[U-Boot] [RESEND][PATCH 00/24] sh: add generic board support and fixes

This is a combined series of the fixes to SH2/SH3/SH4/SH4A architecture port of U-boot on top of the master branch, there is no functional difference between this series and 3 my series sent in August 2016 for 2016.09, however due to many positive generalization updates to U-boot sources the old unreviewed series can not be cleanly applied anymore:
* [PATCH 0/6] sh4: fix and simplify cache manipulation * [PATCH 0/5] sh4: fixes to SH7751 PCI host controller * [PATCH] common: sh: add necessary define bits to board_f * [PATCH 00/12] sh: change arch and boards code to generic board
I have to resend the changes, because apparently Nobuhiro Iwamatsu is too busy to maintain SH port and I ask Tom/Simon/Marek and other active U-boot developers to review and apply the changes, it is highly desirable to have a possibility to run modern U-boot on boards powered by SH cores.
The changeset implements initial support of relocatable U-Boot code for SH2/SH3/SH4 architectures and boards, as weel as it restores a possibility to boot U-Boot on SH boards, which has not been converted to generic board in time (for more details see commit f41e6088eb1 ("sh: Fix build errors for generic board")). Special attention from maintainers of all touched boards is required, due to inaccessibility of hardware for me it would be a troublesome task.
*** CACHE SUPPORT COVER LETTER ***
In my tests I experience that sometimes SH4 does not properly fetch instructions after immediate jump to a code loaded by means of rtl8139, the problem is gone if "icache off" is executed after load or if cache invalidation and write-back is used on data load instead of just cache invalidation, which is apparently an improper backbone of flush_dcache_range() function.
The changeset contains a couple of bugfixes and a general simplification of the code related to cache manipulation. Note that while caches are found on SH2 and SH3 for long time they were inactive in U-Boot, because I don't have SH2/SH3 hardware for testing I don't spread SH4 cache fixes to those cpus, however generally it should be the same, in that case arch/sh/cpu/sh4/cache.c file can be moved to arch/sh/lib folder
*** PCI CONTROLLER CHANGES COVER LETTER ***
This series fixes 2 bugs found in SH7751 PCI host controller driver, also it restores r2dplus defconfig and slightly simplifies the code related to the SH7751 PCI controller, more improvements may follow in future.
The change is independent on the following conversion to generic board, however it adds some bits to simplify porting of r2dplus board by moving board specific CONFIG_SYS_TEXT_BASE into P1 area,
Before the change even if rtl8139 driver is selected in a defconfig the device was unusable due to invalid phys to bus mapping (e.g. test with 'dhcp' command shows it), this most probably was caused by some unnoticed generic change in PCI driver framework, however now it is fixed by the series.
*** GENERIC BOARD CHANGES COVER LETTER ***
Now code/data initialization and relocation in general resemble the procedure on ARM with minor peculiarities (same one relocation from a storage device if calculated reloc_off == 0, otherwise two relocations), however please note that the change does *not* add PIE support (only PIC), so it may end up that there are persistent pointers to some non-relocated data, this point requires better investion.
Only r2dplus board is actually converted to support new architectural changes, the rest of the boards require attention from board maintainers or they will be removed. Board maintainers may pay attention to CONFIG_SYS_MALLOC_CLEAR_ON_INIT, CONFIG_NEEDS_MANUAL_RELOC, CONFIG_SYS_GENERIC_GLOBAL_DATA etc. options.
This r2dplus board change allows immediately check the correctness of the series on a r2dplus qemu target, note that the second copy is not avoided in this case, also for simplicity SDRAM area up to text base is large enough to store malloc pool and two copies of loaded code/data.
The change was tested on one custom SH4 (SH7551R) board, r2dplus qemu target (see also SH7751 PCI change under review), the rest of the boards are compile tested only.
Multiple kudos to Simon for great patience and a decision to not remove the code.
Vladimir Zapolskiy (24): sh4: cache: correct dcache flush to invalidate with write-back sh4: cache: correct flush_cache() to writeback and invalidate sh3: remove unused cache.c file from being built sh: cache use jump_to_P2() and back_to_P1() from asm/system.h sh: cache: don't modify CCR from P1 area sh4: cache: move exported cache manipulation functions into cache.c pci: sh7751: fix up PCI I/O space address pci: sh7751: map PCI memory space into SDRAM sh4: remove __io config options from r2dplus and r7780mp boards r2dplus: use P1 area space for text base and PCI system memory r2dplus: select rtl8139 driver in defconfig common: sh: add necessary define bits to board_f sh4: use single u-boot linker script for all boards sh: place board lowlevel_init code in the beginning of .text sh: define entry point and reloc_dst inside a linker script sh: add MEMORY command to a shared linker script sh: remove undefined DEBUG preprocessor token from board config files sh: define CONFIG_DISPLAY_BOARDINFO to print board information sh: add common dram_init() function for all boards sh: add shared relocate_code() function and call board_init_r() sh4: fix start.S by calling board_init_f() after first code relocation sh: share the correct version of start.S among all cpus sh: generate position independent code for all platforms r2dplus: fixup CONFIG_SYS_TEXT_BASE to account arch/sh changes
arch/sh/Makefile | 2 +- arch/sh/config.mk | 2 +- arch/sh/cpu/sh2/Makefile | 1 - arch/sh/cpu/sh2/cpu.c | 6 -- arch/sh/cpu/sh3/Makefile | 3 +- arch/sh/cpu/sh3/cache.c | 96 ------------------------------ arch/sh/cpu/sh3/cpu.c | 6 -- arch/sh/cpu/sh3/start.S | 65 -------------------- arch/sh/cpu/sh4/Makefile | 1 - arch/sh/cpu/sh4/cache.c | 88 +++++++++++++-------------- arch/sh/cpu/sh4/cpu.c | 40 ------------- arch/sh/cpu/sh4/start.S | 62 ------------------- arch/sh/cpu/u-boot.lds | 44 +++++++------- arch/sh/include/asm/cache.h | 2 - arch/sh/include/asm/io.h | 10 ---- arch/sh/lib/Makefile | 2 + arch/sh/lib/board.c | 35 +++++++++++ arch/sh/{cpu/sh2 => lib}/start.S | 33 +++++----- board/alphaproject/ap_sh4a_4a/Makefile | 2 +- board/alphaproject/ap_sh4a_4a/ap_sh4a_4a.c | 11 ---- board/espt/Makefile | 2 +- board/espt/espt.c | 10 ---- board/mpr2/Makefile | 2 +- board/mpr2/mpr2.c | 10 ---- board/ms7720se/Makefile | 2 +- board/ms7720se/ms7720se.c | 10 ---- board/ms7722se/Makefile | 2 +- board/ms7722se/ms7722se.c | 10 ---- board/ms7750se/Makefile | 2 +- board/ms7750se/ms7750se.c | 10 ---- board/renesas/MigoR/Makefile | 2 +- board/renesas/MigoR/migo_r.c | 10 ---- board/renesas/ap325rxa/Makefile | 2 +- board/renesas/ap325rxa/ap325rxa.c | 10 ---- board/renesas/ecovec/Makefile | 2 +- board/renesas/ecovec/ecovec.c | 10 ---- board/renesas/r0p7734/Makefile | 2 +- board/renesas/r0p7734/r0p7734.c | 11 ---- board/renesas/r2dplus/Makefile | 2 +- board/renesas/r2dplus/r2dplus.c | 10 ---- board/renesas/r7780mp/Makefile | 2 +- board/renesas/r7780mp/r7780mp.c | 10 ---- board/renesas/rsk7203/Makefile | 2 +- board/renesas/rsk7203/rsk7203.c | 10 ---- board/renesas/rsk7264/Makefile | 2 +- board/renesas/rsk7264/rsk7264.c | 10 ---- board/renesas/rsk7269/Makefile | 2 +- board/renesas/rsk7269/rsk7269.c | 10 ---- board/renesas/sh7752evb/Makefile | 2 +- board/renesas/sh7752evb/sh7752evb.c | 11 ---- board/renesas/sh7752evb/u-boot.lds | 82 ------------------------- board/renesas/sh7753evb/Makefile | 2 +- board/renesas/sh7753evb/sh7753evb.c | 11 ---- board/renesas/sh7753evb/u-boot.lds | 82 ------------------------- board/renesas/sh7757lcr/Makefile | 2 +- board/renesas/sh7757lcr/sh7757lcr.c | 25 -------- board/renesas/sh7757lcr/u-boot.lds | 83 -------------------------- board/renesas/sh7763rdp/Makefile | 2 +- board/renesas/sh7763rdp/sh7763rdp.c | 10 ---- board/renesas/sh7785lcr/Makefile | 2 +- board/renesas/sh7785lcr/sh7785lcr.c | 10 ---- board/shmin/Makefile | 2 +- board/shmin/shmin.c | 10 ---- common/board_f.c | 15 +++-- configs/r2dplus_defconfig | 2 + drivers/pci/pci_sh7751.c | 12 ++-- include/configs/MigoR.h | 2 +- include/configs/ap325rxa.h | 2 +- include/configs/ap_sh4a_4a.h | 2 +- include/configs/ecovec.h | 2 +- include/configs/espt.h | 1 + include/configs/mpr2.h | 2 + include/configs/ms7720se.h | 1 + include/configs/ms7722se.h | 1 + include/configs/ms7750se.h | 2 + include/configs/r0p7734.h | 2 +- include/configs/r2dplus.h | 15 +++-- include/configs/r7780mp.h | 4 +- include/configs/rsk7203.h | 2 +- include/configs/rsk7264.h | 3 +- include/configs/rsk7269.h | 3 +- include/configs/sh7752evb.h | 3 +- include/configs/sh7753evb.h | 3 +- include/configs/sh7757lcr.h | 3 +- include/configs/sh7763rdp.h | 1 + include/configs/sh7785lcr.h | 2 +- include/configs/shmin.h | 1 + 87 files changed, 190 insertions(+), 912 deletions(-) delete mode 100644 arch/sh/cpu/sh3/cache.c delete mode 100644 arch/sh/cpu/sh3/start.S delete mode 100644 arch/sh/cpu/sh4/start.S create mode 100644 arch/sh/lib/board.c rename arch/sh/{cpu/sh2 => lib}/start.S (56%) delete mode 100644 board/renesas/sh7752evb/u-boot.lds delete mode 100644 board/renesas/sh7753evb/u-boot.lds delete mode 100644 board/renesas/sh7757lcr/u-boot.lds

In common usecases flush_cache() assumes both cache invalidation and write-back to memory, thus in flush_dcache_range() implementation change SH4 cache write-back only instruction 'ocbwb' with cache purge instruction 'ocbp', according to the User's Manual there should be no performance penalty for that.
Note that under circumstances only cache invalidation is expected from flush_cache() call, in these occasional cases the current version of flush_cache() works, which is a wrapper over invalidate_dcache_range() at the moment, this will be fixed in the following change.
Signed-off-by: Vladimir Zapolskiy vz@mleia.com --- arch/sh/cpu/sh4/cache.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/sh/cpu/sh4/cache.c b/arch/sh/cpu/sh4/cache.c index e1ee970..b3e5fd5 100644 --- a/arch/sh/cpu/sh4/cache.c +++ b/arch/sh/cpu/sh4/cache.c @@ -97,7 +97,7 @@ void flush_dcache_range(unsigned long start, unsigned long end)
start &= ~(L1_CACHE_BYTES - 1); for (v = start; v < end; v += L1_CACHE_BYTES) { - asm volatile ("ocbwb %0" : /* no output */ + asm volatile ("ocbp %0" : /* no output */ : "m" (__m(v))); } }

On Mon, Nov 28, 2016 at 12:15:13AM +0200, Vladimir Zapolskiy wrote:
In common usecases flush_cache() assumes both cache invalidation and write-back to memory, thus in flush_dcache_range() implementation change SH4 cache write-back only instruction 'ocbwb' with cache purge instruction 'ocbp', according to the User's Manual there should be no performance penalty for that.
Note that under circumstances only cache invalidation is expected from flush_cache() call, in these occasional cases the current version of flush_cache() works, which is a wrapper over invalidate_dcache_range() at the moment, this will be fixed in the following change.
Signed-off-by: Vladimir Zapolskiy vz@mleia.com
Applied to u-boot/master, thanks!

