]> git.kernelconcepts.de Git - karo-tx-uboot.git/blobdiff - arch/powerpc/lib/board.c
ppc: Don't initialize write protected NOR flashes
[karo-tx-uboot.git] / arch / powerpc / lib / board.c
index 529f71960d7ce62dfbfbc897ebe86443d23f8fda..2e0749da0a545a3d15300903c9e5def269a8bdac 100644 (file)
@@ -175,6 +175,16 @@ void __board_add_ram_info(int use_default)
 }
 void board_add_ram_info(int) __attribute__((weak, alias("__board_add_ram_info")));
 
+int __board_flash_wp_on(void)
+{
+       /*
+        * Most flashes can't be detected when write protection is enabled,
+        * so provide a way to let U-Boot gracefully ignore write protected
+        * devices.
+        */
+       return 0;
+}
+int board_flash_wp_on(void) __attribute__((weak, alias("__board_flash_wp_on")));
 
 static int init_func_ram (void)
 {
@@ -546,8 +556,6 @@ void board_init_f (ulong bootflag)
        }
 #endif
 
-       bd->bi_bootflags = bootflag;    /* boot / reboot flag (for LynxOS)    */
-
        WATCHDOG_RESET ();
        bd->bi_intfreq = gd->cpu_clk;   /* Internal Freq, in Hz */
        bd->bi_busfreq = gd->bus_clk;   /* Bus Freq,      in Hz */
@@ -700,7 +708,11 @@ void board_init_r (gd_t *id, ulong dest_addr)
 #if !defined(CONFIG_SYS_NO_FLASH)
        puts ("FLASH: ");
 
-       if ((flash_size = flash_init ()) > 0) {
+       if (board_flash_wp_on()) {
+               printf("Uninitialized - Write Protect On\n");
+               /* Since WP is on, we can't find real size.  Set to 0 */
+               flash_size = 0;
+       } else if ((flash_size = flash_init ()) > 0) {
 # ifdef CONFIG_SYS_FLASH_CHECKSUM
                print_size (flash_size, "");
                /*
@@ -734,7 +746,7 @@ void board_init_r (gd_t *id, ulong dest_addr)
 
 # if defined(CONFIG_OXC) || defined(CONFIG_RMU)
        /* flash mapped at end of memory map */
-       bd->bi_flashoffset = TEXT_BASE + flash_size;
+       bd->bi_flashoffset = CONFIG_SYS_TEXT_BASE + flash_size;
 # elif CONFIG_SYS_MONITOR_BASE == CONFIG_SYS_FLASH_BASE
        bd->bi_flashoffset = monitor_flash_len; /* reserved area for startup monitor  */
 # endif