diff options
author | Ye.Li <B37916@freescale.com> | 2014-06-10 18:40:47 +0800 |
---|---|---|
committer | Ye.Li <B37916@freescale.com> | 2014-06-17 11:13:55 +0800 |
commit | 3a6e8ad55fb8ccf09caa9e258e4b5aa21631c203 (patch) | |
tree | e2e06f46eacccb3b44f106add90fb7d325c434ba /drivers | |
parent | 1d442553d0b201dc23e3ed0e0e434c2aa6f43d1f (diff) | |
download | u-boot-imx-3a6e8ad55fb8ccf09caa9e258e4b5aa21631c203.zip u-boot-imx-3a6e8ad55fb8ccf09caa9e258e4b5aa21631c203.tar.gz u-boot-imx-3a6e8ad55fb8ccf09caa9e258e4b5aa21631c203.tar.bz2 |
ENGR00315894-53 ENET:FEC Update fec_mxc driver for iMX6SX
1. iMX6SX enet rx have 64 bytes alignment limitation for DMA transfer.
For i.MX6SX platform, need to add below define in config file:
#define CONFIG_FEC_DMA_MINALIGN 64
2. Change to check READY bit in BD, not check the TDAR. On iMX6SX, FEC will
clear the TDAR prior than the READY bit of last BD. Since fec driver only
prepare two BD for transmit, this cause the BD send failed at the third
packet.
Signed-off-by: Fugang Duan <B38611@freescale.com>
Signed-off-by: Ye.Li <B37916@freescale.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/fec_mxc.c | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/drivers/net/fec_mxc.c b/drivers/net/fec_mxc.c index 4cefda4..c3c07ed 100644 --- a/drivers/net/fec_mxc.c +++ b/drivers/net/fec_mxc.c @@ -286,7 +286,11 @@ static void fec_rbd_init(struct fec_priv *fec, int count, int dsize) * Reload the RX descriptors with default values and wipe * the RX buffers. */ +#if defined(CONFIG_FEC_DMA_MINALIGN) + size = roundup(dsize, CONFIG_FEC_DMA_MINALIGN); +#else size = roundup(dsize, ARCH_DMA_MINALIGN); +#endif for (i = 0; i < count; i++) { data = (uint8_t *)fec->rbd_base[i].data_pointer; memset(data, 0, dsize); @@ -707,17 +711,14 @@ static int fec_send(struct eth_device *dev, void *packet, int length) * barrier here. */ while (--timeout) { - if (!(readl(&fec->eth->x_des_active) & FEC_X_DES_ACTIVE_TDAR)) + invalidate_dcache_range(addr, addr + size); + if (!(readw(&fec->tbd_base[fec->tbd_index].status) & FEC_TBD_READY)) break; } if (!timeout) ret = -EINVAL; - invalidate_dcache_range(addr, addr + size); - if (readw(&fec->tbd_base[fec->tbd_index].status) & FEC_TBD_READY) - ret = -EINVAL; - debug("fec_send: status 0x%x index %d ret %i\n", readw(&fec->tbd_base[fec->tbd_index].status), fec->tbd_index, ret); @@ -881,9 +882,17 @@ static int fec_alloc_descs(struct fec_priv *fec) /* Allocate RX buffers. */ /* Maximum RX buffer size. */ +#if defined(CONFIG_FEC_DMA_MINALIGN) + size = roundup(FEC_MAX_PKT_SIZE, CONFIG_FEC_DMA_MINALIGN); +#else size = roundup(FEC_MAX_PKT_SIZE, ARCH_DMA_MINALIGN); +#endif for (i = 0; i < FEC_RBD_NUM; i++) { +#if defined(CONFIG_FEC_DMA_MINALIGN) + data = memalign(CONFIG_FEC_DMA_MINALIGN, size); +#else data = memalign(ARCH_DMA_MINALIGN, size); +#endif if (!data) { printf("%s: error allocating rxbuf %d\n", __func__, i); goto err_ring; |