Skip to contentSkip to conversation

sh: add generic board support and fixes

PATCH RESEND Superseded Vladimir Zapolskiy 3 participants 68 messages Nov 27, 2016 – Dec 4, 2016 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

cover 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
Signature · 1 line
2.10.2
#1 lore raw

PATCH RESEND 1/24 sh4: cache: correct dcache flush to invalidate with write-back

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.

---
 arch/sh/cpu/sh4/cache.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/sh/cpu/sh4/cache.c +1 -1
index e1ee970..b3e5fd5 100644
@@ -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)));
 	}
 }
Signature · 1 line
2.10.2
#3 lore raw

PATCH RESEND 2/24 sh4: cache: correct flush_cache() to writeback and invalidate

In reply to Vladimir Zapolskiy

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'.

---
 arch/sh/cpu/sh4/cpu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/sh/cpu/sh4/cpu.c +1 -1
index de90ca7..a2cec98 100644
@@ -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)
Signature · 1 line
2.10.2
#6 lore raw

PATCH RESEND 3/24 sh3: remove unused cache.c file from being built

In reply to Vladimir Zapolskiy

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.

---
 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
arch/sh/cpu/sh3/Makefile +1 -1
index 1dccaf9..85917b9 100644
@@ -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
arch/sh/cpu/sh3/cache.c deleted +0 -96

96 lines not on this page · raw message

Signature · 1 line
2.10.2
#9 lore raw

PATCH RESEND 4/24 sh: cache use jump_to_P2() and back_to_P1() from asm/system.h

In reply to Vladimir Zapolskiy

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.

---
 arch/sh/cpu/sh4/cache.c | 39 ++-------------------------------------
 1 file changed, 2 insertions(+), 37 deletions(-)
arch/sh/cpu/sh4/cache.c +2 -37
index b3e5fd5..50695b6 100644
@@ -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
Signature · 1 line
2.10.2
#12 lore raw

PATCH RESEND 5/24 sh: cache: don't modify CCR from P1 area

In reply to Vladimir Zapolskiy

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.

---
 arch/sh/cpu/sh4/cache.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)
arch/sh/cpu/sh4/cache.c +3 -5
index 50695b6..7750f0f 100644
@@ -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
 
Signature · 1 line
2.10.2
#14 lore raw

PATCH RESEND 6/24 sh4: cache: move exported cache manipulation functions into cache.c

In reply to Vladimir Zapolskiy

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.

---
 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(-)
arch/sh/cpu/sh4/cache.c +36 -3
index 7750f0f..6175c67 100644
@@ -1,6 +1,6 @@
 /*
- * (C) Copyright 2007
- * Nobuhiro Iwamatsu <[email protected]>
+ * (C) Copyright 2016 Vladimir Zapolskiy <[email protected]>
+ * (C) Copyright 2007 Nobuhiro Iwamatsu <[email protected]>
  *
  * 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;
+}
arch/sh/cpu/sh4/cpu.c +0 -34
index a2cec98..49c58ae 100644
@@ -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
arch/sh/include/asm/cache.h +0 -2
index abaf405..b548a35 100644
@@ -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]; };
Signature · 1 line
2.10.2
#17 lore raw

PATCH RESEND 7/24 pci: sh7751: fix up PCI I/O space address

In reply to Vladimir Zapolskiy

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.

---
 drivers/pci/pci_sh7751.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pci/pci_sh7751.c +1 -1
index f189ed8..420ae81 100644
@@ -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);
Signature · 1 line
2.10.2
#19 lore raw

PATCH RESEND 8/24 pci: sh7751: map PCI memory space into SDRAM

In reply to Vladimir Zapolskiy

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.

---
 drivers/pci/pci_sh7751.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)
drivers/pci/pci_sh7751.c +4 -6
index 420ae81..8a50445 100644
@@ -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 */
Signature · 1 line
2.10.2
#21 lore raw

PATCH RESEND 9/24 sh4: remove __io config options from r2dplus and r7780mp boards

In reply to Vladimir Zapolskiy

Defined __io is no-op for the SH architecture and it can be removed from board files without any functional change.

---
 arch/sh/include/asm/io.h  | 10 ----------
 include/configs/r2dplus.h |  1 -
 include/configs/r7780mp.h |  1 -
 3 files changed, 12 deletions(-)
arch/sh/include/asm/io.h +0 -10
index 5dc27be..5cb000c 100644
@@ -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.
include/configs/r2dplus.h +0 -1
index 477f035..2186915 100644
@@ -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 */
include/configs/r7780mp.h +0 -1
index d4f200a..42d5135 100644
@@ -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 */
Signature · 1 line
2.10.2
#24 lore raw

PATCH RESEND 10/24 r2dplus: use P1 area space for text base and PCI system memory

In reply to Vladimir Zapolskiy

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.

---
 include/configs/r2dplus.h | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
include/configs/r2dplus.h +5 -5
index 2186915..21bfe72 100644
@@ -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 */
Signature · 1 line
2.10.2
#27 lore raw

PATCH RESEND 11/24 r2dplus: select rtl8139 driver in defconfig

In reply to Vladimir Zapolskiy

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.

---
 configs/r2dplus_defconfig | 2 ++
 1 file changed, 2 insertions(+)
configs/r2dplus_defconfig +2 -0
index f4dc68e..2637723 100644
@@ -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
Signature · 1 line
2.10.2
#30 lore raw

PATCH RESEND 12/24 common: sh: add necessary define bits to board_f

In reply to Vladimir Zapolskiy

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.

---
 common/board_f.c | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)
common/board_f.c +9 -6
index 4b74835..cc8aee7 100644
@@ -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)
Signature · 1 line
2.10.2
#32 lore raw

PATCH RESEND 13/24 sh4: use single u-boot linker script for all boards

In reply to Vladimir Zapolskiy

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.

---
 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
arch/sh/cpu/u-boot.lds +4 -0
index 78611c2..6f38563 100644
@@ -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);
board/renesas/sh7752evb/Makefile +1 -1
index 856af81..fb6eeec 100644
@@ -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
board/renesas/sh7752evb/u-boot.lds deleted +0 -82

82 lines not on this page · raw message

board/renesas/sh7753evb/Makefile +1 -1
index f7c8e94..4293142 100644
@@ -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
board/renesas/sh7753evb/u-boot.lds deleted +0 -82

82 lines not on this page · raw message

board/renesas/sh7757lcr/Makefile +1 -1
index 1fa3992..f1ce0f6 100644
@@ -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
board/renesas/sh7757lcr/u-boot.lds deleted +0 -83

83 lines not on this page · raw message

