Skip to contentSkip to conversation

powerpc: mpc85xx: Cleanup code

PATCH New Pali Rohár 1 participant 4 messages Apr 2, 2022 PowerPC

lore
Share & tools
lore
#0 lore raw

cover powerpc: mpc85xx: Cleanup code

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(-)
Signature · 1 line
2.20.1
#1 lore raw

PATCH 1/3 powerpc: mpc85xx: Drop _start symbol

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

---
 arch/powerpc/cpu/mpc85xx/start.S | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)
arch/powerpc/cpu/mpc85xx/start.S +2 -7
index 656cc6ec8024..71b04b9f7286 100644
@@ -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,
Signature · 1 line
2.20.1
#2 lore raw

PATCH 2/3 powerpc: mpc85xx: Rename _start_e500 symbol to _start

In reply to Pali Rohár

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.

---
 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(-)
arch/powerpc/cpu/mpc85xx/resetvec.S +1 -1
index 29555d4a0092..9a552f6624ed 100644
@@ -1,2 +1,2 @@
 	.section .resetvec,"ax"
-	b _start_e500
+	b _start
arch/powerpc/cpu/mpc85xx/start.S +2 -2
index 71b04b9f7286..f62dd79805ca 100644
@@ -70,9 +70,9 @@
  */
 
 	.section .bootpg,"ax"
-	.globl _start_e500
+	.globl _start
 
-_start_e500:
+_start:
 /* Enable debug exception */
 	li	r1,MSR_DE
 	mtmsr	r1
arch/powerpc/cpu/mpc85xx/u-boot.lds +1 -1
index 22bbac51aa33..17a0e631ca3e 100644
@@ -16,7 +16,7 @@
 #endif
 
 OUTPUT_ARCH(powerpc)
-ENTRY(_start_e500)
+ENTRY(_start)
 
 PHDRS
 {
doc/README.mpc85xx +2 -2
index 8464e7f4d8a6..3c6ebbdb0e6e 100644
@@ -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
Signature · 1 line
2.20.1
#3 lore raw

PATCH 3/3 powerpc: mpc85xx: Show e500 core version

In reply to Pali Rohár

Distinguish between e500v1 and e500v2.

---
 arch/powerpc/cpu/mpc85xx/cpu.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
arch/powerpc/cpu/mpc85xx/cpu.c +3 -1
index cd32290410f6..261f79e40585 100644
@@ -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");
Signature · 1 line
2.20.1