[U-Boot] [PATCH 2/2] powerpc/8xxx: query feature reporting register for num cores on unknown cpus

doing so helps avant garde users, such as those using simulators that allow users to configure the number of cores, so as to not have to manually adjust u-boot sources. h/w should also be reliably setting FRR NCPU in the future.
Signed-off-by: Kim Phillips kim.phillips@freescale.com --- arch/powerpc/cpu/mpc8xxx/cpu.c | 10 ++++++++-- arch/powerpc/include/asm/immap_85xx.h | 2 ++ 2 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/arch/powerpc/cpu/mpc8xxx/cpu.c b/arch/powerpc/cpu/mpc8xxx/cpu.c index 22f3423..89434e1 100644 --- a/arch/powerpc/cpu/mpc8xxx/cpu.c +++ b/arch/powerpc/cpu/mpc8xxx/cpu.c @@ -104,8 +104,14 @@ struct cpu_type *identify_cpu(u32 ver) }
int cpu_numcores() { - struct cpu_type *cpu; - cpu = gd->cpu; + ccsr_pic_t __iomem *pic = (void *)CONFIG_SYS_MPC85xx_PIC_ADDR; + struct cpu_type *cpu = gd->cpu; + + /* better to query feature reporting register than just assume 1 */ + if (cpu == &cpu_type_unknown) + return ((in_be32(&pic->frr) & MPC85xx_PICFRR_NCPU_MASK) >> + MPC85xx_PICFRR_NCPU_SHIFT) + 1; + return cpu->num_cores; }
diff --git a/arch/powerpc/include/asm/immap_85xx.h b/arch/powerpc/include/asm/immap_85xx.h index a37bc80..e1d077b 100644 --- a/arch/powerpc/include/asm/immap_85xx.h +++ b/arch/powerpc/include/asm/immap_85xx.h @@ -759,6 +759,8 @@ typedef struct ccsr_pic { u32 eoi; /* End Of IRQ */ u8 res9[3916]; u32 frr; /* Feature Reporting */ +#define MPC85xx_PICFRR_NCPU_MASK 0x00001f00 +#define MPC85xx_PICFRR_NCPU_SHIFT 8 u8 res10[28]; u32 gcr; /* Global Configuration */ #define MPC85xx_PICGCR_RST 0x80000000

On Jul 14, 2010, at 7:47 PM, Kim Phillips wrote:
doing so helps avant garde users, such as those using simulators that allow users to configure the number of cores, so as to not have to manually adjust u-boot sources. h/w should also be reliably setting FRR NCPU in the future.
Signed-off-by: Kim Phillips kim.phillips@freescale.com
arch/powerpc/cpu/mpc8xxx/cpu.c | 10 ++++++++-- arch/powerpc/include/asm/immap_85xx.h | 2 ++ 2 files changed, 10 insertions(+), 2 deletions(-)
applied to 85xx
- k

Dear Kim,
In message 20100714194729.7405f880.kim.phillips@freescale.com you wrote:
doing so helps avant garde users, such as those using simulators that allow users to configure the number of cores, so as to not have to manually adjust u-boot sources. h/w should also be reliably setting FRR NCPU in the future.
Signed-off-by: Kim Phillips kim.phillips@freescale.com
arch/powerpc/cpu/mpc8xxx/cpu.c | 10 ++++++++-- arch/powerpc/include/asm/immap_85xx.h | 2 ++ 2 files changed, 10 insertions(+), 2 deletions(-)
Unfortunately this commit breaks a number of boards, especially 86xx ones. For example:
$ ./MAKEALL MPC8610HPCD Configuring for MPC8610HPCD board... cpu.c: In function 'cpu_numcores': cpu.c:113: error: 'CONFIG_SYS_MPC85xx_PIC_ADDR' undeclared (first use in this function) cpu.c:113: error: (Each undeclared identifier is reported only once cpu.c:113: error: for each function it appears in.) cpu.c:118: error: 'MPC85xx_PICFRR_NCPU_MASK' undeclared (first use in this function) cpu.c:119: error: 'MPC85xx_PICFRR_NCPU_SHIFT' undeclared (first use in this function) make[1]: *** [/work/wd/tmp-ppc/arch/powerpc/cpu/mpc8xxx/cpu.o] Error 1 make: *** [/work/wd/tmp-ppc/arch/powerpc/cpu/mpc8xxx/lib8xxx.a] Error 2 make: *** Waiting for unfinished jobs.... ppc_6xx-size: '/work/wd/tmp-ppc/u-boot': No such file
And git bisect says:
a37c36f4e70bada297f281b0e542539ad43e50f6 is the first bad commit commit a37c36f4e70bada297f281b0e542539ad43e50f6 Author: Kim Phillips kim.phillips@freescale.com Date: Wed Jul 14 19:47:29 2010 -0500
powerpc/8xxx: query feature reporting register for num cores on unknown cpus
Can you please have a look at it?
[Did both you and Kumar forget to run MAKEALL?]
Best regards,
Wolfgang Denk

On Mon, 9 Aug 2010 23:33:18 +0200 Wolfgang Denk wd@denx.de wrote:
Dear Kim,
In message 20100714194729.7405f880.kim.phillips@freescale.com you wrote:
doing so helps avant garde users, such as those using simulators that allow users to configure the number of cores, so as to not have to manually adjust u-boot sources. h/w should also be reliably setting FRR NCPU in the future.
Signed-off-by: Kim Phillips kim.phillips@freescale.com
arch/powerpc/cpu/mpc8xxx/cpu.c | 10 ++++++++-- arch/powerpc/include/asm/immap_85xx.h | 2 ++ 2 files changed, 10 insertions(+), 2 deletions(-)
Unfortunately this commit breaks a number of boards, especially 86xx ones. For example:
sorry, my fault - this should fix it:
From 093851331069abefe38e93bb04f715e9c63c9dd3 Mon Sep 17 00:00:00 2001
From: Kim Phillips kim.phillips@freescale.com Date: Mon, 9 Aug 2010 18:28:40 -0500 Subject: [PATCH] powerpc/8xxx: share PIC defines among 85xx and 86xx
fixes breakeage introduced by commit a37c36f4e70bada297f281b0e542539ad43e50f6 "powerpc/8xxx: query feature reporting register for num cores on unknown cpus"
Reported-by: Wolfgang Denk wd@denx.de Signed-off-by: Kim Phillips kim.phillips@freescale.com --- arch/powerpc/cpu/mpc85xx/cpu.c | 2 +- arch/powerpc/cpu/mpc85xx/cpu_init.c | 2 +- arch/powerpc/cpu/mpc85xx/interrupts.c | 2 +- arch/powerpc/cpu/mpc85xx/mp.c | 6 +++--- arch/powerpc/cpu/mpc85xx/traps.c | 2 +- arch/powerpc/cpu/mpc8xxx/cpu.c | 8 +++++--- arch/powerpc/include/asm/immap_85xx.h | 4 +--- arch/powerpc/include/asm/immap_86xx.h | 9 ++++++--- 8 files changed, 19 insertions(+), 16 deletions(-)
diff --git a/arch/powerpc/cpu/mpc85xx/cpu.c b/arch/powerpc/cpu/mpc85xx/cpu.c index f15d43c..3f80700 100644 --- a/arch/powerpc/cpu/mpc85xx/cpu.c +++ b/arch/powerpc/cpu/mpc85xx/cpu.c @@ -74,7 +74,7 @@ int checkcpu (void) puts("Unicore software on multiprocessor system!!\n" "To enable mutlticore build define CONFIG_MP\n"); #endif - volatile ccsr_pic_t *pic = (void *)(CONFIG_SYS_MPC85xx_PIC_ADDR); + volatile ccsr_pic_t *pic = (void *)(CONFIG_SYS_MPC8xxx_PIC_ADDR); printf("CPU%d: ", pic->whoami); } else { puts("CPU: "); diff --git a/arch/powerpc/cpu/mpc85xx/cpu_init.c b/arch/powerpc/cpu/mpc85xx/cpu_init.c index 2c3be6d..27236a0 100644 --- a/arch/powerpc/cpu/mpc85xx/cpu_init.c +++ b/arch/powerpc/cpu/mpc85xx/cpu_init.c @@ -179,7 +179,7 @@ static void corenet_tb_init(void) volatile ccsr_rcpm_t *rcpm = (void *)(CONFIG_SYS_FSL_CORENET_RCPM_ADDR); volatile ccsr_pic_t *pic = - (void *)(CONFIG_SYS_MPC85xx_PIC_ADDR); + (void *)(CONFIG_SYS_MPC8xxx_PIC_ADDR); u32 whoami = in_be32(&pic->whoami);
/* Enable the timebase register for this core */ diff --git a/arch/powerpc/cpu/mpc85xx/interrupts.c b/arch/powerpc/cpu/mpc85xx/interrupts.c index ac8c01a..a62b031 100644 --- a/arch/powerpc/cpu/mpc85xx/interrupts.c +++ b/arch/powerpc/cpu/mpc85xx/interrupts.c @@ -35,7 +35,7 @@
int interrupt_init_cpu(unsigned int *decrementer_count) { - ccsr_pic_t __iomem *pic = (void *)CONFIG_SYS_MPC85xx_PIC_ADDR; + ccsr_pic_t __iomem *pic = (void *)CONFIG_SYS_MPC8xxx_PIC_ADDR;
out_be32(&pic->gcr, MPC85xx_PICGCR_RST); while (in_be32(&pic->gcr) & MPC85xx_PICGCR_RST) diff --git a/arch/powerpc/cpu/mpc85xx/mp.c b/arch/powerpc/cpu/mpc85xx/mp.c index e05257c..603baef 100644 --- a/arch/powerpc/cpu/mpc85xx/mp.c +++ b/arch/powerpc/cpu/mpc85xx/mp.c @@ -38,7 +38,7 @@ u32 get_my_id()
int cpu_reset(int nr) { - volatile ccsr_pic_t *pic = (void *)(CONFIG_SYS_MPC85xx_PIC_ADDR); + volatile ccsr_pic_t *pic = (void *)(CONFIG_SYS_MPC8xxx_PIC_ADDR); out_be32(&pic->pir, 1 << nr); /* the dummy read works around an errata on early 85xx MP PICs */ (void)in_be32(&pic->pir); @@ -207,7 +207,7 @@ static void plat_mp_up(unsigned long bootpg) gur = (void *)(CONFIG_SYS_MPC85xx_GUTS_ADDR); ccm = (void *)(CONFIG_SYS_FSL_CORENET_CCM_ADDR); rcpm = (void *)(CONFIG_SYS_FSL_CORENET_RCPM_ADDR); - pic = (void *)(CONFIG_SYS_MPC85xx_PIC_ADDR); + pic = (void *)(CONFIG_SYS_MPC8xxx_PIC_ADDR);
nr_cpus = ((in_be32(&pic->frr) >> 8) & 0xff) + 1;
@@ -272,7 +272,7 @@ static void plat_mp_up(unsigned long bootpg) volatile u32 bpcr; volatile ccsr_local_ecm_t *ecm = (void *)(CONFIG_SYS_MPC85xx_ECM_ADDR); volatile ccsr_gur_t *gur = (void *)(CONFIG_SYS_MPC85xx_GUTS_ADDR); - volatile ccsr_pic_t *pic = (void *)(CONFIG_SYS_MPC85xx_PIC_ADDR); + volatile ccsr_pic_t *pic = (void *)(CONFIG_SYS_MPC8xxx_PIC_ADDR); u32 devdisr; int timeout = 10;
diff --git a/arch/powerpc/cpu/mpc85xx/traps.c b/arch/powerpc/cpu/mpc85xx/traps.c index 7e96664..7800717 100644 --- a/arch/powerpc/cpu/mpc85xx/traps.c +++ b/arch/powerpc/cpu/mpc85xx/traps.c @@ -288,7 +288,7 @@ UnknownException(struct pt_regs *regs) void ExtIntException(struct pt_regs *regs) { - volatile ccsr_pic_t *pic = (void *)(CONFIG_SYS_MPC85xx_PIC_ADDR); + volatile ccsr_pic_t *pic = (void *)(CONFIG_SYS_MPC8xxx_PIC_ADDR);
uint vect;
diff --git a/arch/powerpc/cpu/mpc8xxx/cpu.c b/arch/powerpc/cpu/mpc8xxx/cpu.c index 97a94f4..5b30fbd 100644 --- a/arch/powerpc/cpu/mpc8xxx/cpu.c +++ b/arch/powerpc/cpu/mpc8xxx/cpu.c @@ -110,13 +110,15 @@ struct cpu_type *identify_cpu(u32 ver) }
int cpu_numcores() { - ccsr_pic_t __iomem *pic = (void *)CONFIG_SYS_MPC85xx_PIC_ADDR; + ccsr_pic_t __iomem *pic = (void *)CONFIG_SYS_MPC8xxx_PIC_ADDR; struct cpu_type *cpu = gd->cpu;
/* better to query feature reporting register than just assume 1 */ +#define MPC8xxx_PICFRR_NCPU_MASK 0x00001f00 +#define MPC8xxx_PICFRR_NCPU_SHIFT 8 if (cpu == &cpu_type_unknown) - return ((in_be32(&pic->frr) & MPC85xx_PICFRR_NCPU_MASK) >> - MPC85xx_PICFRR_NCPU_SHIFT) + 1; + return ((in_be32(&pic->frr) & MPC8xxx_PICFRR_NCPU_MASK) >> + MPC8xxx_PICFRR_NCPU_SHIFT) + 1;
return cpu->num_cores; } diff --git a/arch/powerpc/include/asm/immap_85xx.h b/arch/powerpc/include/asm/immap_85xx.h index c1382c8..e5a02c3 100644 --- a/arch/powerpc/include/asm/immap_85xx.h +++ b/arch/powerpc/include/asm/immap_85xx.h @@ -760,8 +760,6 @@ typedef struct ccsr_pic { u32 eoi; /* End Of IRQ */ u8 res9[3916]; u32 frr; /* Feature Reporting */ -#define MPC85xx_PICFRR_NCPU_MASK 0x00001f00 -#define MPC85xx_PICFRR_NCPU_SHIFT 8 u8 res10[28]; u32 gcr; /* Global Configuration */ #define MPC85xx_PICGCR_RST 0x80000000 @@ -2301,7 +2299,7 @@ typedef struct ccsr_pme { (CONFIG_SYS_IMMR + CONFIG_SYS_MPC85xx_DMA_OFFSET) #define CONFIG_SYS_MPC85xx_ESDHC_ADDR \ (CONFIG_SYS_IMMR + CONFIG_SYS_MPC85xx_ESDHC_OFFSET) -#define CONFIG_SYS_MPC85xx_PIC_ADDR \ +#define CONFIG_SYS_MPC8xxx_PIC_ADDR \ (CONFIG_SYS_IMMR + CONFIG_SYS_MPC85xx_PIC_OFFSET) #define CONFIG_SYS_MPC85xx_CPM_ADDR \ (CONFIG_SYS_IMMR + CONFIG_SYS_MPC85xx_CPM_OFFSET) diff --git a/arch/powerpc/include/asm/immap_86xx.h b/arch/powerpc/include/asm/immap_86xx.h index 4bebb68..4e60cbb 100644 --- a/arch/powerpc/include/asm/immap_86xx.h +++ b/arch/powerpc/include/asm/immap_86xx.h @@ -1250,12 +1250,15 @@ typedef struct immap {
extern immap_t *immr;
-#define CONFIG_SYS_MPC86xx_DDR_OFFSET (0x2000) +#define CONFIG_SYS_MPC86xx_DDR_OFFSET 0x2000 #define CONFIG_SYS_MPC86xx_DDR_ADDR (CONFIG_SYS_IMMR + CONFIG_SYS_MPC86xx_DDR_OFFSET) -#define CONFIG_SYS_MPC86xx_DDR2_OFFSET (0x6000) +#define CONFIG_SYS_MPC86xx_DDR2_OFFSET 0x6000 #define CONFIG_SYS_MPC86xx_DDR2_ADDR (CONFIG_SYS_IMMR + CONFIG_SYS_MPC86xx_DDR2_OFFSET) -#define CONFIG_SYS_MPC86xx_DMA_OFFSET (0x21000) +#define CONFIG_SYS_MPC86xx_DMA_OFFSET 0x21000 #define CONFIG_SYS_MPC86xx_DMA_ADDR (CONFIG_SYS_IMMR + CONFIG_SYS_MPC86xx_DMA_OFFSET) +#define CONFIG_SYS_MPC86xx_PIC_OFFSET 0x40000 +#define CONFIG_SYS_MPC8xxx_PIC_ADDR (CONFIG_SYS_IMMR + CONFIG_SYS_MPC86xx_PIC_OFFSET) +
#define CONFIG_SYS_MPC86xx_PCI1_OFFSET 0x8000 #ifdef CONFIG_MPC8610

On Aug 9, 2010, at 6:39 PM, Kim Phillips wrote:
From 093851331069abefe38e93bb04f715e9c63c9dd3 Mon Sep 17 00:00:00 2001
From: Kim Phillips kim.phillips@freescale.com Date: Mon, 9 Aug 2010 18:28:40 -0500 Subject: [PATCH] powerpc/8xxx: share PIC defines among 85xx and 86xx
fixes breakeage introduced by commit a37c36f4e70bada297f281b0e542539ad43e50f6 "powerpc/8xxx: query feature reporting register for num cores on unknown cpus"
Reported-by: Wolfgang Denk wd@denx.de Signed-off-by: Kim Phillips kim.phillips@freescale.com
arch/powerpc/cpu/mpc85xx/cpu.c | 2 +- arch/powerpc/cpu/mpc85xx/cpu_init.c | 2 +- arch/powerpc/cpu/mpc85xx/interrupts.c | 2 +- arch/powerpc/cpu/mpc85xx/mp.c | 6 +++--- arch/powerpc/cpu/mpc85xx/traps.c | 2 +- arch/powerpc/cpu/mpc8xxx/cpu.c | 8 +++++--- arch/powerpc/include/asm/immap_85xx.h | 4 +--- arch/powerpc/include/asm/immap_86xx.h | 9 ++++++--- 8 files changed, 19 insertions(+), 16 deletions(-)
applied
- k
participants (3)
-
Kim Phillips
-
Kumar Gala
-
Wolfgang Denk