net: Move initialization of Au1x00 SoC ethernet MAC to cpu_eth_init
PATCH 1/1 net: Move initialization of Au1x00 SoC ethernet MAC to cpu_eth_init
From: Shinya Kuribayashi <[email protected]>
This patch will move au1x00_eth_initialize from net/eth.c to cpu_eth_init as a part of ongoing eth_initialize cleanup work. The function ret value is also fixed as it should be negative on fail.
--- cpu/mips/au1x00_eth.c | 2 +- cpu/mips/cpu.c | 9 +++++++++ include/netdev.h | 1 + net/eth.c | 4 ---- 4 files changed, 11 insertions(+), 5 deletions(-)
cpu/mips/au1x00_eth.c +1 -1
@@ -283,7 +283,7 @@ int au1x00_enet_initialize(bd_t *bis){if ((dev = (struct eth_device *)malloc (sizeof *dev)) ==NULL ) {puts ("malloc failed\n" ); -return 0 ; +return -1 ; }memset (dev,0 ,sizeof *dev);
cpu/mips/cpu.c +9 -0
@@ -23,6 +23,7 @@#include <common.h> #include <command.h> +#include <netdev.h> #include <asm/mipsregs.h> #include <asm/cacheops.h> #include <asm/reboot.h>
@@ -73,3 +74,11 @@ void write_one_tlb(int index, u32 pagemask, u32 hi, u32 low0, u32 low1)write_c0_index (index);tlb_write_indexed (); } + +int cpu_eth_init (bd_t *bis) +{ +#ifdef CONFIG_SOC_AU1X00 +au1x00_enet_initialize (bis); +#endif +return 0 ; +}
include/netdev.h +1 -0
@@ -41,6 +41,7 @@ int board_eth_init(bd_t *bis);int cpu_eth_init (bd_t *bis);/* Driver initialization prototypes */ +int au1x00_enet_initialize (bd_t *);int bfin_EMAC_initialize (bd_t *bis);int dc21x4x_initialize (bd_t *bis);int e1000_initialize (bd_t *bis);
net/eth.c +0 -4
@@ -39,7 +39,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" ))); -extern int au1x00_enet_initialize (bd_t *);extern int fec_initialize (bd_t *);extern int mpc8220_fec_initialize (bd_t *);extern int mv6436x_eth_initialize (bd_t *);
@@ -189,9 +188,6 @@ int eth_initialize(bd_t *bis)#if defined(FEC_ENET ) || defined(CONFIG_ETHER_ON_FCC )fec_initialize (bis);#endif -#if defined(CONFIG_AU1X00 ) -au1x00_enet_initialize (bis); -#endif if (!eth_devices) {puts ("No ethernet found.\n" );show_boot_progress (-64 );
Signature · 1 line
1.5.4.3
PATCH 1/1 Remove last reference to CONFIG_MPC85xx_FEC
This is no longer used by any boards, the last one was removed in commit 6de5bf24004c8d9c9b070bb8f7418d1c45e5eb27.
--- cpu/mpc85xx/cpu.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
cpu/mpc85xx/cpu.c +1 -1
@@ -379,7 +379,7 @@ void upmconfig (uint upm, uint * table, uint size)*/ int cpu_eth_init (bd_t *bis) { -#if defined(CONFIG_TSEC_ENET ) || defined(CONFIG_MPC85xx_FEC) +#if defined(CONFIG_TSEC_ENET )tsec_standard_init (bis);#endif
Signature · 1 line
1.5.4.3
PATCH 1/1 Moved initialization of FCC Ethernet controller to cpu_eth_init
Affected boards:
Several MPC8xx boards
Several MPC8260/MPC8272 boards
Several MPC85xx boards
Removed initialization of the driver from net/eth.c
--- cpu/mpc8260/cpu.c | 13 +++++++++++++ cpu/mpc85xx/cpu.c | 5 ++++- cpu/mpc8xx/cpu.c | 13 +++++++++++++ include/netdev.h | 1 + net/eth.c | 5 ----- 5 files changed, 31 insertions(+), 6 deletions(-)
cpu/mpc8260/cpu.c +13 -0
@@ -44,6 +44,7 @@#include <watchdog.h> #include <command.h> #include <mpc8260.h> +#include <netdev.h> #include <asm/processor.h> #include <asm/cpm_8260.h>
@@ -315,3 +316,15 @@ void ft_cpu_setup (void *blob, bd_t *bd) do_fixup_by_path_u32(blob, cpu_path, "clock-frequency", bd->bi_intfreq, 1); }#endif /* CONFIG_OF_LIBFDT */ + +/* +* Initializes on-chip ethernet controllers. +* to override, implement board_eth_init() +*/ +int cpu_eth_init (bd_t *bis) +{ +#if defined(CONFIG_ETHER_ON_FCC ) +fec_initialize (bis); +#endif +return 0 ; +}
cpu/mpc85xx/cpu.c +4 -1
@@ -30,6 +30,7 @@#include <watchdog.h> #include <command.h> #include <tsec.h> +#include <netdev.h> #include <asm/cache.h> #include <asm/io.h>
@@ -379,9 +380,11 @@ void upmconfig (uint upm, uint * table, uint size)*/ int cpu_eth_init (bd_t *bis) { +#if defined(CONFIG_ETHER_ON_FCC ) +fec_initialize (bis); +#endif #if defined(CONFIG_TSEC_ENET )tsec_standard_init (bis);#endif -return 0 ; }
cpu/mpc8xx/cpu.c +13 -0
@@ -37,6 +37,7 @@#include <watchdog.h> #include <command.h> #include <mpc8xx.h> +#include <netdev.h> #include <asm/cache.h> #if defined(CONFIG_OF_LIBFDT )
@@ -635,3 +636,15 @@ void reset_8xx_watchdog (volatile immap_t * immr) # endif /* CONFIG_LWMON */ }#endif /* CONFIG_WATCHDOG */ + +/* +* Initializes on-chip ethernet controllers. +* to override, implement board_eth_init() +*/ +int cpu_eth_init (bd_t *bis) +{ +#if defined(FEC_ENET ) +fec_initialize (bis); +#endif +return 0 ; +}
include/netdev.h +1 -0
@@ -47,6 +47,7 @@ int dc21x4x_initialize(bd_t *bis);int e1000_initialize (bd_t *bis);int eepro100_initialize (bd_t *bis);int eth_3com_initialize (bd_t * bis); +int fec_initialize (bd_t *bis);int greth_initialize (bd_t *bis);void gt6426x_eth_initialize (bd_t *bis);int inca_switch_initialize (bd_t *bis);
net/eth.c +0 -5
@@ -39,7 +39,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" ))); -extern int fec_initialize (bd_t *);extern int mpc8220_fec_initialize (bd_t *);extern int mv6436x_eth_initialize (bd_t *);extern int mv6446x_eth_initialize (bd_t *);
@@ -184,10 +183,6 @@ int eth_initialize(bd_t *bis)#if defined(CONFIG_UEC_ETH6 )uec_initialize (5 );#endif - -#if defined(FEC_ENET ) || defined(CONFIG_ETHER_ON_FCC ) -fec_initialize (bis); -#endif if (!eth_devices) {puts ("No ethernet found.\n" );show_boot_progress (-64 );
Signature · 1 line
1.5.4.3
PATCH 1/1 Moved initialization of QE Ethernet controller to cpu_eth_init()
Removed initialization of the driver from net/eth.c
--- cpu/mpc83xx/cpu.c | 20 +++++++++++++++++++- cpu/mpc85xx/cpu.c | 18 ++++++++++++++++++ include/netdev.h | 1 + net/eth.c | 19 ------------------- 4 files changed, 38 insertions(+), 20 deletions(-)
cpu/mpc83xx/cpu.c +19 -1
@@ -33,6 +33,7 @@#include <asm/processor.h> #include <libfdt.h> #include <tsec.h> +#include <netdev.h> DECLARE_GLOBAL_DATA_PTR ;
@@ -361,9 +362,26 @@ int dma_xfer(void *dest, u32 count, void *src)*/ int cpu_eth_init (bd_t *bis) { +#if defined(CONFIG_UEC_ETH1 ) +uec_initialize (0 ); +#endif +#if defined(CONFIG_UEC_ETH2 ) +uec_initialize (1 ); +#endif +#if defined(CONFIG_UEC_ETH3 ) +uec_initialize (2 ); +#endif +#if defined(CONFIG_UEC_ETH4 ) +uec_initialize (3 ); +#endif +#if defined(CONFIG_UEC_ETH5 ) +uec_initialize (4 ); +#endif +#if defined(CONFIG_UEC_ETH6 ) +uec_initialize (5 ); +#endif #if defined(CONFIG_TSEC_ENET )tsec_standard_init (bis);#endif -return 0 ; }
cpu/mpc85xx/cpu.c +18 -0
@@ -383,6 +383,24 @@ int cpu_eth_init(bd_t *bis)#if defined(CONFIG_ETHER_ON_FCC )fec_initialize (bis);#endif +#if defined(CONFIG_UEC_ETH1 ) +uec_initialize (0 ); +#endif +#if defined(CONFIG_UEC_ETH2 ) +uec_initialize (1 ); +#endif +#if defined(CONFIG_UEC_ETH3 ) +uec_initialize (2 ); +#endif +#if defined(CONFIG_UEC_ETH4 ) +uec_initialize (3 ); +#endif +#if defined(CONFIG_UEC_ETH5 ) +uec_initialize (4 ); +#endif +#if defined(CONFIG_UEC_ETH6 ) +uec_initialize (5 ); +#endif #if defined(CONFIG_TSEC_ENET )tsec_standard_init (bis);#endif
include/netdev.h +1 -0
@@ -65,6 +65,7 @@ int rtl8139_initialize(bd_t *bis);int rtl8169_initialize (bd_t *bis);int skge_initialize (bd_t *bis);int tsi108_eth_initialize (bd_t *bis); +int uec_initialize (int index);int uli526x_initialize (bd_t *bis);/* Boards with PCI network controllers can call this from their board_eth_init()
net/eth.c +0 -19
@@ -44,7 +44,6 @@ extern int mv6436x_eth_initialize(bd_t *);extern int mv6446x_eth_initialize (bd_t *);extern int ppc_4xx_eth_initialize (bd_t *);extern int scc_initialize (bd_t *); -extern int uec_initialize (int );#ifdef CONFIG_API extern void (*push_packet)(volatile void *,int );
@@ -165,24 +164,6 @@ int eth_initialize(bd_t *bis)#if defined(CONFIG_MPC8220_FEC )mpc8220_fec_initialize (bis);#endif -#if defined(CONFIG_UEC_ETH1 ) -uec_initialize (0 ); -#endif -#if defined(CONFIG_UEC_ETH2 ) -uec_initialize (1 ); -#endif -#if defined(CONFIG_UEC_ETH3 ) -uec_initialize (2 ); -#endif -#if defined(CONFIG_UEC_ETH4 ) -uec_initialize (3 ); -#endif -#if defined(CONFIG_UEC_ETH5 ) -uec_initialize (4 ); -#endif -#if defined(CONFIG_UEC_ETH6 ) -uec_initialize (5 ); -#endif if (!eth_devices) {puts ("No ethernet found.\n" );show_boot_progress (-64 );
Signature · 1 line
1.5.4.3
PATCH 1/1 Moved initialization of MPC8220 FEC to cpu_eth_init()
Removed initialization of the driver from net/eth.c
--- board/sorcery/sorcery.c | 2 ++ cpu/mpc8220/cpu.c | 13 +++++++++++++ include/netdev.h | 1 + net/eth.c | 4 ---- 4 files changed, 16 insertions(+), 4 deletions(-)
board/sorcery/sorcery.c +2 -0
@@ -62,5 +62,7 @@ void pci_init_board (void)int board_eth_init (bd_t *bis) { +/* Initialize built-in FEC first */ +cpu_eth_init (bis);return pci_eth_init (bis); }
cpu/mpc8220/cpu.c +13 -0
@@ -29,6 +29,7 @@#include <watchdog.h> #include <command.h> #include <mpc8220.h> +#include <netdev.h> #include <asm/processor.h> DECLARE_GLOBAL_DATA_PTR ;
@@ -89,3 +90,15 @@ unsigned long get_tbclk (void) }/* ------------------------------------------------------------------------- */ + +/* +* Initializes on-chip ethernet controllers. +* to override, implement board_eth_init() +*/ +int cpu_eth_init (bd_t *bis) +{ +#if defined(CONFIG_MPC8220_FEC ) +mpc8220_fec_initialize (bis); +#endif +return 0 ; +}
include/netdev.h +1 -0
@@ -56,6 +56,7 @@ int mcdmafec_initialize(bd_t *bis);int mcffec_initialize (bd_t *bis);int mpc512x_fec_initialize (bd_t *bis);int mpc5xxx_fec_initialize (bd_t *bis); +int mpc8220_fec_initialize (bd_t *bis);int natsemi_initialize (bd_t *bis);int npe_initialize (bd_t *bis);int ns8382x_initialize (bd_t *bis);
net/eth.c +0 -4
@@ -39,7 +39,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" ))); -extern int mpc8220_fec_initialize (bd_t *);extern int mv6436x_eth_initialize (bd_t *);extern int mv6446x_eth_initialize (bd_t *);extern int ppc_4xx_eth_initialize (bd_t *);
@@ -161,9 +160,6 @@ int eth_initialize(bd_t *bis)#ifdef SCC_ENET scc_initialize (bis);#endif -#if defined(CONFIG_MPC8220_FEC ) -mpc8220_fec_initialize (bis); -#endif if (!eth_devices) {puts ("No ethernet found.\n" );show_boot_progress (-64 );
Signature · 1 line
1.5.4.3
PATCH 1/1 Moved initialization of MPC8XX SCC to cpu_eth_init()
Removed initialization of the driver from net/eth.c
--- cpu/mpc8xx/cpu.c | 4 ++++ include/netdev.h | 1 + net/eth.c | 4 ---- 3 files changed, 5 insertions(+), 4 deletions(-)
cpu/mpc8xx/cpu.c +4 -0
@@ -37,6 +37,7 @@#include <watchdog.h> #include <command.h> #include <mpc8xx.h> +#include <commproc.h> #include <netdev.h> #include <asm/cache.h>
@@ -643,6 +644,9 @@ void reset_8xx_watchdog (volatile immap_t * immr)*/ int cpu_eth_init (bd_t *bis) { +#if defined(SCC_ENET ) +scc_initialize (bis); +#endif #if defined(FEC_ENET )fec_initialize (bis);#endif
include/netdev.h +1 -0
@@ -64,6 +64,7 @@ int pcnet_initialize(bd_t *bis);int plb2800_eth_initialize (bd_t *bis);int rtl8139_initialize (bd_t *bis);int rtl8169_initialize (bd_t *bis); +int scc_initialize (bd_t *bis);int skge_initialize (bd_t *bis);int tsi108_eth_initialize (bd_t *bis);int uec_initialize (int index);
net/eth.c +0 -4
@@ -42,7 +42,6 @@ int board_eth_init(bd_t *bis) __attribute((weak, alias("__def_eth_init")));extern int mv6436x_eth_initialize (bd_t *);extern int mv6446x_eth_initialize (bd_t *);extern int ppc_4xx_eth_initialize (bd_t *); -extern int scc_initialize (bd_t *);#ifdef CONFIG_API extern void (*push_packet)(volatile void *,int );
@@ -157,9 +156,6 @@ int eth_initialize(bd_t *bis)#if defined(CONFIG_4xx) && !defined(CONFIG_IOP480 ) && !defined(CONFIG_AP1000 )ppc_4xx_eth_initialize (bis);#endif -#ifdef SCC_ENET -scc_initialize (bis); -#endif if (!eth_devices) {puts ("No ethernet found.\n" );show_boot_progress (-64 );
Signature · 1 line
1.5.4.3
PATCH 1/1 Remove last reference to CONFIG_MPC85xx_FEC
In reply to Ben WarrenQuoted 4 lines · Ben Warren
This is no longer used by any boards, the last one was removed in commit
6de5bf24004c8d9c9b070bb8f7418d1c45e5eb27.Signed-off-by Ben Warren <[email protected]>
Um....8540ADS uses it. And the 8572 has one, even though we don't have any boards which expose it at this time. Unless I've missed something. If you look at drivers/net/tsec.c, you'll see it's used in the standard tsec init array.
Andy
PATCH 1/1 Remove last reference to CONFIG_MPC85xx_FEC
Quoted 5 lines · Andy Fleming
Quoted 4 lines · Ben Warren
This is no longer used by any boards, the last one was removed in commit
6de5bf24004c8d9c9b070bb8f7418d1c45e5eb27.Signed-off-by Ben Warren <[email protected]>
As a follow-up, it should be noted that the FEC on the 85xx is different from the FEC on older chips. The older FEC is a variant of the FCC. The 85xx FEC is just a tsec without gigabit (and lacking a few other accompanying features that don't affect u-boot).
This has caused frequent confusion.
PATCH 1/1 Remove last reference to CONFIG_MPC85xx_FEC
In reply to Andy FlemingQuoted 8 lines · Andy Fleming
Quoted 5 lines · Ben Warren
This is no longer used by any boards, the last one was removed in commit
6de5bf24004c8d9c9b070bb8f7418d1c45e5eb27.Signed-off-by Ben Warren <[email protected]>
Quoted 7 lines
Um....8540ADS uses it. And the 8572 has one, even though we don't have any boards which expose it at this time. Unless I've missed something. If you look at
drivers/net/tsec.c, you'll see it's used in the standard tsec init array.Andy
I see... check this out:
bwarren at bwarren-linux:~/src/u-boot$ grep -R MPC85xx_FEC * cpu/mpc85xx/cpu.c:#if defined(CONFIG_TSEC_ENET) || defined(CONFIG_MPC85xx_FEC)
bwarren at bwarren-linux:~/src/u-boot$ grep -R MPC85XX_FEC * drivers/net/tsec.c:#ifdef CONFIG_MPC85XX_FECdrivers/net/tsec.c: .devname = CONFIG_MPC85XX_FEC_NAME,
include/configs/MPC8540EVAL.h:#define CONFIG_MPC85XX_FEC 1
include/configs/MPC8540EVAL.h:#define CONFIG_MPC85XX_FEC_NAME "FE
C"
include/configs/sbc8548.h:#undef CONFIG_MPC85XX_FEC include/configs/ATUM8548.h:#undef CONFIG_MPC85XX_FEC
include/configs/PM854.h:#define CONFIG_MPC85XX_FEC 1
include/configs/PM854.h:#define CONFIG_MPC85XX_FEC_NAME "FEC"
include/configs/MPC8540ADS.h:#define CONFIG_MPC85XX_FEC 1
include/configs/MPC8540ADS.h:#define CONFIG_MPC85XX_FEC_NAME "FEC"
include/configs/TQM85xx.h:#define CONFIG_MPC85XX_FEC 1
include/configs/TQM85xx.h:#define CONFIG_MPC85XX_FEC_NAME "FEC"
include/configs/MPC8548CDS.h:#undef CONFIG_MPC85XX_FEC include/configs/socrates.h:#undef CONFIG_MPC85XX_FEC