]> git.kernelconcepts.de Git - karo-tx-uboot.git/commitdiff
Convert CS8900 Ethernet driver to CONFIG_NET_MULTI API
authorBen Warren <biggerbadderben@gmail.com>
Tue, 25 Aug 2009 20:09:37 +0000 (13:09 -0700)
committerBen Warren <biggerbadderben@gmail.com>
Tue, 25 Aug 2009 20:35:54 +0000 (13:35 -0700)
All in-tree boards that use this controller have CONFIG_NET_MULTI added
Also:
  - changed CONFIG_DRIVER_CS8900 to CONFIG_CS8900
  - changed CS8900_BASE to CONFIG_CS8900_BASE
  - changed CS8900_BUS?? to CONFIG_CS8900_BUS??
  - cleaned up line lengths
  - modified VCMA9 command function that accesses the device
  - removed MAC address initialization from lib_arm/board.c

Signed-off-by: Ben Warren <biggerbadderben@gmail.com>
Tested-by: Wolfgang Denk <wd@denx.de>
Acked-by: Wolfgang Denk <wd@denx.de>
38 files changed:
board/altera/dk1c20/dk1c20.c
board/altera/dk1s10/dk1s10.c
board/armadillo/armadillo.c
board/csb226/csb226.c
board/ep7312/ep7312.c
board/freescale/mx31ads/mx31ads.c
board/impa7/impa7.c
board/lart/lart.c
board/mpl/vcma9/cmd_vcma9.c
board/mpl/vcma9/vcma9.c
board/mx1ads/mx1ads.c
board/samsung/smdk2400/smdk2400.c
board/samsung/smdk2410/smdk2410.c
board/samsung/smdk6400/smdk6400.c
board/sbc2410x/sbc2410x.c
board/ssv/adnpesc1/adnpesc1.c
board/trab/trab.c
drivers/net/Makefile
drivers/net/cs8900.c
drivers/net/cs8900.h
include/configs/ADNPESC1.h
include/configs/DK1C20.h
include/configs/DK1S10.h
include/configs/VCMA9.h
include/configs/armadillo.h
include/configs/csb226.h
include/configs/ep7312.h
include/configs/impa7.h
include/configs/lart.h
include/configs/mx1ads.h
include/configs/mx31ads.h
include/configs/sbc2410x.h
include/configs/smdk2400.h
include/configs/smdk2410.h
include/configs/smdk6400.h
include/configs/trab.h
include/netdev.h
lib_arm/board.c

index 11c19b7eedb252773e9521b8547c136bc9f84350..0bcaa4fd1470b2faa5bd52e579ba87150b51637d 100644 (file)
@@ -25,6 +25,7 @@
  */
 
 #include <common.h>
+#include <netdev.h>
 #include <nios-io.h>
 #if    defined(CONFIG_SEVENSEG)
 #include "../common/sevenseg.h"
@@ -79,3 +80,14 @@ int ide_preinit (void)
        return 0;
 }
 #endif
+
+#ifdef CONFIG_CMD_NET
+int board_eth_init(bd_t *bis)
+{
+       int rc = 0;
+#ifdef CONFIG_CS8900
+       rc = cs8900_initialize(0, CONFIG_CS8900_BASE);
+#endif
+       return rc;
+}
+#endif
index 64d591e714e079dcf82c59afc91d84bca69f73e3..fb96501da21f4e4f7d4ce34645b04b3c011fe319 100644 (file)
@@ -22,6 +22,7 @@
  */
 
 #include <common.h>
+#include <netdev.h>
 #if    defined(CONFIG_SEVENSEG)
 #include "../common/sevenseg.h"
 #endif
@@ -58,3 +59,14 @@ phys_size_t initdram (int board_type)
 {
        return (0);
 }
+
+#ifdef CONFIG_CMD_NET
+int board_eth_init(bd_t *bis)
+{
+       int rc = 0;
+#ifdef CONFIG_CS8900
+       rc = cs8900_initialize(0, CONFIG_CS8900_BASE);
+#endif
+       return rc;
+}
+#endif
index ca5bd1d1640403de06d81afbd88f854ebfb21492..a825144c5c6544e603e340b2f540c923f6a0baf1 100644 (file)
@@ -26,6 +26,7 @@
  */
 
 #include <common.h>
+#include <netdev.h>
 #include <clps7111.h>
 
 DECLARE_GLOBAL_DATA_PTR;
@@ -58,3 +59,14 @@ int dram_init (void)
 
        return (0);
 }
+
+#ifdef CONFIG_CMD_NET
+int board_eth_init(bd_t *bis)
+{
+       int rc = 0;
+#ifdef CONFIG_CS8900
+       rc = cs8900_initialize(0, CONFIG_CS8900_BASE);
+#endif
+       return rc;
+}
+#endif
index 80caf8b464e17e5bda816760a9248a799845454b..0a6c13dd29b046ff89c46b46d134d6a5966edecb 100644 (file)
@@ -24,6 +24,7 @@
  */
 
 #include <common.h>
+#include <netdev.h>
 #include <asm/arch/pxa-regs.h>
 
 DECLARE_GLOBAL_DATA_PTR;
@@ -151,3 +152,14 @@ void show_boot_progress (int status)
 
        return;
 }
+
+#ifdef CONFIG_CMD_NET
+int board_eth_init(bd_t *bis)
+{
+       int rc = 0;
+#ifdef CONFIG_CS8900
+       rc = cs8900_initialize(0, CONFIG_CS8900_BASE);
+#endif
+       return rc;
+}
+#endif
index 6968a5dbdd11d41404dacfd3ae533e1cd281c7b9..8ed14ad583d4ee54d84bdfbf027e4692dadd2564 100644 (file)
@@ -23,6 +23,7 @@
  */
 
 #include <common.h>
+#include <netdev.h>
 #include <clps7111.h>
 
 DECLARE_GLOBAL_DATA_PTR;
@@ -52,3 +53,14 @@ int dram_init (void)
 
        return (0);
 }
+
+#ifdef CONFIG_CMD_NET
+int board_eth_init(bd_t *bis)
+{
+       int rc = 0;
+#ifdef CONFIG_CS8900
+       rc = cs8900_initialize(0, CONFIG_CS8900_BASE);
+#endif
+       return rc;
+}
+#endif
index c24c47c57f885a6f006db0b6eb7080d00338b260..bc25c6deb5cb8c04b6b07c5d15f5935eaa843cf3 100644 (file)
@@ -21,6 +21,7 @@
  */
 
 #include <common.h>
+#include <netdev.h>
 #include <asm/io.h>
 #include <asm/arch/mx31.h>
 #include <asm/arch/mx31-regs.h>
@@ -104,3 +105,14 @@ int checkboard (void)
        printf("Board: MX31ADS\n");
        return 0;
 }
+
+#ifdef CONFIG_CMD_NET
+int board_eth_init(bd_t *bis)
+{
+       int rc = 0;
+#ifdef CONFIG_CS8900
+       rc = cs8900_initialize(0, CONFIG_CS8900_BASE);
+#endif
+       return rc;
+}
+#endif
index 3230dd48f0767622b1d295cb5c42227befdbc303..205b1b31dde19ffec3d6bd96415e951272eb41c3 100644 (file)
@@ -23,6 +23,7 @@
  */
 
 #include <common.h>
+#include <netdev.h>
 #include <clps7111.h>
 
 DECLARE_GLOBAL_DATA_PTR;
@@ -57,3 +58,14 @@ int dram_init (void)
 
        return (0);
 }
+
+#ifdef CONFIG_CMD_NET
+int board_eth_init(bd_t *bis)
+{
+       int rc = 0;
+#ifdef CONFIG_CS8900
+       rc = cs8900_initialize(0, CONFIG_CS8900_BASE);
+#endif
+       return rc;
+}
+#endif
index 8d534c8e6738fd8af533c69b3522b9e42cd4049a..a0b459f2f2174e17691d8c7996e13fcbfbce9f21 100644 (file)
@@ -23,6 +23,7 @@
  */
 
 #include <common.h>
+#include <netdev.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -62,3 +63,14 @@ int dram_init (void)
 
        return (0);
 }
+
+#ifdef CONFIG_CMD_NET
+int board_eth_init(bd_t *bis)
+{
+       int rc = 0;
+#ifdef CONFIG_CS8900
+       rc = cs8900_initialize(0, CONFIG_CS8900_BASE);
+#endif
+       return rc;
+}
+#endif
index 01607743952b88e22307b66da00f673a9eea2ed5..0ee959507f7e516626b667ef2a6731073a5efda9 100644 (file)
@@ -31,7 +31,7 @@
 #include "vcma9.h"
 #include "../common/common_util.h"
 
-#if defined(CONFIG_DRIVER_CS8900)
+#if defined(CONFIG_CS8900)
 #include <../drivers/net/cs8900.h>
 
 static uchar cs8900_chksum(ushort data)
@@ -56,25 +56,33 @@ extern int do_mplcommon(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]);
 
 int do_vcma9(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
 {
+       struct eth_device *dev;
+       char cs8900_name[10];
        if (strcmp(argv[1], "info") == 0)
        {
                print_vcma9_info();
                return 0;
        }
-#if defined(CONFIG_DRIVER_CS8900)
+#if defined(CONFIG_CS8900)
        if (strcmp(argv[1], "cs8900") == 0) {
+               sprintf(cs8900_name, "%s-0", CS8900_DRIVERNAME);
+               dev = eth_get_dev_by_name(cs8900_name);
+               if (!dev) {
+                       printf("Couldn't find CS8900 driver");
+                       return 0;
+               }
                if (strcmp(argv[2], "read") == 0) {
                        uchar addr; ushort data;
 
                        addr = simple_strtoul(argv[3], NULL, 16);
-                       cs8900_e2prom_read(addr, &data);
+                       cs8900_e2prom_read(dev, addr, &data);
                        printf("0x%2.2X: 0x%4.4X\n", addr, data);
                } else if (strcmp(argv[2], "write") == 0) {
                        uchar addr; ushort data;
 
                        addr = simple_strtoul(argv[3], NULL, 16);
                        data = simple_strtoul(argv[4], NULL, 16);
-                       cs8900_e2prom_write(addr, data);
+                       cs8900_e2prom_write(dev, addr, data);
                } else if (strcmp(argv[2], "setaddr") == 0) {
                        uchar addr, i, csum; ushort data;
                        uchar ethaddr[6];
@@ -83,22 +91,22 @@ int do_vcma9(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
                        if (eth_getenv_enetaddr("ethaddr", ethaddr)) {
                                addr = 1;
                                data = 0x2158;
-                               cs8900_e2prom_write(addr, data);
+                               cs8900_e2prom_write(dev, addr, data);
                                csum = cs8900_chksum(data);
                                addr++;
                                for (i = 0; i < 6; i+=2) {
                                        data = ethaddr[i+1] << 8 |
                                               ethaddr[i];
-                                       cs8900_e2prom_write(addr, data);
+                                       cs8900_e2prom_write(dev, addr, data);
                                        csum += cs8900_chksum(data);
                                        addr++;
                                }
                                /* calculate header link byte */
                                data = 0xA100 | (addr * 2);
-                               cs8900_e2prom_write(0, data);
+                               cs8900_e2prom_write(dev, 0, data);
                                csum += cs8900_chksum(data);
                                /* write checksum word */
-                               cs8900_e2prom_write(addr, (0 - csum) << 8);
+                               cs8900_e2prom_write(dev, addr, (0 - csum) << 8);
                        } else {
                                puts("\nplease defined 'ethaddr'\n");
                        }
@@ -106,12 +114,12 @@ int do_vcma9(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
                        uchar addr = 0, endaddr, csum; ushort data;
 
                        puts("Dump of CS8900 config device: ");
-                       cs8900_e2prom_read(addr, &data);
+                       cs8900_e2prom_read(dev, addr, &data);
                        if ((data & 0xE000) == 0xA000) {
                                endaddr = (data & 0x00FF) / 2;
                                csum = cs8900_chksum(data);
                                for (addr = 1; addr <= endaddr; addr++) {
-                                       cs8900_e2prom_read(addr, &data);
+                                       cs8900_e2prom_read(dev, addr, &data);
                                        printf("\n0x%2.2X: 0x%4.4X", addr, data);
                                        csum += cs8900_chksum(data);
                                }
index 2b3fad2513e16b8ac5e1322214072fada39219ce..3216d6347dcef378696837bc693c676197b8b5af 100644 (file)
@@ -26,6 +26,7 @@
  */
 
 #include <common.h>
+#include <netdev.h>
 #include <s3c2410.h>
 #include <stdio_dev.h>
 #include <i2c.h>
@@ -349,3 +350,14 @@ void print_vcma9_info(void)
                Show_VCMA9_Info(s, &s[6]);
        }
 }
+
+#ifdef CONFIG_CMD_NET
+int board_eth_init(bd_t *bis)
+{
+       int rc = 0;
+#ifdef CONFIG_CS8900
+       rc = cs8900_initialize(0, CONFIG_CS8900_BASE);
+#endif
+       return rc;
+}
+#endif
index ba152e2e886669a50bd7a839a740becb15bf812f..f8ce2108c1c5f6de196f1a2d82b3ea30e299a239 100644 (file)
@@ -24,6 +24,7 @@
  */
 
 #include <common.h>
+#include <netdev.h>
 /*#include <mc9328.h>*/
 #include <asm/arch/imx-regs.h>
 
@@ -167,3 +168,14 @@ int dram_init (void)
 
        return 0;
 }
+
+#ifdef CONFIG_CMD_NET
+int board_eth_init(bd_t *bis)
+{
+       int rc = 0;
+#ifdef CONFIG_CS8900
+       rc = cs8900_initialize(0, CONFIG_CS8900_BASE);
+#endif
+       return rc;
+}
+#endif
index 0b820706b2385ea34b88e618d64cc2fe269494b9..2c47063e95e7661b916c00a37ecf9a03be51d239 100644 (file)
@@ -26,6 +26,7 @@
  */
 
 #include <common.h>
+#include <netdev.h>
 #include <s3c2400.h>
 
 DECLARE_GLOBAL_DATA_PTR;
@@ -110,3 +111,14 @@ static int key_pressed(void)
        return rc;
 }
 #endif /* CONFIG_MODEM_SUPPORT */
+
+#ifdef CONFIG_CMD_NET
+int board_eth_init(bd_t *bis)
+{
+       int rc = 0;
+#ifdef CONFIG_CS8900
+       rc = cs8900_initialize(0, CONFIG_CS8900_BASE);
+#endif
+       return rc;
+}
+#endif
index 802348d23693f8ef25a4fe1299f3908848eb2df3..25c38e67e9db5dc48cbd84202a6cc1801c4d9785 100644 (file)
@@ -26,6 +26,7 @@
  */
 
 #include <common.h>
+#include <netdev.h>
 #include <s3c2410.h>
 
 DECLARE_GLOBAL_DATA_PTR;
@@ -121,3 +122,14 @@ int dram_init (void)
 
        return 0;
 }
+
+#ifdef CONFIG_CMD_NET
+int board_eth_init(bd_t *bis)
+{
+       int rc = 0;
+#ifdef CONFIG_CS8900
+       rc = cs8900_initialize(0, CONFIG_CS8900_BASE);
+#endif
+       return rc;
+}
+#endif
index 52cd174a066b08bb4a30c43dc744204f5e7d1fb3..561c0c83115871950129af11bdbc568c8c52a166 100644 (file)
@@ -29,6 +29,7 @@
  */
 
 #include <common.h>
+#include <netdev.h>
 #include <s3c6400.h>
 
 /* ------------------------------------------------------------------------- */
@@ -117,3 +118,14 @@ ulong board_flash_get_legacy (ulong base, int banknum, flash_info_t *info)
        } else
                return 0;
 }
