net: Adds Fast Ethernet Controller driver for Armada100
[oweals/u-boot.git] / drivers / net / ns8382x.c
index 0b9a3ae66d3ecd4823dfc8620faa8cafa602f3d9..6dfcd0e94c77ff7e1fad014185fc447102449703 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>
 
@@ -298,7 +299,7 @@ OUTL(struct eth_device *dev, int command, u_long addr)
  * Description: Retrieves the MAC address of the card, and sets up some
  *  globals required by other routines, and initializes the NIC, making it
  *  ready to send and receive packets.
- * Side effects: initializes ns8382xs, ready to recieve packets.
+ * Side effects: initializes ns8382xs, ready to receive packets.
  * Returns:   int:          number of cards found
  */
 
@@ -339,6 +340,11 @@ ns8382x_initialize(bd_t * bis)
                }
 
                dev = (struct eth_device *) malloc(sizeof *dev);
+               if (!dev) {
+                       printf("ns8382x: Can not allocate memory\n");
+                       break;
+               }
+               memset(dev, 0, sizeof(*dev));
 
                sprintf(dev->name, "dp8382x#%d", card_number);
                dev->iobase = bus_to_phys(iobase);
@@ -444,7 +450,7 @@ ns8382x_initialize(bd_t * bis)
        Read and write MII registers using software-generated serial MDIO
        protocol.  See the MII specifications or DP83840A data sheet for details.
 
-       The maximum data clock rate is 2.5 Mhz.  To meet minimum timing we
+       The maximum data clock rate is 2.5 MHz.  To meet minimum timing we
        must flush writes to the PCI bus with a PCI read. */
 #define mdio_delay(mdio_addr) INL(dev, mdio_addr)
 
@@ -770,14 +776,14 @@ ns8382x_send(struct eth_device *dev, volatile void *packet, int length)
 
        for (i = 0; (tx_stat = le32_to_cpu(txd.cmdsts)) & DescOwn; i++) {
                if (i >= TOUT_LOOP) {
-                       printf ("%s: tx error buffer not ready: txd.cmdsts %#X\n",
+                       printf ("%s: tx error buffer not ready: txd.cmdsts %#lX\n",
                             dev->name, tx_stat);
                        goto Done;
                }
        }
 
        if (!(tx_stat & DescPktOK)) {
-               printf("ns8382x_send: Transmit error, Tx status %X.\n", tx_stat);
+               printf("ns8382x_send: Transmit error, Tx status %lX.\n", tx_stat);
                goto Done;
        }
 #ifdef NS8382X_DEBUG