aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd
diff options
context:
space:
mode:
authorPekon Gupta <pekon@ti.com>2013-10-24 08:50:20 -0400
committerBrian Norris <computersforpeace@gmail.com>2013-11-07 02:33:08 -0500
commitf18befb57b0779094ac7658fa7be5cf559da835f (patch)
treefe73befc203731491a2ad549ec8763483e9bb10c /drivers/mtd
parent633deb58e1ecc81486505fe9d3dc2aa3cfbca719 (diff)
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>
Diffstat (limited to 'drivers/mtd')
-rw-r--r--drivers/mtd/nand/omap2.c21
1 files changed, 9 insertions, 12 deletions
diff --git a/drivers/mtd/nand/omap2.c b/drivers/mtd/nand/omap2.c
index 5596368a3574..f464321c598d 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)
1856 mtd->name = dev_name(&pdev->dev); 1856 mtd->name = dev_name(&pdev->dev);
1857 mtd->owner = THIS_MODULE; 1857 mtd->owner = THIS_MODULE;
1858 nand_chip = &info->nand; 1858 nand_chip = &info->nand;
1859 nand_chip->options = pdata->devsize;
1860 nand_chip->options |= NAND_SKIP_BBTSCAN; 1859 nand_chip->options |= NAND_SKIP_BBTSCAN;
1861#ifdef CONFIG_MTD_NAND_OMAP_BCH 1860#ifdef CONFIG_MTD_NAND_OMAP_BCH
1862 info->of_node = pdata->of_node; 1861 info->of_node = pdata->of_node;
@@ -1904,6 +1903,15 @@ static int omap_nand_probe(struct platform_device *pdev)
1904 nand_chip->chip_delay = 50; 1903 nand_chip->chip_delay = 50;
1905 } 1904 }
1906 1905
1906 /* scan NAND device connected to chip controller */
1907 nand_chip->options |= pdata->devsize & NAND_BUSWIDTH_16;
1908 if (nand_scan_ident(mtd, 1, NULL)) {
1909 pr_err("nand device scan failed, may be bus-width mismatch\n");
1910 err = -ENXIO;
1911 goto out_release_mem_region;
1912 }
1913
1914 /* re-populate low-level callbacks based on xfer modes */
1907 switch (pdata->xfer_type) { 1915 switch (pdata->xfer_type) {
1908 case NAND_OMAP_PREFETCH_POLLED: 1916 case NAND_OMAP_PREFETCH_POLLED:
1909 nand_chip->read_buf = omap_read_buf_pref; 1917 nand_chip->read_buf = omap_read_buf_pref;
@@ -2011,17 +2019,6 @@ static int omap_nand_probe(struct platform_device *pdev)
2011 } 2019 }
2012 } 2020 }
2013 2021
2014 /* DIP switches on some boards change between 8 and 16 bit
2015 * bus widths for flash. Try the other width if the first try fails.
2016 */
2017 if (nand_scan_ident(mtd, 1, NULL)) {
2018 nand_chip->options ^= NAND_BUSWIDTH_16;
2019 if (nand_scan_ident(mtd, 1, NULL)) {
2020 err = -ENXIO;
2021 goto out_release_mem_region;
2022 }
2023 }
2024
2025 /* rom code layout */ 2022 /* rom code layout */
2026 if (pdata->ecc_opt == OMAP_ECC_HAM1_CODE_HW) { 2023 if (pdata->ecc_opt == OMAP_ECC_HAM1_CODE_HW) {
2027 2024