+
+#ifdef CONFIG_CMD_NET
+int board_eth_init(bd_t *bis)
+{
+       int rc = 0;
+#ifdef CONFIG_CS8900
+       rc = cs8900_initialize(0, CONFIG_CS8900_BASE);
+#endif
+       return rc;
+}
+#endif
index 6c894a3869e977135ca2cb486f10d71b3cb12716..62768503ad5bb937b7dc557819bb3b41b2adf50e 100644 (file)
@@ -29,6 +29,7 @@
  */
 
 #include <common.h>
+#include <netdev.h>
 #include <s3c2410.h>
 
 #if defined(CONFIG_CMD_NAND)
@@ -178,3 +179,14 @@ void nand_init(void)
        printf ("%4lu MB\n", nand_probe((ulong)nand) >> 20);
 }
 #endif
+
+#ifdef CONFIG_CMD_NET
+int board_eth_init(bd_t *bis)
+{
+       int rc = 0;
+#ifdef CONFIG_CS8900
+       rc = cs8900_initialize(0, CONFIG_CS8900_BASE);
+#endif
+       return rc;
+}
+#endif
index 9d32741499ee7bf5997caa1a5cbb2a1acfa1d187..72810d036aea9a73e89c9b4e07f5d2a2efcd5677 100644 (file)
@@ -22,6 +22,7 @@
  */
 
 #include <common.h>
+#include <netdev.h>
 #include <nios-io.h>
 #include <spi.h>
 
@@ -100,3 +101,14 @@ int post_hotkeys_pressed(void)
        return 0;       /* No hotkeys supported */
 }
 #endif /* CONFIG_POST */
+
+#ifdef CONFIG_CMD_NET
+int board_eth_init(bd_t *bis)
+{
+       int rc = 0;
+#ifdef CONFIG_CS8900
+       rc = cs8900_initialize(0, CONFIG_CS8900_BASE);
+#endif
+       return rc;
+}
+#endif
index ddf6abf7b4cafb5c36a9cd38741bb39dd06fdb84..2dccd87677c4944887af39b7b748ef6f91e1a76a 100644 (file)
@@ -24,6 +24,7 @@
 /* #define DEBUG */
 
 #include <common.h>
+#include <netdev.h>
 #include <malloc.h>
 #include <s3c2400.h>
 #include <command.h>
@@ -420,3 +421,14 @@ static void tsc2000_set_brightness(void)
        tsc2000_write(0, 0xb, br & 0xff);
 }
 #endif
+
+#ifdef CONFIG_CMD_NET
+int board_eth_init(bd_t *bis)
+{
+       int rc = 0;
+#ifdef CONFIG_CS8900
+       rc = cs8900_initialize(0, CONFIG_CS8900_BASE);
+#endif
+       return rc;
+}
+#endif
index 1c6e402246e502faeaacefdae0b46e841835eca8..f6e9f6796c6476597a97a4632270aa3fc8f1a72d 100644 (file)
@@ -30,7 +30,7 @@ COBJS-$(CONFIG_PPC4xx_EMAC) += 4xx_enet.o
 COBJS-$(CONFIG_DRIVER_AX88180) += ax88180.o
 COBJS-$(CONFIG_BCM570x) += bcm570x.o bcm570x_autoneg.o 5701rls.o
 COBJS-$(CONFIG_BFIN_MAC) += bfin_mac.o
-COBJS-$(CONFIG_DRIVER_CS8900) += cs8900.o
+COBJS-$(CONFIG_CS8900) += cs8900.o
 COBJS-$(CONFIG_TULIP) += dc2114x.o
 COBJS-$(CONFIG_DRIVER_DM9000) += dm9000x.o
 COBJS-$(CONFIG_DNET) += dnet.o
index 5e2b3b080d00924c1e9253a097588772db7a971d..587f7f62a760308fc3c39331d68f600056d42e35 100644 (file)
@@ -1,6 +1,9 @@
 /*
  * Cirrus Logic CS8900A Ethernet
  *
+ * (C) 2009 Ben Warren , biggerbadderben@gmail.com
+ *     Converted to use CONFIG_NET_MULTI API
+ *
  * (C) 2003 Wolfgang Denk, wd@denx.de
  *     Extension to synchronize ethaddr environment variable
  *     against value in EEPROM
 
 #include <common.h>
 #include <command.h>
-#include "cs8900.h"
+#include <asm/io.h>
 #include <net.h>
+#include <malloc.h>
+#include "cs8900.h"
 
 #undef DEBUG
 
 /* packet page register access functions */
 
-#ifdef CS8900_BUS32
+#ifdef CONFIG_CS8900_BUS32
+
+#define REG_WRITE(v, a) writel((v),(a))
+#define REG_READ(a) readl((a))
+
 /* we don't need 16 bit initialisation on 32 bit bus */
 #define get_reg_init_bus(x) get_reg((x))
+
 #else
