[OpenWrt-Devel] [PATCH] b53: override CPU port state on BCM5301X with CPU port other than 8

2015-04-12 Thread Rafał Miłecki
Newer revisions (5+) of BCM53011 and probably all revs of BCM53012
require overriding CPU port to work. So far we were handling it only for
CPU port 8, but some devices may use e.g. port 5. In such case we need
to use recently defined GMII_PORT registers.
It was tested for regressions on BCM53011 revs 2  3. It was also
confirmed to fix switch on some internal Broadcom board.

Signed-off-by: Rafał Miłecki zaj...@gmail.com
---
 .../linux/generic/files/drivers/net/phy/b53/b53_common.c  | 15 +++
 1 file changed, 15 insertions(+)

diff --git a/target/linux/generic/files/drivers/net/phy/b53/b53_common.c 
b/target/linux/generic/files/drivers/net/phy/b53/b53_common.c
index d2bb51a..87c4d5b 100644
--- a/target/linux/generic/files/drivers/net/phy/b53/b53_common.c
+++ b/target/linux/generic/files/drivers/net/phy/b53/b53_common.c
@@ -534,6 +534,21 @@ static int b53_switch_reset(struct b53_device *dev)
b53_write8(dev, B53_CTRL_PAGE, B53_PORT_OVERRIDE_CTRL,
   mii_port_override | PORT_OVERRIDE_EN |
   PORT_OVERRIDE_LINK);
+   } else if (is5301x(dev)) {
+   if (dev-sw_dev.cpu_port == 8) {
+   /* TODO: Ports 5  7 require some extra handling */
+   } else {
+   u8 po_reg = 
B53_GMII_PORT_OVERRIDE_CTRL(dev-sw_dev.cpu_port);
+   u8 gmii_po;
+
+   b53_read8(dev, B53_CTRL_PAGE, po_reg, gmii_po);
+   gmii_po |= GMII_PO_LINK |
+  GMII_PO_RX_FLOW |
+  GMII_PO_TX_FLOW |
+  GMII_PO_EN |
+  GMII_PO_SPEED_2000M;
+   b53_write8(dev, B53_CTRL_PAGE, po_reg, gmii_po);
+   }
}
 
b53_enable_mib(dev);
-- 
1.8.4.5
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCH] b53: override CPU port state on BCM5301X with CPU port other than 8

2015-04-12 Thread Jonas Gorski
On Sun, Apr 12, 2015 at 6:03 PM, Rafał Miłecki zaj...@gmail.com wrote:
 Newer revisions (5+) of BCM53011 and probably all revs of BCM53012
 require overriding CPU port to work. So far we were handling it only for
 CPU port 8, but some devices may use e.g. port 5. In such case we need
 to use recently defined GMII_PORT registers.
 It was tested for regressions on BCM53011 revs 2  3. It was also
 confirmed to fix switch on some internal Broadcom board.

 Signed-off-by: Rafał Miłecki zaj...@gmail.com
 ---
  .../linux/generic/files/drivers/net/phy/b53/b53_common.c  | 15 
 +++
  1 file changed, 15 insertions(+)

 diff --git a/target/linux/generic/files/drivers/net/phy/b53/b53_common.c 
 b/target/linux/generic/files/drivers/net/phy/b53/b53_common.c
 index d2bb51a..87c4d5b 100644
 --- a/target/linux/generic/files/drivers/net/phy/b53/b53_common.c
 +++ b/target/linux/generic/files/drivers/net/phy/b53/b53_common.c
 @@ -534,6 +534,21 @@ static int b53_switch_reset(struct b53_device *dev)
 b53_write8(dev, B53_CTRL_PAGE, B53_PORT_OVERRIDE_CTRL,
mii_port_override | PORT_OVERRIDE_EN |
PORT_OVERRIDE_LINK);
 +   } else if (is5301x(dev)) {
 +   if (dev-sw_dev.cpu_port == 8) {
 +   /* TODO: Ports 5  7 require some extra handling */

This branch can never be reached because the previous has

else if ((is531x5(dev) || is5301x(dev)) 
   dev-sw_dev.cpu_port == B53_CPU_PORT) { /*
B53_CPU_PORT is 8 */


 +   } else {
 +   u8 po_reg = 
 B53_GMII_PORT_OVERRIDE_CTRL(dev-sw_dev.cpu_port);
 +   u8 gmii_po;
 +
 +   b53_read8(dev, B53_CTRL_PAGE, po_reg, gmii_po);
 +   gmii_po |= GMII_PO_LINK |
 +  GMII_PO_RX_FLOW |
 +  GMII_PO_TX_FLOW |
 +  GMII_PO_EN |
 +  GMII_PO_SPEED_2000M;
 +   b53_write8(dev, B53_CTRL_PAGE, po_reg, gmii_po);
 +   }
 }

 b53_enable_mib(dev);

Jonas
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCH] b53: override CPU port state on BCM5301X with CPU port other than 8

2015-04-12 Thread Rafał Miłecki
On 12 April 2015 at 18:16, Jonas Gorski j...@openwrt.org wrote:
 On Sun, Apr 12, 2015 at 6:03 PM, Rafał Miłecki zaj...@gmail.com wrote:
 Newer revisions (5+) of BCM53011 and probably all revs of BCM53012
 require overriding CPU port to work. So far we were handling it only for
 CPU port 8, but some devices may use e.g. port 5. In such case we need
 to use recently defined GMII_PORT registers.
 It was tested for regressions on BCM53011 revs 2  3. It was also
 confirmed to fix switch on some internal Broadcom board.

 Signed-off-by: Rafał Miłecki zaj...@gmail.com
 ---
  .../linux/generic/files/drivers/net/phy/b53/b53_common.c  | 15 
 +++
  1 file changed, 15 insertions(+)

 diff --git a/target/linux/generic/files/drivers/net/phy/b53/b53_common.c 
 b/target/linux/generic/files/drivers/net/phy/b53/b53_common.c
 index d2bb51a..87c4d5b 100644
 --- a/target/linux/generic/files/drivers/net/phy/b53/b53_common.c
 +++ b/target/linux/generic/files/drivers/net/phy/b53/b53_common.c
 @@ -534,6 +534,21 @@ static int b53_switch_reset(struct b53_device *dev)
 b53_write8(dev, B53_CTRL_PAGE, B53_PORT_OVERRIDE_CTRL,
mii_port_override | PORT_OVERRIDE_EN |
PORT_OVERRIDE_LINK);
 +   } else if (is5301x(dev)) {
 +   if (dev-sw_dev.cpu_port == 8) {
 +   /* TODO: Ports 5  7 require some extra handling */

 This branch can never be reached because the previous has

 else if ((is531x5(dev) || is5301x(dev)) 
dev-sw_dev.cpu_port == B53_CPU_PORT) { /*
 B53_CPU_PORT is 8 */

Yes, as discussed with you earlier, I didn't move the code from
previous branch yet, since there weren't any differences. Once we
implement differences in port 8 handling on BCM5301X all the code
should be moved to the new branch and condition should be changed.

-- 
Rafał
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel