flash: complete CONFIG_SYS_NO_FLASH move with renaming
[platform/kernel/u-boot.git] / board / amcc / sequoia / sequoia.c
index 73c65c5..1e45774 100644 (file)
@@ -10,6 +10,7 @@
  */
 
 #include <common.h>
+#include <errno.h>
 #include <libfdt.h>
 #include <fdt_support.h>
 #include <asm/ppc4xx.h>
@@ -20,7 +21,7 @@
 
 DECLARE_GLOBAL_DATA_PTR;
 
-#if !defined(CONFIG_SYS_NO_FLASH)
+#if defined(CONFIG_MTD_NOR_FLASH)
 extern flash_info_t flash_info[CONFIG_SYS_MAX_FLASH_BANKS]; /* info for FLASH chips */
 #endif
 
@@ -123,7 +124,7 @@ int board_early_init_f(void)
 
 int misc_init_r(void)
 {
-#if !defined(CONFIG_SYS_NO_FLASH)
+#if defined(CONFIG_MTD_NOR_FLASH)
        uint pbcr;
        int size_val = 0;
 #endif
@@ -135,15 +136,14 @@ int misc_init_r(void)
 #endif
        u32 reg;
 
-#if !defined(CONFIG_SYS_NO_FLASH)
+#if defined(CONFIG_MTD_NOR_FLASH)
        /* Re-do flash sizing to get full correct info */
 
        /* adjust flash start and offset */
        gd->bd->bi_flashstart = 0 - gd->bd->bi_flashsize;
        gd->bd->bi_flashoffset = 0;
 
-#if defined(CONFIG_NAND_U_BOOT) || defined(CONFIG_NAND_SPL) || \
-    defined(CONFIG_SYS_RAMBOOT)
+#if defined(CONFIG_SYS_RAMBOOT)
        mtdcr(EBC0_CFGADDR, PB3CR);
 #else
        mtdcr(EBC0_CFGADDR, PB0CR);
@@ -151,8 +151,7 @@ int misc_init_r(void)
        pbcr = mfdcr(EBC0_CFGDATA);
        size_val = ffs(gd->bd->bi_flashsize) - 21;
        pbcr = (pbcr & 0x0001ffff) | gd->bd->bi_flashstart | (size_val << 17);
-#if defined(CONFIG_NAND_U_BOOT) || defined(CONFIG_NAND_SPL) || \
-    defined(CONFIG_SYS_RAMBOOT)
+#if defined(CONFIG_SYS_RAMBOOT)
        mtdcr(EBC0_CFGADDR, PB3CR);
 #else
        mtdcr(EBC0_CFGADDR, PB0CR);
@@ -177,7 +176,7 @@ int misc_init_r(void)
                            CONFIG_ENV_ADDR_REDUND + 2*CONFIG_ENV_SECT_SIZE - 1,
                            &flash_info[0]);
 #endif
-#endif /* CONFIG_SYS_NO_FLASH */
+#endif /* CONFIG_MTD_NOR_FLASH */
 
        /*
         * USB suff...
@@ -360,12 +359,12 @@ void board_pci_fixup_irq(struct pci_controller *hose, pci_dev_t dev)
 }
 #endif
 
-#if defined(CONFIG_NAND_U_BOOT) || defined(CONFIG_SYS_RAMBOOT)
+#if defined(CONFIG_SYS_RAMBOOT)
 /*
  * On NAND-booting sequoia, we need to patch the chips select numbers
  * in the dtb (CS0 - NAND, CS3 - NOR)
  */
-void ft_board_setup(void *blob, bd_t *bd)
+int ft_board_setup(void *blob, bd_t *bd)
 {
        int rc;
        int len;
@@ -383,15 +382,14 @@ void ft_board_setup(void *blob, bd_t *bd)
        prop = fdt_get_property_w(blob, nodeoffset, "reg", &len);
        if (prop == NULL) {
                printf("Unable to update NOR chip select for NAND booting\n");
-               return;
+               return -FDT_ERR_NOTFOUND;
        }
        reg = (u32 *)&prop->data[0];
        reg[0] = 3;
        rc = fdt_find_and_setprop(blob, path, "reg", reg, 3 * sizeof(u32), 1);
        if (rc) {
-               printf("Unable to update property NOR mappings, err=%s\n",
-                      fdt_strerror(rc));
-               return;
+               printf("Unable to update property NOR mappings\n");
+               return rc;
        }
 
        /* And now configure NAND chip select to 0 instead of 3 */
@@ -400,15 +398,16 @@ void ft_board_setup(void *blob, bd_t *bd)
        prop = fdt_get_property_w(blob, nodeoffset, "reg", &len);
        if (prop == NULL) {
                printf("Unable to update NDFC chip select for NAND booting\n");
-               return;
+               return len;
        }
        reg = (u32 *)&prop->data[0];
        reg[0] = 0;
        rc = fdt_find_and_setprop(blob, path, "reg", reg, 3 * sizeof(u32), 1);
        if (rc) {
-               printf("Unable to update property NDFC mappings, err=%s\n",
-                      fdt_strerror(rc));
-               return;
+               printf("Unable to update property NDFC mapping\n");
+               return rc;
        }
+
+       return 0;
 }
-#endif /* CONFIG_NAND_U_BOOT */
+#endif /* CONFIG_SYS_RAMBOOT */