NET: fec_mxc: fix MDIO clock prescaler calculation
PATCH 1/1 NET: fec_mxc: fix MDIO clock prescaler calculation
From: Markus Niebel <[email protected]>
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
--- drivers/net/fec_mxc.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/net/fec_mxc.c +6 -2
@@ -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); + registeru32 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)); }
Signature · 1 line
1.7.9.5
PATCH 1/1 NET: fec_mxc: fix MDIO clock prescaler calculation
Hi Marcus,
Quoted 21 lines · Markus Niebel
From: Markus Niebel <[email protected]>
The prescaler value for MDC is calculated wrong for MX6S. Implement the same logic as linux here which handles
ENET_MACdifferent then original FEC.Tested on a custom board with i.MX6S and 100MBit PHY
Signed-off-by Markus Niebel <[email protected]>--- drivers/net/fec_mxc.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)drivers/net/fec_mxc.c +0
-0@@ -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. */
drivers/net/fec_mxc.c static void fec_mii_setspeed(struct ethernet_regs *eth) · line 138
Quoted 10 lines
drivers/net/fec_mxc.c +6
-2-writel ((((imx_get_fecclk () /1000000 ) +2 ) /5 ) <<1 , - ð->mii_speed); + registeru32 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
Signature · 5 lines
===================================================================== DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de =====================================================================
PATCH 1/1 NET: fec_mxc: fix MDIO clock prescaler calculation
In reply to Markus NiebelQuoted 10 lines · Markus Niebel
From: Markus Niebel <[email protected]>
The prescaler value for MDC is calculated wrong for MX6S. Implement the same logic as linux here which handles
ENET_MACdifferent then original FEC.Tested on a custom board with i.MX6S and 100MBit PHY
Signed-off-by Markus Niebel <[email protected]>---
Applied to u-boot-imx, thanks !
Best regards,
Stefano Babic
Signature · 5 lines
===================================================================== DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de =====================================================================