include/configs/sh7752evb.h +0 -1
index 38bf408..23c8300 100644
@@ -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
include/configs/sh7753evb.h +0 -1
index 3718bc5..9c601b5 100644
@@ -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
include/configs/sh7757lcr.h +0 -1
index 8820e15..8345e53 100644
@@ -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
Signature · 1 line
2.10.2
#35 lore raw

PATCH RESEND 14/24 sh: place board lowlevel_init code in the beginning of .text

In reply to Vladimir Zapolskiy

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.

---
 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(-)
arch/sh/cpu/u-boot.lds +1 -1
index 6f38563..e90ac06 100644
@@ -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)
board/alphaproject/ap_sh4a_4a/Makefile +1 -1
index 486d0ac..df76466 100644
@@ -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
board/espt/Makefile +1 -1
index 8a8a2c9..f24e9cf 100644
@@ -8,4 +8,4 @@
 #
 
 obj-y	:= espt.o
-obj-y	+= lowlevel_init.o
+extra-y	+= lowlevel_init.o
board/mpr2/Makefile +1 -1
index b6cdeb4..0cb1dd6 100644
@@ -16,4 +16,4 @@
 # SPDX-License-Identifier:	GPL-2.0+
 
 obj-y	:= mpr2.o
-obj-y	+= lowlevel_init.o
+extra-y	+= lowlevel_init.o
board/ms7720se/Makefile +1 -1
index 1819c4c..66c25fa 100644
@@ -13,4 +13,4 @@
 # SPDX-License-Identifier:	GPL-2.0+
 
 obj-y	:= ms7720se.o
-obj-y	+= lowlevel_init.o
+extra-y	+= lowlevel_init.o
board/ms7722se/Makefile +1 -1
index 9f7af78..808d459 100644
@@ -10,4 +10,4 @@
 # SPDX-License-Identifier:	GPL-2.0+
 
 obj-y	:= ms7722se.o
-obj-y	+= lowlevel_init.o
+extra-y	+= lowlevel_init.o
board/ms7750se/Makefile +1 -1
index a8e3ca0..a010e32 100644
@@ -6,4 +6,4 @@
 #
 
 obj-y	:= ms7750se.o
-obj-y	+= lowlevel_init.o
+extra-y	+= lowlevel_init.o
board/renesas/MigoR/Makefile +1 -1
index b4691a1..0686f97 100644
@@ -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
board/renesas/ap325rxa/Makefile +1 -1
index ff72de9..18e1ed5 100644
@@ -9,4 +9,4 @@
 #
 
 obj-y	:= ap325rxa.o cpld-ap325rxa.o
-obj-y	+= lowlevel_init.o
+extra-y	+= lowlevel_init.o
board/renesas/ecovec/Makefile +1 -1
index 943fa47..2e6fb50 100644
@@ -5,4 +5,4 @@
 # SPDX-License-Identifier:	GPL-2.0+
 
 obj-y := ecovec.o
-obj-y += lowlevel_init.o
+extra-y += lowlevel_init.o
board/renesas/r0p7734/Makefile +1 -1
index 1f24d92..bfe52d6 100644
@@ -4,4 +4,4 @@
 # SPDX-License-Identifier:	GPL-2.0+
 
 obj-y	:= r0p7734.o
-obj-y	+= lowlevel_init.o
+extra-y	+= lowlevel_init.o
board/renesas/r2dplus/Makefile +1 -1
index acffb6d..4021ab6 100644
@@ -6,4 +6,4 @@
 #
 
 obj-y	:= r2dplus.o
-obj-y	+= lowlevel_init.o
+extra-y	+= lowlevel_init.o
board/renesas/r7780mp/Makefile +1 -1
index 8dab435..66813a3 100644
@@ -6,4 +6,4 @@
 # SPDX-License-Identifier:	GPL-2.0+
 
 obj-y	:= r7780mp.o
-obj-y	+= lowlevel_init.o
+extra-y	+= lowlevel_init.o
board/renesas/rsk7203/Makefile +1 -1
index 16acfaf..08139a2 100644
@@ -7,4 +7,4 @@
 # SPDX-License-Identifier:	GPL-2.0+
 
 obj-y	:= rsk7203.o
-obj-y	+= lowlevel_init.o
+extra-y	+= lowlevel_init.o
board/renesas/rsk7264/Makefile +1 -1
index 7ada697..2a845a0 100644
@@ -4,4 +4,4 @@
 # SPDX-License-Identifier:	GPL-2.0+
 
 obj-y	:= rsk7264.o
-obj-y	+= lowlevel_init.o
+extra-y	+= lowlevel_init.o
board/renesas/rsk7269/Makefile +1 -1
index 0f053d8..86b2263 100644
@@ -5,4 +5,4 @@
 # SPDX-License-Identifier:	GPL-2.0+
 
 obj-y	:= rsk7269.o
-obj-y	+= lowlevel_init.o
+extra-y	+= lowlevel_init.o
board/renesas/sh7763rdp/Makefile +1 -1
index cbf38bb..13f7ae9 100644
@@ -9,4 +9,4 @@
 #
 
 obj-y	:= sh7763rdp.o
-obj-y	+= lowlevel_init.o
+extra-y	+= lowlevel_init.o
board/renesas/sh7785lcr/Makefile +1 -1
index e8cfb05..1bf5d53 100644
@@ -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
board/shmin/Makefile +1 -1
index daf36de..d169661 100644
@@ -7,4 +7,4 @@
 # SPDX-License-Identifier:	GPL-2.0+
 
 obj-y	:= shmin.o
-obj-y	+= lowlevel_init.o
+extra-y	+= lowlevel_init.o
Signature · 1 line
2.10.2
#38 lore raw

PATCH RESEND 15/24 sh: define entry point and reloc_dst inside a linker script

In reply to Vladimir Zapolskiy

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.

---
 arch/sh/config.mk      | 1 -
 arch/sh/cpu/u-boot.lds | 6 +-----
 2 files changed, 1 insertion(+), 6 deletions(-)
arch/sh/config.mk +0 -1
index 0578fa3..673ed8d 100644
@@ -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
arch/sh/cpu/u-boot.lds +1 -5
index e90ac06..bc240bd 100644
@@ -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 = .);
Signature · 1 line
2.10.2
#41 lore raw

PATCH RESEND 16/24 sh: add MEMORY command to a shared linker script

In reply to Vladimir Zapolskiy

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.

---
 arch/sh/cpu/u-boot.lds | 32 ++++++++++++++++----------------
 1 file changed, 16 insertions(+), 16 deletions(-)
