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 */
}
-int eth_init (bd_t * bis)
+static int ppc_4xx_eth_init (struct eth_device *dev, bd_t * bis)
{
int i;
unsigned long reg;
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;
return (-1);
}
} else {
- return (0);
+ return (len);
}
}
}
/*-----------------------------------------------------------------------------+
* 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 */
/*-----------------------------------------------------------------------------+
* 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);
}
-int eth_rx (void)
+static int ppc_4xx_eth_rx (struct eth_device *dev)
{
int length;
int user_index;
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 */