]> git.sur5r.net Git - u-boot/blobdiff - board/armltd/integrator/integrator.c
microblaze: Fix reset function
[u-boot] / board / armltd / integrator / integrator.c
index 780218cbe910e5900a17f05c2d5bc3fbb0a3ce9b..4658ac1fa2a7e2ee9f68a3135db7a7ddf1119130 100644 (file)
@@ -36,6 +36,8 @@
 #include <common.h>
 #include <netdev.h>
 #include <asm/io.h>
+#include "arm-ebi.h"
+#include "integrator-sc.h"
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -56,6 +58,8 @@ void show_boot_progress(int progress)
 
 int board_init (void)
 {
+       u32 val;
+
        /* arch number of Integrator Board */
 #ifdef CONFIG_ARCH_CINTEGRATOR
        gd->bd->bi_arch_number = MACH_TYPE_CINTEGRATOR;
@@ -73,6 +77,37 @@ extern void cm_remap(void);
        cm_remap();     /* remaps writeable memory to 0x00000000 */
 #endif
 
+#ifdef CONFIG_ARCH_CINTEGRATOR
+       /*
+        * Flash protection on the Integrator/CP is in a simple register
+        */
+       val = readl(CP_FLASHPROG);
+       val |= (CP_FLASHPROG_FLVPPEN | CP_FLASHPROG_FLWREN);
+       writel(val, CP_FLASHPROG);
+#else
+       /*
+        * The Integrator/AP has some special protection mechanisms
+        * for the external memories, first the External Bus Interface (EBI)
+        * then the system controller (SC).
+        *
+        * The system comes up with the flash memory non-writable and
+        * configuration locked. If we want U-Boot to be used for flash
+        * access we cannot have the flash memory locked.
+        */
+       writel(EBI_UNLOCK_MAGIC, EBI_BASE + EBI_LOCK_REG);
+       val = readl(EBI_BASE + EBI_CSR1_REG);
+       val &= EBI_CSR_WREN_MASK;
+       val |= EBI_CSR_WREN_ENABLE;
+       writel(val, EBI_BASE + EBI_CSR1_REG);
+       writel(0, EBI_BASE + EBI_LOCK_REG);
+
+       /*
+        * Set up the system controller to remove write protection from
+        * the flash memory and enable Vpp
+        */
+       writel(SC_CTRL_FLASHVPP | SC_CTRL_FLASHWP, SC_CTRLS);
+#endif
+
        icache_enable ();
 
        return 0;
@@ -80,9 +115,6 @@ extern void cm_remap(void);
 
 int misc_init_r (void)
 {
-#ifdef CONFIG_PCI
-       pci_init();
-#endif
        setenv("verify", "n");
        return (0);
 }