]> git.sur5r.net Git - u-boot/blobdiff - arch/arm/cpu/armv7/vf610/generic.c
ARM: vf610: Add SoC and CPU type detection
[u-boot] / arch / arm / cpu / armv7 / vf610 / generic.c
index a26d63ebe0135fca6def324bac919d839fda0a2c..3bdc2211e7953c6e74a4ce6de98da71261ed984e 100644 (file)
@@ -18,6 +18,8 @@
 DECLARE_GLOBAL_DATA_PTR;
 #endif
 
+static char soc_type[] = "xx0";
+
 #ifdef CONFIG_MXC_OCOTP
 void enable_ocotp_clk(unsigned char enable)
 {
@@ -265,32 +267,56 @@ static char *get_reset_cause(void)
 
        cause = readl(&src_regs->srsr);
        writel(cause, &src_regs->srsr);
-       cause &= 0xff;
 
-       switch (cause) {
-       case 0x08:
-               return "WDOG";
-       case 0x20:
+       if (cause & SRC_SRSR_POR_RST)
+               return "POWER ON RESET";
+       else if (cause & SRC_SRSR_WDOG_A5)
+               return "WDOG A5";
+       else if (cause & SRC_SRSR_WDOG_M4)
+               return "WDOG M4";
+       else if (cause & SRC_SRSR_JTAG_RST)
                return "JTAG HIGH-Z";
-       case 0x80:
+       else if (cause & SRC_SRSR_SW_RST)
+               return "SW RESET";
+       else if (cause & SRC_SRSR_RESETB)
                return "EXTERNAL RESET";
-       case 0xfd:
-               return "POR";
-       default:
+       else
                return "unknown reset";
-       }
 }
 
 int print_cpuinfo(void)
 {
-       printf("CPU:   Freescale Vybrid VF610 at %d MHz\n",
-               mxc_get_clock(MXC_ARM_CLK) / 1000000);
+       printf("CPU: Freescale Vybrid VF%s at %d MHz\n",
+              soc_type, mxc_get_clock(MXC_ARM_CLK) / 1000000);
        printf("Reset cause: %s\n", get_reset_cause());
 
        return 0;
 }
 #endif
 
+int arch_cpu_init(void)
+{
+       struct mscm *mscm = (struct mscm *)MSCM_BASE_ADDR;
+
+       soc_type[0] = mscm->cpxcount ? '6' : '5'; /*Dual Core => VF6x0 */
+       soc_type[1] = mscm->cpxcfg1 ? '1' : '0'; /* L2 Cache => VFx10 */
+
+       return 0;
+}
+
+#ifdef CONFIG_ARCH_MISC_INIT
+int arch_misc_init(void)
+{
+       char soc[6];
+
+       strcat(soc, "vf");
+       strcat(soc, soc_type);
+       setenv("soc", soc);
+
+       return 0;
+}
+#endif
+
 int cpu_eth_init(bd_t *bis)
 {
        int rc = -ENODEV;