]> git.sur5r.net Git - u-boot/commitdiff
powerpc/8xxx: query feature reporting register for num cores on unknown cpus
authorKim Phillips <kim.phillips@freescale.com>
Thu, 15 Jul 2010 00:47:29 +0000 (19:47 -0500)
committerKumar Gala <galak@kernel.crashing.org>
Sun, 1 Aug 2010 16:18:45 +0000 (11:18 -0500)
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>
Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
arch/powerpc/cpu/mpc8xxx/cpu.c
arch/powerpc/include/asm/immap_85xx.h

index dc3da1689f9a96e346d86c53aa3edbd37cf37917..97a94f4cd0152739771eeb80e66c15b6ed717d65 100644 (file)
@@ -110,8 +110,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;
 }
 
index f109e8c5c2d483bdaab609b6c4227da28660c4e4..c1382c8c5e31e567aaf175dbb4f053cf23f41cfe 100644 (file)
@@ -760,6 +760,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