]> git.kernelconcepts.de Git - karo-tx-uboot.git/blobdiff - drivers/net/ks8695eth.c
ARM: remove dkb board support
[karo-tx-uboot.git] / drivers / net / ks8695eth.c
index 7f3e0c2e491f5ca98e1f92f5d394a8edce88c927..b4822e950485df18049200ee678d4ab300a554ca 100644 (file)
@@ -3,19 +3,7 @@
  *
  * (C) Copyright 2004-2005, Greg Ungerer <greg.ungerer@opengear.com>
  *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ * SPDX-License-Identifier:    GPL-2.0+
  */
 
 /****************************************************************************/
@@ -99,7 +87,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;
 
@@ -150,28 +138,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__);
 
@@ -182,7 +155,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;
@@ -205,12 +178,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];
@@ -230,5 +203,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;
 }