[U-Boot] [PATCH] 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 biggerbadderben@gmail.com ---
This patch will be applied to u-boot-net/testing
board/atmel/atngw100/atngw100.c | 3 +- board/atmel/atstk1000/atstk1000.c | 3 +- board/bf537-stamp/bf537-stamp.c | 3 +- board/freescale/mpc8610hpcd/mpc8610hpcd.c | 3 +- board/sl8245/sl8245.c | 3 +- cpu/arm926ejs/at91sam9/ether.c | 3 +- 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 +-- cpu/mpc83xx/cpu.c | 3 +- cpu/mpc85xx/cpu.c | 3 +- cpu/mpc86xx/cpu.c | 3 +- include/netdev.h | 53 +++++++++++++++++++++++++++++ 15 files changed, 68 insertions(+), 28 deletions(-) create mode 100644 include/netdev.h
diff --git a/board/atmel/atngw100/atngw100.c b/board/atmel/atngw100/atngw100.c index caf33f0..686d214 100644 --- a/board/atmel/atngw100/atngw100.c +++ b/board/atmel/atngw100/atngw100.c @@ -26,6 +26,7 @@ #include <asm/arch/clk.h> #include <asm/arch/gpio.h> #include <asm/arch/hmatrix.h> +#include <netdev.h>
DECLARE_GLOBAL_DATA_PTR;
@@ -90,8 +91,6 @@ void board_init_info(void) gd->bd->bi_phy_id[1] = 0x03; }
-extern int macb_eth_initialize(int id, void *regs, unsigned int phy_addr); - #ifdef CONFIG_CMD_NET int board_eth_init(bd_t *bi) { diff --git a/board/atmel/atstk1000/atstk1000.c b/board/atmel/atstk1000/atstk1000.c index 496c6a8..ca03c3a 100644 --- a/board/atmel/atstk1000/atstk1000.c +++ b/board/atmel/atstk1000/atstk1000.c @@ -26,6 +26,7 @@ #include <asm/arch/clk.h> #include <asm/arch/gpio.h> #include <asm/arch/hmatrix.h> +#include <netdev.h>
DECLARE_GLOBAL_DATA_PTR;
@@ -116,8 +117,6 @@ void board_init_info(void) gd->bd->bi_phy_id[1] = 0x11; }
-extern int macb_eth_initialize(int id, void *regs, unsigned int phy_addr); - #ifdef CONFIG_CMD_NET int board_eth_init(bd_t *bi) { diff --git a/board/bf537-stamp/bf537-stamp.c b/board/bf537-stamp/bf537-stamp.c index a9b7a68..4567213 100644 --- a/board/bf537-stamp/bf537-stamp.c +++ b/board/bf537-stamp/bf537-stamp.c @@ -32,6 +32,7 @@ #include <asm/io.h> #include <net.h> #include <asm/mach-common/bits/bootrom.h> +#include <netdev.h>
/** * is_valid_ether_addr - Determine if the given Ethernet address is valid @@ -156,8 +157,6 @@ int misc_init_r(void)
#if defined(CONFIG_BFIN_MAC)
-extern int bfin_EMAC_initialize(bd_t *bis); - int board_eth_init(bd_t *bis) { return bfin_EMAC_initialize(bis); diff --git a/board/freescale/mpc8610hpcd/mpc8610hpcd.c b/board/freescale/mpc8610hpcd/mpc8610hpcd.c index 0122e6d..3a061dd 100644 --- a/board/freescale/mpc8610hpcd/mpc8610hpcd.c +++ b/board/freescale/mpc8610hpcd/mpc8610hpcd.c @@ -31,6 +31,7 @@ #include <libfdt.h> #include <fdt_support.h> #include <spd_sdram.h> +#include <netdev.h>
#include "../common/pixis.h"
@@ -516,8 +517,6 @@ get_board_sys_clk(ulong dummy) return val; }
-extern int uli526x_initialize(bd_t *); - int board_eth_init(bd_t *bis) { #if defined(CONFIG_ULI526) diff --git a/board/sl8245/sl8245.c b/board/sl8245/sl8245.c index c853755..e66272e 100644 --- a/board/sl8245/sl8245.c +++ b/board/sl8245/sl8245.c @@ -24,6 +24,7 @@ #include <common.h> #include <mpc824x.h> #include <pci.h> +#include <netdev.h>
int checkboard (void) { @@ -67,8 +68,6 @@ void pci_init_board(void) pci_mpc824x_init(&hose); }
-extern int skge_initialize(bd_t *bis); - int board_eth_init(bd_t *bis) { int rc = 0; diff --git a/cpu/arm926ejs/at91sam9/ether.c b/cpu/arm926ejs/at91sam9/ether.c index 7e11fe4..cf270da 100644 --- a/cpu/arm926ejs/at91sam9/ether.c +++ b/cpu/arm926ejs/at91sam9/ether.c @@ -28,8 +28,9 @@ 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) +int cpu_eth_init(bd_t *bi) { macb_eth_initialize(0, (void *)AT91_BASE_EMAC, 0x00); + return 0; } #endif 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 <common.h> #include <watchdog.h> #include <command.h> +#include <netdev.h>
#include <asm/immap.h>
@@ -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 <watchdog.h> #include <command.h> #include <asm/immap.h> +#include <netdev.h>
#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 <common.h> #include <watchdog.h> #include <command.h> +#include <netdev.h>
#include <asm/immap.h>
@@ -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 <common.h> #include <watchdog.h> #include <command.h> +#include <netdev.h>
#include <asm/immap.h>
@@ -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 <common.h> #include <watchdog.h> #include <command.h> +#include <netdev.h>
#include <asm/immap.h>
@@ -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) diff --git a/cpu/mpc83xx/cpu.c b/cpu/mpc83xx/cpu.c index 94d1a13..ce330ee 100644 --- a/cpu/mpc83xx/cpu.c +++ b/cpu/mpc83xx/cpu.c @@ -32,6 +32,7 @@ #include <mpc83xx.h> #include <asm/processor.h> #include <libfdt.h> +#include <netdev.h>
DECLARE_GLOBAL_DATA_PTR;
@@ -365,8 +366,6 @@ int dma_xfer(void *dest, u32 count, void *src) * int board_eth_init(bd_t *bis) */
-extern int tsec_initialize(bd_t * bis, int index, char *devname); - int cpu_eth_init(bd_t *bis) { #if defined(CONFIG_TSEC1) diff --git a/cpu/mpc85xx/cpu.c b/cpu/mpc85xx/cpu.c index fcdb587..e358361 100644 --- a/cpu/mpc85xx/cpu.c +++ b/cpu/mpc85xx/cpu.c @@ -30,6 +30,7 @@ #include <command.h> #include <asm/cache.h> #include <asm/io.h> +#include <netdev.h>
DECLARE_GLOBAL_DATA_PTR;
@@ -360,8 +361,6 @@ void upmconfig (uint upm, uint * table, uint size) * int board_eth_init(bd_t *bis) */
-extern int tsec_initialize(bd_t * bis, int index, char *devname); - int cpu_eth_init(bd_t *bis) { #if defined(CONFIG_TSEC1) diff --git a/cpu/mpc86xx/cpu.c b/cpu/mpc86xx/cpu.c index 4eaed05..3178644 100644 --- a/cpu/mpc86xx/cpu.c +++ b/cpu/mpc86xx/cpu.c @@ -29,6 +29,7 @@ #include <asm/mmu.h> #include <mpc86xx.h> #include <asm/fsl_law.h> +#include <netdev.h>
int @@ -297,8 +298,6 @@ void mpc86xx_reginfo(void) * int board_eth_init(bd_t *bis) */
-extern int tsec_initialize(bd_t * bis, int index, char *devname); - int cpu_eth_init(bd_t *bis) { #if defined(CONFIG_TSEC1) diff --git a/include/netdev.h b/include/netdev.h new file mode 100644 index 0000000..fda3fe1 --- /dev/null +++ b/include/netdev.h @@ -0,0 +1,53 @@ +/* + * (C) Copyright 2008 + * Benjamin Warren, biggerbadderben@gmail.com + * + * 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 + */ + +/* + * netdev.h - definitions an prototypes for network devices + */ + +#ifndef _NETDEV_H_ +#define _NETDEV_H_ + +/* + * Board and CPU-specific initialization functions + * board_eth_init() has highest priority. cpu_eth_init() only + * gets called if board_eth_init() isn't instantiated or fails. + * Return values: + * 0: success + * -1: failure + */ + +int board_eth_init(bd_t *bis); +int cpu_eth_init(bd_t *bis); + +/* Driver initialization prototypes */ +int bfin_EMAC_initialize(bd_t *bis); +int macb_eth_initialize(int id, void *regs, unsigned int phy_addr); +int mcdmafec_initialize(bd_t *bis); +int mcffec_initialize(bd_t*); +int skge_initialize(bd_t *bis); +int tsec_initialize(bd_t * bis, int index, char *devname); +int uli526x_initialize(bd_t *); + +#endif /* _NETDEV_H_ */ +
participants (1)
-
Ben Warren