In common usecases flush_cache() assumes both cache invalidation and write-back to memory, instead of doing cache invalidation only with the wrapped 'ocbi' instruction pin flush_cache() to cache invalidation with memory write-back done by 'ocbp'.
Signed-off-by: Vladimir Zapolskiy vz@mleia.com --- arch/sh/cpu/sh4/cpu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/sh/cpu/sh4/cpu.c b/arch/sh/cpu/sh4/cpu.c index de90ca7..a2cec98 100644 --- a/arch/sh/cpu/sh4/cpu.c +++ b/arch/sh/cpu/sh4/cpu.c @@ -37,7 +37,7 @@ int do_reset (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
void flush_cache (unsigned long addr, unsigned long size) { - invalidate_dcache_range(addr , addr + size); + flush_dcache_range(addr , addr + size); }
void icache_enable (void)

On 27 November 2016 at 15:15, Vladimir Zapolskiy vz@mleia.com wrote:
In common usecases flush_cache() assumes both cache invalidation and write-back to memory, instead of doing cache invalidation only with the wrapped 'ocbi' instruction pin flush_cache() to cache invalidation with memory write-back done by 'ocbp'.
Signed-off-by: Vladimir Zapolskiy vz@mleia.com
arch/sh/cpu/sh4/cpu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Reviewed-by: Simon Glass sjg@chromium.org

On Mon, Nov 28, 2016 at 12:15:14AM +0200, Vladimir Zapolskiy wrote:
In common usecases flush_cache() assumes both cache invalidation and write-back to memory, instead of doing cache invalidation only with the wrapped 'ocbi' instruction pin flush_cache() to cache invalidation with memory write-back done by 'ocbp'.
Signed-off-by: Vladimir Zapolskiy vz@mleia.com Reviewed-by: Simon Glass sjg@chromium.org
Applied to u-boot/master, thanks!

The change is similar to commit 994b56616bae ("sh: delete an unused source file") for SH2, however here the removed cache.c file was built and included into an image as a dead code.
If it is needed in future the contents can be reused from a similar arch/sh/cpu/sh4/cache.c file, which is in turn will be moved to a shared among all core flavours location at arch/sh/lib/cache.c.
Signed-off-by: Vladimir Zapolskiy vz@mleia.com --- arch/sh/cpu/sh3/Makefile | 2 +- arch/sh/cpu/sh3/cache.c | 96 ------------------------------------------------ 2 files changed, 1 insertion(+), 97 deletions(-) delete mode 100644 arch/sh/cpu/sh3/cache.c
diff --git a/arch/sh/cpu/sh3/Makefile b/arch/sh/cpu/sh3/Makefile index 1dccaf9..85917b9 100644 --- a/arch/sh/cpu/sh3/Makefile +++ b/arch/sh/cpu/sh3/Makefile @@ -12,4 +12,4 @@ #
extra-y = start.o -obj-y = cpu.o interrupts.o watchdog.o cache.o +obj-y = cpu.o interrupts.o watchdog.o diff --git a/arch/sh/cpu/sh3/cache.c b/arch/sh/cpu/sh3/cache.c deleted file mode 100644 index 34cbbff..0000000 --- a/arch/sh/cpu/sh3/cache.c +++ /dev/null @@ -1,96 +0,0 @@ -/* - * (C) Copyright 2007 - * Yoshihiro Shimoda shimoda.yoshihiro@renesas.com - * - * (C) Copyright 2007 - * Nobobuhiro Iwamatsu iwamatsu@nigauri.org - * - * SPDX-License-Identifier: GPL-2.0+ - */ - -#include <common.h> -#include <command.h> -#include <asm/processor.h> -#include <asm/io.h> - -/* - * Jump to P2 area. - * When handling TLB or caches, we need to do it from P2 area. - */ -#define jump_to_P2() \ - do { \ - unsigned long __dummy; \ - __asm__ __volatile__( \ - "mov.l 1f, %0\n\t" \ - "or %1, %0\n\t" \ - "jmp @%0\n\t" \ - " nop\n\t" \ - ".balign 4\n" \ - "1: .long 2f\n" \ - "2:" \ - : "=&r" (__dummy) \ - : "r" (0x20000000)); \ - } while (0) - -/* - * Back to P1 area. - */ -#define back_to_P1() \ - do { \ - unsigned long __dummy; \ - __asm__ __volatile__( \ - "nop;nop;nop;nop;nop;nop;nop\n\t" \ - "mov.l 1f, %0\n\t" \ - "jmp @%0\n\t" \ - " nop\n\t" \ - ".balign 4\n" \ - "1: .long 2f\n" \ - "2:" \ - : "=&r" (__dummy)); \ - } while (0) - -#define CACHE_VALID 1 -#define CACHE_UPDATED 2 - -static inline void cache_wback_all(void) -{ - unsigned long addr, data, i, j; - - jump_to_P2(); - for (i = 0; i < CACHE_OC_NUM_ENTRIES; i++) { - for (j = 0; j < CACHE_OC_NUM_WAYS; j++) { - addr = CACHE_OC_ADDRESS_ARRAY - | (j << CACHE_OC_WAY_SHIFT) - | (i << CACHE_OC_ENTRY_SHIFT); - data = inl(addr); - if (data & CACHE_UPDATED) { - data &= ~CACHE_UPDATED; - outl(data, addr); - } - } - } - back_to_P1(); -} - - -#define CACHE_ENABLE 0 -#define CACHE_DISABLE 1 - -int cache_control(unsigned int cmd) -{ - unsigned long ccr; - - jump_to_P2(); - ccr = inl(CCR); - - if (ccr & CCR_CACHE_ENABLE) - cache_wback_all(); - - if (cmd == CACHE_DISABLE) - outl(CCR_CACHE_STOP, CCR); - else - outl(CCR_CACHE_INIT, CCR); - back_to_P1(); - - return 0; -}

On 27 November 2016 at 15:15, Vladimir Zapolskiy vz@mleia.com wrote:
The change is similar to commit 994b56616bae ("sh: delete an unused source file") for SH2, however here the removed cache.c file was built and included into an image as a dead code.
If it is needed in future the contents can be reused from a similar arch/sh/cpu/sh4/cache.c file, which is in turn will be moved to a shared among all core flavours location at arch/sh/lib/cache.c.
Signed-off-by: Vladimir Zapolskiy vz@mleia.com
arch/sh/cpu/sh3/Makefile | 2 +- arch/sh/cpu/sh3/cache.c | 96 ------------------------------------------------ 2 files changed, 1 insertion(+), 97 deletions(-) delete mode 100644 arch/sh/cpu/sh3/cache.c
Reviewed-by: Simon Glass sjg@chromium.org

On Mon, Nov 28, 2016 at 12:15:15AM +0200, Vladimir Zapolskiy wrote:
The change is similar to commit 994b56616bae ("sh: delete an unused source file") for SH2, however here the removed cache.c file was built and included into an image as a dead code.
If it is needed in future the contents can be reused from a similar arch/sh/cpu/sh4/cache.c file, which is in turn will be moved to a shared among all core flavours location at arch/sh/lib/cache.c.
Signed-off-by: Vladimir Zapolskiy vz@mleia.com Reviewed-by: Simon Glass sjg@chromium.org
Applied to u-boot/master, thanks!

Both jump_to_P2() and back_to_P1() functions are found in asm/system.h header file and functionally they are the same, don't redefine them.
Signed-off-by: Vladimir Zapolskiy vz@mleia.com --- arch/sh/cpu/sh4/cache.c | 39 ++------------------------------------- 1 file changed, 2 insertions(+), 37 deletions(-)
diff --git a/arch/sh/cpu/sh4/cache.c b/arch/sh/cpu/sh4/cache.c index b3e5fd5..50695b6 100644 --- a/arch/sh/cpu/sh4/cache.c +++ b/arch/sh/cpu/sh4/cache.c @@ -7,44 +7,9 @@
#include <common.h> #include <command.h> -#include <asm/processor.h> #include <asm/io.h> - -/* - * Jump to P2 area. - * When handling TLB or caches, we need to do it from P2 area. - */ -#define jump_to_P2() \ - do { \ - unsigned long __dummy; \ - __asm__ __volatile__( \ - "mov.l 1f, %0\n\t" \ - "or %1, %0\n\t" \ - "jmp @%0\n\t" \ - " nop\n\t" \ - ".balign 4\n" \ - "1: .long 2f\n" \ - "2:" \ - : "=&r" (__dummy) \ - : "r" (0x20000000)); \ - } while (0) - -/* - * Back to P1 area. - */ -#define back_to_P1() \ - do { \ - unsigned long __dummy; \ - __asm__ __volatile__( \ - "nop;nop;nop;nop;nop;nop;nop\n\t" \ - "mov.l 1f, %0\n\t" \ - "jmp @%0\n\t" \ - " nop\n\t" \ - ".balign 4\n" \ - "1: .long 2f\n" \ - "2:" \ - : "=&r" (__dummy)); \ - } while (0) +#include <asm/processor.h> +#include <asm/system.h>
#define CACHE_VALID 1 #define CACHE_UPDATED 2

On 27 November 2016 at 15:15, Vladimir Zapolskiy vz@mleia.com wrote:
Both jump_to_P2() and back_to_P1() functions are found in asm/system.h header file and functionally they are the same, don't redefine them.
Signed-off-by: Vladimir Zapolskiy vz@mleia.com
arch/sh/cpu/sh4/cache.c | 39 ++------------------------------------- 1 file changed, 2 insertions(+), 37 deletions(-)
Reviewed-by: Simon Glass sjg@chromium.org

On Mon, Nov 28, 2016 at 12:15:16AM +0200, Vladimir Zapolskiy wrote:
Both jump_to_P2() and back_to_P1() functions are found in asm/system.h header file and functionally they are the same, don't redefine them.
Signed-off-by: Vladimir Zapolskiy vz@mleia.com Reviewed-by: Simon Glass sjg@chromium.org
Applied to u-boot/master, thanks!

cache_wback_all() is a local function and it is called from cache_control() only, which is in turn jumps to P2 area.
The change fixes an issue when cache_wback_all() returns from P2 to P1, however cache_control() continues to manipulate with CCR register, according to the User's Manual this is restricted.
Signed-off-by: Vladimir Zapolskiy vz@mleia.com --- arch/sh/cpu/sh4/cache.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/arch/sh/cpu/sh4/cache.c b/arch/sh/cpu/sh4/cache.c index 50695b6..7750f0f 100644 --- a/arch/sh/cpu/sh4/cache.c +++ b/arch/sh/cpu/sh4/cache.c @@ -18,10 +18,10 @@ static inline void cache_wback_all(void) { unsigned long addr, data, i, j;
- jump_to_P2(); - for (i = 0; i < CACHE_OC_NUM_ENTRIES; i++){ + for (i = 0; i < CACHE_OC_NUM_ENTRIES; i++) { for (j = 0; j < CACHE_OC_NUM_WAYS; j++) { - addr = CACHE_OC_ADDRESS_ARRAY | (j << CACHE_OC_WAY_SHIFT) + addr = CACHE_OC_ADDRESS_ARRAY + | (j << CACHE_OC_WAY_SHIFT) | (i << CACHE_OC_ENTRY_SHIFT); data = inl(addr); if (data & CACHE_UPDATED) { @@ -30,10 +30,8 @@ static inline void cache_wback_all(void) } } } - back_to_P1(); }
- #define CACHE_ENABLE 0 #define CACHE_DISABLE 1

On Mon, Nov 28, 2016 at 12:15:17AM +0200, Vladimir Zapolskiy wrote:
cache_wback_all() is a local function and it is called from cache_control() only, which is in turn jumps to P2 area.
The change fixes an issue when cache_wback_all() returns from P2 to P1, however cache_control() continues to manipulate with CCR register, according to the User's Manual this is restricted.
Signed-off-by: Vladimir Zapolskiy vz@mleia.com
Applied to u-boot/master, thanks!

No functional change, moving cache manipulation functions into cache.c allows to collect all of them in a single location and as a pleasant side effect cache_control() function can be unexported now.
Signed-off-by: Vladimir Zapolskiy vz@mleia.com --- arch/sh/cpu/sh4/cache.c | 39 ++++++++++++++++++++++++++++++++++++--- arch/sh/cpu/sh4/cpu.c | 34 ---------------------------------- arch/sh/include/asm/cache.h | 2 -- 3 files changed, 36 insertions(+), 39 deletions(-)
diff --git a/arch/sh/cpu/sh4/cache.c b/arch/sh/cpu/sh4/cache.c index 7750f0f..6175c67 100644 --- a/arch/sh/cpu/sh4/cache.c +++ b/arch/sh/cpu/sh4/cache.c @@ -1,6 +1,6 @@ /* - * (C) Copyright 2007 - * Nobuhiro Iwamatsu iwamatsu@nigauri.org + * (C) Copyright 2016 Vladimir Zapolskiy vz@mleia.com + * (C) Copyright 2007 Nobuhiro Iwamatsu iwamatsu@nigauri.org * * SPDX-License-Identifier: GPL-2.0+ */ @@ -35,7 +35,7 @@ static inline void cache_wback_all(void) #define CACHE_ENABLE 0 #define CACHE_DISABLE 1
-int cache_control(unsigned int cmd) +static int cache_control(unsigned int cmd) { unsigned long ccr;
@@ -75,3 +75,36 @@ void invalidate_dcache_range(unsigned long start, unsigned long end) : "m" (__m(v))); } } + +void flush_cache(unsigned long addr, unsigned long size) +{ + flush_dcache_range(addr , addr + size); +} + +void icache_enable(void) +{ + cache_control(CACHE_ENABLE); +} + +void icache_disable(void) +{ + cache_control(CACHE_DISABLE); +} + +int icache_status(void) +{ + return 0; +} + +void dcache_enable(void) +{ +} + +void dcache_disable(void) +{ +} + +int dcache_status(void) +{ + return 0; +} diff --git a/arch/sh/cpu/sh4/cpu.c b/arch/sh/cpu/sh4/cpu.c index a2cec98..49c58ae 100644 --- a/arch/sh/cpu/sh4/cpu.c +++ b/arch/sh/cpu/sh4/cpu.c @@ -9,7 +9,6 @@ #include <command.h> #include <netdev.h> #include <asm/processor.h> -#include <asm/cache.h>
int checkcpu(void) { @@ -35,39 +34,6 @@ int do_reset (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) return 0; }
-void flush_cache (unsigned long addr, unsigned long size) -{ - flush_dcache_range(addr , addr + size); -} - -void icache_enable (void) -{ - cache_control(0); -} - -void icache_disable (void) -{ - cache_control(1); -} - -int icache_status (void) -{ - return 0; -} - -void dcache_enable (void) -{ -} - -void dcache_disable (void) -{ -} - -int dcache_status (void) -{ - return 0; -} - int cpu_eth_init(bd_t *bis) { #ifdef CONFIG_SH_ETHER diff --git a/arch/sh/include/asm/cache.h b/arch/sh/include/asm/cache.h index abaf405..b548a35 100644 --- a/arch/sh/include/asm/cache.h +++ b/arch/sh/include/asm/cache.h @@ -3,8 +3,6 @@
#if defined(CONFIG_CPU_SH4)
-int cache_control(unsigned int cmd); - #define L1_CACHE_BYTES 32
struct __large_struct { unsigned long buf[100]; };

On 27 November 2016 at 15:15, Vladimir Zapolskiy vz@mleia.com wrote:
No functional change, moving cache manipulation functions into cache.c allows to collect all of them in a single location and as a pleasant side effect cache_control() function can be unexported now.
Signed-off-by: Vladimir Zapolskiy vz@mleia.com
arch/sh/cpu/sh4/cache.c | 39 ++++++++++++++++++++++++++++++++++++--- arch/sh/cpu/sh4/cpu.c | 34 ---------------------------------- arch/sh/include/asm/cache.h | 2 -- 3 files changed, 36 insertions(+), 39 deletions(-)
Reviewed-by: Simon Glass sjg@chromium.org

On Mon, Nov 28, 2016 at 12:15:18AM +0200, Vladimir Zapolskiy wrote:
No functional change, moving cache manipulation functions into cache.c allows to collect all of them in a single location and as a pleasant side effect cache_control() function can be unexported now.
Signed-off-by: Vladimir Zapolskiy vz@mleia.com Reviewed-by: Simon Glass sjg@chromium.org
Applied to u-boot/master, thanks!

The change actually maps PCI I/O window to the same address on PCI bus as it is stated by a comment, before the change transfers to the PCI I/O space are failed due to misconfiguration of the most significant 14 bits of the PCI address in PCIIOBR (note that it is set to 0x0).
Most probably the problem remained unnoticed, because communcation to all tested PCI devices is done over PCI memory space only.
Signed-off-by: Vladimir Zapolskiy vz@mleia.com --- drivers/pci/pci_sh7751.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/pci/pci_sh7751.c b/drivers/pci/pci_sh7751.c index f189ed8..420ae81 100644 --- a/drivers/pci/pci_sh7751.c +++ b/drivers/pci/pci_sh7751.c @@ -164,7 +164,7 @@ int pci_sh7751_init(struct pci_controller *hose) p4_out(SH7751_PCI_MEM_BASE, SH7751_PCIMBR);
/* Map IO window to same address on PCI bus */ - p4_out(0x2000 & 0xfffc0000, SH7751_PCIIOBR); + p4_out(SH7751_PCI_IO_BASE, SH7751_PCIIOBR);
/* set BREQEN */ p4_out(inl(SH7751_BCR1) | 0x00080000, SH7751_BCR1);

On Mon, Nov 28, 2016 at 12:15:19AM +0200, Vladimir Zapolskiy wrote:
The change actually maps PCI I/O window to the same address on PCI bus as it is stated by a comment, before the change transfers to the PCI I/O space are failed due to misconfiguration of the most significant 14 bits of the PCI address in PCIIOBR (note that it is set to 0x0).
Most probably the problem remained unnoticed, because communcation to all tested PCI devices is done over PCI memory space only.
Signed-off-by: Vladimir Zapolskiy vz@mleia.com
Applied to u-boot/master, thanks!

For ease of use and accounting a condition that on SH4 pci_phys_to_bus() and pci_bus_to_phys() are one in one mappings due to unimplemented __iomem() conversion, this change fixes access to SDRAM memory by PCI devices.
This change also generalizes PCI system memory configuration, which is taken from board specific defines rather than hardcoded in the PCI host driver.
Signed-off-by: Vladimir Zapolskiy vz@mleia.com --- drivers/pci/pci_sh7751.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-)
diff --git a/drivers/pci/pci_sh7751.c b/drivers/pci/pci_sh7751.c index 420ae81..8a50445 100644 --- a/drivers/pci/pci_sh7751.c +++ b/drivers/pci/pci_sh7751.c @@ -66,9 +66,6 @@ #define SH7751_PCI_IO_BASE 0xFE240000 #define SH7751_PCI_IO_SIZE 0x00040000
-#define SH7751_CS3_BASE_ADDR 0x0C000000 -#define SH7751_P2CS3_BASE_ADDR 0xAC000000 - #define SH7751_PCIPAR (vu_long *)0xFE2001C0 #define SH7751_PCIPDR (vu_long *)0xFE200220
@@ -153,11 +150,12 @@ int pci_sh7751_init(struct pci_controller *hose)
/* Set up target memory mappings (for external DMA access) */ /* Map both P0 and P2 range to Area 3 RAM for ease of use */ - p4_out((64 - 1) << 20, SH7751_PCILSR0); - p4_out(SH7751_CS3_BASE_ADDR, SH7751_PCILAR0); + p4_out(CONFIG_SYS_SDRAM_SIZE - 0x100000, SH7751_PCILSR0); + p4_out(CONFIG_SYS_SDRAM_BASE & 0x1FF00000, SH7751_PCILAR0); + p4_out(CONFIG_SYS_SDRAM_BASE & 0xFFF00000, SH7751_PCICONF5); + p4_out(0, SH7751_PCILSR1); p4_out(0, SH7751_PCILAR1); - p4_out(SH7751_CS3_BASE_ADDR, SH7751_PCICONF5); p4_out(0xd0000000, SH7751_PCICONF6);
/* Map memory window to same address on PCI bus */

On Mon, Nov 28, 2016 at 12:15:20AM +0200, Vladimir Zapolskiy wrote:
For ease of use and accounting a condition that on SH4 pci_phys_to_bus() and pci_bus_to_phys() are one in one mappings due to unimplemented __iomem() conversion, this change fixes access to SDRAM memory by PCI devices.
This change also generalizes PCI system memory configuration, which is taken from board specific defines rather than hardcoded in the PCI host driver.
Signed-off-by: Vladimir Zapolskiy vz@mleia.com
Applied to u-boot/master, thanks!

Defined __io is no-op for the SH architecture and it can be removed from board files without any functional change.
Signed-off-by: Vladimir Zapolskiy vz@mleia.com --- arch/sh/include/asm/io.h | 10 ---------- include/configs/r2dplus.h | 1 - include/configs/r7780mp.h | 1 - 3 files changed, 12 deletions(-)
diff --git a/arch/sh/include/asm/io.h b/arch/sh/include/asm/io.h index 5dc27be..5cb000c 100644 --- a/arch/sh/include/asm/io.h +++ b/arch/sh/include/asm/io.h @@ -68,13 +68,6 @@ extern void __raw_readsl(unsigned int addr, void *data, int longlen); #define __raw_base_readl(base, off) __arch_base_getl(base, off)
/* - * Now, pick up the machine-defined IO definitions - */ -#if 0 /* XXX###XXX */ -#include <asm/arch/io.h> -#endif /* XXX###XXX */ - -/* * IO port access primitives * ------------------------- * @@ -82,9 +75,6 @@ extern void __raw_readsl(unsigned int addr, void *data, int longlen); * mapped. Note that these are defined to perform little endian accesses * only. Their primary purpose is to access PCI and ISA peripherals. * - * The machine specific io.h include defines __io to translate an "IO" - * address to a memory address. - * * Note that we prevent GCC re-ordering or caching values in expressions * by introducing sequence points into the in*() definitions. Note that * __raw_* do not guarantee this behaviour. diff --git a/include/configs/r2dplus.h b/include/configs/r2dplus.h index 477f035..2186915 100644 --- a/include/configs/r2dplus.h +++ b/include/configs/r2dplus.h @@ -91,7 +91,6 @@ #define CONFIG_SH4_PCI #define CONFIG_SH7751_PCI #define CONFIG_PCI_SCAN_SHOW 1 -#define __io #define __mem_pci
#define CONFIG_PCI_MEM_BUS 0xFD000000 /* Memory space base addr */ diff --git a/include/configs/r7780mp.h b/include/configs/r7780mp.h index d4f200a..42d5135 100644 --- a/include/configs/r7780mp.h +++ b/include/configs/r7780mp.h @@ -100,7 +100,6 @@ #define CONFIG_SH7780_PCI_LAR CONFIG_SYS_SDRAM_SIZE #define CONFIG_SH7780_PCI_BAR CONFIG_SYS_SDRAM_SIZE #define CONFIG_PCI_SCAN_SHOW 1 -#define __io #define __mem_pci
#define CONFIG_PCI_MEM_BUS 0xFD000000 /* Memory space base addr */

On 27 November 2016 at 15:15, Vladimir Zapolskiy vz@mleia.com wrote:
Defined __io is no-op for the SH architecture and it can be removed from board files without any functional change.
Signed-off-by: Vladimir Zapolskiy vz@mleia.com
arch/sh/include/asm/io.h | 10 ---------- include/configs/r2dplus.h | 1 - include/configs/r7780mp.h | 1 - 3 files changed, 12 deletions(-)
Reviewed-by: Simon Glass sjg@chromium.org

On Mon, Nov 28, 2016 at 12:15:21AM +0200, Vladimir Zapolskiy wrote:
Defined __io is no-op for the SH architecture and it can be removed from board files without any functional change.
Signed-off-by: Vladimir Zapolskiy vz@mleia.com Reviewed-by: Simon Glass sjg@chromium.org
Applied to u-boot/master, thanks!

While both options are acceptable use P1 area physical addresses instead of external memory space of text base and PCI system memory for unification purposes, all other supported superh boards have the same selection.
This allows to easily ensure that CONFIG_SYS_TEXT_BASE is located within available DRAM.
Signed-off-by: Vladimir Zapolskiy vz@mleia.com --- include/configs/r2dplus.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/include/configs/r2dplus.h b/include/configs/r2dplus.h index 2186915..21bfe72 100644 --- a/include/configs/r2dplus.h +++ b/include/configs/r2dplus.h @@ -26,10 +26,10 @@ #define CONFIG_ENV_OVERWRITE 1
/* SDRAM */ -#define CONFIG_SYS_SDRAM_BASE (0x8C000000) -#define CONFIG_SYS_SDRAM_SIZE (0x04000000) +#define CONFIG_SYS_SDRAM_BASE 0x8C000000 +#define CONFIG_SYS_SDRAM_SIZE 0x04000000
-#define CONFIG_SYS_TEXT_BASE 0x0FFC0000 +#define CONFIG_SYS_TEXT_BASE 0x8FFC0000 #define CONFIG_SYS_LONGHELP #define CONFIG_SYS_CBSIZE 256 #define CONFIG_SYS_PBSIZE 256 @@ -99,8 +99,8 @@ #define CONFIG_PCI_IO_BUS 0xFE240000 /* IO space base address */ #define CONFIG_PCI_IO_PHYS CONFIG_PCI_IO_BUS #define CONFIG_PCI_IO_SIZE 0x00040000 /* Size of IO window */ -#define CONFIG_PCI_SYS_BUS (CONFIG_SYS_SDRAM_BASE & 0x1fffffff) -#define CONFIG_PCI_SYS_PHYS (CONFIG_SYS_SDRAM_BASE & 0x1fffffff) +#define CONFIG_PCI_SYS_BUS CONFIG_SYS_SDRAM_BASE +#define CONFIG_PCI_SYS_PHYS CONFIG_SYS_SDRAM_BASE #define CONFIG_PCI_SYS_SIZE CONFIG_SYS_SDRAM_SIZE
#endif /* __CONFIG_H */

