85xx: Fix relocation of CCSRBAR
PATCH 1/1 85xx: Fix relocation of CCSRBAR
If the virtual address for CCSRBAR is the same after relocation but the physical address is changing we'd end up having two TLB entries with the same VA. Instead we new us the new CCSRBAR virt address + 4k as a temp virt address to access the old CCSRBAR to relocate it.
--- cpu/mpc85xx/cpu_init.c | 9 +++++---- 1 files changed, 5 insertions(+), 4 deletions(-)
cpu/mpc85xx/cpu_init.c +5 -4
@@ -140,14 +140,15 @@ void cpu_init_early_f(void)#if (CONFIG_SYS_CCSRBAR_DEFAULT !=CONFIG_SYS_CCSRBAR_PHYS ) {u32 temp; +volatile u32 *ccsr_virt = + (volatile u32 *)(CONFIG_SYS_CCSRBAR +0x1000 ); -set_tlb (0 ,CONFIG_SYS_CCSRBAR_DEFAULT ,CONFIG_SYS_CCSRBAR_DEFAULT , +set_tlb (0 , (u32 )ccsr_virt,CONFIG_SYS_CCSRBAR_DEFAULT ,MAS3_SX |MAS3_SW |MAS3_SR ,MAS2_I |MAS2_G ,1 ,1 ,BOOKE_PAGESZ_4K ,0 ); - temp =in_be32 ((volatile u32 *)CONFIG_SYS_CCSRBAR_DEFAULT ); -out_be32 ((volatile u32 *)CONFIG_SYS_CCSRBAR_DEFAULT ,CONFIG_SYS_CCSRBAR_PHYS >>12 ); - + temp =in_be32 (ccsr_virt); +out_be32 (ccsr_virt,CONFIG_SYS_CCSRBAR_PHYS >>12 ); temp =in_be32 ((volatile u32 *)CONFIG_SYS_CCSRBAR ); }#endif
Signature · 1 line
1.5.6.5
PATCH 1/1 85xx: Fix relocation of CCSRBAR
Quoted 4 lines · Kumar Gala
If the virtual address for CCSRBAR is the same after relocation but the physical address is changing we'd end up having two TLB entries with the same VA. Instead we new us the new CCSRBAR virt address + 4k as a temp virt address to access the old CCSRBAR to relocate it.
s/we new us the/we now use the/
Quoted 10 lines
Signed-off-by Kumar Gala <[email protected]>--- cpu/mpc85xx/cpu_init.c | 9 +++++---- 1 files changed, 5 insertions(+), 4 deletions(-)cpu/mpc85xx/cpu_init.c +0
-0
cpu/mpc85xx/cpu_init.c void cpu_init_early_f(void) · line 144
Quoted 5 lines
cpu/mpc85xx/cpu_init.c +2
-0@@ -140,14 +140,15 @@ void cpu_init_early_f(void)#if (CONFIG_SYS_CCSRBAR_DEFAULT !=CONFIG_SYS_CCSRBAR_PHYS ) {u32 temp; +volatile u32 *ccsr_virt = + (volatile u32 *)(CONFIG_SYS_CCSRBAR +0x1000 );
Is there any reason to use volatiles when you access the address using the proper io functions?
Best,
Peter
PATCH 1/1 85xx: Fix relocation of CCSRBAR
Quoted 9 lines · Peter Tyser
Quoted 6 lines · Kumar Gala
If the virtual address for CCSRBAR is the same after relocation but the physical address is changing we'd end up having two TLB entries with
the same VA. Instead we new us the new CCSRBAR virt address + 4k as a
temp virt address to access the old CCSRBAR to relocate it.s/we new us the/we now use the/
I'll let andy fix that when we applies the patch.
Quoted 5 lines
Quoted 5 lines
Signed-off-by Kumar Gala <[email protected]>---
cpu/mpc85xx/cpu_init.c| 9 +++++----1 files changed, 5 insertions(+), 4 deletions(-)
Quoted 13 lines
cpu/mpc85xx/cpu_init.c void cpu_init_early_f(void) · line 144
Quoted 10 lines
cpu/mpc85xx/cpu_init.c +2
-0@@ -140,14 +140,15 @@ void cpu_init_early_f(void)#if (CONFIG_SYS_CCSRBAR_DEFAULT !=CONFIG_SYS_CCSRBAR_PHYS ) {u32 temp; +volatile u32 *ccsr_virt = + (volatile u32 *)(CONFIG_SYS_CCSRBAR +0x1000 );Is there any reason to use volatiles when you access the address using the proper io functions?
That's how the functions are defined:
extern inline unsigned in_be32(const volatile unsigned __iomem *addr)
- k