]> git.kernelconcepts.de Git - karo-tx-uboot.git/commitdiff
KS8695: convert KS8695 eth driver to CONFIG_MULTI_ETH
authorGreg Ungerer <greg.ungerer@opengear.com>
Sat, 10 Sep 2011 08:40:34 +0000 (18:40 +1000)
committerWolfgang Denk <wd@denx.de>
Sat, 10 Sep 2011 14:10:34 +0000 (16:10 +0200)
Trivial conversion of the ks8695eth driver to a CONFIG_MULTI_ETH type
driver.

Signed-off-by: Greg Ungerer <greg.ungerer@opengear.com>
board/cm4008/cm4008.c
board/cm41xx/cm41xx.c
drivers/net/ks8695eth.c
include/configs/cm4008.h
include/configs/cm41xx.h
include/netdev.h

index 63296f092ba07344f295566c7e73989f1aed5d04..2e8d948054b1e3de788eb798c6d8eccc1ab3a4a6 100644 (file)
@@ -74,6 +74,10 @@ int board_late_init (void)
        return 0;
 }
 
+int board_eth_init(bd_t *bis)
+{
+       return ks8695_eth_initialize();
+}
 
 int board_init (void)
 {
index 9a6d89fdc6d18b765dd8d961be49cae898993ec8..72fd64d5b0cd35d23e2adc9c307931708c36fd6c 100644 (file)
@@ -74,6 +74,10 @@ int board_late_init (void)
        return 0;
 }
 
+int board_eth_init(bd_t *bis)
+{
+       return ks8695_eth_initialize();
+}
 
 int board_init (void)
 {
index 5ea6e7fda794cd066c2c0ffbd3ac240d8d48188a..cd368808f2c90bb894add593787f0b3bf6fd5949 100644 (file)
@@ -99,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;
 
@@ -151,21 +151,12 @@ void eth_reset(bd_t *bd)
        ks8695_write(KS8695_LAN_DMA_RX_START, 0x1);
 
        printf("KS8695 ETHERNET: %pM\n", eth_mac);
-}
-
-/****************************************************************************/
-
-int eth_init(bd_t *bd)
-{
-       debug ("%s(%d): eth_init()\n", __FILE__, __LINE__);
-
-       eth_reset(bd);
        return 0;
 }
 
 /****************************************************************************/
 
-void eth_halt(void)
+static void ks8695_eth_halt(struct eth_device *dev)
 {
        debug ("%s(%d): eth_halt()\n", __FILE__, __LINE__);
 
@@ -176,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;
@@ -199,7 +190,8 @@ int eth_rx(void)
 
 /****************************************************************************/
 
-int eth_send(volatile void *packet, int len)
+static int ks8695_eth_send(struct eth_device *dev, volatile void *packet,
+       int len)
 {
        volatile struct ks8695_txdesc *dp;
        static int next = 0;
@@ -224,5 +216,27 @@ int eth_send(volatile void *packet, int len)
        if (++next >= TXDESCS)
                next = 0;
 
-       return len;
+       return 0;
+}
+
+/****************************************************************************/
+
+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;
 }
index 81e4de45d6e8f4b9339492fd267e594b147f5a59..5777062c60a634baba517850195350e757cd2606 100644 (file)
@@ -38,6 +38,7 @@
 #define CONFIG_INITRD_TAG       1
 
 #define CONFIG_DRIVER_KS8695ETH                /* use KS8695 ethernet driver   */
+#define CONFIG_NET_MULTI
 
 /*
  * Size of malloc() pool
index 785ab0a62a42a39a1da07726e5772d42a887a04e..66e689aa85873463244b9fee99897918326c21be 100644 (file)
@@ -38,6 +38,7 @@
 #define CONFIG_INITRD_TAG       1
 
 #define CONFIG_DRIVER_KS8695ETH                /* use KS8695 ethernet driver   */
+#define CONFIG_NET_MULTI
 
 /*
  * Size of malloc() pool
index 6f0a971b7e2892cdff18a57034ba1d5920c074e9..83d78861c477fabad80e656e993c239dbeda2a56 100644 (file)
@@ -66,6 +66,7 @@ int ftmac100_initialize(bd_t *bits);
 int greth_initialize(bd_t *bis);
 void gt6426x_eth_initialize(bd_t *bis);
 int inca_switch_initialize(bd_t *bis);
+int ks8695_eth_initialize(bd_t *bis);
 int lan91c96_initialize(u8 dev_num, int base_addr);
 int macb_eth_initialize(int id, void *regs, unsigned int phy_addr);
 int mcdmafec_initialize(bd_t *bis);