diff options
| author | Pekon Gupta <pekon@ti.com> | 2013-10-24 18:20:20 +0530 | 
|---|---|---|
| committer | Evan Wilson <evan@oliodevices.com> | 2014-11-29 14:49:12 -0800 | 
| commit | be93f72eb0e3a62bf11b8984ed197dab5232ac19 (patch) | |
| tree | cb5717c9e5ced54d534be0305deaa012c8e6cff9 | |
| parent | cb7d5bbf703bab6bf197592cb89d9d64f29085cc (diff) | |
| download | olio-linux-3.10-be93f72eb0e3a62bf11b8984ed197dab5232ac19.tar.xz olio-linux-3.10-be93f72eb0e3a62bf11b8984ed197dab5232ac19.zip | |
mtd: nand: omap: use DT specified bus-width only for scanning NAND device
This patch:
- calls nand_scan_ident() using bus-width as passed by DT
- removes double calls to nand_scan_ident(), in case first call fails
  then omap_nand_probe just returns error.
Signed-off-by: Pekon Gupta <pekon@ti.com>
Tested-by: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
| -rw-r--r-- | drivers/mtd/nand/omap2.c | 21 | 
1 files changed, 9 insertions, 12 deletions
| diff --git a/drivers/mtd/nand/omap2.c b/drivers/mtd/nand/omap2.c index 5596368a357..f464321c598 100644 --- a/drivers/mtd/nand/omap2.c +++ b/drivers/mtd/nand/omap2.c @@ -1856,7 +1856,6 @@ static int omap_nand_probe(struct platform_device *pdev)  	mtd->name		= dev_name(&pdev->dev);  	mtd->owner		= THIS_MODULE;  	nand_chip		= &info->nand; -	nand_chip->options	= pdata->devsize;  	nand_chip->options	|= NAND_SKIP_BBTSCAN;  #ifdef CONFIG_MTD_NAND_OMAP_BCH  	info->of_node		= pdata->of_node; @@ -1904,6 +1903,15 @@ static int omap_nand_probe(struct platform_device *pdev)  		nand_chip->chip_delay = 50;  	} +	/* scan NAND device connected to chip controller */ +	nand_chip->options |= pdata->devsize & NAND_BUSWIDTH_16; +	if (nand_scan_ident(mtd, 1, NULL)) { +		pr_err("nand device scan failed, may be bus-width mismatch\n"); +		err = -ENXIO; +		goto out_release_mem_region; +	} + +	/* re-populate low-level callbacks based on xfer modes */  	switch (pdata->xfer_type) {  	case NAND_OMAP_PREFETCH_POLLED:  		nand_chip->read_buf   = omap_read_buf_pref; @@ -2011,17 +2019,6 @@ static int omap_nand_probe(struct platform_device *pdev)  		}  	} -	/* DIP switches on some boards change between 8 and 16 bit -	 * bus widths for flash.  Try the other width if the first try fails. -	 */ -	if (nand_scan_ident(mtd, 1, NULL)) { -		nand_chip->options ^= NAND_BUSWIDTH_16; -		if (nand_scan_ident(mtd, 1, NULL)) { -			err = -ENXIO; -			goto out_release_mem_region; -		} -	} -  	/* rom code layout */  	if (pdata->ecc_opt == OMAP_ECC_HAM1_CODE_HW) { |