diff options
author | Shinya Kuribayashi <shinya.kuribayashi@necel.com> | 2008-01-16 16:12:26 +0900 |
---|---|---|
committer | Ben Warren <biggerbadderben@gmail.com> | 2008-01-16 17:37:35 -0500 |
commit | 96a236746fe6a7b84802afb4ed31536696d34812 (patch) | |
tree | e1c36153450c7bca13ea800783353978a2b8d981 /drivers | |
parent | d1276c76c1e2b5035296689280ba1acb2c425104 (diff) | |
download | u-boot-imx-96a236746fe6a7b84802afb4ed31536696d34812.zip u-boot-imx-96a236746fe6a7b84802afb4ed31536696d34812.tar.gz u-boot-imx-96a236746fe6a7b84802afb4ed31536696d34812.tar.bz2 |
drivers/net/rtl8139.c: Fix cache coherency issues
Current driver is meant for cache coherent systems. This patch adds
flush_cache() routines to support cache non-coherent systems.
Signed-off-by: Shinya Kuribayashi <shinya.kuribayashi@necel.com>
Cc: Masami Komiya <mkomiya@sonare.it>
Cc: Lucas Jin <lucasjin@gmail.com>
Signed-off-by: Ben Warren <biggerbadderben@gmail.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/rtl8139.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/drivers/net/rtl8139.c b/drivers/net/rtl8139.c index 5d7ae74..014f3b4 100644 --- a/drivers/net/rtl8139.c +++ b/drivers/net/rtl8139.c @@ -389,6 +389,7 @@ static void rtl_reset(struct eth_device *dev) #ifdef DEBUG_RX printf("rx ring address is %X\n",(unsigned long)rx_ring); #endif + flush_cache((unsigned long)rx_ring, RX_BUF_LEN); outl(phys_to_bus((int)rx_ring), ioaddr + RxBuf); /* If we add multicast support, the MAR0 register would have to be @@ -430,6 +431,7 @@ static int rtl_transmit(struct eth_device *dev, volatile void *packet, int lengt tx_buffer[len++] = '\0'; } + flush_cache((unsigned long)tx_buffer, length); outl(phys_to_bus((int)tx_buffer), ioaddr + TxAddr0 + cur_tx*4); outl(((TX_FIFO_THRESH<<11) & 0x003f0000) | len, ioaddr + TxStatus0 + cur_tx*4); @@ -486,7 +488,8 @@ static int rtl_poll(struct eth_device *dev) #endif ring_offs = cur_rx % RX_BUF_LEN; - rx_status = *(unsigned int*)KSEG1ADDR((rx_ring + ring_offs)); + /* ring_offs is guaranteed being 4-byte aligned */ + rx_status = *(unsigned int *)(rx_ring + ring_offs); rx_size = rx_status >> 16; rx_status &= 0xffff; @@ -516,6 +519,7 @@ static int rtl_poll(struct eth_device *dev) printf("rx packet %d bytes", rx_size-4); #endif } + flush_cache((unsigned long)rx_ring, RX_BUF_LEN); cur_rx = (cur_rx + rx_size + 4 + 3) & ~3; outw(cur_rx - 16, ioaddr + RxBufPtr); |