On 27 November 2016 at 15:15, Vladimir Zapolskiy vz@mleia.com wrote:
While both options are acceptable use P1 area physical addresses instead of external memory space of text base and PCI system memory for unification purposes, all other supported superh boards have the same selection.
This allows to easily ensure that CONFIG_SYS_TEXT_BASE is located within available DRAM.
Signed-off-by: Vladimir Zapolskiy vz@mleia.com
include/configs/r2dplus.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
Reviewed-by: Simon Glass sjg@chromium.org
But it is probably nice to move this to DM_PCI.

On Mon, Nov 28, 2016 at 12:15:22AM +0200, Vladimir Zapolskiy wrote:
While both options are acceptable use P1 area physical addresses instead of external memory space of text base and PCI system memory for unification purposes, all other supported superh boards have the same selection.
This allows to easily ensure that CONFIG_SYS_TEXT_BASE is located within available DRAM.
Signed-off-by: Vladimir Zapolskiy vz@mleia.com Reviewed-by: Simon Glass sjg@chromium.org
Applied to u-boot/master, thanks!

CONFIG_RTL8139 was moved to a board defconfig by a commit 86e9dc86b1a2 ("net: Move CONFIG_RTL8139 to Kconfig"), however it was done incorrectly due to a missing CONFIG_NETDEVICES selection, thus virtually it was just a removal of the driver compilation.
As an unlucky consequence the option was completely removed by a purge commit adad96e60d0e ("configs: Re-sync HUSH options"), restore the driver inclusion back.
Signed-off-by: Vladimir Zapolskiy vz@mleia.com --- configs/r2dplus_defconfig | 2 ++ 1 file changed, 2 insertions(+)
diff --git a/configs/r2dplus_defconfig b/configs/r2dplus_defconfig index f4dc68e..2637723 100644 --- a/configs/r2dplus_defconfig +++ b/configs/r2dplus_defconfig @@ -5,5 +5,7 @@ CONFIG_BOOTDELAY=-1 CONFIG_CMD_PING=y CONFIG_CMD_CACHE=y CONFIG_CMD_EXT2=y +CONFIG_NETDEVICES=y +CONFIG_RTL8139=y CONFIG_PCI=y CONFIG_USE_PRIVATE_LIBGCC=y

On 27 November 2016 at 15:15, Vladimir Zapolskiy vz@mleia.com wrote:
CONFIG_RTL8139 was moved to a board defconfig by a commit 86e9dc86b1a2 ("net: Move CONFIG_RTL8139 to Kconfig"), however it was done incorrectly due to a missing CONFIG_NETDEVICES selection, thus virtually it was just a removal of the driver compilation.
As an unlucky consequence the option was completely removed by a purge commit adad96e60d0e ("configs: Re-sync HUSH options"), restore the driver inclusion back.
Signed-off-by: Vladimir Zapolskiy vz@mleia.com
configs/r2dplus_defconfig | 2 ++ 1 file changed, 2 insertions(+)
Reviewed-by: Simon Glass sjg@chromium.org

On Mon, Nov 28, 2016 at 12:15:23AM +0200, Vladimir Zapolskiy wrote:
CONFIG_RTL8139 was moved to a board defconfig by a commit 86e9dc86b1a2 ("net: Move CONFIG_RTL8139 to Kconfig"), however it was done incorrectly due to a missing CONFIG_NETDEVICES selection, thus virtually it was just a removal of the driver compilation.
As an unlucky consequence the option was completely removed by a purge commit adad96e60d0e ("configs: Re-sync HUSH options"), restore the driver inclusion back.
Signed-off-by: Vladimir Zapolskiy vz@mleia.com Reviewed-by: Simon Glass sjg@chromium.org
Applied to u-boot/master, thanks!

Since a platform conversion to generic board support has not been accomplished some architecture specific bits are missing from board_f init sequence, the change adds a number of basic expected callbacks into early init sequence.
Signed-off-by: Vladimir Zapolskiy vz@mleia.com Reviewed-by: Simon Glass sjg@chromium.org --- common/board_f.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-)
diff --git a/common/board_f.c b/common/board_f.c index 4b74835..cc8aee7 100644 --- a/common/board_f.c +++ b/common/board_f.c @@ -276,7 +276,7 @@ static int setup_mon_len(void) #elif defined(CONFIG_BLACKFIN) || defined(CONFIG_NIOS2) || \ defined(CONFIG_XTENSA) gd->mon_len = CONFIG_SYS_MONITOR_LEN; -#elif defined(CONFIG_NDS32) +#elif defined(CONFIG_NDS32) || defined(CONFIG_SH) gd->mon_len = (ulong)(&__bss_end) - (ulong)(&_start); #elif defined(CONFIG_SYS_MONITOR_BASE) /* TODO: use (ulong)&__bss_end - (ulong)&__text_start; ? */ @@ -619,7 +619,8 @@ static int display_new_sp(void) return 0; }
-#if defined(CONFIG_PPC) || defined(CONFIG_M68K) || defined(CONFIG_MIPS) +#if defined(CONFIG_M68K) || defined(CONFIG_MIPS) || defined(CONFIG_PPC) || \ + defined(CONFIG_SH) static int setup_board_part1(void) { bd_t *bd = gd->bd; @@ -884,7 +885,7 @@ static init_fnc_t init_sequence_f[] = { #endif #if defined(CONFIG_ARM) || defined(CONFIG_MIPS) || \ defined(CONFIG_BLACKFIN) || defined(CONFIG_NDS32) || \ - defined(CONFIG_SPARC) + defined(CONFIG_SH) || defined(CONFIG_SPARC) timer_init, /* initialize timer */ #endif #ifdef CONFIG_SYS_ALLOC_DPRAM @@ -921,7 +922,7 @@ static init_fnc_t init_sequence_f[] = { #if defined(CONFIG_MPC83xx) prt_83xx_rsr, #endif -#if defined(CONFIG_PPC) || defined(CONFIG_M68K) +#if defined(CONFIG_PPC) || defined(CONFIG_M68K) || defined(CONFIG_SH) checkcpu, #endif print_cpuinfo, /* display cpu info (and speed) */ @@ -945,7 +946,8 @@ static init_fnc_t init_sequence_f[] = { announce_dram_init, /* TODO: unify all these dram functions? */ #if defined(CONFIG_ARM) || defined(CONFIG_X86) || defined(CONFIG_NDS32) || \ - defined(CONFIG_MICROBLAZE) || defined(CONFIG_AVR32) + defined(CONFIG_MICROBLAZE) || defined(CONFIG_AVR32) || \ + defined(CONFIG_SH) dram_init, /* configure available RAM banks */ #endif #if defined(CONFIG_MIPS) || defined(CONFIG_PPC) || defined(CONFIG_M68K) @@ -1023,7 +1025,8 @@ static init_fnc_t init_sequence_f[] = { reserve_stacks, setup_dram_config, show_dram_config, -#if defined(CONFIG_PPC) || defined(CONFIG_M68K) || defined(CONFIG_MIPS) +#if defined(CONFIG_M68K) || defined(CONFIG_MIPS) || defined(CONFIG_PPC) || \ + defined(CONFIG_SH) setup_board_part1, #endif #if defined(CONFIG_PPC) || defined(CONFIG_M68K)

On Mon, Nov 28, 2016 at 12:15:24AM +0200, Vladimir Zapolskiy wrote:
Since a platform conversion to generic board support has not been accomplished some architecture specific bits are missing from board_f init sequence, the change adds a number of basic expected callbacks into early init sequence.
Signed-off-by: Vladimir Zapolskiy vz@mleia.com Reviewed-by: Simon Glass sjg@chromium.org
Applied to u-boot/master, thanks!

Three supported SH4/SH4A boards with the bootloader image stored on SPI flash have own flavour of a linker script, in turn they are equal among each other. The only difference is that the text from lowlevel_init.o is placed right after start.o, which makes sense.
Note that .bss section is not marked as NOLOAD, because for about 10 years this is a default option of a GNU linker, either the attribute is found or not the resulting image file is the same.
Signed-off-by: Vladimir Zapolskiy vz@mleia.com --- arch/sh/cpu/u-boot.lds | 4 ++ board/renesas/sh7752evb/Makefile | 2 +- board/renesas/sh7752evb/u-boot.lds | 82 ------------------------------------- board/renesas/sh7753evb/Makefile | 2 +- board/renesas/sh7753evb/u-boot.lds | 82 ------------------------------------- board/renesas/sh7757lcr/Makefile | 2 +- board/renesas/sh7757lcr/u-boot.lds | 83 -------------------------------------- include/configs/sh7752evb.h | 1 - include/configs/sh7753evb.h | 1 - include/configs/sh7757lcr.h | 1 - 10 files changed, 7 insertions(+), 253 deletions(-) delete mode 100644 board/renesas/sh7752evb/u-boot.lds delete mode 100644 board/renesas/sh7753evb/u-boot.lds delete mode 100644 board/renesas/sh7757lcr/u-boot.lds
diff --git a/arch/sh/cpu/u-boot.lds b/arch/sh/cpu/u-boot.lds index 78611c2..6f38563 100644 --- a/arch/sh/cpu/u-boot.lds +++ b/arch/sh/cpu/u-boot.lds @@ -11,6 +11,8 @@ * SPDX-License-Identifier: GPL-2.0+ */
+#include "config.h" + OUTPUT_FORMAT("elf32-sh-linux", "elf32-sh-linux", "elf32-sh-linux") OUTPUT_ARCH(sh) ENTRY(_start) @@ -29,6 +31,8 @@ SECTIONS .text : { KEEP(*/start.o (.text)) + KEEP(CONFIG_BOARDDIR/lowlevel_init.o (.spiboot1.text)) + KEEP(*(.spiboot2.text)) . = ALIGN(8192); common/env_embedded.o (.ppcenv) . = ALIGN(8192); diff --git a/board/renesas/sh7752evb/Makefile b/board/renesas/sh7752evb/Makefile index 856af81..fb6eeec 100644 --- a/board/renesas/sh7752evb/Makefile +++ b/board/renesas/sh7752evb/Makefile @@ -4,4 +4,4 @@ # SPDX-License-Identifier: GPL-2.0+
obj-y := sh7752evb.o spi-boot.o -obj-y += lowlevel_init.o +extra-y += lowlevel_init.o diff --git a/board/renesas/sh7752evb/u-boot.lds b/board/renesas/sh7752evb/u-boot.lds deleted file mode 100644 index 6cd4056..0000000 --- a/board/renesas/sh7752evb/u-boot.lds +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Copyright (C) 2007 - * Nobuhiro Iwamatsu iwamatsu@nigauri.org - * - * Copyright (C) 2012 - * Yoshihiro Shimoda yoshihiro.shimoda.uh@renesas.com - * - * SPDX-License-Identifier: GPL-2.0+ - */ - -OUTPUT_FORMAT("elf32-sh-linux", "elf32-sh-linux", "elf32-sh-linux") -OUTPUT_ARCH(sh) -ENTRY(_start) - -SECTIONS -{ - /* - * entry and reloct_dst will be provided via ldflags - */ - . = .; - - PROVIDE (_ftext = .); - PROVIDE (_fcode = .); - PROVIDE (_start = .); - - .text : - { - KEEP(arch/sh/cpu/sh4/start.o (.text)) - *(.spiboot1.text) - *(.spiboot2.text) - . = ALIGN(8192); - common/env_embedded.o (.ppcenv) - . = ALIGN(8192); - common/env_embedded.o (.ppcenvr) - . = ALIGN(8192); - *(.text) - . = ALIGN(4); - } =0xFF - PROVIDE (_ecode = .); - .rodata : - { - *(SORT_BY_ALIGNMENT(SORT_BY_NAME(.rodata*))) - . = ALIGN(4); - } - PROVIDE (_etext = .); - - - PROVIDE (_fdata = .); - .data : - { - *(.data) - . = ALIGN(4); - } - PROVIDE (_edata = .); - - PROVIDE (_fgot = .); - .got : - { - *(.got) - . = ALIGN(4); - } - PROVIDE (_egot = .); - - .u_boot_list : { - KEEP(*(SORT(.u_boot_list*))); - } - - PROVIDE (__init_end = .); - PROVIDE (reloc_dst_end = .); - /* _reloc_dst_end = .; */ - - PROVIDE (bss_start = .); - PROVIDE (__bss_start = .); - .bss (NOLOAD) : - { - *(.bss) - . = ALIGN(4); - } - PROVIDE (bss_end = .); - - PROVIDE (__bss_end = .); -} diff --git a/board/renesas/sh7753evb/Makefile b/board/renesas/sh7753evb/Makefile index f7c8e94..4293142 100644 --- a/board/renesas/sh7753evb/Makefile +++ b/board/renesas/sh7753evb/Makefile @@ -4,4 +4,4 @@ # SPDX-License-Identifier: GPL-2.0+
obj-y := sh7753evb.o spi-boot.o -obj-y += lowlevel_init.o +extra-y += lowlevel_init.o diff --git a/board/renesas/sh7753evb/u-boot.lds b/board/renesas/sh7753evb/u-boot.lds deleted file mode 100644 index 6cd4056..0000000 --- a/board/renesas/sh7753evb/u-boot.lds +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Copyright (C) 2007 - * Nobuhiro Iwamatsu iwamatsu@nigauri.org - * - * Copyright (C) 2012 - * Yoshihiro Shimoda yoshihiro.shimoda.uh@renesas.com - * - * SPDX-License-Identifier: GPL-2.0+ - */ - -OUTPUT_FORMAT("elf32-sh-linux", "elf32-sh-linux", "elf32-sh-linux") -OUTPUT_ARCH(sh) -ENTRY(_start) - -SECTIONS -{ - /* - * entry and reloct_dst will be provided via ldflags - */ - . = .; - - PROVIDE (_ftext = .); - PROVIDE (_fcode = .); - PROVIDE (_start = .); - - .text : - { - KEEP(arch/sh/cpu/sh4/start.o (.text)) - *(.spiboot1.text) - *(.spiboot2.text) - . = ALIGN(8192); - common/env_embedded.o (.ppcenv) - . = ALIGN(8192); - common/env_embedded.o (.ppcenvr) - . = ALIGN(8192); - *(.text) - . = ALIGN(4); - } =0xFF - PROVIDE (_ecode = .); - .rodata : - { - *(SORT_BY_ALIGNMENT(SORT_BY_NAME(.rodata*))) - . = ALIGN(4); - } - PROVIDE (_etext = .); - - - PROVIDE (_fdata = .); - .data : - { - *(.data) - . = ALIGN(4); - } - PROVIDE (_edata = .); - - PROVIDE (_fgot = .); - .got : - { - *(.got) - . = ALIGN(4); - } - PROVIDE (_egot = .); - - .u_boot_list : { - KEEP(*(SORT(.u_boot_list*))); - } - - PROVIDE (__init_end = .); - PROVIDE (reloc_dst_end = .); - /* _reloc_dst_end = .; */ - - PROVIDE (bss_start = .); - PROVIDE (__bss_start = .); - .bss (NOLOAD) : - { - *(.bss) - . = ALIGN(4); - } - PROVIDE (bss_end = .); - - PROVIDE (__bss_end = .); -} diff --git a/board/renesas/sh7757lcr/Makefile b/board/renesas/sh7757lcr/Makefile index 1fa3992..f1ce0f6 100644 --- a/board/renesas/sh7757lcr/Makefile +++ b/board/renesas/sh7757lcr/Makefile @@ -4,4 +4,4 @@ # SPDX-License-Identifier: GPL-2.0+
obj-y := sh7757lcr.o spi-boot.o -obj-y += lowlevel_init.o +extra-y += lowlevel_init.o diff --git a/board/renesas/sh7757lcr/u-boot.lds b/board/renesas/sh7757lcr/u-boot.lds deleted file mode 100644 index d701367..0000000 --- a/board/renesas/sh7757lcr/u-boot.lds +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Copyright (C) 2007 - * Nobuhiro Iwamatsu iwamatsu@nigauri.org - * - * Copyright (C) 2011 - * Yoshihiro Shimoda yoshihiro.shimoda.uh@renesas.com - * - * SPDX-License-Identifier: GPL-2.0+ - */ - -OUTPUT_FORMAT("elf32-sh-linux", "elf32-sh-linux", "elf32-sh-linux") -OUTPUT_ARCH(sh) -ENTRY(_start) - -SECTIONS -{ - /* - * entry and reloct_dst will be provided via ldflags - */ - . = .; - - PROVIDE (_ftext = .); - PROVIDE (_fcode = .); - PROVIDE (_start = .); - - .text : - { - KEEP(arch/sh/cpu/sh4/start.o (.text)) - *(.spiboot1.text) - *(.spiboot2.text) - . = ALIGN(8192); - common/env_embedded.o (.ppcenv) - . = ALIGN(8192); - common/env_embedded.o (.ppcenvr) - . = ALIGN(8192); - *(.text) - . = ALIGN(4); - } =0xFF - PROVIDE (_ecode = .); - .rodata : - { - *(SORT_BY_ALIGNMENT(SORT_BY_NAME(.rodata*))) - . = ALIGN(4); - } - PROVIDE (_etext = .); - - - PROVIDE (_fdata = .); - .data : - { - *(.data) - . = ALIGN(4); - } - PROVIDE (_edata = .); - - PROVIDE (_fgot = .); - .got : - { - *(.got) - . = ALIGN(4); - } - PROVIDE (_egot = .); - - - .u_boot_list : { - KEEP(*(SORT(.u_boot_list*))); - } - - PROVIDE (__init_end = .); - PROVIDE (reloc_dst_end = .); - /* _reloc_dst_end = .; */ - - PROVIDE (bss_start = .); - PROVIDE (__bss_start = .); - .bss (NOLOAD) : - { - *(.bss) - . = ALIGN(4); - } - PROVIDE (bss_end = .); - - PROVIDE (__bss_end = .); -} diff --git a/include/configs/sh7752evb.h b/include/configs/sh7752evb.h index 38bf408..23c8300 100644 --- a/include/configs/sh7752evb.h +++ b/include/configs/sh7752evb.h @@ -14,7 +14,6 @@ #define CONFIG_SH7752EVB 1
#define CONFIG_SYS_TEXT_BASE 0x5ff80000 -#define CONFIG_SYS_LDSCRIPT "board/renesas/sh7752evb/u-boot.lds"
#define CONFIG_CMD_DFL #define CONFIG_CMD_SDRAM diff --git a/include/configs/sh7753evb.h b/include/configs/sh7753evb.h index 3718bc5..9c601b5 100644 --- a/include/configs/sh7753evb.h +++ b/include/configs/sh7753evb.h @@ -14,7 +14,6 @@ #define CONFIG_SH7753EVB 1
#define CONFIG_SYS_TEXT_BASE 0x5ff80000 -#define CONFIG_SYS_LDSCRIPT "board/renesas/sh7753evb/u-boot.lds"
#define CONFIG_CMD_DFL #define CONFIG_CMD_SDRAM diff --git a/include/configs/sh7757lcr.h b/include/configs/sh7757lcr.h index 8820e15..8345e53 100644 --- a/include/configs/sh7757lcr.h +++ b/include/configs/sh7757lcr.h @@ -15,7 +15,6 @@ #define CONFIG_SH7757LCR_DDR_ECC 1
#define CONFIG_SYS_TEXT_BASE 0x8ef80000 -#define CONFIG_SYS_LDSCRIPT "board/renesas/sh7757lcr/u-boot.lds"
#define CONFIG_CMD_SDRAM #define CONFIG_CMD_MD5SUM

