summaryrefslogtreecommitdiffstats
path: root/net/eth.c
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2016-01-17 14:51:57 -0700
committerJoe Hershberger <joe.hershberger@ni.com>2016-01-28 12:32:45 -0600
commit818f91eb5778781083e33ce3291bba76a3f1601c (patch)
tree99b1f72f8a64acf204acebb8ab07d2525190b5cd /net/eth.c
parentc32a6fd07b1839e4a45729587ebc8e1c55601a4d (diff)
downloadblackbird-obmc-uboot-818f91eb5778781083e33ce3291bba76a3f1601c.tar.gz
blackbird-obmc-uboot-818f91eb5778781083e33ce3291bba76a3f1601c.zip
net: Move common init into a new eth_common.c file
Only half of the init is actually common. Move that part into a new common file and call it from driver-model and legacy code. More common functions will be added in future patches. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Bin Meng <bmeng.cn@gmail.com> Acked-by: Joe Hershberger <joe.hershberger@ni.com>
Diffstat (limited to 'net/eth.c')
-rw-r--r--net/eth.c42
1 files changed, 14 insertions, 28 deletions
diff --git a/net/eth.c b/net/eth.c
index d96d3a5f45..602925d20f 100644
--- a/net/eth.c
+++ b/net/eth.c
@@ -16,6 +16,7 @@
#include <asm/errno.h>
#include <dm/device-internal.h>
#include <dm/uclass-internal.h>
+#include "eth_internal.h"
DECLARE_GLOBAL_DATA_PTR;
@@ -85,34 +86,6 @@ static int __def_eth_init(bd_t *bis)
int cpu_eth_init(bd_t *bis) __attribute__((weak, alias("__def_eth_init")));
int board_eth_init(bd_t *bis) __attribute__((weak, alias("__def_eth_init")));
-static void eth_common_init(void)
-{
- bootstage_mark(BOOTSTAGE_ID_NET_ETH_START);
-#if defined(CONFIG_MII) || defined(CONFIG_CMD_MII) || defined(CONFIG_PHYLIB)
- miiphy_init();
-#endif
-
-#ifdef CONFIG_PHYLIB
- phy_init();
-#endif
-
-#ifndef CONFIG_DM_ETH
- /*
- * If board-specific initialization exists, call it.
- * If not, call a CPU-specific one
- */
- if (board_eth_init != __def_eth_init) {
- if (board_eth_init(gd->bd) < 0)
- printf("Board Net Initialization Failed\n");
- } else if (cpu_eth_init != __def_eth_init) {
- if (cpu_eth_init(gd->bd) < 0)
- printf("CPU Net Initialization Failed\n");
- } else {
- printf("Net Initialization Skipped\n");
- }
-#endif
-}
-
#ifdef CONFIG_DM_ETH
/**
* struct eth_device_priv - private structure for each Ethernet device
@@ -865,6 +838,19 @@ int eth_initialize(void)
eth_devices = NULL;
eth_current = NULL;
eth_common_init();
+ /*
+ * If board-specific initialization exists, call it.
+ * If not, call a CPU-specific one
+ */
+ if (board_eth_init != __def_eth_init) {
+ if (board_eth_init(gd->bd) < 0)
+ printf("Board Net Initialization Failed\n");
+ } else if (cpu_eth_init != __def_eth_init) {
+ if (cpu_eth_init(gd->bd) < 0)
+ printf("CPU Net Initialization Failed\n");
+ } else {
+ printf("Net Initialization Skipped\n");
+ }
if (!eth_devices) {
puts("No ethernet found.\n");
OpenPOWER on IntegriCloud