diff options
author | Ben Warren <biggerbadderben@gmail.com> | 2009-10-04 22:37:03 -0700 |
---|---|---|
committer | Ben Warren <biggerbadderben@gmail.com> | 2009-10-04 22:37:03 -0700 |
commit | 7194ab809532eeca3e2ee5dc12017cb901cc5842 (patch) | |
tree | 635cd41e409da222cfa7f975d1fcccfc14cc9b8c /board | |
parent | 32e7f239dda8638377edb0d3e7ac269cabbafbe6 (diff) | |
download | u-boot-imx-7194ab809532eeca3e2ee5dc12017cb901cc5842.zip u-boot-imx-7194ab809532eeca3e2ee5dc12017cb901cc5842.tar.gz u-boot-imx-7194ab809532eeca3e2ee5dc12017cb901cc5842.tar.bz2 |
Convert SMC91111 Ethernet driver to CONFIG_NET_MULTI API
All in-tree boards that use this controller have CONFIG_NET_MULTI
added
Also:
- changed CONFIG_DRIVER_SMC91111 to CONFIG_SMC91111
- cleaned up line lengths
- modified all boards that override weak function in this driver
- modified all eeprom standalone apps to work with new driver
- updated blackfin standalone EEPROM app after testing
Signed-off-by: Ben Warren <biggerbadderben@gmail.com>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Diffstat (limited to 'board')
34 files changed, 413 insertions, 58 deletions
diff --git a/board/altera/ep1c20/ep1c20.c b/board/altera/ep1c20/ep1c20.c index c5bfb85..82900f7 100644 --- a/board/altera/ep1c20/ep1c20.c +++ b/board/altera/ep1c20/ep1c20.c @@ -22,6 +22,7 @@ */ #include <common.h> +#include <netdev.h> int board_early_init_f (void) { @@ -38,3 +39,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_SMC91111 + rc = smc91111_initialize(0, CONFIG_SMC91111_BASE); +#endif + return rc; +} +#endif diff --git a/board/altera/ep1s10/ep1s10.c b/board/altera/ep1s10/ep1s10.c index de9bf42..cf886da 100644 --- a/board/altera/ep1s10/ep1s10.c +++ b/board/altera/ep1s10/ep1s10.c @@ -22,6 +22,7 @@ */ #include <common.h> +#include <netdev.h> int board_early_init_f (void) { @@ -38,3 +39,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_SMC91111 + rc = smc91111_initialize(0, CONFIG_SMC91111_BASE); +#endif + return rc; +} +#endif diff --git a/board/altera/ep1s40/ep1s40.c b/board/altera/ep1s40/ep1s40.c index c0eca17..6395de7 100644 --- a/board/altera/ep1s40/ep1s40.c +++ b/board/altera/ep1s40/ep1s40.c @@ -22,6 +22,7 @@ */ #include <common.h> +#include <netdev.h> int checkboard (void) { @@ -33,3 +34,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_SMC91111 + rc = smc91111_initialize(0, CONFIG_SMC91111_BASE); +#endif + return rc; +} +#endif diff --git a/board/armltd/integrator/integrator.c b/board/armltd/integrator/integrator.c index a46deea..518944e 100644 --- a/board/armltd/integrator/integrator.c +++ b/board/armltd/integrator/integrator.c @@ -34,9 +34,7 @@ */ #include <common.h> -#ifdef CONFIG_PCI #include <netdev.h> -#endif DECLARE_GLOBAL_DATA_PTR; @@ -127,9 +125,16 @@ extern void dram_query(void); return 0; } -#ifdef CONFIG_PCI +#ifdef CONFIG_CMD_NET int board_eth_init(bd_t *bis) { - return pci_eth_init(bis); + int rc = 0; +#ifdef CONFIG_SMC91111 + rc = smc91111_initialize(0, CONFIG_SMC91111_BASE); +#endif +#ifdef CONFIG_PCI + rc += pci_eth_init(bis); +#endif + return rc; } #endif diff --git a/board/armltd/versatile/versatile.c b/board/armltd/versatile/versatile.c index 197bc89..6e836dd 100644 --- a/board/armltd/versatile/versatile.c +++ b/board/armltd/versatile/versatile.c @@ -34,6 +34,7 @@ */ #include <common.h> +#include <netdev.h> DECLARE_GLOBAL_DATA_PTR; @@ -89,3 +90,14 @@ int dram_init (void) { return 0; } + +#ifdef CONFIG_CMD_NET +int board_eth_init(bd_t *bis) +{ + int rc = 0; +#ifdef CONFIG_SMC91111 + rc = smc91111_initialize(0, CONFIG_SMC91111_BASE); +#endif + return rc; +} +#endif diff --git a/board/bf533-ezkit/bf533-ezkit.c b/board/bf533-ezkit/bf533-ezkit.c index d5f0b7c..8727dee 100644 --- a/board/bf533-ezkit/bf533-ezkit.c +++ b/board/bf533-ezkit/bf533-ezkit.c @@ -26,6 +26,7 @@ */ #include <common.h> +#include <netdev.h> #include "psd4256.h" #include "flash-defines.h" @@ -57,3 +58,10 @@ int misc_init_r(void) return 0; } + +#ifdef CONFIG_SMC91111 +int board_eth_init(bd_t *bis) +{ + return smc91111_initialize(0, CONFIG_SMC91111_BASE); +} +#endif diff --git a/board/bf533-stamp/bf533-stamp.c b/board/bf533-stamp/bf533-stamp.c index 7108dda..a226910 100644 --- a/board/bf533-stamp/bf533-stamp.c +++ b/board/bf533-stamp/bf533-stamp.c @@ -26,6 +26,7 @@ */ #include <common.h> +#include <netdev.h> #include <asm/io.h> #include "bf533-stamp.h" @@ -283,3 +284,10 @@ void __led_toggle(led_id_t mask) } #endif + +#ifdef CONFIG_SMC91111 +int board_eth_init(bd_t *bis) +{ + return smc91111_initialize(0, CONFIG_SMC91111_BASE); +} +#endif diff --git a/board/bf538f-ezkit/bf538f-ezkit.c b/board/bf538f-ezkit/bf538f-ezkit.c index bbee989..15916fa 100644 --- a/board/bf538f-ezkit/bf538f-ezkit.c +++ b/board/bf538f-ezkit/bf538f-ezkit.c @@ -7,6 +7,7 @@ */ #include <common.h> +#include <netdev.h> #include <config.h> #include <asm/blackfin.h> @@ -25,3 +26,10 @@ phys_size_t initdram(int board_type) gd->bd->bi_memsize = CONFIG_SYS_MAX_RAM_SIZE; return gd->bd->bi_memsize; } + +#ifdef CONFIG_SMC91111 +int board_eth_init(bd_t *bis) +{ + return smc91111_initialize(0, CONFIG_SMC91111_BASE); +} +#endif diff --git a/board/bf561-ezkit/bf561-ezkit.c b/board/bf561-ezkit/bf561-ezkit.c index 5aede17..e5d7eb3 100644 --- a/board/bf561-ezkit/bf561-ezkit.c +++ b/board/bf561-ezkit/bf561-ezkit.c @@ -26,6 +26,7 @@ */ #include <common.h> +#include <netdev.h> #include <asm/io.h> DECLARE_GLOBAL_DATA_PTR; @@ -43,3 +44,10 @@ phys_size_t initdram(int board_type) gd->bd->bi_memsize = CONFIG_SYS_MAX_RAM_SIZE; return gd->bd->bi_memsize; } + +#ifdef CONFIG_SMC91111 +int board_eth_init(bd_t *bis) +{ + return smc91111_initialize(0, CONFIG_SMC91111_BASE); +} +#endif diff --git a/board/blackstamp/blackstamp.c b/board/blackstamp/blackstamp.c index b671899..f55ab97 100644 --- a/board/blackstamp/blackstamp.c +++ b/board/blackstamp/blackstamp.c @@ -12,6 +12,7 @@ */ #include <common.h> +#include <netdev.h> #include <asm/io.h> DECLARE_GLOBAL_DATA_PTR; @@ -44,3 +45,10 @@ void swap_to(int device_id) SSYNC(); } #endif + +#ifdef CONFIG_SMC91111 +int board_eth_init(bd_t *bis) +{ + return smc91111_initialize(0, CONFIG_SMC91111_BASE); +} +#endif diff --git a/board/cerf250/cerf250.c b/board/cerf250/cerf250.c index 307894f..59346bc 100644 --- a/board/cerf250/cerf250.c +++ b/board/cerf250/cerf250.c @@ -26,6 +26,7 @@ */ #include <common.h> +#include <netdev.h> DECLARE_GLOBAL_DATA_PTR; @@ -71,3 +72,14 @@ int dram_init (void) return 0; } + +#ifdef CONFIG_CMD_NET +int board_eth_init(bd_t *bis) +{ + int rc = 0; +#ifdef CONFIG_SMC91111 + rc = smc91111_initialize(0, CONFIG_SMC91111_BASE); +#endif + return rc; +} +#endif diff --git a/board/cm-bf533/cm-bf533.c b/board/cm-bf533/cm-bf533.c index 7eb761d..ab0bf3b 100644 --- a/board/cm-bf533/cm-bf533.c +++ b/board/cm-bf533/cm-bf533.c @@ -7,6 +7,7 @@ */ #include <common.h> +#include <netdev.h> DECLARE_GLOBAL_DATA_PTR; @@ -23,3 +24,10 @@ phys_size_t initdram(int board_type) gd->bd->bi_memsize = CONFIG_SYS_MAX_RAM_SIZE; return gd->bd->bi_memsize; } + +#ifdef CONFIG_SMC91111 +int board_eth_init(bd_t *bis) +{ + return smc91111_initialize(0, CONFIG_SMC91111_BASE); +} +#endif diff --git a/board/cm-bf561/cm-bf561.c b/board/cm-bf561/cm-bf561.c index 5bce9eb..f21a015 100644 --- a/board/cm-bf561/cm-bf561.c +++ b/board/cm-bf561/cm-bf561.c @@ -7,6 +7,7 @@ */ #include <common.h> +#include <netdev.h> DECLARE_GLOBAL_DATA_PTR; @@ -23,3 +24,10 @@ phys_size_t initdram(int board_type) gd->bd->bi_memsize = CONFIG_SYS_MAX_RAM_SIZE; return gd->bd->bi_memsize; } + +#ifdef CONFIG_SMC91111 +int board_eth_init(bd_t *bis) +{ + return smc91111_initialize(0, CONFIG_SMC91111_BASE); +} +#endif diff --git a/board/cradle/cradle.c b/board/cradle/cradle.c index 6d8d555..21eb655 100644 --- a/board/cradle/cradle.c +++ b/board/cradle/cradle.c @@ -27,6 +27,7 @@ #include <asm/arch/pxa-regs.h> #include <common.h> +#include <netdev.h> DECLARE_GLOBAL_DATA_PTR; @@ -223,3 +224,14 @@ dram_init (void) PHYS_SDRAM_3_SIZE + PHYS_SDRAM_4_SIZE ); } + +#ifdef CONFIG_CMD_NET +int board_eth_init(bd_t *bis) +{ + int rc = 0; +#ifdef CONFIG_SMC91111 + rc = smc91111_initialize(0, CONFIG_SMC91111_BASE); +#endif + return rc; +} +#endif diff --git a/board/delta/delta.c b/board/delta/delta.c index 84ff47e..a294213 100644 --- a/board/delta/delta.c +++ b/board/delta/delta.c @@ -22,6 +22,7 @@ */ #include <common.h> +#include <netdev.h> #include <i2c.h> #include <da9030.h> #include <malloc.h> @@ -363,3 +364,14 @@ void hw_watchdog_reset(void) i2c_reg_write(addr, SYS_CONTROL_A, val); } #endif + +#ifdef CONFIG_CMD_NET +int board_eth_init(bd_t *bis) +{ + int rc = 0; +#ifdef CONFIG_SMC91111 + rc = smc91111_initialize(0, CONFIG_SMC91111_BASE); +#endif + return rc; +} +#endif diff --git a/board/dnp1110/dnp1110.c b/board/dnp1110/dnp1110.c index ab8e7be..c215f5f 100644 --- a/board/dnp1110/dnp1110.c +++ b/board/dnp1110/dnp1110.c @@ -23,6 +23,7 @@ */ #include <common.h> +#include <netdev.h> #include <SA-1100.h> DECLARE_GLOBAL_DATA_PTR; @@ -53,3 +54,14 @@ int dram_init (void) return (0); } + +#ifdef CONFIG_CMD_NET +int board_eth_init(bd_t *bis) +{ + int rc = 0; +#ifdef CONFIG_SMC91111 + rc = smc91111_initialize(0, CONFIG_SMC91111_BASE); +#endif + return rc; +} +#endif diff --git a/board/gaisler/gr_cpci_ax2000/gr_cpci_ax2000.c b/board/gaisler/gr_cpci_ax2000/gr_cpci_ax2000.c index 105a747..7fe85b8 100644 --- a/board/gaisler/gr_cpci_ax2000/gr_cpci_ax2000.c +++ b/board/gaisler/gr_cpci_ax2000/gr_cpci_ax2000.c @@ -19,6 +19,7 @@ */ #include <common.h> +#include <netdev.h> #include <config.h> #include <asm/leon.h> @@ -37,3 +38,14 @@ int misc_init_r(void) { return 0; } + +#ifdef CONFIG_CMD_NET +int board_eth_init(bd_t *bis) +{ + int rc = 0; +#ifdef CONFIG_SMC91111 + rc = smc91111_initialize(0, CONFIG_SMC91111_BASE); +#endif + return rc; +} +#endif diff --git a/board/gaisler/gr_ep2s60/gr_ep2s60.c b/board/gaisler/gr_ep2s60/gr_ep2s60.c index 2904d32..7241c6d 100644 --- a/board/gaisler/gr_ep2s60/gr_ep2s60.c +++ b/board/gaisler/gr_ep2s60/gr_ep2s60.c @@ -19,6 +19,7 @@ */ #include <common.h> +#include <netdev.h> #include <config.h> #include <asm/leon.h> @@ -37,3 +38,14 @@ int misc_init_r(void) { return 0; } + +#ifdef CONFIG_CMD_NET +int board_eth_init(bd_t *bis) +{ + int rc = 0; +#ifdef CONFIG_SMC91111 + rc = smc91111_initialize(0, CONFIG_SMC91111_BASE); +#endif + return rc; +} +#endif diff --git a/board/innokom/innokom.c b/board/innokom/innokom.c index c2b88ae..3412f10 100644 --- a/board/innokom/innokom.c +++ b/board/innokom/innokom.c @@ -24,6 +24,7 @@ */ #include <common.h> +#include <netdev.h> #include <asm/arch/pxa-regs.h> #include <asm/mach-types.h> @@ -182,3 +183,14 @@ void show_boot_progress (int status) return; } + +#ifdef CONFIG_CMD_NET +int board_eth_init(bd_t *bis) +{ + int rc = 0; +#ifdef CONFIG_SMC91111 + rc = smc91111_initialize(0, CONFIG_SMC91111_BASE); +#endif + return rc; +} +#endif diff --git a/board/logodl/logodl.c b/board/logodl/logodl.c index c57210a..2562ecc 100644 --- a/board/logodl/logodl.c +++ b/board/logodl/logodl.c @@ -23,6 +23,7 @@ */ #include <common.h> +#include <netdev.h> #include <asm/arch/pxa-regs.h> DECLARE_GLOBAL_DATA_PTR; @@ -120,3 +121,14 @@ void show_boot_progress (int status) return; } + +#ifdef CONFIG_CMD_NET +int board_eth_init(bd_t *bis) +{ + int rc = 0; +#ifdef CONFIG_SMC91111 + rc = smc91111_initialize(0, CONFIG_SMC91111_BASE); +#endif + return rc; +} +#endif diff --git a/board/lpd7a40x/lpd7a40x.c b/board/lpd7a40x/lpd7a40x.c index 7edb65e..437dad0 100644 --- a/board/lpd7a40x/lpd7a40x.c +++ b/board/lpd7a40x/lpd7a40x.c @@ -26,6 +26,7 @@ */ #include <common.h> +#include <netdev.h> #if defined(CONFIG_LH7A400) #include <lh7a400.h> #elif defined(CONFIG_LH7A404) @@ -79,3 +80,14 @@ int dram_init (void) return 0; } + +#ifdef CONFIG_CMD_NET +int board_eth_init(bd_t *bis) +{ + int rc = 0; +#ifdef CONFIG_SMC91111 + rc = smc91111_initialize(0, CONFIG_SMC91111_BASE); +#endif + return rc; +} +#endif diff --git a/board/ms7722se/ms7722se.c b/board/ms7722se/ms7722se.c index 32234d3..4e40b17 100644 --- a/board/ms7722se/ms7722se.c +++ b/board/ms7722se/ms7722se.c @@ -24,6 +24,7 @@ */ #include <common.h> +#include <netdev.h> #include <asm/io.h> #include <asm/processor.h> @@ -57,3 +58,14 @@ void led_set_state(unsigned short value) { writew(value & 0xFF, LED_BASE); } + +#ifdef CONFIG_CMD_NET +int board_eth_init(bd_t *bis) +{ + int rc = 0; +#ifdef CONFIG_SMC91111 + rc = smc91111_initialize(0, CONFIG_SMC91111_BASE); +#endif + return rc; +} +#endif diff --git a/board/netstar/eeprom.c b/board/netstar/eeprom.c index 5806128..1366457 100644 --- a/board/netstar/eeprom.c +++ b/board/netstar/eeprom.c @@ -27,43 +27,42 @@ #include <common.h> #include <exports.h> #include <timestamp.h> +#include <net.h> #include "../drivers/net/smc91111.h" -#define SMC_BASE_ADDRESS CONFIG_SMC91111_BASE - -static u16 read_eeprom_reg(u16 reg) +static u16 read_eeprom_reg(struct eth_device *dev, u16 reg) { int timeout; - SMC_SELECT_BANK(2); - SMC_outw(reg, PTR_REG); + SMC_SELECT_BANK(dev, 2); + SMC_outw(dev, reg, PTR_REG); - SMC_SELECT_BANK(1); - SMC_outw(SMC_inw (CTL_REG) | CTL_EEPROM_SELECT | CTL_RELOAD, + SMC_SELECT_BANK(dev, 1); + SMC_outw(dev, SMC_inw (dev, CTL_REG) | CTL_EEPROM_SELECT | CTL_RELOAD, CTL_REG); timeout = 100; - while((SMC_inw (CTL_REG) & CTL_RELOAD) && --timeout) + while((SMC_inw (dev, CTL_REG) & CTL_RELOAD) && --timeout) udelay(100); if (timeout == 0) { printf("Timeout Reading EEPROM register %02x\n", reg); return 0; } - return SMC_inw (GP_REG); + return SMC_inw (dev, GP_REG); } -static int write_eeprom_reg(u16 value, u16 reg) +static int write_eeprom_reg(struct eth_device *dev, u16 value, u16 reg) { int timeout; - SMC_SELECT_BANK(2); - SMC_outw(reg, PTR_REG); + SMC_SELECT_BANK(dev, 2); + SMC_outw(dev, reg, PTR_REG); - SMC_SELECT_BANK(1); - SMC_outw(value, GP_REG); - SMC_outw(SMC_inw (CTL_REG) | CTL_EEPROM_SELECT | CTL_STORE, CTL_REG); + SMC_SELECT_BANK(dev, 1); + SMC_outw(dev, value, GP_REG); + SMC_outw(dev, SMC_inw (dev, CTL_REG) | CTL_EEPROM_SELECT | CTL_STORE, CTL_REG); timeout = 100; - while ((SMC_inw(CTL_REG) & CTL_STORE) && --timeout) + while ((SMC_inw(dev, CTL_REG) & CTL_STORE) && --timeout) udelay (100); if (timeout == 0) { printf("Timeout Writing EEPROM register %02x\n", reg); @@ -73,17 +72,17 @@ static int write_eeprom_reg(u16 value, u16 reg) return 1; } -static int write_data(u16 *buf, int len) +static int write_data(struct eth_device *dev, u16 *buf, int len) { u16 reg = 0x23; while (len--) - write_eeprom_reg(*buf++, reg++); + write_eeprom_reg(dev, *buf++, reg++); return 0; } -static int verify_macaddr(char *s) +static int verify_macaddr(struct eth_device *dev, char *s) { u16 reg; int i, err = 0; @@ -91,7 +90,7 @@ static int verify_macaddr(char *s) printf("MAC Address: "); err = i = 0; for (i = 0; i < 3; i++) { - reg = read_eeprom_reg(0x20 + i); + reg = read_eeprom_reg(dev, 0x20 + i); printf("%02x:%02x%c", reg & 0xff, reg >> 8, i != 2 ? ':' : '\n'); if (s) err |= reg != ((u16 *)s)[i]; @@ -100,7 +99,7 @@ static int verify_macaddr(char *s) return err ? 0 : 1; } -static int set_mac(char *s) +static int set_mac(struct eth_device *dev, char *s) { int i; char *e, eaddr[6]; @@ -112,7 +111,7 @@ static int set_mac(char *s) } for (i = 0; i < 3; i++) - write_eeprom_reg(*(((u16 *)eaddr) + i), 0x20 + i); + write_eeprom_reg(dev, *(((u16 *)eaddr) + i), 0x20 + i); return 0; } @@ -150,6 +149,10 @@ int eeprom(int argc, char *argv[]) int i, len, ret; unsigned char buf[58], *p; + struct eth_device dev = { + .iobase = CONFIG_SMC91111_BASE + }; + app_startup(argv); if (get_version() != XF_VERSION) { printf("Wrong XF_VERSION.\n"); @@ -160,14 +163,14 @@ int eeprom(int argc, char *argv[]) return crcek(); - if ((SMC_inw (BANK_SELECT) & 0xFF00) != 0x3300) { + if ((SMC_inw (&dev, BANK_SELECT) & 0xFF00) != 0x3300) { printf("SMSC91111 not found.\n"); return 2; } /* Called without parameters - print MAC address */ if (argc < 2) { - verify_macaddr(NULL); + verify_macaddr(&dev, NULL); return 0; } @@ -201,8 +204,8 @@ int eeprom(int argc, char *argv[]) } /* First argument (MAC) is mandatory */ - set_mac(argv[1]); - if (verify_macaddr(argv[1])) { + set_mac(&dev, argv[1]); + if (verify_macaddr(&dev, argv[1])) { printf("*** MAC address does not match! ***\n"); return 4; } @@ -210,7 +213,7 @@ int eeprom(int argc, char *argv[]) while (len--) *p++ = 0; - write_data((u16 *)buf, sizeof(buf) >> 1); + write_data(&dev, (u16 *)buf, sizeof(buf) >> 1); return 0; } diff --git a/board/netstar/netstar.c b/board/netstar/netstar.c index ffd60bf..df1704b 100644 --- a/board/netstar/netstar.c +++ b/board/netstar/netstar.c @@ -21,6 +21,7 @@ */ #include <common.h> +#include <netdev.h> #include <i2c.h> #include <flash.h> #include <nand.h> @@ -115,3 +116,14 @@ int board_nand_init(struct nand_chip *nand) return 0; } #endif + +#ifdef CONFIG_CMD_NET +int board_eth_init(bd_t *bis) +{ + int rc = 0; +#ifdef CONFIG_SMC91111 + rc = smc91111_initialize(0, CONFIG_SMC91111_BASE); +#endif + return rc; +} +#endif diff --git a/board/psyent/pk1c20/pk1c20.c b/board/psyent/pk1c20/pk1c20.c index 95b48bc..0a24866 100644 --- a/board/psyent/pk1c20/pk1c20.c +++ b/board/psyent/pk1c20/pk1c20.c @@ -22,6 +22,7 @@ */ #include <common.h> +#include <netdev.h> int board_early_init_f (void) { @@ -38,3 +39,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_SMC91111 + rc = smc91111_initialize(0, CONFIG_SMC91111_BASE); +#endif + return rc; +} +#endif diff --git a/board/pxa255_idp/pxa_idp.c b/board/pxa255_idp/pxa_idp.c index e9e479c..05e30ec 100644 --- a/board/pxa255_idp/pxa_idp.c +++ b/board/pxa255_idp/pxa_idp.c @@ -31,6 +31,7 @@ */ #include <common.h> +#include <netdev.h> #include <command.h> DECLARE_GLOBAL_DATA_PTR; @@ -133,3 +134,14 @@ U_BOOT_CMD(idpcmd, CONFIG_SYS_MAXARGS, 0, do_idpcmd, ); #endif + +#ifdef CONFIG_CMD_NET +int board_eth_init(bd_t *bis) +{ + int rc = 0; +#ifdef CONFIG_SMC91111 + rc = smc91111_initialize(0, CONFIG_SMC91111_BASE); +#endif + return rc; +} +#endif diff --git a/board/renesas/MigoR/migo_r.c b/board/renesas/MigoR/migo_r.c index 204ca78..c0f26ac 100644 --- a/board/renesas/MigoR/migo_r.c +++ b/board/renesas/MigoR/migo_r.c @@ -24,6 +24,7 @@ */ #include <common.h> +#include <netdev.h> #include <asm/io.h> #include <asm/processor.h> @@ -51,3 +52,14 @@ int dram_init (void) void led_set_state (unsigned short value) { } + +#ifdef CONFIG_CMD_NET +int board_eth_init(bd_t *bis) +{ + int rc = 0; +#ifdef CONFIG_SMC91111 + rc = smc91111_initialize(0, CONFIG_SMC91111_BASE); +#endif + return rc; +} +#endif diff --git a/board/st/nhk8815/nhk8815.c b/board/st/nhk8815/nhk8815.c index 1fa506a..faef810 100644 --- a/board/st/nhk8815/nhk8815.c +++ b/board/st/nhk8815/nhk8815.c @@ -26,6 +26,7 @@ */ #include <common.h> +#include <netdev.h> #include <asm/io.h> #include <asm/arch/gpio.h> @@ -89,3 +90,14 @@ int dram_init(void) gd->bd->bi_dram[1].size = PHYS_SDRAM_2_SIZE; return 0; } + +#ifdef CONFIG_CMD_NET +int board_eth_init(bd_t *bis) +{ + int rc = 0; +#ifdef CONFIG_SMC91111 + rc = smc91111_initialize(0, CONFIG_SMC91111_BASE); +#endif + return rc; +} +#endif diff --git a/board/voiceblue/eeprom.c b/board/voiceblue/eeprom.c index f01597a..2ae46d1 100644 --- a/board/voiceblue/eeprom.c +++ b/board/voiceblue/eeprom.c @@ -27,43 +27,42 @@ #include <common.h> #include <exports.h> #include <timestamp.h> +#include <net.h> #include "../drivers/net/smc91111.h" -#define SMC_BASE_ADDRESS CONFIG_SMC91111_BASE - -static u16 read_eeprom_reg(u16 reg) +static u16 read_eeprom_reg(struct eth_device *dev, u16 reg) { int timeout; - SMC_SELECT_BANK(2); - SMC_outw(reg, PTR_REG); + SMC_SELECT_BANK(dev, 2); + SMC_outw(dev, reg, PTR_REG); - SMC_SELECT_BANK(1); - SMC_outw(SMC_inw (CTL_REG) | CTL_EEPROM_SELECT | CTL_RELOAD, + SMC_SELECT_BANK(dev, 1); + SMC_outw(dev, SMC_inw (dev, CTL_REG) | CTL_EEPROM_SELECT | CTL_RELOAD, CTL_REG); timeout = 100; - while((SMC_inw (CTL_REG) & CTL_RELOAD) && --timeout) + while((SMC_inw (dev, CTL_REG) & CTL_RELOAD) && --timeout) udelay(100); if (timeout == 0) { printf("Timeout Reading EEPROM register %02x\n", reg); return 0; } - return SMC_inw (GP_REG); + return SMC_inw (dev, GP_REG); } -static int write_eeprom_reg(u16 value, u16 reg) +static int write_eeprom_reg(struct eth_device *dev, u16 value, u16 reg) { int timeout; - SMC_SELECT_BANK(2); - SMC_outw(reg, PTR_REG); + SMC_SELECT_BANK(dev, 2); + SMC_outw(dev, reg, PTR_REG); - SMC_SELECT_BANK(1); - SMC_outw(value, GP_REG); - SMC_outw(SMC_inw (CTL_REG) | CTL_EEPROM_SELECT | CTL_STORE, CTL_REG); + SMC_SELECT_BANK(dev, 1); + SMC_outw(dev, value, GP_REG); + SMC_outw(dev, SMC_inw (dev, CTL_REG) | CTL_EEPROM_SELECT | CTL_STORE, CTL_REG); timeout = 100; - while ((SMC_inw(CTL_REG) & CTL_STORE) && --timeout) + while ((SMC_inw(dev, CTL_REG) & CTL_STORE) && --timeout) udelay (100); if (timeout == 0) { printf("Timeout Writing EEPROM register %02x\n", reg); @@ -73,17 +72,17 @@ static int write_eeprom_reg(u16 value, u16 reg) return 1; } -static int write_data(u16 *buf, int len) +static int write_data(struct eth_device *dev, u16 *buf, int len) { u16 reg = 0x23; while (len--) - write_eeprom_reg(*buf++, reg++); + write_eeprom_reg(dev, *buf++, reg++); return 0; } -static int verify_macaddr(char *s) +static int verify_macaddr(struct eth_device *dev, char *s) { u16 reg; int i, err = 0; @@ -91,7 +90,7 @@ static int verify_macaddr(char *s) printf("MAC Address: "); err = i = 0; for (i = 0; i < 3; i++) { - reg = read_eeprom_reg(0x20 + i); + reg = read_eeprom_reg(dev, 0x20 + i); printf("%02x:%02x%c", reg & 0xff, reg >> 8, i != 2 ? ':' : '\n'); if (s) err |= reg != ((u16 *)s)[i]; @@ -100,7 +99,7 @@ static int verify_macaddr(char *s) return err ? 0 : 1; } -static int set_mac(char *s) +static int set_mac(struct eth_device *dev, char *s) { int i; char *e, eaddr[6]; @@ -112,7 +111,7 @@ static int set_mac(char *s) } for (i = 0; i < 3; i++) - write_eeprom_reg(*(((u16 *)eaddr) + i), 0x20 + i); + write_eeprom_reg(dev, *(((u16 *)eaddr) + i), 0x20 + i); return 0; } @@ -148,6 +147,10 @@ int eeprom(int argc, char *argv[]) int i, len, ret; unsigned char buf[58], *p; + struct eth_device dev = { + .iobase = CONFIG_SMC91111_BASE + }; + app_startup(argv); if (get_version() != XF_VERSION) { printf("Wrong XF_VERSION.\n"); @@ -156,14 +159,14 @@ int eeprom(int argc, char *argv[]) return 1; } - if ((SMC_inw (BANK_SELECT) & 0xFF00) != 0x3300) { + if ((SMC_inw (&dev, BANK_SELECT) & 0xFF00) != 0x3300) { printf("SMSC91111 not found.\n"); return 2; } /* Called without parameters - print MAC address */ if (argc < 2) { - verify_macaddr(NULL); + verify_macaddr(&dev, NULL); return 0; } @@ -197,8 +200,8 @@ int eeprom(int argc, char *argv[]) } /* First argument (MAC) is mandatory */ - set_mac(argv[1]); - if (verify_macaddr(argv[1])) { + set_mac(&dev, argv[1]); + if (verify_macaddr(&dev, argv[1])) { printf("*** MAC address does not match! ***\n"); return 4; } @@ -206,7 +209,7 @@ int eeprom(int argc, char *argv[]) while (len--) *p++ = 0; - write_data((u16 *)buf, sizeof(buf) >> 1); + write_data(&dev, (u16 *)buf, sizeof(buf) >> 1); return 0; } diff --git a/board/voiceblue/voiceblue.c b/board/voiceblue/voiceblue.c index 59b3310..5f8af2b 100644 --- a/board/voiceblue/voiceblue.c +++ b/board/voiceblue/voiceblue.c @@ -20,6 +20,7 @@ */ #include <common.h> +#include <netdev.h> DECLARE_GLOBAL_DATA_PTR; @@ -66,3 +67,14 @@ int board_late_init(void) return 0; } + +#ifdef CONFIG_CMD_NET +int board_eth_init(bd_t *bis) +{ + int rc = 0; +#ifdef CONFIG_SMC91111 + rc = smc91111_initialize(0, CONFIG_SMC91111_BASE); +#endif + return rc; +} +#endif diff --git a/board/xaeniax/xaeniax.c b/board/xaeniax/xaeniax.c index 9baa457..4c19c4d 100644 --- a/board/xaeniax/xaeniax.c +++ b/board/xaeniax/xaeniax.c @@ -29,6 +29,7 @@ */ #include <common.h> +#include <netdev.h> DECLARE_GLOBAL_DATA_PTR; @@ -71,3 +72,14 @@ int dram_init (void) return 0; } + +#ifdef CONFIG_CMD_NET +int board_eth_init(bd_t *bis) +{ + int rc = 0; +#ifdef CONFIG_SMC91111 + rc = smc91111_initialize(0, CONFIG_SMC91111_BASE); +#endif + return rc; +} +#endif diff --git a/board/xm250/xm250.c b/board/xm250/xm250.c index 56b1cd4..246bdde 100644 --- a/board/xm250/xm250.c +++ b/board/xm250/xm250.c @@ -27,6 +27,7 @@ #include <asm/arch/pxa-regs.h> #include <common.h> +#include <netdev.h> DECLARE_GLOBAL_DATA_PTR; @@ -80,3 +81,14 @@ dram_init (void) return (0); } + +#ifdef CONFIG_CMD_NET +int board_eth_init(bd_t *bis) +{ + int rc = 0; +#ifdef CONFIG_SMC91111 + rc = smc91111_initialize(0, CONFIG_SMC91111_BASE); +#endif + return rc; +} +#endif diff --git a/board/xsengine/xsengine.c b/board/xsengine/xsengine.c index 65923e9..4464fd4 100644 --- a/board/xsengine/xsengine.c +++ b/board/xsengine/xsengine.c @@ -26,6 +26,7 @@ */ #include <common.h> +#include <netdev.h> DECLARE_GLOBAL_DATA_PTR; @@ -61,3 +62,14 @@ int dram_init (void) return 0; } + +#ifdef CONFIG_CMD_NET +int board_eth_init(bd_t *bis) +{ + int rc = 0; +#ifdef CONFIG_SMC91111 + rc = smc91111_initialize(0, CONFIG_SMC91111_BASE); +#endif + return rc; +} +#endif diff --git a/board/zylonite/zylonite.c b/board/zylonite/zylonite.c index 5829170..749a40f 100644 --- a/board/zylonite/zylonite.c +++ b/board/zylonite/zylonite.c @@ -26,6 +26,7 @@ */ #include <common.h> +#include <netdev.h> DECLARE_GLOBAL_DATA_PTR; @@ -68,3 +69,14 @@ int dram_init (void) return 0; } + +#ifdef CONFIG_CMD_NET +int board_eth_init(bd_t *bis) +{ + int rc = 0; +#ifdef CONFIG_SMC91111 + rc = smc91111_initialize(0, CONFIG_SMC91111_BASE); +#endif + return rc; +} +#endif |