From 75b9d4ae0d69f214eab641caf12ce8af83a39a42 Mon Sep 17 00:00:00 2001 From: Andy Fleming Date: Sun, 31 Aug 2008 16:33:26 -0500 Subject: Pass in tsec_info struct through tsec_initialize The tsec driver contains a hard-coded array of configuration information for the tsec ethernet controllers. We create a default function that works for most tsecs, and allow that to be overridden by board code. It creates an array of tsec_info structures, which are then parsed by the corresponding driver instance to determine configuration. Also, add regs, miiregs, and devname fields to the tsec_info structure, so that we don't need the kludgy "index" parameter. Signed-off-by: Andy Fleming Signed-off-by: Ben Warren --- cpu/mpc83xx/cpu.c | 20 +++++++------------- cpu/mpc85xx/cpu.c | 33 ++++++++++----------------------- cpu/mpc86xx/cpu.c | 26 +++++++------------------- 3 files changed, 24 insertions(+), 55 deletions(-) (limited to 'cpu') diff --git a/cpu/mpc83xx/cpu.c b/cpu/mpc83xx/cpu.c index 52e4476..5862acd 100644 --- a/cpu/mpc83xx/cpu.c +++ b/cpu/mpc83xx/cpu.c @@ -32,6 +32,7 @@ #include #include #include +#include DECLARE_GLOBAL_DATA_PTR; @@ -358,22 +359,15 @@ int dma_xfer(void *dest, u32 count, void *src) } #endif /*CONFIG_DDR_ECC*/ -#ifdef CONFIG_TSEC_ENET -/* Default initializations for TSEC controllers. To override, - * create a board-specific function called: - * int board_eth_init(bd_t *bis) +/* + * Initializes on-chip ethernet controllers. + * to override, implement board_eth_init() */ - -extern int tsec_initialize(bd_t * bis, int index, char *devname); - int cpu_eth_init(bd_t *bis) { -#if defined(CONFIG_TSEC1) - tsec_initialize(bis, 0, CONFIG_TSEC1_NAME); -#endif -#if defined(CONFIG_TSEC2) - tsec_initialize(bis, 1, CONFIG_TSEC2_NAME); +#if defined(CONFIG_TSEC_ENET) + tsec_standard_init(bis); #endif + return 0; } -#endif diff --git a/cpu/mpc85xx/cpu.c b/cpu/mpc85xx/cpu.c index 2fe3cea..7976cac 100644 --- a/cpu/mpc85xx/cpu.c +++ b/cpu/mpc85xx/cpu.c @@ -25,9 +25,11 @@ * MA 02111-1307 USA */ +#include #include #include #include +#include #include #include @@ -294,6 +296,7 @@ int dma_xfer(void *dest, uint count, void *src) { return dma_check(); } #endif + /* * Configures a UPM. Currently, the loop fields in MxMR (RLF, WLF and TLF) * are hardcoded as "1"."size" is the number or entries, not a sizeof. @@ -360,32 +363,16 @@ void upmconfig (uint upm, uint * table, uint size) out_be32(mxmr, loopval); /* OP_NORMAL */ } -#if defined(CONFIG_TSEC_ENET) || defined(CONFIGMPC85XX_FEC) -/* Default initializations for TSEC controllers. To override, - * create a board-specific function called: - * int board_eth_init(bd_t *bis) - */ - -extern int tsec_initialize(bd_t * bis, int index, char *devname); +/* + * Initializes on-chip ethernet controllers. + * to override, implement board_eth_init() + */ int cpu_eth_init(bd_t *bis) { -#if defined(CONFIG_TSEC1) - tsec_initialize(bis, 0, CONFIG_TSEC1_NAME); -#endif -#if defined(CONFIG_TSEC2) - tsec_initialize(bis, 1, CONFIG_TSEC2_NAME); -#endif -#if defined(CONFIG_MPC85XX_FEC) - tsec_initialize(bis, 2, CONFIG_MPC85XX_FEC_NAME); -#else -#if defined(CONFIG_TSEC3) - tsec_initialize(bis, 2, CONFIG_TSEC3_NAME); -#endif -#if defined(CONFIG_TSEC4) - tsec_initialize(bis, 3, CONFIG_TSEC4_NAME); -#endif +#if defined(CONFIG_TSEC_ENET) || defined(CONFIG_MPC85xx_FEC) + tsec_standard_init(bis); #endif + return 0; } -#endif diff --git a/cpu/mpc86xx/cpu.c b/cpu/mpc86xx/cpu.c index ecea5b0..3a75af7 100644 --- a/cpu/mpc86xx/cpu.c +++ b/cpu/mpc86xx/cpu.c @@ -28,6 +28,7 @@ #include #include #include +#include #include @@ -305,28 +306,15 @@ void mpc86xx_reginfo(void) } -#ifdef CONFIG_TSEC_ENET -/* Default initializations for TSEC controllers. To override, - * create a board-specific function called: - * int board_eth_init(bd_t *bis) +/* + * Initializes on-chip ethernet controllers. + * to override, implement board_eth_init() */ - -extern int tsec_initialize(bd_t * bis, int index, char *devname); - int cpu_eth_init(bd_t *bis) { -#if defined(CONFIG_TSEC1) - tsec_initialize(bis, 0, CONFIG_TSEC1_NAME); -#endif -#if defined(CONFIG_TSEC2) - tsec_initialize(bis, 1, CONFIG_TSEC2_NAME); -#endif -#if defined(CONFIG_TSEC3) - tsec_initialize(bis, 2, CONFIG_TSEC3_NAME); -#endif -#if defined(CONFIG_TSEC4) - tsec_initialize(bis, 3, CONFIG_TSEC4_NAME); +#if defined(CONFIG_TSEC_ENET) + tsec_standard_init(bis); #endif + return 0; } -#endif /* CONFIG_TSEC_ENET */ -- cgit v1.1 From 89973f8a82c28ad893c4c3cc56839a8e10fe5f13 Mon Sep 17 00:00:00 2001 From: Ben Warren Date: Sun, 31 Aug 2008 22:22:04 -0700 Subject: Introduce netdev.h header file and remove externs This addresses all drivers whose initializers have already been moved to board_eth_init()/cpu_eth_init(). Signed-off-by: Ben Warren --- cpu/leon2/cpu.c | 3 +-- cpu/leon3/cpu.c | 2 +- cpu/mcf523x/cpu.c | 3 +-- cpu/mcf52x2/cpu.c | 3 +-- cpu/mcf532x/cpu.c | 3 +-- cpu/mcf5445x/cpu.c | 3 +-- cpu/mcf547x_8x/cpu.c | 4 +--- 7 files changed, 7 insertions(+), 14 deletions(-) (limited to 'cpu') diff --git a/cpu/leon2/cpu.c b/cpu/leon2/cpu.c index 5de1c52..d6e23b1 100644 --- a/cpu/leon2/cpu.c +++ b/cpu/leon2/cpu.c @@ -25,6 +25,7 @@ #include #include #include +#include DECLARE_GLOBAL_DATA_PTR; @@ -57,8 +58,6 @@ int do_reset(cmd_tbl_t * cmdtp, int flag, int argc, char *argv[]) /* ------------------------------------------------------------------------- */ -extern int greth_initialize(bd_t *bis); - #ifdef CONFIG_GRETH int cpu_eth_init(bd_t *bis) { diff --git a/cpu/leon3/cpu.c b/cpu/leon3/cpu.c index 1725fdb..976f311 100644 --- a/cpu/leon3/cpu.c +++ b/cpu/leon3/cpu.c @@ -25,6 +25,7 @@ #include #include #include +#include #include #include @@ -65,7 +66,6 @@ u64 flash_read64(void *addr) } /* ------------------------------------------------------------------------- */ -extern int greth_initialize(bd_t *bis); #ifdef CONFIG_GRETH int cpu_eth_init(bd_t *bis) diff --git a/cpu/mcf523x/cpu.c b/cpu/mcf523x/cpu.c index 8d2152d..bdc152f 100644 --- a/cpu/mcf523x/cpu.c +++ b/cpu/mcf523x/cpu.c @@ -28,6 +28,7 @@ #include #include #include +#include #include @@ -114,8 +115,6 @@ int watchdog_init(void) * int board_eth_init(bd_t *bis) */ -extern int mcffec_initialize(bd_t*); - int cpu_eth_init(bd_t *bis) { return mcffec_initialize(bis); diff --git a/cpu/mcf52x2/cpu.c b/cpu/mcf52x2/cpu.c index 2af31cb..167097a 100644 --- a/cpu/mcf52x2/cpu.c +++ b/cpu/mcf52x2/cpu.c @@ -32,6 +32,7 @@ #include #include #include +#include #ifdef CONFIG_M5271 /* @@ -328,8 +329,6 @@ int do_reset(cmd_tbl_t * cmdtp, bd_t * bd, int flag, int argc, char *argv[]) * int board_eth_init(bd_t *bis) */ -extern int mcffec_initialize(bd_t*); - int cpu_eth_init(bd_t *bis) { return mcffec_initialize(bis); diff --git a/cpu/mcf532x/cpu.c b/cpu/mcf532x/cpu.c index 20d0d5c..260d6e6 100644 --- a/cpu/mcf532x/cpu.c +++ b/cpu/mcf532x/cpu.c @@ -28,6 +28,7 @@ #include #include #include +#include #include @@ -136,8 +137,6 @@ int watchdog_init(void) * int board_eth_init(bd_t *bis) */ -extern int mcffec_initialize(bd_t*); - int cpu_eth_init(bd_t *bis) { return mcffec_initialize(bis); diff --git a/cpu/mcf5445x/cpu.c b/cpu/mcf5445x/cpu.c index ab342dd..a30c327 100644 --- a/cpu/mcf5445x/cpu.c +++ b/cpu/mcf5445x/cpu.c @@ -28,6 +28,7 @@ #include #include #include +#include #include @@ -102,8 +103,6 @@ int checkcpu(void) * int board_eth_init(bd_t *bis) */ -extern int mcffec_initialize(bd_t*); - int cpu_eth_init(bd_t *bis) { return mcffec_initialize(bis); diff --git a/cpu/mcf547x_8x/cpu.c b/cpu/mcf547x_8x/cpu.c index 1ba7aa8..ab4ad28 100644 --- a/cpu/mcf547x_8x/cpu.c +++ b/cpu/mcf547x_8x/cpu.c @@ -28,6 +28,7 @@ #include #include #include +#include #include @@ -148,9 +149,6 @@ int watchdog_init(void) * int board_eth_init(bd_t *bis) */ -extern int mcdmafec_initialize(bd_t *bis); -extern int mcffec_initialize(bd_t*); - int cpu_eth_init(bd_t *bis) { #if defined(CONFIG_FSLDMAFEC) -- cgit v1.1 From 3ae071e44256144d6c1e3febb65f6c56bd433769 Mon Sep 17 00:00:00 2001 From: Ben Warren Date: Tue, 12 Aug 2008 22:11:53 -0700 Subject: Moved initialization of Ethernet controllers on Atmel AT91 to board_eth_init() Removed at91sam9_eth_initialize() from net/eth.c Signed-off-by: Ben Warren --- cpu/arm926ejs/at91/Makefile | 1 - cpu/arm926ejs/at91/ether.c | 35 ----------------------------------- 2 files changed, 36 deletions(-) delete mode 100644 cpu/arm926ejs/at91/ether.c (limited to 'cpu') diff --git a/cpu/arm926ejs/at91/Makefile b/cpu/arm926ejs/at91/Makefile index 44cde1a..2d2a888 100644 --- a/cpu/arm926ejs/at91/Makefile +++ b/cpu/arm926ejs/at91/Makefile @@ -25,7 +25,6 @@ include $(TOPDIR)/config.mk LIB = $(obj)lib$(SOC).a -COBJS-y += ether.o COBJS-y += timer.o COBJS-$(CONFIG_HAS_DATAFLASH) +=spi.o COBJS-y += usb.o diff --git a/cpu/arm926ejs/at91/ether.c b/cpu/arm926ejs/at91/ether.c deleted file mode 100644 index 7e11fe4..0000000 --- a/cpu/arm926ejs/at91/ether.c +++ /dev/null @@ -1,35 +0,0 @@ -/* - * (C) Copyright 2007-2008 - * Stelian Pop - * Lead Tech Design - * - * See file CREDITS for list of people who contributed to this - * project. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of - * the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, - * MA 02111-1307 USA - */ - -#include -#include - -extern int macb_eth_initialize(int id, void *regs, unsigned int phy_addr); - -#if defined(CONFIG_MACB) && defined(CONFIG_CMD_NET) -void at91sam9_eth_initialize(bd_t *bi) -{ - macb_eth_initialize(0, (void *)AT91_BASE_EMAC, 0x00); -} -#endif -- cgit v1.1 From a0aad08f9427ac00218bdb2cb649833ce6ec9b8d Mon Sep 17 00:00:00 2001 From: Ben Warren Date: Sun, 31 Aug 2008 10:36:38 -0700 Subject: Moved initialization of MPC512x_FEC Ethernet driver to CPU directory Added a cpu_eth_init() function to MPC512x CPU directory and removed code from net/eth.c Signed-off-by: Ben Warren --- cpu/mpc512x/cpu.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'cpu') diff --git a/cpu/mpc512x/cpu.c b/cpu/mpc512x/cpu.c index 1f39ac4..d432d99 100644 --- a/cpu/mpc512x/cpu.c +++ b/cpu/mpc512x/cpu.c @@ -30,6 +30,7 @@ #include #include #include +#include #include #if defined(CONFIG_OF_LIBFDT) @@ -195,3 +196,15 @@ void ft_cpu_setup(void *blob, bd_t *bd) #endif } #endif + +#ifdef CONFIG_MPC512x_FEC +/* Default initializations for FEC controllers. To override, + * create a board-specific function called: + * int board_eth_init(bd_t *bis) + */ + +int cpu_eth_init(bd_t *bis) +{ + return mpc512x_fec_initialize(bis); +} +#endif -- cgit v1.1 From e1d7480b5de1fd4830bf7cf5e2237d3b0846d08d Mon Sep 17 00:00:00 2001 From: Ben Warren Date: Sun, 31 Aug 2008 10:39:12 -0700 Subject: Moved initialization of MPC5xxx_FEC Ethernet driver to CPU directory Modified board_eth_init() functions of boards that have this FEC in addition to other Ethernet controllers. Affected boards: bc3450 icecube mvbc_p o2dnt pm520 total5200 tq5200 Removed initialization of controller from net/eth.c Signed-off-by: Ben Warren --- cpu/mpc5xxx/cpu.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'cpu') diff --git a/cpu/mpc5xxx/cpu.c b/cpu/mpc5xxx/cpu.c index 0ed2899..1326c3c 100644 --- a/cpu/mpc5xxx/cpu.c +++ b/cpu/mpc5xxx/cpu.c @@ -29,6 +29,7 @@ #include #include #include +#include #include #include @@ -155,3 +156,15 @@ ulong bootcount_load (void) return (*save_addr & 0x0000ffff); } #endif /* CONFIG_BOOTCOUNT_LIMIT */ + +#ifdef CONFIG_MPC5xxx_FEC +/* Default initializations for FEC controllers. To override, + * create a board-specific function called: + * int board_eth_init(bd_t *bis) + */ + +int cpu_eth_init(bd_t *bis) +{ + return mpc5xxx_fec_initialize(bis); +} +#endif -- cgit v1.1