u-boot.lists.denx.de archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/3] powerpc: mpc85xx: Cleanup code
@ 2022-04-02 22:05 Pali Rohár
  2022-04-02 22:05 ` [PATCH 1/3] powerpc: mpc85xx: Drop _start symbol Pali Rohár
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Pali Rohár @ 2022-04-02 22:05 UTC (permalink / raw)
  To: Priyanka Jain, Wolfgang Denk; +Cc: u-boot

This patch series cleanups mpc85xx e500 code. It removes _start symbol
together with its content because it is useless and then rename symbol
_start_e500 to _start as this is the real entry point. Third patch just
show e500 core version.

Tested on P2020 board with configuration when BootROM loads SPL from SD
card (which then loads U-Boot) and also when BootROM directly loads
U-Boot from SD card. No visible difference, that (old) _start symbol and
its content were useless.

Pali Rohár (3):
  powerpc: mpc85xx: Drop _start symbol
  powerpc: mpc85xx: Rename _start_e500 symbol to _start
  powerpc: mpc85xx: Show e500 core version

 arch/powerpc/cpu/mpc85xx/cpu.c      |  4 +++-
 arch/powerpc/cpu/mpc85xx/resetvec.S |  2 +-
 arch/powerpc/cpu/mpc85xx/start.S    | 13 ++++---------
 arch/powerpc/cpu/mpc85xx/u-boot.lds |  2 +-
 doc/README.mpc85xx                  |  4 ++--
 5 files changed, 11 insertions(+), 14 deletions(-)

-- 
2.20.1


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 1/3] powerpc: mpc85xx: Drop _start symbol
  2022-04-02 22:05 [PATCH 0/3] powerpc: mpc85xx: Cleanup code Pali Rohár
@ 2022-04-02 22:05 ` Pali Rohár
  2022-04-02 22:05 ` [PATCH 2/3] powerpc: mpc85xx: Rename _start_e500 symbol to _start Pali Rohár
  2022-04-02 22:05 ` [PATCH 3/3] powerpc: mpc85xx: Show e500 core version Pali Rohár
  2 siblings, 0 replies; 4+ messages in thread
From: Pali Rohár @ 2022-04-02 22:05 UTC (permalink / raw)
  To: Priyanka Jain, Wolfgang Denk; +Cc: u-boot

_start symbol contains only 32-bit data number 0x27051956 despite it is
marked as text section. This magic number is IH_MAGIC which is used for
marking uboot image header.

mpc85xx start.S code does not define valid uboot image header, so IH_MAGIC
number in _start symbol is useless there.

Moreover this _start symbol is not used at all. Entry point is at symbol
_start_e500.

So because this _start symbol is not used for anything, completely remove
it with IH_MAGIC number. After _start symbol was _start_cont symbol, so
replace all relative address calculations by _start_cont.

Signed-off-by: Pali Rohár <pali@kernel.org>
---
 arch/powerpc/cpu/mpc85xx/start.S | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/arch/powerpc/cpu/mpc85xx/start.S b/arch/powerpc/cpu/mpc85xx/start.S
index 656cc6ec8024..71b04b9f7286 100644
--- a/arch/powerpc/cpu/mpc85xx/start.S
+++ b/arch/powerpc/cpu/mpc85xx/start.S
@@ -46,7 +46,6 @@
 	GOT_ENTRY(_FIXUP_TABLE_)
 
 #ifndef MINIMAL_SPL
-	GOT_ENTRY(_start)
 	GOT_ENTRY(_start_of_vectors)
 	GOT_ENTRY(_end_of_vectors)
 	GOT_ENTRY(transfer_to_handler)
@@ -1128,16 +1127,12 @@ switch_as:
 	/*--------------------------------------------------------------*/
 	lis	r3,CONFIG_SYS_MONITOR_BASE@h
 	ori	r3,r3,CONFIG_SYS_MONITOR_BASE@l
-	addi	r3,r3,_start_cont - _start
+	addi	r3,r3,_start_cont - _start_cont
 	mtlr	r3
 	blr
 #endif
 
 	.text
-	.globl	_start
-_start:
-	.long	0x27051956		/* U-BOOT Magic Number */
-
 	.globl	_start_cont
 _start_cont:
 	/* Setup the stack in initial RAM,could be L2-as-SRAM or L1 dcache*/
@@ -1604,7 +1599,7 @@ relocate_code:
  * initialization, now running from RAM.
  */
 
-	addi	r0,r10,in_ram - _start
+	addi	r0,r10,in_ram - _start_cont
 
 	/*
 	 * As IVPR is going to point RAM address,
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 2/3] powerpc: mpc85xx: Rename _start_e500 symbol to _start
  2022-04-02 22:05 [PATCH 0/3] powerpc: mpc85xx: Cleanup code Pali Rohár
  2022-04-02 22:05 ` [PATCH 1/3] powerpc: mpc85xx: Drop _start symbol Pali Rohár
@ 2022-04-02 22:05 ` Pali Rohár
  2022-04-02 22:05 ` [PATCH 3/3] powerpc: mpc85xx: Show e500 core version Pali Rohár
  2 siblings, 0 replies; 4+ messages in thread
From: Pali Rohár @ 2022-04-02 22:05 UTC (permalink / raw)
  To: Priyanka Jain, Wolfgang Denk; +Cc: u-boot

The real entry point is _start_e500. There is no _start symbol at all. So
rename _start_e500 to _start for convension that _start symbol is used as
entry point.

Signed-off-by: Pali Rohár <pali@kernel.org>
---
 arch/powerpc/cpu/mpc85xx/resetvec.S | 2 +-
 arch/powerpc/cpu/mpc85xx/start.S    | 4 ++--
 arch/powerpc/cpu/mpc85xx/u-boot.lds | 2 +-
 doc/README.mpc85xx                  | 4 ++--
 4 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/arch/powerpc/cpu/mpc85xx/resetvec.S b/arch/powerpc/cpu/mpc85xx/resetvec.S
index 29555d4a0092..9a552f6624ed 100644
--- a/arch/powerpc/cpu/mpc85xx/resetvec.S
+++ b/arch/powerpc/cpu/mpc85xx/resetvec.S
@@ -1,2 +1,2 @@
 	.section .resetvec,"ax"
-	b _start_e500
+	b _start
diff --git a/arch/powerpc/cpu/mpc85xx/start.S b/arch/powerpc/cpu/mpc85xx/start.S
index 71b04b9f7286..f62dd79805ca 100644
--- a/arch/powerpc/cpu/mpc85xx/start.S
+++ b/arch/powerpc/cpu/mpc85xx/start.S
@@ -70,9 +70,9 @@
  */
 
 	.section .bootpg,"ax"
-	.globl _start_e500
+	.globl _start
 
-_start_e500:
+_start:
 /* Enable debug exception */
 	li	r1,MSR_DE
 	mtmsr	r1
diff --git a/arch/powerpc/cpu/mpc85xx/u-boot.lds b/arch/powerpc/cpu/mpc85xx/u-boot.lds
index 22bbac51aa33..17a0e631ca3e 100644
--- a/arch/powerpc/cpu/mpc85xx/u-boot.lds
+++ b/arch/powerpc/cpu/mpc85xx/u-boot.lds
@@ -16,7 +16,7 @@
 #endif
 
 OUTPUT_ARCH(powerpc)
-ENTRY(_start_e500)
+ENTRY(_start)
 
 PHDRS
 {
diff --git a/doc/README.mpc85xx b/doc/README.mpc85xx
index 8464e7f4d8a6..3c6ebbdb0e6e 100644
--- a/doc/README.mpc85xx
+++ b/doc/README.mpc85xx
@@ -45,7 +45,7 @@ Note: Sequence number is in order of execution
 A) defined(CONFIG_SYS_RAMBOOT) i.e. SD, SPI, NAND RAMBOOT & NAND_SPL boot
 
    1) TLB entry to overcome e500 v1/v2 debug restriction
-       Location	  : Label "_start_e500"
+       Location	  : Label "_start"
        TLB Entry  : CONFIG_SYS_PPC_E500_DEBUG_TLB
        EPN -->RPN : CONFIG_SYS_MONITOR_BASE --> CONFIG_SYS_MONITOR_BASE
        Properties : 256K, AS0, I, IPROT
@@ -91,7 +91,7 @@ A) defined(CONFIG_SYS_RAMBOOT) i.e. SD, SPI, NAND RAMBOOT & NAND_SPL boot
 B) !defined(CONFIG_SYS_RAMBOOT) i.e. NOR boot
 
    1) TLB entry to overcome e500 v1/v2 debug restriction
-       Location	  : Label "_start_e500"
+       Location	  : Label "_start"
        TLB Entry  : CONFIG_SYS_PPC_E500_DEBUG_TLB
 #if defined(CONFIG_NXP_ESBC)
        EPN -->RPN : CONFIG_SYS_MONITOR_BASE --> CONFIG_SYS_PBI_FLASH_WINDOW
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 3/3] powerpc: mpc85xx: Show e500 core version
  2022-04-02 22:05 [PATCH 0/3] powerpc: mpc85xx: Cleanup code Pali Rohár
  2022-04-02 22:05 ` [PATCH 1/3] powerpc: mpc85xx: Drop _start symbol Pali Rohár
  2022-04-02 22:05 ` [PATCH 2/3] powerpc: mpc85xx: Rename _start_e500 symbol to _start Pali Rohár
@ 2022-04-02 22:05 ` Pali Rohár
  2 siblings, 0 replies; 4+ messages in thread
From: Pali Rohár @ 2022-04-02 22:05 UTC (permalink / raw)
  To: Priyanka Jain, Wolfgang Denk; +Cc: u-boot

Distinguish between e500v1 and e500v2.

Signed-off-by: Pali Rohár <pali@kernel.org>
---
 arch/powerpc/cpu/mpc85xx/cpu.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/arch/powerpc/cpu/mpc85xx/cpu.c b/arch/powerpc/cpu/mpc85xx/cpu.c
index cd32290410f6..261f79e40585 100644
--- a/arch/powerpc/cpu/mpc85xx/cpu.c
+++ b/arch/powerpc/cpu/mpc85xx/cpu.c
@@ -143,8 +143,10 @@ int checkcpu (void)
 	printf("Core:  ");
 	switch(ver) {
 	case PVR_VER_E500_V1:
+		puts("e500v1");
+		break;
 	case PVR_VER_E500_V2:
-		puts("e500");
+		puts("e500v2");
 		break;
 	case PVR_VER_E500MC:
 		puts("e500mc");
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-04-02 22:06 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-02 22:05 [PATCH 0/3] powerpc: mpc85xx: Cleanup code Pali Rohár
2022-04-02 22:05 ` [PATCH 1/3] powerpc: mpc85xx: Drop _start symbol Pali Rohár
2022-04-02 22:05 ` [PATCH 2/3] powerpc: mpc85xx: Rename _start_e500 symbol to _start Pali Rohár
2022-04-02 22:05 ` [PATCH 3/3] powerpc: mpc85xx: Show e500 core version Pali Rohár

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).