On 27 November 2016 at 15:15, Vladimir Zapolskiy vz@mleia.com wrote:
Three supported SH4/SH4A boards with the bootloader image stored on SPI flash have own flavour of a linker script, in turn they are equal among each other. The only difference is that the text from lowlevel_init.o is placed right after start.o, which makes sense.
Note that .bss section is not marked as NOLOAD, because for about 10 years this is a default option of a GNU linker, either the attribute is found or not the resulting image file is the same.
Signed-off-by: Vladimir Zapolskiy vz@mleia.com
arch/sh/cpu/u-boot.lds | 4 ++ board/renesas/sh7752evb/Makefile | 2 +- board/renesas/sh7752evb/u-boot.lds | 82 ------------------------------------- board/renesas/sh7753evb/Makefile | 2 +- board/renesas/sh7753evb/u-boot.lds | 82 ------------------------------------- board/renesas/sh7757lcr/Makefile | 2 +- board/renesas/sh7757lcr/u-boot.lds | 83 -------------------------------------- include/configs/sh7752evb.h | 1 - include/configs/sh7753evb.h | 1 - include/configs/sh7757lcr.h | 1 - 10 files changed, 7 insertions(+), 253 deletions(-) delete mode 100644 board/renesas/sh7752evb/u-boot.lds delete mode 100644 board/renesas/sh7753evb/u-boot.lds delete mode 100644 board/renesas/sh7757lcr/u-boot.lds
Reviewed-by: Simon Glass sjg@chromium.org

On Mon, Nov 28, 2016 at 12:15:25AM +0200, Vladimir Zapolskiy wrote:
Three supported SH4/SH4A boards with the bootloader image stored on SPI flash have own flavour of a linker script, in turn they are equal among each other. The only difference is that the text from lowlevel_init.o is placed right after start.o, which makes sense.
Note that .bss section is not marked as NOLOAD, because for about 10 years this is a default option of a GNU linker, either the attribute is found or not the resulting image file is the same.
Signed-off-by: Vladimir Zapolskiy vz@mleia.com Reviewed-by: Simon Glass sjg@chromium.org
Applied to u-boot/master, thanks!

Reference lowlevel_init of all supported SH2A/SH3/SH4/SH4A boards from a shared linker script, the lowlevel_init function will be called by a relative address.
Signed-off-by: Vladimir Zapolskiy vz@mleia.com --- arch/sh/cpu/u-boot.lds | 2 +- board/alphaproject/ap_sh4a_4a/Makefile | 2 +- board/espt/Makefile | 2 +- board/mpr2/Makefile | 2 +- board/ms7720se/Makefile | 2 +- board/ms7722se/Makefile | 2 +- board/ms7750se/Makefile | 2 +- board/renesas/MigoR/Makefile | 2 +- board/renesas/ap325rxa/Makefile | 2 +- board/renesas/ecovec/Makefile | 2 +- board/renesas/r0p7734/Makefile | 2 +- board/renesas/r2dplus/Makefile | 2 +- board/renesas/r7780mp/Makefile | 2 +- board/renesas/rsk7203/Makefile | 2 +- board/renesas/rsk7264/Makefile | 2 +- board/renesas/rsk7269/Makefile | 2 +- board/renesas/sh7763rdp/Makefile | 2 +- board/renesas/sh7785lcr/Makefile | 2 +- board/shmin/Makefile | 2 +- 19 files changed, 19 insertions(+), 19 deletions(-)
diff --git a/arch/sh/cpu/u-boot.lds b/arch/sh/cpu/u-boot.lds index 6f38563..e90ac06 100644 --- a/arch/sh/cpu/u-boot.lds +++ b/arch/sh/cpu/u-boot.lds @@ -31,7 +31,7 @@ SECTIONS .text : { KEEP(*/start.o (.text)) - KEEP(CONFIG_BOARDDIR/lowlevel_init.o (.spiboot1.text)) + KEEP(CONFIG_BOARDDIR/lowlevel_init.o (.text .spiboot1.text)) KEEP(*(.spiboot2.text)) . = ALIGN(8192); common/env_embedded.o (.ppcenv) diff --git a/board/alphaproject/ap_sh4a_4a/Makefile b/board/alphaproject/ap_sh4a_4a/Makefile index 486d0ac..df76466 100644 --- a/board/alphaproject/ap_sh4a_4a/Makefile +++ b/board/alphaproject/ap_sh4a_4a/Makefile @@ -4,4 +4,4 @@ # SPDX-License-Identifier: GPL-2.0+
obj-y := ap_sh4a_4a.o -obj-y += lowlevel_init.o +extra-y += lowlevel_init.o diff --git a/board/espt/Makefile b/board/espt/Makefile index 8a8a2c9..f24e9cf 100644 --- a/board/espt/Makefile +++ b/board/espt/Makefile @@ -8,4 +8,4 @@ #
obj-y := espt.o -obj-y += lowlevel_init.o +extra-y += lowlevel_init.o diff --git a/board/mpr2/Makefile b/board/mpr2/Makefile index b6cdeb4..0cb1dd6 100644 --- a/board/mpr2/Makefile +++ b/board/mpr2/Makefile @@ -16,4 +16,4 @@ # SPDX-License-Identifier: GPL-2.0+
obj-y := mpr2.o -obj-y += lowlevel_init.o +extra-y += lowlevel_init.o diff --git a/board/ms7720se/Makefile b/board/ms7720se/Makefile index 1819c4c..66c25fa 100644 --- a/board/ms7720se/Makefile +++ b/board/ms7720se/Makefile @@ -13,4 +13,4 @@ # SPDX-License-Identifier: GPL-2.0+
obj-y := ms7720se.o -obj-y += lowlevel_init.o +extra-y += lowlevel_init.o diff --git a/board/ms7722se/Makefile b/board/ms7722se/Makefile index 9f7af78..808d459 100644 --- a/board/ms7722se/Makefile +++ b/board/ms7722se/Makefile @@ -10,4 +10,4 @@ # SPDX-License-Identifier: GPL-2.0+
obj-y := ms7722se.o -obj-y += lowlevel_init.o +extra-y += lowlevel_init.o diff --git a/board/ms7750se/Makefile b/board/ms7750se/Makefile index a8e3ca0..a010e32 100644 --- a/board/ms7750se/Makefile +++ b/board/ms7750se/Makefile @@ -6,4 +6,4 @@ #
obj-y := ms7750se.o -obj-y += lowlevel_init.o +extra-y += lowlevel_init.o diff --git a/board/renesas/MigoR/Makefile b/board/renesas/MigoR/Makefile index b4691a1..0686f97 100644 --- a/board/renesas/MigoR/Makefile +++ b/board/renesas/MigoR/Makefile @@ -10,4 +10,4 @@ # SPDX-License-Identifier: GPL-2.0+
obj-y := migo_r.o -obj-y += lowlevel_init.o +extra-y += lowlevel_init.o diff --git a/board/renesas/ap325rxa/Makefile b/board/renesas/ap325rxa/Makefile index ff72de9..18e1ed5 100644 --- a/board/renesas/ap325rxa/Makefile +++ b/board/renesas/ap325rxa/Makefile @@ -9,4 +9,4 @@ #
obj-y := ap325rxa.o cpld-ap325rxa.o -obj-y += lowlevel_init.o +extra-y += lowlevel_init.o diff --git a/board/renesas/ecovec/Makefile b/board/renesas/ecovec/Makefile index 943fa47..2e6fb50 100644 --- a/board/renesas/ecovec/Makefile +++ b/board/renesas/ecovec/Makefile @@ -5,4 +5,4 @@ # SPDX-License-Identifier: GPL-2.0+
obj-y := ecovec.o -obj-y += lowlevel_init.o +extra-y += lowlevel_init.o diff --git a/board/renesas/r0p7734/Makefile b/board/renesas/r0p7734/Makefile index 1f24d92..bfe52d6 100644 --- a/board/renesas/r0p7734/Makefile +++ b/board/renesas/r0p7734/Makefile @@ -4,4 +4,4 @@ # SPDX-License-Identifier: GPL-2.0+
obj-y := r0p7734.o -obj-y += lowlevel_init.o +extra-y += lowlevel_init.o diff --git a/board/renesas/r2dplus/Makefile b/board/renesas/r2dplus/Makefile index acffb6d..4021ab6 100644 --- a/board/renesas/r2dplus/Makefile +++ b/board/renesas/r2dplus/Makefile @@ -6,4 +6,4 @@ #
obj-y := r2dplus.o -obj-y += lowlevel_init.o +extra-y += lowlevel_init.o diff --git a/board/renesas/r7780mp/Makefile b/board/renesas/r7780mp/Makefile index 8dab435..66813a3 100644 --- a/board/renesas/r7780mp/Makefile +++ b/board/renesas/r7780mp/Makefile @@ -6,4 +6,4 @@ # SPDX-License-Identifier: GPL-2.0+
obj-y := r7780mp.o -obj-y += lowlevel_init.o +extra-y += lowlevel_init.o diff --git a/board/renesas/rsk7203/Makefile b/board/renesas/rsk7203/Makefile index 16acfaf..08139a2 100644 --- a/board/renesas/rsk7203/Makefile +++ b/board/renesas/rsk7203/Makefile @@ -7,4 +7,4 @@ # SPDX-License-Identifier: GPL-2.0+
obj-y := rsk7203.o -obj-y += lowlevel_init.o +extra-y += lowlevel_init.o diff --git a/board/renesas/rsk7264/Makefile b/board/renesas/rsk7264/Makefile index 7ada697..2a845a0 100644 --- a/board/renesas/rsk7264/Makefile +++ b/board/renesas/rsk7264/Makefile @@ -4,4 +4,4 @@ # SPDX-License-Identifier: GPL-2.0+
obj-y := rsk7264.o -obj-y += lowlevel_init.o +extra-y += lowlevel_init.o diff --git a/board/renesas/rsk7269/Makefile b/board/renesas/rsk7269/Makefile index 0f053d8..86b2263 100644 --- a/board/renesas/rsk7269/Makefile +++ b/board/renesas/rsk7269/Makefile @@ -5,4 +5,4 @@ # SPDX-License-Identifier: GPL-2.0+
obj-y := rsk7269.o -obj-y += lowlevel_init.o +extra-y += lowlevel_init.o diff --git a/board/renesas/sh7763rdp/Makefile b/board/renesas/sh7763rdp/Makefile index cbf38bb..13f7ae9 100644 --- a/board/renesas/sh7763rdp/Makefile +++ b/board/renesas/sh7763rdp/Makefile @@ -9,4 +9,4 @@ #
obj-y := sh7763rdp.o -obj-y += lowlevel_init.o +extra-y += lowlevel_init.o diff --git a/board/renesas/sh7785lcr/Makefile b/board/renesas/sh7785lcr/Makefile index e8cfb05..1bf5d53 100644 --- a/board/renesas/sh7785lcr/Makefile +++ b/board/renesas/sh7785lcr/Makefile @@ -4,4 +4,4 @@ # SPDX-License-Identifier: GPL-2.0+
obj-y := sh7785lcr.o selfcheck.o rtl8169_mac.o -obj-y += lowlevel_init.o +extra-y += lowlevel_init.o diff --git a/board/shmin/Makefile b/board/shmin/Makefile index daf36de..d169661 100644 --- a/board/shmin/Makefile +++ b/board/shmin/Makefile @@ -7,4 +7,4 @@ # SPDX-License-Identifier: GPL-2.0+
obj-y := shmin.o -obj-y += lowlevel_init.o +extra-y += lowlevel_init.o

On 27 November 2016 at 15:15, Vladimir Zapolskiy vz@mleia.com wrote:
Reference lowlevel_init of all supported SH2A/SH3/SH4/SH4A boards from a shared linker script, the lowlevel_init function will be called by a relative address.
Signed-off-by: Vladimir Zapolskiy vz@mleia.com
arch/sh/cpu/u-boot.lds | 2 +- board/alphaproject/ap_sh4a_4a/Makefile | 2 +- board/espt/Makefile | 2 +- board/mpr2/Makefile | 2 +- board/ms7720se/Makefile | 2 +- board/ms7722se/Makefile | 2 +- board/ms7750se/Makefile | 2 +- board/renesas/MigoR/Makefile | 2 +- board/renesas/ap325rxa/Makefile | 2 +- board/renesas/ecovec/Makefile | 2 +- board/renesas/r0p7734/Makefile | 2 +- board/renesas/r2dplus/Makefile | 2 +- board/renesas/r7780mp/Makefile | 2 +- board/renesas/rsk7203/Makefile | 2 +- board/renesas/rsk7264/Makefile | 2 +- board/renesas/rsk7269/Makefile | 2 +- board/renesas/sh7763rdp/Makefile | 2 +- board/renesas/sh7785lcr/Makefile | 2 +- board/shmin/Makefile | 2 +- 19 files changed, 19 insertions(+), 19 deletions(-)
Reviewed-by: Simon Glass sjg@chromium.org

On Mon, Nov 28, 2016 at 12:15:26AM +0200, Vladimir Zapolskiy wrote:
Reference lowlevel_init of all supported SH2A/SH3/SH4/SH4A boards from a shared linker script, the lowlevel_init function will be called by a relative address.
Signed-off-by: Vladimir Zapolskiy vz@mleia.com Reviewed-by: Simon Glass sjg@chromium.org
Applied to u-boot/master, thanks!

No functional change, concentrate linker script commands in one place for convenience. Entry point is set to CONFIG_SYS_TEXT_BASE by default on build, so this option can be omitted from being added to the linker script.
Signed-off-by: Vladimir Zapolskiy vz@mleia.com --- arch/sh/config.mk | 1 - arch/sh/cpu/u-boot.lds | 6 +----- 2 files changed, 1 insertion(+), 6 deletions(-)
diff --git a/arch/sh/config.mk b/arch/sh/config.mk index 0578fa3..673ed8d 100644 --- a/arch/sh/config.mk +++ b/arch/sh/config.mk @@ -15,6 +15,5 @@ CONFIG_STANDALONE_LOAD_ADDR += -EB endif
PLATFORM_CPPFLAGS += -DCONFIG_SH -D__SH__ -PLATFORM_LDFLAGS += -e $(CONFIG_SYS_TEXT_BASE) --defsym reloc_dst=$(CONFIG_SYS_TEXT_BASE) LDFLAGS_FINAL = --gc-sections PLATFORM_RELFLAGS += -ffixed-r13 diff --git a/arch/sh/cpu/u-boot.lds b/arch/sh/cpu/u-boot.lds index e90ac06..bc240bd 100644 --- a/arch/sh/cpu/u-boot.lds +++ b/arch/sh/cpu/u-boot.lds @@ -19,10 +19,7 @@ ENTRY(_start)
SECTIONS { - /* - * entry and reloct_dst will be provided via ldflags - */ - . = .; + reloc_dst = .;
PROVIDE (_ftext = .); PROVIDE (_fcode = .); @@ -73,7 +70,6 @@ SECTIONS
PROVIDE (__init_end = .); PROVIDE (reloc_dst_end = .); - /* _reloc_dst_end = .; */
PROVIDE (bss_start = .); PROVIDE (__bss_start = .);

On 27 November 2016 at 15:15, Vladimir Zapolskiy vz@mleia.com wrote:
No functional change, concentrate linker script commands in one place for convenience. Entry point is set to CONFIG_SYS_TEXT_BASE by default on build, so this option can be omitted from being added to the linker script.
Signed-off-by: Vladimir Zapolskiy vz@mleia.com
arch/sh/config.mk | 1 - arch/sh/cpu/u-boot.lds | 6 +----- 2 files changed, 1 insertion(+), 6 deletions(-)
Reviewed-by: Simon Glass sjg@chromium.org

On Mon, Nov 28, 2016 at 12:15:27AM +0200, Vladimir Zapolskiy wrote:
No functional change, concentrate linker script commands in one place for convenience. Entry point is set to CONFIG_SYS_TEXT_BASE by default on build, so this option can be omitted from being added to the linker script.
Signed-off-by: Vladimir Zapolskiy vz@mleia.com Reviewed-by: Simon Glass sjg@chromium.org
Applied to u-boot/master, thanks!

At the moment in runtime all defined sections are copied into or created in RAM, specify this explicitly to assert potential out of RAM placements of the sections.
Signed-off-by: Vladimir Zapolskiy vz@mleia.com --- arch/sh/cpu/u-boot.lds | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-)
diff --git a/arch/sh/cpu/u-boot.lds b/arch/sh/cpu/u-boot.lds index bc240bd..f2e48c6 100644 --- a/arch/sh/cpu/u-boot.lds +++ b/arch/sh/cpu/u-boot.lds @@ -1,12 +1,8 @@ /* - * Copyright (C) 2007 - * Nobuhiro Iwamatsu iwamatsu@nigauri.org - * - * Copyright (C) 2008-2009 - * Yoshihiro Shimoda shimoda.yoshihiro@renesas.com - * - * Copyright (C) 2008 - * Mark Jonas mark.jonas@de.bosch.com + * Copyright (C) 2016 Vladimir Zapolskiy vz@mleia.com + * Copyright (C) 2008-2009 Yoshihiro Shimoda shimoda.yoshihiro@renesas.com + * Copyright (C) 2008 Mark Jonas mark.jonas@de.bosch.com + * Copyright (C) 2007 Nobuhiro Iwamatsu iwamatsu@nigauri.org * * SPDX-License-Identifier: GPL-2.0+ */ @@ -15,6 +11,12 @@
OUTPUT_FORMAT("elf32-sh-linux", "elf32-sh-linux", "elf32-sh-linux") OUTPUT_ARCH(sh) + +MEMORY +{ + ram : ORIGIN = CONFIG_SYS_SDRAM_BASE, LENGTH = CONFIG_SYS_SDRAM_SIZE +} + ENTRY(_start)
SECTIONS @@ -37,13 +39,13 @@ SECTIONS . = ALIGN(8192); *(.text) . = ALIGN(4); - } =0xFF + } >ram =0xFF PROVIDE (_ecode = .); .rodata : { *(SORT_BY_ALIGNMENT(SORT_BY_NAME(.rodata*))) . = ALIGN(4); - } + } >ram PROVIDE (_etext = .);
@@ -52,7 +54,7 @@ SECTIONS { *(.data) . = ALIGN(4); - } + } >ram PROVIDE (_edata = .);
PROVIDE (_fgot = .); @@ -60,13 +62,12 @@ SECTIONS { *(.got) . = ALIGN(4); - } + } >ram PROVIDE (_egot = .);
- .u_boot_list : { KEEP(*(SORT(.u_boot_list*))); - } + } >ram
PROVIDE (__init_end = .); PROVIDE (reloc_dst_end = .); @@ -77,8 +78,7 @@ SECTIONS { *(.bss) . = ALIGN(4); - } + } >ram PROVIDE (bss_end = .); - PROVIDE (__bss_end = .); }

