]> git.kernelconcepts.de Git - karo-tx-uboot.git/blobdiff - drivers/net/natsemi.c
net: lpc32xx: add RMII phy mode support
[karo-tx-uboot.git] / drivers / net / natsemi.c
index 4aee0481dbe48b09b325699394cfd66607b8ccf5..0ed9bb5765cb0ce82fa379884ebaea31c4b2aeb2 100644 (file)
@@ -53,6 +53,7 @@
 #include <common.h>
 #include <malloc.h>
 #include <net.h>
+#include <netdev.h>
 #include <asm/io.h>
 #include <pci.h>
 
@@ -236,8 +237,7 @@ static void natsemi_init_txd(struct eth_device *dev);
 static void natsemi_init_rxd(struct eth_device *dev);
 static void natsemi_set_rx_mode(struct eth_device *dev);
 static void natsemi_check_duplex(struct eth_device *dev);
-static int natsemi_send(struct eth_device *dev, volatile void *packet,
-                       int length);
+static int natsemi_send(struct eth_device *dev, void *packet, int length);
 static int natsemi_poll(struct eth_device *dev);
 static void natsemi_disable(struct eth_device *dev);
 
@@ -281,7 +281,7 @@ OUTL(struct eth_device *dev, int command, u_long addr)
  * ready to send and receive packets.
  *
  * Side effects:
- *            leaves the natsemi initialized, and ready to recieve packets.
+ *            leaves the natsemi initialized, and ready to receive packets.
  *
  * Returns:   struct eth_device *:          pointer to NIC data structure
  */
@@ -320,6 +320,11 @@ natsemi_initialize(bd_t * bis)
                }
 
                dev = (struct eth_device *) malloc(sizeof *dev);
+               if (!dev) {
+                       printf("natsemi: Can not allocate memory\n");
+                       break;
+               }
+               memset(dev, 0, sizeof(*dev));
 
                sprintf(dev->name, "dp83815#%d", card_number);
                dev->iobase = bus_to_phys(iobase);
@@ -408,7 +413,7 @@ natsemi_initialize(bd_t * bis)
    The EEPROM code is for common 93c06/46 EEPROMs w/ 6bit addresses.  */
 
 /* Delay between EEPROM clock transitions.
-   No extra delay is needed with 33Mhz PCI, but future 66Mhz
+   No extra delay is needed with 33MHz PCI, but future 66MHz
    access may need a delay. */
 #define eeprom_delay(ee_addr)  INL(dev, ee_addr)
 
@@ -748,12 +753,12 @@ natsemi_check_duplex(struct eth_device *dev)
  * Description: transmits a packet and waits for completion or timeout.
  *
  * Returns:   void.  */
-static int
-natsemi_send(struct eth_device *dev, volatile void *packet, int length)
+static int natsemi_send(struct eth_device *dev, void *packet, int length)
 {
        u32 i, status = 0;
        u32 tx_status = 0;
-       vu_long *res = (vu_long *)&tx_status;
+       u32 *tx_ptr = &tx_status;
+       vu_long *res = (vu_long *)tx_ptr;
 
        /* Stop the transmitter */
        OUTL(dev, TxOff, ChipCmd);
@@ -836,7 +841,8 @@ natsemi_poll(struct eth_device *dev)
                     rx_status);
                retstat = 0;
        } else {                /* give packet to higher level routine */
-               NetReceive((rxb + cur_rx * RX_BUF_SIZE), length);
+               net_process_received_packet((rxb + cur_rx * RX_BUF_SIZE),
+                                           length);
                retstat = 1;
        }