diff options
Diffstat (limited to 'drivers/mtd/nand/omap2.c')
-rw-r--r-- | drivers/mtd/nand/omap2.c | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/drivers/mtd/nand/omap2.c b/drivers/mtd/nand/omap2.c index da9a351c9d79..0db2c0e7656a 100644 --- a/drivers/mtd/nand/omap2.c +++ b/drivers/mtd/nand/omap2.c | |||
@@ -94,9 +94,7 @@ | |||
94 | #define P4e_s(a) (TF(a & NAND_Ecc_P4e) << 0) | 94 | #define P4e_s(a) (TF(a & NAND_Ecc_P4e) << 0) |
95 | #define P4o_s(a) (TF(a & NAND_Ecc_P4o) << 1) | 95 | #define P4o_s(a) (TF(a & NAND_Ecc_P4o) << 1) |
96 | 96 | ||
97 | #ifdef CONFIG_MTD_PARTITIONS | ||
98 | static const char *part_probes[] = { "cmdlinepart", NULL }; | 97 | static const char *part_probes[] = { "cmdlinepart", NULL }; |
99 | #endif | ||
100 | 98 | ||
101 | /* oob info generated runtime depending on ecc algorithm and layout selected */ | 99 | /* oob info generated runtime depending on ecc algorithm and layout selected */ |
102 | static struct nand_ecclayout omap_oobinfo; | 100 | static struct nand_ecclayout omap_oobinfo; |
@@ -263,11 +261,10 @@ static void omap_read_buf_pref(struct mtd_info *mtd, u_char *buf, int len) | |||
263 | if (ret) { | 261 | if (ret) { |
264 | /* PFPW engine is busy, use cpu copy method */ | 262 | /* PFPW engine is busy, use cpu copy method */ |
265 | if (info->nand.options & NAND_BUSWIDTH_16) | 263 | if (info->nand.options & NAND_BUSWIDTH_16) |
266 | omap_read_buf16(mtd, buf, len); | 264 | omap_read_buf16(mtd, (u_char *)p, len); |
267 | else | 265 | else |
268 | omap_read_buf8(mtd, buf, len); | 266 | omap_read_buf8(mtd, (u_char *)p, len); |
269 | } else { | 267 | } else { |
270 | p = (u32 *) buf; | ||
271 | do { | 268 | do { |
272 | r_count = gpmc_read_status(GPMC_PREFETCH_FIFO_CNT); | 269 | r_count = gpmc_read_status(GPMC_PREFETCH_FIFO_CNT); |
273 | r_count = r_count >> 2; | 270 | r_count = r_count >> 2; |
@@ -293,7 +290,7 @@ static void omap_write_buf_pref(struct mtd_info *mtd, | |||
293 | struct omap_nand_info, mtd); | 290 | struct omap_nand_info, mtd); |
294 | uint32_t w_count = 0; | 291 | uint32_t w_count = 0; |
295 | int i = 0, ret = 0; | 292 | int i = 0, ret = 0; |
296 | u16 *p; | 293 | u16 *p = (u16 *)buf; |
297 | unsigned long tim, limit; | 294 | unsigned long tim, limit; |
298 | 295 | ||
299 | /* take care of subpage writes */ | 296 | /* take care of subpage writes */ |
@@ -309,11 +306,10 @@ static void omap_write_buf_pref(struct mtd_info *mtd, | |||
309 | if (ret) { | 306 | if (ret) { |
310 | /* PFPW engine is busy, use cpu copy method */ | 307 | /* PFPW engine is busy, use cpu copy method */ |
311 | if (info->nand.options & NAND_BUSWIDTH_16) | 308 | if (info->nand.options & NAND_BUSWIDTH_16) |
312 | omap_write_buf16(mtd, buf, len); | 309 | omap_write_buf16(mtd, (u_char *)p, len); |
313 | else | 310 | else |
314 | omap_write_buf8(mtd, buf, len); | 311 | omap_write_buf8(mtd, (u_char *)p, len); |
315 | } else { | 312 | } else { |
316 | p = (u16 *) buf; | ||
317 | while (len) { | 313 | while (len) { |
318 | w_count = gpmc_read_status(GPMC_PREFETCH_FIFO_CNT); | 314 | w_count = gpmc_read_status(GPMC_PREFETCH_FIFO_CNT); |
319 | w_count = w_count >> 1; | 315 | w_count = w_count >> 1; |
@@ -1073,9 +1069,9 @@ static int __devinit omap_nand_probe(struct platform_device *pdev) | |||
1073 | /* DIP switches on some boards change between 8 and 16 bit | 1069 | /* DIP switches on some boards change between 8 and 16 bit |
1074 | * bus widths for flash. Try the other width if the first try fails. | 1070 | * bus widths for flash. Try the other width if the first try fails. |
1075 | */ | 1071 | */ |
1076 | if (nand_scan(&info->mtd, 1)) { | 1072 | if (nand_scan_ident(&info->mtd, 1, NULL)) { |
1077 | info->nand.options ^= NAND_BUSWIDTH_16; | 1073 | info->nand.options ^= NAND_BUSWIDTH_16; |
1078 | if (nand_scan(&info->mtd, 1)) { | 1074 | if (nand_scan_ident(&info->mtd, 1, NULL)) { |
1079 | err = -ENXIO; | 1075 | err = -ENXIO; |
1080 | goto out_release_mem_region; | 1076 | goto out_release_mem_region; |
1081 | } | 1077 | } |
@@ -1101,15 +1097,19 @@ static int __devinit omap_nand_probe(struct platform_device *pdev) | |||
1101 | info->nand.ecc.layout = &omap_oobinfo; | 1097 | info->nand.ecc.layout = &omap_oobinfo; |
1102 | } | 1098 | } |
1103 | 1099 | ||
1104 | #ifdef CONFIG_MTD_PARTITIONS | 1100 | /* second phase scan */ |
1101 | if (nand_scan_tail(&info->mtd)) { | ||
1102 | err = -ENXIO; | ||
1103 | goto out_release_mem_region; | ||
1104 | } | ||
1105 | |||
1105 | err = parse_mtd_partitions(&info->mtd, part_probes, &info->parts, 0); | 1106 | err = parse_mtd_partitions(&info->mtd, part_probes, &info->parts, 0); |
1106 | if (err > 0) | 1107 | if (err > 0) |
1107 | add_mtd_partitions(&info->mtd, info->parts, err); | 1108 | mtd_device_register(&info->mtd, info->parts, err); |
1108 | else if (pdata->parts) | 1109 | else if (pdata->parts) |
1109 | add_mtd_partitions(&info->mtd, pdata->parts, pdata->nr_parts); | 1110 | mtd_device_register(&info->mtd, pdata->parts, pdata->nr_parts); |
1110 | else | 1111 | else |
1111 | #endif | 1112 | mtd_device_register(&info->mtd, NULL, 0); |
1112 | add_mtd_device(&info->mtd); | ||
1113 | 1113 | ||
1114 | platform_set_drvdata(pdev, &info->mtd); | 1114 | platform_set_drvdata(pdev, &info->mtd); |
1115 | 1115 | ||