On 27 November 2016 at 15:15, Vladimir Zapolskiy vz@mleia.com wrote:
At the moment in runtime all defined sections are copied into or created in RAM, specify this explicitly to assert potential out of RAM placements of the sections.
Signed-off-by: Vladimir Zapolskiy vz@mleia.com
arch/sh/cpu/u-boot.lds | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-)
Reviewed-by: Simon Glass sjg@chromium.org

On Mon, Nov 28, 2016 at 12:15:28AM +0200, Vladimir Zapolskiy wrote:
At the moment in runtime all defined sections are copied into or created in RAM, specify this explicitly to assert potential out of RAM placements of the sections.
Signed-off-by: Vladimir Zapolskiy vz@mleia.com Reviewed-by: Simon Glass sjg@chromium.org
Applied to u-boot/master, thanks!

By default this undef is a noop, moreover at this point when the platform support is broken is prevents debugging of U-boot by manual insertion of #define DEBUG into common files, so it makes sense to remove the option from all SH boards as a harmful one.
Signed-off-by: Vladimir Zapolskiy vz@mleia.com --- include/configs/MigoR.h | 1 - include/configs/ap325rxa.h | 1 - include/configs/ap_sh4a_4a.h | 1 - include/configs/ecovec.h | 1 - include/configs/r0p7734.h | 1 - include/configs/r2dplus.h | 2 -- include/configs/r7780mp.h | 1 - include/configs/rsk7203.h | 1 - include/configs/rsk7264.h | 1 - include/configs/rsk7269.h | 1 - include/configs/sh7752evb.h | 1 - include/configs/sh7753evb.h | 1 - include/configs/sh7757lcr.h | 1 - include/configs/sh7785lcr.h | 1 - 14 files changed, 15 deletions(-)
diff --git a/include/configs/MigoR.h b/include/configs/MigoR.h index bb12785..e1338cd 100644 --- a/include/configs/MigoR.h +++ b/include/configs/MigoR.h @@ -9,7 +9,6 @@ #ifndef __MIGO_R_H #define __MIGO_R_H
-#undef DEBUG #define CONFIG_CPU_SH7722 1 #define CONFIG_MIGO_R 1
diff --git a/include/configs/ap325rxa.h b/include/configs/ap325rxa.h index 9a4d2c9..6e39868 100644 --- a/include/configs/ap325rxa.h +++ b/include/configs/ap325rxa.h @@ -10,7 +10,6 @@ #ifndef __AP325RXA_H #define __AP325RXA_H
-#undef DEBUG #define CONFIG_CPU_SH7723 1 #define CONFIG_AP325RXA 1
diff --git a/include/configs/ap_sh4a_4a.h b/include/configs/ap_sh4a_4a.h index 93205aa..d2d9770 100644 --- a/include/configs/ap_sh4a_4a.h +++ b/include/configs/ap_sh4a_4a.h @@ -9,7 +9,6 @@ #ifndef __AP_SH4A_4A_H #define __AP_SH4A_4A_H
-#undef DEBUG #define CONFIG_CPU_SH7734 1 #define CONFIG_AP_SH4A_4A 1 #define CONFIG_400MHZ_MODE 1 diff --git a/include/configs/ecovec.h b/include/configs/ecovec.h index e1e3c78..19514b6 100644 --- a/include/configs/ecovec.h +++ b/include/configs/ecovec.h @@ -22,7 +22,6 @@ * 0x1800_0000 MFI 16bit */
-#undef DEBUG #define CONFIG_CPU_SH7724 1 #define CONFIG_BOARD_LATE_INIT 1 #define CONFIG_ECOVEC 1 diff --git a/include/configs/r0p7734.h b/include/configs/r0p7734.h index 0552003..2ae9e02 100644 --- a/include/configs/r0p7734.h +++ b/include/configs/r0p7734.h @@ -9,7 +9,6 @@ #ifndef __R0P7734_H #define __R0P7734_H
-#undef DEBUG #define CONFIG_CPU_SH7734 1 #define CONFIG_R0P7734 1 #define CONFIG_400MHZ_MODE 1 diff --git a/include/configs/r2dplus.h b/include/configs/r2dplus.h index 21bfe72..a0e0c1c 100644 --- a/include/configs/r2dplus.h +++ b/include/configs/r2dplus.h @@ -1,8 +1,6 @@ #ifndef __CONFIG_H #define __CONFIG_H
-#undef DEBUG - #define CONFIG_CPU_SH7751 1 #define CONFIG_CPU_SH_TYPE_R 1 #define CONFIG_R2DPLUS 1 diff --git a/include/configs/r7780mp.h b/include/configs/r7780mp.h index 42d5135..9812bc8 100644 --- a/include/configs/r7780mp.h +++ b/include/configs/r7780mp.h @@ -10,7 +10,6 @@ #ifndef __R7780RP_H #define __R7780RP_H
-#undef DEBUG #define CONFIG_CPU_SH7780 1 #define CONFIG_R7780MP 1 #define CONFIG_SYS_R7780MP_OLD_FLASH 1 diff --git a/include/configs/rsk7203.h b/include/configs/rsk7203.h index 9db73d3..2eb9d31 100644 --- a/include/configs/rsk7203.h +++ b/include/configs/rsk7203.h @@ -10,7 +10,6 @@ #ifndef __RSK7203_H #define __RSK7203_H
-#undef DEBUG #define CONFIG_CPU_SH7203 1 #define CONFIG_RSK7203 1
diff --git a/include/configs/rsk7264.h b/include/configs/rsk7264.h index 3f9fb7b..55dd2c4 100644 --- a/include/configs/rsk7264.h +++ b/include/configs/rsk7264.h @@ -11,7 +11,6 @@ #ifndef __RSK7264_H #define __RSK7264_H
-#undef DEBUG #define CONFIG_CPU_SH7264 1 #define CONFIG_RSK7264 1
diff --git a/include/configs/rsk7269.h b/include/configs/rsk7269.h index b7f361b..ec7a99b 100644 --- a/include/configs/rsk7269.h +++ b/include/configs/rsk7269.h @@ -10,7 +10,6 @@ #ifndef __RSK7269_H #define __RSK7269_H
-#undef DEBUG #define CONFIG_CPU_SH7269 1 #define CONFIG_RSK7269 1
diff --git a/include/configs/sh7752evb.h b/include/configs/sh7752evb.h index 23c8300..4f99856 100644 --- a/include/configs/sh7752evb.h +++ b/include/configs/sh7752evb.h @@ -9,7 +9,6 @@ #ifndef __SH7752EVB_H #define __SH7752EVB_H
-#undef DEBUG #define CONFIG_CPU_SH7752 1 #define CONFIG_SH7752EVB 1
diff --git a/include/configs/sh7753evb.h b/include/configs/sh7753evb.h index 9c601b5..e2ef2d5 100644 --- a/include/configs/sh7753evb.h +++ b/include/configs/sh7753evb.h @@ -9,7 +9,6 @@ #ifndef __SH7753EVB_H #define __SH7753EVB_H
-#undef DEBUG #define CONFIG_CPU_SH7753 1 #define CONFIG_SH7753EVB 1
diff --git a/include/configs/sh7757lcr.h b/include/configs/sh7757lcr.h index 8345e53..a5a9396 100644 --- a/include/configs/sh7757lcr.h +++ b/include/configs/sh7757lcr.h @@ -9,7 +9,6 @@ #ifndef __SH7757LCR_H #define __SH7757LCR_H
-#undef DEBUG #define CONFIG_CPU_SH7757 1 #define CONFIG_SH7757LCR 1 #define CONFIG_SH7757LCR_DDR_ECC 1 diff --git a/include/configs/sh7785lcr.h b/include/configs/sh7785lcr.h index a49e839..926efbe 100644 --- a/include/configs/sh7785lcr.h +++ b/include/configs/sh7785lcr.h @@ -9,7 +9,6 @@ #ifndef __SH7785LCR_H #define __SH7785LCR_H
-#undef DEBUG #define CONFIG_CPU_SH7785 1 #define CONFIG_SH7785LCR 1

On 27 November 2016 at 15:15, Vladimir Zapolskiy vz@mleia.com wrote:
By default this undef is a noop, moreover at this point when the platform support is broken is prevents debugging of U-boot by manual
U-Boot
insertion of #define DEBUG into common files, so it makes sense to remove the option from all SH boards as a harmful one.
Signed-off-by: Vladimir Zapolskiy vz@mleia.com
include/configs/MigoR.h | 1 - include/configs/ap325rxa.h | 1 - include/configs/ap_sh4a_4a.h | 1 - include/configs/ecovec.h | 1 - include/configs/r0p7734.h | 1 - include/configs/r2dplus.h | 2 -- include/configs/r7780mp.h | 1 - include/configs/rsk7203.h | 1 - include/configs/rsk7264.h | 1 - include/configs/rsk7269.h | 1 - include/configs/sh7752evb.h | 1 - include/configs/sh7753evb.h | 1 - include/configs/sh7757lcr.h | 1 - include/configs/sh7785lcr.h | 1 - 14 files changed, 15 deletions(-)
Reviewed-by: Simon Glass sjg@chromium.org

On Mon, Nov 28, 2016 at 12:15:29AM +0200, Vladimir Zapolskiy wrote:
By default this undef is a noop, moreover at this point when the platform support is broken is prevents debugging of U-boot by manual insertion of #define DEBUG into common files, so it makes sense to remove the option from all SH boards as a harmful one.
Signed-off-by: Vladimir Zapolskiy vz@mleia.com Reviewed-by: Simon Glass sjg@chromium.org
Applied to u-boot/master, thanks!

All SH boards define a checkboard() function which outputs basic board information on boot, however generic board support requires to define CONFIG_DISPLAY_BOARDINFO to do that, so define it for the boards.
Signed-off-by: Vladimir Zapolskiy vz@mleia.com --- include/configs/MigoR.h | 1 + include/configs/ap325rxa.h | 1 + include/configs/ap_sh4a_4a.h | 1 + include/configs/ecovec.h | 1 + include/configs/espt.h | 1 + include/configs/mpr2.h | 2 ++ include/configs/ms7720se.h | 1 + include/configs/ms7722se.h | 1 + include/configs/ms7750se.h | 2 ++ include/configs/r0p7734.h | 1 + include/configs/r2dplus.h | 2 ++ include/configs/r7780mp.h | 2 ++ include/configs/rsk7203.h | 1 + include/configs/rsk7264.h | 2 ++ include/configs/rsk7269.h | 2 ++ include/configs/sh7752evb.h | 1 + include/configs/sh7753evb.h | 1 + include/configs/sh7757lcr.h | 1 + include/configs/sh7763rdp.h | 1 + include/configs/sh7785lcr.h | 1 + include/configs/shmin.h | 1 + 21 files changed, 27 insertions(+)
diff --git a/include/configs/MigoR.h b/include/configs/MigoR.h index e1338cd..75c5af6 100644 --- a/include/configs/MigoR.h +++ b/include/configs/MigoR.h @@ -17,6 +17,7 @@ #define CONFIG_BAUDRATE 115200 #define CONFIG_BOOTARGS "console=ttySC0,115200 root=1f01"
+#define CONFIG_DISPLAY_BOARDINFO #undef CONFIG_SHOW_BOOT_PROGRESS
/* SMC9111 */ diff --git a/include/configs/ap325rxa.h b/include/configs/ap325rxa.h index 6e39868..c86ce05 100644 --- a/include/configs/ap325rxa.h +++ b/include/configs/ap325rxa.h @@ -20,6 +20,7 @@ #define CONFIG_BAUDRATE 38400 #define CONFIG_BOOTARGS "console=ttySC2,38400"
+#define CONFIG_DISPLAY_BOARDINFO #undef CONFIG_SHOW_BOOT_PROGRESS
/* SMC9118 */ diff --git a/include/configs/ap_sh4a_4a.h b/include/configs/ap_sh4a_4a.h index d2d9770..4b07f06 100644 --- a/include/configs/ap_sh4a_4a.h +++ b/include/configs/ap_sh4a_4a.h @@ -23,6 +23,7 @@ #define CONFIG_BAUDRATE 115200 #define CONFIG_BOOTARGS "console=ttySC4,115200"
+#define CONFIG_DISPLAY_BOARDINFO #undef CONFIG_SHOW_BOOT_PROGRESS
/* Ether */ diff --git a/include/configs/ecovec.h b/include/configs/ecovec.h index 19514b6..6470327 100644 --- a/include/configs/ecovec.h +++ b/include/configs/ecovec.h @@ -37,6 +37,7 @@ #define CONFIG_BAUDRATE 115200 #define CONFIG_BOOTARGS "console=ttySC0,115200"
+#define CONFIG_DISPLAY_BOARDINFO #undef CONFIG_SHOW_BOOT_PROGRESS
/* I2C */ diff --git a/include/configs/espt.h b/include/configs/espt.h index e76a4ee..9475740 100644 --- a/include/configs/espt.h +++ b/include/configs/espt.h @@ -23,6 +23,7 @@ #define CONFIG_BOOTARGS "console=ttySC0,115200 root=1f01" #define CONFIG_ENV_OVERWRITE 1
+#define CONFIG_DISPLAY_BOARDINFO #undef CONFIG_SHOW_BOOT_PROGRESS
/* SCIF */ diff --git a/include/configs/mpr2.h b/include/configs/mpr2.h index 1a8909a..0d37912 100644 --- a/include/configs/mpr2.h +++ b/include/configs/mpr2.h @@ -22,6 +22,8 @@ #define CONFIG_CPU_SH7720 1 #define CONFIG_MPR2 1
+#define CONFIG_DISPLAY_BOARDINFO + /* U-Boot internals */ #define CONFIG_SYS_LONGHELP /* undef to save memory */ #define CONFIG_SYS_CBSIZE 256 /* Buffer size for input from the Console */ diff --git a/include/configs/ms7720se.h b/include/configs/ms7720se.h index d136726..87f8712 100644 --- a/include/configs/ms7720se.h +++ b/include/configs/ms7720se.h @@ -21,6 +21,7 @@ #define CONFIG_BOOTFILE "/boot/zImage" #define CONFIG_LOADADDR 0x8E000000
+#define CONFIG_DISPLAY_BOARDINFO #undef CONFIG_SHOW_BOOT_PROGRESS
/* MEMORY */ diff --git a/include/configs/ms7722se.h b/include/configs/ms7722se.h index a473eec..181d021 100644 --- a/include/configs/ms7722se.h +++ b/include/configs/ms7722se.h @@ -18,6 +18,7 @@ #define CONFIG_BAUDRATE 115200 #define CONFIG_BOOTARGS "console=ttySC0,115200 root=1f01"
+#define CONFIG_DISPLAY_BOARDINFO #undef CONFIG_SHOW_BOOT_PROGRESS
/* SMC9111 */ diff --git a/include/configs/ms7750se.h b/include/configs/ms7750se.h index c0fb16d..6268d73 100644 --- a/include/configs/ms7750se.h +++ b/include/configs/ms7750se.h @@ -15,6 +15,8 @@ #define CONFIG_MS7750SE 1 #define __LITTLE_ENDIAN__ 1
+#define CONFIG_DISPLAY_BOARDINFO + /* * Command line configuration. */ diff --git a/include/configs/r0p7734.h b/include/configs/r0p7734.h index 2ae9e02..f7412f0 100644 --- a/include/configs/r0p7734.h +++ b/include/configs/r0p7734.h @@ -23,6 +23,7 @@ #define CONFIG_BAUDRATE 115200 #define CONFIG_BOOTARGS "console=ttySC3,115200"
+#define CONFIG_DISPLAY_BOARDINFO #undef CONFIG_SHOW_BOOT_PROGRESS
/* Ether */ diff --git a/include/configs/r2dplus.h b/include/configs/r2dplus.h index a0e0c1c..e8f60b2 100644 --- a/include/configs/r2dplus.h +++ b/include/configs/r2dplus.h @@ -6,6 +6,8 @@ #define CONFIG_R2DPLUS 1 #define __LITTLE_ENDIAN__ 1
+#define CONFIG_DISPLAY_BOARDINFO + /* * Command line configuration. */ diff --git a/include/configs/r7780mp.h b/include/configs/r7780mp.h index 9812bc8..baadd87 100644 --- a/include/configs/r7780mp.h +++ b/include/configs/r7780mp.h @@ -15,6 +15,8 @@ #define CONFIG_SYS_R7780MP_OLD_FLASH 1 #define __LITTLE_ENDIAN__ 1
+#define CONFIG_DISPLAY_BOARDINFO + /* * Command line configuration. */ diff --git a/include/configs/rsk7203.h b/include/configs/rsk7203.h index 2eb9d31..913cbc2 100644 --- a/include/configs/rsk7203.h +++ b/include/configs/rsk7203.h @@ -19,6 +19,7 @@ #define CONFIG_BOOTARGS "console=ttySC0,115200" #define CONFIG_LOADADDR 0x0C100000 /* RSK7203_SDRAM_BASE + 1MB */
+#define CONFIG_DISPLAY_BOARDINFO #undef CONFIG_SHOW_BOOT_PROGRESS
/* MEMORY */ diff --git a/include/configs/rsk7264.h b/include/configs/rsk7264.h index 55dd2c4..ea60014 100644 --- a/include/configs/rsk7264.h +++ b/include/configs/rsk7264.h @@ -14,6 +14,8 @@ #define CONFIG_CPU_SH7264 1 #define CONFIG_RSK7264 1
+#define CONFIG_DISPLAY_BOARDINFO + #define CONFIG_BAUDRATE 115200 #define CONFIG_BOOTARGS "console=ttySC3,115200" #define CONFIG_SYS_BAUDRATE_TABLE { CONFIG_BAUDRATE } diff --git a/include/configs/rsk7269.h b/include/configs/rsk7269.h index ec7a99b..f470954 100644 --- a/include/configs/rsk7269.h +++ b/include/configs/rsk7269.h @@ -13,6 +13,8 @@ #define CONFIG_CPU_SH7269 1 #define CONFIG_RSK7269 1
+#define CONFIG_DISPLAY_BOARDINFO + #define CONFIG_BAUDRATE 115200 #define CONFIG_BOOTARGS "console=ttySC7,115200" #define CONFIG_SYS_BAUDRATE_TABLE { CONFIG_BAUDRATE } diff --git a/include/configs/sh7752evb.h b/include/configs/sh7752evb.h index 4f99856..67ca4a6 100644 --- a/include/configs/sh7752evb.h +++ b/include/configs/sh7752evb.h @@ -24,6 +24,7 @@ #define CONFIG_BAUDRATE 115200 #define CONFIG_BOOTARGS "console=ttySC2,115200 root=/dev/nfs ip=dhcp"
+#define CONFIG_DISPLAY_BOARDINFO #undef CONFIG_SHOW_BOOT_PROGRESS #define CONFIG_CMDLINE_EDITING #define CONFIG_AUTO_COMPLETE diff --git a/include/configs/sh7753evb.h b/include/configs/sh7753evb.h index e2ef2d5..d77b470 100644 --- a/include/configs/sh7753evb.h +++ b/include/configs/sh7753evb.h @@ -24,6 +24,7 @@ #define CONFIG_BAUDRATE 115200 #define CONFIG_BOOTARGS "console=ttySC2,115200 root=/dev/nfs ip=dhcp"
+#define CONFIG_DISPLAY_BOARDINFO #undef CONFIG_SHOW_BOOT_PROGRESS #define CONFIG_CMDLINE_EDITING #define CONFIG_AUTO_COMPLETE diff --git a/include/configs/sh7757lcr.h b/include/configs/sh7757lcr.h index a5a9396..efb7ad9 100644 --- a/include/configs/sh7757lcr.h +++ b/include/configs/sh7757lcr.h @@ -24,6 +24,7 @@ #define CONFIG_BAUDRATE 115200 #define CONFIG_BOOTARGS "console=ttySC2,115200 root=/dev/nfs ip=dhcp"
+#define CONFIG_DISPLAY_BOARDINFO #undef CONFIG_SHOW_BOOT_PROGRESS
/* MEMORY */ diff --git a/include/configs/sh7763rdp.h b/include/configs/sh7763rdp.h index 2e45699..6124826 100644 --- a/include/configs/sh7763rdp.h +++ b/include/configs/sh7763rdp.h @@ -23,6 +23,7 @@ #define CONFIG_BOOTARGS "console=ttySC2,115200 root=1f01" #define CONFIG_ENV_OVERWRITE 1
+#define CONFIG_DISPLAY_BOARDINFO #undef CONFIG_SHOW_BOOT_PROGRESS
/* SCIF */ diff --git a/include/configs/sh7785lcr.h b/include/configs/sh7785lcr.h index 926efbe..a74fd60 100644 --- a/include/configs/sh7785lcr.h +++ b/include/configs/sh7785lcr.h @@ -26,6 +26,7 @@ "bootdevice=0:1\0" \ "usbload=usb reset;usbboot;usb stop;bootm\0"
+#define CONFIG_DISPLAY_BOARDINFO #undef CONFIG_SHOW_BOOT_PROGRESS
/* MEMORY */ diff --git a/include/configs/shmin.h b/include/configs/shmin.h index e0fc3a2..dde6625 100644 --- a/include/configs/shmin.h +++ b/include/configs/shmin.h @@ -26,6 +26,7 @@ * you should set undef. */ #undef CONFIG_SHOW_BOOT_PROGRESS +#define CONFIG_DISPLAY_BOARDINFO
/* system */ #define SHMIN_SDRAM_BASE (0x8C000000)

