summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorMarkus Niebel <Markus.Niebel@tqs.de>2014-02-05 10:54:11 +0100
committerStefano Babic <sbabic@denx.de>2014-02-11 11:33:45 +0100
commit6ba45cc0f8b46533965219cfd90864a60ec1009b (patch)
tree1627b25a018f4779f79d4e7590e790ff094aed3f /drivers
parentadadc915b31c4d55561c2703849f92cddfa8ad24 (diff)
downloadu-boot-imx-6ba45cc0f8b46533965219cfd90864a60ec1009b.zip
u-boot-imx-6ba45cc0f8b46533965219cfd90864a60ec1009b.tar.gz
u-boot-imx-6ba45cc0f8b46533965219cfd90864a60ec1009b.tar.bz2
NET: fec_mxc: fix MDIO clock prescaler calculation
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>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/fec_mxc.c8
1 files 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,
- &eth->mii_speed);
+ register u32 speed = DIV_ROUND_UP(imx_get_fecclk(), 5000000);
+#ifdef FEC_QUIRK_ENET_MAC
+ speed--;
+#endif
+ speed <<= 1;
+ writel(speed, &eth->mii_speed);
debug("%s: mii_speed %08x\n", __func__, readl(&eth->mii_speed));
}