net: move bootfile/ipaddr init into eth_initialize
Subsystems (11)
PATCH 1/1 net: move bootfile/ipaddr init into eth_initialize
All arches init these variables the same way, so move the logic into the core net code to avoid duplicating it everywhere else.
--- arch/arm/lib/board.c | 11 ----------- arch/avr32/lib/board.c | 5 ----- arch/blackfin/lib/board.c | 9 +-------- arch/m68k/lib/board.c | 14 -------------- arch/microblaze/lib/board.c | 7 ------- arch/mips/lib/board.c | 11 ----------- arch/nds32/lib/board.c | 9 --------- arch/nios2/lib/board.c | 2 -- arch/powerpc/lib/board.c | 11 ----------- arch/sandbox/lib/board.c | 3 --- arch/sh/lib/board.c | 22 ++-------------------- arch/sparc/lib/board.c | 7 ------- arch/x86/lib/board.c | 12 ------------ net/eth.c | 12 ++++++++++++ 14 files changed, 15 insertions(+), 120 deletions(-)
arch/arm/lib/board.c +0 -11
@@ -536,9 +536,6 @@ void board_init_r(gd_t *id, ulong dest_addr)arm_pci_init ();#endif -/* IP Address */ - gd->bd->bi_ip_addr =getenv_IPaddr ("ipaddr" ); -stdio_init ();/* get the devices list going. */ jumptable_init ();
@@ -576,14 +573,6 @@ void board_init_r(gd_t *id, ulong dest_addr)/* Initialize from environment */ load_addr =getenv_ulong ("loadaddr" ,16 , load_addr); -#if defined(CONFIG_CMD_NET ) - { -char *s =getenv ("bootfile" ); - -if (s !=NULL ) -copy_filename (BootFile, s,sizeof (BootFile)); - } -#endif #ifdef CONFIG_BOARD_LATE_INIT board_late_init ();
arch/avr32/lib/board.c +0 -5
@@ -304,8 +304,6 @@ void board_init_r(gd_t *new_gd, ulong dest_addr)/* initialize environment */ env_relocate (); - bd->bi_ip_addr =getenv_IPaddr ("ipaddr" ); -stdio_init ();jumptable_init ();console_init_r ();
@@ -317,9 +315,6 @@ void board_init_r(gd_t *new_gd, ulong dest_addr)bb_miiphy_init ();#endif #if defined(CONFIG_CMD_NET ) - s =getenv ("bootfile" ); -if (s) -copy_filename (BootFile, s,sizeof (BootFile));puts ("Net: " );eth_initialize (gd->bd);#endif
arch/blackfin/lib/board.c +1 -8
@@ -294,15 +294,8 @@ static void board_net_init_r(bd_t *bd)bb_miiphy_init ();#endif #ifdef CONFIG_CMD_NET -char *s; - -if ((s =getenv ("bootfile" )) !=NULL ) -copy_filename (BootFile, s,sizeof (BootFile)); - - bd->bi_ip_addr =getenv_IPaddr ("ipaddr" ); -printf ("Net: " ); -eth_initialize (gd->bd); +eth_initialize (bd);#endif }
arch/m68k/lib/board.c +0 -14
@@ -507,15 +507,6 @@ void board_init_r (gd_t *id, ulong dest_addr)/* relocate environment function pointers etc. */ env_relocate (); -/* -* Fill in missing fields of bd_info. -* We do this here, where we have "normal" access to the -* environment; we used to do this still running from ROM, -* where had to use getenv_f(), which can be pretty slow when -* the environment is in EEPROM. -*/ - bd->bi_ip_addr =getenv_IPaddr ("ipaddr" ); -WATCHDOG_RESET ();#if defined(CONFIG_PCI )
@@ -568,11 +559,6 @@ void board_init_r (gd_t *id, ulong dest_addr)/* Initialize from environment */ load_addr =getenv_ulong ("loadaddr" ,16 , load_addr); -#if defined(CONFIG_CMD_NET ) -if ((s =getenv ("bootfile" )) !=NULL ) { -copy_filename (BootFile, s,sizeof (BootFile)); - } -#endif WATCHDOG_RESET ();
arch/microblaze/lib/board.c +0 -7
@@ -176,19 +176,12 @@ void board_init (void) load_addr =getenv_ulong ("loadaddr" ,16 , load_addr);#if defined(CONFIG_CMD_NET ) -/* IP Address */ - bd->bi_ip_addr =getenv_IPaddr ("ipaddr" ); -printf ("Net: " );eth_initialize (gd->bd);uchar enetaddr[6 ];eth_getenv_enetaddr ("ethaddr" , enetaddr);printf ("MAC: %pM\n" , enetaddr); - - s =getenv ("bootfile" ); -if (s !=NULL ) -copy_filename (BootFile, s,sizeof (BootFile));#endif /* main_loop */
arch/mips/lib/board.c +0 -11
@@ -316,9 +316,6 @@ void board_init_r(gd_t *id, ulong dest_addr)/* relocate environment function pointers etc. */ env_relocate (); -/* IP Address */ - bd->bi_ip_addr =getenv_IPaddr ("ipaddr" ); -#if defined(CONFIG_PCI )/* * Do pci configuration
@@ -338,14 +335,6 @@ void board_init_r(gd_t *id, ulong dest_addr)/* Initialize from environment */ load_addr =getenv_ulong ("loadaddr" ,16 , load_addr); -#if defined(CONFIG_CMD_NET ) - { -char *s =getenv ("bootfile" ); - -if (s !=NULL ) -copy_filename (BootFile, s,sizeof (BootFile)); - } -#endif #ifdef CONFIG_CMD_SPI puts ("SPI: " );
arch/nds32/lib/board.c +0 -9
@@ -368,9 +368,6 @@ void board_init_r(gd_t *id, ulong dest_addr)nds32_pci_init ();#endif -/* IP Address */ - gd->bd->bi_ip_addr =getenv_IPaddr ("ipaddr" ); -stdio_init ();/* get the devices list going. */ jumptable_init ();
@@ -401,12 +398,6 @@ void board_init_r(gd_t *id, ulong dest_addr)/* Initialize from environment */ load_addr =getenv_ulong ("loadaddr" ,16 , load_addr); -#if defined(CONFIG_CMD_NET ) - s =getenv ("bootfile" ); -if (s !=NULL ) -copy_filename (BootFile, s,sizeof (BootFile)); -#endif -#ifdef BOARD_LATE_INIT board_late_init ();#endif
arch/nios2/lib/board.c +0 -2
@@ -143,8 +143,6 @@ void board_init (void)WATCHDOG_RESET ();env_relocate (); - bd->bi_ip_addr =getenv_IPaddr ("ipaddr" ); -WATCHDOG_RESET ();stdio_init ();jumptable_init ();
arch/powerpc/lib/board.c +0 -11
@@ -877,9 +877,6 @@ void board_init_r(gd_t *id, ulong dest_addr)#endif #endif /* CONFIG_CMD_NET */ -/* IP Address */ - bd->bi_ip_addr =getenv_IPaddr ("ipaddr" ); -WATCHDOG_RESET ();#if defined(CONFIG_PCI ) && !defined(CONFIG_SYS_EARLY_PCI_INIT )
@@ -935,14 +932,6 @@ void board_init_r(gd_t *id, ulong dest_addr)/* Initialize from environment */ load_addr =getenv_ulong ("loadaddr" ,16 , load_addr); -#if defined(CONFIG_CMD_NET ) - { -char *s =getenv ("bootfile" ); - -if (s !=NULL ) -copy_filename (BootFile, s,sizeof (BootFile)); - } -#endif WATCHDOG_RESET ();
arch/sandbox/lib/board.c +0 -3
@@ -226,9 +226,6 @@ void board_init_r(gd_t *id, ulong dest_addr)/* initialize environment */ env_relocate (); -/* IP Address */ - gd->bd->bi_ip_addr =getenv_IPaddr ("ipaddr" ); -stdio_init ();/* get the devices list going. */ jumptable_init ();
arch/sh/lib/board.c +2 -20
@@ -99,14 +99,6 @@ static int sh_mem_env_init(void)return 0 ; } -#if defined(CONFIG_CMD_NET ) -static int sh_net_init (void ) -{ - gd->bd->bi_ip_addr =getenv_IPaddr ("ipaddr" ); -return 0 ; -} -#endif -#if defined(CONFIG_CMD_MMC )static int sh_mmc_init (void ) {
@@ -144,9 +136,6 @@ init_fnc_t *init_sequence[] =#ifdef CONFIG_BOARD_LATE_INIT board_late_init,#endif -#if defined(CONFIG_CMD_NET ) - sh_net_init, /* SH specific eth init */ -#endif #if defined(CONFIG_CMD_MMC ) sh_mmc_init,#endif
@@ -200,15 +189,8 @@ void sh_generic_init(void)bb_miiphy_init ();#endif #if defined(CONFIG_CMD_NET ) - { -char *s; -puts ("Net: " ); -eth_initialize (gd->bd); - - s =getenv ("bootfile" ); -if (s !=NULL ) -copy_filename (BootFile, s,sizeof (BootFile)); - } +puts ("Net: " ); +eth_initialize (gd->bd);#endif /* CONFIG_CMD_NET */ while (1 ) {
arch/sparc/lib/board.c +0 -7
@@ -333,8 +333,6 @@ void board_init_f(ulong bootflag)mac_read_from_eeprom ();#endif -/* IP Address */ - bd->bi_ip_addr =getenv_IPaddr ("ipaddr" );#if defined(CONFIG_PCI )/* * Do pci configuration
@@ -359,11 +357,6 @@ void board_init_f(ulong bootflag)/* Initialize from environment */ load_addr =getenv_ulong ("loadaddr" ,16 , load_addr); -#if defined(CONFIG_CMD_NET ) -if ((s =getenv ("bootfile" )) !=NULL ) { -copy_filename (BootFile, s,sizeof (BootFile)); - } -#endif /* CONFIG_CMD_NET */ WATCHDOG_RESET ();
arch/x86/lib/board.c +0 -12
@@ -321,12 +321,6 @@ void board_init_r(gd_t *id, ulong dest_addr)env_relocate ();show_boot_progress (0x26 ); - -#ifdef CONFIG_CMD_NET -/* IP Address */ - bd_data.bi_ip_addr =getenv_IPaddr ("ipaddr" ); -#endif -#if defined(CONFIG_PCI )/* * Do pci configuration
@@ -373,12 +367,6 @@ void board_init_r(gd_t *id, ulong dest_addr)/* Initialize from environment */ load_addr =getenv_ulong ("loadaddr" ,16 , load_addr); -#if defined(CONFIG_CMD_NET ) - s =getenv ("bootfile" ); - -if (s !=NULL ) -copy_filename (BootFile, s,sizeof (BootFile)); -#endif WATCHDOG_RESET ();
net/eth.c +12 -0
@@ -224,6 +224,16 @@ int eth_register(struct eth_device *dev)return 0 ; } +static void eth_env_init (bd_t *bis) +{ +const char *s; + +if ((s =getenv ("bootfile" )) !=NULL ) +copy_filename (BootFile, s,sizeof (BootFile)); + + bis->bi_ip_addr =getenv_IPaddr ("ipaddr" ); +} +int eth_initialize (bd_t *bis) {int num_devices =0 ;
@@ -239,6 +249,8 @@ int eth_initialize(bd_t *bis)phy_init ();#endif +eth_env_init (bis); +/* * If board-specific initialization exists, call it. * If not, call a CPU-specific one
Signature · 1 line
1.7.8.3
PATCH 1/1 net: move bootfile/ipaddr init into eth_initialize
Hi Mike,
Quoted 4 lines · Mike Frysinger
All arches init these variables the same way, so move the logic into the core net code to avoid duplicating it everywhere else.
Signed-off-by Mike Frysinger<[email protected]>
Quoted 16 lines
--- arch/arm/lib/board.c | 11 ----------- arch/avr32/lib/board.c | 5 ----- arch/blackfin/lib/board.c | 9 +-------- arch/m68k/lib/board.c | 14 -------------- arch/microblaze/lib/board.c | 7 ------- arch/mips/lib/board.c | 11 ----------- arch/nds32/lib/board.c | 9 --------- arch/nios2/lib/board.c | 2 -- arch/powerpc/lib/board.c | 11 ----------- arch/sandbox/lib/board.c | 3 --- arch/sh/lib/board.c | 22 ++-------------------- arch/sparc/lib/board.c | 7 ------- arch/x86/lib/board.c | 12 ------------ net/eth.c | 12 ++++++++++++ 14 files changed, 15 insertions(+), 120 deletions(-)
Tested on nios2 boards.
Best regards,
Thomas
PATCH 1/1 net: move bootfile/ipaddr init into eth_initialize
In reply to Mike FrysingerDear Mike Frysinger,
Quoted 2 lines · In message <[email protected]> you wrote:
All arches init these variables the same way, so move the logic into the core net code to avoid duplicating it everywhere else.
This is the wrong approach.
There are many more ieces of code in arch/*/lib/board.c which are duplicated across some or all architectures. Instread of ripping these apart and fixing a bit here and a bit thre we should combine efforts and merge all arch/*/lib/board.c into a common file.
Additionally, your patch potentially breaks a number of boards.
arch/arm/lib/board.c void board_init_r(gd_t *id, ulong dest_addr) · line 540
Quoted 9 lines
index 3d78274..2c4276b 100644
arch/arm/lib/board.c +0
-2@@ -536,9 +536,6 @@ void board_init_r(gd_t *id, ulong dest_addr)arm_pci_init ();#endif -/* IP Address */ - gd->bd->bi_ip_addr =getenv_IPaddr ("ipaddr" );
The code which you remove here does NOT depend on CONFIG_CMD_NET; note that this is intentional.
When moving this into net/eth.c, it will be missing for all oards that do not have CONFIG_CMD_NET defined.
So NAK.
Best regards,
Wolfgang Denk
Signature · 5 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de An Ada exception is when a routine gets in trouble and says 'Beam me up, Scotty'.
PATCH 1/1 net: move bootfile/ipaddr init into eth_initialize
Quoted 10 lines · On Monday 16 January 2012 03:03:23 Wolfgang Denk wrote:
Quoted 2 lines · Mike Frysinger
All arches init these variables the same way, so move the logic into the core net code to avoid duplicating it everywhere else.
This is the wrong approach.
There are many more ieces of code in
arch/*/lib/board.cwhich are duplicated across some or all architectures. Instread of ripping these apart and fixing a bit here and a bit thre we should combine efforts and merge allarch/*/lib/board.cinto a common file.
or, if we add bit by bit, we have an easily testable solution rather than one giant leap
Quoted 6 lines
Quoted 6 lines
arch/arm/lib/board.c +0
-0@@ -536,9 +536,6 @@ void board_init_r(gd_t *id, ulong dest_addr)arm_pci_init ();
Quoted 7 lines
arch/arm/lib/board.c void board_init_r(gd_t *id, ulong dest_addr) · line 540
Quoted 4 lines
arch/arm/lib/board.c +0
-2#endif -/* IP Address */ - gd->bd->bi_ip_addr =getenv_IPaddr ("ipaddr" );The code which you remove here does NOT depend on
CONFIG_CMD_NET; note that this is intentional.
i noticed that, however, i'm not sure it matters. i can't find any place in u- boot that actually reads this variable.
arch/*/include/asm/u-boot.h: bi_ip_addr is declared as part of bd_t arch/*/lib/board.c: bi_ip_addr gets initialized based on env common/cmd_bdinfo.c: the value of bi_ip_addr gets displayed common/cmd_nvedit.c: bi_ip_addr gets written when user does "setenv ipaddr" board/esd/cpci405/cpci405.c: bi_ip_addr is written via the env net/net.c: bi_ip_addr gets written as part of global env sync
is there any reason i shouldn't just rip out all bi_ip_addr handling ? -mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20120116/4969ee87/attachment.pgp>
PATCH 1/1 net: move bootfile/ipaddr init into eth_initialize
Dear Mike Frysinger,
Quoted 6 lines · In message <[email protected]> you wrote:
Quoted 3 lines
The code which you remove here does NOT depend on
CONFIG_CMD_NET; note that this is intentional.i noticed that, however, i'm not sure it matters. i can't find any place in u- boot that actually reads this variable.
For example, the "bdinfo" command prints it; see common/cmd_bdinfo.c
Best regards,
Wolfgang Denk
Signature · 5 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de I can't understand it. I can't even understand the people who can understand it. - Queen Juliana of the Netherlands.
PATCH 1/1 net: move bootfile/ipaddr init into eth_initialize
Quoted 8 lines · On Monday 16 January 2012 06:18:26 Wolfgang Denk wrote:
Quoted 5 lines · Mike Frysinger
Quoted 2 lines
The code which you remove here does NOT depend on
CONFIG_CMD_NET; note that this is intentional.i noticed that, however, i'm not sure it matters. i can't find any place in u- boot that actually reads this variable.
For example, the "bdinfo" command prints it; see
common/cmd_bdinfo.c
which i documented as the *only* place where the member gets read:
common/cmd_bdinfo.c: the value of bi_ip_addr gets displayed
and that would be absolutely trivial to replace with getenv("ipaddr")
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20120116/dd8d8390/attachment.pgp>
PATCH 1/2 net: punt bd->bi_ip_addr
In reply to Mike FrysingerThis field gets read in one place (by "bdinfo"), and we can replace that with getenv("ipaddr"). After all, the bi_ip_addr field is kept up-to-date implicitly with the value of the ipaddr env var.
--- arch/arm/include/asm/u-boot.h | 1 - arch/arm/lib/board.c | 3 --- arch/avr32/include/asm/u-boot.h | 1 - arch/avr32/lib/board.c | 2 -- arch/blackfin/include/asm/u-boot.h | 1 - arch/blackfin/lib/board.c | 3 --- arch/m68k/include/asm/u-boot.h | 1 - arch/m68k/lib/board.c | 9 --------- arch/microblaze/include/asm/u-boot.h | 1 - arch/microblaze/lib/board.c | 3 --- arch/mips/include/asm/u-boot.h | 1 - arch/mips/lib/board.c | 3 --- arch/nds32/include/asm/u-boot.h | 1 - arch/nds32/lib/board.c | 3 --- arch/nios2/include/asm/u-boot.h | 1 - arch/nios2/lib/board.c | 2 -- arch/openrisc/include/asm/u-boot.h | 1 - arch/powerpc/include/asm/u-boot.h | 1 - arch/powerpc/lib/board.c | 3 --- arch/sandbox/include/asm/u-boot.h | 1 - arch/sandbox/lib/board.c | 3 --- arch/sh/include/asm/u-boot.h | 1 - arch/sh/lib/board.c | 11 ----------- arch/sparc/include/asm/u-boot.h | 1 - arch/sparc/lib/board.c | 2 -- arch/x86/include/asm/u-boot.h | 1 - arch/x86/lib/board.c | 6 ------ board/esd/cpci405/cpci405.c | 9 ++++----- common/cmd_bdinfo.c | 28 ++++++++++++++-------------- common/cmd_nvedit.c | 16 +--------------- net/net.c | 2 -- 31 files changed, 19 insertions(+), 103 deletions(-)
arch/arm/include/asm/u-boot.h +0 -1
@@ -38,7 +38,6 @@ typedef struct bd_info { int bi_baudrate; /* serial console baudrate */ - unsigned long bi_ip_addr; /* IP Address */ ulong bi_arch_number; /* unique id for this board */ ulong bi_boot_params; /* where this board expects params */ struct /* RAM configuration */
arch/arm/lib/board.c +0 -3
@@ -536,9 +536,6 @@ void board_init_r(gd_t *id, ulong dest_addr)arm_pci_init ();#endif -/* IP Address */ - gd->bd->bi_ip_addr =getenv_IPaddr ("ipaddr" ); -stdio_init ();/* get the devices list going. */ jumptable_init ();
arch/avr32/include/asm/u-boot.h +0 -1
@@ -24,7 +24,6 @@ typedef struct bd_info { unsigned long bi_baudrate; - unsigned long bi_ip_addr; unsigned char bi_phy_id[4]; unsigned long bi_board_number; void *bi_boot_params;
arch/avr32/lib/board.c +0 -2
@@ -304,8 +304,6 @@ void board_init_r(gd_t *new_gd, ulong dest_addr)/* initialize environment */ env_relocate (); - bd->bi_ip_addr =getenv_IPaddr ("ipaddr" ); -stdio_init ();jumptable_init ();console_init_r ();
arch/blackfin/include/asm/u-boot.h +0 -1
@@ -30,7 +30,6 @@ typedef struct bd_info { int bi_baudrate; /* serial console baudrate */ - unsigned long bi_ip_addr; /* IP Address */ unsigned long bi_boot_params; /* where this board expects params */ unsigned long bi_memstart; /* start of DRAM memory */ phys_size_t bi_memsize; /* size of DRAM memory in bytes */
arch/blackfin/lib/board.c +0 -3
@@ -86,7 +86,6 @@ static void display_global_data(void)printf (" |-jt(%p): %p\n" , gd->jt, *(gd->jt));printf (" \\-bd: %p\n" , gd->bd);printf (" |-bi_baudrate: %x\n" , bd->bi_baudrate); -printf (" |-bi_ip_addr: %lx\n" , bd->bi_ip_addr);printf (" |-bi_boot_params: %lx\n" , bd->bi_boot_params);printf (" |-bi_memstart: %lx\n" , bd->bi_memstart);printf (" |-bi_memsize: %lx\n" , bd->bi_memsize);
@@ -299,8 +298,6 @@ static void board_net_init_r(bd_t *bd)if ((s =getenv ("bootfile" )) !=NULL )copy_filename (BootFile, s,sizeof (BootFile)); - bd->bi_ip_addr =getenv_IPaddr ("ipaddr" ); -printf ("Net: " );eth_initialize (gd->bd);#endif
arch/m68k/include/asm/u-boot.h +0 -1
@@ -47,7 +47,6 @@ typedef struct bd_info {unsigned long bi_mbar_base;/* base of internal registers */ unsigned long bi_bootflags;/* boot / reboot flag (for LynxOS) */ unsigned long bi_boot_params;/* where this board expects params */ -unsigned long bi_ip_addr;/* IP Address */ unsigned short bi_ethspeed;/* Ethernet speed in Mbps */ unsigned long bi_intfreq;/* Internal Freq, in MHz */ unsigned long bi_busfreq;/* Bus Freq, in MHz */
arch/m68k/lib/board.c +0 -9
@@ -507,15 +507,6 @@ void board_init_r (gd_t *id, ulong dest_addr)/* relocate environment function pointers etc. */ env_relocate (); -/* -* Fill in missing fields of bd_info. -* We do this here, where we have "normal" access to the -* environment; we used to do this still running from ROM, -* where had to use getenv_f(), which can be pretty slow when -* the environment is in EEPROM. -*/ - bd->bi_ip_addr =getenv_IPaddr ("ipaddr" ); -WATCHDOG_RESET ();#if defined(CONFIG_PCI )
arch/microblaze/include/asm/u-boot.h +0 -1
@@ -40,7 +40,6 @@ typedef struct bd_info {unsigned long bi_flashoffset;/* reserved area for startup monitor */ unsigned long bi_sramstart;/* start of SRAM memory */ unsigned long bi_sramsize;/* size of SRAM memory */ -unsigned long bi_ip_addr;/* IP Address */ unsigned long bi_baudrate;/* Console Baudrate */ } bd_t;
arch/microblaze/lib/board.c +0 -3
@@ -176,9 +176,6 @@ void board_init (void) load_addr =getenv_ulong ("loadaddr" ,16 , load_addr);#if defined(CONFIG_CMD_NET ) -/* IP Address */ - bd->bi_ip_addr =getenv_IPaddr ("ipaddr" ); -printf ("Net: " );eth_initialize (gd->bd);
arch/mips/include/asm/u-boot.h +0 -1
@@ -33,7 +33,6 @@ typedef struct bd_info { int bi_baudrate; /* serial console baudrate */ - unsigned long bi_ip_addr; /* IP Address */ unsigned long bi_arch_number; /* unique id for this board */ unsigned long bi_boot_params; /* where this board expects params */ unsigned long bi_memstart; /* start of DRAM memory */
arch/mips/lib/board.c +0 -3
@@ -316,9 +316,6 @@ void board_init_r(gd_t *id, ulong dest_addr)/* relocate environment function pointers etc. */ env_relocate (); -/* IP Address */ - bd->bi_ip_addr =getenv_IPaddr ("ipaddr" ); -#if defined(CONFIG_PCI )/* * Do pci configuration
arch/nds32/include/asm/u-boot.h +0 -1
@@ -40,7 +40,6 @@ typedef struct bd_info { int bi_baudrate; /* serial console baudrate */ - unsigned long bi_ip_addr; /* IP Address */ unsigned char bi_enetaddr[6]; /* Ethernet adress */ unsigned long bi_arch_number; /* unique id for this board */ unsigned long bi_boot_params; /* where this board expects params */
arch/nds32/lib/board.c +0 -3
@@ -368,9 +368,6 @@ void board_init_r(gd_t *id, ulong dest_addr)nds32_pci_init ();#endif -/* IP Address */ - gd->bd->bi_ip_addr =getenv_IPaddr ("ipaddr" ); -stdio_init ();/* get the devices list going. */ jumptable_init ();
arch/nios2/include/asm/u-boot.h +0 -1
@@ -39,7 +39,6 @@ typedef struct bd_info {unsigned long bi_flashoffset;/* reserved area for startup monitor */ unsigned long bi_sramstart;/* start of SRAM memory */ unsigned long bi_sramsize;/* size of SRAM memory */ -unsigned long bi_ip_addr;/* IP Address */ unsigned long bi_baudrate;/* Console Baudrate */ } bd_t;
arch/nios2/lib/board.c +0 -2
@@ -143,8 +143,6 @@ void board_init (void)WATCHDOG_RESET ();env_relocate (); - bd->bi_ip_addr =getenv_IPaddr ("ipaddr" ); -WATCHDOG_RESET ();stdio_init ();jumptable_init ();
arch/openrisc/include/asm/u-boot.h +0 -1
@@ -33,7 +33,6 @@ typedef struct bd_info { unsigned long bi_baudrate; /* serial console baudrate */ - unsigned long bi_ip_addr; /* IP Address */ unsigned long bi_arch_number; /* unique id for this board */ unsigned long bi_boot_params; /* where this board expects params */ unsigned long bi_memstart; /* start of DRAM memory */
arch/powerpc/include/asm/u-boot.h +0 -1
@@ -63,7 +63,6 @@ typedef struct bd_info {unsigned long bi_vcofreq;/* VCO Freq, in MHz */ #endif unsigned long bi_bootflags;/* boot / reboot flag (Unused) */ -unsigned long bi_ip_addr;/* IP Address */ unsigned char bi_enetaddr[6 ];/* OLD: see README.enetaddr */ unsigned short bi_ethspeed;/* Ethernet speed in Mbps */ unsigned long bi_intfreq;/* Internal Freq, in MHz */
arch/powerpc/lib/board.c +0 -3
@@ -877,9 +877,6 @@ void board_init_r(gd_t *id, ulong dest_addr)#endif #endif /* CONFIG_CMD_NET */ -/* IP Address */ - bd->bi_ip_addr =getenv_IPaddr ("ipaddr" ); -WATCHDOG_RESET ();#if defined(CONFIG_PCI ) && !defined(CONFIG_SYS_EARLY_PCI_INIT )
arch/sandbox/include/asm/u-boot.h +0 -1
@@ -45,7 +45,6 @@ typedef struct bd_info {unsigned long bi_sramstart;/* start of SRAM memory */ unsigned long bi_sramsize;/* size of SRAM memory */ unsigned long bi_bootflags;/* boot / reboot flag (for LynxOS) */ -unsigned long bi_ip_addr;/* IP Address */ unsigned short bi_ethspeed;/* Ethernet speed in Mbps */ unsigned long bi_intfreq;/* Internal Freq, in MHz */ unsigned long bi_busfreq;/* Bus Freq, in MHz */
arch/sandbox/lib/board.c +0 -3
@@ -226,9 +226,6 @@ void board_init_r(gd_t *id, ulong dest_addr)/* initialize environment */ env_relocate (); -/* IP Address */ - gd->bd->bi_ip_addr =getenv_IPaddr ("ipaddr" ); -stdio_init ();/* get the devices list going. */ jumptable_init ();
arch/sh/include/asm/u-boot.h +0 -1
@@ -33,7 +33,6 @@ typedef struct bd_info {unsigned long bi_flashoffset;/* reserved area for startup monitor */ unsigned long bi_sramstart;/* start of SRAM memory */ unsigned long bi_sramsize;/* size of SRAM memory */ -unsigned long bi_ip_addr;/* IP Address */ unsigned long bi_baudrate;/* Console Baudrate */ unsigned long bi_boot_params;/* where this board expects params */ } bd_t;
arch/sh/lib/board.c +0 -11
@@ -99,14 +99,6 @@ static int sh_mem_env_init(void)return 0 ; } -#if defined(CONFIG_CMD_NET ) -static int sh_net_init (void ) -{ - gd->bd->bi_ip_addr =getenv_IPaddr ("ipaddr" ); -return 0 ; -} -#endif -#if defined(CONFIG_CMD_MMC )static int sh_mmc_init (void ) {
@@ -144,9 +136,6 @@ init_fnc_t *init_sequence[] =#ifdef CONFIG_BOARD_LATE_INIT board_late_init,#endif -#if defined(CONFIG_CMD_NET ) - sh_net_init, /* SH specific eth init */ -#endif #if defined(CONFIG_CMD_MMC ) sh_mmc_init,#endif
arch/sparc/include/asm/u-boot.h +0 -1
@@ -51,7 +51,6 @@ typedef struct bd_info {unsigned long bi_sramstart;/* start of SRAM memory */ unsigned long bi_sramsize;/* size of SRAM memory */ unsigned long bi_bootflags;/* boot / reboot flag (for LynxOS) */ -unsigned long bi_ip_addr;/* IP Address */ unsigned short bi_ethspeed;/* Ethernet speed in Mbps */ unsigned long bi_intfreq;/* Internal Freq, in MHz */ unsigned long bi_busfreq;/* Bus Freq, in MHz */
arch/sparc/lib/board.c +0 -2
@@ -333,8 +333,6 @@ void board_init_f(ulong bootflag)mac_read_from_eeprom ();#endif -/* IP Address */ - bd->bi_ip_addr =getenv_IPaddr ("ipaddr" );#if defined(CONFIG_PCI )/* * Do pci configuration
arch/x86/include/asm/u-boot.h +0 -1
@@ -45,7 +45,6 @@ typedef struct bd_info {unsigned long bi_sramstart;/* start of SRAM memory */ unsigned long bi_sramsize;/* size of SRAM memory */ unsigned long bi_bootflags;/* boot / reboot flag (for LynxOS) */ -unsigned long bi_ip_addr;/* IP Address */ unsigned short bi_ethspeed;/* Ethernet speed in Mbps */ unsigned long bi_intfreq;/* Internal Freq, in MHz */ unsigned long bi_busfreq;/* Bus Freq, in MHz */
arch/x86/lib/board.c +0 -6
@@ -321,12 +321,6 @@ void board_init_r(gd_t *id, ulong dest_addr)env_relocate ();show_boot_progress (0x26 ); - -#ifdef CONFIG_CMD_NET -/* IP Address */ - bd_data.bi_ip_addr =getenv_IPaddr ("ipaddr" ); -#endif -#if defined(CONFIG_PCI )/* * Do pci configuration
board/esd/cpci405/cpci405.c +4 -5
@@ -730,12 +730,11 @@ int do_get_bpip(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])/* * Update whole ip-addr */ - bd->bi_ip_addr = ipaddr;sprintf (str,"%ld.%ld.%ld.%ld" , - (bd->bi_ip_addr &0xff000000 ) >>24 , - (bd->bi_ip_addr &0x00ff0000 ) >>16 , - (bd->bi_ip_addr &0x0000ff00 ) >>8 , - (bd->bi_ip_addr &0x000000ff )); + (ipaddr &0xff000000 ) >>24 , + (ipaddr &0x00ff0000 ) >>16 , + (ipaddr &0x0000ff00 ) >>8 , + (ipaddr &0x000000ff ));setenv ("ipaddr" , str);printf ("Updated ip_addr from bp_eeprom to %s!\n" , str); }
common/cmd_bdinfo.c +14 -14
@@ -139,7 +139,7 @@ int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])#ifdef CONFIG_HERMES print_mhz ("ethspeed" , bd->bi_ethspeed);#endif -printf ("IP addr = %pI4\n" , &bd->bi_ip_addr); +printf ("IP addr = %s\n" ,getenv ("ipaddr" ));printf ("baudrate = %6ld bps\n" , bd->bi_baudrate);print_num ("relocaddr" , gd->relocaddr);return 0 ;
@@ -164,7 +164,7 @@ int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])#if defined(CONFIG_CMD_NET )print_eth (0 ); -printf ("ip_addr = %pI4\n" , &bd->bi_ip_addr); +printf ("ip_addr = %s\n" ,getenv ("ipaddr" ));#endif printf ("baudrate = %ld bps\n" , bd->bi_baudrate);
@@ -188,7 +188,7 @@ int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])#endif #if defined(CONFIG_CMD_NET )print_eth (0 ); -printf ("ip_addr = %pI4\n" , &bd->bi_ip_addr); +printf ("ip_addr = %s\n" ,getenv ("ipaddr" ));#endif printf ("baudrate = %ld bps\n" , (ulong )bd->bi_baudrate);return 0 ;
@@ -221,7 +221,7 @@ int do_bdinfo(cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])#if defined(CONFIG_CMD_NET )print_eth (0 ); -printf ("ip_addr = %pI4\n" , &bd->bi_ip_addr); +printf ("ip_addr = %s\n" ,getenv ("ipaddr" ));#endif printf ("baudrate = %6ld bps\n" , bd->bi_baudrate);return 0 ;
@@ -267,7 +267,7 @@ int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])print_eth (3 );#endif -printf ("ip_addr = %pI4\n" , &bd->bi_ip_addr); +printf ("ip_addr = %s\n" ,getenv ("ipaddr" ));#endif printf ("baudrate = %ld bps\n" , bd->bi_baudrate);
@@ -295,7 +295,7 @@ int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])print_num ("flashoffset" , (ulong )bd->bi_flashoffset);print_eth (0 ); -printf ("ip_addr = %pI4\n" , &bd->bi_ip_addr); +printf ("ip_addr = %s\n" ,getenv ("ipaddr" ));printf ("baudrate = %d bps\n" , bd->bi_baudrate);return 0 ;
@@ -315,7 +315,7 @@ int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])print_num ("flashoffset" , (ulong )bd->bi_flashoffset);print_eth (0 ); -printf ("ip_addr = %pI4\n" , &bd->bi_ip_addr); +printf ("ip_addr = %s\n" ,getenv ("ipaddr" ));printf ("baudrate = %d bps\n" , bd->bi_baudrate);return 0 ;
@@ -335,7 +335,7 @@ int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])print_num ("flashoffset" , (ulong )bd->bi_flashoffset);print_eth (0 ); -printf ("ip_addr = %pI4\n" , &bd->bi_ip_addr); +printf ("ip_addr = %s\n" ,getenv ("ipaddr" ));printf ("baudrate = %lu bps\n" , bd->bi_baudrate);return 0 ;
@@ -359,7 +359,7 @@ int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])#if defined(CONFIG_CMD_NET )print_eth (0 ); -printf ("ip_addr = %pI4\n" , &bd->bi_ip_addr); +printf ("ip_addr = %s\n" ,getenv ("ipaddr" ));#endif printf ("baudrate = %d bps\n" , bd->bi_baudrate);#if !(defined(CONFIG_SYS_ICACHE_OFF ) && defined(CONFIG_SYS_DCACHE_OFF ))
@@ -386,7 +386,7 @@ int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])#if defined(CONFIG_CMD_NET )print_eth (0 ); -printf ("ip_addr = %pI4\n" , &bd->bi_ip_addr); +printf ("ip_addr = %s\n" ,getenv ("ipaddr" ));#endif printf ("baudrate = %ld bps\n" , (ulong )bd->bi_baudrate);return 0 ;
@@ -419,7 +419,7 @@ int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])#if defined(CONFIG_CMD_NET )print_eth (0 ); -printf ("ip_addr = %pI4\n" , &bd->bi_ip_addr); +printf ("ip_addr = %s\n" ,getenv ("ipaddr" ));print_mhz ("ethspeed" , bd->bi_ethspeed);#endif printf ("baudrate = %d bps\n" , bd->bi_baudrate);
@@ -444,7 +444,7 @@ int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])#if defined(CONFIG_CMD_NET )print_eth (0 ); -printf ("ip_addr = %pI4\n" , &bd->bi_ip_addr); +printf ("ip_addr = %s\n" ,getenv ("ipaddr" ));#endif print_num ("FB base " , gd->fb_base);return 0 ;
@@ -468,7 +468,7 @@ int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])#if defined(CONFIG_CMD_NET )print_eth (0 ); -printf ("ip_addr = %pI4\n" , &bd->bi_ip_addr); +printf ("ip_addr = %s\n" ,getenv ("ipaddr" ));#endif printf ("baudrate = %d bps\n" , bd->bi_baudrate);
@@ -489,7 +489,7 @@ int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])#if defined(CONFIG_CMD_NET )print_eth (0 ); -printf ("ip_addr = %pI4\n" , &bd->bi_ip_addr); +printf ("ip_addr = %s\n" ,getenv ("ipaddr" ));#endif printf ("baudrate = %ld bps\n" , bd->bi_baudrate);
common/cmd_nvedit.c +1 -15
@@ -341,21 +341,7 @@ int _do_env_set(int flag, int argc, char * const argv[])* Some variables should be updated when the corresponding * entry in the environment is changed */ -if (strcmp (name,"ipaddr" ) ==0 ) { -char *s = argv[2 ];/* always use only one arg */ -char *e; -unsigned long addr; - bd->bi_ip_addr =0 ; -for (addr =0 , i =0 ; i <4 ; ++i) { -ulong val = s ?simple_strtoul (s, &e,10 ) :0 ; - addr <<=8 ; - addr |= val &0xFF ; -if (s) - s = *e ? e +1 : e; - } - bd->bi_ip_addr =htonl (addr); -return 0 ; - }else if (strcmp (argv[1 ],"loadaddr" ) ==0 ) { +if (strcmp (argv[1 ],"loadaddr" ) ==0 ) { load_addr =simple_strtoul (argv[2 ],NULL ,16 );return 0 ; }
net/net.c +0 -2
@@ -342,13 +342,11 @@ void net_auto_load(void)static void NetInitLoop (enum proto_t protocol) {static int env_changed_id; -bd_t *bd = gd->bd;int env_id =get_env_id ();/* update only when the environment has changed */ if (env_changed_id != env_id) { NetOurIP =getenv_IPaddr ("ipaddr" ); -NetCopyIP (&bd->bi_ip_addr, &NetOurIP); NetOurGatewayIP =getenv_IPaddr ("gatewayip" ); NetOurSubnetMask =getenv_IPaddr ("netmask" ); NetServerIP =getenv_IPaddr ("serverip" );
Signature · 1 line
1.7.8.3
PATCH 2/2 net: move bootfile init into eth_initialize
All arches init this the same way, so move the logic into the core net code to avoid duplicating it everywhere else.
--- arch/arm/lib/board.c | 8 -------- arch/avr32/lib/board.c | 3 --- arch/blackfin/lib/board.c | 7 +------ arch/m68k/lib/board.c | 5 ----- arch/microblaze/lib/board.c | 4 ---- arch/mips/lib/board.c | 8 -------- arch/nds32/lib/board.c | 6 ------ arch/powerpc/lib/board.c | 8 -------- arch/sh/lib/board.c | 11 ++--------- arch/sparc/lib/board.c | 5 ----- arch/x86/lib/board.c | 6 ------ net/eth.c | 10 ++++++++++ 12 files changed, 13 insertions(+), 68 deletions(-)
arch/arm/lib/board.c +0 -8
@@ -573,14 +573,6 @@ void board_init_r(gd_t *id, ulong dest_addr)/* Initialize from environment */ load_addr =getenv_ulong ("loadaddr" ,16 , load_addr); -#if defined(CONFIG_CMD_NET ) - { -char *s =getenv ("bootfile" ); - -if (s !=NULL ) -copy_filename (BootFile, s,sizeof (BootFile)); - } -#endif #ifdef CONFIG_BOARD_LATE_INIT board_late_init ();
arch/avr32/lib/board.c +0 -3
@@ -315,9 +315,6 @@ void board_init_r(gd_t *new_gd, ulong dest_addr)bb_miiphy_init ();#endif #if defined(CONFIG_CMD_NET ) - s =getenv ("bootfile" ); -if (s) -copy_filename (BootFile, s,sizeof (BootFile));puts ("Net: " );eth_initialize (gd->bd);#endif
arch/blackfin/lib/board.c +1 -6
@@ -293,13 +293,8 @@ static void board_net_init_r(bd_t *bd)bb_miiphy_init ();#endif #ifdef CONFIG_CMD_NET -char *s; - -if ((s =getenv ("bootfile" )) !=NULL ) -copy_filename (BootFile, s,sizeof (BootFile)); -printf ("Net: " ); -eth_initialize (gd->bd); +eth_initialize (bd);#endif }
arch/m68k/lib/board.c +0 -5
@@ -559,11 +559,6 @@ void board_init_r (gd_t *id, ulong dest_addr)/* Initialize from environment */ load_addr =getenv_ulong ("loadaddr" ,16 , load_addr); -#if defined(CONFIG_CMD_NET ) -if ((s =getenv ("bootfile" )) !=NULL ) { -copy_filename (BootFile, s,sizeof (BootFile)); - } -#endif WATCHDOG_RESET ();
arch/microblaze/lib/board.c +0 -4
@@ -182,10 +182,6 @@ void board_init (void)uchar enetaddr[6 ];eth_getenv_enetaddr ("ethaddr" , enetaddr);printf ("MAC: %pM\n" , enetaddr); - - s =getenv ("bootfile" ); -if (s !=NULL ) -copy_filename (BootFile, s,sizeof (BootFile));#endif /* main_loop */
arch/mips/lib/board.c +0 -8
@@ -335,14 +335,6 @@ void board_init_r(gd_t *id, ulong dest_addr)/* Initialize from environment */ load_addr =getenv_ulong ("loadaddr" ,16 , load_addr); -#if defined(CONFIG_CMD_NET ) - { -char *s =getenv ("bootfile" ); - -if (s !=NULL ) -copy_filename (BootFile, s,sizeof (BootFile)); - } -#endif #ifdef CONFIG_CMD_SPI puts ("SPI: " );
arch/nds32/lib/board.c +0 -6
@@ -398,12 +398,6 @@ void board_init_r(gd_t *id, ulong dest_addr)/* Initialize from environment */ load_addr =getenv_ulong ("loadaddr" ,16 , load_addr); -#if defined(CONFIG_CMD_NET ) - s =getenv ("bootfile" ); -if (s !=NULL ) -copy_filename (BootFile, s,sizeof (BootFile)); -#endif -#ifdef BOARD_LATE_INIT board_late_init ();#endif
arch/powerpc/lib/board.c +0 -8
@@ -932,14 +932,6 @@ void board_init_r(gd_t *id, ulong dest_addr)/* Initialize from environment */ load_addr =getenv_ulong ("loadaddr" ,16 , load_addr); -#if defined(CONFIG_CMD_NET ) - { -char *s =getenv ("bootfile" ); - -if (s !=NULL ) -copy_filename (BootFile, s,sizeof (BootFile)); - } -#endif WATCHDOG_RESET ();
arch/sh/lib/board.c +2 -9
@@ -189,15 +189,8 @@ void sh_generic_init(void)bb_miiphy_init ();#endif #if defined(CONFIG_CMD_NET ) - { -char *s; -puts ("Net: " ); -eth_initialize (gd->bd); - - s =getenv ("bootfile" ); -if (s !=NULL ) -copy_filename (BootFile, s,sizeof (BootFile)); - } +puts ("Net: " ); +eth_initialize (gd->bd);#endif /* CONFIG_CMD_NET */ while (1 ) {
arch/sparc/lib/board.c +0 -5
@@ -357,11 +357,6 @@ void board_init_f(ulong bootflag)/* Initialize from environment */ load_addr =getenv_ulong ("loadaddr" ,16 , load_addr); -#if defined(CONFIG_CMD_NET ) -if ((s =getenv ("bootfile" )) !=NULL ) { -copy_filename (BootFile, s,sizeof (BootFile)); - } -#endif /* CONFIG_CMD_NET */ WATCHDOG_RESET ();
arch/x86/lib/board.c +0 -6
@@ -367,12 +367,6 @@ void board_init_r(gd_t *id, ulong dest_addr)/* Initialize from environment */ load_addr =getenv_ulong ("loadaddr" ,16 , load_addr); -#if defined(CONFIG_CMD_NET ) - s =getenv ("bootfile" ); - -if (s !=NULL ) -copy_filename (BootFile, s,sizeof (BootFile)); -#endif WATCHDOG_RESET ();
net/eth.c +10 -0
@@ -224,6 +224,14 @@ int eth_register(struct eth_device *dev)return 0 ; } +static void eth_env_init (bd_t *bis) +{ +const char *s; + +if ((s =getenv ("bootfile" )) !=NULL ) +copy_filename (BootFile, s,sizeof (BootFile)); +} +int eth_initialize (bd_t *bis) {int num_devices =0 ;
@@ -239,6 +247,8 @@ int eth_initialize(bd_t *bis)phy_init ();#endif +eth_env_init (bis); +/* * If board-specific initialization exists, call it. * If not, call a CPU-specific one
Signature · 1 line
1.7.8.3
PATCH 2/2 net: move bootfile init into eth_initialize
Hi Mike,
Quoted 4 lines · Mike Frysinger
All arches init this the same way, so move the logic into the core net code to avoid duplicating it everywhere else.
Signed-off-by Mike Frysinger <[email protected]>
Please rebase.
Thanks,
-Joe
PATCH 1/2 net: punt bd->bi_ip_addr
In reply to Mike FrysingerHi Mike,
Quoted 5 lines · Mike Frysinger
This field gets read in one place (by "bdinfo"), and we can replace that with
getenv("ipaddr"). ?After all, thebi_ip_addrfield is kept up-to-date implicitly with the value of the ipaddr env var.Signed-off-by Mike Frysinger <[email protected]>
Please rebase.
Thanks,
-Joe
PATCH v2 1/2 net: punt bd->bi_ip_addr
In reply to Mike FrysingerThis field gets read in one place (by "bdinfo"), and we can replace that with getenv("ipaddr"). After all, the bi_ip_addr field is kept up-to-date implicitly with the value of the ipaddr env var.
---
v2
- rebased onto mainline
arch/arm/include/asm/u-boot.h | 1 - arch/arm/lib/board.c | 3 --- arch/avr32/include/asm/u-boot.h | 1 - arch/avr32/lib/board.c | 2 -- arch/blackfin/include/asm/u-boot.h | 1 - arch/blackfin/lib/board.c | 3 --- arch/m68k/include/asm/u-boot.h | 1 - arch/m68k/lib/board.c | 9 --------- arch/microblaze/include/asm/u-boot.h | 1 - arch/microblaze/lib/board.c | 3 --- arch/mips/include/asm/u-boot.h | 1 - arch/mips/lib/board.c | 3 --- arch/nds32/include/asm/u-boot.h | 1 - arch/nds32/lib/board.c | 3 --- arch/nios2/include/asm/u-boot.h | 1 - arch/nios2/lib/board.c | 2 -- arch/openrisc/include/asm/u-boot.h | 1 - arch/powerpc/include/asm/u-boot.h | 1 - arch/powerpc/lib/board.c | 3 --- arch/sandbox/include/asm/u-boot.h | 1 - arch/sandbox/lib/board.c | 3 --- arch/sh/include/asm/u-boot.h | 1 - arch/sh/lib/board.c | 11 ----------- arch/sparc/include/asm/u-boot.h | 1 - arch/sparc/lib/board.c | 2 -- arch/x86/include/asm/init_helpers.h | 1 - arch/x86/include/asm/u-boot.h | 1 - arch/x86/lib/board.c | 3 --- arch/x86/lib/init_helpers.c | 8 -------- board/esd/cpci405/cpci405.c | 9 ++++----- common/cmd_bdinfo.c | 28 ++++++++++++++-------------- common/cmd_nvedit.c | 16 +--------------- net/net.c | 2 -- 33 files changed, 19 insertions(+), 109 deletions(-)
arch/arm/include/asm/u-boot.h +0 -1
@@ -38,7 +38,6 @@ typedef struct bd_info { int bi_baudrate; /* serial console baudrate */ - unsigned long bi_ip_addr; /* IP Address */ ulong bi_arch_number; /* unique id for this board */ ulong bi_boot_params; /* where this board expects params */ unsigned long bi_arm_freq; /* arm frequency */
arch/arm/lib/board.c +0 -3
@@ -555,9 +555,6 @@ void board_init_r(gd_t *id, ulong dest_addr)arm_pci_init ();#endif -/* IP Address */ - gd->bd->bi_ip_addr =getenv_IPaddr ("ipaddr" ); -stdio_init ();/* get the devices list going. */ jumptable_init ();
arch/avr32/include/asm/u-boot.h +0 -1
@@ -24,7 +24,6 @@ typedef struct bd_info { unsigned long bi_baudrate; - unsigned long bi_ip_addr; unsigned char bi_phy_id[4]; unsigned long bi_board_number; void *bi_boot_params;
arch/avr32/lib/board.c +0 -2
@@ -316,8 +316,6 @@ void board_init_r(gd_t *new_gd, ulong dest_addr)/* initialize environment */ env_relocate (); - bd->bi_ip_addr =getenv_IPaddr ("ipaddr" ); -stdio_init ();jumptable_init ();console_init_r ();
arch/blackfin/include/asm/u-boot.h +0 -1
@@ -30,7 +30,6 @@ typedef struct bd_info { int bi_baudrate; /* serial console baudrate */ - unsigned long bi_ip_addr; /* IP Address */ unsigned long bi_boot_params; /* where this board expects params */ unsigned long bi_memstart; /* start of DRAM memory */ phys_size_t bi_memsize; /* size of DRAM memory in bytes */
arch/blackfin/lib/board.c +0 -3
@@ -86,7 +86,6 @@ static void display_global_data(void)printf (" |-jt(%p): %p\n" , gd->jt, *(gd->jt));printf (" \\-bd: %p\n" , gd->bd);printf (" |-bi_baudrate: %x\n" , bd->bi_baudrate); -printf (" |-bi_ip_addr: %lx\n" , bd->bi_ip_addr);printf (" |-bi_boot_params: %lx\n" , bd->bi_boot_params);printf (" |-bi_memstart: %lx\n" , bd->bi_memstart);printf (" |-bi_memsize: %lx\n" , bd->bi_memsize);
@@ -299,8 +298,6 @@ static void board_net_init_r(bd_t *bd)if ((s =getenv ("bootfile" )) !=NULL )copy_filename (BootFile, s,sizeof (BootFile)); - bd->bi_ip_addr =getenv_IPaddr ("ipaddr" ); -printf ("Net: " );eth_initialize (gd->bd);#endif
arch/m68k/include/asm/u-boot.h +0 -1
@@ -47,7 +47,6 @@ typedef struct bd_info {unsigned long bi_mbar_base;/* base of internal registers */ unsigned long bi_bootflags;/* boot / reboot flag (for LynxOS) */ unsigned long bi_boot_params;/* where this board expects params */ -unsigned long bi_ip_addr;/* IP Address */ unsigned short bi_ethspeed;/* Ethernet speed in Mbps */ unsigned long bi_intfreq;/* Internal Freq, in MHz */ unsigned long bi_busfreq;/* Bus Freq, in MHz */
arch/m68k/lib/board.c +0 -9
@@ -507,15 +507,6 @@ void board_init_r (gd_t *id, ulong dest_addr)/* relocate environment function pointers etc. */ env_relocate (); -/* -* Fill in missing fields of bd_info. -* We do this here, where we have "normal" access to the -* environment; we used to do this still running from ROM, -* where had to use getenv_f(), which can be pretty slow when -* the environment is in EEPROM. -*/ - bd->bi_ip_addr =getenv_IPaddr ("ipaddr" ); -WATCHDOG_RESET ();#if defined(CONFIG_PCI )
arch/microblaze/include/asm/u-boot.h +0 -1
@@ -40,7 +40,6 @@ typedef struct bd_info {unsigned long bi_flashoffset;/* reserved area for startup monitor */ unsigned long bi_sramstart;/* start of SRAM memory */ unsigned long bi_sramsize;/* size of SRAM memory */ -unsigned long bi_ip_addr;/* IP Address */ unsigned long bi_baudrate;/* Console Baudrate */ } bd_t;
arch/microblaze/lib/board.c +0 -3
@@ -176,9 +176,6 @@ void board_init (void) load_addr =getenv_ulong ("loadaddr" ,16 , load_addr);#if defined(CONFIG_CMD_NET ) -/* IP Address */ - bd->bi_ip_addr =getenv_IPaddr ("ipaddr" ); -printf ("Net: " );eth_initialize (gd->bd);
arch/mips/include/asm/u-boot.h +0 -1
@@ -33,7 +33,6 @@ typedef struct bd_info { int bi_baudrate; /* serial console baudrate */ - unsigned long bi_ip_addr; /* IP Address */ unsigned long bi_arch_number; /* unique id for this board */ unsigned long bi_boot_params; /* where this board expects params */ unsigned long bi_memstart; /* start of DRAM memory */
arch/mips/lib/board.c +0 -3
@@ -316,9 +316,6 @@ void board_init_r(gd_t *id, ulong dest_addr)/* relocate environment function pointers etc. */ env_relocate (); -/* IP Address */ - bd->bi_ip_addr =getenv_IPaddr ("ipaddr" ); -#if defined(CONFIG_PCI )/* * Do pci configuration
arch/nds32/include/asm/u-boot.h +0 -1
@@ -40,7 +40,6 @@ typedef struct bd_info { int bi_baudrate; /* serial console baudrate */ - unsigned long bi_ip_addr; /* IP Address */ unsigned char bi_enetaddr[6]; /* Ethernet adress */ unsigned long bi_arch_number; /* unique id for this board */ unsigned long bi_boot_params; /* where this board expects params */
arch/nds32/lib/board.c +0 -3
@@ -369,9 +369,6 @@ void board_init_r(gd_t *id, ulong dest_addr)nds32_pci_init ();#endif -/* IP Address */ - gd->bd->bi_ip_addr =getenv_IPaddr ("ipaddr" ); -stdio_init ();/* get the devices list going. */ jumptable_init ();
arch/nios2/include/asm/u-boot.h +0 -1
@@ -39,7 +39,6 @@ typedef struct bd_info {unsigned long bi_flashoffset;/* reserved area for startup monitor */ unsigned long bi_sramstart;/* start of SRAM memory */ unsigned long bi_sramsize;/* size of SRAM memory */ -unsigned long bi_ip_addr;/* IP Address */ unsigned long bi_baudrate;/* Console Baudrate */ } bd_t;
arch/nios2/lib/board.c +0 -2
@@ -143,8 +143,6 @@ void board_init (void)WATCHDOG_RESET ();env_relocate (); - bd->bi_ip_addr =getenv_IPaddr ("ipaddr" ); -WATCHDOG_RESET ();stdio_init ();jumptable_init ();
arch/openrisc/include/asm/u-boot.h +0 -1
@@ -33,7 +33,6 @@ typedef struct bd_info { unsigned long bi_baudrate; /* serial console baudrate */ - unsigned long bi_ip_addr; /* IP Address */ unsigned long bi_arch_number; /* unique id for this board */ unsigned long bi_boot_params; /* where this board expects params */ unsigned long bi_memstart; /* start of DRAM memory */
arch/powerpc/include/asm/u-boot.h +0 -1
@@ -63,7 +63,6 @@ typedef struct bd_info {unsigned long bi_vcofreq;/* VCO Freq, in MHz */ #endif unsigned long bi_bootflags;/* boot / reboot flag (Unused) */ -unsigned long bi_ip_addr;/* IP Address */ unsigned char bi_enetaddr[6 ];/* OLD: see README.enetaddr */ unsigned short bi_ethspeed;/* Ethernet speed in Mbps */ unsigned long bi_intfreq;/* Internal Freq, in MHz */
arch/powerpc/lib/board.c +0 -3
@@ -877,9 +877,6 @@ void board_init_r(gd_t *id, ulong dest_addr)#endif #endif /* CONFIG_CMD_NET */ -/* IP Address */ - bd->bi_ip_addr =getenv_IPaddr ("ipaddr" ); -WATCHDOG_RESET ();#if defined(CONFIG_PCI ) && !defined(CONFIG_SYS_EARLY_PCI_INIT )
arch/sandbox/include/asm/u-boot.h +0 -1
@@ -45,7 +45,6 @@ typedef struct bd_info {unsigned long bi_sramstart;/* start of SRAM memory */ unsigned long bi_sramsize;/* size of SRAM memory */ unsigned long bi_bootflags;/* boot / reboot flag (for LynxOS) */ -unsigned long bi_ip_addr;/* IP Address */ unsigned short bi_ethspeed;/* Ethernet speed in Mbps */ unsigned long bi_intfreq;/* Internal Freq, in MHz */ unsigned long bi_busfreq;/* Bus Freq, in MHz */
arch/sandbox/lib/board.c +0 -3
@@ -235,9 +235,6 @@ void board_init_r(gd_t *id, ulong dest_addr)/* initialize environment */ env_relocate (); -/* IP Address */ - gd->bd->bi_ip_addr =getenv_IPaddr ("ipaddr" ); -stdio_init ();/* get the devices list going. */ jumptable_init ();
arch/sh/include/asm/u-boot.h +0 -1
@@ -33,7 +33,6 @@ typedef struct bd_info {unsigned long bi_flashoffset;/* reserved area for startup monitor */ unsigned long bi_sramstart;/* start of SRAM memory */ unsigned long bi_sramsize;/* size of SRAM memory */ -unsigned long bi_ip_addr;/* IP Address */ unsigned long bi_baudrate;/* Console Baudrate */ unsigned long bi_boot_params;/* where this board expects params */ } bd_t;
arch/sh/lib/board.c +0 -11
@@ -100,14 +100,6 @@ static int sh_mem_env_init(void)return 0 ; } -#if defined(CONFIG_CMD_NET ) -static int sh_net_init (void ) -{ - gd->bd->bi_ip_addr =getenv_IPaddr ("ipaddr" ); -return 0 ; -} -#endif -#if defined(CONFIG_CMD_MMC )static int sh_mmc_init (void ) {
@@ -145,9 +137,6 @@ init_fnc_t *init_sequence[] =#ifdef CONFIG_BOARD_LATE_INIT board_late_init,#endif -#if defined(CONFIG_CMD_NET ) - sh_net_init, /* SH specific eth init */ -#endif #if defined(CONFIG_CMD_MMC ) sh_mmc_init,#endif
arch/sparc/include/asm/u-boot.h +0 -1
@@ -51,7 +51,6 @@ typedef struct bd_info {unsigned long bi_sramstart;/* start of SRAM memory */ unsigned long bi_sramsize;/* size of SRAM memory */ unsigned long bi_bootflags;/* boot / reboot flag (for LynxOS) */ -unsigned long bi_ip_addr;/* IP Address */ unsigned short bi_ethspeed;/* Ethernet speed in Mbps */ unsigned long bi_intfreq;/* Internal Freq, in MHz */ unsigned long bi_busfreq;/* Bus Freq, in MHz */
arch/sparc/lib/board.c +0 -2
@@ -333,8 +333,6 @@ void board_init_f(ulong bootflag)mac_read_from_eeprom ();#endif -/* IP Address */ - bd->bi_ip_addr =getenv_IPaddr ("ipaddr" );#if defined(CONFIG_PCI )/* * Do pci configuration
arch/x86/include/asm/init_helpers.h +0 -1
@@ -36,7 +36,6 @@ int set_reloc_flag_r(void);int mem_malloc_init_r (void );int init_bd_struct_r (void );int flash_init_r (void ); -int init_ip_address_r (void );int status_led_set_r (void );int set_bootfile_r (void );int set_load_addr_r (void );
arch/x86/include/asm/u-boot.h +0 -1
@@ -45,7 +45,6 @@ typedef struct bd_info {unsigned long bi_sramstart;/* start of SRAM memory */ unsigned long bi_sramsize;/* size of SRAM memory */ unsigned long bi_bootflags;/* boot / reboot flag (for LynxOS) */ -unsigned long bi_ip_addr;/* IP Address */ unsigned short bi_ethspeed;/* Ethernet speed in Mbps */ unsigned long bi_intfreq;/* Internal Freq, in MHz */ unsigned long bi_busfreq;/* Bus Freq, in MHz */
arch/x86/lib/board.c +0 -3
@@ -157,9 +157,6 @@ init_fnc_t *init_sequence_r[] = { flash_init_r, #endif env_relocate_r, -#ifdef CONFIG_CMD_NET - init_ip_address_r, -#endif #ifdef CONFIG_PCI pci_init_r,#endif
arch/x86/lib/init_helpers.c +0 -8
@@ -179,14 +179,6 @@ int flash_init_r(void) }#endif -int init_ip_address_r (void ) -{ -/* IP Address */ - bd_data.bi_ip_addr =getenv_IPaddr ("ipaddr" ); - -return 0 ; -} -#ifdef CONFIG_STATUS_LED int status_led_set_r (void ) {
board/esd/cpci405/cpci405.c +4 -5
@@ -730,12 +730,11 @@ int do_get_bpip(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])/* * Update whole ip-addr */ - bd->bi_ip_addr = ipaddr;sprintf (str,"%ld.%ld.%ld.%ld" , - (bd->bi_ip_addr &0xff000000 ) >>24 , - (bd->bi_ip_addr &0x00ff0000 ) >>16 , - (bd->bi_ip_addr &0x0000ff00 ) >>8 , - (bd->bi_ip_addr &0x000000ff )); + (ipaddr &0xff000000 ) >>24 , + (ipaddr &0x00ff0000 ) >>16 , + (ipaddr &0x0000ff00 ) >>8 , + (ipaddr &0x000000ff ));setenv ("ipaddr" , str);printf ("Updated ip_addr from bp_eeprom to %s!\n" , str); }
common/cmd_bdinfo.c +14 -14
@@ -139,7 +139,7 @@ int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])#ifdef CONFIG_HERMES print_mhz ("ethspeed" , bd->bi_ethspeed);#endif -printf ("IP addr = %pI4\n" , &bd->bi_ip_addr); +printf ("IP addr = %s\n" ,getenv ("ipaddr" ));printf ("baudrate = %6ld bps\n" , bd->bi_baudrate);print_num ("relocaddr" , gd->relocaddr);return 0 ;
@@ -164,7 +164,7 @@ int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])#if defined(CONFIG_CMD_NET )print_eth (0 ); -printf ("ip_addr = %pI4\n" , &bd->bi_ip_addr); +printf ("ip_addr = %s\n" ,getenv ("ipaddr" ));#endif printf ("baudrate = %ld bps\n" , bd->bi_baudrate);
@@ -188,7 +188,7 @@ int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])#endif #if defined(CONFIG_CMD_NET )print_eth (0 ); -printf ("ip_addr = %pI4\n" , &bd->bi_ip_addr); +printf ("ip_addr = %s\n" ,getenv ("ipaddr" ));#endif printf ("baudrate = %ld bps\n" , (ulong )bd->bi_baudrate);return 0 ;
@@ -221,7 +221,7 @@ int do_bdinfo(cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])#if defined(CONFIG_CMD_NET )print_eth (0 ); -printf ("ip_addr = %pI4\n" , &bd->bi_ip_addr); +printf ("ip_addr = %s\n" ,getenv ("ipaddr" ));#endif printf ("baudrate = %6ld bps\n" , bd->bi_baudrate);return 0 ;
@@ -267,7 +267,7 @@ int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])print_eth (3 );#endif -printf ("ip_addr = %pI4\n" , &bd->bi_ip_addr); +printf ("ip_addr = %s\n" ,getenv ("ipaddr" ));#endif printf ("baudrate = %ld bps\n" , bd->bi_baudrate);
@@ -295,7 +295,7 @@ int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])print_num ("flashoffset" , (ulong )bd->bi_flashoffset);print_eth (0 ); -printf ("ip_addr = %pI4\n" , &bd->bi_ip_addr); +printf ("ip_addr = %s\n" ,getenv ("ipaddr" ));printf ("baudrate = %d bps\n" , bd->bi_baudrate);return 0 ;
@@ -315,7 +315,7 @@ int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])print_num ("flashoffset" , (ulong )bd->bi_flashoffset);print_eth (0 ); -printf ("ip_addr = %pI4\n" , &bd->bi_ip_addr); +printf ("ip_addr = %s\n" ,getenv ("ipaddr" ));printf ("baudrate = %d bps\n" , bd->bi_baudrate);return 0 ;
@@ -335,7 +335,7 @@ int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])print_num ("flashoffset" , (ulong )bd->bi_flashoffset);print_eth (0 ); -printf ("ip_addr = %pI4\n" , &bd->bi_ip_addr); +printf ("ip_addr = %s\n" ,getenv ("ipaddr" ));printf ("baudrate = %lu bps\n" , bd->bi_baudrate);return 0 ;
@@ -359,7 +359,7 @@ int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])#if defined(CONFIG_CMD_NET )print_eth (0 ); -printf ("ip_addr = %pI4\n" , &bd->bi_ip_addr); +printf ("ip_addr = %s\n" ,getenv ("ipaddr" ));#endif printf ("baudrate = %d bps\n" , bd->bi_baudrate);#if !(defined(CONFIG_SYS_ICACHE_OFF ) && defined(CONFIG_SYS_DCACHE_OFF ))
@@ -395,7 +395,7 @@ int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])#if defined(CONFIG_CMD_NET )print_eth (0 ); -printf ("ip_addr = %pI4\n" , &bd->bi_ip_addr); +printf ("ip_addr = %s\n" ,getenv ("ipaddr" ));#endif printf ("baudrate = %ld bps\n" , (ulong )bd->bi_baudrate);return 0 ;
@@ -428,7 +428,7 @@ int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])#if defined(CONFIG_CMD_NET )print_eth (0 ); -printf ("ip_addr = %pI4\n" , &bd->bi_ip_addr); +printf ("ip_addr = %s\n" ,getenv ("ipaddr" ));print_mhz ("ethspeed" , bd->bi_ethspeed);#endif printf ("baudrate = %d bps\n" , bd->bi_baudrate);
@@ -453,7 +453,7 @@ int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])#if defined(CONFIG_CMD_NET )print_eth (0 ); -printf ("ip_addr = %pI4\n" , &bd->bi_ip_addr); +printf ("ip_addr = %s\n" ,getenv ("ipaddr" ));#endif print_num ("FB base " , gd->fb_base);return 0 ;
@@ -477,7 +477,7 @@ int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])#if defined(CONFIG_CMD_NET )print_eth (0 ); -printf ("ip_addr = %pI4\n" , &bd->bi_ip_addr); +printf ("ip_addr = %s\n" ,getenv ("ipaddr" ));#endif printf ("baudrate = %d bps\n" , bd->bi_baudrate);
@@ -498,7 +498,7 @@ int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])#if defined(CONFIG_CMD_NET )print_eth (0 ); -printf ("ip_addr = %pI4\n" , &bd->bi_ip_addr); +printf ("ip_addr = %s\n" ,getenv ("ipaddr" ));#endif printf ("baudrate = %ld bps\n" , bd->bi_baudrate);
common/cmd_nvedit.c +1 -15
@@ -342,21 +342,7 @@ int _do_env_set(int flag, int argc, char * const argv[])* Some variables should be updated when the corresponding * entry in the environment is changed */ -if (strcmp (name,"ipaddr" ) ==0 ) { -char *s = argv[2 ];/* always use only one arg */ -char *e; -unsigned long addr; - bd->bi_ip_addr =0 ; -for (addr =0 , i =0 ; i <4 ; ++i) { -ulong val = s ?simple_strtoul (s, &e,10 ) :0 ; - addr <<=8 ; - addr |= val &0xFF ; -if (s) - s = *e ? e +1 : e; - } - bd->bi_ip_addr =htonl (addr); -return 0 ; - }else if (strcmp (argv[1 ],"loadaddr" ) ==0 ) { +if (strcmp (argv[1 ],"loadaddr" ) ==0 ) { load_addr =simple_strtoul (argv[2 ],NULL ,16 );return 0 ; }
net/net.c +0 -2
@@ -342,13 +342,11 @@ void net_auto_load(void)static void NetInitLoop (enum proto_t protocol) {static int env_changed_id; -bd_t *bd = gd->bd;int env_id =get_env_id ();/* update only when the environment has changed */ if (env_changed_id != env_id) { NetOurIP =getenv_IPaddr ("ipaddr" ); -NetCopyIP (&bd->bi_ip_addr, &NetOurIP); NetOurGatewayIP =getenv_IPaddr ("gatewayip" ); NetOurSubnetMask =getenv_IPaddr ("netmask" ); NetServerIP =getenv_IPaddr ("serverip" );
Signature · 1 line
1.7.8.5
PATCH v2 2/2 net: move bootfile init into eth_initialize
All arches init this the same way, so move the logic into the core net code to avoid duplicating it everywhere else.
---
v2
- rebased onto mainline
arch/arm/lib/board.c | 8 -------- arch/avr32/lib/board.c | 3 --- arch/blackfin/lib/board.c | 7 +------ arch/m68k/lib/board.c | 5 ----- arch/microblaze/lib/board.c | 4 ---- arch/mips/lib/board.c | 8 -------- arch/nds32/lib/board.c | 6 ------ arch/powerpc/lib/board.c | 8 -------- arch/sh/lib/board.c | 11 ++--------- arch/sparc/lib/board.c | 5 ----- arch/x86/include/asm/init_helpers.h | 1 - arch/x86/lib/board.c | 3 --- arch/x86/lib/init_helpers.c | 12 ------------ net/eth.c | 10 ++++++++++ 14 files changed, 13 insertions(+), 78 deletions(-)
arch/arm/lib/board.c +0 -8
@@ -592,14 +592,6 @@ void board_init_r(gd_t *id, ulong dest_addr)/* Initialize from environment */ load_addr =getenv_ulong ("loadaddr" ,16 , load_addr); -#if defined(CONFIG_CMD_NET ) - { -char *s =getenv ("bootfile" ); - -if (s !=NULL ) -copy_filename (BootFile, s,sizeof (BootFile)); - } -#endif #ifdef CONFIG_BOARD_LATE_INIT board_late_init ();
arch/avr32/lib/board.c +0 -3
@@ -327,9 +327,6 @@ void board_init_r(gd_t *new_gd, ulong dest_addr)bb_miiphy_init ();#endif #if defined(CONFIG_CMD_NET ) - s =getenv ("bootfile" ); -if (s) -copy_filename (BootFile, s,sizeof (BootFile));puts ("Net: " );eth_initialize (gd->bd);#endif
arch/blackfin/lib/board.c +1 -6
@@ -293,13 +293,8 @@ static void board_net_init_r(bd_t *bd)bb_miiphy_init ();#endif #ifdef CONFIG_CMD_NET -char *s; - -if ((s =getenv ("bootfile" )) !=NULL ) -copy_filename (BootFile, s,sizeof (BootFile)); -printf ("Net: " ); -eth_initialize (gd->bd); +eth_initialize (bd);#endif }
arch/m68k/lib/board.c +0 -5
@@ -559,11 +559,6 @@ void board_init_r (gd_t *id, ulong dest_addr)/* Initialize from environment */ load_addr =getenv_ulong ("loadaddr" ,16 , load_addr); -#if defined(CONFIG_CMD_NET ) -if ((s =getenv ("bootfile" )) !=NULL ) { -copy_filename (BootFile, s,sizeof (BootFile)); - } -#endif WATCHDOG_RESET ();
arch/microblaze/lib/board.c +0 -4
@@ -182,10 +182,6 @@ void board_init (void)uchar enetaddr[6 ];eth_getenv_enetaddr ("ethaddr" , enetaddr);printf ("MAC: %pM\n" , enetaddr); - - s =getenv ("bootfile" ); -if (s !=NULL ) -copy_filename (BootFile, s,sizeof (BootFile));#endif /* main_loop */
arch/mips/lib/board.c +0 -8
@@ -335,14 +335,6 @@ void board_init_r(gd_t *id, ulong dest_addr)/* Initialize from environment */ load_addr =getenv_ulong ("loadaddr" ,16 , load_addr); -#if defined(CONFIG_CMD_NET ) - { -char *s =getenv ("bootfile" ); - -if (s !=NULL ) -copy_filename (BootFile, s,sizeof (BootFile)); - } -#endif #ifdef CONFIG_CMD_SPI puts ("SPI: " );
arch/nds32/lib/board.c +0 -6
@@ -399,12 +399,6 @@ void board_init_r(gd_t *id, ulong dest_addr)/* Initialize from environment */ load_addr =getenv_ulong ("loadaddr" ,16 , load_addr); -#if defined(CONFIG_CMD_NET ) - s =getenv ("bootfile" ); -if (s !=NULL ) -copy_filename (BootFile, s,sizeof (BootFile)); -#endif -#ifdef BOARD_LATE_INIT board_late_init ();#endif
arch/powerpc/lib/board.c +0 -8
@@ -932,14 +932,6 @@ void board_init_r(gd_t *id, ulong dest_addr)/* Initialize from environment */ load_addr =getenv_ulong ("loadaddr" ,16 , load_addr); -#if defined(CONFIG_CMD_NET ) - { -char *s =getenv ("bootfile" ); - -if (s !=NULL ) -copy_filename (BootFile, s,sizeof (BootFile)); - } -#endif WATCHDOG_RESET ();
arch/sh/lib/board.c +2 -9
@@ -190,15 +190,8 @@ void sh_generic_init(void)bb_miiphy_init ();#endif #if defined(CONFIG_CMD_NET ) - { -char *s; -puts ("Net: " ); -eth_initialize (gd->bd); - - s =getenv ("bootfile" ); -if (s !=NULL ) -copy_filename (BootFile, s,sizeof (BootFile)); - } +puts ("Net: " ); +eth_initialize (gd->bd);#endif /* CONFIG_CMD_NET */ while (1 ) {
arch/sparc/lib/board.c +0 -5
@@ -357,11 +357,6 @@ void board_init_f(ulong bootflag)/* Initialize from environment */ load_addr =getenv_ulong ("loadaddr" ,16 , load_addr); -#if defined(CONFIG_CMD_NET ) -if ((s =getenv ("bootfile" )) !=NULL ) { -copy_filename (BootFile, s,sizeof (BootFile)); - } -#endif /* CONFIG_CMD_NET */ WATCHDOG_RESET ();
arch/x86/include/asm/init_helpers.h +0 -1
@@ -37,7 +37,6 @@ int mem_malloc_init_r(void);int init_bd_struct_r (void );int flash_init_r (void );int status_led_set_r (void ); -int set_bootfile_r (void );int set_load_addr_r (void );#endif /* !_INIT_HELPERS_H_ */
arch/x86/lib/board.c +0 -3
@@ -177,9 +177,6 @@ init_fnc_t *init_sequence_r[] = { status_led_set_r, #endif set_load_addr_r, -#if defined(CONFIG_CMD_NET ) - set_bootfile_r, -#endif #if defined(CONFIG_CMD_IDE ) ide_init_r,#endif
arch/x86/lib/init_helpers.c +0 -12
@@ -188,18 +188,6 @@ int status_led_set_r(void) }#endif -int set_bootfile_r (void ) -{ -char *s; - - s =getenv ("bootfile" ); - -if (s !=NULL ) -copy_filename (BootFile, s,sizeof (BootFile)); - -return 0 ; -} -int set_load_addr_r (void ) {/* Initialize from environment */
net/eth.c +10 -0
@@ -250,6 +250,14 @@ int eth_unregister(struct eth_device *dev)return 0 ; } +static void eth_env_init (bd_t *bis) +{ +const char *s; + +if ((s =getenv ("bootfile" )) !=NULL ) +copy_filename (BootFile, s,sizeof (BootFile)); +} +int eth_initialize (bd_t *bis) {int num_devices =0 ;
@@ -265,6 +273,8 @@ int eth_initialize(bd_t *bis)phy_init ();#endif +eth_env_init (bis); +/* * If board-specific initialization exists, call it. * If not, call a CPU-specific one
Signature · 1 line
1.7.8.5
Joe Hershberger
AppliedPATCH v2 2/2 net: move bootfile init into eth_initialize
Hi Mike,
Quoted 22 lines · Mike Frysinger
All arches init this the same way, so move the logic into the core net code to avoid duplicating it everywhere else.
Signed-off-by Mike Frysinger <[email protected]>---
v2
? ? ? ?- rebased onto mainline?arch/arm/lib/board.c ? ? ? ? ? ? ? ?| ? ?8 -------- ?arch/avr32/lib/board.c ? ? ? ? ? ? ?| ? ?3 --- ?arch/blackfin/lib/board.c ? ? ? ? ? | ? ?7 +------ ?arch/m68k/lib/board.c ? ? ? ? ? ? ? | ? ?5 ----- ?arch/microblaze/lib/board.c ? ? ? ? | ? ?4 ---- ?arch/mips/lib/board.c ? ? ? ? ? ? ? | ? ?8 -------- ?arch/nds32/lib/board.c ? ? ? ? ? ? ?| ? ?6 ------ ?arch/powerpc/lib/board.c ? ? ? ? ? ?| ? ?8 -------- ?arch/sh/lib/board.c ? ? ? ? ? ? ? ? | ? 11 ++--------- ?arch/sparc/lib/board.c ? ? ? ? ? ? ?| ? ?5 ----- ?arch/x86/include/asm/init_helpers.h | ? ?1 - ?arch/x86/lib/board.c ? ? ? ? ? ? ? ?| ? ?3 --- ?arch/x86/lib/init_helpers.c ? ? ? ? | ? 12 ------------ ?net/eth.c ? ? ? ? ? ? ? ? ? ? ? ? ? | ? 10 ++++++++++
Quoted 1 line
?14 files changed, 13 insertions(+), 78 deletions(-)
Applied... thanks.
-Joe
Joe Hershberger
AppliedPATCH v2 1/2 net: punt bd->bi_ip_addr
In reply to Mike FrysingerHi Mike,
Quoted 42 lines · Mike Frysinger
This field gets read in one place (by "bdinfo"), and we can replace that with
getenv("ipaddr"). ?After all, thebi_ip_addrfield is kept up-to-date implicitly with the value of the ipaddr env var.Signed-off-by Mike Frysinger <[email protected]>---
v2
? ? ? ?- rebased onto mainline?arch/arm/include/asm/u-boot.h ? ? ? ?| ? ?1 - ?arch/arm/lib/board.c ? ? ? ? ? ? ? ? | ? ?3 --- ?arch/avr32/include/asm/u-boot.h ? ? ?| ? ?1 - ?arch/avr32/lib/board.c ? ? ? ? ? ? ? | ? ?2 -- ?arch/blackfin/include/asm/u-boot.h ? | ? ?1 - ?arch/blackfin/lib/board.c ? ? ? ? ? ?| ? ?3 --- ?arch/m68k/include/asm/u-boot.h ? ? ? | ? ?1 - ?arch/m68k/lib/board.c ? ? ? ? ? ? ? ?| ? ?9 --------- ?arch/microblaze/include/asm/u-boot.h | ? ?1 - ?arch/microblaze/lib/board.c ? ? ? ? ?| ? ?3 --- ?arch/mips/include/asm/u-boot.h ? ? ? | ? ?1 - ?arch/mips/lib/board.c ? ? ? ? ? ? ? ?| ? ?3 --- ?arch/nds32/include/asm/u-boot.h ? ? ?| ? ?1 - ?arch/nds32/lib/board.c ? ? ? ? ? ? ? | ? ?3 --- ?arch/nios2/include/asm/u-boot.h ? ? ?| ? ?1 - ?arch/nios2/lib/board.c ? ? ? ? ? ? ? | ? ?2 -- ?arch/openrisc/include/asm/u-boot.h ? | ? ?1 - ?arch/powerpc/include/asm/u-boot.h ? ?| ? ?1 - ?arch/powerpc/lib/board.c ? ? ? ? ? ? | ? ?3 --- ?arch/sandbox/include/asm/u-boot.h ? ?| ? ?1 - ?arch/sandbox/lib/board.c ? ? ? ? ? ? | ? ?3 --- ?arch/sh/include/asm/u-boot.h ? ? ? ? | ? ?1 - ?arch/sh/lib/board.c ? ? ? ? ? ? ? ? ?| ? 11 ----------- ?arch/sparc/include/asm/u-boot.h ? ? ?| ? ?1 - ?arch/sparc/lib/board.c ? ? ? ? ? ? ? | ? ?2 -- ?arch/x86/include/asm/init_helpers.h ?| ? ?1 - ?arch/x86/include/asm/u-boot.h ? ? ? ?| ? ?1 - ?arch/x86/lib/board.c ? ? ? ? ? ? ? ? | ? ?3 --- ?arch/x86/lib/init_helpers.c ? ? ? ? ?| ? ?8 -------- ?board/esd/cpci405/cpci405.c ? ? ? ? ?| ? ?9 ++++----- ?common/cmd_bdinfo.c ? ? ? ? ? ? ? ? ?| ? 28 ++++++++++++++-------------- ?common/cmd_nvedit.c ? ? ? ? ? ? ? ? ?| ? 16 +--------------- ?net/net.c ? ? ? ? ? ? ? ? ? ? ? ? ? ?| ? ?2 --
Quoted 1 line
?33 files changed, 19 insertions(+), 109 deletions(-)
Applied... thanks.
-Joe
PATCH 1/1 Fix cmd_nvedit.c: warning: unused variable 'bd'
In reply to Mike FrysingerCommit 50a47d0 "net: punt bd->bi_ip_addr" introduced a build warning. Fix it.
--- common/cmd_nvedit.c | 1 - 1 files changed, 0 insertions(+), 1 deletions(-)
common/cmd_nvedit.c +0 -1
@@ -204,7 +204,6 @@ static int do_env_grep(cmd_tbl_t *cmdtp, int flag,*/ int _do_env_set (int flag,int argc,char *const argv[]) { -bd_t *bd = gd->bd;int i, len;int console =-1 ;char *name, *value, *s;
Signature · 1 line
1.7.7.6
Joe Hershberger
AppliedPATCH 1/1 Fix cmd_nvedit.c: warning: unused variable 'bd'
Quoted 5 lines · Wolfgang Denk
Commit 50a47d0 "net: punt
bd->bi_ip_addr" introduced a build warning. Fix it.Signed-off-by Wolfgang Denk <[email protected]>Cc Mike Frysinger <[email protected]>
Applied, thanks.
-Joe
PATCH 1/1 Fix cmd_nvedit.c: warning: unused variable 'bd'
Dear Joe Hershberger,
Quoted 8 lines · In message <CANr=Z=bVYVDM_qoUngpEUz0x4S1P4bZYPbypU_P2grzvARnKXQ@mail.gmail.com>…
Quoted 5 lines · Wolfgang Denk
Commit 50a47d0 "net: punt
bd->bi_ip_addr" introduced a build warning. Fix it.Signed-off-by Wolfgang Denk <[email protected]>Cc Mike Frysinger <[email protected]>Applied, thanks.
Umm... how comes?
This falls not into your bailiwick...
Best regards,
Wolfgang Denk
Signature · 5 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de When the ax entered the forest, the trees said, "The handle is one of us!" -- Turkish proverb
PATCH 1/1 Fix cmd_nvedit.c: warning: unused variable 'bd'
Quoted 7 lines · Wolfgang Denk
Dear Joe Hershberger,
Quoted 4 lines · In message <CANr=Z=bVYVDM_qoUngpEUz0x4S1P4bZYPbypU_P2grzvARnKXQ@mail.gmail.com>…
Quoted 3 lines · Wolfgang Denk
Commit 50a47d0 "net: punt
bd->bi_ip_addr" introduced a build warning. Fix it.
Quoted 8 lines
Quoted 4 lines
Quoted 2 lines
Signed-off-by Wolfgang Denk <[email protected]>Cc Mike Frysinger <[email protected]>Applied, thanks.
Umm... how comes?
This falls not into your bailiwick...
Only because the break came through me.
-Joe
PATCH 1/1 Fix cmd_nvedit.c: warning: unused variable 'bd'
Dear Joe Hershberger,
Quoted 11 lines · In message <CANr=Z=aDCq+E2yeDpPXLxtoRyN3G3tOs7v0h=q4_of_ybkH8Hw@mail.gmail.com>…
Quoted 10 lines · Wolfgang Denk
Dear Joe Hershberger,
Quoted 7 lines · In message <CANr=Z=bVYVDM_qoUngpEUz0x4S1P4bZYPbypU_P2grzvARnKXQ@mail.gmail.com>…
Quoted 5 lines · Wolfgang Denk
Commit 50a47d0 "net: punt
bd->bi_ip_addr" introduced a build warning. Fix it.Signed-off-by Wolfgang Denk <[email protected]>Cc Mike Frysinger <[email protected]>
Quoted 7 lines
Quoted 5 lines
Quoted 1 line
Applied, thanks.
Umm... how comes?
This falls not into your bailiwick...
Only because the break came through me.
This is a common file that is unrelated with network code. It shuld not go through the net repo. [If you want to go ahead, you can pull it into the stagiung repo, and send a pull reqest fot that - but for a single patch that makes little sense.]
Best regards,
Wolfgang Denk
Signature · 6 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de In a survey taken several years ago, all incoming freshmen at MIT were asked if they expected to graduate in the top half of their class. Ninety-seven percent responded that they did.
PATCH 1/1 Fix cmd_nvedit.c: warning: unused variable 'bd'
Hi Wolfgang,
Quoted 18 lines · Wolfgang Denk
Dear Joe Hershberger,
Quoted 15 lines · In message <CANr=Z=aDCq+E2yeDpPXLxtoRyN3G3tOs7v0h=q4_of_ybkH8Hw@mail.gmail.com>…
Quoted 14 lines · Wolfgang Denk
Dear Joe Hershberger,
Quoted 8 lines · In message <CANr=Z=bVYVDM_qoUngpEUz0x4S1P4bZYPbypU_P2grzvARnKXQ@mail.gmail.com>…
Quoted 5 lines · Wolfgang Denk
Commit 50a47d0 "net: punt
bd->bi_ip_addr" introduced a build warning. Fix it.Signed-off-by Wolfgang Denk <[email protected]>Cc Mike Frysinger <[email protected]>Applied, thanks.
Umm... how comes?
Quoted 8 lines
Quoted 3 lines
Quoted 1 line
This falls not into your bailiwick...
Only because the break came through me.
This is a common file that is unrelated with network code. ?It shuld not go through the net repo. ?[If you want to go ahead, you can pull it into the stagiung repo, and send a pull reqest fot that - but for a single patch that makes little sense.]
Sounds good... I'll drop it. You can apply it directly.
Thanks,
-Joe
PATCH v2 1/2 net: punt bd->bi_ip_addr
In reply to Mike FrysingerHi Mike,
Quoted 3 lines · On Thu, 5 Apr 2012 00:53:40 -0400 Mike Frysinger <[email protected]> wrote:
This field gets read in one place (by "bdinfo"), and we can replace that with
getenv("ipaddr"). After all, thebi_ip_addrfield is kept up-to-date implicitly with the value of the ipaddr env var.
unfortunately this patch breaks compatibility with older v2.4 kernels. bd_t struct passed to the kernel has different offsets of the fields after bi_ip_addr. As a result older powerpc kernels setup wrong bus clock configurations and serial console baudrate. If the kernel still boots somehow, mounting nfs rootfs doesn't seem to work, etc. We need to fix the offsets at least.
Thanks,
Anatolij