Message ID | 1391594051-4947-1-git-send-email-list-09_u-boot@tqsc.de |
---|---|
State | Accepted |
Delegated to: | Stefano Babic |
Headers | show |
Hi Marcus, On 05/02/2014 10:54, Markus Niebel wrote: > From: Markus Niebel <Markus.Niebel@tqs.de> > > The prescaler value for MDC is calculated wrong for > MX6S. Implement the same logic as linux here which handles > ENET_MAC different then original FEC. > > Tested on a custom board with i.MX6S and 100MBit PHY > > Signed-off-by: Markus Niebel <Markus.Niebel@tqs.de> > --- > drivers/net/fec_mxc.c | 8 ++++++-- > 1 file changed, 6 insertions(+), 2 deletions(-) > > diff --git a/drivers/net/fec_mxc.c b/drivers/net/fec_mxc.c > index 3b2b995..4cefda4 100644 > --- a/drivers/net/fec_mxc.c > +++ b/drivers/net/fec_mxc.c > @@ -128,8 +128,12 @@ static void fec_mii_setspeed(struct ethernet_regs *eth) > * Set MII_SPEED = (1/(mii_speed * 2)) * System Clock > * and do not drop the Preamble. > */ > - writel((((imx_get_fecclk() / 1000000) + 2) / 5) << 1, > - ð->mii_speed); > + register u32 speed = DIV_ROUND_UP(imx_get_fecclk(), 5000000); > +#ifdef FEC_QUIRK_ENET_MAC > + speed--; > +#endif > + speed <<= 1; > + writel(speed, ð->mii_speed); > debug("%s: mii_speed %08x\n", __func__, readl(ð->mii_speed)); > } Thanks for this - I go for merging.. Best regards, Stefano Babic
On 05/02/2014 10:54, Markus Niebel wrote: > From: Markus Niebel <Markus.Niebel@tqs.de> > > The prescaler value for MDC is calculated wrong for > MX6S. Implement the same logic as linux here which handles > ENET_MAC different then original FEC. > > Tested on a custom board with i.MX6S and 100MBit PHY > > Signed-off-by: Markus Niebel <Markus.Niebel@tqs.de> > --- Applied to u-boot-imx, thanks ! Best regards, Stefano Babic
diff --git a/drivers/net/fec_mxc.c b/drivers/net/fec_mxc.c index 3b2b995..4cefda4 100644 --- a/drivers/net/fec_mxc.c +++ b/drivers/net/fec_mxc.c @@ -128,8 +128,12 @@ static void fec_mii_setspeed(struct ethernet_regs *eth) * Set MII_SPEED = (1/(mii_speed * 2)) * System Clock * and do not drop the Preamble. */ - writel((((imx_get_fecclk() / 1000000) + 2) / 5) << 1, - ð->mii_speed); + register u32 speed = DIV_ROUND_UP(imx_get_fecclk(), 5000000); +#ifdef FEC_QUIRK_ENET_MAC + speed--; +#endif + speed <<= 1; + writel(speed, ð->mii_speed); debug("%s: mii_speed %08x\n", __func__, readl(ð->mii_speed)); }