Kconfig: Introduce CONFIG_SYS_HAS_SRAM
Subsystems (5)
PATCH v3 1/17 Kconfig: Introduce CONFIG_SYS_HAS_SRAM
In order to be able to replace "#ifdef CONFIG_SYS_SRAM_BASE" sequences with the IS_ENABLED() equivalent, introduce a new boolean Kconfig option that signals whether the platform has SRAM support.
---
Kconfig | 11 +++++++++++ 1 file changed, 11 insertions(+)
Kconfig +11 -0
@@ -350,6 +350,17 @@ config PLATFORM_ELFENTRY default "__start" if MIPS default "_start" +config SYS_HAS_SRAM + bool + default y if TARGET_PIC32MZDASK + default y if TARGET_DEVKIT8000 + default y if TARGET_TRICORDER + default n + help + Enable this to allow support for the on board SRAM. + SRAM base address is controlled by CONFIG_SYS_SRAM_BASE. + SRAM size is controlled by CONFIG_SYS_SRAM_SIZE. + endmenu # General setup menu "Boot images"
Signature · 1 line
2.17.1
PATCH v3 2/17 Kconfig: Convert CONFIG_SYS_SRAM_BASE to Kconfig
This converts ad-hoc CONFIG_SYS_SRAM_BASE to Kconfig.
---
Kconfig | 5 +++++ include/configs/pic32mzdask.h | 1 - scripts/config_whitelist.txt | 1 - 3 files changed, 5 insertions(+), 2 deletions(-)
Kconfig +5 -0
@@ -361,6 +361,11 @@ config SYS_HAS_SRAM SRAM base address is controlled by CONFIG_SYS_SRAM_BASE. SRAM size is controlled by CONFIG_SYS_SRAM_SIZE. +config SYS_SRAM_BASE + hex + default 0x80000000 if TARGET_PIC32MZDASK + default 0x0 + endmenu # General setup menu "Boot images"
include/configs/pic32mzdask.h +0 -1
@@ -19,7 +19,6 @@/*---------------------------------------------------------------------- * Memory Layout */ -#define CONFIG_SYS_SRAM_BASE 0x80000000#define CONFIG_SYS_SRAM_SIZE 0x00080000/* 512K */ /* Initial RAM for temporary stack, global data */
scripts/config_whitelist.txt +0 -1
@@ -3788,7 +3788,6 @@ CONFIG_SYS_SPL_LEN CONFIG_SYS_SPL_MALLOC_SIZE CONFIG_SYS_SPL_MALLOC_START CONFIG_SYS_SPR -CONFIG_SYS_SRAM_BASE CONFIG_SYS_SRAM_SIZE CONFIG_SYS_SRAM_START CONFIG_SYS_SRIO
Signature · 1 line
2.17.1
PATCH v3 3/17 Kconfig: Convert CONFIG_SYS_SRAM_SIZE to Kconfig
In reply to Ovidiu PanaitThis converts ad-hoc CONFIG_SYS_SRAM_SIZE to Kconfig.
---
Kconfig | 7 +++++++ include/configs/devkit8000.h | 1 - include/configs/pic32mzdask.h | 2 -- include/configs/tricorder.h | 1 - scripts/config_whitelist.txt | 1 - 5 files changed, 7 insertions(+), 5 deletions(-)
Kconfig +7 -0
@@ -366,6 +366,13 @@ config SYS_SRAM_BASE default 0x80000000 if TARGET_PIC32MZDASK default 0x0 +config SYS_SRAM_SIZE + hex + default 0x00080000 if TARGET_PIC32MZDASK + default 0x10000 if TARGET_DEVKIT8000 + default 0x10000 if TARGET_TRICORDER + default 0x0 + endmenu # General setup menu "Boot images"
include/configs/devkit8000.h +0 -1
@@ -140,7 +140,6 @@/* SRAM config */ #define CONFIG_SYS_SRAM_START 0x40200000 -#define CONFIG_SYS_SRAM_SIZE 0x10000/* Defines for SPL */
include/configs/pic32mzdask.h +0 -2
@@ -19,8 +19,6 @@/*---------------------------------------------------------------------- * Memory Layout */ -#define CONFIG_SYS_SRAM_SIZE 0x00080000/* 512K */ -/* Initial RAM for temporary stack, global data */ #define CONFIG_SYS_INIT_RAM_SIZE 0x10000#define CONFIG_SYS_INIT_RAM_ADDR \
include/configs/tricorder.h +0 -1
@@ -202,7 +202,6 @@/* SRAM config */ #define CONFIG_SYS_SRAM_START 0x40200000 -#define CONFIG_SYS_SRAM_SIZE 0x10000/* Defines for SPL */
scripts/config_whitelist.txt +0 -1
@@ -3788,7 +3788,6 @@ CONFIG_SYS_SPL_LEN CONFIG_SYS_SPL_MALLOC_SIZE CONFIG_SYS_SPL_MALLOC_START CONFIG_SYS_SPR -CONFIG_SYS_SRAM_SIZE CONFIG_SYS_SRAM_START CONFIG_SYS_SRIO CONFIG_SYS_SRIO1_MEM_BASE
Signature · 1 line
2.17.1
PATCH v3 4/17 Kconfig: Remove CONFIG_SYS_SRAM_START
In reply to Ovidiu PanaitRemove ad-hoc CONFIG_SYS_SRAM_START and use CONFIG_SYS_SRAM_BASE instead.
---
Kconfig | 2 ++ include/configs/devkit8000.h | 3 --- include/configs/tricorder.h | 3 --- scripts/config_whitelist.txt | 1 - 4 files changed, 2 insertions(+), 7 deletions(-)
Kconfig +2 -0
@@ -364,6 +364,8 @@ config SYS_HAS_SRAM config SYS_SRAM_BASE hex default 0x80000000 if TARGET_PIC32MZDASK + default 0x40200000 if TARGET_DEVKIT8000 + default 0x40200000 if TARGET_TRICORDER default 0x0 config SYS_SRAM_SIZE
include/configs/devkit8000.h +0 -3
@@ -138,9 +138,6 @@/* Boot Argument Buffer Size */ -/* SRAM config */ -#define CONFIG_SYS_SRAM_START 0x40200000 -/* Defines for SPL */ /* NAND boot config */
include/configs/tricorder.h +0 -3
@@ -200,9 +200,6 @@ CONFIG_SYS_INIT_RAM_SIZE - \ GENERATED_GBL_DATA_SIZE) -/* SRAM config */ -#define CONFIG_SYS_SRAM_START 0x40200000 -/* Defines for SPL */ #define CONFIG_SPL_NAND_BASE
scripts/config_whitelist.txt +0 -1
@@ -3788,7 +3788,6 @@ CONFIG_SYS_SPL_LEN CONFIG_SYS_SPL_MALLOC_SIZE CONFIG_SYS_SPL_MALLOC_START CONFIG_SYS_SPR -CONFIG_SYS_SRAM_START CONFIG_SYS_SRIO CONFIG_SYS_SRIO1_MEM_BASE CONFIG_SYS_SRIO1_MEM_BUS
Signature · 1 line
2.17.1
PATCH v3 5/17 cmd: bdinfo: Move sram info prints to generic code
In reply to Ovidiu Panaitbi_sramstart and bi_sramsize are generic members of the bd_info structure, so move the m68k/powerpc-specific prints to generic code. Also, print them only if SRAM support is enabled via CONFIG_SYS_HAS_SRAM.
---
arch/m68k/lib/bdinfo.c | 4 ---- arch/powerpc/lib/bdinfo.c | 4 ---- cmd/bdinfo.c | 4 ++++ 3 files changed, 4 insertions(+), 8 deletions(-)
arch/m68k/lib/bdinfo.c +0 -4
@@ -15,10 +15,6 @@ void arch_print_bdinfo(void) {struct bd_info *bd = gd->bd; -#if defined(CONFIG_SYS_INIT_RAM_ADDR ) -bdinfo_print_num ("sramstart" , (ulong )bd->bi_sramstart); -bdinfo_print_num ("sramsize" , (ulong )bd->bi_sramsize); -#endif bdinfo_print_mhz ("busfreq" , bd->bi_busfreq);#if defined(CONFIG_SYS_MBAR )bdinfo_print_num ("mbar" , bd->bi_mbar_base);
arch/powerpc/lib/bdinfo.c +0 -4
@@ -20,10 +20,6 @@ void arch_print_bdinfo(void) {struct bd_info *bd = gd->bd; -#if defined(CONFIG_SYS_INIT_RAM_ADDR ) -bdinfo_print_num ("sramstart" , (ulong )bd->bi_sramstart); -bdinfo_print_num ("sramsize" , (ulong )bd->bi_sramsize); -#endif bdinfo_print_mhz ("busfreq" , bd->bi_busfreq);#if defined(CONFIG_MPC8xx) || defined(CONFIG_E500 )bdinfo_print_num ("immr_base" , bd->bi_immr_base);
cmd/bdinfo.c +4 -0
@@ -75,6 +75,10 @@ int do_bdinfo(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])print_bi_dram (bd);bdinfo_print_num ("memstart" , (ulong )bd->bi_memstart);print_lnum ("memsize" , (u64 )bd->bi_memsize); +if (IS_ENABLED (CONFIG_SYS_HAS_SRAM )) { +bdinfo_print_num ("sramstart" , (ulong )bd->bi_sramstart); +bdinfo_print_num ("sramsize" , (ulong )bd->bi_sramsize); + }bdinfo_print_num ("flashstart" , (ulong )bd->bi_flashstart);bdinfo_print_num ("flashsize" , (ulong )bd->bi_flashsize);bdinfo_print_num ("flashoffset" , (ulong )bd->bi_flashoffset);
Signature · 1 line
2.17.1
PATCH v3 5/17 cmd: bdinfo: Move sram info prints to generic code
Quoted 5 lines · Ovidiu Panait
bi_sramstartandbi_sramsizeare generic members of thebd_infostructure, so move the m68k/powerpc-specific prints to generic code. Also, print them only if SRAM support is enabled viaCONFIG_SYS_HAS_SRAM.
Quoted 8 lines
Signed-off-by Ovidiu Panait <[email protected]>---
arch/m68k/lib/bdinfo.c | 4 ---- arch/powerpc/lib/bdinfo.c | 4 ---- cmd/bdinfo.c | 4 ++++ 3 files changed, 4 insertions(+), 8 deletions(-)
PATCH v3 6/17 board_f: Introduce setup_bdinfo initcall
In reply to Ovidiu PanaitIntroduce setup_bdinfo initcall as a generic routine to populate bdinfo fields.
---
common/board_f.c | 6 ++++++ include/init.h | 10 ++++++++++ 2 files changed, 16 insertions(+)
common/board_f.c +6 -0
@@ -598,6 +598,11 @@ static int display_new_sp(void)return 0 ; } +int setup_bdinfo (void ) +{ +return 0 ; +} +#if defined(CONFIG_M68K ) || defined(CONFIG_MIPS ) || defined(CONFIG_PPC ) || \ defined(CONFIG_SH )static int setup_board_part1 (void )
@@ -975,6 +980,7 @@ static const init_fnc_t init_sequence_f[] = { reserve_stacks, dram_init_banksize, show_dram_config, + setup_bdinfo, #if defined(CONFIG_M68K) || defined(CONFIG_MIPS) || defined(CONFIG_PPC) || \ defined(CONFIG_SH) setup_board_part1,
include/init.h +10 -0
@@ -141,6 +141,16 @@ int arch_reserve_stacks(void);*/ int arch_reserve_mmu (void ); +/** +* setup_bdinfo() - Generic boardinfo setup +* +* Routine for populating various generic boardinfo fields of +* gd->bd. It is called during the generic board init sequence. +* +* Return: 0 if OK +*/ +int setup_bdinfo (void ); +/** * init_cache_f_r() - Turn on the cache in preparation for relocation *
Signature · 1 line
2.17.1
PATCH v3 6/17 board_f: Introduce setup_bdinfo initcall
Quoted 10 lines · Ovidiu Panait
Introduce
setup_bdinfoinitcall as a generic routine to populate bdinfo fields.Signed-off-by Ovidiu Panait <[email protected]>---
common/board_f.c | 6 ++++++ include/init.h | 10 ++++++++++ 2 files changed, 16 insertions(+)
PATCH v3 7/17 board_f: Introduce arch_setup_bdinfo initcall
In reply to Ovidiu PanaitCertain architectures (ppc, mips, sh, m68k) use setup board_part1 and setup_board_part2 calls during pre-relocation init to populate gd->bd boardinfo fields. This makes the generic init sequence cluttered with arch-specific ifdefs.
In order to clean these arch-specific sequences from generic init, introduce arch_setup_bdinfo weak initcall so that everyone can define their own bdinfo setup routines.
---
common/board_f.c | 7 ++++++- include/init.h | 12 ++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-)
common/board_f.c +6 -1
@@ -598,11 +598,16 @@ static int display_new_sp(void)return 0 ; } -int setup_bdinfo (void ) +__weak int arch_setup_bdinfo (void ) {return 0 ; } +int setup_bdinfo (void ) +{ +return arch_setup_bdinfo (); +} +#if defined(CONFIG_M68K ) || defined(CONFIG_MIPS ) || defined(CONFIG_PPC ) || \ defined(CONFIG_SH )static int setup_board_part1 (void )
include/init.h +12 -0
@@ -141,6 +141,18 @@ int arch_reserve_stacks(void);*/ int arch_reserve_mmu (void ); +/** +* arch_setup_bdinfo() - Architecture dependent boardinfo setup +* +* Architecture-specific routine for populating various boardinfo fields of +* gd->bd. It is called during the generic board init sequence. +* +* If an implementation is not provided, it will just be a nop stub. +* +* Return: 0 if OK +*/ +int arch_setup_bdinfo (void ); +/** * setup_bdinfo() - Generic boardinfo setup *
Signature · 1 line
2.17.1
PATCH v3 8/17 board_f: Introduce board_setup_bdinfo_mem initcall
In reply to Ovidiu PanaitIn most cases (arc, ppc, mips, sh, m68k) gd->bd->bi_memsize and gd->bd->bi_memstart are populated in a similar fashion:
bd->bi_memstart = CONFIG_SYS_SDRAM_BASE;
bd->bi_memsize = gd->ram_size;However, there is a special case in board/cadence/xtfpga/xtfpga.c that populates those fields in a board specific manner:
gd->bd->bi_memstart = PHYSADDR(CONFIG_SYS_SDRAM_BASE);
gd->bd->bi_memsize = CONFIG_SYS_SDRAM_SIZE;Due to this fact, a weak board-specific routine is introduced to take care of this scenario. Also, move all assignments to bi_mem* fields to setup_bdinfo initcall.
Use gd->ram_base to populate bi_memstart to avoid an ifdef.
---
arch/arc/lib/cpu.c | 2 -- board/cadence/xtfpga/xtfpga.c | 7 ++++++- common/board_f.c | 21 +++++++++++++++------ include/init.h | 12 ++++++++++++ 4 files changed, 33 insertions(+), 9 deletions(-)
arch/arc/lib/cpu.c +0 -2
@@ -27,8 +27,6 @@ int arch_cpu_init(void)int arch_early_init_r (void ) { - gd->bd->bi_memstart =CONFIG_SYS_SDRAM_BASE ; - gd->bd->bi_memsize =CONFIG_SYS_SDRAM_SIZE ;return 0 ; }
board/cadence/xtfpga/xtfpga.c +6 -1
@@ -49,7 +49,7 @@ int checkboard(void)return 0 ; } -int dram_init_banksize (void ) +int board_setup_bdinfo_mem (void ) { gd->bd->bi_memstart =PHYSADDR (CONFIG_SYS_SDRAM_BASE ); gd->bd->bi_memsize =CONFIG_SYS_SDRAM_SIZE ;
@@ -57,6 +57,11 @@ int dram_init_banksize(void)return 0 ; } +int dram_init_banksize (void ) +{ +return 0 ; +} +int board_postclk_init (void ) {/*
common/board_f.c +15 -6
@@ -598,6 +598,19 @@ static int display_new_sp(void)return 0 ; } +__weak int board_setup_bdinfo_mem (void ) +{ +struct bd_info *bd = gd->bd; + +/* +* Save local variables to board info struct +*/ + bd->bi_memstart = gd->ram_base;/* start of memory */ + bd->bi_memsize = gd->ram_size;/* size in bytes */ + +return 0 ; +} +__weak int arch_setup_bdinfo (void ) {return 0 ;
@@ -605,6 +618,8 @@ __weak int arch_setup_bdinfo(void)int setup_bdinfo (void ) { +board_setup_bdinfo_mem (); +return arch_setup_bdinfo (); }
@@ -614,12 +629,6 @@ static int setup_board_part1(void) {struct bd_info *bd = gd->bd; -/* -* Save local variables to board info struct -*/ - bd->bi_memstart =CONFIG_SYS_SDRAM_BASE ;/* start of memory */ - bd->bi_memsize = gd->ram_size;/* size in bytes */ -#ifdef CONFIG_SYS_SRAM_BASE bd->bi_sramstart =CONFIG_SYS_SRAM_BASE ;/* start of SRAM */ bd->bi_sramsize =CONFIG_SYS_SRAM_SIZE ;/* size of SRAM */
include/init.h +12 -0
@@ -141,6 +141,18 @@ int arch_reserve_stacks(void);*/ int arch_reserve_mmu (void ); +/** +* board_setup_bdinfo_mem() - Populate gd->bd->bi_mem* fields +* +* Board-specific routine for populating gd->bd->bi_mem* fields. +* It is called during the generic board init sequence in setup_bdinfo. +* +* If an implementation is not provided, the generic one will be used. +* +* Return: 0 if OK +*/ +int board_setup_bdinfo_mem (void ); +/** * arch_setup_bdinfo() - Architecture dependent boardinfo setup *
Signature · 1 line
2.17.1
PATCH v3 8/17 board_f: Introduce board_setup_bdinfo_mem initcall
Hi Ovidiu,
[snip]
arch/arc/lib/cpu.c int arch_cpu_init(void) · line 30
Quoted 11 lines
arch/arc/lib/cpu.c +0
-2@@ -27,8 +27,6 @@ int arch_cpu_init(void)int arch_early_init_r (void ) { - gd->bd->bi_memstart =CONFIG_SYS_SDRAM_BASE ; - gd->bd->bi_memsize =CONFIG_SYS_SDRAM_SIZE ;return 0 ;
Do we still need an empty arch_early_init_r()?
I.e. get rid of it and:
--------------------------------->8-------------------------------
arch/Kconfig +0 -1
@@ -10,7 +10,6 @@ choice config ARC bool "ARC architecture" - select ARCH_EARLY_INIT_R select ARC_TIMER select CLK select HAVE_PRIVATE_LIBGCC
--------------------------------->8-------------------------------
-Alexey
PATCH v3 8/17 board_f: Introduce board_setup_bdinfo_mem initcall
Quoted 23 lines · Alexey Brodkin
Hi Ovidiu,
[snip]
arch/arc/lib/cpu.c int arch_cpu_init(void) · line 30
Quoted 11 lines
arch/arc/lib/cpu.c +0
-2@@ -27,8 +27,6 @@ int arch_cpu_init(void)int arch_early_init_r (void ) { - gd->bd->bi_memstart =CONFIG_SYS_SDRAM_BASE ; - gd->bd->bi_memsize =CONFIG_SYS_SDRAM_SIZE ;return 0 ;Do we still need an empty
arch_early_init_r()?
I.e. get rid of it and:
--------------------------------->8-------------------------------arch/Kconfig +0
-0
arch/Kconfig choice
Quoted 8 lines
arch/Kconfig +0
-2@@ -10,7 +10,6 @@ choice config ARC bool "ARC architecture" - select ARCH_EARLY_INIT_R select ARC_TIMER select CLK select HAVE_PRIVATE_LIBGCC --------------------------------->8-------------------------------
Hi Alexey,
Thanks for your input. I'll include these changes in v4.
Ovidiu
Quoted 1 line
-Alexey
PATCH v3 8/17 board_f: Introduce board_setup_bdinfo_mem initcall
In reply to Ovidiu PanaitHi Ovidiu,
Quoted 19 lines · Ovidiu Panait
In most cases (arc, ppc, mips, sh, m68k)
gd->bd->bi_memsizeandgd->bd->bi_memstartare populated in a similar fashion:bd->bi_memstart = CONFIG_SYS_SDRAM_BASE; bd->bi_memsize = gd->ram_size;However, there is a special case in
board/cadence/xtfpga/xtfpga.cthat populates those fields in a board specific manner:gd->bd->bi_memstart = PHYSADDR(CONFIG_SYS_SDRAM_BASE); gd->bd->bi_memsize = CONFIG_SYS_SDRAM_SIZE;Due to this fact, a weak board-specific routine is introduced to take care of this scenario. Also, move all assignments to bi_mem* fields to
setup_bdinfoinitcall.Use
gd->ram_baseto populatebi_memstartto avoid an ifdef.
Quoted 8 lines
Signed-off-by Ovidiu Panait <[email protected]>---
arch/arc/lib/cpu.c | 2 -- board/cadence/xtfpga/xtfpga.c | 7 ++++++- common/board_f.c | 21 +++++++++++++++------ include/init.h | 12 ++++++++++++ 4 files changed, 33 insertions(+), 9 deletions(-)
This is unfortunate and I would much rather that some board-specific code fix it up earlier or later. But I can't see an obvious place to do this.
Regards,
Simon
PATCH v3 9/17 board_f: Move sram bdinfo assignments to generic code
In reply to Ovidiu PanaitMove sram related bdinfo from arch-specific setup_board_part1 to generic code in setup_bdinfo. Also use "if (IS_ENABLED(CONFIG_SYS_HAS_SRAM))" instead of "#ifdef CONFIG_SYS_SRAM_BASE".
---
common/board_f.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-)
common/board_f.c +7 -5
@@ -618,8 +618,15 @@ __weak int arch_setup_bdinfo(void)int setup_bdinfo (void ) { +struct bd_info *bd = gd->bd; +board_setup_bdinfo_mem (); +if (IS_ENABLED (CONFIG_SYS_HAS_SRAM )) { + bd->bi_sramstart =CONFIG_SYS_SRAM_BASE ;/* start of SRAM */ + bd->bi_sramsize =CONFIG_SYS_SRAM_SIZE ;/* size of SRAM */ + } +return arch_setup_bdinfo (); }
@@ -629,11 +636,6 @@ static int setup_board_part1(void) {struct bd_info *bd = gd->bd; -#ifdef CONFIG_SYS_SRAM_BASE - bd->bi_sramstart =CONFIG_SYS_SRAM_BASE ;/* start of SRAM */ - bd->bi_sramsize =CONFIG_SYS_SRAM_SIZE ;/* size of SRAM */ -#endif -#if defined(CONFIG_E500 ) || defined(CONFIG_MPC86xx) bd->bi_immr_base =CONFIG_SYS_IMMR ;/* base of IMMR register */ #endif
Signature · 1 line
2.17.1
PATCH v3 9/17 board_f: Move sram bdinfo assignments to generic code
Quoted 10 lines · Ovidiu Panait
Move sram related bdinfo from arch-specific
setup_board_part1to generic code insetup_bdinfo. Also use "if (IS_ENABLED(CONFIG_SYS_HAS_SRAM))" instead of "#ifdefCONFIG_SYS_SRAM_BASE".Signed-off-by Ovidiu Panait <[email protected]>---
common/board_f.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-)
PATCH v3 10/17 board_f: m68k: Factor out m68k-specific bdinfo setup
In reply to Ovidiu PanaitFactor out m68k-specific bdinfo setup to arch_setup_bdinfo in arch/m68k/lib/bdinfo.c. Also, use if(IS_ENABLED()) instead of #ifdef where possible.
---
arch/m68k/lib/bdinfo.c | 21 +++++++++++++++++++++ common/board_f.c | 19 ++++--------------- 2 files changed, 25 insertions(+), 15 deletions(-)
arch/m68k/lib/bdinfo.c +21 -0
@@ -11,6 +11,27 @@DECLARE_GLOBAL_DATA_PTR ; +int arch_setup_bdinfo (void ) +{ +struct bd_info *bd = gd->bd; + + bd->bi_mbar_base =CONFIG_SYS_MBAR ;/* base of internal registers */ + + bd->bi_intfreq = gd->cpu_clk;/* Internal Freq, in Hz */ + bd->bi_busfreq = gd->bus_clk;/* Bus Freq, in Hz */ + +if (IS_ENABLED (CONFIG_PCI )) + bd->bi_pcifreq = gd->pci_clk; + +#if defined(CONFIG_EXTRA_CLOCK ) + bd->bi_inpfreq = gd->arch.inp_clk;/* input Freq in Hz */ + bd->bi_vcofreq = gd->arch.vco_clk;/* vco Freq in Hz */ + bd->bi_flbfreq = gd->arch.flb_clk;/* flexbus Freq in Hz */ +#endif + +return 0 ; +} +void arch_print_bdinfo (void ) {struct bd_info *bd = gd->bd;
common/board_f.c +4 -15
@@ -630,7 +630,7 @@ int setup_bdinfo(void)return arch_setup_bdinfo (); } -#if defined(CONFIG_M68K ) || defined(CONFIG_MIPS ) || defined(CONFIG_PPC ) || \ +#if defined(CONFIG_MIPS ) || defined(CONFIG_PPC ) || \ defined(CONFIG_SH )static int setup_board_part1 (void ) {
@@ -639,9 +639,6 @@ static int setup_board_part1(void)#if defined(CONFIG_E500 ) || defined(CONFIG_MPC86xx) bd->bi_immr_base =CONFIG_SYS_IMMR ;/* base of IMMR register */ #endif -#if defined(CONFIG_M68K ) - bd->bi_mbar_base =CONFIG_SYS_MBAR ;/* base of internal registers */ -#endif #if defined(CONFIG_MPC83xx) bd->bi_immrbar =CONFIG_SYS_IMMR ;#endif
@@ -650,7 +647,7 @@ static int setup_board_part1(void) }#endif -#if defined(CONFIG_PPC ) || defined(CONFIG_M68K ) +#if defined(CONFIG_PPC )static int setup_board_part2 (void ) {struct bd_info *bd = gd->bd;
@@ -663,14 +660,6 @@ static int setup_board_part2(void) bd->bi_sccfreq = gd->arch.scc_clk; bd->bi_vco = gd->arch.vco_out;#endif /* CONFIG_CPM2 */ -#if defined(CONFIG_M68K ) && defined(CONFIG_PCI ) - bd->bi_pcifreq = gd->pci_clk; -#endif -#if defined(CONFIG_EXTRA_CLOCK ) - bd->bi_inpfreq = gd->arch.inp_clk;/* input Freq in Hz */ - bd->bi_vcofreq = gd->arch.vco_clk;/* vco Freq in Hz */ - bd->bi_flbfreq = gd->arch.flb_clk;/* flexbus Freq in Hz */ -#endif return 0 ; }
@@ -997,11 +986,11 @@ static const init_fnc_t init_sequence_f[] = { dram_init_banksize, show_dram_config, setup_bdinfo, -#if defined(CONFIG_M68K) || defined(CONFIG_MIPS) || defined(CONFIG_PPC) || \ +#if defined(CONFIG_MIPS) || defined(CONFIG_PPC) || \ defined(CONFIG_SH) setup_board_part1, #endif -#if defined(CONFIG_PPC) || defined(CONFIG_M68K) +#if defined(CONFIG_PPC) INIT_FUNC_WATCHDOG_RESET setup_board_part2, #endif
Signature · 1 line
2.17.1
PATCH v3 10/17 board_f: m68k: Factor out m68k-specific bdinfo setup
Quoted 11 lines · Ovidiu Panait
Factor out m68k-specific bdinfo setup to
arch_setup_bdinfoinarch/m68k/lib/bdinfo.c. Also, use if(IS_ENABLED()) instead of #ifdef where possible.Signed-off-by Ovidiu Panait <[email protected]>---
arch/m68k/lib/bdinfo.c | 21 +++++++++++++++++++++ common/board_f.c | 19 ++++--------------- 2 files changed, 25 insertions(+), 15 deletions(-)
PATCH v3 11/17 board_f: ppc: Factor out ppc-specific bdinfo setup
In reply to Ovidiu PanaitFactor out ppc-specific bdinfo setup from generic init sequence to arch_setup_bdinfo in arch/powerpc/lib/bdinfo.c.
---
arch/powerpc/lib/bdinfo.c | 25 +++++++++++++++++++++++++ common/board_f.c | 36 ++---------------------------------- 2 files changed, 27 insertions(+), 34 deletions(-)
arch/powerpc/lib/bdinfo.c +25 -0
@@ -11,6 +11,31 @@DECLARE_GLOBAL_DATA_PTR ; +int arch_setup_bdinfo (void ) +{ +struct bd_info *bd = gd->bd; + +#if defined(CONFIG_E500 ) || defined(CONFIG_MPC86xx) + bd->bi_immr_base =CONFIG_SYS_IMMR ;/* base of IMMR register */ +#endif + +#if defined(CONFIG_MPC83xx) + bd->bi_immrbar =CONFIG_SYS_IMMR ; +#endif + + bd->bi_intfreq = gd->cpu_clk;/* Internal Freq, in Hz */ + bd->bi_busfreq = gd->bus_clk;/* Bus Freq, in Hz */ + +#if defined(CONFIG_CPM2 ) + bd->bi_cpmfreq = gd->arch.cpm_clk; + bd->bi_brgfreq = gd->arch.brg_clk; + bd->bi_sccfreq = gd->arch.scc_clk; + bd->bi_vco = gd->arch.vco_out; +#endif /* CONFIG_CPM2 */ + +return 0 ; +} +void __weak board_detail (void ) {/* Please define board_detail() for your PPC platform */
common/board_f.c +2 -34
@@ -630,37 +630,9 @@ int setup_bdinfo(void)return arch_setup_bdinfo (); } -#if defined(CONFIG_MIPS ) || defined(CONFIG_PPC ) || \ - defined(CONFIG_SH ) +#if defined(CONFIG_MIPS ) || defined(CONFIG_SH )static int setup_board_part1 (void ) { -struct bd_info *bd = gd->bd; - -#if defined(CONFIG_E500 ) || defined(CONFIG_MPC86xx) - bd->bi_immr_base =CONFIG_SYS_IMMR ;/* base of IMMR register */ -#endif -#if defined(CONFIG_MPC83xx) - bd->bi_immrbar =CONFIG_SYS_IMMR ; -#endif - -return 0 ; -} -#endif - -#if defined(CONFIG_PPC ) -static int setup_board_part2 (void ) -{ -struct bd_info *bd = gd->bd; - - bd->bi_intfreq = gd->cpu_clk;/* Internal Freq, in Hz */ - bd->bi_busfreq = gd->bus_clk;/* Bus Freq, in Hz */ -#if defined(CONFIG_CPM2 ) - bd->bi_cpmfreq = gd->arch.cpm_clk; - bd->bi_brgfreq = gd->arch.brg_clk; - bd->bi_sccfreq = gd->arch.scc_clk; - bd->bi_vco = gd->arch.vco_out; -#endif /* CONFIG_CPM2 */ -return 0 ; }#endif
@@ -986,14 +958,10 @@ static const init_fnc_t init_sequence_f[] = { dram_init_banksize, show_dram_config, setup_bdinfo, -#if defined(CONFIG_MIPS) || defined(CONFIG_PPC) || \ - defined(CONFIG_SH) +#if defined(CONFIG_MIPS) || defined(CONFIG_SH) setup_board_part1, #endif -#if defined(CONFIG_PPC) INIT_FUNC_WATCHDOG_RESET - setup_board_part2, -#endif display_new_sp, #ifdef CONFIG_OF_BOARD_FIXUP fix_fdt,
Signature · 1 line
2.17.1
PATCH v3 11/17 board_f: ppc: Factor out ppc-specific bdinfo setup
Quoted 10 lines · Ovidiu Panait
Factor out ppc-specific bdinfo setup from generic init sequence to
arch_setup_bdinfoinarch/powerpc/lib/bdinfo.c.Signed-off-by Ovidiu Panait <[email protected]>---
arch/powerpc/lib/bdinfo.c | 25 +++++++++++++++++++++++++ common/board_f.c | 36 ++---------------------------------- 2 files changed, 27 insertions(+), 34 deletions(-)
Could this be a way to remove the weak SDRAM function?
PATCH v3 11/17 board_f: ppc: Factor out ppc-specific bdinfo setup
Hi Simon,
Quoted 7 lines · Simon Glass
Quoted 6 lines · Ovidiu Panait
Factor out ppc-specific bdinfo setup from generic init sequence to
arch_setup_bdinfoinarch/powerpc/lib/bdinfo.c.Signed-off-by Ovidiu Panait <[email protected]>---
Quoted 6 lines
Quoted 3 lines
arch/powerpc/lib/bdinfo.c | 25 +++++++++++++++++++++++++ common/board_f.c | 36 ++---------------------------------- 2 files changed, 27 insertions(+), 34 deletions(-)Reviewed-by Simon Glass <[email protected]>Could this be a way to remove the weak SDRAM function?
I think the SDRAM weak function can be eliminated by overwriting the values set in common/board_f.c using the xtensa-specific arch_setup_bdinfo (arch/xtensa/lib/bdinfo.c), as you suggested.
I plan to replace the weak SDRAM function patch with this one:
iff --git a/arch/Kconfig b/arch/Kconfig
index 9be02d1319..4d9557959c 100644
arch/Kconfig +0 -1
@@ -10,7 +10,6 @@ choice ?config ARC ???? bool "ARC architecture" -??? select ARCH_EARLY_INIT_R ???? select ARC_TIMER ???? select CLK ???? select HAVE_PRIVATE_LIBGCC
arch/arc/lib/cpu.c +0 -7
@@ -25,13 +25,6 @@ int arch_cpu_init(void) ???? return 0; ?} -int arch_early_init_r (void ) -{ -??? gd->bd->bi_memstart = CONFIG_SYS_SDRAM_BASE; -??? gd->bd->bi_memsize = CONFIG_SYS_SDRAM_SIZE; -??? return 0; -} - ?/* This is a dummy function on arc */ ?int dram_init(void) ?{
arch/xtensa/lib/bdinfo.c new file +20 -0
@@ -0,0 +1,20 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* +* XTENSA-specific information for the 'bd' command +* +* (C) Copyright 2003 +* Wolfgang Denk, DENX Software Engineering, wd at denx.de. +*/ + +#include <common.h> +#include <init.h> + +DECLARE_GLOBAL_DATA_PTR ; + +int arch_setup_bdinfo (void ) +{ +??? struct bd_info *bd = gd->bd; + +??? gd->bd->bi_memstart = PHYSADDR(CONFIG_SYS_SDRAM_BASE); +??? gd->bd->bi_memsize = CONFIG_SYS_SDRAM_SIZE; +}
board/cadence/xtfpga/xtfpga.c +0 -3
@@ -51,9 +51,6 @@ int checkboard(void) ?int dram_init_banksize(void) ?{ -??? gd->bd->bi_memstart = PHYSADDR(CONFIG_SYS_SDRAM_BASE); -??? gd->bd->bi_memsize = CONFIG_SYS_SDRAM_SIZE; - ???? return 0; ?}
common/board_f.c +5 -6
@@ -605,6 +605,11 @@ __weak int arch_setup_bdinfo(void) ?int setup_bdinfo(void) ?{ +??? struct bd_info *bd = gd->bd; + +??? bd->bi_memstart = gd->ram_base;? /* start of memory */ +??? bd->bi_memsize = gd->ram_size;?? /* size in bytes */ + ???? return arch_setup_bdinfo(); ?}
@@ -614,12 +619,6 @@ static int setup_board_part1(void) ?{ ???? struct bd_info *bd = gd->bd; -??? /* -??? ?* Save local variables to board info struct -??? ?*/ -??? bd->bi_memstart = CONFIG_SYS_SDRAM_BASE;??? /* start of memory */ -??? bd->bi_memsize = gd->ram_size;??? ??? ??? /* size in bytes */ - ?#ifdef CONFIG_SYS_SRAM_BASE ???? bd->bi_sramstart = CONFIG_SYS_SRAM_BASE;??? /* start of SRAM */ ???? bd->bi_sramsize = CONFIG_SYS_SRAM_SIZE;??? ??? /* size? of SRAM */
Do you think this is a better approach?
Ovidiu
PATCH v3 11/17 board_f: ppc: Factor out ppc-specific bdinfo setup
Hi Ovidiu,
Quoted 125 lines · Ovidiu Panait
Hi Simon,
Quoted 7 lines · Simon Glass
Quoted 6 lines · Ovidiu Panait
Factor out ppc-specific bdinfo setup from generic init sequence to
arch_setup_bdinfoinarch/powerpc/lib/bdinfo.c.Signed-off-by Ovidiu Panait <[email protected]>---
Quoted 6 lines
Quoted 3 lines
arch/powerpc/lib/bdinfo.c | 25 +++++++++++++++++++++++++ common/board_f.c | 36 ++---------------------------------- 2 files changed, 27 insertions(+), 34 deletions(-)Reviewed-by Simon Glass <[email protected]>Could this be a way to remove the weak SDRAM function?
I think the SDRAM weak function can be eliminated by overwriting the values set in
common/board_f.cusing the xtensa-specificarch_setup_bdinfo(arch/xtensa/lib/bdinfo.c), as you suggested.I plan to replace the weak SDRAM function patch with this one:
iff --git a/arch/Kconfig b/arch/Kconfig
index9be02d1319..4d9557959c100644arch/Kconfig +0
-1@@ -10,7 +10,6 @@ choice config ARC bool "ARC architecture" - select ARCH_EARLY_INIT_R select ARC_TIMER select CLK select HAVE_PRIVATE_LIBGCCarch/arc/lib/cpu.c +0
-7@@ -25,13 +25,6 @@ int arch_cpu_init(void)return 0 ; } -int arch_early_init_r (void ) -{ - gd->bd->bi_memstart =CONFIG_SYS_SDRAM_BASE ; - gd->bd->bi_memsize =CONFIG_SYS_SDRAM_SIZE ; -return 0 ; -} -/* This is a dummy function on arc */ int dram_init (void ) {arch/xtensa/lib/bdinfo.c new file +20
-0@@ -0,0 +1,20 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* +* XTENSA-specific information for the 'bd' command +* +* (C) Copyright 2003 +* Wolfgang Denk, DENX Software Engineering, wd at denx.de. +*/ + +#include <common.h> +#include <init.h> + +DECLARE_GLOBAL_DATA_PTR ; + +int arch_setup_bdinfo (void ) +{ +struct bd_info *bd = gd->bd; + + gd->bd->bi_memstart =PHYSADDR (CONFIG_SYS_SDRAM_BASE ); + gd->bd->bi_memsize =CONFIG_SYS_SDRAM_SIZE ; +}board/cadence/xtfpga/xtfpga.c +0
-3@@ -51,9 +51,6 @@ int checkboard(void)int dram_init_banksize (void ) { - gd->bd->bi_memstart =PHYSADDR (CONFIG_SYS_SDRAM_BASE ); - gd->bd->bi_memsize =CONFIG_SYS_SDRAM_SIZE ; -return 0 ; }common/board_f.c +5
-6@@ -605,6 +605,11 @@ __weak int arch_setup_bdinfo(void)int setup_bdinfo (void ) { +struct bd_info *bd = gd->bd; + + bd->bi_memstart = gd->ram_base;/* start of memory */ + bd->bi_memsize = gd->ram_size;/* size in bytes */ +return arch_setup_bdinfo (); }@@ -614,12 +619,6 @@ static int setup_board_part1(void) {struct bd_info *bd = gd->bd; -/* -* Save local variables to board info struct -*/ - bd->bi_memstart =CONFIG_SYS_SDRAM_BASE ;/* start of memory */ - bd->bi_memsize = gd->ram_size;/* size in bytes */ -#ifdef CONFIG_SYS_SRAM_BASE bd->bi_sramstart =CONFIG_SYS_SRAM_BASE ;/* start of SRAM */ bd->bi_sramsize =CONFIG_SYS_SRAM_SIZE ;/* size of SRAM */
Quoted 1 line
Do you think this is a better approach?
Yes it looks better to me.
Regards,
Simon
PATCH v3 11/17 board_f: ppc: Factor out ppc-specific bdinfo setup
Hi Simon,
Quoted 126 lines · Simon Glass
Hi Ovidiu,
Quoted 123 lines · Ovidiu Panait
Hi Simon,
Quoted 7 lines · Simon Glass
Quoted 6 lines · Ovidiu Panait
Factor out ppc-specific bdinfo setup from generic init sequence to
arch_setup_bdinfoinarch/powerpc/lib/bdinfo.c.Signed-off-by Ovidiu Panait <[email protected]>---
Quoted 6 lines
Quoted 3 lines
arch/powerpc/lib/bdinfo.c | 25 +++++++++++++++++++++++++ common/board_f.c | 36 ++---------------------------------- 2 files changed, 27 insertions(+), 34 deletions(-)Reviewed-by Simon Glass <[email protected]>Could this be a way to remove the weak SDRAM function?
I think the SDRAM weak function can be eliminated by overwriting the values set in
common/board_f.cusing the xtensa-specificarch_setup_bdinfo(arch/xtensa/lib/bdinfo.c), as you suggested.I plan to replace the weak SDRAM function patch with this one:
iff --git a/arch/Kconfig b/arch/Kconfig
index9be02d1319..4d9557959c100644arch/Kconfig +0
-1@@ -10,7 +10,6 @@ choice config ARC bool "ARC architecture" - select ARCH_EARLY_INIT_R select ARC_TIMER select CLK select HAVE_PRIVATE_LIBGCCarch/arc/lib/cpu.c +0
-7@@ -25,13 +25,6 @@ int arch_cpu_init(void)return 0 ; } -int arch_early_init_r (void ) -{ - gd->bd->bi_memstart =CONFIG_SYS_SDRAM_BASE ; - gd->bd->bi_memsize =CONFIG_SYS_SDRAM_SIZE ; -return 0 ; -} -/* This is a dummy function on arc */ int dram_init (void ) {arch/xtensa/lib/bdinfo.c new file +20
-0@@ -0,0 +1,20 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* +* XTENSA-specific information for the 'bd' command +* +* (C) Copyright 2003 +* Wolfgang Denk, DENX Software Engineering, wd at denx.de. +*/ + +#include <common.h> +#include <init.h> + +DECLARE_GLOBAL_DATA_PTR ; + +int arch_setup_bdinfo (void ) +{ +struct bd_info *bd = gd->bd; + + gd->bd->bi_memstart =PHYSADDR (CONFIG_SYS_SDRAM_BASE ); + gd->bd->bi_memsize =CONFIG_SYS_SDRAM_SIZE ; +}board/cadence/xtfpga/xtfpga.c +0
-3@@ -51,9 +51,6 @@ int checkboard(void)int dram_init_banksize (void ) { - gd->bd->bi_memstart =PHYSADDR (CONFIG_SYS_SDRAM_BASE ); - gd->bd->bi_memsize =CONFIG_SYS_SDRAM_SIZE ; -return 0 ; }common/board_f.c +5
-6@@ -605,6 +605,11 @@ __weak int arch_setup_bdinfo(void)int setup_bdinfo (void ) { +struct bd_info *bd = gd->bd; + + bd->bi_memstart = gd->ram_base;/* start of memory */ + bd->bi_memsize = gd->ram_size;/* size in bytes */ +return arch_setup_bdinfo (); }@@ -614,12 +619,6 @@ static int setup_board_part1(void) {struct bd_info *bd = gd->bd; -/* -* Save local variables to board info struct -*/ - bd->bi_memstart =CONFIG_SYS_SDRAM_BASE ;/* start of memory */ - bd->bi_memsize = gd->ram_size;/* size in bytes */ -#ifdef CONFIG_SYS_SRAM_BASE bd->bi_sramstart =CONFIG_SYS_SRAM_BASE ;/* start of SRAM */ bd->bi_sramsize =CONFIG_SYS_SRAM_SIZE ;/* size of SRAM */
Quoted 2 lines
Quoted 1 line
Do you think this is a better approach?
Yes it looks better to me.
In the meantime, I have sent the v4 for this series, containing the above mentioned changes:
https://lists.denx.de/pipermail/u-boot/2020-July/421283.html
Thanks,
Ovidiu
Quoted 2 lines
Regards,
Simon
PATCH v3 12/17 board_f: Remove setup_board_part1
In reply to Ovidiu PanaitNow that all arch specific code was converted to setup_bdinfo, we can remove setup_board_part1.
---
common/board_f.c | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-)
common/board_f.c +1 -11
@@ -630,13 +630,6 @@ int setup_bdinfo(void)return arch_setup_bdinfo (); } -#if defined(CONFIG_MIPS ) || defined(CONFIG_SH ) -static int setup_board_part1 (void ) -{ -return 0 ; -} -#endif -#ifdef CONFIG_POST static int init_post (void ) {
@@ -957,11 +950,8 @@ static const init_fnc_t init_sequence_f[] = { reserve_stacks, dram_init_banksize, show_dram_config, - setup_bdinfo, -#if defined(CONFIG_MIPS) || defined(CONFIG_SH) - setup_board_part1, -#endif INIT_FUNC_WATCHDOG_RESET + setup_bdinfo, display_new_sp,#ifdef CONFIG_OF_BOARD_FIXUP fix_fdt,
Signature · 1 line
2.17.1
PATCH v3 12/17 board_f: Remove setup_board_part1
Quoted 9 lines · Ovidiu Panait
Now that all arch specific code was converted to
setup_bdinfo, we can removesetup_board_part1.Signed-off-by Ovidiu Panait <[email protected]>---
common/board_f.c | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-)
PATCH v3 13/17 dm: blk: Use IS_ENABLED() instead of #ifdefs in blk_post_probe
In reply to Ovidiu PanaitUse IS_ENABLED() instead of #ifdef in blk_post_probe function.
No functional change intended.
---
drivers/block/blk-uclass.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
drivers/block/blk-uclass.c +5 -4
@@ -644,11 +644,12 @@ int blk_unbind_all(int if_type)static int blk_post_probe (struct udevice *dev) { -#if defined(CONFIG_PARTITIONS ) && defined(CONFIG_HAVE_BLOCK_DEVICE ) -struct blk_desc *desc =dev_get_uclass_platdata (dev); +if (IS_ENABLED (CONFIG_PARTITIONS ) && +IS_ENABLED (CONFIG_HAVE_BLOCK_DEV )) { +struct blk_desc *desc =dev_get_uclass_platdata (dev); -part_init (desc); -#endif +part_init (desc); + }return 0 ; }
Signature · 1 line
2.17.1
PATCH v3 14/17 drivers: serial: Make serial_initialize return int
In reply to Ovidiu Panaitserial_initialize is called only during the common init sequence, after relocation (in common/board_r.c). Because it has a void return value, it has to wrapped in initr_serial. In order to be able to get rid of this indirection, make serial_initialize return int.
Remove extern from prototype in order to silence the following checkpatch warning:
check: extern prototypes should be avoided in .h files
---
drivers/serial/serial-uclass.c | 4 ++-- drivers/serial/serial.c | 4 +++- include/serial.h | 2 +- 3 files changed, 6 insertions(+), 4 deletions(-)
drivers/serial/serial-uclass.c +2 -2
@@ -170,9 +170,9 @@ int serial_init(void) }/* Called after relocation */ -void serial_initialize (void ) +int serial_initialize (void ) { -serial_init (); +return serial_init (); }static void _serial_putc (struct udevice *dev,char ch)
drivers/serial/serial.c +3 -1
@@ -170,7 +170,7 @@ void serial_register(struct serial_device *dev)* serial port to the serial core. That serial port is then used as a * default output. */ -void serial_initialize (void ) +int serial_initialize (void ) {atmel_serial_initialize ();mcf_serial_initialize ();
@@ -183,6 +183,8 @@ void serial_initialize(void)mtk_serial_initialize ();serial_assign (default_serial_console ()->name); + +return 0 ; }static int serial_stub_start (struct stdio_dev *sdev)
include/serial.h +1 -1
@@ -42,10 +42,10 @@ extern struct serial_device eserial5_device;extern struct serial_device eserial6_device;extern void serial_register (struct serial_device *); -extern void serial_initialize (void );extern void serial_stdio_init (void );extern int serial_assign (const char *name);extern void serial_reinit_all (void ); +int serial_initialize (void );/* For usbtty */ #ifdef CONFIG_USB_TTY
Signature · 1 line
2.17.1
PATCH v3 15/17 common/board_r: Remove initr_serial wrapper
In reply to Ovidiu PanaitRemove the initr_serial->serial_initialize indirection and call serial_initialize directly.
---
common/board_r.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-)
common/board_r.c +1 -7
@@ -187,12 +187,6 @@ static int initr_reloc_global_data(void)return 0 ; } -static int initr_serial (void ) -{ -serial_initialize (); -return 0 ; -} -#if defined(CONFIG_PPC ) || defined(CONFIG_M68K ) || defined(CONFIG_MIPS )static int initr_trap (void ) {
@@ -705,7 +699,7 @@ static init_fnc_t init_sequence_r[] = {#endif initr_dm_devices, stdio_init_tables, - initr_serial, + serial_initialize, initr_announce, #if CONFIG_IS_ENABLED(WDT) initr_watchdog,
Signature · 1 line
2.17.1
PATCH v3 16/17 blkcache: Extend blkcache_init to cover CONFIG_NEEDS_MANUAL_RELOC
In reply to Ovidiu PanaitExtend manual relocation of block_cache list pointers to all platforms that enable CONFIG_NEEDS_MANUAL_RELOC. Remove m68k-specific checks and provide a single implementation that adds gd->reloc_off to the pre-relocation pointers.
---
common/board_r.c | 2 +- drivers/block/blkcache.c | 13 +++++++------ 2 files changed, 8 insertions(+), 7 deletions(-)
common/board_r.c +1 -1
@@ -836,7 +836,7 @@ static init_fnc_t init_sequence_r[] = {#if defined(CONFIG_PRAM ) initr_mem,#endif -#if defined(CONFIG_M68K ) && defined(CONFIG_BLOCK_CACHE ) +#if defined(CONFIG_NEEDS_MANUAL_RELOC ) && defined(CONFIG_BLOCK_CACHE ) blkcache_init, #endif run_main_loop,
drivers/block/blkcache.c +7 -6
@@ -12,6 +12,8 @@#include <linux/ctype.h> #include <linux/list.h> +DECLARE_GLOBAL_DATA_PTR ; +struct block_cache_node {struct list_head lh;int iftype;
@@ -22,21 +24,20 @@ struct block_cache_node {char *cache; }; -#ifndef CONFIG_M68K static LIST_HEAD (block_cache); -#else -static struct list_head block_cache; -#endif static struct block_cache_stats _stats = { .max_blocks_per_entry =8 , .max_entries =32 }; -#ifdef CONFIG_M68K +#ifdef CONFIG_NEEDS_MANUAL_RELOC int blkcache_init (void ) { -INIT_LIST_HEAD (&block_cache); +struct list_head *head = &block_cache; + + head->next = (uintptr_t )head->next + gd->reloc_off; + head->prev = (uintptr_t )head->prev + gd->reloc_off;return 0 ; }
Signature · 1 line
2.17.1
PATCH v3 17/17 common/board_r: Move blkcache_init call earlier in the boot sequence
In reply to Ovidiu Panaitblkcache_init manually relocates blkcache list pointers when CONFIG_NEEDS_MANUAL_RELOC is enabled. However, it is called very late in the boot sequence, which could be a problem if previous boot calls execute blkcache operations with the non-relocated pointers. For example, mmc is initialized earlier and might call blkcache_invalidate (in mmc_select_hwpart()) when trying to load the environment from mmc via env_load().
To fix this issue, move blkcache_init boot call earlier, before mmc gets initialized.
---
common/board_r.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
common/board_r.c +3 -3
@@ -705,6 +705,9 @@ static init_fnc_t init_sequence_r[] = { initr_watchdog, #endif INIT_FUNC_WATCHDOG_RESET +#if defined(CONFIG_NEEDS_MANUAL_RELOC ) && defined(CONFIG_BLOCK_CACHE ) + blkcache_init, +#endif #ifdef CONFIG_NEEDS_MANUAL_RELOC initr_manual_reloc_cmdtable,#endif
@@ -835,9 +838,6 @@ static init_fnc_t init_sequence_r[] = {#endif #if defined(CONFIG_PRAM ) initr_mem, -#endif -#if defined(CONFIG_NEEDS_MANUAL_RELOC ) && defined(CONFIG_BLOCK_CACHE ) - blkcache_init, #endif run_main_loop, };
Signature · 1 line
2.17.1