summaryrefslogtreecommitdiff
path: root/drivers/mtd/nand/raw/mxs_nand_spl.c
diff options
context:
space:
mode:
authorTom Rini <trini@konsulko.com>2019-03-13 16:07:41 -0400
committerTom Rini <trini@konsulko.com>2019-03-13 16:07:41 -0400
commita0d12cd2392af52000790739df3fc8ddbd4db460 (patch)
tree75730552278c8ed9dde126cf4141d244ce29b991 /drivers/mtd/nand/raw/mxs_nand_spl.c
parent116a3a1ae085753e04b62c37a0f11f80cab9d730 (diff)
parentb882005a18dec45848e153dcf8d29b4a2feecf14 (diff)
Merge tag 'u-boot-imx-20190313' of git://git.denx.de/u-boot-imx
Small fixes in several i.MX boards ---------------------------------- - imx8: add pinctrl driveri (mx8m), fix documentation and fix reported CPU frequency. Fabio is co-maintainer - pico-imx6ul: switch to DM - local fixes for ventana, mx6ul_14x14_evk, engicam, imx6(q)_logic, liteboard
Diffstat (limited to 'drivers/mtd/nand/raw/mxs_nand_spl.c')
-rw-r--r--drivers/mtd/nand/raw/mxs_nand_spl.c17
1 files changed, 6 insertions, 11 deletions
diff --git a/drivers/mtd/nand/raw/mxs_nand_spl.c b/drivers/mtd/nand/raw/mxs_nand_spl.c
index ba85baac60..ee7d9cb957 100644
--- a/drivers/mtd/nand/raw/mxs_nand_spl.c
+++ b/drivers/mtd/nand/raw/mxs_nand_spl.c
@@ -174,11 +174,11 @@ static int is_badblock(struct mtd_info *mtd, loff_t offs, int allowbbt)
}
/* setup mtd and nand structs and init mxs_nand driver */
-static int mxs_nand_init(void)
+void nand_init(void)
{
/* return if already initalized */
if (nand_chip.numchips)
- return 0;
+ return;
/* init mxs nand driver */
mxs_nand_init_spl(&nand_chip);
@@ -191,7 +191,8 @@ static int mxs_nand_init(void)
/* identify flash device */
if (mxs_flash_ident(mtd)) {
printf("Failed to identify\n");
- return -1;
+ nand_chip.numchips = 0; /* If fail, don't use nand */
+ return;
}
/* allocate and initialize buffers */
@@ -202,8 +203,6 @@ static int mxs_nand_init(void)
mtd->size = nand_chip.chipsize;
nand_chip.scan_bbt(mtd);
mxs_nand_setup_ecc(mtd);
-
- return 0;
}
int nand_spl_load_image(uint32_t offs, unsigned int size, void *buf)
@@ -213,9 +212,9 @@ int nand_spl_load_image(uint32_t offs, unsigned int size, void *buf)
unsigned int nand_page_per_block;
unsigned int sz = 0;
- if (mxs_nand_init())
- return -ENODEV;
chip = mtd_to_nand(mtd);
+ if (!chip->numchips)
+ return -ENODEV;
page = offs >> chip->page_shift;
nand_page_per_block = mtd->erasesize / mtd->writesize;
@@ -256,10 +255,6 @@ int nand_default_bbt(struct mtd_info *mtd)
return 0;
}
-void nand_init(void)
-{
-}
-
void nand_deselect(void)
{
}