diff options
author | Ben Warren <biggerbadderben@gmail.com> | 2009-07-20 22:01:11 -0700 |
---|---|---|
committer | Ben Warren <biggerbadderben@gmail.com> | 2009-07-22 22:53:44 -0700 |
commit | 736fead8fdbf8a8407048bebc373cd551d01ec98 (patch) | |
tree | 60307d25c8dd18cbdf7e3b3807f924b838cee9fb /board | |
parent | 3bd0a877b74b9c005ae7cb892480ccedfa308c20 (diff) |
Convert SMC911X Ethernet driver to CONFIG_NET_MULTI API
All in-tree boards that use this controller have CONFIG_NET_MULTI added
Also:
- changed CONFIG_DRIVER_SMC911X* to CONFIG_SMC911X*
- cleaned up line lengths
- modified all boards that override weak function in this driver
- added
Signed-off-by: Ben Warren <biggerbadderben@gmail.com>
Tested-by: Mike Frysinger <vapier@gentoo.org>
Diffstat (limited to 'board')
-rw-r--r-- | board/bf548-ezkit/bf548-ezkit.c | 8 | ||||
-rw-r--r-- | board/cm-bf548/cm-bf548.c | 10 | ||||
-rw-r--r-- | board/freescale/mx31pdk/mx31pdk.c | 10 | ||||
-rw-r--r-- | board/imx31_litekit/imx31_litekit.c | 10 | ||||
-rw-r--r-- | board/imx31_phycore/imx31_phycore.c | 10 | ||||
-rw-r--r-- | board/micronas/vct/ebi_smc911x.c | 22 | ||||
-rw-r--r-- | board/micronas/vct/vct.c | 10 | ||||
-rw-r--r-- | board/omap3/evm/evm.c | 10 | ||||
-rw-r--r-- | board/renesas/ap325rxa/ap325rxa.c | 10 | ||||
-rw-r--r-- | board/renesas/rsk7203/rsk7203.c | 17 |
10 files changed, 110 insertions, 7 deletions
diff --git a/board/bf548-ezkit/bf548-ezkit.c b/board/bf548-ezkit/bf548-ezkit.c index 74f93ba27da..88a0cd4d619 100644 --- a/board/bf548-ezkit/bf548-ezkit.c +++ b/board/bf548-ezkit/bf548-ezkit.c @@ -7,6 +7,7 @@ */ #include <common.h> +#include <netdev.h> #include <config.h> #include <command.h> #include <asm/blackfin.h> @@ -77,3 +78,10 @@ int board_early_init_f(void) return 0; } + +#ifdef CONFIG_SMC911X +int board_eth_init(bd_t *bis) +{ + return smc911x_initialize(0, CONFIG_SMC911X_BASE); +} +#endif diff --git a/board/cm-bf548/cm-bf548.c b/board/cm-bf548/cm-bf548.c index 1c2660046fb..796263d62b3 100644 --- a/board/cm-bf548/cm-bf548.c +++ b/board/cm-bf548/cm-bf548.c @@ -9,6 +9,7 @@ #include <common.h> #include <config.h> #include <command.h> +#include <netdev.h> #include <asm/blackfin.h> DECLARE_GLOBAL_DATA_PTR; @@ -77,3 +78,12 @@ int board_early_init_f(void) return 0; } + +int board_eth_init(bd_t *bis) +{ + int rc = 0; +#ifdef CONFIG_SMC911X + rc = smc911x_initialize(0, CONFIG_SMC911X_BASE); +#endif + return rc; +} diff --git a/board/freescale/mx31pdk/mx31pdk.c b/board/freescale/mx31pdk/mx31pdk.c index 6b60c17dca8..9f471692dd9 100644 --- a/board/freescale/mx31pdk/mx31pdk.c +++ b/board/freescale/mx31pdk/mx31pdk.c @@ -25,6 +25,7 @@ #include <common.h> +#include <netdev.h> #include <asm/arch/mx31.h> #include <asm/arch/mx31-regs.h> @@ -61,3 +62,12 @@ int checkboard(void) printf("Board: i.MX31 MAX PDK (3DS)\n"); return 0; } + +int board_eth_init(bd_t *bis) +{ + int rc = 0; +#ifdef CONFIG_SMC911X + rc = smc911x_initialize(0, CONFIG_SMC911X_BASE); +#endif + return rc; +} diff --git a/board/imx31_litekit/imx31_litekit.c b/board/imx31_litekit/imx31_litekit.c index cb3e1748418..2ac622dbbe3 100644 --- a/board/imx31_litekit/imx31_litekit.c +++ b/board/imx31_litekit/imx31_litekit.c @@ -23,6 +23,7 @@ #include <common.h> +#include <netdev.h> #include <asm/arch/mx31.h> #include <asm/arch/mx31-regs.h> @@ -75,3 +76,12 @@ int checkboard (void) printf("Board: i.MX31 Litekit\n"); return 0; } + +int board_eth_init(bd_t *bis) +{ + int rc = 0; +#ifdef CONFIG_SMC911X + rc = smc911x_initialize(0, CONFIG_SMC911X_BASE); +#endif + return rc; +} diff --git a/board/imx31_phycore/imx31_phycore.c b/board/imx31_phycore/imx31_phycore.c index 92aba96b983..3d7b7f70ce6 100644 --- a/board/imx31_phycore/imx31_phycore.c +++ b/board/imx31_phycore/imx31_phycore.c @@ -24,6 +24,7 @@ #include <common.h> #include <s6e63d6.h> +#include <netdev.h> #include <asm/arch/mx31.h> #include <asm/arch/mx31-regs.h> @@ -128,3 +129,12 @@ int checkboard (void) printf("Board: Phytec phyCore i.MX31\n"); return 0; } + +int board_eth_init(bd_t *bis) +{ + int rc = 0; +#ifdef CONFIG_SMC911X + rc = smc911x_initialize(0, CONFIG_SMC911X_BASE); +#endif + return rc; +} diff --git a/board/micronas/vct/ebi_smc911x.c b/board/micronas/vct/ebi_smc911x.c index e1b67a075b7..c9ef33d9510 100644 --- a/board/micronas/vct/ebi_smc911x.c +++ b/board/micronas/vct/ebi_smc911x.c @@ -18,6 +18,7 @@ */ #include <common.h> +#include <netdev.h> #include <asm/io.h> #include "vct.h" @@ -45,10 +46,11 @@ int ebi_init_smc911x(void) * Accessor functions replacing the "weak" functions in * drivers/net/smc911x.c */ -u32 smc911x_reg_read(u32 addr) +u32 smc911x_reg_read(struct eth_device *dev, u32 addr) { volatile u32 data; + addr += dev->iobase; reg_write(EBI_DEV1_CONFIG2(EBI_BASE), 0x0000004F); ebi_wait(); reg_write(EBI_CPU_IO_ACCS(EBI_BASE), (EXT_DEVICE_CHANNEL_1 | addr)); @@ -58,8 +60,9 @@ u32 smc911x_reg_read(u32 addr) return (data); } -void smc911x_reg_write(u32 addr, u32 data) +void smc911x_reg_write(struct eth_device *dev, u32 addr, u32 data) { + addr += dev->iobase; reg_write(EBI_DEV1_CONFIG2(EBI_BASE), 0x0000004F); ebi_wait(); reg_write(EBI_IO_ACCS_DATA(EBI_BASE), data); @@ -68,8 +71,9 @@ void smc911x_reg_write(u32 addr, u32 data) ebi_wait(); } -void pkt_data_push(u32 addr, u32 data) +void pkt_data_push(struct eth_device *dev, u32 addr, u32 data) { + addr += dev->iobase; reg_write(EBI_DEV1_CONFIG2(EBI_BASE), 0x0000004A); ebi_wait(); reg_write(EBI_IO_ACCS_DATA(EBI_BASE), data); @@ -80,10 +84,11 @@ void pkt_data_push(u32 addr, u32 data) return; } -u32 pkt_data_pull(u32 addr) +u32 pkt_data_pull(struct eth_device *dev, u32 addr) { volatile u32 data; + addr += dev->iobase; reg_write(EBI_DEV1_CONFIG2(EBI_BASE), 0x0000004A); ebi_wait(); reg_write(EBI_CPU_IO_ACCS(EBI_BASE), (EXT_DEVICE_CHANNEL_1 | addr)); @@ -92,3 +97,12 @@ u32 pkt_data_pull(u32 addr) return data; } + +int board_eth_init(bd_t *bis) +{ + int rc = 0; +#ifdef CONFIG_SMC911X + rc = smc911x_initialize(0, CONFIG_DRIVER_SMC911X_BASE); +#endif + return rc; +} diff --git a/board/micronas/vct/vct.c b/board/micronas/vct/vct.c index d320e0b5f0d..7fc3507b0e1 100644 --- a/board/micronas/vct/vct.c +++ b/board/micronas/vct/vct.c @@ -21,6 +21,7 @@ #include <common.h> #include <command.h> +#include <netdev.h> #include <asm/mipsregs.h> #include "vct.h" @@ -115,3 +116,12 @@ int checkboard(void) return 0; } + +int board_eth_init(bd_t *bis) +{ + int rc = 0; +#ifdef CONFIG_SMC911X + rc = smc911x_initialize(0, CONFIG_SMC911X_BASE); +#endif + return rc; +} diff --git a/board/omap3/evm/evm.c b/board/omap3/evm/evm.c index 5fd5efad9c2..bfd2688d734 100644 --- a/board/omap3/evm/evm.c +++ b/board/omap3/evm/evm.c @@ -28,6 +28,7 @@ * MA 02111-1307 USA */ #include <common.h> +#include <netdev.h> #include <asm/io.h> #include <asm/arch/mem.h> #include <asm/arch/mux.h> @@ -122,3 +123,12 @@ static void setup_net_chip(void) udelay(1); writel(GPIO0, &gpio3_base->setdataout); } + +int board_eth_init(bd_t *bis) +{ + int rc = 0; +#ifdef CONFIG_SMC911X + rc = smc911x_initialize(0, CONFIG_SMC911X_BASE); +#endif + return rc; +} diff --git a/board/renesas/ap325rxa/ap325rxa.c b/board/renesas/ap325rxa/ap325rxa.c index 9f1112a4360..be919f5454a 100644 --- a/board/renesas/ap325rxa/ap325rxa.c +++ b/board/renesas/ap325rxa/ap325rxa.c @@ -19,6 +19,7 @@ */ #include <common.h> +#include <netdev.h> #include <asm/io.h> #include <asm/processor.h> @@ -160,3 +161,12 @@ void ide_set_reset(int idereset) udelay(FPGA_NAND_RST_WAIT); outw(FPGA_NAND_INIT, FPGA_NAND_CTL); } + +int board_eth_init(bd_t *bis) +{ + int rc = 0; +#ifdef CONFIG_SMC911X + rc = smc911x_initialize(0, CONFIG_SMC911X_BASE); +#endif + return rc; +} diff --git a/board/renesas/rsk7203/rsk7203.c b/board/renesas/rsk7203/rsk7203.c index 2cbd45e043f..2b857998697 100644 --- a/board/renesas/rsk7203/rsk7203.c +++ b/board/renesas/rsk7203/rsk7203.c @@ -21,6 +21,7 @@ */ #include <common.h> +#include <netdev.h> #include <asm/io.h> #include <asm/processor.h> @@ -57,15 +58,25 @@ void led_set_state(unsigned short value) * And this has problem by FIFO access only. pkt_data_pull/pkt_data_push * functions necessary to solve this problem. */ -u32 pkt_data_pull(u32 addr) +u32 pkt_data_pull(struct eth_device *dev, u32 addr) { - volatile u16 *addr_16 = (u16 *)addr; + volatile u16 *addr_16 = (u16 *)(dev->iobase + addr); return (u32)((swab16(*addr_16) << 16) & 0xFFFF0000)\ | swab16(*(addr_16 + 1)); } -void pkt_data_push(u32 addr, u32 val) +void pkt_data_push(struct eth_device *dev, u32 addr, u32 val) { + addr += dev->iobase; *(volatile u16 *)(addr + 2) = swab16((u16)val); *(volatile u16 *)(addr) = swab16((u16)(val >> 16)); } + +int board_eth_init(bd_t *bis) +{ + int rc = 0; +#ifdef CONFIG_SMC911X + rc = smc911x_initialize(0, CONFIG_SMC911X_BASE); +#endif + return rc; +} |