arch/sh/cpu/u-boot.lds +16 -16
index bc240bd..f2e48c6 100644
@@ -1,12 +1,8 @@
 /*
- * Copyright (C) 2007
- * Nobuhiro Iwamatsu <[email protected]>
- *
- * Copyright (C) 2008-2009
- * Yoshihiro Shimoda <[email protected]>
- *
- * Copyright (C) 2008
- * Mark Jonas <[email protected]>
+ * Copyright (C) 2016 Vladimir Zapolskiy <[email protected]>
+ * Copyright (C) 2008-2009 Yoshihiro Shimoda <[email protected]>
+ * Copyright (C) 2008 Mark Jonas <[email protected]>
+ * Copyright (C) 2007 Nobuhiro Iwamatsu <[email protected]>
  *
  * 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 = .);
 }
Signature · 1 line
2.10.2
#44 lore raw

PATCH RESEND 17/24 sh: remove undefined DEBUG preprocessor token from board config files

In reply to Vladimir Zapolskiy

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.

---
 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(-)
include/configs/MigoR.h +0 -1
index bb12785..e1338cd 100644
@@ -9,7 +9,6 @@
 #ifndef __MIGO_R_H
 #define __MIGO_R_H
 
-#undef DEBUG
 #define CONFIG_CPU_SH7722	1
 #define CONFIG_MIGO_R		1
 
include/configs/ap325rxa.h +0 -1
index 9a4d2c9..6e39868 100644
@@ -10,7 +10,6 @@
 #ifndef __AP325RXA_H
 #define __AP325RXA_H
 
-#undef DEBUG
 #define CONFIG_CPU_SH7723	1
 #define CONFIG_AP325RXA	1
 
include/configs/ap_sh4a_4a.h +0 -1
index 93205aa..d2d9770 100644
@@ -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
include/configs/ecovec.h +0 -1
index e1e3c78..19514b6 100644
@@ -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
include/configs/r0p7734.h +0 -1
index 0552003..2ae9e02 100644
@@ -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
include/configs/r2dplus.h +0 -2
index 21bfe72..a0e0c1c 100644
@@ -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
include/configs/r7780mp.h +0 -1
index 42d5135..9812bc8 100644
@@ -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
include/configs/rsk7203.h +0 -1
index 9db73d3..2eb9d31 100644
@@ -10,7 +10,6 @@
 #ifndef __RSK7203_H
 #define __RSK7203_H
 
-#undef DEBUG
 #define CONFIG_CPU_SH7203	1
 #define CONFIG_RSK7203	1
 
include/configs/rsk7264.h +0 -1
index 3f9fb7b..55dd2c4 100644
@@ -11,7 +11,6 @@
 #ifndef __RSK7264_H
 #define __RSK7264_H
 
-#undef DEBUG
 #define CONFIG_CPU_SH7264	1
 #define CONFIG_RSK7264		1
 
include/configs/rsk7269.h +0 -1
index b7f361b..ec7a99b 100644
@@ -10,7 +10,6 @@
 #ifndef __RSK7269_H
 #define __RSK7269_H
 
-#undef DEBUG
 #define CONFIG_CPU_SH7269	1
 #define CONFIG_RSK7269		1
 
include/configs/sh7752evb.h +0 -1
index 23c8300..4f99856 100644
@@ -9,7 +9,6 @@
 #ifndef __SH7752EVB_H
 #define __SH7752EVB_H
 
-#undef DEBUG
 #define CONFIG_CPU_SH7752	1
 #define CONFIG_SH7752EVB	1
 
include/configs/sh7753evb.h +0 -1
index 9c601b5..e2ef2d5 100644
@@ -9,7 +9,6 @@
 #ifndef __SH7753EVB_H
 #define __SH7753EVB_H
 
-#undef DEBUG
 #define CONFIG_CPU_SH7753	1
 #define CONFIG_SH7753EVB	1
 
include/configs/sh7757lcr.h +0 -1
index 8345e53..a5a9396 100644
@@ -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
include/configs/sh7785lcr.h +0 -1
index a49e839..926efbe 100644
@@ -9,7 +9,6 @@
 #ifndef __SH7785LCR_H
 #define __SH7785LCR_H
 
-#undef DEBUG
 #define CONFIG_CPU_SH7785	1
 #define CONFIG_SH7785LCR	1
 
Signature · 1 line
2.10.2
#47 lore raw

PATCH RESEND 18/24 sh: define CONFIG_DISPLAY_BOARDINFO to print board information

In reply to Vladimir Zapolskiy

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.

---
 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(+)
include/configs/MigoR.h +1 -0
index e1338cd..75c5af6 100644
@@ -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 */
include/configs/ap325rxa.h +1 -0
index 6e39868..c86ce05 100644
@@ -20,6 +20,7 @@
 #define CONFIG_BAUDRATE		38400
 #define CONFIG_BOOTARGS		"console=ttySC2,38400"
 
+#define CONFIG_DISPLAY_BOARDINFO
 #undef  CONFIG_SHOW_BOOT_PROGRESS
 
 /* SMC9118 */
include/configs/ap_sh4a_4a.h +1 -0
index d2d9770..4b07f06 100644
@@ -23,6 +23,7 @@
 #define CONFIG_BAUDRATE		115200
 #define CONFIG_BOOTARGS		"console=ttySC4,115200"
 
+#define CONFIG_DISPLAY_BOARDINFO
 #undef  CONFIG_SHOW_BOOT_PROGRESS
 
 /* Ether */
include/configs/ecovec.h +1 -0
index 19514b6..6470327 100644
@@ -37,6 +37,7 @@
 #define CONFIG_BAUDRATE		115200
 #define CONFIG_BOOTARGS		"console=ttySC0,115200"
 
+#define CONFIG_DISPLAY_BOARDINFO
 #undef  CONFIG_SHOW_BOOT_PROGRESS
 
 /* I2C */
include/configs/espt.h +1 -0
index e76a4ee..9475740 100644
@@ -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 */
include/configs/mpr2.h +2 -0
index 1a8909a..0d37912 100644
@@ -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 */
include/configs/ms7720se.h +1 -0
index d136726..87f8712 100644
@@ -21,6 +21,7 @@
 #define CONFIG_BOOTFILE		"/boot/zImage"
 #define CONFIG_LOADADDR		0x8E000000
 
+#define CONFIG_DISPLAY_BOARDINFO
 #undef  CONFIG_SHOW_BOOT_PROGRESS
 
 /* MEMORY */
include/configs/ms7722se.h +1 -0
index a473eec..181d021 100644
@@ -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 */
include/configs/ms7750se.h +2 -0
index c0fb16d..6268d73 100644
@@ -15,6 +15,8 @@
 #define CONFIG_MS7750SE		1
 #define __LITTLE_ENDIAN__	1
 
+#define CONFIG_DISPLAY_BOARDINFO
+
 /*
  * Command line configuration.
  */
include/configs/r0p7734.h +1 -0
index 2ae9e02..f7412f0 100644
@@ -23,6 +23,7 @@
 #define CONFIG_BAUDRATE		115200
 #define CONFIG_BOOTARGS		"console=ttySC3,115200"
 
