Merge branch 'master' of git://www.denx.de/git/u-boot-socfpga
[oweals/u-boot.git] / arch / arm / cpu / armv7 / vf610 / generic.c
index 92aaad941548391fbf5ae76bbcab4fb581661d86..1bb9b8ed1d0ae7fb0409b516b146441812be177f 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)
 {
@@ -284,14 +286,37 @@ static char *get_reset_cause(void)
 
 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;
@@ -317,3 +342,19 @@ int get_clocks(void)
 #endif
        return 0;
 }
+
+#ifndef CONFIG_SYS_DCACHE_OFF
+void enable_caches(void)
+{
+#if defined(CONFIG_SYS_ARM_CACHE_WRITETHROUGH)
+       enum dcache_option option = DCACHE_WRITETHROUGH;
+#else
+       enum dcache_option option = DCACHE_WRITEBACK;
+#endif
+       dcache_enable();
+       icache_enable();
+
+    /* Enable caching on OCRAM */
+       mmu_set_region_dcache_behaviour(IRAM_BASE_ADDR, IRAM_SIZE, option);
+}
+#endif