X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=drivers%2Fnet%2Ftsi108_eth.c;h=b2c1be54fe4f9b05cc39a89f2c528e74a0812800;hb=a098cf41fdb2a6607c675f7fe4f3164617c9367e;hp=2534097df5577e01250728feb7e921b8ab5fa6aa;hpb=a07351fdbad1a92746d75a195eaef25d146c7f87;p=u-boot diff --git a/drivers/net/tsi108_eth.c b/drivers/net/tsi108_eth.c index 2534097df5..b2c1be54fe 100644 --- a/drivers/net/tsi108_eth.c +++ b/drivers/net/tsi108_eth.c @@ -34,6 +34,7 @@ #include #include #include +#include #include #ifdef DEBUG @@ -53,7 +54,7 @@ printf ("%s %d: " fmt, __FUNCTION__, __LINE__, ##args) #define RX_PRINT_ERRORS #define TX_PRINT_ERRORS -#define ETH_BASE (CFG_TSI108_CSR_BASE + 0x6000) +#define ETH_BASE (CONFIG_SYS_TSI108_CSR_BASE + 0x6000) #define ETH_PORT_OFFSET 0x400 @@ -432,8 +433,7 @@ static struct dma_descriptor rx_descr_array[NUM_RX_DESC] static struct dma_descriptor *rx_descr_current; static int tsi108_eth_probe (struct eth_device *dev, bd_t * bis); -static int tsi108_eth_send (struct eth_device *dev, - volatile void *packet, int length); +static int tsi108_eth_send(struct eth_device *dev, void *packet, int length); static int tsi108_eth_recv (struct eth_device *dev); static void tsi108_eth_halt (struct eth_device *dev); static unsigned int read_phy (unsigned int base, @@ -730,7 +730,11 @@ int tsi108_eth_initialize (bd_t * bis) for (index = 0; index < CONFIG_TSI108_ETH_NUM_PORTS; index++) { dev = (struct eth_device *)malloc(sizeof(struct eth_device)); - + if (!dev) { + printf("tsi108: Can not allocate memory\n"); + break; + } + memset(dev, 0, sizeof(*dev)); sprintf (dev->name, "TSI108_eth%d", index); dev->iobase = ETH_BASE + (index * ETH_PORT_OFFSET); @@ -867,8 +871,7 @@ static int tsi108_eth_probe (struct eth_device *dev, bd_t * bis) /* * send a packet */ -static int tsi108_eth_send (struct eth_device *dev, - volatile void *packet, int length) +static int tsi108_eth_send(struct eth_device *dev, void *packet, int length) { unsigned long base; int timeout; @@ -943,7 +946,7 @@ static int tsi108_eth_recv (struct eth_device *dev) unsigned long base; int length = 0; unsigned long status; - volatile uchar *buffer; + uchar *buffer; base = dev->iobase; @@ -978,10 +981,8 @@ static int tsi108_eth_recv (struct eth_device *dev) le32_to_cpu(rx_descr->vlan_byte_count) & 0xFFFF; /*** process packet ***/ - buffer = - (volatile uchar - *)(le32_to_cpu (rx_descr->start_addr0)); - NetReceive (buffer, length); + buffer = (uchar *)(le32_to_cpu(rx_descr->start_addr0)); + NetReceive(buffer, length); invalidate_dcache_range ((unsigned long)buffer, (unsigned long)buffer +