]> git.sur5r.net Git - u-boot/blobdiff - drivers/net/ks8695eth.c
usbether: Removed DEV_CONFIG_{CDC,SUBSET}
[u-boot] / drivers / net / ks8695eth.c
index b598dd7f23d2cbd3d79723e1033e16ac6b1994ef..b4904b68e5e676c138f2eec723735a5974136e9a 100644 (file)
@@ -21,8 +21,6 @@
 /****************************************************************************/
 
 #include <common.h>
-
-#ifdef CONFIG_DRIVER_KS8695ETH
 #include <malloc.h>
 #include <net.h>
 #include <asm/io.h>
@@ -101,7 +99,7 @@ void ks8695_getmac(void)
 
 /****************************************************************************/
 
-void eth_reset(bd_t *bd)
+static int ks8695_eth_init(struct eth_device *dev, bd_t *bd)
 {
        int i;
 
@@ -152,28 +150,13 @@ void eth_reset(bd_t *bd)
        ks8695_write(KS8695_LAN_DMA_RX, 0x71);
        ks8695_write(KS8695_LAN_DMA_RX_START, 0x1);
 
-       printf("KS8695 ETHERNET: ");
-       for (i = 0; (i < 5); i++) {
-               bd->bi_enetaddr[i] = eth_mac[i];
-               printf("%02x:", eth_mac[i]);
-       }
-       bd->bi_enetaddr[i] = eth_mac[i];
-       printf("%02x\n", eth_mac[i]);
-}
-
-/****************************************************************************/
-
-int eth_init(bd_t *bd)
-{
-       debug ("%s(%d): eth_init()\n", __FILE__, __LINE__);
-
-       eth_reset(bd);
+       printf("KS8695 ETHERNET: %pM\n", eth_mac);
        return 0;
 }
 
 /****************************************************************************/
 
-void eth_halt(void)
+static void ks8695_eth_halt(struct eth_device *dev)
 {
        debug ("%s(%d): eth_halt()\n", __FILE__, __LINE__);
 
@@ -184,7 +167,7 @@ void eth_halt(void)
 
 /****************************************************************************/
 
-int eth_rx(void)
+static int ks8695_eth_recv(struct eth_device *dev)
 {
        volatile struct ks8695_rxdesc *dp;
        int i, len = 0;
@@ -207,12 +190,12 @@ int eth_rx(void)
 
 /****************************************************************************/
 
-int eth_send(volatile void *packet, int len)
+static int ks8695_eth_send(struct eth_device *dev, void *packet, int len)
 {
        volatile struct ks8695_txdesc *dp;
        static int next = 0;
 
-       debug ("%s(%d): eth_send(packet=%x,len=%d)\n", __FILE__, __LINE__,
+       debug ("%s(%d): eth_send(packet=%p,len=%d)\n", __FILE__, __LINE__,
                packet, len);
 
        dp = &ks8695_tx[next];
@@ -232,7 +215,27 @@ int eth_send(volatile void *packet, int len)
        if (++next >= TXDESCS)
                next = 0;
 
-       return len;
+       return 0;
 }
 
-#endif /* CONFIG_DRIVER_KS8695ETH */
+/****************************************************************************/
+
+int ks8695_eth_initialize(void)
+{
+       struct eth_device *dev;
+
+       dev = malloc(sizeof(*dev));
+       if (dev == NULL)
+               return -1;
+       memset(dev, 0, sizeof(*dev));
+
+       dev->iobase = KS8695_IO_BASE + KS8695_LAN_DMA_TX;
+       dev->init = ks8695_eth_init;
+       dev->halt = ks8695_eth_halt;
+       dev->send = ks8695_eth_send;
+       dev->recv = ks8695_eth_recv;
+       strcpy(dev->name, "ks8695eth");
+
+       eth_register(dev);
+       return 0;
+}