On 27 November 2016 at 15:15, Vladimir Zapolskiy vz@mleia.com wrote:
All SH boards define a checkboard() function which outputs basic board information on boot, however generic board support requires to define CONFIG_DISPLAY_BOARDINFO to do that, so define it for the boards.
Signed-off-by: Vladimir Zapolskiy vz@mleia.com
include/configs/MigoR.h | 1 + include/configs/ap325rxa.h | 1 + include/configs/ap_sh4a_4a.h | 1 + include/configs/ecovec.h | 1 + include/configs/espt.h | 1 + include/configs/mpr2.h | 2 ++ include/configs/ms7720se.h | 1 + include/configs/ms7722se.h | 1 + include/configs/ms7750se.h | 2 ++ include/configs/r0p7734.h | 1 + include/configs/r2dplus.h | 2 ++ include/configs/r7780mp.h | 2 ++ include/configs/rsk7203.h | 1 + include/configs/rsk7264.h | 2 ++ include/configs/rsk7269.h | 2 ++ include/configs/sh7752evb.h | 1 + include/configs/sh7753evb.h | 1 + include/configs/sh7757lcr.h | 1 + include/configs/sh7763rdp.h | 1 + include/configs/sh7785lcr.h | 1 + include/configs/shmin.h | 1 + 21 files changed, 27 insertions(+)
Reviewed-by: Simon Glass sjg@chromium.org

On Mon, Nov 28, 2016 at 12:15:30AM +0200, Vladimir Zapolskiy wrote:
All SH boards define a checkboard() function which outputs basic board information on boot, however generic board support requires to define CONFIG_DISPLAY_BOARDINFO to do that, so define it for the boards.
Signed-off-by: Vladimir Zapolskiy vz@mleia.com Reviewed-by: Simon Glass sjg@chromium.org
Applied to u-boot/master, thanks!

