Convert CS8900 Ethernet driver to CONFIG_NET_MULTI API
cover Convert CS8900 Ethernet driver to CONFIG_NET_MULTI API
Hello,
This driver is compile-tested only on ARM platform. I'm hoping some volunteers can test it on real hardware.
thanks,
Ben
--- board/altera/dk1c20/dk1c20.c | 12 ++ board/altera/dk1s10/dk1s10.c | 12 ++ board/armadillo/armadillo.c | 12 ++ board/csb226/csb226.c | 12 ++ board/ep7312/ep7312.c | 12 ++ board/freescale/mx31ads/mx31ads.c | 12 ++ board/impa7/impa7.c | 12 ++ board/lart/lart.c | 12 ++ board/mpl/vcma9/cmd_vcma9.c | 28 +++-- board/mpl/vcma9/vcma9.c | 12 ++ board/mx1ads/mx1ads.c | 12 ++ board/samsung/smdk2400/smdk2400.c | 12 ++ board/samsung/smdk2410/smdk2410.c | 12 ++ board/samsung/smdk6400/smdk6400.c | 12 ++ board/sbc2410x/sbc2410x.c | 12 ++ board/ssv/adnpesc1/adnpesc1.c | 12 ++ board/trab/trab.c | 12 ++ drivers/net/Makefile | 2 +- drivers/net/cs8900.c | 243 ++++++++++++++++++++----------------- drivers/net/cs8900.h | 41 ++++--- include/configs/ADNPESC1.h | 14 ++- include/configs/DK1C20.h | 14 ++- include/configs/DK1S10.h | 14 ++- include/configs/VCMA9.h | 7 +- include/configs/armadillo.h | 9 +- include/configs/csb226.h | 7 +- include/configs/ep7312.h | 9 +- include/configs/impa7.h | 7 +- include/configs/lart.h | 7 +- include/configs/mx1ads.h | 7 +- include/configs/mx31ads.h | 7 +- include/configs/sbc2410x.h | 7 +- include/configs/smdk2400.h | 7 +- include/configs/smdk2410.h | 7 +- include/configs/smdk6400.h | 7 +- include/configs/trab.h | 7 +- include/netdev.h | 1 + lib_arm/board.c | 9 -- 38 files changed, 448 insertions(+), 205 deletions(-)
PATCH 1/1 Convert CS8900 Ethernet driver to CONFIG_NET_MULTI API
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
--- board/altera/dk1c20/dk1c20.c | 12 ++ board/altera/dk1s10/dk1s10.c | 12 ++ board/armadillo/armadillo.c | 12 ++ board/csb226/csb226.c | 12 ++ board/ep7312/ep7312.c | 12 ++ board/freescale/mx31ads/mx31ads.c | 12 ++ board/impa7/impa7.c | 12 ++ board/lart/lart.c | 12 ++ board/mpl/vcma9/cmd_vcma9.c | 28 +++-- board/mpl/vcma9/vcma9.c | 12 ++ board/mx1ads/mx1ads.c | 12 ++ board/samsung/smdk2400/smdk2400.c | 12 ++ board/samsung/smdk2410/smdk2410.c | 12 ++ board/samsung/smdk6400/smdk6400.c | 12 ++ board/sbc2410x/sbc2410x.c | 12 ++ board/ssv/adnpesc1/adnpesc1.c | 12 ++ board/trab/trab.c | 12 ++ drivers/net/Makefile | 2 +- drivers/net/cs8900.c | 243 ++++++++++++++++++++----------------- drivers/net/cs8900.h | 41 ++++--- include/configs/ADNPESC1.h | 14 ++- include/configs/DK1C20.h | 14 ++- include/configs/DK1S10.h | 14 ++- include/configs/VCMA9.h | 7 +- include/configs/armadillo.h | 9 +- include/configs/csb226.h | 7 +- include/configs/ep7312.h | 9 +- include/configs/impa7.h | 7 +- include/configs/lart.h | 7 +- include/configs/mx1ads.h | 7 +- include/configs/mx31ads.h | 7 +- include/configs/sbc2410x.h | 7 +- include/configs/smdk2400.h | 7 +- include/configs/smdk2410.h | 7 +- include/configs/smdk6400.h | 7 +- include/configs/trab.h | 7 +- include/netdev.h | 1 + lib_arm/board.c | 9 -- 38 files changed, 448 insertions(+), 205 deletions(-)
board/altera/dk1c20/dk1c20.c +12 -0
@@ -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
board/altera/dk1s10/dk1s10.c +12 -0
@@ -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
board/armadillo/armadillo.c +12 -0
@@ -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
board/csb226/csb226.c +12 -0
@@ -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
board/ep7312/ep7312.c +12 -0
@@ -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
board/freescale/mx31ads/mx31ads.c +12 -0
@@ -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
board/impa7/impa7.c +12 -0
@@ -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
board/lart/lart.c +12 -0
@@ -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
board/mpl/vcma9/cmd_vcma9.c +18 -10
@@ -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); }
board/mpl/vcma9/vcma9.c +12 -0
@@ -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
board/mx1ads/mx1ads.c +12 -0
@@ -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
board/samsung/smdk2400/smdk2400.c +12 -0
@@ -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
board/samsung/smdk2410/smdk2410.c +12 -0
@@ -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
board/samsung/smdk6400/smdk6400.c +12 -0
@@ -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
board/sbc2410x/sbc2410x.c +12 -0
@@ -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
board/ssv/adnpesc1/adnpesc1.c +12 -0
@@ -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
board/trab/trab.c +12 -0
@@ -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
drivers/net/Makefile +1 -1
@@ -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
drivers/net/cs8900.c +134 -109
385 lines not on this page · raw message
drivers/net/cs8900.h +24 -17
70 lines not on this page · raw message
include/configs/ADNPESC1.h +8 -6
@@ -426,15 +426,17 @@/********************************************/ /* !!! 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
include/configs/DK1C20.h +8 -6
@@ -232,15 +232,17 @@/********************************************/ /* !!! 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
include/configs/DK1S10.h +8 -6
@@ -249,15 +249,17 @@/********************************************/ /* !!! 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
include/configs/VCMA9.h +4 -3
@@ -108,9 +108,10 @@/* * 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 */
include/configs/armadillo.h +5 -4
@@ -56,10 +56,11 @@/* * 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
include/configs/csb226.h +4 -3
@@ -150,9 +150,10 @@/* * 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
include/configs/ep7312.h +5 -4
@@ -47,10 +47,11 @@/* * 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
include/configs/impa7.h +4 -3
@@ -47,9 +47,10 @@/* * 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
include/configs/lart.h +4 -3
@@ -47,9 +47,10 @@/* * 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
include/configs/mx1ads.h +4 -3
@@ -66,9 +66,10 @@/* * 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
include/configs/mx31ads.h +4 -3
@@ -109,9 +109,10 @@"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
include/configs/sbc2410x.h +4 -3
@@ -63,9 +63,10 @@/* * 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
include/configs/smdk2400.h +4 -3
@@ -56,9 +56,10 @@/* * 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
include/configs/smdk2410.h +4 -3
@@ -53,9 +53,10 @@/* * 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
include/configs/smdk6400.h +4 -3
@@ -74,9 +74,10 @@/* * 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
include/configs/trab.h +4 -3
@@ -99,9 +99,10 @@/* * 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 */
include/netdev.h +1 -0
@@ -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);
lib_arm/board.c +0 -9
@@ -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" )) {
Signature · 1 line
1.5.6.3
PATCH 1/1 Convert CS8900 Ethernet driver to CONFIG_NET_MULTI API
Dear Ben Warren,
Quoted 11 lines · In message <[email protected]> you…
All in-tree boards that use this controller have
CONFIG_NET_MULTIadded
Also:
- changedCONFIG_DRIVER_CS8900toCONFIG_CS8900
- changedCS8900_BASEtoCONFIG_CS8900_BASE
- changedCS8900_BUS?? toCONFIG_CS8900_BUS??
- cleaned up line lengths
- modified VCMA9 command function that accesses the device
- removed MAC address initialization fromlib_arm/board.cSigned-off-by Ben Warren <[email protected]>
The patch fails on "trab" (which is, as far as this patch is concerned, basicly identical to SMDK2400):
U-Boot 2009.08-rc2-00017-g7d4cd15-dirty (Aug 12 2009 - 23:55:37)
I2C: ready DRAM: 32 MB Flash: 8 MB USB: scanning bus for devices... 1 USB Device(s) found
0 Storage Device(s) found
Net: CS8900-0
Enter password - autoboot in 5 sec...
TRAB # tftp C100000 trab/u-boot.bin-wd
CS8900 Ethernet chip not found?!
Using CS8900-0 device
TFTP from server 192.168.1.1; our IP address is 192.168.3.68 Filename 'trab/u-boot.bin-wd'.
Load address: 0xc100000
Loading: data abort
pc : [<0df6b310>] lr : [<0df4cc44>]
sp : 0df1bd74 ip : 0df1c0e8 fp : 00000045
r10: 0df7a320 r9 : 00000032 r8 : 0df1bfd8
r7 : 00000000 r6 : 0df1c0e8 r5 : 0000002a r4 : 0000005c
r3 : 000000c0 r2 : ea000012 r1 : 0df7a320 r0 : 0df1c0e8
Flags: nzCv IRQs off FIQs off Mode SVC_32
Resetting CPU ...
resetting ...
I see two issues here - the obvious "CS8900 Ethernet chip not found?!", and the fact that the (uninitialized?) driver then crashes the board.
With DEBUG enabled, I see the same, i. e. no additional information.
With the following patch applied (which you might want to add - but please check if the changed return code makes sense; it doesn;t change behaviour, it seems) I get this:
drivers/net/cs8900.c +6 -3
@@ -154,11 +154,14 @@ void cs8900_halt(struct eth_device *dev)static int cs8900_init (struct eth_device *dev,bd_t * bd) {uchar *enetaddr = dev->enetaddr; +u16 id;/* verify chip id */ -if (get_reg_init_bus (dev, 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 ; }cs8900_reset (dev);
TRAB # tftp C100000 trab/u-boot.bin-wd
CS8900 Ethernet chip not found: ID=0x0012 instead 0x630e Using CS8900-0 device
TFTP from server 192.168.1.1; our IP address is 192.168.3.68 Filename 'trab/u-boot.bin-wd'.
Load address: 0xc100000
Loading: data abort
pc : [<0df6b320>] lr : [<0df4cc44>]
sp : 0df1bd74 ip : 0df1c0e8 fp : 00000045
r10: 0df7a320 r9 : 00000032 r8 : 0df1bfd8
r7 : 00000000 r6 : 0df1c0e8 r5 : 0000002a r4 : 0000005c
r3 : 000000c0 r2 : ea000012 r1 : 0df7a320 r0 : 0df1c0e8
Flags: nzCv IRQs off FIQs off Mode SVC_32
Resetting CPU ...
So it's reading indeed a bad ID ...
Best regards,
Wolfgang Denk
Signature · 6 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
If I don't document something, it's usually either for a good reason,
or a bad reason. In this case it's a good reason. :-)
- Larry Wall in <[email protected]>PATCH 1/1 Convert CS8900 Ethernet driver to CONFIG_NET_MULTI API
Hi Wolfgang,
Quoted 14 lines · Wolfgang Denk
Dear Ben Warren,
Quoted 10 lines · In message <[email protected]> you…
All in-tree boards that use this controller have
CONFIG_NET_MULTIadded
Also:
- changedCONFIG_DRIVER_CS8900toCONFIG_CS8900
- changedCS8900_BASEtoCONFIG_CS8900_BASE
- changedCS8900_BUS?? toCONFIG_CS8900_BUS??
- cleaned up line lengths
- modified VCMA9 command function that accesses the device
- removed MAC address initialization fromlib_arm/board.c
Quoted 7 lines
Quoted 2 lines
Signed-off-by Ben Warren <[email protected]>The patch fails on "trab" (which is, as far as this patch is concerned, basicly identical to SMDK2400):
Thank you very much for the fast, useful feedback!
Quoted 25 lines
U-Boot 2009.08-rc2-00017-g7d4cd15-dirty (Aug 12 2009 - 23:55:37)
I2C: ready DRAM: 32 MB Flash: 8 MB USB: scanning bus for devices... 1 USB Device(s) found0 Storage Device(s) found
Net: CS8900-0Enter password - autoboot in 5 sec...
TRAB # tftp C100000 trab/u-boot.bin-wd
CS8900 Ethernet chip not found?!
Using CS8900-0 device
TFTP from server 192.168.1.1; our IP address is 192.168.3.68 Filename 'trab/u-boot.bin-wd'.
Load address:0xc100000
Loading: data abortpc : [<0df6b310>] lr : [<0df4cc44>]sp :
0df1bd74ip :0df1c0e8fp : 00000045
r10:0df7a320r9 : 00000032 r8 :0df1bfd8
r7 : 00000000 r6 :0df1c0e8r5 :0000002ar4 :0000005c
r3 :000000c0r2 :ea000012r1 :0df7a320r0 :0df1c0e8
Flags: nzCv IRQs off FIQs off ModeSVC_32
Resetting CPU ...
Quoted 8 lines
resetting ...
I see two issues here - the obvious "CS8900 Ethernet chip not found?!", and the fact that the (uninitialized?) driver then crashes the board.
Uh, yeah. Two serious problems :)
Quoted 46 lines
With DEBUG enabled, I see the same, i. e. no additional information.
With the following patch applied (which you might want to add - but please check if the changed return code makes sense; it doesn;t change behaviour, it seems) I get this:
drivers/net/cs8900.c +6
-3@@ -154,11 +154,14 @@ void cs8900_halt(struct eth_device *dev)static int cs8900_init (struct eth_device *dev,bd_t * bd) {uchar *enetaddr = dev->enetaddr; +u16 id;/* verify chip id */ -if (get_reg_init_bus (dev, 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 ; }cs8900_reset (dev);TRAB # tftp C100000 trab/u-boot.bin-wd
CS8900 Ethernet chip not found: ID=0x0012 instead0x630eUsing CS8900-0 device
TFTP from server 192.168.1.1; our IP address is 192.168.3.68 Filename 'trab/u-boot.bin-wd'.
Load address:0xc100000
Loading: data abortpc : [<0df6b320>] lr : [<0df4cc44>]sp :
0df1bd74ip :0df1c0e8fp : 00000045
r10:0df7a320r9 : 00000032 r8 :0df1bfd8
r7 : 00000000 r6 :0df1c0e8r5 :0000002ar4 :0000005c
r3 :000000c0r2 :ea000012r1 :0df7a320r0 :0df1c0e8
Flags: nzCv IRQs off FIQs off ModeSVC_32
Resetting CPU ...
Quoted 3 lines
So it's reading indeed a bad ID ...
It looks like the 'trab' board uses 16-bit accesses (CONFIG_CS8900_BUS16). The function 'get_reg_init_bus()' does some funny initialization to get the chip into 16-bit mode. I wonder if maybe that's not working the same as the original. That could explain the crash too.
BTW - it shouldn't matter in this case, but there's a typo in cs8900.c that this should fix:
drivers/net/cs8900.c +1 -1
@@ -50,7 +50,7 @@/* packet page register access functions */ -#ifdef CS8900_BUS32 +#ifdef CONFIG_CS8900_BUS32 /* we don't need 16 bit initialisation on 32 bit bus */ #define get_reg_init_bus (x) get_reg((x))#else
Best regards,
Quoted 3 lines
Wolfgang Denk
regards,
Ben
PATCH 1/1 Convert CS8900 Ethernet driver to CONFIG_NET_MULTI API
Dear Ben Warren,
Quoted 6 lines · In message <[email protected]> you wrote:
It looks like the 'trab' board uses 16-bit accesses (
CONFIG_CS8900_BUS16). The function 'get_reg_init_bus()' does some funny initialization to get the chip into 16-bit mode. I wonder if maybe that's not working the same as the original. That could explain the crash too.
Yes...
Quoted 2 lines
BTW - it shouldn't matter in this case, but there's a typo in
cs8900.cthat this should fix:
I confirm that this change has no impact on the current issue.
Note however that your modification was probably not the (only) culprit. With current mainline version I get this:
TRAB # run load
TFTP from server 192.168.1.1; our IP address is 192.168.3.68 Filename 'trab/u-boot.bin-wd'.
Load address: 0xc100000
Loading: T T T T T T T T T T
Retry count exceeded; starting again
TFTP from server 192.168.1.1; our IP address is 192.168.3.68 Filename 'trab/u-boot.bin-wd'.
Load address: 0xc100000
Loading: T T T T T T T T T T
Retry count exceeded; starting again
TFTP from server 192.168.1.1; our IP address is 192.168.3.68 Filename 'trab/u-boot.bin-wd'.
Load address: 0xc100000
Loading: T T T T T T T T T T
Retry count exceeded; starting again
with the timeouts being *way* too fast.
It seems that 1.2.0 was the last version that has been actually tested on trab / SMDK2400.
I'll try to run a git bisect tomorrow; need to get some sleep now.
Best regards,
Wolfgang Denk
Signature · 5 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de As long as we're going to reinvent the wheel again, we might as well try making it round this time. - Mike Dennison