]> git.kernelconcepts.de Git - karo-tx-uboot.git/commitdiff
* Patch by Vladimir Gurevich, 04 Jun 2003: LABEL_2003_06_05_2140
authorwdenk <wdenk>
Thu, 5 Jun 2003 19:37:36 +0000 (19:37 +0000)
committerwdenk <wdenk>
Thu, 5 Jun 2003 19:37:36 +0000 (19:37 +0000)
  make ppc405 ethernet driver compatible with CONFIG_NET_MULTI option

CHANGELOG
cpu/ppc4xx/405gp_enet.c
include/405gp_enet.h
net/eth.c

index b613c19a801d47cdb51e258659171d047a70b651..bcb77767389efb64086445b58f4294d6cfee31fb 100644 (file)
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -2,6 +2,9 @@
 Changes since U-Boot 0.3.1:
 ======================================================================
 
+* Patch by Vladimir Gurevich, 04 Jun 2003:
+  make ppc405 ethernet driver compatible with CONFIG_NET_MULTI option
+
 * Patch by Stefan Roese, 05 Jun 2003:
   - PPC4xx: Fix bug for initial stack in data cache as pointed out by
     Thomas Schaefer (tschaefer@giga-stream.de). Now inital stack in
index af3c1b788b25ef82c67003ec5ca7a676d1c225b6..b7b03edbeb3409edd795e17bc011a3aa4d4b98d9 100644 (file)
@@ -173,17 +173,16 @@ static bd_t *bis_save = NULL;     /* for eth_init upon mal error */
 static int is_receiving = 0;   /* sync with eth interrupt */
 static int print_speed = 1;    /* print speed message upon start */
 
-static void enet_rcv (unsigned long malisr);
-
 /*-----------------------------------------------------------------------------+
  * Prototypes and externals.
  *-----------------------------------------------------------------------------*/
-void mal_err (unsigned long isr, unsigned long uic, unsigned long mal_def,
+static void enet_rcv (unsigned long malisr);
+static int  enetInt(void);
+static void mal_err (unsigned long isr, unsigned long uic, unsigned long mal_def,
              unsigned long mal_errr);
-void emac_err (unsigned long isr);
+static void emac_err (unsigned long isr);
 
-
-void eth_halt (void)
+static void ppc_4xx_eth_halt (struct eth_device *dev)
 {
        mtdcr (malier, 0x00000000);     /* disable mal interrupts */
        out32 (EMAC_IER, 0x00000000);   /* disable emac interrupts */
@@ -202,7 +201,7 @@ void eth_halt (void)
 }
 
 
-int eth_init (bd_t * bis)
+static int ppc_4xx_eth_init (struct eth_device *dev, bd_t * bis)
 {
        int i;
        unsigned long reg;
@@ -478,11 +477,11 @@ int eth_init (bd_t * bis)
        bis_save = bis;
        first_init = 1;
 
-       return (0);
+       return (1);
 }
 
 
-int eth_send (volatile void *ptr, int len)
+static int ppc_4xx_eth_send (struct eth_device *dev, volatile void *ptr, int len)
 {
        struct enet_frame *ef_ptr;
        ulong time_start, time_now;
@@ -539,7 +538,7 @@ int eth_send (volatile void *ptr, int len)
                                return (-1);
                        }
                } else {
-                       return (0);
+                       return (len);
                }
        }
 }
@@ -696,7 +695,7 @@ int enetInt ()
 /*-----------------------------------------------------------------------------+
  *  MAL Error Routine
  *-----------------------------------------------------------------------------*/
-void mal_err (unsigned long isr, unsigned long uic, unsigned long maldef,
+static void mal_err (unsigned long isr, unsigned long uic, unsigned long maldef,
              unsigned long mal_errr)
 {
        mtdcr (malesr, isr);            /* clear interrupt */
@@ -724,7 +723,7 @@ void mal_err (unsigned long isr, unsigned long uic, unsigned long maldef,
 /*-----------------------------------------------------------------------------+
  *  EMAC Error Routine
  *-----------------------------------------------------------------------------*/
-void emac_err (unsigned long isr)
+static void emac_err (unsigned long isr)
 {
        printf ("EMAC error occured.... ISR = %lx\n", isr);
        out32 (EMAC_ISR, isr);
@@ -816,7 +815,7 @@ static void enet_rcv (unsigned long malisr)
 }
 
 
-int eth_rx (void)
+static int ppc_4xx_eth_rx (struct eth_device *dev)
 {
        int length;
        int user_index;
@@ -864,4 +863,46 @@ int eth_rx (void)
        return length;
 }
 
+#if defined(CONFIG_NET_MULTI)
+int ppc_4xx_eth_initialize(bd_t *bis)
+{
+        struct eth_device *dev;
+        int                eth_num = 0;
+
+        dev = malloc (sizeof *dev);
+        if (dev == NULL) {
+                printf(__FUNCTION__ ": Cannot allocate eth_device\n");
+                return (-1);
+        }
+
+        sprintf(dev->name, "ppc_4xx_eth%d", eth_num);
+        dev->priv = (void *) eth_num;
+        dev->init = ppc_4xx_eth_init;
+        dev->halt = ppc_4xx_eth_halt;
+        dev->send = ppc_4xx_eth_send;
+        dev->recv = ppc_4xx_eth_rx;
+
+        eth_register (dev);
+}
+#else /* !defined(CONFIG_NET_MULTI) */
+void eth_halt (void)
+{
+        ppc_4xx_eth_halt(NULL);
+}
+
+int eth_init (bd_t *bis)
+{
+        return (ppc_4xx_eth_init(NULL, bis));
+}
+int eth_send(volatile void *packet, int length)
+{
+        return (ppc_4xx_eth_send(NULL, packet, length));
+}
+
+int eth_rx(void)
+{
+        return (ppc_4xx_eth_rx(NULL));
+}
+#endif /* !defined(CONFIG_NET_MULTI) */
+
 #endif /* CONFIG_405GP */
index 582caf2e19c7029dbffbbd0565844d1bbf7c1809..52a2f331bebd053af2136ac982f596e23ad52fae 100644 (file)
@@ -241,6 +241,4 @@ struct arp_entry {
 /*-----------------------------------------------------------------------------+
 | Function prototypes for device table.
 +-----------------------------------------------------------------------------*/
-int enetInt(void);
-
 #endif /* _enetLib_h_ */
index 22d33da6dd359989d097299811e223ac91048d27..7faa1f6974ac1a62998d84e74f61dd0b71bbdf4b 100644 (file)
--- a/net/eth.c
+++ b/net/eth.c
@@ -41,6 +41,7 @@ extern int pcnet_initialize(bd_t*);
 extern int fec_initialize(bd_t*);
 extern int scc_initialize(bd_t*);
 extern int inca_switch_initialize(bd_t*);
+extern int ppc_4xx_eth_initialize(bd_t *);
 extern int plb2800_eth_initialize(bd_t*);
 
 static struct eth_device *eth_devices, *eth_current;
@@ -98,6 +99,9 @@ int eth_initialize(bd_t *bis)
        eth_devices = NULL;
        eth_current = NULL;
 
+#if (defined(CONFIG_405GP) || defined(CONFIG_440)|| defined(CONFIG_405EP)
+        ppc_4xx_eth_initialize(bis);
+#endif
 #ifdef CONFIG_INCA_IP_SWITCH
        inca_switch_initialize(bis);
 #endif