+#define CONFIG_DISPLAY_BOARDINFO
 #undef  CONFIG_SHOW_BOOT_PROGRESS
 
 /* Ether */
include/configs/r2dplus.h +2 -0
index a0e0c1c..e8f60b2 100644
@@ -6,6 +6,8 @@
 #define CONFIG_R2DPLUS		1
 #define __LITTLE_ENDIAN__	1
 
+#define CONFIG_DISPLAY_BOARDINFO
+
 /*
  * Command line configuration.
  */
include/configs/r7780mp.h +2 -0
index 9812bc8..baadd87 100644
@@ -15,6 +15,8 @@
 #define CONFIG_SYS_R7780MP_OLD_FLASH	1
 #define __LITTLE_ENDIAN__ 1
 
+#define CONFIG_DISPLAY_BOARDINFO
+
 /*
  * Command line configuration.
  */
include/configs/rsk7203.h +1 -0
index 2eb9d31..913cbc2 100644
@@ -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 */
include/configs/rsk7264.h +2 -0
index 55dd2c4..ea60014 100644
@@ -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 }
include/configs/rsk7269.h +2 -0
index ec7a99b..f470954 100644
@@ -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 }
include/configs/sh7752evb.h +1 -0
index 4f99856..67ca4a6 100644
@@ -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
include/configs/sh7753evb.h +1 -0
index e2ef2d5..d77b470 100644
@@ -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
include/configs/sh7757lcr.h +1 -0
index a5a9396..efb7ad9 100644
@@ -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 */
include/configs/sh7763rdp.h +1 -0
index 2e45699..6124826 100644
@@ -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 */
include/configs/sh7785lcr.h +1 -0
index 926efbe..a74fd60 100644
@@ -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 */
include/configs/shmin.h +1 -0
index e0fc3a2..dde6625 100644
@@ -26,6 +26,7 @@
  * you should set undef.
  */
 #undef  CONFIG_SHOW_BOOT_PROGRESS
+#define CONFIG_DISPLAY_BOARDINFO
 
 /* system */
 #define SHMIN_SDRAM_BASE		(0x8C000000)
Signature · 1 line
2.10.2
#50 lore raw

PATCH RESEND 19/24 sh: add common dram_init() function for all boards

In reply to Vladimir Zapolskiy

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.

---
 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
arch/sh/lib/Makefile +1 -1
index c5cf89f..7be20b1 100644
@@ -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
arch/sh/lib/board.c new file +17 -0
new file mode 100644
index 0000000..7cb594e
@@ -0,0 +1,17 @@
+/*
+ * Copyright (C) 2016 Vladimir Zapolskiy <[email protected]>
+ *
+ * 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;
+}
board/alphaproject/ap_sh4a_4a/ap_sh4a_4a.c +0 -11
index e65befc..31418a1 100644
@@ -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;
-}
board/espt/espt.c +0 -10
index ee6e538..9ab71fe 100644
@@ -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)
 {
 }
board/mpr2/mpr2.c +0 -10
index 7449e03..3788a39 100644
@@ -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;
-}
board/ms7720se/ms7720se.c +0 -10
index 534a422..48edcc6 100644
@@ -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);
board/ms7722se/ms7722se.c +0 -10
index ee1e99c..869b415 100644
@@ -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);
board/ms7750se/ms7750se.c +0 -10
index a7f9346..d252faa 100644
@@ -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;
board/renesas/MigoR/migo_r.c +0 -10
index fa2bf78..6409a73 100644
@@ -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)
 {
 }
board/renesas/ap325rxa/ap325rxa.c +0 -10
index 518ad7b..218d479 100644
@@ -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)
 {
 }
board/renesas/ecovec/ecovec.c +0 -10
index d862d99..28b557a 100644
@@ -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 */
board/renesas/r0p7734/r0p7734.c +0 -11
index 2e31ba6..360e0a1 100644
@@ -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)
 {
board/renesas/r2dplus/r2dplus.c +0 -10
index 249c35f..d6fb4da 100644
@@ -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;
board/renesas/r7780mp/r7780mp.c +0 -10
index 783352d..de259f5 100644
@@ -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)
 {
 
board/renesas/rsk7203/rsk7203.c +0 -10
index 8800371..72c562d 100644
@@ -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)
 {
 }
board/renesas/rsk7264/rsk7264.c +0 -10
index d938b3a..4ebb27b 100644
@@ -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)
 {
 }
board/renesas/rsk7269/rsk7269.c +0 -10
index ae32b6a..0066f9f 100644
@@ -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)
 {
 }
board/renesas/sh7752evb/sh7752evb.c +0 -11
index 3aad532..525d979 100644
@@ -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;
board/renesas/sh7753evb/sh7753evb.c +0 -11
index 52a1906..3d1eeda 100644
@@ -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;
board/renesas/sh7757lcr/sh7757lcr.c +0 -25
index ddcf275..0a04a9d 100644
@@ -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();
board/renesas/sh7763rdp/sh7763rdp.c +0 -10
index 9658a5e..d83e2f8 100644
@@ -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)
 {
 }
board/renesas/sh7785lcr/sh7785lcr.c +0 -10
index 622e602..a1a0301 100644
@@ -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)
 {
board/shmin/shmin.c +0 -10
index 74d1e39..42bd126 100644
@@ -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();
Signature · 1 line
2.10.2
#53 lore raw

PATCH RESEND 20/24 sh: add shared relocate_code() function and call board_init_r()

In reply to Vladimir Zapolskiy

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.

---
 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(-)
arch/sh/cpu/sh2/cpu.c +0 -6
index 9a93cf5..a2f856f 100644
@@ -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);
-}
arch/sh/cpu/sh3/cpu.c +0 -6
index 494f908..ea0006a 100644
@@ -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);
-}
arch/sh/cpu/sh4/cpu.c +0 -6
index 49c58ae..aa8d4df 100644
@@ -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);
-}
arch/sh/lib/board.c +18 -0
index 7cb594e..aa967c0 100644
@@ -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);
+}
Signature · 1 line
2.10.2
#56 lore raw

PATCH RESEND 21/24 sh4: fix start.S by calling board_init_f() after first code relocation

In reply to Vladimir Zapolskiy

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").

---
 arch/sh/cpu/sh4/start.S | 23 +++++++++++------------
 1 file changed, 11 insertions(+), 12 deletions(-)
