On 18 March 2015 at 11:28, Jonas Gorski <j...@openwrt.org> wrote: > On Wed, Mar 18, 2015 at 10:02 AM, Rafał Miłecki <zaj...@gmail.com> wrote: >> Signed-off-by: Rafał Miłecki <zaj...@gmail.com> >> --- >> .../generic/files/drivers/net/phy/b53/b53_common.c | 23 >> +++++++++++++++++++++- >> .../generic/files/drivers/net/phy/b53/b53_regs.h | 1 + >> 2 files changed, 23 insertions(+), 1 deletion(-) >> >> 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 e44d194..4597742 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 >> @@ -525,7 +525,7 @@ static int b53_switch_reset(struct b53_device *dev) >> return -EINVAL; >> } >> } >> - } else if ((is531x5(dev) || is5301x(dev)) && dev->sw_dev.cpu_port == >> B53_CPU_PORT) { >> + } else if (is531x5(dev) && dev->sw_dev.cpu_port == B53_CPU_PORT) { >> u8 mii_port_override; >> >> b53_read8(dev, B53_CTRL_PAGE, B53_PORT_OVERRIDE_CTRL, >> @@ -533,6 +533,27 @@ 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)) { >> + /* >> + * CPU interface attached to port 8 requires specific >> handling. >> + * It uses different overriding register and extra ports 5 >> and 7 >> + * need to be configured as well. >> + */ >> + if (dev->sw_dev.cpu_port == 8) { >> + u8 mii_port_override; >> + >> + b53_read8(dev, B53_CTRL_PAGE, B53_PORT_OVERRIDE_CTRL, >> + &mii_port_override); >> + mii_port_override |= PORT_OVERRIDE_LINK | >> + PORT_OVERRIDE_RX_FLOW | >> + PORT_OVERRIDE_TX_FLOW | >> + PORT_OVERRIDE_SPEED_2000M | >> + PORT_OVERRIDE_EN; >> + b53_write8(dev, B53_CTRL_PAGE, >> B53_PORT_OVERRIDE_CTRL, >> + mii_port_override); >> + } else { >> + pr_warn("overriding CPU port other than 8 is not >> supported yet\n"); >> + } >> } >> >> b53_enable_mib(dev); > > How about > > @@ -530,9 +530,16 @@ static int b53_switch_reset(struct b53_device *dev) > > b53_read8(dev, B53_CTRL_PAGE, B53_PORT_OVERRIDE_CTRL, > &mii_port_override); > + > + mii_port_override |= PORT_OVERRIDE_LINK | PORT_OVERRIDE_EN; > + > + if (is5301x(dev)) > + mii_port_override |= PORT_OVERRIDE_RX_FLOW | > + PORT_OVERRIDE_TX_FLOW | > + PORT_OVERRIDE_SPEED_2000M; > + > b53_write8(dev, B53_CTRL_PAGE, B53_PORT_OVERRIDE_CTRL, > - mii_port_override | PORT_OVERRIDE_EN | > - PORT_OVERRIDE_LINK); > + mii_port_override); > } > > b53_enable_mib(dev); > > instead of creating a full new branch?
As the comment says, this code for BCM5301X will be extended. This is because of this 2000M speed, which requires configuring 3 ports. It seems communication between switch and CPU interface with such speed couldn't be handled with only a single port. Broadcom decided to use 3 ports in total for that. I don't have that code ready and I also don't like patch bombs, so I started with this simple change. However because of further development plans I vote for a separated branch. -- Rafał _______________________________________________ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel