[U-Boot] [PATCH 2/2] powerpc: Rework cpu_init_f() to take no arguments
Mario Six
mario.six at gdsys.cc
Mon Aug 14 06:56:43 UTC 2017
On Mon, Aug 14, 2017 at 8:20 AM, Christophe LEROY
<christophe.leroy at c-s.fr> wrote:
> Acked-by: Christophe Leroy <christophe.leroy at c-s.fr>
>
>
>
> Le 14/08/2017 à 04:44, Tom Rini a écrit :
>>
>> The function cpu_init_f() is called slightly differently on different
>> PowerPC platforms. In some cases the function needs to make use of the
>> IMMR and in other cases it does not. Rather than pass the IMMR location
>> as the function argument and then ignore it on some platforms, allow the
>> function to use the location as needed as it is a constant.
>>
>> Cc: Mario Six <mario.six at gdsys.cc>
>> Cc: Wolfgang Denk <wd at denx.de>
>> Cc: Christophe Leroy <christophe.leroy at c-s.fr>
>> Signed-off-by: Tom Rini <trini at konsulko.com>
>> ---
>> arch/powerpc/cpu/mpc83xx/cpu_init.c | 4 +++-
>> arch/powerpc/cpu/mpc83xx/spl_minimal.c | 4 +++-
>> arch/powerpc/cpu/mpc83xx/start.S | 2 --
>> arch/powerpc/cpu/mpc85xx/cpu_init.c | 4 +---
>> arch/powerpc/cpu/mpc8xx/cpu_init.c | 4 +++-
>> arch/powerpc/cpu/mpc8xx/start.S | 1 -
>> arch/powerpc/include/asm/ppc.h | 1 +
>> 7 files changed, 11 insertions(+), 9 deletions(-)
>>
>> diff --git a/arch/powerpc/cpu/mpc83xx/cpu_init.c
>> b/arch/powerpc/cpu/mpc83xx/cpu_init.c
>> index 2a9db0c51b89..f09a96b9abff 100644
>> --- a/arch/powerpc/cpu/mpc83xx/cpu_init.c
>> +++ b/arch/powerpc/cpu/mpc83xx/cpu_init.c
>> @@ -46,8 +46,10 @@ static void config_qe_ioports(void)
>> * initialize a bunch of registers,
>> * initialize the UPM's
>> */
>> -void cpu_init_f (volatile immap_t * im)
>> +void cpu_init_f (void)
>> {
>> + volatile immap_t *im = (void *)(CONFIG_SYS_IMMR);
>> +
>> __be32 acr_mask =
>> #ifdef CONFIG_SYS_ACR_PIPE_DEP /* Arbiter pipeline depth */
>> ACR_PIPE_DEP |
>> diff --git a/arch/powerpc/cpu/mpc83xx/spl_minimal.c
>> b/arch/powerpc/cpu/mpc83xx/spl_minimal.c
>> index 1c65e4cb78dd..ce751d3bdf9f 100644
>> --- a/arch/powerpc/cpu/mpc83xx/spl_minimal.c
>> +++ b/arch/powerpc/cpu/mpc83xx/spl_minimal.c
>> @@ -16,8 +16,10 @@ DECLARE_GLOBAL_DATA_PTR;
>> * initialize a bunch of registers,
>> * initialize the UPM's
>> */
>> -void cpu_init_f (volatile immap_t * im)
>> +void cpu_init_f (void)
>> {
>> + volatile immap_t *im = (void *)(CONFIG_SYS_IMMR);
>> +
>> /* Pointer is writable since we allocated a register for it */
>> gd = (gd_t *) (CONFIG_SYS_INIT_RAM_ADDR +
>> CONFIG_SYS_GBL_DATA_OFFSET);
>> diff --git a/arch/powerpc/cpu/mpc83xx/start.S
>> b/arch/powerpc/cpu/mpc83xx/start.S
>> index d2fced8aba86..8d10c50f6912 100644
>> --- a/arch/powerpc/cpu/mpc83xx/start.S
>> +++ b/arch/powerpc/cpu/mpc83xx/start.S
>> @@ -290,8 +290,6 @@ in_flash:
>> GET_GOT /* initialize GOT access */
>> - /* r3: IMMR */
>> - lis r3, CONFIG_SYS_IMMR at h
>> /* run low-level CPU init code (in Flash)*/
>> bl cpu_init_f
>> diff --git a/arch/powerpc/cpu/mpc85xx/cpu_init.c
>> b/arch/powerpc/cpu/mpc85xx/cpu_init.c
>> index a3076d8d7100..2db8f1f91fe2 100644
>> --- a/arch/powerpc/cpu/mpc85xx/cpu_init.c
>> +++ b/arch/powerpc/cpu/mpc85xx/cpu_init.c
>> @@ -435,7 +435,7 @@ void fsl_erratum_a007212_workaround(void)
>> }
>> #endif
>> -ulong cpu_init_f(void)
>> +void cpu_init_f(void)
>> {
>> extern void m8560_cpm_reset (void);
>> #ifdef CONFIG_SYS_DCSRBAR_PHYS
>> @@ -507,8 +507,6 @@ ulong cpu_init_f(void)
>> #ifdef CONFIG_SYS_FSL_ERRATUM_A007212
>> fsl_erratum_a007212_workaround();
>> #endif
>> -
>> - return 0;
>> }
>> /* Implement a dummy function for those platforms w/o SERDES */
>> diff --git a/arch/powerpc/cpu/mpc8xx/cpu_init.c
>> b/arch/powerpc/cpu/mpc8xx/cpu_init.c
>> index dc601a12976f..c1cd2fac36f4 100644
>> --- a/arch/powerpc/cpu/mpc8xx/cpu_init.c
>> +++ b/arch/powerpc/cpu/mpc8xx/cpu_init.c
>> @@ -19,8 +19,10 @@
>> * initialize a bunch of registers,
>> * initialize the UPM's
>> */
>> -void cpu_init_f(immap_t __iomem *immr)
>> +void cpu_init_f(void)
>> {
>> + volatile immap_t *immr = (void *)(CONFIG_SYS_IMMR);
>> +
>> memctl8xx_t __iomem *memctl = &immr->im_memctl;
>> ulong reg;
>> diff --git a/arch/powerpc/cpu/mpc8xx/start.S
>> b/arch/powerpc/cpu/mpc8xx/start.S
>> index 202ea81ae498..f03bfe94f25b 100644
>> --- a/arch/powerpc/cpu/mpc8xx/start.S
>> +++ b/arch/powerpc/cpu/mpc8xx/start.S
>> @@ -158,7 +158,6 @@ in_flash:
>> GET_GOT /* initialize GOT access
>> */
>> - /* r3: IMMR */
>> bl cpu_init_f /* run low-level CPU init code (from
>> Flash) */
>> bl board_init_f /* run 1st part of board init code (from
>> Flash) */
>> diff --git a/arch/powerpc/include/asm/ppc.h
>> b/arch/powerpc/include/asm/ppc.h
>> index 5e0aa08be936..615d7fda9324 100644
>> --- a/arch/powerpc/include/asm/ppc.h
>> +++ b/arch/powerpc/include/asm/ppc.h
>> @@ -122,6 +122,7 @@ static inline void set_msr(unsigned long msr)
>> void print_reginfo(void);
>> #endif
>> +void cpu_init_f(void);
>> void interrupt_init_cpu(unsigned *);
>> void timer_interrupt_cpu(struct pt_regs *);
>> unsigned long search_exception_table(unsigned long addr);
>>
>
Acked-by: Mario Six <mario.six at gdsys.cc>
More information about the U-Boot
mailing list