]> git.sur5r.net Git - u-boot/blobdiff - drivers/mtd/nand/mxs_nand_spl.c
mtd: nand: mxs_nand_spl: refactor mxs_flash_ident
[u-boot] / drivers / mtd / nand / mxs_nand_spl.c
index a8a3084d033fff4f995b54154c7fa46d85c3763c..adb12c531ec118918057339f71cf856b3f207da7 100644 (file)
@@ -1,12 +1,12 @@
+// SPDX-License-Identifier: GPL-2.0+
 /*
  * Copyright (C) 2014 Gateworks Corporation
  * Author: Tim Harvey <tharvey@gateworks.com>
- *
- * SPDX-License-Identifier:    GPL-2.0+
  */
 #include <common.h>
 #include <nand.h>
 #include <malloc.h>
+#include "mxs_nand.h"
 
 static struct mtd_info *mtd;
 static struct nand_chip nand_chip;
@@ -49,7 +49,7 @@ static void mxs_nand_command(struct mtd_info *mtd, unsigned int command,
        }
 }
 
-static int mxs_flash_ident(struct mtd_info *mtd)
+static int mxs_flash_onfi_ident(struct mtd_info *mtd)
 {
        register struct nand_chip *chip = mtd_to_nand(mtd);
        int i;
@@ -109,6 +109,13 @@ static int mxs_flash_ident(struct mtd_info *mtd)
        return 0;
 }
 
+static int mxs_flash_ident(struct mtd_info *mtd)
+{
+       int ret;
+       ret = mxs_flash_onfi_ident(mtd);
+       return ret;
+}
+
 static int mxs_read_page_ecc(struct mtd_info *mtd, void *buf, unsigned int page)
 {
        register struct nand_chip *chip = mtd_to_nand(mtd);
@@ -146,14 +153,13 @@ static int mxs_nand_init(void)
                return 0;
 
        /* init mxs nand driver */
-       board_nand_init(&nand_chip);
-       mtd = &nand_chip.mtd;
+       mxs_nand_init_spl(&nand_chip);
+       mtd = nand_to_mtd(&nand_chip);
        /* set mtd functions */
        nand_chip.cmdfunc = mxs_nand_command;
        nand_chip.numchips = 1;
 
        /* identify flash device */
-       puts("NAND : ");
        if (mxs_flash_ident(mtd)) {
                printf("Failed to identify\n");
                return -1;
@@ -167,7 +173,6 @@ static int mxs_nand_init(void)
        mtd->size = nand_chip.chipsize;
        nand_chip.scan_bbt(mtd);
 
-       printf("%llu MiB\n", (mtd->size / (1024 * 1024)));
        return 0;
 }