diff options
-rw-r--r-- | arch/arm/mach-pxa/include/mach/pxa3xx_nand.h | 3 | ||||
-rw-r--r-- | drivers/mtd/nand/pxa3xx_nand.c | 18 |
2 files changed, 19 insertions, 2 deletions
diff --git a/arch/arm/mach-pxa/include/mach/pxa3xx_nand.h b/arch/arm/mach-pxa/include/mach/pxa3xx_nand.h index 0dc50d82ea73..6ac9aea0b0b5 100644 --- a/arch/arm/mach-pxa/include/mach/pxa3xx_nand.h +++ b/arch/arm/mach-pxa/include/mach/pxa3xx_nand.h | |||
@@ -58,6 +58,9 @@ struct pxa3xx_nand_platform_data { | |||
58 | 58 | ||
59 | struct mtd_partition *parts; | 59 | struct mtd_partition *parts; |
60 | unsigned int nr_parts; | 60 | unsigned int nr_parts; |
61 | |||
62 | struct pxa3xx_nand_flash * const flash; | ||
63 | size_t num_flash; | ||
61 | }; | 64 | }; |
62 | 65 | ||
63 | extern void pxa3xx_set_nand_info(struct pxa3xx_nand_platform_data *info); | 66 | extern void pxa3xx_set_nand_info(struct pxa3xx_nand_platform_data *info); |
diff --git a/drivers/mtd/nand/pxa3xx_nand.c b/drivers/mtd/nand/pxa3xx_nand.c index 203e8efefb30..1906aba7e73c 100644 --- a/drivers/mtd/nand/pxa3xx_nand.c +++ b/drivers/mtd/nand/pxa3xx_nand.c | |||
@@ -911,12 +911,26 @@ static int pxa3xx_nand_config_flash(struct pxa3xx_nand_info *info, | |||
911 | return 0; | 911 | return 0; |
912 | } | 912 | } |
913 | 913 | ||
914 | static int pxa3xx_nand_detect_flash(struct pxa3xx_nand_info *info) | 914 | static int pxa3xx_nand_detect_flash(struct pxa3xx_nand_info *info, |
915 | const struct pxa3xx_nand_platform_data *pdata) | ||
915 | { | 916 | { |
916 | struct pxa3xx_nand_flash *f; | 917 | struct pxa3xx_nand_flash *f; |
917 | uint32_t id; | 918 | uint32_t id; |
918 | int i; | 919 | int i; |
919 | 920 | ||
921 | for (i = 0; i<pdata->num_flash; ++i) { | ||
922 | f = pdata->flash + i; | ||
923 | |||
924 | if (pxa3xx_nand_config_flash(info, f)) | ||
925 | continue; | ||
926 | |||
927 | if (__readid(info, &id)) | ||
928 | continue; | ||
929 | |||
930 | if (id == f->chip_id) | ||
931 | return 0; | ||
932 | } | ||
933 | |||
920 | for (i = 0; i < ARRAY_SIZE(builtin_flash_types); i++) { | 934 | for (i = 0; i < ARRAY_SIZE(builtin_flash_types); i++) { |
921 | 935 | ||
922 | f = builtin_flash_types[i]; | 936 | f = builtin_flash_types[i]; |
@@ -1114,7 +1128,7 @@ static int pxa3xx_nand_probe(struct platform_device *pdev) | |||
1114 | goto fail_free_buf; | 1128 | goto fail_free_buf; |
1115 | } | 1129 | } |
1116 | 1130 | ||
1117 | ret = pxa3xx_nand_detect_flash(info); | 1131 | ret = pxa3xx_nand_detect_flash(info, pdata); |
1118 | if (ret) { | 1132 | if (ret) { |
1119 | dev_err(&pdev->dev, "failed to detect flash\n"); | 1133 | dev_err(&pdev->dev, "failed to detect flash\n"); |
1120 | ret = -ENODEV; | 1134 | ret = -ENODEV; |