[U-Boot-Users] [RFC][PATCH 1/1] Add board_eth_init() function
Ben Warren
biggerbadderben at gmail.com
Sat Mar 22 03:46:21 CET 2008
Add new board_eth_init() function, moving all TSEC initializations to board
code.
Signed-off-by: Ben Warren <biggerbadderben at gmail.com>
---
board/atum8548/atum8548.c | 18 +++++++++++++++
board/freescale/mpc8313erdb/mpc8313erdb.c | 12 ++++++++++
board/freescale/mpc8315erdb/mpc8315erdb.c | 12 ++++++++++
board/freescale/mpc8349emds/mpc8349emds.c | 12 ++++++++++
board/freescale/mpc8349itx/mpc8349itx.c | 12 ++++++++++
board/freescale/mpc837xemds/mpc837xemds.c | 12 ++++++++++
board/freescale/mpc837xerdb/mpc837xerdb.c | 12 ++++++++++
board/freescale/mpc8540ads/mpc8540ads.c | 22 ++++++++++++++++++
board/freescale/mpc8541cds/mpc8541cds.c | 12 ++++++++++
board/freescale/mpc8544ds/mpc8544ds.c | 18 +++++++++++++++
board/freescale/mpc8548cds/mpc8548cds.c | 18 +++++++++++++++
board/freescale/mpc8555cds/mpc8555cds.c | 12 ++++++++++
board/freescale/mpc8560ads/mpc8560ads.c | 12 ++++++++++
board/freescale/mpc8568mds/mpc8568mds.c | 12 ++++++++++
board/freescale/mpc8641hpcn/mpc8641hpcn.c | 18 +++++++++++++++
board/mpc8540eval/mpc8540eval.c | 23 +++++++++++++++++++
board/pm854/pm854.c | 23 +++++++++++++++++++
board/pm856/pm856.c | 12 ++++++++++
board/sbc8349/sbc8349.c | 12 ++++++++++
board/sbc8548/sbc8548.c | 18 +++++++++++++++
board/sbc8560/sbc8560.c | 9 +++++++
board/sbc8641d/sbc8641d.c | 18 +++++++++++++++
board/stxgp3/stxgp3.c | 12 ++++++++++
board/stxssa/stxssa.c | 12 ++++++++++
board/tqm834x/tqm834x.c | 12 ++++++++++
board/tqm85xx/tqm85xx.c | 22 ++++++++++++++++++
include/netdev.h | 35
+++++++++++++++++++++++++++++
net/eth.c | 25 ++++++--------------
28 files changed, 430 insertions(+), 17 deletions(-)
create mode 100644 include/netdev.h
diff --git a/board/atum8548/atum8548.c b/board/atum8548/atum8548.c
index 2f6ae29..d6bd8ae 100644
--- a/board/atum8548/atum8548.c
+++ b/board/atum8548/atum8548.c
@@ -34,6 +34,7 @@
#include <miiphy.h>
#include <libfdt.h>
#include <fdt_support.h>
+#include <netdev.h>
#if defined(CONFIG_DDR_ECC) && !defined(CONFIG_ECC_INIT_VIA_DDRCONTROLLER)
extern void ddr_enable_ecc(unsigned int dram_size);
@@ -417,3 +418,20 @@ ft_board_setup(void *blob, bd_t *bd)
}
}
#endif
+
+int board_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);
+#endif
+ return 0;
+}
diff --git a/board/freescale/mpc8313erdb/mpc8313erdb.c
b/board/freescale/mpc8313erdb/mpc8313erdb.c
index 42019fb..fdbc9bf 100644
--- a/board/freescale/mpc8313erdb/mpc8313erdb.c
+++ b/board/freescale/mpc8313erdb/mpc8313erdb.c
@@ -28,6 +28,7 @@
#endif
#include <pci.h>
#include <mpc83xx.h>
+#include <netdev.h>
DECLARE_GLOBAL_DATA_PTR;
@@ -107,3 +108,14 @@ void ft_board_setup(void *blob, bd_t *bd)
#endif
}
#endif
+
+int board_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
+ return 0;
+}
diff --git a/board/freescale/mpc8315erdb/mpc8315erdb.c
b/board/freescale/mpc8315erdb/mpc8315erdb.c
index 7af36dd..136b0aa 100644
--- a/board/freescale/mpc8315erdb/mpc8315erdb.c
+++ b/board/freescale/mpc8315erdb/mpc8315erdb.c
@@ -30,6 +30,7 @@
#endif
#include <pci.h>
#include <mpc83xx.h>
+#include <netdev.h>
DECLARE_GLOBAL_DATA_PTR;
@@ -130,3 +131,14 @@ void ft_board_setup(void *blob, bd_t *bd)
#endif
}
#endif
+
+int board_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
+ return 0;
+}
diff --git a/board/freescale/mpc8349emds/mpc8349emds.c
b/board/freescale/mpc8349emds/mpc8349emds.c
index 6c82596..59ace6c 100644
--- a/board/freescale/mpc8349emds/mpc8349emds.c
+++ b/board/freescale/mpc8349emds/mpc8349emds.c
@@ -30,6 +30,7 @@
#include <spi.h>
#include <miiphy.h>
#include <spd_sdram.h>
+#include <netdev.h>
#if defined(CONFIG_OF_LIBFDT)
#include <libfdt.h>
@@ -287,3 +288,14 @@ void ft_board_setup(void *blob, bd_t *bd)
#endif
}
#endif
+
+int board_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
+ return 0;
+}
diff --git a/board/freescale/mpc8349itx/mpc8349itx.c
b/board/freescale/mpc8349itx/mpc8349itx.c
index 972361f..8f7ae72 100644
--- a/board/freescale/mpc8349itx/mpc8349itx.c
+++ b/board/freescale/mpc8349itx/mpc8349itx.c
@@ -25,6 +25,7 @@
#include <mpc83xx.h>
#include <i2c.h>
#include <miiphy.h>
+#include <netdev.h>
#ifdef CONFIG_PCI
#include <asm/mpc8349_pci.h>
#include <pci.h>
@@ -387,3 +388,14 @@ void ft_board_setup(void *blob, bd_t *bd)
#endif
}
#endif
+
+int board_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
+ return 0;
+}
diff --git a/board/freescale/mpc837xemds/mpc837xemds.c
b/board/freescale/mpc837xemds/mpc837xemds.c
index e57a53f..1ebd23d 100644
--- a/board/freescale/mpc837xemds/mpc837xemds.c
+++ b/board/freescale/mpc837xemds/mpc837xemds.c
@@ -13,6 +13,7 @@
#include <common.h>
#include <i2c.h>
#include <spd_sdram.h>
+#include <netdev.h>
#if defined(CONFIG_OF_LIBFDT)
#include <libfdt.h>
#endif
@@ -127,3 +128,14 @@ void ft_board_setup(void *blob, bd_t *bd)
#endif
}
#endif /* CONFIG_OF_BOARD_SETUP */
+
+int board_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
+ return 0;
+}
diff --git a/board/freescale/mpc837xerdb/mpc837xerdb.c
b/board/freescale/mpc837xerdb/mpc837xerdb.c
index bed0fc3..ba9ba22 100644
--- a/board/freescale/mpc837xerdb/mpc837xerdb.c
+++ b/board/freescale/mpc837xerdb/mpc837xerdb.c
@@ -16,6 +16,7 @@
#include <i2c.h>
#include <asm/io.h>
#include <spd_sdram.h>
+#include <netdev.h>
#if defined(CFG_DRAM_TEST)
int
@@ -145,3 +146,14 @@ void ft_board_setup(void *blob, bd_t *bd)
ft_cpu_setup(blob, bd);
}
#endif /* CONFIG_OF_BOARD_SETUP */
+
+int board_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
+ return 0;
+}
diff --git a/board/freescale/mpc8540ads/mpc8540ads.c
b/board/freescale/mpc8540ads/mpc8540ads.c
index a951b9e..d227a2f 100644
--- a/board/freescale/mpc8540ads/mpc8540ads.c
+++ b/board/freescale/mpc8540ads/mpc8540ads.c
@@ -32,6 +32,7 @@
#include <spd_sdram.h>
#include <libfdt.h>
#include <fdt_support.h>
+#include <netdev.h>
#if defined(CONFIG_DDR_ECC) && !defined(CONFIG_ECC_INIT_VIA_DDRCONTROLLER)
extern void ddr_enable_ecc(unsigned int dram_size);
@@ -343,3 +344,24 @@ ft_board_setup(void *blob, bd_t *bd)
}
}
#endif
+
+int board_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
+#endif
+ return 0;
+}
diff --git a/board/freescale/mpc8541cds/mpc8541cds.c
b/board/freescale/mpc8541cds/mpc8541cds.c
index 62c8d63..4317a16 100644
--- a/board/freescale/mpc8541cds/mpc8541cds.c
+++ b/board/freescale/mpc8541cds/mpc8541cds.c
@@ -30,6 +30,7 @@
#include <spd_sdram.h>
#include <libfdt.h>
#include <fdt_support.h>
+#include <netdev.h>
#include "../common/cadmus.h"
#include "../common/eeprom.h"
@@ -530,3 +531,14 @@ ft_pci_setup(void *blob, bd_t *bd)
}
}
#endif
+
+int board_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
+ return 0;
+}
diff --git a/board/freescale/mpc8544ds/mpc8544ds.c
b/board/freescale/mpc8544ds/mpc8544ds.c
index 8107016..54b5659 100644
--- a/board/freescale/mpc8544ds/mpc8544ds.c
+++ b/board/freescale/mpc8544ds/mpc8544ds.c
@@ -31,6 +31,7 @@
#include <miiphy.h>
#include <libfdt.h>
#include <fdt_support.h>
+#include <netdev.h>
#include "../common/pixis.h"
@@ -545,3 +546,20 @@ ft_board_setup(void *blob, bd_t *bd)
}
}
#endif
+
+int board_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);
+#endif
+ return 0;
+}
diff --git a/board/freescale/mpc8548cds/mpc8548cds.c
b/board/freescale/mpc8548cds/mpc8548cds.c
index dc39fbe..cebd92c 100644
--- a/board/freescale/mpc8548cds/mpc8548cds.c
+++ b/board/freescale/mpc8548cds/mpc8548cds.c
@@ -31,6 +31,7 @@
#include <miiphy.h>
#include <libfdt.h>
#include <fdt_support.h>
+#include <netdev.h>
#include "../common/cadmus.h"
#include "../common/eeprom.h"
@@ -543,3 +544,20 @@ ft_pci_setup(void *blob, bd_t *bd)
}
}
#endif
+
+int board_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);
+#endif
+ return 0;
+}
diff --git a/board/freescale/mpc8555cds/mpc8555cds.c
b/board/freescale/mpc8555cds/mpc8555cds.c
index 8acbba4..96a9b00 100644
--- a/board/freescale/mpc8555cds/mpc8555cds.c
+++ b/board/freescale/mpc8555cds/mpc8555cds.c
@@ -28,6 +28,7 @@
#include <spd_sdram.h>
#include <libfdt.h>
#include <fdt_support.h>
+#include <netdev.h>
#include "../common/cadmus.h"
#include "../common/eeprom.h"
@@ -530,3 +531,14 @@ ft_pci_setup(void *blob, bd_t *bd)
}
}
#endif
+
+int board_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
+ return 0;
+}
diff --git a/board/freescale/mpc8560ads/mpc8560ads.c
b/board/freescale/mpc8560ads/mpc8560ads.c
index 8d4b8a8..2d00a0a 100644
--- a/board/freescale/mpc8560ads/mpc8560ads.c
+++ b/board/freescale/mpc8560ads/mpc8560ads.c
@@ -34,6 +34,7 @@
#include <miiphy.h>
#include <libfdt.h>
#include <fdt_support.h>
+#include <netdev.h>
#if defined(CONFIG_DDR_ECC) && !defined(CONFIG_ECC_INIT_VIA_DDRCONTROLLER)
extern void ddr_enable_ecc(unsigned int dram_size);
@@ -562,3 +563,14 @@ ft_board_setup(void *blob, bd_t *bd)
}
}
#endif
+
+int board_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
+ return 0;
+}
diff --git a/board/freescale/mpc8568mds/mpc8568mds.c
b/board/freescale/mpc8568mds/mpc8568mds.c
index 4568aa1..b295d01 100644
--- a/board/freescale/mpc8568mds/mpc8568mds.c
+++ b/board/freescale/mpc8568mds/mpc8568mds.c
@@ -32,6 +32,7 @@
#include <ioports.h>
#include <libfdt.h>
#include <fdt_support.h>
+#include <netdev.h>
#include "bcsr.h"
@@ -561,3 +562,14 @@ ft_board_setup(void *blob, bd_t *bd)
}
}
#endif
+
+int board_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
+ return 0;
+}
diff --git a/board/freescale/mpc8641hpcn/mpc8641hpcn.c
b/board/freescale/mpc8641hpcn/mpc8641hpcn.c
index 31e7d67..4f240b9 100644
--- a/board/freescale/mpc8641hpcn/mpc8641hpcn.c
+++ b/board/freescale/mpc8641hpcn/mpc8641hpcn.c
@@ -29,6 +29,7 @@
#include <asm/io.h>
#include <libfdt.h>
#include <fdt_support.h>
+#include <netdev.h>
#include "../common/pixis.h"
@@ -415,3 +416,20 @@ get_board_sys_clk(ulong dummy)
return val;
}
+
+int board_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);
+#endif
+ return 0;
+}
diff --git a/board/mpc8540eval/mpc8540eval.c
b/board/mpc8540eval/mpc8540eval.c
index 8328b3a..b436ab1 100644
--- a/board/mpc8540eval/mpc8540eval.c
+++ b/board/mpc8540eval/mpc8540eval.c
@@ -27,6 +27,7 @@
#include <asm/processor.h>
#include <asm/immap_85xx.h>
#include <spd_sdram.h>
+#include <netdev.h>
long int fixed_sdram (void);
@@ -243,3 +244,25 @@ long int fixed_sdram (void)
return (CFG_SDRAM_SIZE * 1024 * 1024);
}
#endif /* !defined(CONFIG_SPD_EEPROM) */
+
+int board_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
+#endif
+
+ return 0;
+}
diff --git a/board/pm854/pm854.c b/board/pm854/pm854.c
index 5e7bf34..89e91a6 100644
--- a/board/pm854/pm854.c
+++ b/board/pm854/pm854.c
@@ -30,6 +30,7 @@
#include <asm/processor.h>
#include <asm/immap_85xx.h>
#include <spd_sdram.h>
+#include <netdev.h>
#if defined(CONFIG_DDR_ECC)
extern void ddr_enable_ecc(unsigned int dram_size);
@@ -285,3 +286,25 @@ pci_init_board(void)
pci_mpc85xx_init(&hose);
#endif /* CONFIG_PCI */
}
+
+int board_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
+#endif
+
+ return 0;
+}
diff --git a/board/pm856/pm856.c b/board/pm856/pm856.c
index 792d1e5..7c8d579 100644
--- a/board/pm856/pm856.c
+++ b/board/pm856/pm856.c
@@ -32,6 +32,7 @@
#include <ioports.h>
#include <spd_sdram.h>
#include <miiphy.h>
+#include <netdev.h>
#if defined(CONFIG_DDR_ECC)
extern void ddr_enable_ecc(unsigned int dram_size);
@@ -440,3 +441,14 @@ pci_init_board(void)
pci_mpc85xx_init(&hose);
#endif /* CONFIG_PCI */
}
+
+int board_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
+ return 0;
+}
diff --git a/board/sbc8349/sbc8349.c b/board/sbc8349/sbc8349.c
index e89b6e8..5668203 100644
--- a/board/sbc8349/sbc8349.c
+++ b/board/sbc8349/sbc8349.c
@@ -32,6 +32,7 @@
#include <i2c.h>
#include <spd_sdram.h>
#include <miiphy.h>
+#include <netdev.h>
#if defined(CONFIG_OF_LIBFDT)
#include <libfdt.h>
#endif
@@ -240,3 +241,14 @@ void ft_board_setup(void *blob, bd_t *bd)
#endif
}
#endif
+
+int board_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
+ return 0;
+}
diff --git a/board/sbc8548/sbc8548.c b/board/sbc8548/sbc8548.c
index 8a6ced3..d97f04b 100644
--- a/board/sbc8548/sbc8548.c
+++ b/board/sbc8548/sbc8548.c
@@ -34,6 +34,7 @@
#include <miiphy.h>
#include <libfdt.h>
#include <fdt_support.h>
+#include <netdev.h>
#if defined(CONFIG_DDR_ECC) && !defined(CONFIG_ECC_INIT_VIA_DDRCONTROLLER)
extern void ddr_enable_ecc(unsigned int dram_size);
@@ -566,3 +567,20 @@ ft_board_setup(void *blob, bd_t *bd)
#endif
}
#endif
+
+int board_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);
+#endif
+ return 0;
+}
diff --git a/board/sbc8560/sbc8560.c b/board/sbc8560/sbc8560.c
index 8df4f3a..4e33982 100644
--- a/board/sbc8560/sbc8560.c
+++ b/board/sbc8560/sbc8560.c
@@ -33,6 +33,7 @@
#include <ioports.h>
#include <spd_sdram.h>
#include <miiphy.h>
+#include <netdev.h>
long int fixed_sdram (void);
@@ -452,3 +453,11 @@ long int fixed_sdram (void)
return CFG_SDRAM_SIZE * 1024 * 1024;
}
#endif /* !defined(CONFIG_SPD_EEPROM) */
+
+int board_eth_init(bd_t *bis)
+{
+#if defined(CONFIG_TSEC1)
+ tsec_initialize(bis, 0, CONFIG_TSEC1_NAME);
+#endif
+ return 0;
+}
diff --git a/board/sbc8641d/sbc8641d.c b/board/sbc8641d/sbc8641d.c
index b3dd9c8..45ffb4a 100644
--- a/board/sbc8641d/sbc8641d.c
+++ b/board/sbc8641d/sbc8641d.c
@@ -37,6 +37,7 @@
#include <spd_sdram.h>
#include <libfdt.h>
#include <fdt_support.h>
+#include <netdev.h>
#if defined(CONFIG_DDR_ECC) && !defined(CONFIG_ECC_INIT_VIA_DDRCONTROLLER)
extern void ddr_enable_ecc (unsigned int dram_size);
@@ -415,3 +416,20 @@ unsigned long get_board_sys_clk (ulong dummy)
return val;
}
+
+int board_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);
+#endif
+ return 0;
+}
diff --git a/board/stxgp3/stxgp3.c b/board/stxgp3/stxgp3.c
index f04ffa8..7f3f882 100644
--- a/board/stxgp3/stxgp3.c
+++ b/board/stxgp3/stxgp3.c
@@ -37,6 +37,7 @@
#include <asm/io.h>
#include <spd_sdram.h>
#include <miiphy.h>
+#include <netdev.h>
long int fixed_sdram (void);
@@ -373,3 +374,14 @@ pci_init_board(void)
pci_mpc85xx_init(&hose);
#endif /* CONFIG_PCI */
}
+
+int board_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
+ return 0;
+}
diff --git a/board/stxssa/stxssa.c b/board/stxssa/stxssa.c
index 08177e1..92febca 100644
--- a/board/stxssa/stxssa.c
+++ b/board/stxssa/stxssa.c
@@ -37,6 +37,7 @@
#include <asm/io.h>
#include <spd_sdram.h>
#include <miiphy.h>
+#include <netdev.h>
long int fixed_sdram (void);
@@ -396,3 +397,14 @@ pci_init_board(void)
pci_mpc85xx_init(hose);
#endif /* CONFIG_PCI */
}
+
+int board_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
+ return 0;
+}
diff --git a/board/tqm834x/tqm834x.c b/board/tqm834x/tqm834x.c
index aea985c..cffc7b3 100644
--- a/board/tqm834x/tqm834x.c
+++ b/board/tqm834x/tqm834x.c
@@ -30,6 +30,7 @@
#include <miiphy.h>
#include <asm-ppc/mmu.h>
#include <pci.h>
+#include <netdev.h>
DECLARE_GLOBAL_DATA_PTR;
@@ -431,3 +432,14 @@ static void set_ddr_config(void) {
#endif
}
}
+
+int board_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
+ return 0;
+}
diff --git a/board/tqm85xx/tqm85xx.c b/board/tqm85xx/tqm85xx.c
index 8fa0162..f8237a0 100644
--- a/board/tqm85xx/tqm85xx.c
+++ b/board/tqm85xx/tqm85xx.c
@@ -33,6 +33,7 @@
#include <asm/immap_85xx.h>
#include <ioports.h>
#include <flash.h>
+#include <netdev.h>
DECLARE_GLOBAL_DATA_PTR;
@@ -417,3 +418,24 @@ int board_early_init_r (void)
return (0);
}
#endif /* CONFIG_BOARD_EARLY_INIT_R */
+
+int board_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
+#endif
+ return 0;
+}
diff --git a/include/netdev.h b/include/netdev.h
new file mode 100644
index 0000000..19195fa
--- /dev/null
+++ b/include/netdev.h
@@ -0,0 +1,35 @@
+/*
+ * (C) Copyright 2008
+ * Benjamin Warren, biggerbadderben at 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_
+
+int tsec_initialize(bd_t * bis, int index, char *devname);
+
+#endif /* _NETDEV_H_ */
+
+
diff --git a/net/eth.c b/net/eth.c
index 16a6dcb..3d02272 100644
--- a/net/eth.c
+++ b/net/eth.c
@@ -28,6 +28,13 @@
#if defined(CONFIG_CMD_NET) && defined(CONFIG_NET_MULTI)
+int __board_eth_init(bd_t *bis)
+{
+ return 0;
+}
+
+int board_eth_init(bd_t *bis) __attribute((weak,
alias("__board_eth_init")));
+
#ifdef CFG_GT_6426x
extern int gt6426x_eth_initialize(bd_t *bis);
#endif
@@ -55,7 +62,6 @@ extern int scc_initialize(bd_t*);
extern int skge_initialize(bd_t*);
extern int tsi108_eth_initialize(bd_t*);
extern int uli526x_initialize(bd_t *);
-extern int tsec_initialize(bd_t*, int, char *);
extern int npe_initialize(bd_t *);
extern int uec_initialize(int);
extern int bfin_EMAC_initialize(bd_t *);
@@ -164,6 +170,7 @@ int eth_initialize(bd_t *bis)
#if defined(CONFIG_MII) || defined(CONFIG_CMD_MII)
miiphy_init();
#endif
+ board_eth_init(bis);
#if defined(CONFIG_DB64360) || defined(CONFIG_CPCI750)
mv6436x_eth_initialize(bis);
@@ -195,22 +202,6 @@ int eth_initialize(bd_t *bis)
#if defined(CONFIG_SK98)
skge_initialize(bis);
#endif
-#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
-#endif
#if defined(CONFIG_UEC_ETH1)
uec_initialize(0);
#endif
--
1.5.2.5
More information about the U-Boot
mailing list