Commit 89973f8a authored by Ben Warren's avatar Ben Warren

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: default avatarBen Warren <biggerbadderben@gmail.com>
parent 5a8a163a
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
#include <asm/arch/clk.h> #include <asm/arch/clk.h>
#include <asm/arch/gpio.h> #include <asm/arch/gpio.h>
#include <asm/arch/hmatrix.h> #include <asm/arch/hmatrix.h>
#include <netdev.h>
DECLARE_GLOBAL_DATA_PTR; DECLARE_GLOBAL_DATA_PTR;
...@@ -93,8 +94,6 @@ void board_init_info(void) ...@@ -93,8 +94,6 @@ void board_init_info(void)
gd->bd->bi_phy_id[1] = 0x03; gd->bd->bi_phy_id[1] = 0x03;
} }
extern int macb_eth_initialize(int id, void *regs, unsigned int phy_addr);
#ifdef CONFIG_CMD_NET #ifdef CONFIG_CMD_NET
int board_eth_init(bd_t *bi) int board_eth_init(bd_t *bi)
{ {
......
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
#include <asm/arch/clk.h> #include <asm/arch/clk.h>
#include <asm/arch/gpio.h> #include <asm/arch/gpio.h>
#include <asm/arch/hmatrix.h> #include <asm/arch/hmatrix.h>
#include <netdev.h>
DECLARE_GLOBAL_DATA_PTR; DECLARE_GLOBAL_DATA_PTR;
...@@ -116,8 +117,6 @@ void board_init_info(void) ...@@ -116,8 +117,6 @@ void board_init_info(void)
gd->bd->bi_phy_id[1] = 0x11; gd->bd->bi_phy_id[1] = 0x11;
} }
extern int macb_eth_initialize(int id, void *regs, unsigned int phy_addr);
#ifdef CONFIG_CMD_NET #ifdef CONFIG_CMD_NET
int board_eth_init(bd_t *bi) int board_eth_init(bd_t *bi)
{ {
......
...@@ -32,6 +32,7 @@ ...@@ -32,6 +32,7 @@
#include <asm/io.h> #include <asm/io.h>
#include <net.h> #include <net.h>
#include <asm/mach-common/bits/bootrom.h> #include <asm/mach-common/bits/bootrom.h>
#include <netdev.h>
/** /**
* is_valid_ether_addr - Determine if the given Ethernet address is valid * is_valid_ether_addr - Determine if the given Ethernet address is valid
...@@ -156,8 +157,6 @@ int misc_init_r(void) ...@@ -156,8 +157,6 @@ int misc_init_r(void)
#if defined(CONFIG_BFIN_MAC) #if defined(CONFIG_BFIN_MAC)
extern int bfin_EMAC_initialize(bd_t *bis);
int board_eth_init(bd_t *bis) int board_eth_init(bd_t *bis)
{ {
return bfin_EMAC_initialize(bis); return bfin_EMAC_initialize(bis);
......
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
* Place, Suite 330, Boston, MA 02111-1307 USA * Place, Suite 330, Boston, MA 02111-1307 USA
*/ */
#include <common.h> #include <common.h>
#include <netdev.h>
#include <asm/io.h> #include <asm/io.h>
#include <asm/sdram.h> #include <asm/sdram.h>
...@@ -87,8 +88,6 @@ void board_init_info(void) ...@@ -87,8 +88,6 @@ void board_init_info(void)
} }
#if defined(CONFIG_MACB) && defined(CONFIG_CMD_NET) #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) int board_eth_init(bd_t *bi)
{ {
return macb_eth_initialize(0, (void *)MACB0_BASE, bi->bi_phy_id[0]); return macb_eth_initialize(0, (void *)MACB0_BASE, bi->bi_phy_id[0]);
......
...@@ -32,6 +32,7 @@ ...@@ -32,6 +32,7 @@
#include <libfdt.h> #include <libfdt.h>
#include <fdt_support.h> #include <fdt_support.h>
#include <spd_sdram.h> #include <spd_sdram.h>
#include <netdev.h>
#include "../common/pixis.h" #include "../common/pixis.h"
...@@ -520,12 +521,7 @@ get_board_sys_clk(ulong dummy) ...@@ -520,12 +521,7 @@ get_board_sys_clk(ulong dummy)
return val; return val;
} }
extern int uli526x_initialize(bd_t *);
int board_eth_init(bd_t *bis) int board_eth_init(bd_t *bis)
{ {
#if defined(CONFIG_ULI526) return pci_eth_init(bis);
uli526x_initialize(bis);
#endif
return 0;
} }
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
* MA 02111-1307 USA * MA 02111-1307 USA
*/ */
#include <common.h> #include <common.h>
#include <netdev.h>
#include <asm/io.h> #include <asm/io.h>
#include <asm/sdram.h> #include <asm/sdram.h>
...@@ -195,8 +196,6 @@ void spi_cs_deactivate(struct spi_slave *slave) ...@@ -195,8 +196,6 @@ void spi_cs_deactivate(struct spi_slave *slave)
#endif /* CONFIG_ATMEL_SPI */ #endif /* CONFIG_ATMEL_SPI */
#ifdef CONFIG_CMD_NET #ifdef CONFIG_CMD_NET
extern int macb_eth_initialize(int id, void *regs, unsigned int phy_addr);
int board_eth_init(bd_t *bi) int board_eth_init(bd_t *bi)
{ {
macb_eth_initialize(0, (void *)MACB0_BASE, bi->bi_phy_id[0]); macb_eth_initialize(0, (void *)MACB0_BASE, bi->bi_phy_id[0]);
......
...@@ -25,6 +25,7 @@ ...@@ -25,6 +25,7 @@
#include "../cpu/at32ap/at32ap700x/sm.h" #include "../cpu/at32ap/at32ap700x/sm.h"
#include <common.h> #include <common.h>
#include <netdev.h>
#include <asm/io.h> #include <asm/io.h>
#include <asm/sdram.h> #include <asm/sdram.h>
...@@ -51,8 +52,6 @@ static const struct sdram_config sdram_config = { ...@@ -51,8 +52,6 @@ static const struct sdram_config sdram_config = {
.refresh_period = (781 * (SDRAMC_BUS_HZ / 1000)) / 100000, .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 #ifdef CONFIG_CMD_NET
int board_eth_init(bd_t *bis) int board_eth_init(bd_t *bis)
{ {
......
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
#include <common.h> #include <common.h>
#include <mpc824x.h> #include <mpc824x.h>
#include <pci.h> #include <pci.h>
#include <netdev.h>
int checkboard (void) int checkboard (void)
{ {
...@@ -67,8 +68,6 @@ void pci_init_board(void) ...@@ -67,8 +68,6 @@ void pci_init_board(void)
pci_mpc824x_init(&hose); pci_mpc824x_init(&hose);
} }
extern int skge_initialize(bd_t *bis);
int board_eth_init(bd_t *bis) int board_eth_init(bd_t *bis)
{ {
int rc = 0; int rc = 0;
......
...@@ -25,6 +25,7 @@ ...@@ -25,6 +25,7 @@
#include <common.h> #include <common.h>
#include <watchdog.h> #include <watchdog.h>
#include <command.h> #include <command.h>
#include <netdev.h>
DECLARE_GLOBAL_DATA_PTR; DECLARE_GLOBAL_DATA_PTR;
...@@ -57,8 +58,6 @@ int do_reset(cmd_tbl_t * cmdtp, int flag, int argc, char *argv[]) ...@@ -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 #ifdef CONFIG_GRETH
int cpu_eth_init(bd_t *bis) int cpu_eth_init(bd_t *bis)
{ {
......
...@@ -25,6 +25,7 @@ ...@@ -25,6 +25,7 @@
#include <common.h> #include <common.h>
#include <watchdog.h> #include <watchdog.h>
#include <command.h> #include <command.h>
#include <netdev.h>
#include <asm/io.h> #include <asm/io.h>
#include <asm/processor.h> #include <asm/processor.h>
...@@ -65,7 +66,6 @@ u64 flash_read64(void *addr) ...@@ -65,7 +66,6 @@ u64 flash_read64(void *addr)
} }
/* ------------------------------------------------------------------------- */ /* ------------------------------------------------------------------------- */
extern int greth_initialize(bd_t *bis);
#ifdef CONFIG_GRETH #ifdef CONFIG_GRETH
int cpu_eth_init(bd_t *bis) int cpu_eth_init(bd_t *bis)
......
...@@ -28,6 +28,7 @@ ...@@ -28,6 +28,7 @@
#include <common.h> #include <common.h>
#include <watchdog.h> #include <watchdog.h>
#include <command.h> #include <command.h>
#include <netdev.h>
#include <asm/immap.h> #include <asm/immap.h>
...@@ -114,8 +115,6 @@ int watchdog_init(void) ...@@ -114,8 +115,6 @@ int watchdog_init(void)
* int board_eth_init(bd_t *bis) * int board_eth_init(bd_t *bis)
*/ */
extern int mcffec_initialize(bd_t*);
int cpu_eth_init(bd_t *bis) int cpu_eth_init(bd_t *bis)
{ {
return mcffec_initialize(bis); return mcffec_initialize(bis);
......
...@@ -32,6 +32,7 @@ ...@@ -32,6 +32,7 @@
#include <watchdog.h> #include <watchdog.h>
#include <command.h> #include <command.h>
#include <asm/immap.h> #include <asm/immap.h>
#include <netdev.h>
#ifdef CONFIG_M5271 #ifdef CONFIG_M5271
/* /*
...@@ -328,8 +329,6 @@ int do_reset(cmd_tbl_t * cmdtp, bd_t * bd, int flag, int argc, char *argv[]) ...@@ -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) * int board_eth_init(bd_t *bis)
*/ */
extern int mcffec_initialize(bd_t*);
int cpu_eth_init(bd_t *bis) int cpu_eth_init(bd_t *bis)
{ {
return mcffec_initialize(bis); return mcffec_initialize(bis);
......
...@@ -28,6 +28,7 @@ ...@@ -28,6 +28,7 @@
#include <common.h> #include <common.h>
#include <watchdog.h> #include <watchdog.h>
#include <command.h> #include <command.h>
#include <netdev.h>
#include <asm/immap.h> #include <asm/immap.h>
...@@ -136,8 +137,6 @@ int watchdog_init(void) ...@@ -136,8 +137,6 @@ int watchdog_init(void)
* int board_eth_init(bd_t *bis) * int board_eth_init(bd_t *bis)
*/ */
extern int mcffec_initialize(bd_t*);
int cpu_eth_init(bd_t *bis) int cpu_eth_init(bd_t *bis)
{ {
return mcffec_initialize(bis); return mcffec_initialize(bis);
......
...@@ -28,6 +28,7 @@ ...@@ -28,6 +28,7 @@
#include <common.h> #include <common.h>
#include <watchdog.h> #include <watchdog.h>
#include <command.h> #include <command.h>
#include <netdev.h>
#include <asm/immap.h> #include <asm/immap.h>
...@@ -102,8 +103,6 @@ int checkcpu(void) ...@@ -102,8 +103,6 @@ int checkcpu(void)
* int board_eth_init(bd_t *bis) * int board_eth_init(bd_t *bis)
*/ */
extern int mcffec_initialize(bd_t*);
int cpu_eth_init(bd_t *bis) int cpu_eth_init(bd_t *bis)
{ {
return mcffec_initialize(bis); return mcffec_initialize(bis);
......
...@@ -28,6 +28,7 @@ ...@@ -28,6 +28,7 @@
#include <common.h> #include <common.h>
#include <watchdog.h> #include <watchdog.h>
#include <command.h> #include <command.h>
#include <netdev.h>
#include <asm/immap.h> #include <asm/immap.h>
...@@ -148,9 +149,6 @@ int watchdog_init(void) ...@@ -148,9 +149,6 @@ int watchdog_init(void)
* int board_eth_init(bd_t *bis) * 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) int cpu_eth_init(bd_t *bis)
{ {
#if defined(CONFIG_FSLDMAFEC) #if defined(CONFIG_FSLDMAFEC)
......
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
#include <common.h> #include <common.h>
#include <config.h> #include <config.h>
#include <net.h> #include <net.h>
#include <netdev.h>
#include <command.h> #include <command.h>
#include <malloc.h> #include <malloc.h>
......
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
#include <common.h> #include <common.h>
#include <command.h> #include <command.h>
#include <net.h> #include <net.h>
#include <netdev.h>
#include <malloc.h> #include <malloc.h>
#include <asm/processor.h> #include <asm/processor.h>
#include <ambapp.h> #include <ambapp.h>
......
...@@ -40,6 +40,7 @@ ...@@ -40,6 +40,7 @@
*/ */
#include <net.h> #include <net.h>
#include <netdev.h>
#include <malloc.h> #include <malloc.h>
#include <linux/mii.h> #include <linux/mii.h>
......
...@@ -32,6 +32,7 @@ ...@@ -32,6 +32,7 @@
#include <command.h> #include <command.h>
#include <net.h> #include <net.h>
#include <netdev.h>
#include <miiphy.h> #include <miiphy.h>
#undef ET_DEBUG #undef ET_DEBUG
......
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
*/ */
#include <common.h> #include <common.h>
#include <netdev.h>
#include "h/skdrv1st.h" #include "h/skdrv1st.h"
#include "h/skdrv2nd.h" #include "h/skdrv2nd.h"
......
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
#include <common.h> #include <common.h>
#include <malloc.h> #include <malloc.h>
#include <net.h> #include <net.h>
#include <netdev.h>
#include <asm/io.h> #include <asm/io.h>
#include <pci.h> #include <pci.h>
#include <miiphy.h> #include <miiphy.h>
......
/*
* (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_ */
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment