]> git.sur5r.net Git - u-boot/commitdiff
mtd: OneNAND: allow board init function fail
authorLadislav Michl <ladis@linux-mips.org>
Tue, 12 Jul 2016 18:28:20 +0000 (20:28 +0200)
committerTom Rini <trini@konsulko.com>
Fri, 22 Jul 2016 18:46:12 +0000 (14:46 -0400)
Signed-off-by: Ladislav Michl <ladis@linux-mips.org>
board/micronas/vct/ebi_onenand.c
board/samsung/goni/onenand.c
board/samsung/smdkc100/onenand.c
board/samsung/universal_c210/onenand.c
drivers/mtd/onenand/onenand_uboot.c
include/onenand_uboot.h

index 62eb6489be273252a9688e67f3b5d6b96e39a547..ef892cae15b730651643d9ae7e9ec484f42f18ee 100644 (file)
@@ -169,7 +169,7 @@ static int ebi_write_bufferram(struct mtd_info *mtd, loff_t addr, int area,
        return 0;
 }
 
-void onenand_board_init(struct mtd_info *mtd)
+int onenand_board_init(struct mtd_info *mtd)
 {
        struct onenand_chip *chip = mtd->priv;
 
@@ -181,4 +181,6 @@ void onenand_board_init(struct mtd_info *mtd)
 
        chip->read_bufferram = ebi_read_bufferram;
        chip->write_bufferram = ebi_write_bufferram;
+
+       return 0;
 }
index b74d8e8ac9eb3c8d26226529fc5b721fc5d3f866..cbe1d12fdaae659ee4b5ad10e390ea573a1da3bb 100644 (file)
 #include <linux/mtd/samsung_onenand.h>
 #include <onenand_uboot.h>
 
-void onenand_board_init(struct mtd_info *mtd)
+int onenand_board_init(struct mtd_info *mtd)
 {
        struct onenand_chip *this = mtd->priv;
 
        this->base = (void *)CONFIG_SYS_ONENAND_BASE;
        this->options |= ONENAND_RUNTIME_BADBLOCK_CHECK;
        this->chip_probe = s5pc110_chip_probe;
+
+       return 0;
 }
index 577c1a546f081a9749eaa07c99785b5e212a4ead..994d91d999f914330ee1e4d42929b9e3bb5c93ec 100644 (file)
@@ -16,7 +16,7 @@
 #include <asm/io.h>
 #include <asm/arch/clock.h>
 
-void onenand_board_init(struct mtd_info *mtd)
+int onenand_board_init(struct mtd_info *mtd)
 {
        struct onenand_chip *this = mtd->priv;
        struct s5pc100_clock *clk =
@@ -65,4 +65,6 @@ void onenand_board_init(struct mtd_info *mtd)
        writel(value, &onenand->int_err_mask);
 
        s3c_onenand_init(mtd);
+
+       return 0;
 }
index 28bc8114f4a4c6b5892d5ee06a98c505a731c4cc..147a95e2907a037ef427e1d52b3999fc2692ae88 100644 (file)
 #include <linux/mtd/onenand.h>
 #include <linux/mtd/samsung_onenand.h>
 
-void onenand_board_init(struct mtd_info *mtd)
+int onenand_board_init(struct mtd_info *mtd)
 {
        struct onenand_chip *this = mtd->priv;
 
        this->base = (void *)CONFIG_SYS_ONENAND_BASE;
        this->options |= ONENAND_RUNTIME_BADBLOCK_CHECK;
        this->chip_probe = s5pc210_chip_probe;
+
+       return 0;
 }
index ae60c3bb71dffd2203fb8fbca5d821aa12c8a60d..c15ec9df079eb124d15ce1321713816e4f1fb4c6 100644 (file)
@@ -24,33 +24,33 @@ static __attribute__((unused)) char dev_name[] = "onenand0";
 
 void onenand_init(void)
 {
+       int err = 0;
        memset(&onenand_mtd, 0, sizeof(struct mtd_info));
        memset(&onenand_chip, 0, sizeof(struct onenand_chip));
 
        onenand_mtd.priv = &onenand_chip;
 
 #ifdef CONFIG_USE_ONENAND_BOARD_INIT
-       /*
-        * It's used for some board init required
-        */
-       onenand_board_init(&onenand_mtd);
+       /* It's used for some board init required */
+       err = onenand_board_init(&onenand_mtd);
 #else
        onenand_chip.base = (void *) CONFIG_SYS_ONENAND_BASE;
 #endif
 
-       onenand_scan(&onenand_mtd, 1);
+       if (!err && !(onenand_scan(&onenand_mtd, 1))) {
 
-       if (onenand_chip.device_id & DEVICE_IS_FLEXONENAND)
-               puts("Flex-");
-       puts("OneNAND: ");
-       print_size(onenand_chip.chipsize, "\n");
+               if (onenand_chip.device_id & DEVICE_IS_FLEXONENAND)
+                       puts("Flex-");
+               puts("OneNAND: ");
 
 #ifdef CONFIG_MTD_DEVICE
-       /*
-        * Add MTD device so that we can reference it later
-        * via the mtdcore infrastructure (e.g. ubi).
-        */
-       onenand_mtd.name = dev_name;
-       add_mtd_device(&onenand_mtd);
+               /*
+                * Add MTD device so that we can reference it later
+                * via the mtdcore infrastructure (e.g. ubi).
+                */
+               onenand_mtd.name = dev_name;
+               add_mtd_device(&onenand_mtd);
 #endif
+       }
+       print_size(onenand_chip.chipsize, "\n");
 }
index d69e0d2d190d0bdf7f20c42ff0b001680c0c20e1..995f0aa6fecb4e6d696f13a4e2c3855f1966e3af 100644 (file)
@@ -26,7 +26,7 @@ extern struct mtd_info onenand_mtd;
 extern struct onenand_chip onenand_chip;
 
 /* board */
-extern void onenand_board_init(struct mtd_info *);
+extern int onenand_board_init(struct mtd_info *);
 
 /* Functions */
 extern void onenand_init(void);