X-Git-Url: https://git.kernelconcepts.de/?a=blobdiff_plain;f=drivers%2Fnet%2Ftsi108_eth.c;h=9da59a018acf7889ad4ee7ee239eaf3cf6be6307;hb=3d3d12d100c277281f16794178dd129b6f3dc745;hp=50fa765f7019aef3c2de40e19ec3a12a062bb50f;hpb=16116ddd0d0158f4e91c91dc979b845b6e98a99d;p=karo-tx-uboot.git diff --git a/drivers/net/tsi108_eth.c b/drivers/net/tsi108_eth.c index 50fa765f70..9da59a018a 100644 --- a/drivers/net/tsi108_eth.c +++ b/drivers/net/tsi108_eth.c @@ -2,23 +2,7 @@ * * Copyright (c) 2005 Freescale Semiconductor, Inc. * - * See file CREDITS for list of people who contributed to this - * project. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of - * the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, - * MA 02111-1307 USA + * SPDX-License-Identifier: GPL-2.0+ * * Description: * Ethernet interface for Tundra TSI108 bridge chip @@ -54,7 +38,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 @@ -433,8 +417,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, @@ -731,7 +714,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); @@ -817,11 +804,11 @@ static int tsi108_eth_probe (struct eth_device *dev, bd_t * bis) rx_descr_current = rx_descr; for (index = 0; index < NUM_RX_DESC; index++) { /* make sure the receive buffers are not in cache */ - invalidate_dcache_range((unsigned long)NetRxPackets[index], - (unsigned long)NetRxPackets[index] + + invalidate_dcache_range((unsigned long)net_rx_packets[index], + (unsigned long)net_rx_packets[index] + RX_BUFFER_SIZE); rx_descr->start_addr0 = - cpu_to_le32((vuint32) NetRxPackets[index]); + cpu_to_le32((vuint32) net_rx_packets[index]); rx_descr->start_addr1 = 0; rx_descr->next_descr_addr0 = cpu_to_le32((vuint32) (rx_descr + 1)); @@ -868,8 +855,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; @@ -944,7 +930,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; @@ -979,10 +965,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)); + net_process_received_packet(buffer, length); invalidate_dcache_range ((unsigned long)buffer, (unsigned long)buffer +