-static unsigned short get_reg_init_bus (int regno)
-{
-       /* force 16 bit busmode */
-       volatile unsigned char c;
 
-       c = CS8900_BUS16_0;
-       c = CS8900_BUS16_1;
-       c = CS8900_BUS16_0;
-       c = CS8900_BUS16_1;
-       c = CS8900_BUS16_0;
+#define REG_WRITE(v, a) writew((v),(a))
+#define REG_READ(a) readw((a))
 
-       CS8900_PPTR = regno;
-       return CS8900_PDATA;
+static u16 get_reg_init_bus(struct eth_device *dev, int regno)
+{
+       /* force 16 bit busmode */
+       volatile u8 c;
+       struct cs8900_priv *priv = (struct cs8900_priv *)(dev->priv);
+       uint8_t volatile * const iob = (uint8_t volatile * const)dev->iobase;
+
+       c = readb(iob);
+       c = readb(iob + 1);
+       c = readb(iob);
+       c = readb(iob + 1);
+       c = readb(iob);
+
+       REG_WRITE(regno, &priv->regs->pptr);
+       return REG_READ(&priv->regs->pdata);
 }
 #endif
 
-static unsigned short get_reg (int regno)
+static u16 get_reg(struct eth_device *dev, int regno)
 {
-       CS8900_PPTR = regno;
-       return CS8900_PDATA;
+       struct cs8900_priv *priv = (struct cs8900_priv *)(dev->priv);
+       REG_WRITE(regno, &priv->regs->pptr);
+       return REG_READ(&priv->regs->pdata);
 }
 
 
-static void put_reg (int regno, unsigned short val)
+static void put_reg(struct eth_device *dev, int regno, u16 val)
 {
-       CS8900_PPTR = regno;
-       CS8900_PDATA = val;
+       struct cs8900_priv *priv = (struct cs8900_priv *)(dev->priv);
+       REG_WRITE(regno, &priv->regs->pptr);
+       REG_WRITE(val, &priv->regs->pdata);
 }
 
-static void eth_reset (void)
+static void cs8900_reset(struct eth_device *dev)
 {
        int tmo;
-       unsigned short us;
+       u16 us;
 
        /* reset NIC */
-       put_reg (PP_SelfCTL, get_reg (PP_SelfCTL) | PP_SelfCTL_Reset);
+       put_reg(dev, PP_SelfCTL, get_reg(dev, PP_SelfCTL) | PP_SelfCTL_Reset);
 
        /* wait for 200ms */
-       udelay (200000);
+       udelay(200000);
        /* Wait until the chip is reset */
 
-       tmo = get_timer (0) + 1 * CONFIG_SYS_HZ;
-       while ((((us = get_reg_init_bus (PP_SelfSTAT)) & PP_SelfSTAT_InitD) == 0)
-                  && tmo < get_timer (0))
+       tmo = get_timer(0) + 1 * CONFIG_SYS_HZ;
+       while ((((us = get_reg_init_bus(dev, PP_SelfSTAT)) &
+               PP_SelfSTAT_InitD) == 0) && tmo < get_timer(0))
                /*NOP*/;
 }
 
-static void eth_reginit (void)
+static void cs8900_reginit(struct eth_device *dev)
 {
        /* receive only error free packets addressed to this card */
-       put_reg (PP_RxCTL, PP_RxCTL_IA | PP_RxCTL_Broadcast | PP_RxCTL_RxOK);
+       put_reg(dev, PP_RxCTL,
+               PP_RxCTL_IA | PP_RxCTL_Broadcast | PP_RxCTL_RxOK);
        /* do not generate any interrupts on receive operations */
-       put_reg (PP_RxCFG, 0);
+       put_reg(dev, PP_RxCFG, 0);
        /* do not generate any interrupts on transmit operations */
-       put_reg (PP_TxCFG, 0);
+       put_reg(dev, PP_TxCFG, 0);
        /* do not generate any interrupts on buffer operations */
-       put_reg (PP_BufCFG, 0);
+       put_reg(dev, PP_BufCFG, 0);
        /* enable transmitter/receiver mode */
-       put_reg (PP_LineCTL, PP_LineCTL_Rx | PP_LineCTL_Tx);
+       put_reg(dev, PP_LineCTL, PP_LineCTL_Rx | PP_LineCTL_Tx);
 }
 
-void cs8900_get_enetaddr (void)
+void cs8900_get_enetaddr(struct eth_device *dev)
 {
        int i;
-       uchar enetaddr[6];
-
-       /* if the env is setup, then bail */
-       if (eth_getenv_enetaddr("ethaddr", enetaddr))
-               return;
 
        /* verify chip id */
-       if (get_reg_init_bus (PP_ChipID) != 0x630e)
+       if (get_reg_init_bus(dev, PP_ChipID) != 0x630e)
                return;
-       eth_reset ();
-       if ((get_reg (PP_SelfSTAT) & (PP_SelfSTAT_EEPROM | PP_SelfSTAT_EEPROM_OK)) ==
-                       (PP_SelfSTAT_EEPROM | PP_SelfSTAT_EEPROM_OK)) {
+       cs8900_reset(dev);
+       if ((get_reg(dev, PP_SelfSTAT) &
+               (PP_SelfSTAT_EEPROM | PP_SelfSTAT_EEPROM_OK)) ==
+               (PP_SelfSTAT_EEPROM | PP_SelfSTAT_EEPROM_OK)) {
 
                /* Load the MAC from EEPROM */
-               for (i = 0; i < 6 / 2; i++) {
-                       unsigned int Addr;
+               for (i = 0; i < 3; i++) {
+                       u32 Addr;
 
-                       Addr = get_reg (PP_IA + i * 2);
-                       enetaddr[i * 2] = Addr & 0xFF;
-                       enetaddr[i * 2 + 1] = Addr >> 8;
+                       Addr = get_reg(dev, PP_IA + i * 2);
+                       dev->enetaddr[i * 2] = Addr & 0xFF;
+                       dev->enetaddr[i * 2 + 1] = Addr >> 8;
                }
-
-               eth_setenv_enetaddr("ethaddr", enetaddr);
-               debug("### Set environment from HW MAC addr = \"%pM\"\n", enetaddr);
        }
 }
 
-void eth_halt (void)
+void cs8900_halt(struct eth_device *dev)
 {
        /* disable transmitter/receiver mode */
-       put_reg (PP_LineCTL, 0);
+       put_reg(dev, PP_LineCTL, 0);
 
        /* "shutdown" to show ChipID or kernel wouldn't find he cs8900 ... */
-       get_reg_init_bus (PP_ChipID);
+       get_reg_init_bus(dev, PP_ChipID);
 }
 
-int eth_init (bd_t * bd)
+static int cs8900_init(struct eth_device *dev, bd_t * bd)
 {
-       uchar enetaddr[6];
+       uchar *enetaddr = dev->enetaddr;
+       u16 id;
 
        /* verify chip id */
-       if (get_reg_init_bus (PP_ChipID) != 0x630e) {
-               printf ("CS8900 Ethernet chip not found?!\n");
-               return 0;
+       id = get_reg_init_bus(dev, PP_ChipID);
+       if (id != 0x630e) {
+               printf ("CS8900 Ethernet chip not found: "
+                       "ID=0x%04x instead 0x%04x\n", id, 0x630e);
+               return 1;
        }
 
-       eth_reset ();
+       cs8900_reset (dev);
        /* set the ethernet address */
-       eth_getenv_enetaddr("ethaddr", enetaddr);
-       put_reg (PP_IA + 0, enetaddr[0] | (enetaddr[1] << 8));
-       put_reg (PP_IA + 2, enetaddr[2] | (enetaddr[3] << 8));
-       put_reg (PP_IA + 4, enetaddr[4] | (enetaddr[5] << 8));
+       put_reg(dev, PP_IA + 0, enetaddr[0] | (enetaddr[1] << 8));
+       put_reg(dev, PP_IA + 2, enetaddr[2] | (enetaddr[3] << 8));
+       put_reg(dev, PP_IA + 4, enetaddr[4] | (enetaddr[5] << 8));
 
-       eth_reginit ();
+       cs8900_reginit(dev);
        return 0;
 }
 
 /* Get a data block via Ethernet */
-int eth_rx (void)
+static int cs8900_recv(struct eth_device *dev)
 {
        int i;
-       unsigned short rxlen;
-       unsigned short *addr;
-       unsigned short status;
+       u16 rxlen;
+       u16 *addr;
+       u16 status;
 
-       status = get_reg (PP_RER);
+       struct cs8900_priv *priv = (struct cs8900_priv *)(dev->priv);
+
+       status = get_reg(dev, PP_RER);
 
        if ((status & PP_RER_RxOK) == 0)
                return 0;
 
-       status = CS8900_RTDATA;         /* stat */
-       rxlen = CS8900_RTDATA;          /* len */
+       status = REG_READ(&priv->regs->rtdata);
+       rxlen = REG_READ(&priv->regs->rtdata);
 
-#ifdef DEBUG
        if (rxlen > PKTSIZE_ALIGN + PKTALIGN)
-               printf ("packet too big!\n");
-#endif
-       for (addr = (unsigned short *) NetRxPackets[0], i = rxlen >> 1; i > 0;
+               debug("packet too big!\n");
+       for (addr = (u16 *) NetRxPackets[0], i = rxlen >> 1; i > 0;
                 i--)
-               *addr++ = CS8900_RTDATA;
+               *addr++ = REG_READ(&priv->regs->rtdata);
        if (rxlen & 1)
-               *addr++ = CS8900_RTDATA;
+               *addr++ = REG_READ(&priv->regs->rtdata);
 
        /* Pass the packet up to the protocol layers. */
        NetReceive (NetRxPackets[0], rxlen);
-
        return rxlen;
 }
 
 /* Send a data block via Ethernet. */
-int eth_send (volatile void *packet, int length)
+static int cs8900_send(struct eth_device *dev,
+                       volatile void *packet, int length)
 {
-       volatile unsigned short *addr;
+       volatile u16 *addr;
        int tmo;
-       unsigned short s;
+       u16 s;
+       struct cs8900_priv *priv = (struct cs8900_priv *)(dev->priv);
 
 retry:
        /* initiate a transmit sequence */
-       CS8900_TxCMD = PP_TxCmd_TxStart_Full;
-       CS8900_TxLEN = length;
+       REG_WRITE(PP_TxCmd_TxStart_Full, &priv->regs->txcmd);
+       REG_WRITE(length, &priv->regs->txlen);
 
        /* Test to see if the chip has allocated memory for the packet */
-       if ((get_reg (PP_BusSTAT) & PP_BusSTAT_TxRDY) == 0) {
+       if ((get_reg(dev, PP_BusSTAT) & PP_BusSTAT_TxRDY) == 0) {
                /* Oops... this should not happen! */
-#ifdef DEBUG
-               printf ("cs: unable to send packet; retrying...\n");
-#endif
-               for (tmo = get_timer (0) + 5 * CONFIG_SYS_HZ; get_timer (0) < tmo;)
+               debug("cs: unable to send packet; retrying...\n");
+               for (tmo = get_timer(0) + 5 * CONFIG_SYS_HZ;
+                       get_timer(0) < tmo;)
                        /*NOP*/;
-               eth_reset ();
-               eth_reginit ();
+               cs8900_reset(dev);
+               cs8900_reginit(dev);
                goto retry;
        }
 
        /* Write the contents of the packet */
        /* assume even number of bytes */
        for (addr = packet; length > 0; length -= 2)
-               CS8900_RTDATA = *addr++;
+               REG_WRITE(*addr++, &priv->regs->rtdata);
 
        /* wait for transfer to succeed */
-       tmo = get_timer (0) + 5 * CONFIG_SYS_HZ;
-       while ((s = get_reg (PP_TER) & ~0x1F) == 0) {
-               if (get_timer (0) >= tmo)
+       tmo = get_timer(0) + 5 * CONFIG_SYS_HZ;
+       while ((s = get_reg(dev, PP_TER) & ~0x1F) == 0) {
+               if (get_timer(0) >= tmo)
                        break;
        }
 
        /* nothing */ ;
-       if ((s & (PP_TER_CRS | PP_TER_TxOK)) != PP_TER_TxOK) {
-#ifdef DEBUG
-               printf ("\ntransmission error %#x\n", s);
-#endif
+       if((s & (PP_TER_CRS | PP_TER_TxOK)) != PP_TER_TxOK) {
+               debug("\ntransmission error %#x\n", s);
        }
 
        return 0;
 }
 
-static void cs8900_e2prom_ready(void)
+static void cs8900_e2prom_ready(struct eth_device *dev)
 {
-       while (get_reg(PP_SelfSTAT) & SI_BUSY)
+       while (get_reg(dev, PP_SelfSTAT) & SI_BUSY)
                ;
 }
 
@@ -259,12 +271,13 @@ static void cs8900_e2prom_ready(void)
 /* read a 16-bit word out of the EEPROM                    */
 /***********************************************************/
 
-int cs8900_e2prom_read(unsigned char addr, unsigned short *value)
+int cs8900_e2prom_read(struct eth_device *dev,
+                       u8 addr, u16 *value)
 {
-       cs8900_e2prom_ready();
-       put_reg(PP_EECMD, EEPROM_READ_CMD | addr);
-       cs8900_e2prom_ready();
-       *value = get_reg(PP_EEData);
+       cs8900_e2prom_ready(dev);
+       put_reg(dev, PP_EECMD, EEPROM_READ_CMD | addr);
+       cs8900_e2prom_ready(dev);
+       *value = get_reg(dev, PP_EEData);
 
        return 0;
 }
@@ -274,16 +287,51 @@ int cs8900_e2prom_read(unsigned char addr, unsigned short *value)
 /* write a 16-bit word into the EEPROM                     */
 /***********************************************************/
 
-int cs8900_e2prom_write(unsigned char addr, unsigned short value)
+int cs8900_e2prom_write(struct eth_device *dev, u8 addr, u16 value)
+{
+       cs8900_e2prom_ready(dev);
+       put_reg(dev, PP_EECMD, EEPROM_WRITE_EN);
+       cs8900_e2prom_ready(dev);
+       put_reg(dev, PP_EEData, value);
+       put_reg(dev, PP_EECMD, EEPROM_WRITE_CMD | addr);
+       cs8900_e2prom_ready(dev);
+       put_reg(dev, PP_EECMD, EEPROM_WRITE_DIS);
+       cs8900_e2prom_ready(dev);
+
+       return 0;
+}
+
+int cs8900_initialize(u8 dev_num, int base_addr)
 {
-       cs8900_e2prom_ready();
-       put_reg(PP_EECMD, EEPROM_WRITE_EN);
-       cs8900_e2prom_ready();
-       put_reg(PP_EEData, value);
-       put_reg(PP_EECMD, EEPROM_WRITE_CMD | addr);
-       cs8900_e2prom_ready();
-       put_reg(PP_EECMD, EEPROM_WRITE_DIS);
-       cs8900_e2prom_ready();
+       struct eth_device *dev;
+       struct cs8900_priv *priv;
+
+       dev = malloc(sizeof(*dev));
+       if (!dev) {
+               free(dev);
+               return 0;
+       }
+       memset(dev, 0, sizeof(*dev));
+
+       priv = malloc(sizeof(*priv));
+       if (!priv) {
+               free(priv);
+               return 0;
+       }
+       memset(priv, 0, sizeof(*priv));
+       priv->regs = (struct cs8900_regs *)base_addr;
+
+       /* Load MAC address from EEPROM */
+       cs8900_get_enetaddr(dev);
+
+       dev->iobase = base_addr;
+       dev->priv = priv;
+       dev->init = cs8900_init;
+       dev->halt = cs8900_halt;
+       dev->send = cs8900_send;
+       dev->recv = cs8900_recv;
+       sprintf(dev->name, "%s-%hu", CS8900_DRIVERNAME, dev_num);
 
+       eth_register(dev);
        return 0;
 }
index f9c32dd65d7b297678eb77b819a2e7519013dc96..23c5cb07bb5fa34db477d8e656694396668e9340 100644 (file)
@@ -1,6 +1,11 @@
+#ifndef CS8900_H
+#define CS8900_H
 /*
  * Cirrus Logic CS8900A Ethernet
  *
+ * (C) 2009 Ben Warren , biggerbadderben@gmail.com
+ *     Converted to use CONFIG_NET_MULTI API
+ *
  * (C) Copyright 2002
  * Sysgo Real-Time Solutions, GmbH <www.elinos.com>
  * Marius Groeger <mgroeger@sysgo.de>
 #include <asm/types.h>
 #include <config.h>
 
-#ifdef CONFIG_DRIVER_CS8900
-
+#define CS8900_DRIVERNAME "CS8900"
 /* although the registers are 16 bit, they are 32-bit aligned on the
    EDB7111. so we have to read them as 32-bit registers and ignore the
    upper 16-bits. i'm not sure if this holds for the EDB7211. */
 
-#ifdef CS8900_BUS16
+#ifdef CONFIG_CS8900_BUS16
   /* 16 bit aligned registers, 16 bit wide */
   #define CS8900_REG u16
-  #define CS8900_OFF 0x02
-  #define CS8900_BUS16_0  *(volatile u8 *)(CS8900_BASE+0x00)
-  #define CS8900_BUS16_1  *(volatile u8 *)(CS8900_BASE+0x01)
-#elif  defined(CS8900_BUS32)
+#elif defined(CONFIG_CS8900_BUS32)
   /* 32 bit aligned registers, 16 bit wide (we ignore upper 16 bits) */
   #define CS8900_REG u32
-  #define CS8900_OFF 0x04
 #else
   #error unknown bussize ...
 #endif
 
-#define CS8900_RTDATA *(volatile CS8900_REG *)(CS8900_BASE+0x00*CS8900_OFF)
-#define CS8900_TxCMD  *(volatile CS8900_REG *)(CS8900_BASE+0x02*CS8900_OFF)
-#define CS8900_TxLEN  *(volatile CS8900_REG *)(CS8900_BASE+0x03*CS8900_OFF)
-#define CS8900_ISQ    *(volatile CS8900_REG *)(CS8900_BASE+0x04*CS8900_OFF)
-#define CS8900_PPTR   *(volatile CS8900_REG *)(CS8900_BASE+0x05*CS8900_OFF)
-#define CS8900_PDATA  *(volatile CS8900_REG *)(CS8900_BASE+0x06*CS8900_OFF)
+struct cs8900_regs {
+       CS8900_REG rtdata;
+       CS8900_REG pad0;
+       CS8900_REG txcmd;
+       CS8900_REG txlen;
+       CS8900_REG isq;
+       CS8900_REG pptr;
+       CS8900_REG pdata;
+};
 
+struct cs8900_priv {
+       struct cs8900_regs *regs;
+};
 
 #define ISQ_RxEvent     0x04
 #define ISQ_TxEvent     0x08
 #define EEPROM_READ_CMD                0x0200
 #define EEPROM_ERASE_CMD       0x0300
 
-extern int cs8900_e2prom_read(uchar, ushort *);
-extern int cs8900_e2prom_write(uchar, ushort);
+/* Exported functions */
+int cs8900_e2prom_read(struct eth_device *dev, uchar, ushort *);
+int cs8900_e2prom_write(struct eth_device *dev, uchar, ushort);
 
-#endif /* CONFIG_DRIVER_CS8900 */
+#endif  /* CS8900_H */
index b8afc172c51f88ddc6ae77c26561b903bf03dcc1..2d4fc779150891ee75e9d65d890fdcc0c63d1f6a 100644 (file)
        /********************************************/
        /* !!! CS8900 is __not__ tested on NIOS !!! */
        /********************************************/
-#define        CONFIG_DRIVER_CS8900                    /* Using CS8900         */
-#define        CS8900_BASE             (CONFIG_SYS_NIOS_CPU_LAN0_BASE + CONFIG_SYS_NIOS_CPU_LAN0_OFFS)
+#define CONFIG_NET_MULTI
+#define        CONFIG_CS8900           /* Using CS8900         */
+#define        CONFIG_CS8900_BASE      (CONFIG_SYS_NIOS_CPU_LAN0_BASE + \
+                               CONFIG_SYS_NIOS_CPU_LAN0_OFFS)
 
 #if    (CONFIG_SYS_NIOS_CPU_LAN0_BUSW == 32)
-#undef CS8900_BUS16
-#define        CS8900_BUS32            1
+#undef CONFIG_CS8900_BUS16
+#define        CONFIG_CS8900_BUS32
 #else  /* no */
-#define        CS8900_BUS16            1
-#undef CS8900_BUS32
+#define        CONFIG_CS8900_BUS16
+#undef CONFIG_CS8900_BUS32
 #endif
 
 #else
index 45ff2f7dbc8f61c09a0329159cc03bd4d8674752..cdc488b38e2d66a9a6b2ac697fde4c58bb33b213 100644 (file)
        /********************************************/
        /* !!! CS8900 is __not__ tested on NIOS !!! */
        /********************************************/
-#define        CONFIG_DRIVER_CS8900                    /* Using CS8900         */
-#define        CS8900_BASE             (CONFIG_SYS_NIOS_CPU_LAN0_BASE + CONFIG_SYS_NIOS_CPU_LAN0_OFFS)
+#define CONFIG_NET_MULTI
+#define        CONFIG_CS8900           /* Using CS8900         */
+#define        CONFIG_CS8900_BASE      (CONFIG_SYS_NIOS_CPU_LAN0_BASE + \
+                               CONFIG_SYS_NIOS_CPU_LAN0_OFFS)
 
 #if    (CONFIG_SYS_NIOS_CPU_LAN0_BUSW == 32)
-#undef CS8900_BUS16
-#define        CS8900_BUS32            1
+#undef CONFIG_CS8900_BUS16
+#define        CONFIG_CS8900_BUS32
 #else  /* no */
-#define        CS8900_BUS16            1
-#undef CS8900_BUS32
+#define        CONFIG_CS8900_BUS16
+#undef CONFIG_CS8900_BUS32
 #endif
 
 #else
index ae567a32b322950b1b0b47bc8da0d7641f373453..6e788610fde6caf993dd71aa1ba1aa4871429b3b 100644 (file)
        /********************************************/
        /* !!! CS8900 is __not__ tested on NIOS !!! */
        /********************************************/
-#define        CONFIG_DRIVER_CS8900                    /* Using CS8900         */
-#define        CS8900_BASE             (CONFIG_SYS_NIOS_CPU_LAN0_BASE + CONFIG_SYS_NIOS_CPU_LAN0_OFFS)
+#define CONFIG_NET_MULTI
+#define        CONFIG_CS8900           /* Using CS8900         */
+#define        CONFIG_CS8900_BASE      (CONFIG_SYS_NIOS_CPU_LAN0_BASE + \
+                               CONFIG_SYS_NIOS_CPU_LAN0_OFFS)
 
 #if    (CONFIG_SYS_NIOS_CPU_LAN0_BUSW == 32)
-#undef CS8900_BUS16
-#define        CS8900_BUS32            1
+#undef CONFIG_CS8900_BUS16
+#define        CONFIG_CS8900_BUS32
 #else  /* no */
-#define        CS8900_BUS16            1
-#undef CS8900_BUS32
+#define        CONFIG_CS8900_BUS16
+#undef CONFIG_CS8900_BUS32
 #endif
 
 #else
index 6051480254339a33c9cf490b0a6875329a0d7e5d..618b7f0a7e0fe10529772cc81bf76d48c8caf1d6 100644 (file)
 /*
  * Hardware drivers
  */
-#define CONFIG_DRIVER_CS8900   1               /* we have a CS8900 on-board */
-#define CS8900_BASE            0x20000300
-#define CS8900_BUS16           1               /* the Linux driver does accesses as shorts */
+#define CONFIG_NET_MULTI
+#define CONFIG_CS8900          /* we have a CS8900 on-board */
+#define CONFIG_CS8900_BASE     0x20000300
+#define CONFIG_CS8900_BUS16    /* the Linux driver does accesses as shorts */
 
 #define CONFIG_DRIVER_S3C24X0_I2C      1       /* we use the buildin I2C controller */
 
index f7eec276858169fb9f88218f9167ba215989b1c4..49ea3a16685979c34e61cd8619ecc0b789331585 100644 (file)
 /*
  * Hardware drivers
  */
-#define CONFIG_DRIVER_CS8900   1       /* we have a CS8900 on-board */
-#define CS8900_BASE            0x20000300 /* armadillo board */
-#define CS8900_BUS16           1
-#undef  CS8900_BUS32
+#define CONFIG_NET_MULTI
+#define CONFIG_CS8900          /* we have a CS8900 on-board */
+#define CONFIG_CS8900_BASE     0x20000300 /* armadillo board */
+#define CONFIG_CS8900_BUS16
+#undef  CONFIG_CS8900_BUS32
 
 /*
  * select serial console configuration
index 12bab4702a1c1a83bd470a79702da4dd2d486fcd..0661d65aba4dfaa1e1bb8fd5b7b3439d00ab4e9e 100644 (file)
 /*
  * Network chip
  */
-#define CONFIG_DRIVER_CS8900   1
-#define CS8900_BUS32           1
-#define CS8900_BASE            0x08000000
+#define CONFIG_NET_MULTI
+#define CONFIG_CS8900
+#define CONFIG_CS8900_BUS32
+#define CONFIG_CS8900_BASE     0x08000000
 
 /*
  * Stack sizes
index 630fff3903ac4dfc505ce82df4ed3f0159b23645..e151faa9655ab916cffd88d2cf320ce77e6e591c 100644 (file)
 /*
  * Hardware drivers
  */
-#define CONFIG_DRIVER_CS8900   1       /* we have a CS8900 on-board */
-#define CS8900_BASE            0x20000000
-#define CS8900_BUS16           1
-#undef  CS8900_BUS32
+#define CONFIG_NET_MULTI
+#define CONFIG_CS8900          /* we have a CS8900 on-board */
+#define CONFIG_CS8900_BASE     0x20000000
+#define CONFIG_CS8900_BUS16
+#undef  CONFIG_CS8900_BUS32
 
 /*
  * select serial console configuration
index c7001cc7de87c9a3152eb21c73ff53b500a13c5a..fdfa022c0b0d3e3c7f18d415ee32b5d26d4b904c 100644 (file)
 /*
  * Hardware drivers
  */
-#define CONFIG_DRIVER_CS8900   1       /* we have a CS8900 on-board */
-#define CS8900_BASE            0x20000000
-#define CS8900_BUS32           1
+#define CONFIG_NET_MULTI
+#define CONFIG_CS8900          /* we have a CS8900 on-board */
+#define CONFIG_CS8900_BASE     0x20000000
+#define CONFIG_CS8900_BUS32
 
 /*
  * select serial console configuration
index 5d6d460424d24878dd2bcf6013ccf34bc248fa78..2d3b369aae68078c8c7fa53a03e53ee88a4b5a7d 100644 (file)
 /*
  * Hardware drivers
  */
-#define CONFIG_DRIVER_CS8900   1       /* we have a CS8900 on-board */
-#define CS8900_BASE            0x20008300
-#define CS8900_BUS16           1
+#define CONFIG_NET_MULTI
+#define CONFIG_CS8900          /* we have a CS8900 on-board */
+#define CONFIG_CS8900_BASE     0x20008300
+#define CONFIG_CS8900_BUS16
 
 /*
  * select serial console configuration
index 12e567bf7d4f4ca1893022685ee467e4aaf430ab..b2ffd3e935487849938ab4b2c6de1cb096ec2ca2 100644 (file)
 /*
  *  CS8900 Ethernet drivers
  */
-#define CONFIG_DRIVER_CS8900   1       /* we have a CS8900 on-board */
-#define CS8900_BASE            0x15000300
-#define CS8900_BUS16           1       /* the Linux driver does accesses as shorts */
+#define CONFIG_NET_MULTI
+#define CONFIG_CS8900          /* we have a CS8900 on-board */
+#define CONFIG_CS8900_BASE     0x15000300
+#define CONFIG_CS8900_BUS16    /* the Linux driver does accesses as shorts */
 
 /*
  * select serial console configuration
index 363ea1ba1fe62b2d5777a2064fee599ae249a223..ec1c90540341d134eb6dcaf930087dd43391e7af 100644 (file)
                "cp.b ${loadaddr} ${uboot_addr} ${filesize}; "          \
                "setenv filesize; saveenv\0"
 
-#define CONFIG_DRIVER_CS8900   1
-#define CS8900_BASE            0xb4020300
-#define CS8900_BUS16           1       /* follow the Linux driver */
+#define CONFIG_NET_MULTI
+#define CONFIG_CS8900
+#define CONFIG_CS8900_BASE     0xb4020300
+#define CONFIG_CS8900_BUS16            1       /* follow the Linux driver */
 
 /*
  * The MX31ADS board seems to have a hardware "peculiarity" confirmed under
index f3dc7fe97939d24d340d4afb16a7f6780ccb60a1..f2ea926f92465872a29953a00839035a992180de 100644 (file)
 /*
  * Hardware drivers
  */
-#define CONFIG_DRIVER_CS8900   1       /* we have a CS8900 on-board */
-#define CS8900_BASE            0x19000300
-#define CS8900_BUS16           1 /* the Linux driver does accesses as shorts */
+#define CONFIG_NET_MULTI
+#define CONFIG_CS8900          /* we have a CS8900 on-board */
+#define CONFIG_CS8900_BASE     0x19000300
+#define CONFIG_CS8900_BUS16    /* the Linux driver does accesses as shorts */
 
 /*
  * select serial console configuration
index b712db44f482241152dde810ddadf78f0fab8402..c23417776738ad9270f03c3c4d88dd5bd5a55a8d 100644 (file)
 /*
  * Hardware drivers
  */
-#define CONFIG_DRIVER_CS8900   1       /* we have a CS8900 on-board */
-#define CS8900_BASE            0x07000300 /* agrees with WIN CE PA */
-#define CS8900_BUS16           1 /* the Linux driver does accesses as shorts */
+#define CONFIG_NET_MULTI
+#define CONFIG_CS8900          /* we have a CS8900 on-board */
+#define CONFIG_CS8900_BASE     0x07000300 /* agrees with WIN CE PA */
+#define CONFIG_CS8900_BUS16    /* the Linux driver does accesses as shorts */
 
 /*
  * select serial console configuration
index a4732783d98306967a8d2e2e0dfb63e07d36ef4b..d340098d0bcd4a02215a6043f8850a7534dc536f 100644 (file)
 /*
  * Hardware drivers
  */
-#define CONFIG_DRIVER_CS8900   1       /* we have a CS8900 on-board */
-#define CS8900_BASE            0x19000300
-#define CS8900_BUS16           1 /* the Linux driver does accesses as shorts */
+#define CONFIG_NET_MULTI
+#define CONFIG_CS8900          /* we have a CS8900 on-board */
+#define CONFIG_CS8900_BASE     0x19000300
+#define CONFIG_CS8900_BUS16    /* the Linux driver does accesses as shorts */
 
 /*
  * select serial console configuration
index ddc8e7174af987596b8f35b69d7832b9048a2f30..f6e1221294f332f95026ad50360803ec42747dc6 100644 (file)
 /*
  * Hardware drivers
  */
-#define CONFIG_DRIVER_CS8900   1       /* we have a CS8900 on-board    */
-#define CS8900_BASE            0x18800300
-#define CS8900_BUS16           1       /* follow the Linux driver      */
+#define CONFIG_NET_MULTI
+#define CONFIG_CS8900                  /* we have a CS8900 on-board    */
+#define CONFIG_CS8900_BASE             0x18800300
+#define CONFIG_CS8900_BUS16            /* follow the Linux driver      */
 
 /*
  * select serial console configuration
index 7687ee6dcbae6aeaf0151f9b4ecc605226795525..43c191b4356c1e87f30ff7aaa7f5fde2c0320ba8 100644 (file)
 /*
  * Hardware drivers
  */
-#define CONFIG_DRIVER_CS8900   1       /* we have a CS8900 on-board */
-#define CS8900_BASE            0x07000300 /* agrees with WIN CE PA */
-#define CS8900_BUS16           1 /* the Linux driver does accesses as shorts */
+#define CONFIG_NET_MULTI
+#define CONFIG_CS8900          /* we have a CS8900 on-board */
+#define CONFIG_CS8900_BASE     0x07000300 /* agrees with WIN CE PA */
+#define CONFIG_CS8900_BUS16    /* the Linux driver does accesses as shorts */
 
 #define CONFIG_DRIVER_S3C24X0_I2C 1    /* we use the buildin I2C controller */
 
index 50329a3f53b0f49271ec06e23a9420418b9c6b65..a50ec67d5319a0cd396b58b201c9ab88e8877eaa 100644 (file)
@@ -43,6 +43,7 @@ int cpu_eth_init(bd_t *bis);
 /* Driver initialization prototypes */
 int au1x00_enet_initialize(bd_t*);
 int bfin_EMAC_initialize(bd_t *bis);
+int cs8900_initialize(u8 dev_num, int base_addr);
 int dc21x4x_initialize(bd_t *bis);
 int davinci_emac_initialize(void);
 int dnet_eth_initialize(int id, void *regs, unsigned int phy_addr);
index a44d308f6728c631d92a9a886e62996ca86d9a3b..fa87d51373156b7f87bd1d979c47e7053696c557 100644 (file)
@@ -73,10 +73,6 @@ extern void dataflash_print_info(void);
 const char version_string[] =
        U_BOOT_VERSION" (" U_BOOT_DATE " - " U_BOOT_TIME ")"CONFIG_IDENT_STRING;
 
-#ifdef CONFIG_DRIVER_CS8900
-extern void cs8900_get_enetaddr (void);
-#endif
-
 #ifdef CONFIG_DRIVER_RTL8019
 extern void rtl8019_get_enetaddr (uchar * addr);
 #endif
@@ -423,11 +419,6 @@ extern void davinci_eth_set_mac_addr (const u_int8_t *addr);
        }
 #endif
 
-#ifdef CONFIG_DRIVER_CS8900
-       /* XXX: this needs to be moved to board init */
-       cs8900_get_enetaddr ();
-#endif
-
 #if defined(CONFIG_DRIVER_SMC91111) || defined (CONFIG_DRIVER_LAN91C96)
        /* XXX: this needs to be moved to board init */
        if (getenv ("ethaddr")) {