Merge branch 'master' of git://git.denx.de/u-boot-net
[platform/kernel/u-boot.git] / arch / powerpc / cpu / mpc85xx / cpu.c
index 22fa461..5ddb294 100644 (file)
 
 DECLARE_GLOBAL_DATA_PTR;
 
+/*
+ * Default board reset function
+ */
+static void
+__board_reset(void)
+{
+       /* Do nothing */
+}
+void board_reset(void) __attribute__((weak, alias("__board_reset")));
+
 int checkcpu (void)
 {
        sys_info_t sysinfo;
@@ -64,13 +74,11 @@ int checkcpu (void)
        u32 ddr_ratio = 0;
 #endif /* CONFIG_FSL_CORENET */
 #endif /* CONFIG_DDR_CLK_FREQ */
-       int i;
+       unsigned int i, core, nr_cores = cpu_numcores();
+       u32 mask = cpu_mask();
 
        svr = get_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 (cpu_numcores() > 1) {
@@ -109,6 +117,9 @@ int checkcpu (void)
        case PVR_VER_E5500:
                puts("E5500");
                break;
+       case PVR_VER_E6500:
+               puts("E6500");
+               break;
        default:
                puts("Unknown");
                break;
@@ -119,11 +130,11 @@ int checkcpu (void)
        get_sys_info(&sysinfo);
 
        puts("Clock Configuration:");
-       for (i = 0; i < cpu_numcores(); i++) {
+       for_each_cpu(i, core, nr_cores, mask) {
                if (!(i & 3))
                        printf ("\n       ");
-               printf("CPU%d:%-4s MHz, ",
-                               i,strmhz(buf1, sysinfo.freqProcessor[i]));
+               printf("CPU%d:%-4s MHz, ", core,
+                       strmhz(buf1, sysinfo.freqProcessor[core]));
        }
        printf("\n       CCB:%-4s MHz,\n", strmhz(buf1, sysinfo.freqSystemBus));
 
@@ -217,7 +228,12 @@ int do_reset (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
        mtspr(DBCR0,val);
 #else
        volatile ccsr_gur_t *gur = (void *)(CONFIG_SYS_MPC85xx_GUTS_ADDR);
-       out_be32(&gur->rstcr, 0x2);     /* HRESET_REQ */
+
+       /* Attempt board-specific reset */
+       board_reset();
+
+       /* Next try asserting HRESET_REQ */
+       out_be32(&gur->rstcr, 0x2);
        udelay(100);
 #endif
 
@@ -414,11 +430,21 @@ static void dump_spd_ddr_reg(void)
                case 0:
                        ddr[i] = (void *)CONFIG_SYS_MPC85xx_DDR_ADDR;
                        break;
-#ifdef CONFIG_SYS_MPC85xx_DDR2_ADDR
+#if defined(CONFIG_SYS_MPC85xx_DDR2_ADDR) && (CONFIG_NUM_DDR_CONTROLLERS > 1)
                case 1:
                        ddr[i] = (void *)CONFIG_SYS_MPC85xx_DDR2_ADDR;
                        break;
 #endif
+#if defined(CONFIG_SYS_MPC85xx_DDR3_ADDR) && (CONFIG_NUM_DDR_CONTROLLERS > 2)
+               case 2:
+                       ddr[i] = (void *)CONFIG_SYS_MPC85xx_DDR3_ADDR;
+                       break;
+#endif
+#if defined(CONFIG_SYS_MPC85xx_DDR4_ADDR) && (CONFIG_NUM_DDR_CONTROLLERS > 3)
+               case 3:
+                       ddr[i] = (void *)CONFIG_SYS_MPC85xx_DDR4_ADDR;
+                       break;
+#endif
                default:
                        printf("%s unexpected controller number = %u\n",
                                __func__, i);