aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd/nand
diff options
context:
space:
mode:
authorDavid Woodhouse <David.Woodhouse@intel.com>2010-02-26 13:32:56 -0500
committerDavid Woodhouse <David.Woodhouse@intel.com>2010-02-26 13:32:56 -0500
commit5e81e88a4c140586d9212999cea683bcd66a15c6 (patch)
tree1d67825bb2cbcb3830fe4584bac04f6d9413d41a /drivers/mtd/nand
parent9fc51a37a8da84618df7584cad67c078317f6720 (diff)
mtd: nand: Allow caller to pass alternative ID table to nand_scan_ident()
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
Diffstat (limited to 'drivers/mtd/nand')
-rw-r--r--drivers/mtd/nand/atmel_nand.c2
-rw-r--r--drivers/mtd/nand/bcm_umi_nand.c2
-rw-r--r--drivers/mtd/nand/cafe_nand.c2
-rw-r--r--drivers/mtd/nand/davinci_nand.c2
-rw-r--r--drivers/mtd/nand/fsl_elbc_nand.c2
-rw-r--r--drivers/mtd/nand/mxc_nand.c2
-rw-r--r--drivers/mtd/nand/nand_base.c29
-rw-r--r--drivers/mtd/nand/s3c2410.c3
-rw-r--r--drivers/mtd/nand/sh_flctl.c2
-rw-r--r--drivers/mtd/nand/sm_common.c2
-rw-r--r--drivers/mtd/nand/socrates_nand.c2
-rw-r--r--drivers/mtd/nand/txx9ndfmc.c2
12 files changed, 27 insertions, 25 deletions
diff --git a/drivers/mtd/nand/atmel_nand.c b/drivers/mtd/nand/atmel_nand.c
index 524e6c9e0672..04d30887ca7f 100644
--- a/drivers/mtd/nand/atmel_nand.c
+++ b/drivers/mtd/nand/atmel_nand.c
@@ -474,7 +474,7 @@ static int __init atmel_nand_probe(struct platform_device *pdev)
474 } 474 }
475 475
476 /* first scan to find the device and get the page size */ 476 /* first scan to find the device and get the page size */
477 if (nand_scan_ident(mtd, 1)) { 477 if (nand_scan_ident(mtd, 1, NULL)) {
478 res = -ENXIO; 478 res = -ENXIO;
479 goto err_scan_ident; 479 goto err_scan_ident;
480 } 480 }
diff --git a/drivers/mtd/nand/bcm_umi_nand.c b/drivers/mtd/nand/bcm_umi_nand.c
index 087bcd745bb7..5ff90b7e565e 100644
--- a/drivers/mtd/nand/bcm_umi_nand.c
+++ b/drivers/mtd/nand/bcm_umi_nand.c
@@ -446,7 +446,7 @@ static int __devinit bcm_umi_nand_probe(struct platform_device *pdev)
446 * layout we'll be using. 446 * layout we'll be using.
447 */ 447 */
448 448
449 err = nand_scan_ident(board_mtd, 1); 449 err = nand_scan_ident(board_mtd, 1, NULL);
450 if (err) { 450 if (err) {
451 printk(KERN_ERR "nand_scan failed: %d\n", err); 451 printk(KERN_ERR "nand_scan failed: %d\n", err);
452 iounmap(bcm_umi_io_base); 452 iounmap(bcm_umi_io_base);
diff --git a/drivers/mtd/nand/cafe_nand.c b/drivers/mtd/nand/cafe_nand.c
index 67e2b33f7eff..01a6fe1c7805 100644
--- a/drivers/mtd/nand/cafe_nand.c
+++ b/drivers/mtd/nand/cafe_nand.c
@@ -761,7 +761,7 @@ static int __devinit cafe_nand_probe(struct pci_dev *pdev,
761 cafe_readl(cafe, GLOBAL_CTRL), cafe_readl(cafe, GLOBAL_IRQ_MASK)); 761 cafe_readl(cafe, GLOBAL_CTRL), cafe_readl(cafe, GLOBAL_IRQ_MASK));
762 762
763 /* Scan to find existence of the device */ 763 /* Scan to find existence of the device */
764 if (nand_scan_ident(mtd, 2)) { 764 if (nand_scan_ident(mtd, 2, NULL)) {
765 err = -ENXIO; 765 err = -ENXIO;
766 goto out_irq; 766 goto out_irq;
767 } 767 }
diff --git a/drivers/mtd/nand/davinci_nand.c b/drivers/mtd/nand/davinci_nand.c
index e2eeaf1e51a3..45bb931c0848 100644
--- a/drivers/mtd/nand/davinci_nand.c
+++ b/drivers/mtd/nand/davinci_nand.c
@@ -690,7 +690,7 @@ static int __init nand_davinci_probe(struct platform_device *pdev)
690 spin_unlock_irq(&davinci_nand_lock); 690 spin_unlock_irq(&davinci_nand_lock);
691 691
692 /* Scan to find existence of the device(s) */ 692 /* Scan to find existence of the device(s) */
693 ret = nand_scan_ident(&info->mtd, pdata->mask_chipsel ? 2 : 1); 693 ret = nand_scan_ident(&info->mtd, pdata->mask_chipsel ? 2 : 1, NULL);
694 if (ret < 0) { 694 if (ret < 0) {
695 dev_dbg(&pdev->dev, "no NAND chip(s) found\n"); 695 dev_dbg(&pdev->dev, "no NAND chip(s) found\n");
696 goto err_scan; 696 goto err_scan;
diff --git a/drivers/mtd/nand/fsl_elbc_nand.c b/drivers/mtd/nand/fsl_elbc_nand.c
index 1b8328fbb9dc..3f38fb8e6666 100644
--- a/drivers/mtd/nand/fsl_elbc_nand.c
+++ b/drivers/mtd/nand/fsl_elbc_nand.c
@@ -891,7 +891,7 @@ static int __devinit fsl_elbc_chip_probe(struct fsl_elbc_ctrl *ctrl,
891 if (ret) 891 if (ret)
892 goto err; 892 goto err;
893 893
894 ret = nand_scan_ident(&priv->mtd, 1); 894 ret = nand_scan_ident(&priv->mtd, 1, NULL);
895 if (ret) 895 if (ret)
896 goto err; 896 goto err;
897 897
diff --git a/drivers/mtd/nand/mxc_nand.c b/drivers/mtd/nand/mxc_nand.c
index 06cc378196b5..474a09e53131 100644
--- a/drivers/mtd/nand/mxc_nand.c
+++ b/drivers/mtd/nand/mxc_nand.c
@@ -819,7 +819,7 @@ static int __init mxcnd_probe(struct platform_device *pdev)
819 } 819 }
820 820
821 /* first scan to find the device and get the page size */ 821 /* first scan to find the device and get the page size */
822 if (nand_scan_ident(mtd, 1)) { 822 if (nand_scan_ident(mtd, 1, NULL)) {
823 err = -ENXIO; 823 err = -ENXIO;
824 goto escan; 824 goto escan;
825 } 825 }
diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c
index ba29a29bd743..1c4823696be2 100644
--- a/drivers/mtd/nand/nand_base.c
+++ b/drivers/mtd/nand/nand_base.c
@@ -2766,10 +2766,10 @@ static void nand_set_defaults(struct nand_chip *chip, int busw)
2766 */ 2766 */
2767static struct nand_flash_dev *nand_get_flash_type(struct mtd_info *mtd, 2767static struct nand_flash_dev *nand_get_flash_type(struct mtd_info *mtd,
2768 struct nand_chip *chip, 2768 struct nand_chip *chip,
2769 int busw, int *maf_id) 2769 int busw, int *maf_id,
2770 struct nand_flash_dev *type)
2770{ 2771{
2771 struct nand_flash_dev *type = NULL; 2772 int dev_id, maf_idx;
2772 int i, dev_id, maf_idx;
2773 int tmp_id, tmp_manf; 2773 int tmp_id, tmp_manf;
2774 2774
2775 /* Select the device */ 2775 /* Select the device */
@@ -2808,15 +2808,14 @@ static struct nand_flash_dev *nand_get_flash_type(struct mtd_info *mtd,
2808 return ERR_PTR(-ENODEV); 2808 return ERR_PTR(-ENODEV);
2809 } 2809 }
2810 2810
2811 /* Lookup the flash id */
2812 for (i = 0; nand_flash_ids[i].name != NULL; i++) {
2813 if (dev_id == nand_flash_ids[i].id) {
2814 type = &nand_flash_ids[i];
2815 break;
2816 }
2817 }
2818
2819 if (!type) 2811 if (!type)
2812 type = nand_flash_ids;
2813
2814 for (; type->name != NULL; type++)
2815 if (dev_id == type->id)
2816 break;
2817
2818 if (!type->name)
2820 return ERR_PTR(-ENODEV); 2819 return ERR_PTR(-ENODEV);
2821 2820
2822 if (!mtd->name) 2821 if (!mtd->name)
@@ -2926,13 +2925,15 @@ static struct nand_flash_dev *nand_get_flash_type(struct mtd_info *mtd,
2926 * nand_scan_ident - [NAND Interface] Scan for the NAND device 2925 * nand_scan_ident - [NAND Interface] Scan for the NAND device
2927 * @mtd: MTD device structure 2926 * @mtd: MTD device structure
2928 * @maxchips: Number of chips to scan for 2927 * @maxchips: Number of chips to scan for
2928 * @table: Alternative NAND ID table
2929 * 2929 *
2930 * This is the first phase of the normal nand_scan() function. It 2930 * This is the first phase of the normal nand_scan() function. It
2931 * reads the flash ID and sets up MTD fields accordingly. 2931 * reads the flash ID and sets up MTD fields accordingly.
2932 * 2932 *
2933 * The mtd->owner field must be set to the module of the caller. 2933 * The mtd->owner field must be set to the module of the caller.
2934 */ 2934 */
2935int nand_scan_ident(struct mtd_info *mtd, int maxchips) 2935int nand_scan_ident(struct mtd_info *mtd, int maxchips,
2936 struct nand_flash_dev *table)
2936{ 2937{
2937 int i, busw, nand_maf_id; 2938 int i, busw, nand_maf_id;
2938 struct nand_chip *chip = mtd->priv; 2939 struct nand_chip *chip = mtd->priv;
@@ -2944,7 +2945,7 @@ int nand_scan_ident(struct mtd_info *mtd, int maxchips)
2944 nand_set_defaults(chip, busw); 2945 nand_set_defaults(chip, busw);
2945 2946
2946 /* Read the flash type */ 2947 /* Read the flash type */
2947 type = nand_get_flash_type(mtd, chip, busw, &nand_maf_id); 2948 type = nand_get_flash_type(mtd, chip, busw, &nand_maf_id, table);
2948 2949
2949 if (IS_ERR(type)) { 2950 if (IS_ERR(type)) {
2950 if (!(chip->options & NAND_SCAN_SILENT_NODEV)) 2951 if (!(chip->options & NAND_SCAN_SILENT_NODEV))
@@ -3235,7 +3236,7 @@ int nand_scan(struct mtd_info *mtd, int maxchips)
3235 BUG(); 3236 BUG();
3236 } 3237 }
3237 3238
3238 ret = nand_scan_ident(mtd, maxchips); 3239 ret = nand_scan_ident(mtd, maxchips, NULL);
3239 if (!ret) 3240 if (!ret)
3240 ret = nand_scan_tail(mtd); 3241 ret = nand_scan_tail(mtd);
3241 return ret; 3242 return ret;
diff --git a/drivers/mtd/nand/s3c2410.c b/drivers/mtd/nand/s3c2410.c
index c41ad2285c63..dc02dcd0c08f 100644
--- a/drivers/mtd/nand/s3c2410.c
+++ b/drivers/mtd/nand/s3c2410.c
@@ -1013,7 +1013,8 @@ static int s3c24xx_nand_probe(struct platform_device *pdev)
1013 s3c2410_nand_init_chip(info, nmtd, sets); 1013 s3c2410_nand_init_chip(info, nmtd, sets);
1014 1014
1015 nmtd->scan_res = nand_scan_ident(&nmtd->mtd, 1015 nmtd->scan_res = nand_scan_ident(&nmtd->mtd,
1016 (sets) ? sets->nr_chips : 1); 1016 (sets) ? sets->nr_chips : 1,
1017 NULL);
1017 1018
1018 if (nmtd->scan_res == 0) { 1019 if (nmtd->scan_res == 0) {
1019 s3c2410_nand_update_chip(info, nmtd); 1020 s3c2410_nand_update_chip(info, nmtd);
diff --git a/drivers/mtd/nand/sh_flctl.c b/drivers/mtd/nand/sh_flctl.c
index 4260ab78f95c..dbc09a81866e 100644
--- a/drivers/mtd/nand/sh_flctl.c
+++ b/drivers/mtd/nand/sh_flctl.c
@@ -825,7 +825,7 @@ static int __init flctl_probe(struct platform_device *pdev)
825 nand->select_chip = flctl_select_chip; 825 nand->select_chip = flctl_select_chip;
826 nand->cmdfunc = flctl_cmdfunc; 826 nand->cmdfunc = flctl_cmdfunc;
827 827
828 ret = nand_scan_ident(flctl_mtd, 1); 828 ret = nand_scan_ident(flctl_mtd, 1, NULL);
829 if (ret) 829 if (ret)
830 goto err; 830 goto err;
831 831
diff --git a/drivers/mtd/nand/sm_common.c b/drivers/mtd/nand/sm_common.c
index 07b6f725723f..f52bb3949275 100644
--- a/drivers/mtd/nand/sm_common.c
+++ b/drivers/mtd/nand/sm_common.c
@@ -75,7 +75,7 @@ int sm_register_device(struct mtd_info *mtd)
75 chip->options |= NAND_SKIP_BBTSCAN | NAND_SMARTMEDIA; 75 chip->options |= NAND_SKIP_BBTSCAN | NAND_SMARTMEDIA;
76 76
77 /* Scan for card properties */ 77 /* Scan for card properties */
78 ret = nand_scan_ident(mtd, 1); 78 ret = nand_scan_ident(mtd, 1, NULL);
79 79
80 if (ret) 80 if (ret)
81 return ret; 81 return ret;
diff --git a/drivers/mtd/nand/socrates_nand.c b/drivers/mtd/nand/socrates_nand.c
index 65748ea2b348..b37cbde6e7db 100644
--- a/drivers/mtd/nand/socrates_nand.c
+++ b/drivers/mtd/nand/socrates_nand.c
@@ -220,7 +220,7 @@ static int __devinit socrates_nand_probe(struct of_device *ofdev,
220 dev_set_drvdata(&ofdev->dev, host); 220 dev_set_drvdata(&ofdev->dev, host);
221 221
222 /* first scan to find the device and get the page size */ 222 /* first scan to find the device and get the page size */
223 if (nand_scan_ident(mtd, 1)) { 223 if (nand_scan_ident(mtd, 1, NULL)) {
224 res = -ENXIO; 224 res = -ENXIO;
225 goto out; 225 goto out;
226 } 226 }
diff --git a/drivers/mtd/nand/txx9ndfmc.c b/drivers/mtd/nand/txx9ndfmc.c
index 863513c3b69a..054a41c0ef4a 100644
--- a/drivers/mtd/nand/txx9ndfmc.c
+++ b/drivers/mtd/nand/txx9ndfmc.c
@@ -274,7 +274,7 @@ static int txx9ndfmc_nand_scan(struct mtd_info *mtd)
274 struct nand_chip *chip = mtd->priv; 274 struct nand_chip *chip = mtd->priv;
275 int ret; 275 int ret;
276 276
277 ret = nand_scan_ident(mtd, 1); 277 ret = nand_scan_ident(mtd, 1, NULL);
278 if (!ret) { 278 if (!ret) {
279 if (mtd->writesize >= 512) { 279 if (mtd->writesize >= 512) {
280 chip->ecc.size = mtd->writesize; 280 chip->ecc.size = mtd->writesize;