]> git.karo-electronics.de Git - karo-tx-uboot.git/blobdiff - drivers/net/cs8900.c
Merge branch 'master' of git://git.denx.de/u-boot-net
[karo-tx-uboot.git] / drivers / net / cs8900.c
index 80c4ba21a6849fd1ab7ed18163eb312a7e35f919..35a9bafaa347fd640eafbcf6acf710df2d6732a6 100644 (file)
 #include "cs8900.h"
 #include <net.h>
 
-#ifdef CONFIG_DRIVER_CS8900
-
-#if defined(CONFIG_CMD_NET)
-
 #undef DEBUG
 
 /* packet page register access functions */
@@ -65,14 +61,14 @@ static unsigned short get_reg_init_bus (int regno)
        c = CS8900_BUS16_0;
 
        CS8900_PPTR = regno;
-       return (unsigned short) CS8900_PDATA;
+       return CS8900_PDATA;
 }
 #endif
 
 static unsigned short get_reg (int regno)
 {
        CS8900_PPTR = regno;
-       return (unsigned short) CS8900_PDATA;
+       return CS8900_PDATA;
 }
 
 
@@ -94,7 +90,7 @@ static void eth_reset (void)
        udelay (200000);
        /* Wait until the chip is reset */
 
-       tmo = get_timer (0) + 1 * CFG_HZ;
+       tmo = get_timer (0) + 1 * CONFIG_SYS_HZ;
        while ((((us = get_reg_init_bus (PP_SelfSTAT)) & PP_SelfSTAT_InitD) == 0)
                   && tmo < get_timer (0))
                /*NOP*/;
@@ -131,7 +127,7 @@ void cs8900_get_enetaddr (uchar * addr)
        if (get_reg_init_bus (PP_ChipID) != 0x630e)
                return;
        eth_reset ();
-       if ((get_reg (PP_SelfST) & (PP_SelfSTAT_EEPROM | PP_SelfSTAT_EEPROM_OK)) ==
+       if ((get_reg (PP_SelfSTAT) & (PP_SelfSTAT_EEPROM | PP_SelfSTAT_EEPROM_OK)) ==
                        (PP_SelfSTAT_EEPROM | PP_SelfSTAT_EEPROM_OK)) {
 
                /* Load the MAC from EEPROM */
@@ -165,10 +161,9 @@ void cs8900_get_enetaddr (uchar * addr)
                                 addr[0], addr[1],
                                 addr[2], addr[3],
                                 addr[4], addr[5]) ;
-                       debug ("### Set environment from HW MAC addr = \"%s\"\n",                               ethaddr);
+                       debug ("### Set environment from HW MAC addr = \"%s\"\n", ethaddr);
                        setenv ("ethaddr", ethaddr);
                }
-
        }
 }
 
@@ -183,7 +178,6 @@ void eth_halt (void)
 
 int eth_init (bd_t * bd)
 {
-
        /* verify chip id */
        if (get_reg_init_bus (PP_ChipID) != 0x630e) {
                printf ("CS8900 Ethernet chip not found?!\n");
@@ -201,7 +195,7 @@ int eth_init (bd_t * bd)
 }
 
 /* Get a data block via Ethernet */
-extern int eth_rx (void)
+int eth_rx (void)
 {
        int i;
        unsigned short rxlen;
@@ -233,7 +227,7 @@ extern int eth_rx (void)
 }
 
 /* Send a data block via Ethernet. */
-extern int eth_send (volatile void *packet, int length)
+int eth_send (volatile void *packet, int length)
 {
        volatile unsigned short *addr;
        int tmo;
@@ -250,7 +244,7 @@ retry:
 #ifdef DEBUG
                printf ("cs: unable to send packet; retrying...\n");
 #endif
-               for (tmo = get_timer (0) + 5 * CFG_HZ; get_timer (0) < tmo;)
+               for (tmo = get_timer (0) + 5 * CONFIG_SYS_HZ; get_timer (0) < tmo;)
                        /*NOP*/;
                eth_reset ();
                eth_reginit ();
@@ -263,7 +257,7 @@ retry:
                CS8900_RTDATA = *addr++;
 
        /* wait for transfer to succeed */
-       tmo = get_timer (0) + 5 * CFG_HZ;
+       tmo = get_timer (0) + 5 * CONFIG_SYS_HZ;
        while ((s = get_reg (PP_TER) & ~0x1F) == 0) {
                if (get_timer (0) >= tmo)
                        break;
@@ -281,7 +275,8 @@ retry:
 
 static void cs8900_e2prom_ready(void)
 {
-       while(get_reg(PP_SelfST) & SI_BUSY);
+       while (get_reg(PP_SelfSTAT) & SI_BUSY)
+               ;
 }
 
 /***********************************************************/
@@ -316,7 +311,3 @@ int cs8900_e2prom_write(unsigned char addr, unsigned short value)
 
        return 0;
 }
-
-#endif /* COMMANDS & CFG_NET */
-
-#endif /* CONFIG_DRIVER_CS8900 */