aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMiquel Raynal <miquel.raynal@bootlin.com>2018-07-25 09:31:45 -0400
committerMiquel Raynal <miquel.raynal@bootlin.com>2018-07-31 03:46:11 -0400
commit2f2173449b0350a206faf0d1aa71595602a40c98 (patch)
treed10242293d4d566945ec9c88c18c0e3f325f6260
parentf57bbfb9e3f47b6d4eecb1d8037dab1cda9996a4 (diff)
mtd: rawnand: jz4740: group nand_scan_{ident, tail} calls
Prepare the migration to nand_scan() by moving both calls to nand_scan_ident() and nand_scan_tail() in a single spot. Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com> Reviewed-by: Boris Brezillon <boris.brezillon@bootlin.com>
-rw-r--r--drivers/mtd/nand/raw/jz4740_nand.c23
1 files changed, 11 insertions, 12 deletions
diff --git a/drivers/mtd/nand/raw/jz4740_nand.c b/drivers/mtd/nand/raw/jz4740_nand.c
index 3abf87420c10..ccd8f897db7c 100644
--- a/drivers/mtd/nand/raw/jz4740_nand.c
+++ b/drivers/mtd/nand/raw/jz4740_nand.c
@@ -309,6 +309,7 @@ static int jz_nand_detect_bank(struct platform_device *pdev,
309 size_t chipnr, uint8_t *nand_maf_id, 309 size_t chipnr, uint8_t *nand_maf_id,
310 uint8_t *nand_dev_id) 310 uint8_t *nand_dev_id)
311{ 311{
312 struct jz_nand_platform_data *pdata = dev_get_platdata(&pdev->dev);
312 int ret; 313 int ret;
313 char res_name[6]; 314 char res_name[6];
314 uint32_t ctrl; 315 uint32_t ctrl;
@@ -335,6 +336,16 @@ static int jz_nand_detect_bank(struct platform_device *pdev,
335 if (ret) 336 if (ret)
336 goto notfound_id; 337 goto notfound_id;
337 338
339 if (pdata && pdata->ident_callback)
340 pdata->ident_callback(pdev, mtd, &pdata->partitions,
341 &pdata->num_partitions);
342
343 ret = nand_scan_tail(mtd);
344 if (ret) {
345 dev_err(&pdev->dev, "Failed to scan NAND\n");
346 goto notfound_id;
347 }
348
338 /* Retrieve the IDs from the first chip. */ 349 /* Retrieve the IDs from the first chip. */
339 chip->select_chip(mtd, 0); 350 chip->select_chip(mtd, 0);
340 nand_reset_op(chip); 351 nand_reset_op(chip);
@@ -456,17 +467,6 @@ static int jz_nand_probe(struct platform_device *pdev)
456 goto err_iounmap_mmio; 467 goto err_iounmap_mmio;
457 } 468 }
458 469
459 if (pdata && pdata->ident_callback) {
460 pdata->ident_callback(pdev, mtd, &pdata->partitions,
461 &pdata->num_partitions);
462 }
463
464 ret = nand_scan_tail(mtd);
465 if (ret) {
466 dev_err(&pdev->dev, "Failed to scan NAND\n");
467 goto err_unclaim_banks;
468 }
469
470 ret = mtd_device_register(mtd, pdata ? pdata->partitions : NULL, 470 ret = mtd_device_register(mtd, pdata ? pdata->partitions : NULL,
471 pdata ? pdata->num_partitions : 0); 471 pdata ? pdata->num_partitions : 0);
472 472
@@ -481,7 +481,6 @@ static int jz_nand_probe(struct platform_device *pdev)
481 481
482err_cleanup_nand: 482err_cleanup_nand:
483 nand_cleanup(chip); 483 nand_cleanup(chip);
484err_unclaim_banks:
485 while (chipnr--) { 484 while (chipnr--) {
486 unsigned char bank = nand->banks[chipnr]; 485 unsigned char bank = nand->banks[chipnr];
487 jz_nand_iounmap_resource(nand->bank_mem[bank - 1], 486 jz_nand_iounmap_resource(nand->bank_mem[bank - 1],