]> git.ipfire.org Git - people/ms/u-boot.git/commitdiff
Introduce netdev.h header file and remove externs
authorBen Warren <biggerbadderben@gmail.com>
Mon, 1 Sep 2008 05:22:04 +0000 (22:22 -0700)
committerBen Warren <biggerbadderben@gmail.com>
Wed, 3 Sep 2008 04:18:16 +0000 (21:18 -0700)
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>
22 files changed:
board/atmel/atngw100/atngw100.c
board/atmel/atstk1000/atstk1000.c
board/bf537-stamp/bf537-stamp.c
board/earthlcd/favr-32-ezkit/favr-32-ezkit.c
board/freescale/mpc8610hpcd/mpc8610hpcd.c
board/mimc/mimc200/mimc200.c
board/miromico/hammerhead/hammerhead.c
board/sl8245/sl8245.c
cpu/leon2/cpu.c
cpu/leon3/cpu.c
cpu/mcf523x/cpu.c
cpu/mcf52x2/cpu.c
cpu/mcf532x/cpu.c
cpu/mcf5445x/cpu.c
cpu/mcf547x_8x/cpu.c
drivers/net/bfin_mac.c
drivers/net/greth.c
drivers/net/macb.c
drivers/net/mcffec.c
drivers/net/sk98lin/uboot_drv.c
drivers/net/uli526x.c
include/netdev.h [new file with mode: 0644]

index 7f3e48541deae21ea113d224a9a4b10412d96273..fa1a2aa7c12d69cd2d2b88b0b1e437c1a27c2192 100644 (file)
@@ -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;
 
@@ -93,8 +94,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)
 {
index 915b1c35393a706c6e1f1bf7ee7e426b8088b9cb..94523b5a3b52f9d37e6fc1e1727e761e41342af0 100644 (file)
@@ -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)
 {
index a9b7a68c549914c5840576ca07ffe8ecb0270932..4567213111bbd5a942f38275ee7998c8049bbce1 100644 (file)
@@ -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);
index da69e754f93ce81f6e065ad36a611373a909ff06..da055899f553ef34a4128fca4cf90b0e8aafcd4f 100644 (file)
@@ -18,6 +18,7 @@
  * Place, Suite 330, Boston, MA 02111-1307 USA
  */
 #include <common.h>
+#include <netdev.h>
 
 #include <asm/io.h>
 #include <asm/sdram.h>
@@ -87,8 +88,6 @@ void board_init_info(void)
 }
 
 #if defined(CONFIG_MACB) && defined(CONFIG_CMD_NET)
-extern int macb_eth_initialize(int id, void *regs, unsigned int phy_addr);
-
 int board_eth_init(bd_t *bi)
 {
        return macb_eth_initialize(0, (void *)MACB0_BASE, bi->bi_phy_id[0]);
index af79fc2c67a5774d986844214d7336c205ab85b6..130f7aa8ceb3cdd04470cbf8d5317ade14a70804 100644 (file)
@@ -32,6 +32,7 @@
 #include <libfdt.h>
 #include <fdt_support.h>
 #include <spd_sdram.h>
+#include <netdev.h>
 
 #include "../common/pixis.h"
 
@@ -520,12 +521,7 @@ 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)
-       uli526x_initialize(bis);
-#endif
-       return 0;
+       return pci_eth_init(bis);
 }
index 4ece11ac873a73a2c8fd07d5dd62256c9606a2dc..8516dcb8288bf83b1183fbf5882613584c2e145b 100644 (file)
@@ -20,6 +20,7 @@
  * MA 02111-1307 USA
  */
 #include <common.h>
+#include <netdev.h>
 
 #include <asm/io.h>
 #include <asm/sdram.h>
@@ -195,8 +196,6 @@ void spi_cs_deactivate(struct spi_slave *slave)
 #endif /* CONFIG_ATMEL_SPI */
 
 #ifdef CONFIG_CMD_NET
-extern int macb_eth_initialize(int id, void *regs, unsigned int phy_addr);
-
 int board_eth_init(bd_t *bi)
 {
        macb_eth_initialize(0, (void *)MACB0_BASE, bi->bi_phy_id[0]);
index 738ece2fe32192ecab455169a60a1260525dbb57..d3875f449dbd7d522e74d004d5785b900f356dee 100644 (file)
@@ -25,6 +25,7 @@
 #include "../cpu/at32ap/at32ap700x/sm.h"
 
 #include <common.h>
+#include <netdev.h>
 
 #include <asm/io.h>
 #include <asm/sdram.h>
@@ -51,8 +52,6 @@ static const struct sdram_config sdram_config = {
        .refresh_period = (781 * (SDRAMC_BUS_HZ / 1000)) / 100000,
 };
 
-extern int macb_eth_initialize(int id, void *regs, unsigned int phy_addr);
-
 #ifdef CONFIG_CMD_NET
 int board_eth_init(bd_t *bis)
 {
index c853755a1c6c14852952ff57a353991ba94f3da8..e66272ecb9872312464f28671bf9f4f842a37bdd 100644 (file)
@@ -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;
index 5de1c521aae12fe2f59593383e7c3b2e8da2c1f2..d6e23b129c49491e12546951e3a46dd922efce2f 100644 (file)
@@ -25,6 +25,7 @@
 #include <common.h>
 #include <watchdog.h>
 #include <command.h>
+#include <netdev.h>
 
 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)
 {
index 1725fdb090bf2399f5a4811e78275d840e092ae8..976f3113480a4edf17f1c527c7f9a8c851fcaaed 100644 (file)
@@ -25,6 +25,7 @@
 #include <common.h>
 #include <watchdog.h>
 #include <command.h>
+#include <netdev.h>
 
 #include <asm/io.h>
 #include <asm/processor.h>
@@ -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)
index 8d2152d9c9305c1d485957532551c1a33c6eb49a..bdc152f07824ad83e5ad216d60bc9287942eb8f1 100644 (file)
@@ -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);
index 2af31cbb98d079e3467a68e0472e9ce8ac4c58a8..167097a797d80d50b5fd6bfde7fdcf6cb25f8ef2 100644 (file)
@@ -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);
index 20d0d5cf279eb1c96fb6c1e97db601c65dbe3e3d..260d6e67557c5ebef9b509c351399b7303ba06e9 100644 (file)
@@ -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);
index ab342ddeb0459e71cc0ad312823ade3f34295cf4..a30c327dd76690a5c90215ce672edb285b7f7843 100644 (file)
@@ -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);
index 1ba7aa80a3efee66685f65d4b3b684cdbd02f842..ab4ad2889c08f0ce780156d605d50315a86ae4b2 100644 (file)
@@ -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)
index 3ee5d9603a55cdd3256e89b631c3fc974eb9f979..c5e74b8b5d64e0e7eef42741944fb18a461b342e 100644 (file)
@@ -9,6 +9,7 @@
 #include <common.h>
 #include <config.h>
 #include <net.h>
+#include <netdev.h>
 #include <command.h>
 #include <malloc.h>
 
index 90c5338837d0544c67cdcea027f66e1c666b5642..79bc4d9d26b10df0e8cf6f5448d520782ef4c318 100644 (file)
@@ -27,6 +27,7 @@
 #include <common.h>
 #include <command.h>
 #include <net.h>
+#include <netdev.h>
 #include <malloc.h>
 #include <asm/processor.h>
 #include <ambapp.h>
index aa39284d1d92de04d2ecdc643d3c30dd45e5f51b..08bebf74a5c5ec83ef426a6b4ab2bd99f74caca1 100644 (file)
@@ -40,6 +40,7 @@
  */
 
 #include <net.h>
+#include <netdev.h>
 #include <malloc.h>
 
 #include <linux/mii.h>
index 50d6508fb4d0e90e71a289faa27a177e683f2b99..f93cf598e251d2b3ce1d56eb75458f7889c79802 100644 (file)
@@ -32,6 +32,7 @@
 
 #include <command.h>
 #include <net.h>
+#include <netdev.h>
 #include <miiphy.h>
 
 #undef ET_DEBUG
index 205e7d2e9903de76c2e3906929fea89835fd091d..0199b33fe8b778409d98289f18d5df79395fc330 100644 (file)
@@ -24,6 +24,7 @@
  */
 
 #include <common.h>
+#include <netdev.h>
 
 #include "h/skdrv1st.h"
 #include "h/skdrv2nd.h"
index d87638c138eab5453fa09a7360b875bfe3ea9c2d..9ea5ac2013b3e1d8c6900ca3a105a2a5d77aa447 100644 (file)
@@ -16,6 +16,7 @@
 #include <common.h>
 #include <malloc.h>
 #include <net.h>
+#include <netdev.h>
 #include <asm/io.h>
 #include <pci.h>
 #include <miiphy.h>
diff --git a/include/netdev.h b/include/netdev.h
new file mode 100644 (file)
index 0000000..3ec9212
--- /dev/null
@@ -0,0 +1,66 @@
+/*
+ * (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 greth_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 *bis);
+int skge_initialize(bd_t *bis);
+int uli526x_initialize(bd_t *bis);
+
+/* Boards with PCI network controllers can call this from their board_eth_init()
+ * function to initialize whatever's on board.
+ * Return value is total # of devices found */
+
+static inline int pci_eth_init(bd_t *bis)
+{
+       int num = 0;
+#if defined(CONFIG_ULI526)
+       num += uli526x_initialize(bis);
+#endif
+       return num;
+}
+
+#endif /* _NETDEV_H_ */
+