Generic board support assumes a different method of specifying DRAM size on board, also it can be shared among all boards, notably only sh7763rdp board has a custom legacy dram_init(), however the difference is only in printing some additional information, this feature can be removed.
Signed-off-by: Vladimir Zapolskiy vz@mleia.com --- arch/sh/lib/Makefile | 2 +- arch/sh/lib/board.c | 17 +++++++++++++++++ board/alphaproject/ap_sh4a_4a/ap_sh4a_4a.c | 11 ----------- board/espt/espt.c | 10 ---------- board/mpr2/mpr2.c | 10 ---------- board/ms7720se/ms7720se.c | 10 ---------- board/ms7722se/ms7722se.c | 10 ---------- board/ms7750se/ms7750se.c | 10 ---------- board/renesas/MigoR/migo_r.c | 10 ---------- board/renesas/ap325rxa/ap325rxa.c | 10 ---------- board/renesas/ecovec/ecovec.c | 10 ---------- board/renesas/r0p7734/r0p7734.c | 11 ----------- board/renesas/r2dplus/r2dplus.c | 10 ---------- board/renesas/r7780mp/r7780mp.c | 10 ---------- board/renesas/rsk7203/rsk7203.c | 10 ---------- board/renesas/rsk7264/rsk7264.c | 10 ---------- board/renesas/rsk7269/rsk7269.c | 10 ---------- board/renesas/sh7752evb/sh7752evb.c | 11 ----------- board/renesas/sh7753evb/sh7753evb.c | 11 ----------- board/renesas/sh7757lcr/sh7757lcr.c | 25 ------------------------- board/renesas/sh7763rdp/sh7763rdp.c | 10 ---------- board/renesas/sh7785lcr/sh7785lcr.c | 10 ---------- board/shmin/shmin.c | 10 ---------- 23 files changed, 18 insertions(+), 230 deletions(-) create mode 100644 arch/sh/lib/board.c
diff --git a/arch/sh/lib/Makefile b/arch/sh/lib/Makefile index c5cf89f..7be20b1 100644 --- a/arch/sh/lib/Makefile +++ b/arch/sh/lib/Makefile @@ -5,7 +5,7 @@ # SPDX-License-Identifier: GPL-2.0+ #
- +obj-y += board.o obj-$(CONFIG_CMD_BOOTM) += bootm.o ifeq ($(CONFIG_CPU_SH2),y) obj-y += time_sh2.o diff --git a/arch/sh/lib/board.c b/arch/sh/lib/board.c new file mode 100644 index 0000000..7cb594e --- /dev/null +++ b/arch/sh/lib/board.c @@ -0,0 +1,17 @@ +/* + * Copyright (C) 2016 Vladimir Zapolskiy vz@mleia.com + * + * SPDX-License-Identifier: GPL-2.0+ + */ + +#include <common.h> + +DECLARE_GLOBAL_DATA_PTR; + +int dram_init(void) +{ + gd->ram_size = get_ram_size((long *)CONFIG_SYS_SDRAM_BASE, + CONFIG_SYS_SDRAM_SIZE); + + return 0; +} diff --git a/board/alphaproject/ap_sh4a_4a/ap_sh4a_4a.c b/board/alphaproject/ap_sh4a_4a/ap_sh4a_4a.c index e65befc..31418a1 100644 --- a/board/alphaproject/ap_sh4a_4a/ap_sh4a_4a.c +++ b/board/alphaproject/ap_sh4a_4a/ap_sh4a_4a.c @@ -11,8 +11,6 @@ #include <netdev.h> #include <i2c.h>
-DECLARE_GLOBAL_DATA_PTR; - #define MODEMR (0xFFCC0020) #define MODEMR_MASK (0x6) #define MODEMR_533MHZ (0x2) @@ -172,12 +170,3 @@ int board_late_init(void)
return 0; } - -int dram_init(void) -{ - gd->bd->bi_memstart = CONFIG_SYS_SDRAM_BASE; - gd->bd->bi_memsize = CONFIG_SYS_SDRAM_SIZE; - printf("DRAM: %dMB\n", CONFIG_SYS_SDRAM_SIZE / (1024 * 1024)); - - return 0; -} diff --git a/board/espt/espt.c b/board/espt/espt.c index ee6e538..9ab71fe 100644 --- a/board/espt/espt.c +++ b/board/espt/espt.c @@ -11,8 +11,6 @@ #include <asm/io.h> #include <asm/processor.h>
-DECLARE_GLOBAL_DATA_PTR; - int checkboard(void) { puts("BOARD: ESPT-GIGA\n"); @@ -24,14 +22,6 @@ int board_init(void) return 0; }
-int dram_init(void) -{ - gd->bd->bi_memstart = CONFIG_SYS_SDRAM_BASE; - gd->bd->bi_memsize = CONFIG_SYS_SDRAM_SIZE; - printf("DRAM: %dMB\n", CONFIG_SYS_SDRAM_SIZE / (1024 * 1024)); - return 0; -} - void led_set_state(unsigned short value) { } diff --git a/board/mpr2/mpr2.c b/board/mpr2/mpr2.c index 7449e03..3788a39 100644 --- a/board/mpr2/mpr2.c +++ b/board/mpr2/mpr2.c @@ -11,8 +11,6 @@ #include <asm/io.h> #include <asm/processor.h>
-DECLARE_GLOBAL_DATA_PTR; - int checkboard(void) { puts("BOARD: MPR2\n"); @@ -138,11 +136,3 @@ int board_init(void)
return 0; } - -int dram_init(void) -{ - gd->bd->bi_memstart = CONFIG_SYS_SDRAM_BASE; - gd->bd->bi_memsize = CONFIG_SYS_SDRAM_SIZE; - printf("SDRAM: %dMB\n", CONFIG_SYS_SDRAM_SIZE / (1024 * 1024)); - return 0; -} diff --git a/board/ms7720se/ms7720se.c b/board/ms7720se/ms7720se.c index 534a422..48edcc6 100644 --- a/board/ms7720se/ms7720se.c +++ b/board/ms7720se/ms7720se.c @@ -17,8 +17,6 @@ #include <asm/io.h> #include <asm/processor.h>
-DECLARE_GLOBAL_DATA_PTR; - #define LED_BASE 0xB0800000
int checkboard(void) @@ -32,14 +30,6 @@ int board_init(void) return 0; }
-int dram_init(void) -{ - gd->bd->bi_memstart = CONFIG_SYS_SDRAM_BASE; - gd->bd->bi_memsize = CONFIG_SYS_SDRAM_SIZE; - printf("DRAM: %dMB\n", CONFIG_SYS_SDRAM_SIZE / (1024 * 1024)); - return 0; -} - void led_set_state(unsigned short value) { outw(value & 0xFF, LED_BASE); diff --git a/board/ms7722se/ms7722se.c b/board/ms7722se/ms7722se.c index ee1e99c..869b415 100644 --- a/board/ms7722se/ms7722se.c +++ b/board/ms7722se/ms7722se.c @@ -15,8 +15,6 @@ #include <asm/io.h> #include <asm/processor.h>
-DECLARE_GLOBAL_DATA_PTR; - #define LED_BASE 0xB0800000
int checkboard(void) @@ -33,14 +31,6 @@ int board_init(void) return 0; }
-int dram_init(void) -{ - gd->bd->bi_memstart = CONFIG_SYS_SDRAM_BASE; - gd->bd->bi_memsize = CONFIG_SYS_SDRAM_SIZE; - printf("DRAM: %dMB\n", CONFIG_SYS_SDRAM_SIZE / (1024 * 1024)); - return 0; -} - void led_set_state(unsigned short value) { writew(value & 0xFF, LED_BASE); diff --git a/board/ms7750se/ms7750se.c b/board/ms7750se/ms7750se.c index a7f9346..d252faa 100644 --- a/board/ms7750se/ms7750se.c +++ b/board/ms7750se/ms7750se.c @@ -8,8 +8,6 @@ #include <common.h> #include <asm/processor.h>
-DECLARE_GLOBAL_DATA_PTR; - int checkboard(void) { puts("BOARD: SH7750/SH7750S/SH7750R Solution Engine\n"); @@ -21,14 +19,6 @@ int board_init(void) return 0; }
-int dram_init (void) -{ - gd->bd->bi_memstart = CONFIG_SYS_SDRAM_BASE; - gd->bd->bi_memsize = CONFIG_SYS_SDRAM_SIZE; - printf("DRAM: %dMB\n", CONFIG_SYS_SDRAM_SIZE / (1024 * 1024)); - return 0; -} - int board_late_init(void) { return 0; diff --git a/board/renesas/MigoR/migo_r.c b/board/renesas/MigoR/migo_r.c index fa2bf78..6409a73 100644 --- a/board/renesas/MigoR/migo_r.c +++ b/board/renesas/MigoR/migo_r.c @@ -15,8 +15,6 @@ #include <asm/io.h> #include <asm/processor.h>
-DECLARE_GLOBAL_DATA_PTR; - int checkboard(void) { puts("BOARD: Renesas MigoR\n"); @@ -28,14 +26,6 @@ int board_init(void) return 0; }
-int dram_init (void) -{ - gd->bd->bi_memstart = CONFIG_SYS_SDRAM_BASE; - gd->bd->bi_memsize = CONFIG_SYS_SDRAM_SIZE; - printf("DRAM: %dMB\n", CONFIG_SYS_SDRAM_SIZE / (1024 * 1024)); - return 0; -} - void led_set_state (unsigned short value) { } diff --git a/board/renesas/ap325rxa/ap325rxa.c b/board/renesas/ap325rxa/ap325rxa.c index 518ad7b..218d479 100644 --- a/board/renesas/ap325rxa/ap325rxa.c +++ b/board/renesas/ap325rxa/ap325rxa.c @@ -10,8 +10,6 @@ #include <asm/io.h> #include <asm/processor.h>
-DECLARE_GLOBAL_DATA_PTR; - /* PRI control register */ #define PRPRICR5 0xFF800048 /* LMB */ #define PRPRICR5_D 0x2a @@ -130,14 +128,6 @@ int board_init(void) return 0; }
-int dram_init(void) -{ - gd->bd->bi_memstart = CONFIG_SYS_SDRAM_BASE; - gd->bd->bi_memsize = CONFIG_SYS_SDRAM_SIZE; - printf("DRAM: %dMB\n", CONFIG_SYS_SDRAM_SIZE / (1024 * 1024)); - return 0; -} - void led_set_state(unsigned short value) { } diff --git a/board/renesas/ecovec/ecovec.c b/board/renesas/ecovec/ecovec.c index d862d99..28b557a 100644 --- a/board/renesas/ecovec/ecovec.c +++ b/board/renesas/ecovec/ecovec.c @@ -22,16 +22,6 @@ int checkboard(void) return 0; }
-int dram_init(void) -{ - DECLARE_GLOBAL_DATA_PTR; - - gd->bd->bi_memstart = CONFIG_SYS_SDRAM_BASE; - gd->bd->bi_memsize = CONFIG_SYS_SDRAM_SIZE; - printf("DRAM: %dMB\n", CONFIG_SYS_SDRAM_SIZE / (1024 * 1024)); - return 0; -} - static void debug_led(u8 led) { /* PDGR[0-4] is debug LED */ diff --git a/board/renesas/r0p7734/r0p7734.c b/board/renesas/r0p7734/r0p7734.c index 2e31ba6..360e0a1 100644 --- a/board/renesas/r0p7734/r0p7734.c +++ b/board/renesas/r0p7734/r0p7734.c @@ -11,8 +11,6 @@ #include <netdev.h> #include <i2c.h>
-DECLARE_GLOBAL_DATA_PTR; - #define MODEMR (0xFFCC0020) #define MODEMR_MASK (0x6) #define MODEMR_533MHZ (0x2) @@ -61,15 +59,6 @@ int board_late_init(void) return 0; }
-int dram_init(void) -{ - gd->bd->bi_memstart = CONFIG_SYS_SDRAM_BASE; - gd->bd->bi_memsize = CONFIG_SYS_SDRAM_SIZE; - printf("DRAM: %dMB\n", CONFIG_SYS_SDRAM_SIZE / (1024 * 1024)); - - return 0; -} - #ifdef CONFIG_SMC911X int board_eth_init(bd_t *bis) { diff --git a/board/renesas/r2dplus/r2dplus.c b/board/renesas/r2dplus/r2dplus.c index 249c35f..d6fb4da 100644 --- a/board/renesas/r2dplus/r2dplus.c +++ b/board/renesas/r2dplus/r2dplus.c @@ -12,8 +12,6 @@ #include <asm/io.h> #include <asm/pci.h>
-DECLARE_GLOBAL_DATA_PTR; - int checkboard(void) { puts("BOARD: Renesas Solutions R2D Plus\n"); @@ -25,14 +23,6 @@ int board_init(void) return 0; }
-int dram_init(void) -{ - gd->bd->bi_memstart = CONFIG_SYS_SDRAM_BASE; - gd->bd->bi_memsize = CONFIG_SYS_SDRAM_SIZE; - printf("DRAM: %dMB\n", CONFIG_SYS_SDRAM_SIZE / (1024 * 1024)); - return 0; -} - int board_late_init(void) { return 0; diff --git a/board/renesas/r7780mp/r7780mp.c b/board/renesas/r7780mp/r7780mp.c index 783352d..de259f5 100644 --- a/board/renesas/r7780mp/r7780mp.c +++ b/board/renesas/r7780mp/r7780mp.c @@ -13,8 +13,6 @@ #include <netdev.h> #include "r7780mp.h"
-DECLARE_GLOBAL_DATA_PTR; - int checkboard(void) { #if defined(CONFIG_R7780MP) @@ -33,14 +31,6 @@ int board_init(void) return 0; }
-int dram_init(void) -{ - gd->bd->bi_memstart = CONFIG_SYS_SDRAM_BASE; - gd->bd->bi_memsize = CONFIG_SYS_SDRAM_SIZE; - printf("DRAM: %dMB\n", CONFIG_SYS_SDRAM_SIZE / (1024 * 1024)); - return 0; -} - void led_set_state(unsigned short value) {
diff --git a/board/renesas/rsk7203/rsk7203.c b/board/renesas/rsk7203/rsk7203.c index 8800371..72c562d 100644 --- a/board/renesas/rsk7203/rsk7203.c +++ b/board/renesas/rsk7203/rsk7203.c @@ -13,8 +13,6 @@ #include <asm/io.h> #include <asm/processor.h>
-DECLARE_GLOBAL_DATA_PTR; - int checkboard(void) { puts("BOARD: Renesas Technology RSK7203\n"); @@ -26,14 +24,6 @@ int board_init(void) return 0; }
-int dram_init(void) -{ - gd->bd->bi_memstart = CONFIG_SYS_SDRAM_BASE; - gd->bd->bi_memsize = CONFIG_SYS_SDRAM_SIZE; - printf("DRAM: %dMB\n", CONFIG_SYS_SDRAM_SIZE / (1024 * 1024)); - return 0; -} - void led_set_state(unsigned short value) { } diff --git a/board/renesas/rsk7264/rsk7264.c b/board/renesas/rsk7264/rsk7264.c index d938b3a..4ebb27b 100644 --- a/board/renesas/rsk7264/rsk7264.c +++ b/board/renesas/rsk7264/rsk7264.c @@ -14,8 +14,6 @@ #include <asm/io.h> #include <asm/processor.h>
-DECLARE_GLOBAL_DATA_PTR; - int checkboard(void) { puts("BOARD: Renesas Technology RSK7264\n"); @@ -27,14 +25,6 @@ int board_init(void) return 0; }
-int dram_init(void) -{ - gd->bd->bi_memstart = CONFIG_SYS_SDRAM_BASE; - gd->bd->bi_memsize = CONFIG_SYS_SDRAM_SIZE; - printf("DRAM: %dMB\n", CONFIG_SYS_SDRAM_SIZE / (1024 * 1024)); - return 0; -} - void led_set_state(unsigned short value) { } diff --git a/board/renesas/rsk7269/rsk7269.c b/board/renesas/rsk7269/rsk7269.c index ae32b6a..0066f9f 100644 --- a/board/renesas/rsk7269/rsk7269.c +++ b/board/renesas/rsk7269/rsk7269.c @@ -15,8 +15,6 @@ #include <asm/io.h> #include <asm/processor.h>
-DECLARE_GLOBAL_DATA_PTR; - int checkboard(void) { puts("BOARD: Renesas RSK7269\n"); @@ -28,14 +26,6 @@ int board_init(void) return 0; }
-int dram_init(void) -{ - gd->bd->bi_memstart = CONFIG_SYS_SDRAM_BASE; - gd->bd->bi_memsize = CONFIG_SYS_SDRAM_SIZE; - printf("DRAM: %dMB\n", CONFIG_SYS_SDRAM_SIZE / (1024 * 1024)); - return 0; -} - void led_set_state(unsigned short value) { } diff --git a/board/renesas/sh7752evb/sh7752evb.c b/board/renesas/sh7752evb/sh7752evb.c index 3aad532..525d979 100644 --- a/board/renesas/sh7752evb/sh7752evb.c +++ b/board/renesas/sh7752evb/sh7752evb.c @@ -159,17 +159,6 @@ int board_init(void) return 0; }
-int dram_init(void) -{ - DECLARE_GLOBAL_DATA_PTR; - - gd->bd->bi_memstart = CONFIG_SYS_SDRAM_BASE; - gd->bd->bi_memsize = CONFIG_SYS_SDRAM_SIZE; - printf("DRAM: %dMB\n", CONFIG_SYS_SDRAM_SIZE / (1024 * 1024)); - - return 0; -} - int board_mmc_init(bd_t *bis) { struct gpio_regs *gpio = GPIO_BASE; diff --git a/board/renesas/sh7753evb/sh7753evb.c b/board/renesas/sh7753evb/sh7753evb.c index 52a1906..3d1eeda 100644 --- a/board/renesas/sh7753evb/sh7753evb.c +++ b/board/renesas/sh7753evb/sh7753evb.c @@ -175,17 +175,6 @@ int board_init(void) return 0; }
-int dram_init(void) -{ - DECLARE_GLOBAL_DATA_PTR; - - gd->bd->bi_memstart = CONFIG_SYS_SDRAM_BASE; - gd->bd->bi_memsize = CONFIG_SYS_SDRAM_SIZE; - printf("DRAM: %dMB\n", CONFIG_SYS_SDRAM_SIZE / (1024 * 1024)); - - return 0; -} - int board_mmc_init(bd_t *bis) { struct gpio_regs *gpio = GPIO_BASE; diff --git a/board/renesas/sh7757lcr/sh7757lcr.c b/board/renesas/sh7757lcr/sh7757lcr.c index ddcf275..0a04a9d 100644 --- a/board/renesas/sh7757lcr/sh7757lcr.c +++ b/board/renesas/sh7757lcr/sh7757lcr.c @@ -224,31 +224,6 @@ int board_init(void) return 0; }
-int dram_init(void) -{ - DECLARE_GLOBAL_DATA_PTR; - - gd->bd->bi_memstart = CONFIG_SYS_SDRAM_BASE; - gd->bd->bi_memsize = CONFIG_SYS_SDRAM_SIZE; - printf("DRAM: %dMB\n", CONFIG_SYS_SDRAM_SIZE / (1024 * 1024)); - printf(" Physical address\n"); - printf(" 0x%08x - 0x%08x : Accessible Space as ECC Area\n", - SH7757LCR_SDRAM_PHYS_TOP, - SH7757LCR_SDRAM_PHYS_TOP + SH7757LCR_SDRAM_SIZE - 1); - printf(" 0x%08x - 0x%08x : No Access Area\n", - SH7757LCR_SDRAM_PHYS_TOP + SH7757LCR_SDRAM_SIZE, - SH7757LCR_SDRAM_PHYS_TOP + SH7757LCR_SDRAM_SIZE * 2 - 1); - printf(" 0x%08x - 0x%08x : Non-ECC Area for DVC/AVC\n", - SH7757LCR_SDRAM_PHYS_TOP + SH7757LCR_SDRAM_ECC_SETTING * 2, - SH7757LCR_SDRAM_PHYS_TOP + SH7757LCR_SDRAM_ECC_SETTING * 2 + - SH7757LCR_SDRAM_DVC_SIZE - 1); - printf(" 0x%08x - 0x%08x : Non-ECC Area for G200eR2\n", - SH7757LCR_SDRAM_PHYS_TOP + SH7757LCR_GRA_OFFSET, - SH7757LCR_SDRAM_PHYS_TOP + SH7757LCR_GRA_OFFSET + 0x00ffffff); - - return 0; -} - int board_mmc_init(bd_t *bis) { return mmcif_mmc_init(); diff --git a/board/renesas/sh7763rdp/sh7763rdp.c b/board/renesas/sh7763rdp/sh7763rdp.c index 9658a5e..d83e2f8 100644 --- a/board/renesas/sh7763rdp/sh7763rdp.c +++ b/board/renesas/sh7763rdp/sh7763rdp.c @@ -12,8 +12,6 @@ #include <asm/io.h> #include <asm/processor.h>
-DECLARE_GLOBAL_DATA_PTR; - #define CPU_CMDREG 0xB1000006 #define PDCR 0xffef0006 #define PECR 0xffef0008 @@ -51,14 +49,6 @@ int board_init(void) return 0; }
-int dram_init(void) -{ - gd->bd->bi_memstart = CONFIG_SYS_SDRAM_BASE; - gd->bd->bi_memsize = CONFIG_SYS_SDRAM_SIZE; - printf("DRAM: %dMB\n", CONFIG_SYS_SDRAM_SIZE / (1024 * 1024)); - return 0; -} - void led_set_state(unsigned short value) { } diff --git a/board/renesas/sh7785lcr/sh7785lcr.c b/board/renesas/sh7785lcr/sh7785lcr.c index 622e602..a1a0301 100644 --- a/board/renesas/sh7785lcr/sh7785lcr.c +++ b/board/renesas/sh7785lcr/sh7785lcr.c @@ -10,8 +10,6 @@ #include <asm/pci.h> #include <netdev.h>
-DECLARE_GLOBAL_DATA_PTR; - int checkboard(void) { puts("BOARD: Renesas Technology Corp. R0P7785LC0011RL\n"); @@ -23,14 +21,6 @@ int board_init(void) return 0; }
-int dram_init(void) -{ - gd->bd->bi_memstart = CONFIG_SYS_SDRAM_BASE; - gd->bd->bi_memsize = CONFIG_SYS_SDRAM_SIZE; - printf("DRAM: %dMB\n", CONFIG_SYS_SDRAM_SIZE / (1024 * 1024)); - return 0; -} - static struct pci_controller hose; void pci_init_board(void) { diff --git a/board/shmin/shmin.c b/board/shmin/shmin.c index 74d1e39..42bd126 100644 --- a/board/shmin/shmin.c +++ b/board/shmin/shmin.c @@ -33,16 +33,6 @@ int board_init(void) return 0; }
-int dram_init(void) -{ - DECLARE_GLOBAL_DATA_PTR; - - gd->bd->bi_memstart = CONFIG_SYS_SDRAM_BASE; - gd->bd->bi_memsize = CONFIG_SYS_SDRAM_SIZE; - printf("DRAM: %dMB\n", CONFIG_SYS_SDRAM_SIZE / (1024 * 1024)); - return 0; -} - int board_eth_init(bd_t *bis) { return ne2k_register();

On 27 November 2016 at 15:15, Vladimir Zapolskiy vz@mleia.com wrote:
Generic board support assumes a different method of specifying DRAM size on board, also it can be shared among all boards, notably only sh7763rdp board has a custom legacy dram_init(), however the difference is only in printing some additional information, this feature can be removed.
Signed-off-by: Vladimir Zapolskiy vz@mleia.com
arch/sh/lib/Makefile | 2 +- arch/sh/lib/board.c | 17 +++++++++++++++++ board/alphaproject/ap_sh4a_4a/ap_sh4a_4a.c | 11 ----------- board/espt/espt.c | 10 ---------- board/mpr2/mpr2.c | 10 ---------- board/ms7720se/ms7720se.c | 10 ---------- board/ms7722se/ms7722se.c | 10 ---------- board/ms7750se/ms7750se.c | 10 ---------- board/renesas/MigoR/migo_r.c | 10 ---------- board/renesas/ap325rxa/ap325rxa.c | 10 ---------- board/renesas/ecovec/ecovec.c | 10 ---------- board/renesas/r0p7734/r0p7734.c | 11 ----------- board/renesas/r2dplus/r2dplus.c | 10 ---------- board/renesas/r7780mp/r7780mp.c | 10 ---------- board/renesas/rsk7203/rsk7203.c | 10 ---------- board/renesas/rsk7264/rsk7264.c | 10 ---------- board/renesas/rsk7269/rsk7269.c | 10 ---------- board/renesas/sh7752evb/sh7752evb.c | 11 ----------- board/renesas/sh7753evb/sh7753evb.c | 11 ----------- board/renesas/sh7757lcr/sh7757lcr.c | 25 ------------------------- board/renesas/sh7763rdp/sh7763rdp.c | 10 ---------- board/renesas/sh7785lcr/sh7785lcr.c | 10 ---------- board/shmin/shmin.c | 10 ---------- 23 files changed, 18 insertions(+), 230 deletions(-) create mode 100644 arch/sh/lib/board.c
Reviewed-by: Simon Glass sjg@chromium.org

On Mon, Nov 28, 2016 at 12:15:31AM +0200, Vladimir Zapolskiy wrote:
Generic board support assumes a different method of specifying DRAM size on board, also it can be shared among all boards, notably only sh7763rdp board has a custom legacy dram_init(), however the difference is only in printing some additional information, this feature can be removed.
Signed-off-by: Vladimir Zapolskiy vz@mleia.com Reviewed-by: Simon Glass sjg@chromium.org
Applied to u-boot/master, thanks!

Commits b61e90e6fd83 ("sh: Drop the arch-specific board init") and f41e6088eb1a ("sh: Fix build errors for generic board") left code and data relocation done in start.S, however further actual U-boot configuration is not started anymore. Practically SH boards with the code relocated into the expected position by start.S still can be booted, so the change adds this option and provides an option how to relocate code for board_init_r() execution.
Signed-off-by: Vladimir Zapolskiy vz@mleia.com --- arch/sh/cpu/sh2/cpu.c | 6 ------ arch/sh/cpu/sh3/cpu.c | 6 ------ arch/sh/cpu/sh4/cpu.c | 6 ------ arch/sh/lib/board.c | 18 ++++++++++++++++++ 4 files changed, 18 insertions(+), 18 deletions(-)
diff --git a/arch/sh/cpu/sh2/cpu.c b/arch/sh/cpu/sh2/cpu.c index 9a93cf5..a2f856f 100644 --- a/arch/sh/cpu/sh2/cpu.c +++ b/arch/sh/cpu/sh2/cpu.c @@ -83,9 +83,3 @@ int dcache_status(void) { return 0; } - -void relocate_code(ulong start_addr_sp, gd_t *new_gd, ulong relocaaddr) -{ - /* TODO(sh maintainer): Implement this */ - while (1); -} diff --git a/arch/sh/cpu/sh3/cpu.c b/arch/sh/cpu/sh3/cpu.c index 494f908..ea0006a 100644 --- a/arch/sh/cpu/sh3/cpu.c +++ b/arch/sh/cpu/sh3/cpu.c @@ -66,9 +66,3 @@ int dcache_status(void) { return 0; } - -void relocate_code(ulong start_addr_sp, gd_t *new_gd, ulong relocaaddr) -{ - /* TODO(sh maintainer): Implement this */ - while (1); -} diff --git a/arch/sh/cpu/sh4/cpu.c b/arch/sh/cpu/sh4/cpu.c index 49c58ae..aa8d4df 100644 --- a/arch/sh/cpu/sh4/cpu.c +++ b/arch/sh/cpu/sh4/cpu.c @@ -41,9 +41,3 @@ int cpu_eth_init(bd_t *bis) #endif return 0; } - -void relocate_code(ulong start_addr_sp, gd_t *new_gd, ulong relocaaddr) -{ - /* TODO(sh maintainer): Implement this */ - while (1); -} diff --git a/arch/sh/lib/board.c b/arch/sh/lib/board.c index 7cb594e..aa967c0 100644 --- a/arch/sh/lib/board.c +++ b/arch/sh/lib/board.c @@ -15,3 +15,21 @@ int dram_init(void)
return 0; } + +void relocate_code(ulong start_addr_sp, gd_t *new_gd, ulong relocaddr) +{ + void (*reloc_board_init_r)(gd_t *gd, ulong dest) = board_init_r; + + if (new_gd->reloc_off) { + memcpy((void *)new_gd->relocaddr, + (void *)(new_gd->relocaddr - new_gd->reloc_off), + new_gd->mon_len); + + reloc_board_init_r += new_gd->reloc_off; + } + + __asm__ __volatile__("mov.l %0, r15\n" : : "m" (new_gd->start_addr_sp)); + + while (1) + reloc_board_init_r(new_gd, 0x0); +}

On 27 November 2016 at 15:15, Vladimir Zapolskiy vz@mleia.com wrote:
Commits b61e90e6fd83 ("sh: Drop the arch-specific board init") and f41e6088eb1a ("sh: Fix build errors for generic board") left code and data relocation done in start.S, however further actual U-boot
U-Boot
configuration is not started anymore. Practically SH boards with the code relocated into the expected position by start.S still can be booted, so the change adds this option and provides an option how to relocate code for board_init_r() execution.
Signed-off-by: Vladimir Zapolskiy vz@mleia.com
arch/sh/cpu/sh2/cpu.c | 6 ------ arch/sh/cpu/sh3/cpu.c | 6 ------ arch/sh/cpu/sh4/cpu.c | 6 ------ arch/sh/lib/board.c | 18 ++++++++++++++++++ 4 files changed, 18 insertions(+), 18 deletions(-)
Reviewed-by: Simon Glass sjg@chromium.org

On Mon, Nov 28, 2016 at 12:15:32AM +0200, Vladimir Zapolskiy wrote:
Commits b61e90e6fd83 ("sh: Drop the arch-specific board init") and f41e6088eb1a ("sh: Fix build errors for generic board") left code and data relocation done in start.S, however further actual U-boot configuration is not started anymore. Practically SH boards with the code relocated into the expected position by start.S still can be booted, so the change adds this option and provides an option how to relocate code for board_init_r() execution.
Signed-off-by: Vladimir Zapolskiy vz@mleia.com Reviewed-by: Simon Glass sjg@chromium.org
Applied to u-boot/master, thanks!

Like on ARM platform keep the first code relocation from a U-boot image storage to RAM at CONFIG_SYS_TEXT_BASE, then pass execution to a generic board_init_f() with empty GD flags. If CONFIG_SYS_TEXT_BASE is equal to a calculated by board_init_f() relocation address there will be no more code and data copy, however it's worth to mention that the first copy happens even if $pc on _start is the same as CONFIG_SYS_TEXT_BASE, on practice this works without a problem.
Also note that _sh_start is renamed back to _start to correct gd->mon_len calculation by setup_mon_len(), the opposite rename was done in pre-generic board commit 2024b968ee9 ("sh: Fix build in start.S").
Signed-off-by: Vladimir Zapolskiy vz@mleia.com --- arch/sh/cpu/sh4/start.S | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-)
diff --git a/arch/sh/cpu/sh4/start.S b/arch/sh/cpu/sh4/start.S index 77fc221..416adcf 100644 --- a/arch/sh/cpu/sh4/start.S +++ b/arch/sh/cpu/sh4/start.S @@ -1,6 +1,6 @@ /* - * (C) Copyright 2007, 2010 - * Nobuhiro Iwamatsu iwamatsu@nigauri.org + * Copyright (C) 2016 Vladimir Zapolskiy vz@mleia.com + * Copyright (C) 2007, 2010 Nobuhiro Iwamatsu iwamatsu@nigauri.org * * SPDX-License-Identifier: GPL-2.0+ */ @@ -12,7 +12,7 @@ .align 2
.global _start -_sh_start: +_start: mov.l ._lowlevel_init, r0 100: bsrf r0 nop @@ -21,7 +21,7 @@ _sh_start: nop 1: sts pr, r5 mov.l ._reloc_dst, r4 - add #(_sh_start-1b), r5 + add #(_start-1b), r5 mov.l ._reloc_dst_end, r6
2: mov.l @r5+, r1 @@ -42,10 +42,9 @@ _sh_start: mov.l ._gd_init, r13 /* global data */ mov.l ._stack_init, r15 /* stack */
- #TODO(sh maintainer): Fix this up to call the correct code - #mov.l ._sh_generic_init, r0 - #jsr @r0 - nop + mov.l ._sh_generic_init, r0 + jsr @r0 + mov #0, r4
loop: bra loop @@ -53,10 +52,10 @@ loop: .align 2
._lowlevel_init: .long (lowlevel_init - (100b + 4)) -._reloc_dst: .long reloc_dst +._reloc_dst: .long _start ._reloc_dst_end: .long reloc_dst_end ._bss_start: .long bss_start ._bss_end: .long bss_end -._gd_init: .long (_sh_start - GENERATED_GBL_DATA_SIZE) -._stack_init: .long (_sh_start - GENERATED_GBL_DATA_SIZE - CONFIG_SYS_MALLOC_LEN - 16) -#._sh_generic_init: .long sh_generic_init +._gd_init: .long (_start - GENERATED_GBL_DATA_SIZE) +._stack_init: .long (_start - GENERATED_GBL_DATA_SIZE - CONFIG_SYS_MALLOC_LEN - 16) +._sh_generic_init: .long board_init_f

On 27 November 2016 at 15:15, Vladimir Zapolskiy vz@mleia.com wrote:
Like on ARM platform keep the first code relocation from a U-boot image storage to RAM at CONFIG_SYS_TEXT_BASE, then pass execution to a generic board_init_f() with empty GD flags. If CONFIG_SYS_TEXT_BASE is equal to a calculated by board_init_f() relocation address there will be no more code and data copy, however it's worth to mention that the first copy happens even if $pc on _start is the same as CONFIG_SYS_TEXT_BASE, on practice this works without a problem.
Also note that _sh_start is renamed back to _start to correct gd->mon_len calculation by setup_mon_len(), the opposite rename was done in pre-generic board commit 2024b968ee9 ("sh: Fix build in start.S").
Signed-off-by: Vladimir Zapolskiy vz@mleia.com
arch/sh/cpu/sh4/start.S | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-)
Reviewed-by: Simon Glass sjg@chromium.org

On Mon, Nov 28, 2016 at 12:15:33AM +0200, Vladimir Zapolskiy wrote:
Like on ARM platform keep the first code relocation from a U-boot image storage to RAM at CONFIG_SYS_TEXT_BASE, then pass execution to a generic board_init_f() with empty GD flags. If CONFIG_SYS_TEXT_BASE is equal to a calculated by board_init_f() relocation address there will be no more code and data copy, however it's worth to mention that the first copy happens even if $pc on _start is the same as CONFIG_SYS_TEXT_BASE, on practice this works without a problem.
Also note that _sh_start is renamed back to _start to correct gd->mon_len calculation by setup_mon_len(), the opposite rename was done in pre-generic board commit 2024b968ee9 ("sh: Fix build in start.S").
Signed-off-by: Vladimir Zapolskiy vz@mleia.com Reviewed-by: Simon Glass sjg@chromium.org
Applied to u-boot/master, thanks!

It is easy to note that SH2/SH3/SH4 start.S code is practically the same with a minor difference for SH2 where a short data header is present. To avoid unwanted code duplication and to automatically convert SH2 and SH3 platforms to generic board support move fixed SH4 start.S into arch/sh/lib/start.S and share it among all platforms.
Signed-off-by: Vladimir Zapolskiy vz@mleia.com --- arch/sh/Makefile | 2 +- arch/sh/cpu/sh2/Makefile | 1 - arch/sh/cpu/sh2/start.S | 66 ---------------------------------------- arch/sh/cpu/sh3/Makefile | 1 - arch/sh/cpu/sh3/start.S | 65 --------------------------------------- arch/sh/cpu/sh4/Makefile | 1 - arch/sh/lib/Makefile | 2 ++ arch/sh/{cpu/sh4 => lib}/start.S | 6 ++++ 8 files changed, 9 insertions(+), 135 deletions(-) delete mode 100644 arch/sh/cpu/sh2/start.S delete mode 100644 arch/sh/cpu/sh3/start.S rename arch/sh/{cpu/sh4 => lib}/start.S (87%)
diff --git a/arch/sh/Makefile b/arch/sh/Makefile index ca55fac..14e0b66 100644 --- a/arch/sh/Makefile +++ b/arch/sh/Makefile @@ -2,7 +2,7 @@ # SPDX-License-Identifier: GPL-2.0+ #
-head-y := arch/sh/cpu/$(CPU)/start.o +head-y := arch/sh/lib/start.o
libs-y += arch/sh/cpu/$(CPU)/ libs-y += arch/sh/lib/ diff --git a/arch/sh/cpu/sh2/Makefile b/arch/sh/cpu/sh2/Makefile index a19ed5e..80fff49 100644 --- a/arch/sh/cpu/sh2/Makefile +++ b/arch/sh/cpu/sh2/Makefile @@ -8,5 +8,4 @@ # SPDX-License-Identifier: GPL-2.0+ #
-extra-y = start.o obj-y = cpu.o interrupts.o watchdog.o diff --git a/arch/sh/cpu/sh2/start.S b/arch/sh/cpu/sh2/start.S deleted file mode 100644 index 6171edc..0000000 --- a/arch/sh/cpu/sh2/start.S +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Copyright (C) 2007,2008 Nobuhiro Iwamatsu iwamatsu@nigauri.org - * Copyright (C) 2008 Renesas Solutions Corp. - - * SPDX-License-Identifier: GPL-2.0+ - */ - -#include <asm-offsets.h> -#include <config.h> - - .text - .align 2 - - .global _start -_sh_start: - .long 0x00000010 /* Ppower ON reset PC*/ - .long 0x00000000 - .long 0x00000010 /* Manual reset PC */ - .long 0x00000000 -_init: - mov.l ._lowlevel_init, r0 -100: bsrf r0 - nop - bsr 1f - nop -1: sts pr, r5 - mov.l ._reloc_dst, r4 - add #(_sh_start-1b), r5 - mov.l ._reloc_dst_end, r6 - -2: mov.l @r5+, r1 - mov.l r1, @r4 - add #4, r4 - cmp/hs r6, r4 - bf 2b - - mov.l ._bss_start, r4 - mov.l ._bss_end, r5 - mov #0, r1 - -3: mov.l r1, @r4 /* bss clear */ - add #4, r4 - cmp/hs r5, r4 - bf 3b - - mov.l ._gd_init, r13 /* global data */ - mov.l ._stack_init, r15 /* stack */ - - #TODO(sh maintainer): Fix this up to call the correct code - #mov.l ._sh_generic_init, r0 - #jsr @r0 - nop - -loop: - bra loop - - .align 2 - -._lowlevel_init: .long (lowlevel_init - (100b + 4)) -._reloc_dst: .long reloc_dst -._reloc_dst_end: .long reloc_dst_end -._bss_start: .long bss_start -._bss_end: .long bss_end -._gd_init: .long (_sh_start - GENERATED_GBL_DATA_SIZE) -._stack_init: .long (_sh_start - GENERATED_GBL_DATA_SIZE - CONFIG_SYS_MALLOC_LEN - 16) -#._sh_generic_init: .long sh_generic_init diff --git a/arch/sh/cpu/sh3/Makefile b/arch/sh/cpu/sh3/Makefile index 85917b9..cddc15b 100644 --- a/arch/sh/cpu/sh3/Makefile +++ b/arch/sh/cpu/sh3/Makefile @@ -11,5 +11,4 @@ # SPDX-License-Identifier: GPL-2.0+ #
-extra-y = start.o obj-y = cpu.o interrupts.o watchdog.o diff --git a/arch/sh/cpu/sh3/start.S b/arch/sh/cpu/sh3/start.S deleted file mode 100644 index 9ed7198..0000000 --- a/arch/sh/cpu/sh3/start.S +++ /dev/null @@ -1,65 +0,0 @@ -/* - * (C) Copyright 2007 - * Yoshihiro Shimoda shimoda.yoshihiro@renesas.com - * - * (C) Copyright 2007 - * Nobuhiro Iwamatsu iwamatsu@nigauri.org - * - * SPDX-License-Identifier: GPL-2.0+ - */ - -#include <asm-offsets.h> -#include <config.h> - - .text - .align 2 - - .global _start -_sh_start: - mov.l ._lowlevel_init, r0 -100: bsrf r0 - nop - - bsr 1f - nop -1: sts pr, r5 - mov.l ._reloc_dst, r4 - add #(_sh_start-1b), r5 - mov.l ._reloc_dst_end, r6 - -2: mov.l @r5+, r1 - mov.l r1, @r4 - add #4, r4 - cmp/hs r6, r4 - bf 2b - - mov.l ._bss_start, r4 - mov.l ._bss_end, r5 - mov #0, r1 - -3: mov.l r1, @r4 /* bss clear */ - add #4, r4 - cmp/hs r5, r4 - bf 3b - - mov.l ._gd_init, r13 /* global data */ - mov.l ._stack_init, r15 /* stack */ - - #TODO(sh maintainer): Fix this up to call the correct code - #mov.l ._sh_generic_init, r0 - #jsr @r0 - nop - -loop: - bra loop - - .align 2 - -._lowlevel_init: .long (lowlevel_init - (100b + 4)) -._reloc_dst: .long reloc_dst -._reloc_dst_end: .long reloc_dst_end -._bss_start: .long bss_start -._bss_end: .long bss_end -._gd_init: .long (_sh_start - GENERATED_GBL_DATA_SIZE) -._stack_init: .long (_sh_start - GENERATED_GBL_DATA_SIZE - CONFIG_SYS_MALLOC_LEN - 16) -#._sh_generic_init: .long sh_generic_init diff --git a/arch/sh/cpu/sh4/Makefile b/arch/sh/cpu/sh4/Makefile index 38c6188..976994b 100644 --- a/arch/sh/cpu/sh4/Makefile +++ b/arch/sh/cpu/sh4/Makefile @@ -8,5 +8,4 @@ # SPDX-License-Identifier: GPL-2.0+ #
-extra-y = start.o obj-y = cpu.o interrupts.o watchdog.o cache.o diff --git a/arch/sh/lib/Makefile b/arch/sh/lib/Makefile index 7be20b1..473cf0d 100644 --- a/arch/sh/lib/Makefile +++ b/arch/sh/lib/Makefile @@ -5,6 +5,8 @@ # SPDX-License-Identifier: GPL-2.0+ #
+extra-y += start.o + obj-y += board.o obj-$(CONFIG_CMD_BOOTM) += bootm.o ifeq ($(CONFIG_CPU_SH2),y) diff --git a/arch/sh/cpu/sh4/start.S b/arch/sh/lib/start.S similarity index 87% rename from arch/sh/cpu/sh4/start.S rename to arch/sh/lib/start.S index 416adcf..37d38d5 100644 --- a/arch/sh/cpu/sh4/start.S +++ b/arch/sh/lib/start.S @@ -13,6 +13,12 @@
.global _start _start: +#ifdef CONFIG_CPU_SH2 + .long 0x00000010 /* Ppower ON reset PC*/ + .long 0x00000000 + .long 0x00000010 /* Manual reset PC */ + .long 0x00000000 +#endif mov.l ._lowlevel_init, r0 100: bsrf r0 nop

On 27 November 2016 at 15:15, Vladimir Zapolskiy vz@mleia.com wrote:
It is easy to note that SH2/SH3/SH4 start.S code is practically the same with a minor difference for SH2 where a short data header is present. To avoid unwanted code duplication and to automatically convert SH2 and SH3 platforms to generic board support move fixed SH4 start.S into arch/sh/lib/start.S and share it among all platforms.
Signed-off-by: Vladimir Zapolskiy vz@mleia.com
arch/sh/Makefile | 2 +- arch/sh/cpu/sh2/Makefile | 1 - arch/sh/cpu/sh2/start.S | 66 ---------------------------------------- arch/sh/cpu/sh3/Makefile | 1 - arch/sh/cpu/sh3/start.S | 65 --------------------------------------- arch/sh/cpu/sh4/Makefile | 1 - arch/sh/lib/Makefile | 2 ++ arch/sh/{cpu/sh4 => lib}/start.S | 6 ++++ 8 files changed, 9 insertions(+), 135 deletions(-) delete mode 100644 arch/sh/cpu/sh2/start.S delete mode 100644 arch/sh/cpu/sh3/start.S rename arch/sh/{cpu/sh4 => lib}/start.S (87%)
Reviewed-by: Simon Glass sjg@chromium.org

On Mon, Nov 28, 2016 at 12:15:34AM +0200, Vladimir Zapolskiy wrote:
It is easy to note that SH2/SH3/SH4 start.S code is practically the same with a minor difference for SH2 where a short data header is present. To avoid unwanted code duplication and to automatically convert SH2 and SH3 platforms to generic board support move fixed SH4 start.S into arch/sh/lib/start.S and share it among all platforms.
Signed-off-by: Vladimir Zapolskiy vz@mleia.com Reviewed-by: Simon Glass sjg@chromium.org
Applied to u-boot/master, thanks!

Finally add fpic compilation option to produce relocatable code. Note that this requires to define CONFIG_NEEDS_MANUAL_RELOC for all board files, also relocation support still has some limitations (e.g. a developer should care not to overwrite the executing code or memset() with zeroes not yet relocated data on malloc init etc.), which may be fixed while switching to PIE.
Due to short investigation the architecture code is not ready for PIE linking, this will require some manipulations with .dyn* sections.
Signed-off-by: Vladimir Zapolskiy vz@mleia.com --- arch/sh/config.mk | 1 + arch/sh/cpu/u-boot.lds | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-)
diff --git a/arch/sh/config.mk b/arch/sh/config.mk index 673ed8d..71540c8 100644 --- a/arch/sh/config.mk +++ b/arch/sh/config.mk @@ -15,5 +15,6 @@ CONFIG_STANDALONE_LOAD_ADDR += -EB endif
PLATFORM_CPPFLAGS += -DCONFIG_SH -D__SH__ +PLATFORM_RELFLAGS += -fpic LDFLAGS_FINAL = --gc-sections PLATFORM_RELFLAGS += -ffixed-r13 diff --git a/arch/sh/cpu/u-boot.lds b/arch/sh/cpu/u-boot.lds index f2e48c6..bbf9ff4 100644 --- a/arch/sh/cpu/u-boot.lds +++ b/arch/sh/cpu/u-boot.lds @@ -60,7 +60,7 @@ SECTIONS PROVIDE (_fgot = .); .got : { - *(.got) + *(.got.plt) *(.got) . = ALIGN(4); } >ram PROVIDE (_egot = .);

On Mon, Nov 28, 2016 at 12:15:35AM +0200, Vladimir Zapolskiy wrote:
Finally add fpic compilation option to produce relocatable code. Note that this requires to define CONFIG_NEEDS_MANUAL_RELOC for all board files, also relocation support still has some limitations (e.g. a developer should care not to overwrite the executing code or memset() with zeroes not yet relocated data on malloc init etc.), which may be fixed while switching to PIE.
Due to short investigation the architecture code is not ready for PIE linking, this will require some manipulations with .dyn* sections.
Signed-off-by: Vladimir Zapolskiy vz@mleia.com
Applied to u-boot/master, thanks!

This change allows to reserve enough space at the end of board SDRAM to store two copies of U-Boot and malloc heap.
Due to selection of the CONFIG_SYS_TEXT_BASE the second code/data copying is not avoided, first of all this may depend on a used toolchain, secondly at this point some level of volatility is wanted to do more platform changes and do not care about probably changed calculated in runtime relocation offset.
Signed-off-by: Vladimir Zapolskiy vz@mleia.com --- include/configs/r2dplus.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/configs/r2dplus.h b/include/configs/r2dplus.h index e8f60b2..0e954af 100644 --- a/include/configs/r2dplus.h +++ b/include/configs/r2dplus.h @@ -29,7 +29,7 @@ #define CONFIG_SYS_SDRAM_BASE 0x8C000000 #define CONFIG_SYS_SDRAM_SIZE 0x04000000
-#define CONFIG_SYS_TEXT_BASE 0x8FFC0000 +#define CONFIG_SYS_TEXT_BASE 0x8FE00000 #define CONFIG_SYS_LONGHELP #define CONFIG_SYS_CBSIZE 256 #define CONFIG_SYS_PBSIZE 256

On Mon, Nov 28, 2016 at 12:15:36AM +0200, Vladimir Zapolskiy wrote:
This change allows to reserve enough space at the end of board SDRAM to store two copies of U-Boot and malloc heap.
Due to selection of the CONFIG_SYS_TEXT_BASE the second code/data copying is not avoided, first of all this may depend on a used toolchain, secondly at this point some level of volatility is wanted to do more platform changes and do not care about probably changed calculated in runtime relocation offset.
Signed-off-by: Vladimir Zapolskiy vz@mleia.com
Applied to u-boot/master, thanks!
participants (3)
-
Simon Glass
-
Tom Rini
-
Vladimir Zapolskiy