summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPoonam Aggrwal <poonam.aggrwal@freescale.com>2009-10-07 15:47:43 -0400
committerJustin Waters <justin.waters@timesys.com>2009-10-07 15:47:43 -0400
commit1a6d07ce17bdb34df21d0acb711424b3063322d3 (patch)
tree2d96a6a3d0be24b7b059be74da1413f3acd41e2c
parenta5a53757225320b98afa89e6e9d7e4c41f02c10d (diff)
u-boot-2009.03-p2020rdb-Removed-CONFIG_NUM_CPUS-for-85xx
Removed CONFIG_NUM_CPUS for 85xx processor series. Instead the num of cores is determined dynamically by reading the SVR values. This can help to use the same u-boot image across the platforms. Added CONFIG_MAX_CPUS value 8. Signed-off-by: Poonam Aggrwal <poonam.aggrwal@freescale.com>
-rw-r--r--common/cmd_mp.c8
-rw-r--r--cpu/mpc85xx/cpu.c96
-rw-r--r--cpu/mpc85xx/mp.c6
-rw-r--r--cpu/mpc85xx/release.S2
-rw-r--r--cpu/mpc85xx/speed.c4
-rw-r--r--include/asm-ppc/config.h1
-rw-r--r--include/asm-ppc/global_data.h5
-rw-r--r--include/asm-ppc/processor.h5
-rw-r--r--include/common.h2
-rw-r--r--include/e500.h7
-rw-r--r--lib_ppc/board.c5
-rw-r--r--lib_ppc/bootm.c4
12 files changed, 89 insertions, 56 deletions
diff --git a/common/cmd_mp.c b/common/cmd_mp.c
index a0839c2fbb..158c639ecf 100644
--- a/common/cmd_mp.c
+++ b/common/cmd_mp.c
@@ -1,5 +1,5 @@
/*
- * Copyright 2008 Freescale Semiconductor, Inc.
+ * Copyright 2008-2009 Freescale Semiconductor, Inc.
*
* See file CREDITS for list of people who contributed to this
* project.
@@ -23,6 +23,8 @@
#include <common.h>
#include <command.h>
+DECLARE_GLOBAL_DATA_PTR;
+
int
cpu_cmd(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
{
@@ -34,9 +36,9 @@ cpu_cmd(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
}
cpuid = simple_strtoul(argv[1], NULL, 10);
- if (cpuid >= CONFIG_NUM_CPUS) {
+ if (cpuid >= gd->cpu->num_cores) {
printf ("Core num: %lu is out of range[0..%d]\n",
- cpuid, CONFIG_NUM_CPUS - 1);
+ cpuid, gd->cpu->num_cores - 1);
return 1;
}
diff --git a/cpu/mpc85xx/cpu.c b/cpu/mpc85xx/cpu.c
index 5b72fe544f..d176fd7956 100644
--- a/cpu/mpc85xx/cpu.c
+++ b/cpu/mpc85xx/cpu.c
@@ -1,5 +1,5 @@
/*
- * Copyright 2004,2007,2008 Freescale Semiconductor, Inc.
+ * Copyright 2004-2009 Freescale Semiconductor, Inc.
* (C) Copyright 2002, 2003 Motorola Inc.
* Xianghua Xiao (X.Xiao@motorola.com)
*
@@ -38,33 +38,33 @@
DECLARE_GLOBAL_DATA_PTR;
struct cpu_type cpu_type_list [] = {
- CPU_TYPE_ENTRY(8533, 8533),
- CPU_TYPE_ENTRY(8533, 8533_E),
- CPU_TYPE_ENTRY(8536, 8536),
- CPU_TYPE_ENTRY(8536, 8536_E),
- CPU_TYPE_ENTRY(8540, 8540),
- CPU_TYPE_ENTRY(8541, 8541),
- CPU_TYPE_ENTRY(8541, 8541_E),
- CPU_TYPE_ENTRY(8543, 8543),
- CPU_TYPE_ENTRY(8543, 8543_E),
- CPU_TYPE_ENTRY(8544, 8544),
- CPU_TYPE_ENTRY(8544, 8544_E),
- CPU_TYPE_ENTRY(8545, 8545),
- CPU_TYPE_ENTRY(8545, 8545_E),
- CPU_TYPE_ENTRY(8547, 8547_E),
- CPU_TYPE_ENTRY(8548, 8548),
- CPU_TYPE_ENTRY(8548, 8548_E),
- CPU_TYPE_ENTRY(8555, 8555),
- CPU_TYPE_ENTRY(8555, 8555_E),
- CPU_TYPE_ENTRY(8560, 8560),
- CPU_TYPE_ENTRY(8567, 8567),
- CPU_TYPE_ENTRY(8567, 8567_E),
- CPU_TYPE_ENTRY(8568, 8568),
- CPU_TYPE_ENTRY(8568, 8568_E),
- CPU_TYPE_ENTRY(8572, 8572),
- CPU_TYPE_ENTRY(8572, 8572_E),
- CPU_TYPE_ENTRY(P2020, P2020),
- CPU_TYPE_ENTRY(P2020, P2020_E),
+ CPU_TYPE_ENTRY(8533, 8533, 1),
+ CPU_TYPE_ENTRY(8533, 8533_E, 1),
+ CPU_TYPE_ENTRY(8536, 8536, 1),
+ CPU_TYPE_ENTRY(8536, 8536_E, 1),
+ CPU_TYPE_ENTRY(8540, 8540, 1),
+ CPU_TYPE_ENTRY(8541, 8541, 1),
+ CPU_TYPE_ENTRY(8541, 8541_E, 1),
+ CPU_TYPE_ENTRY(8543, 8543, 1),
+ CPU_TYPE_ENTRY(8543, 8543_E, 1),
+ CPU_TYPE_ENTRY(8544, 8544, 1),
+ CPU_TYPE_ENTRY(8544, 8544_E, 1),
+ CPU_TYPE_ENTRY(8545, 8545, 1),
+ CPU_TYPE_ENTRY(8545, 8545_E, 1),
+ CPU_TYPE_ENTRY(8547, 8547_E, 1),
+ CPU_TYPE_ENTRY(8548, 8548, 1),
+ CPU_TYPE_ENTRY(8548, 8548_E, 1),
+ CPU_TYPE_ENTRY(8555, 8555, 1),
+ CPU_TYPE_ENTRY(8555, 8555_E, 1),
+ CPU_TYPE_ENTRY(8560, 8560, 1),
+ CPU_TYPE_ENTRY(8567, 8567, 1),
+ CPU_TYPE_ENTRY(8567, 8567_E, 1),
+ CPU_TYPE_ENTRY(8568, 8568, 1),
+ CPU_TYPE_ENTRY(8568, 8568_E, 1),
+ CPU_TYPE_ENTRY(8572, 8572, 2),
+ CPU_TYPE_ENTRY(8572, 8572_E, 2),
+ CPU_TYPE_ENTRY(P2020, P2020, 2),
+ CPU_TYPE_ENTRY(P2020, P2020_E, 2),
};
struct cpu_type *identify_cpu(u32 ver)
@@ -77,6 +77,19 @@ struct cpu_type *identify_cpu(u32 ver)
return NULL;
}
+int probecpu (void)
+{
+ uint svr;
+ uint ver;
+
+ svr = get_svr();
+ ver = SVR_SOC_VER(svr);
+
+ gd->cpu = identify_cpu(ver);
+
+ return 0;
+}
+
int checkcpu (void)
{
sys_info_t sysinfo;
@@ -96,23 +109,30 @@ int checkcpu (void)
int i;
svr = get_svr();
- ver = SVR_SOC_VER(svr);
major = SVR_MAJ(svr);
#ifdef CONFIG_MPC8536
major &= 0x7; /* the msb of this nibble is a mfg code */
#endif
minor = SVR_MIN(svr);
-#if (CONFIG_NUM_CPUS > 1)
- volatile ccsr_pic_t *pic = (void *)(CONFIG_SYS_MPC85xx_PIC_ADDR);
- printf("CPU%d: ", pic->whoami);
-#else
- puts("CPU: ");
+#ifndef CONFIG_MP
+ if (gd->cpu->num_cores > 1)
+ puts("#############################################\n"
+ "The system is detected to be MULTICORE,\n"
+ "but u-boot is built with UNI-CORE\n"
+ "To enable mutlticore Build set CONFIG_MP\n"
+ "#############################################\n\n");
#endif
- cpu = identify_cpu(ver);
- if (cpu) {
- puts(cpu->name);
+ if (gd->cpu->num_cores > 1) {
+ volatile ccsr_pic_t *pic = (void *)(CONFIG_SYS_MPC85xx_PIC_ADDR);
+ printf("CPU%d: ", pic->whoami);
+ }
+ else
+ puts("CPU: ");
+
+ if (gd->cpu->name) {
+ puts(gd->cpu->name);
if (IS_E_PROCESSOR(svr))
puts("E");
@@ -146,7 +166,7 @@ int checkcpu (void)
get_sys_info(&sysinfo);
puts("Clock Configuration:");
- for (i = 0; i < CONFIG_NUM_CPUS; i++) {
+ for (i = 0; i < gd->cpu->num_cores; i++) {
if (!(i & 3))
printf ("\n ");
printf("CPU%d:%-4s MHz, ",
diff --git a/cpu/mpc85xx/mp.c b/cpu/mpc85xx/mp.c
index 3338c1aa71..c76173654b 100644
--- a/cpu/mpc85xx/mp.c
+++ b/cpu/mpc85xx/mp.c
@@ -1,5 +1,5 @@
/*
- * Copyright 2008 Freescale Semiconductor.
+ * Copyright 2008-2009 Freescale Semiconductor.
*
* See file CREDITS for list of people who contributed to this
* project.
@@ -147,7 +147,7 @@ static void pq3_mp_up(unsigned long bootpg)
out_be32(&gur->devdisr, devdisr);
/* release the hounds */
- up = ((1 << CONFIG_NUM_CPUS) - 1);
+ up = ((1 << gd->cpu->num_cores) - 1);
bpcr = in_be32(&ecm->eebpcr);
bpcr |= (up << 24);
out_be32(&ecm->eebpcr, bpcr);
@@ -157,7 +157,7 @@ static void pq3_mp_up(unsigned long bootpg)
/* wait for everyone */
while (timeout) {
int i;
- for (i = 0; i < CONFIG_NUM_CPUS; i++) {
+ for (i = 0; i < gd->cpu->num_cores; i++) {
if (table[i * NUM_BOOT_ENTRY + BOOT_ENTRY_ADDR_LOWER])
cpu_up_mask |= (1 << i);
};
diff --git a/cpu/mpc85xx/release.S b/cpu/mpc85xx/release.S
index 54c936c3ed..f4e280fbd5 100644
--- a/cpu/mpc85xx/release.S
+++ b/cpu/mpc85xx/release.S
@@ -187,7 +187,7 @@ __secondary_start_page:
.align L1_CACHE_SHIFT
.globl __spin_table
__spin_table:
- .space CONFIG_NUM_CPUS*ENTRY_SIZE
+ .space CONFIG_MAX_CPUS*ENTRY_SIZE
/* Fill in the empty space. The actual reset vector is
* the last word of the page */
diff --git a/cpu/mpc85xx/speed.c b/cpu/mpc85xx/speed.c
index b0f47e042e..227db914fa 100644
--- a/cpu/mpc85xx/speed.c
+++ b/cpu/mpc85xx/speed.c
@@ -1,5 +1,5 @@
/*
- * Copyright 2004 Freescale Semiconductor.
+ * Copyright 2004-2009 Freescale Semiconductor.
* (C) Copyright 2003 Motorola Inc.
* Xianghua Xiao, (X.Xiao@motorola.com)
*
@@ -48,7 +48,7 @@ void get_sys_info (sys_info_t * sysInfo)
/* Divide before multiply to avoid integer
* overflow for processor speeds above 2GHz */
half_freqSystemBus = sysInfo->freqSystemBus/2;
- for (i = 0; i < CONFIG_NUM_CPUS; i++) {
+ for (i = 0; i < gd->cpu->num_cores; i++) {
e500_ratio = ((gur->porpllsr) >> (i * 8 + 16)) & 0x3f;
sysInfo->freqProcessor[i] = e500_ratio * half_freqSystemBus;
}
diff --git a/include/asm-ppc/config.h b/include/asm-ppc/config.h
index 0900f65b96..e5269b5e9c 100644
--- a/include/asm-ppc/config.h
+++ b/include/asm-ppc/config.h
@@ -29,4 +29,5 @@
#endif
#endif
+#define CONFIG_MAX_CPUS 8
#endif
diff --git a/include/asm-ppc/global_data.h b/include/asm-ppc/global_data.h
index e5a3b2c170..bf4911b3b7 100644
--- a/include/asm-ppc/global_data.h
+++ b/include/asm-ppc/global_data.h
@@ -1,4 +1,5 @@
/*
+ * Copyright 2009 Freescale Semiconductor, Inc.
* (C) Copyright 2002
* Wolfgang Denk, DENX Software Engineering, wd@denx.de.
*
@@ -25,6 +26,7 @@
#define __ASM_GBL_DATA_H
#include "asm/types.h"
+#include "asm/processor.h"
/*
* The following data structure is placed in some memory wich is
@@ -92,6 +94,9 @@ typedef struct global_data {
#if defined(CONFIG_MPC85xx) || defined(CONFIG_MPC86xx)
u32 lbc_clk;
#endif /* CONFIG_MPC85xx || CONFIG_MPC86xx */
+#if defined(CONFIG_MPC85xx)
+ struct cpu_type *cpu;
+#endif
#if defined(CONFIG_MPC83XX) || defined(CONFIG_MPC85xx) || defined(CONFIG_MPC86xx)
u32 i2c1_clk;
u32 i2c2_clk;
diff --git a/include/asm-ppc/processor.h b/include/asm-ppc/processor.h
index 5b29de0fda..9fd60e84d0 100644
--- a/include/asm-ppc/processor.h
+++ b/include/asm-ppc/processor.h
@@ -1013,13 +1013,14 @@ n:
struct cpu_type {
char name[15];
u32 soc_ver;
+ u32 num_cores;
};
struct cpu_type *identify_cpu(u32 ver);
#if defined(CONFIG_MPC85xx)
-#define CPU_TYPE_ENTRY(n, v) \
- { .name = #n, .soc_ver = SVR_##v, }
+#define CPU_TYPE_ENTRY(n, v, nc) \
+ { .name = #n, .soc_ver = SVR_##v, .num_cores = (nc), }
#else
#if defined(CONFIG_MPC83XX)
#define CPU_TYPE_ENTRY(x) {#x, SPR_##x}
diff --git a/include/common.h b/include/common.h
index b75ea60b88..1a7b135b67 100644
--- a/include/common.h
+++ b/include/common.h
@@ -1,4 +1,5 @@
/*
+ * Copyright 2009 Freescale Semiconductor, Inc.
* (C) Copyright 2000-2007
* Wolfgang Denk, DENX Software Engineering, wd@denx.de.
*
@@ -446,6 +447,7 @@ void ppcDWstore(unsigned int *addr, unsigned int *value);
#endif
/* $(CPU)/cpu.c */
+int probecpu (void);
int checkcpu (void);
int checkicache (void);
int checkdcache (void);
diff --git a/include/e500.h b/include/e500.h
index 4c5eeb74e1..3b0f332e2e 100644
--- a/include/e500.h
+++ b/include/e500.h
@@ -1,4 +1,5 @@
/*
+ * Copyright 2009 Freescale Semiconductor, Inc.
* Copyright 2003 Motorola,Inc.
* Xianghua Xiao(x.xiao@motorola.com)
*/
@@ -8,13 +9,9 @@
#ifndef __ASSEMBLY__
-#ifndef CONFIG_NUM_CPUS
-#define CONFIG_NUM_CPUS 1
-#endif
-
typedef struct
{
- unsigned long freqProcessor[CONFIG_NUM_CPUS];
+ unsigned long freqProcessor[CONFIG_MAX_CPUS];
unsigned long freqSystemBus;
unsigned long freqDDRBus;
unsigned long freqLocalBus;
diff --git a/lib_ppc/board.c b/lib_ppc/board.c
index f69c5f4f1f..823054fb90 100644
--- a/lib_ppc/board.c
+++ b/lib_ppc/board.c
@@ -1,4 +1,5 @@
/*
+ * Copyright 2009 Freescale Semiconductor, Inc.
* (C) Copyright 2000-2006
* Wolfgang Denk, DENX Software Engineering, wd@denx.de.
*
@@ -286,7 +287,9 @@ init_fnc_t *init_sequence[] = {
#if defined(CONFIG_BOARD_EARLY_INIT_F)
board_early_init_f,
#endif
-
+#if defined(CONFIG_MPC85xx)
+ probecpu,
+#endif
#if !defined(CONFIG_8xx_CPUCLK_DEFAULT)
get_clocks, /* get CPU and bus clocks (etc.) */
#if defined(CONFIG_TQM8xxL) && !defined(CONFIG_TQM866M) \
diff --git a/lib_ppc/bootm.c b/lib_ppc/bootm.c
index e03d763907..8101823058 100644
--- a/lib_ppc/bootm.c
+++ b/lib_ppc/bootm.c
@@ -1,4 +1,5 @@
/*
+ * Copyright 2009 Freescale Semiconductor, Inc.
* (C) Copyright 2008 Semihalf
*
* (C) Copyright 2000-2006
@@ -170,11 +171,12 @@ void arch_lmb_reserve(struct lmb *lmb)
static void boot_prep_linux(void)
{
-#if (CONFIG_NUM_CPUS > 1)
+#ifdef CONFIG_MP
/* if we are MP make sure to flush the dcache() to any changes are made
* visibile to all other cores */
flush_dcache();
#endif
+
return ;
}