arch/sh/cpu/sh4/start.S +11 -12
index 77fc221..416adcf 100644
@@ -1,6 +1,6 @@
 /*
- * (C) Copyright 2007, 2010
- * Nobuhiro Iwamatsu <[email protected]>
+ * Copyright (C) 2016 Vladimir Zapolskiy <[email protected]>
+ * Copyright (C) 2007, 2010 Nobuhiro Iwamatsu <[email protected]>
  *
  * 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
Signature · 1 line
2.10.2
#59 lore raw

PATCH RESEND 22/24 sh: share the correct version of start.S among all cpus

In reply to Vladimir Zapolskiy

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.

---
 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%)
arch/sh/Makefile +1 -1
index ca55fac..14e0b66 100644
@@ -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/
arch/sh/cpu/sh2/Makefile +0 -1
index a19ed5e..80fff49 100644
@@ -8,5 +8,4 @@
 # SPDX-License-Identifier:	GPL-2.0+
 #
 
-extra-y	= start.o
 obj-y	= cpu.o interrupts.o watchdog.o
arch/sh/cpu/sh2/start.S deleted +0 -66

66 lines not on this page · raw message

arch/sh/cpu/sh3/Makefile +0 -1
index 85917b9..cddc15b 100644
@@ -11,5 +11,4 @@
 # SPDX-License-Identifier:	GPL-2.0+
 #
 
-extra-y	= start.o
 obj-y	= cpu.o interrupts.o watchdog.o
arch/sh/cpu/sh3/start.S deleted +0 -65

65 lines not on this page · raw message

arch/sh/cpu/sh4/Makefile +0 -1
index 38c6188..976994b 100644
@@ -8,5 +8,4 @@
 # SPDX-License-Identifier:	GPL-2.0+
 #
 
-extra-y	= start.o
 obj-y	= cpu.o interrupts.o watchdog.o cache.o
arch/sh/lib/Makefile +2 -0
index 7be20b1..473cf0d 100644
@@ -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)
arch/sh/lib/start.S renamed from arch/sh/cpu/sh4/start.S +6 -0
similarity index 87%
rename from arch/sh/cpu/sh4/start.S
rename to arch/sh/lib/start.S
index 416adcf..37d38d5 100644
@@ -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
Signature · 1 line
2.10.2
#62 lore raw

PATCH RESEND 23/24 sh: generate position independent code for all platforms

In reply to Vladimir Zapolskiy

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.

---
 arch/sh/config.mk      | 1 +
 arch/sh/cpu/u-boot.lds | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)
arch/sh/config.mk +1 -0
index 673ed8d..71540c8 100644
@@ -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
arch/sh/cpu/u-boot.lds +1 -1
index f2e48c6..bbf9ff4 100644
@@ -60,7 +60,7 @@ SECTIONS
 	PROVIDE (_fgot = .);
 	.got :
 	{
-		*(.got)
+		*(.got.plt) *(.got)
 		. = ALIGN(4);
 	} >ram
 	PROVIDE (_egot = .);
Signature · 1 line
2.10.2
#64 lore raw

PATCH RESEND 24/24 r2dplus: fixup CONFIG_SYS_TEXT_BASE to account arch/sh changes

In reply to Vladimir Zapolskiy

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.

---
 include/configs/r2dplus.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/configs/r2dplus.h +1 -1
index e8f60b2..0e954af 100644
@@ -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
Signature · 1 line
2.10.2
#67 lore raw

cover sh: add generic board support and fixes

In reply to a message not in the archive

Hi Tom,

Quoted 13 lines · Tom Rini
Quoted 11 lines · Vladimir Zapolskiy

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

Quoted 6 lines
Quoted 4 lines

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.

First, would you be interested in taking up the SH maintainership?

clearly Renesas abandoned SH architecture as a legacy one (and probably as a competing with R-Car one), but until J4 core as a replacement for Renesas SH4 is released by j-core.org project it is desirable to keep U-Boot running on SH platforms.

I'm interested in maintainership of SH and thereafter J-Core cores, but practically I have only one SH4 powered board on hand, unfortunately begging for hardware donations was not so successful. At the moment U-Boot contains SH2A/SH3/SH4/SH4A arch support and boards, I have to figure out where to get more boards to cover more SoC flavours, and getting legacy hardware is always a problem, because it is not on a store's shelf.

To start from I would recommend to decouple u-boot-sh.git fork into independent SH and ARM R-Car repositories, the latter one will be maintained by Renesas associates.

Quoted 22 lines

Second, I know before you told me how to get QEMU to run, but with this series and:
qemu-system-sh4 -M r2d -kernel r2dplus/current/r2dplus/u-boot.bin -nographic -serial null -serial vc

I get:
QEMU 2.5.91 monitor - type 'help' for more information (qemu) long write to SH7750_WCR1_A7 (0x000000001f800008) ignored long write to SH7750_WCR2_A7 (0x000000001f80000c) ignored long write to SH7750_WCR3_A7 (0x000000001f800010) ignored long write to SH7750_MCR_A7 (0x000000001f800014) ignored word write to SH7750_RTCNT_A7 (0x000000001f800020) ignored word write to SH7750_RTCOR_A7 (0x000000001f800024) ignored Write access to refresh count register
word write to SH7750_RTCSR_A7 (0x000000001f80001c) ignored Read access to refresh count register, incrementing long write to SH7750_MCR_A7 (0x000000001f800014) ignored long read to SH7750_WCR1_A7 (0x000000001f800008) ignored long read to SH7750_WCR2_A7 (0x000000001f80000c) ignored long read to SH7750_WCR3_A7 (0x000000001f800010) ignored long read to SH7750_MCR_A7 (0x000000001f800014) ignored

Quoted 1 line

and the qemu monitor/debug prompt.

The displayed qemu output is expected and can be ignored, currently SH port in qemu is in "odd fixes" maintainership stage, hopefully I'll find time to send a patch to silence this.

Quoted 4 lines

Without -serial args I just get the
hang. Any ideas? I ask since I'm keen to add r2dplus to test.py and travis-ci once it's working, thanks!

I use this list of components to build and test U-Boot on r2dplus qemu target and SH7751 powered board I have on hand (it is quite similar to r2dplus devkit):

* SH4 toolchain from buildroot distro with musl (libc flavour most probably is unrelated to U-boot or kernel):
- gcc-5.3.0
- musl-1.1.12
- linux-4.4 headers

* qemu-system-sh4 is from standard Debian qemu-system-misc package:
- qemu-system-misc-1:2.6+dfsg-3
- qemu-2.6.50 vanilla build also works for me fine

* U-Boot compilation:

% make ARCH=sh CROSS_COMPILE=sh4-buildroot-linux-musl- CC='sh4-buildroot-linux-musl-gcc -Wall' r2dplus_defconfig

% make ARCH=sh CROSS_COMPILE=sh4-buildroot-linux-musl- CC='sh4-buildroot-linux-musl-gcc -Wall' u-boot.bin

Command to run qemu with output directly to a console is similar to the command you mentioned above (press Ctrl-C to terminate):

% qemu-system-sh4 -M r2d -kernel u-boot.bin -monitor null -serial null -serial stdio -nographic

This is an example of testing on my end (omitting "long write .. ignored" messages):

U-Boot 2016.11-00195-ge01f392eab43 (Nov 29 2016 - 02:55:25 +0200)

CPU: SH4
BOARD: Renesas Solutions R2D Plus
DRAM: 64 MiB
Flash: ERROR: too many flash sectors
8 MiB
*** Warning - bad CRC, using default environment

PCI: SH7751 PCI host bridge found.
long read to SH7750_WCR1_A7 (0x000000001f800008) ignored long read to SH7750_WCR2_A7 (0x000000001f80000c) ignored long read to SH7750_WCR3_A7 (0x000000001f800010) ignored long read to SH7750_MCR_A7 (0x000000001f800014) ignored
PCI: Bus Dev VenId DevId Class Int
PCI:
00:00.0 - 1054:350e - Bridge device
00:02.0 - 10ec:8139 - Network controller

In:    serial
Out:   serial
Err:   serial
Net:   RTL8139#0
Error: RTL8139#0 address not set.

IDE: Bus 0: not available
=> bdinfo

mem start      = 0x8C000000
mem size       = 0x04000000
flash start    = 0xA0000000
flash size     = 0x00800000
flash offset   = 0xFFE5D444
ethaddr     = (not set)
IP addr     = <NULL>
baudrate    = 115200 bps

=> pci
Scanning PCI devices on bus 0
BusDevFun VendorId DeviceId Device Class Sub-Class
_____________________________________________________________

00.00.00   0x1054     0x350e     Bridge device           0x00
00.02.00   0x10ec     0x8139     Network controller      0x00

--
With best wishes,
Vladimir

#68 lore raw

cover sh: add generic board support and fixes

Quoted 36 lines · Vladimir Zapolskiy

Hi Tom,

Quoted 13 lines · Tom Rini
Quoted 11 lines · Vladimir Zapolskiy

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

Quoted 6 lines
Quoted 4 lines

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.

First, would you be interested in taking up the SH maintainership?

clearly Renesas abandoned SH architecture as a legacy one (and probably as a competing with R-Car one), but until J4 core as a replacement for Renesas SH4 is released by j-core.org project it is desirable to keep U-Boot running on SH platforms.

I'm interested in maintainership of SH and thereafter J-Core cores, but practically I have only one SH4 powered board on hand, unfortunately begging for hardware donations was not so successful. At the moment U-Boot contains SH2A/SH3/SH4/SH4A arch support and boards, I have to figure out where to get more boards to cover more SoC flavours, and getting legacy hardware is always a problem, because it is not on a store's shelf.

Quoted 3 lines

To start from I would recommend to decouple u-boot-sh.git fork into independent SH and ARM R-Car repositories, the latter one will be maintained by Renesas associates.

I'm interesting in having J-Core work and be maintained in U-Boot, so lets make this work. With regards to legacy platforms, I'm happy to drop things which are unavailable / non-functional and just note in doc/README.scrapyard when things were removed. We did this a lot around a year ago and probably should again.

And then yes, the R-Car patches should come in via another repository rather than u-boot.sh as was previously convenient.

Quoted 22 lines
Quoted 22 lines

Second, I know before you told me how to get QEMU to run, but with this series and:
qemu-system-sh4 -M r2d -kernel r2dplus/current/r2dplus/u-boot.bin -nographic -serial null -serial vc

I get:
QEMU 2.5.91 monitor - type 'help' for more information (qemu) long write to SH7750_WCR1_A7 (0x000000001f800008) ignored long write to SH7750_WCR2_A7 (0x000000001f80000c) ignored long write to SH7750_WCR3_A7 (0x000000001f800010) ignored long write to SH7750_MCR_A7 (0x000000001f800014) ignored word write to SH7750_RTCNT_A7 (0x000000001f800020) ignored word write to SH7750_RTCOR_A7 (0x000000001f800024) ignored Write access to refresh count register
word write to SH7750_RTCSR_A7 (0x000000001f80001c) ignored Read access to refresh count register, incrementing long write to SH7750_MCR_A7 (0x000000001f800014) ignored long read to SH7750_WCR1_A7 (0x000000001f800008) ignored long read to SH7750_WCR2_A7 (0x000000001f80000c) ignored long read to SH7750_WCR3_A7 (0x000000001f800010) ignored long read to SH7750_MCR_A7 (0x000000001f800014) ignored

Quoted 5 lines
Quoted 1 line

and the qemu monitor/debug prompt.

The displayed qemu output is expected and can be ignored, currently SH port in qemu is in "odd fixes" maintainership stage, hopefully I'll find time to send a patch to silence this.

Ah, OK.

Quoted 70 lines
Quoted 4 lines

Without -serial args I just get the
hang. Any ideas? I ask since I'm keen to add r2dplus to test.py and travis-ci once it's working, thanks!

I use this list of components to build and test U-Boot on r2dplus qemu target and SH7751 powered board I have on hand (it is quite similar to r2dplus devkit):

* SH4 toolchain from buildroot distro with musl (libc flavour most probably is unrelated to U-boot or kernel):
- gcc-5.3.0
- musl-1.1.12
- linux-4.4 headers

* qemu-system-sh4 is from standard Debian qemu-system-misc package:
- qemu-system-misc-1:2.6+dfsg-3
- qemu-2.6.50 vanilla build also works for me fine

* U-Boot compilation:

% make ARCH=sh CROSS_COMPILE=sh4-buildroot-linux-musl- CC='sh4-buildroot-linux-musl-gcc -Wall' r2dplus_defconfig

% make ARCH=sh CROSS_COMPILE=sh4-buildroot-linux-musl- CC='sh4-buildroot-linux-musl-gcc -Wall' u-boot.bin

Command to run qemu with output directly to a console is similar to the command you mentioned above (press Ctrl-C to terminate):

% qemu-system-sh4 -M r2d -kernel u-boot.bin -monitor null -serial null -serial stdio -nographic

This is an example of testing on my end (omitting "long write .. ignored" messages):

U-Boot 2016.11-00195-ge01f392eab43 (Nov 29 2016 - 02:55:25 +0200)

CPU: SH4
BOARD: Renesas Solutions R2D Plus
DRAM: 64 MiB
Flash: ERROR: too many flash sectors
8 MiB
*** Warning - bad CRC, using default environment

PCI: SH7751 PCI host bridge found.
long read to SH7750_WCR1_A7 (0x000000001f800008) ignored long read to SH7750_WCR2_A7 (0x000000001f80000c) ignored long read to SH7750_WCR3_A7 (0x000000001f800010) ignored long read to SH7750_MCR_A7 (0x000000001f800014) ignored
PCI: Bus Dev VenId DevId Class Int
PCI:
00:00.0 - 1054:350e - Bridge device
00:02.0 - 10ec:8139 - Network controller

In:    serial
Out:   serial
Err:   serial
Net:   RTL8139#0
Error: RTL8139#0 address not set.

IDE: Bus 0: not available
=> bdinfo

mem start      = 0x8C000000
mem size       = 0x04000000
flash start    = 0xA0000000
flash size     = 0x00800000
flash offset   = 0xFFE5D444
ethaddr     = (not set)
IP addr     = <NULL>
baudrate    = 115200 bps
Quoted 6 lines

=> pci
Scanning PCI devices on bus 0
BusDevFun VendorId DeviceId Device Class Sub-Class
_____________________________________________________________

00.00.00   0x1054     0x350e     Bridge device           0x00
00.02.00   0x10ec     0x8139     Network controller      0x00

Ah, OK. With that exact command line I can get things going. My gut feeling, having played with other qemu boards as a user, is that there's something odd going on in how qemu is parsing the arguments and assigning things as the defaults "should" provide this too, but instead we're disabling the defaults for monitor and serial (which can usually be multiplexed) and then only giving serial to stdio.

But, the good news is that this means I can get travis-ci going and make add r2dplus to the list of tested-every-time platforms. I'll follow up to your series with patches for that hopefully tomorrow.

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20161128/0f683deb/attachment.sig>
#4 lore raw

PATCH RESEND 2/24 sh4: cache: correct flush_cache() to writeback and invalidate

In reply to Vladimir Zapolskiy
Quoted 9 lines · Vladimir Zapolskiy

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'.

---
 arch/sh/cpu/sh4/cpu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
#7 lore raw

PATCH RESEND 3/24 sh3: remove unused cache.c file from being built

In reply to Vladimir Zapolskiy
Quoted 8 lines · Vladimir Zapolskiy

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.

Quoted 6 lines
---
 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
#10 lore raw

PATCH RESEND 4/24 sh: cache use jump_to_P2() and back_to_P1() from asm/system.h

In reply to Vladimir Zapolskiy
Quoted 7 lines · Vladimir Zapolskiy

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.

---
 arch/sh/cpu/sh4/cache.c | 39 ++-------------------------------------
 1 file changed, 2 insertions(+), 37 deletions(-)
#15 lore raw

PATCH RESEND 6/24 sh4: cache: move exported cache manipulation functions into cache.c

In reply to Vladimir Zapolskiy
Quoted 10 lines · Vladimir Zapolskiy

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.

---
 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(-)
#22 lore raw

PATCH RESEND 9/24 sh4: remove __io config options from r2dplus and r7780mp boards

In reply to Vladimir Zapolskiy
Quoted 9 lines · Vladimir Zapolskiy

Defined __io is no-op for the SH architecture and it can be removed from board files without any functional change.

---
 arch/sh/include/asm/io.h  | 10 ----------
 include/configs/r2dplus.h |  1 -
 include/configs/r7780mp.h |  1 -
 3 files changed, 12 deletions(-)
#25 lore raw

PATCH RESEND 10/24 r2dplus: use P1 area space for text base and PCI system memory

In reply to Vladimir Zapolskiy
Quoted 5 lines · Vladimir Zapolskiy

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.

Quoted 7 lines

This allows to easily ensure that CONFIG_SYS_TEXT_BASE is located within available DRAM.

---
 include/configs/r2dplus.h | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

But it is probably nice to move this to DM_PCI.

#28 lore raw

PATCH RESEND 11/24 r2dplus: select rtl8139 driver in defconfig

In reply to Vladimir Zapolskiy
Quoted 5 lines · Vladimir Zapolskiy

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.

Quoted 8 lines

As an unlucky consequence the option was completely removed by a purge commit adad96e60d0e ("configs: Re-sync HUSH options"), restore the driver inclusion back.

---
 configs/r2dplus_defconfig | 2 ++
 1 file changed, 2 insertions(+)
#33 lore raw

PATCH RESEND 13/24 sh4: use single u-boot linker script for all boards

In reply to Vladimir Zapolskiy
Quoted 10 lines · Vladimir Zapolskiy

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.

Quoted 15 lines
---
 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
#39 lore raw

PATCH RESEND 15/24 sh: define entry point and reloc_dst inside a linker script

In reply to Vladimir Zapolskiy
Quoted 10 lines · Vladimir Zapolskiy

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.

---
 arch/sh/config.mk      | 1 -
 arch/sh/cpu/u-boot.lds | 6 +-----
 2 files changed, 1 insertion(+), 6 deletions(-)
#36 lore raw

PATCH RESEND 14/24 sh: place board lowlevel_init code in the beginning of .text

In reply to Vladimir Zapolskiy
Quoted 18 lines · Vladimir Zapolskiy

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.

---
 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 +-
Quoted 8 lines
 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(-)
#42 lore raw

PATCH RESEND 16/24 sh: add MEMORY command to a shared linker script

In reply to Vladimir Zapolskiy
Quoted 8 lines · Vladimir Zapolskiy

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.

---
 arch/sh/cpu/u-boot.lds | 32 ++++++++++++++++----------------
 1 file changed, 16 insertions(+), 16 deletions(-)
#45 lore raw

PATCH RESEND 17/24 sh: remove undefined DEBUG preprocessor token from board config files

In reply to Vladimir Zapolskiy
Quoted 2 lines · Vladimir Zapolskiy

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

Quoted 4 lines

insertion of #define DEBUG into common files, so it makes sense to remove the option from all SH boards as a harmful one.

Quoted 16 lines
---
 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(-)
#48 lore raw

PATCH RESEND 18/24 sh: define CONFIG_DISPLAY_BOARDINFO to print board information

In reply to Vladimir Zapolskiy
Quoted 20 lines · Vladimir Zapolskiy

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.

---
 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 ++
Quoted 8 lines
 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(+)
#51 lore raw

PATCH RESEND 19/24 sh: add common dram_init() function for all boards

In reply to Vladimir Zapolskiy
Quoted 25 lines · Vladimir Zapolskiy

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.

---
 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 ----------
Quoted 8 lines
 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
#54 lore raw

PATCH RESEND 20/24 sh: add shared relocate_code() function and call board_init_r()

In reply to Vladimir Zapolskiy
Quoted 3 lines · Vladimir Zapolskiy

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

Quoted 5 lines

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.

Quoted 7 lines
---
 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(-)
#57 lore raw

PATCH RESEND 21/24 sh4: fix start.S by calling board_init_f() after first code relocation

In reply to Vladimir Zapolskiy
Quoted 8 lines · Vladimir Zapolskiy

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.

Quoted 8 lines

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").

---
 arch/sh/cpu/sh4/start.S | 23 +++++++++++------------
 1 file changed, 11 insertions(+), 12 deletions(-)
#60 lore raw

PATCH RESEND 22/24 sh: share the correct version of start.S among all cpus

In reply to Vladimir Zapolskiy
Quoted 7 lines · Vladimir Zapolskiy

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.

Quoted 13 lines
---
 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%)
#2 lore raw

PATCH RESEND 1/24 sh4: cache: correct dcache flush to invalidate with write-back

In reply to Vladimir Zapolskiy
Quoted 6 lines · Vladimir Zapolskiy

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.

Quoted 6 lines

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.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20161203/3b6c997a/attachment.sig>
#5 lore raw

PATCH RESEND 2/24 sh4: cache: correct flush_cache() to writeback and invalidate

In reply to Vladimir Zapolskiy
Quoted 7 lines · Vladimir Zapolskiy

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'.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20161203/58248f6f/attachment.sig>
#8 lore raw

PATCH RESEND 3/24 sh3: remove unused cache.c file from being built

In reply to Vladimir Zapolskiy
Quoted 10 lines · Vladimir Zapolskiy

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.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20161203/694e79e8/attachment.sig>
#11 lore raw

PATCH RESEND 4/24 sh: cache use jump_to_P2() and back_to_P1() from asm/system.h

In reply to Vladimir Zapolskiy
Quoted 5 lines · Vladimir Zapolskiy

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.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20161203/dba47e11/attachment.sig>
#13 lore raw

PATCH RESEND 5/24 sh: cache: don't modify CCR from P1 area

In reply to Vladimir Zapolskiy
Quoted 8 lines · Vladimir Zapolskiy

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.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20161203/644849fb/attachment.sig>
#16 lore raw

PATCH RESEND 6/24 sh4: cache: move exported cache manipulation functions into cache.c

In reply to Vladimir Zapolskiy
Quoted 6 lines · Vladimir Zapolskiy

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.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20161203/29a55fe9/attachment.sig>
#18 lore raw

PATCH RESEND 7/24 pci: sh7751: fix up PCI I/O space address

In reply to Vladimir Zapolskiy
Quoted 9 lines · Vladimir Zapolskiy

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.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20161203/cf6657ae/attachment.sig>
#20 lore raw

PATCH RESEND 8/24 pci: sh7751: map PCI memory space into SDRAM

In reply to Vladimir Zapolskiy
Quoted 10 lines · Vladimir Zapolskiy

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.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20161203/702aafbb/attachment.sig>
#23 lore raw

PATCH RESEND 9/24 sh4: remove __io config options from r2dplus and r7780mp boards

In reply to Vladimir Zapolskiy
Quoted 5 lines · Vladimir Zapolskiy

Defined __io is no-op for the SH architecture and it can be removed from board files without any functional change.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20161203/d0f355e7/attachment.sig>
#26 lore raw

PATCH RESEND 10/24 r2dplus: use P1 area space for text base and PCI system memory

In reply to Vladimir Zapolskiy
Quoted 10 lines · Vladimir Zapolskiy

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.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20161203/e3130e3a/attachment.sig>
#29 lore raw

PATCH RESEND 11/24 r2dplus: select rtl8139 driver in defconfig

In reply to Vladimir Zapolskiy
Quoted 11 lines · Vladimir Zapolskiy

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.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20161203/7fa73599/attachment.sig>
#31 lore raw

PATCH RESEND 12/24 common: sh: add necessary define bits to board_f

In reply to Vladimir Zapolskiy
Quoted 7 lines · Vladimir Zapolskiy

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.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20161203/22fff2b2/attachment.sig>
#34 lore raw

PATCH RESEND 13/24 sh4: use single u-boot linker script for all boards

In reply to Vladimir Zapolskiy
Quoted 11 lines · Vladimir Zapolskiy

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.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20161203/377551ec/attachment.sig>
#37 lore raw

PATCH RESEND 14/24 sh: place board lowlevel_init code in the beginning of .text

In reply to Vladimir Zapolskiy
Quoted 6 lines · Vladimir Zapolskiy

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.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20161203/6b3a1dbf/attachment.sig>
#40 lore raw

PATCH RESEND 15/24 sh: define entry point and reloc_dst inside a linker script

In reply to Vladimir Zapolskiy
Quoted 7 lines · Vladimir Zapolskiy

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.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20161203/b3c2aab1/attachment.sig>
#43 lore raw

PATCH RESEND 16/24 sh: add MEMORY command to a shared linker script

In reply to Vladimir Zapolskiy
Quoted 6 lines · Vladimir Zapolskiy

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.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20161203/74b3af3d/attachment.sig>
#46 lore raw

PATCH RESEND 17/24 sh: remove undefined DEBUG preprocessor token from board config files

In reply to Vladimir Zapolskiy
Quoted 7 lines · Vladimir Zapolskiy

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.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20161203/a62bba87/attachment.sig>
#49 lore raw

PATCH RESEND 18/24 sh: define CONFIG_DISPLAY_BOARDINFO to print board information

In reply to Vladimir Zapolskiy
Quoted 6 lines · Vladimir Zapolskiy

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.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20161203/e94fd522/attachment.sig>
#52 lore raw

PATCH RESEND 19/24 sh: add common dram_init() function for all boards

In reply to Vladimir Zapolskiy
Quoted 8 lines · Vladimir Zapolskiy

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.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20161203/fe5a166f/attachment.sig>
#55 lore raw

PATCH RESEND 20/24 sh: add shared relocate_code() function and call board_init_r()

In reply to Vladimir Zapolskiy
Quoted 10 lines · Vladimir Zapolskiy

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.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20161203/1b025561/attachment.sig>
#58 lore raw

PATCH RESEND 21/24 sh4: fix start.S by calling board_init_f() after first code relocation

In reply to Vladimir Zapolskiy
Quoted 8 lines · Vladimir Zapolskiy

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.

Quoted 6 lines

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").

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20161203/00c2890d/attachment.sig>
#61 lore raw

PATCH RESEND 22/24 sh: share the correct version of start.S among all cpus

In reply to Vladimir Zapolskiy
Quoted 8 lines · Vladimir Zapolskiy

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.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20161203/61f8e8d0/attachment.sig>
#63 lore raw

PATCH RESEND 23/24 sh: generate position independent code for all platforms

In reply to Vladimir Zapolskiy
Quoted 11 lines · Vladimir Zapolskiy

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.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20161203/f5283aac/attachment.sig>
#65 lore raw

PATCH RESEND 24/24 r2dplus: fixup CONFIG_SYS_TEXT_BASE to account arch/sh changes

In reply to Vladimir Zapolskiy
Quoted 10 lines · Vladimir Zapolskiy

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.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20161203/bbadb2cc/attachment.sig>