diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2012-04-12 23:21:18 +0200 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2012-04-24 10:31:47 +0200 |
commit | 86cfd96af42178a85ec085ddd5e2f471a02041db (patch) | |
tree | 63a29371fbcaf38dbc437fe03e7e83149d94f4ee | |
parent | e0c18c08665b93b3c81eb7ab504238cda85c2674 (diff) | |
download | barebox-86cfd96af42178a85ec085ddd5e2f471a02041db.tar.gz barebox-86cfd96af42178a85ec085ddd5e2f471a02041db.tar.xz |
net fec: Add i.MX6 support
Currently only 100Mb/s is tested. Freescale's U-Boot suggests that
there are some additional adjustments necessary for Gigabit support.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
-rw-r--r-- | drivers/net/fec_imx.c | 25 | ||||
-rw-r--r-- | include/fec.h | 1 |
2 files changed, 23 insertions, 3 deletions
diff --git a/drivers/net/fec_imx.c b/drivers/net/fec_imx.c index 08cd761438..599a9b4099 100644 --- a/drivers/net/fec_imx.c +++ b/drivers/net/fec_imx.c @@ -274,7 +274,7 @@ static int fec_set_hwaddr(struct eth_device *dev, unsigned char *mac) static int fec_init(struct eth_device *dev) { struct fec_priv *fec = (struct fec_priv *)dev->priv; - u32 rcntl; + u32 rcntl, xwmrk; /* * Clear FEC-Lite interrupt event register(IEVENT) @@ -317,13 +317,25 @@ static int fec_init(struct eth_device *dev) writel(FEC_MIIGSK_ENR_EN, fec->regs + FEC_MIIGSK_ENR); } } + + if (fec->xcv_type == RGMII) + rcntl |= 1 << 6; + writel(rcntl, fec->regs + FEC_R_CNTRL); /* * Set Opcode/Pause Duration Register */ writel(0x00010020, fec->regs + FEC_OP_PAUSE); - writel(0x2, fec->regs + FEC_X_WMRK); + + xwmrk = 0x2; + + /* set ENET tx at store and forward mode */ + if (cpu_is_mx6()) + xwmrk |= 1 << 8; + + writel(xwmrk, fec->regs + FEC_X_WMRK); + /* * Set multicast address filter */ @@ -349,6 +361,7 @@ static int fec_open(struct eth_device *edev) { struct fec_priv *fec = (struct fec_priv *)edev->priv; int ret; + u32 ecr; /* * Initialize RxBD/TxBD rings @@ -363,7 +376,13 @@ static int fec_open(struct eth_device *edev) /* * Enable FEC-Lite controller */ - writel(FEC_ECNTRL_ETHER_EN, fec->regs + FEC_ECNTRL); + ecr = FEC_ECNTRL_ETHER_EN; + + /* Enable Swap to support little-endian device */ + if (cpu_is_mx6()) + ecr |= 0x100; + + writel(ecr, fec->regs + FEC_ECNTRL); /* * Enable SmartDMA receive task */ diff --git a/include/fec.h b/include/fec.h index 85691b6854..f56b02309d 100644 --- a/include/fec.h +++ b/include/fec.h @@ -33,6 +33,7 @@ typedef enum { MII10, MII100, RMII, + RGMII, } xceiver_type; /* |