diff options
Diffstat (limited to 'drivers/mtd')
-rw-r--r-- | drivers/mtd/maps/omap_nor.c | 2 | ||||
-rw-r--r-- | drivers/mtd/mtd_blkdevs.c | 2 | ||||
-rw-r--r-- | drivers/mtd/nand/Kconfig | 2 | ||||
-rw-r--r-- | drivers/mtd/nand/ams-delta.c | 2 | ||||
-rw-r--r-- | drivers/mtd/nand/omap2.c | 6 | ||||
-rw-r--r-- | drivers/mtd/nand/pxa3xx_nand.c | 82 | ||||
-rw-r--r-- | drivers/mtd/onenand/omap2.c | 8 |
7 files changed, 80 insertions, 24 deletions
diff --git a/drivers/mtd/maps/omap_nor.c b/drivers/mtd/maps/omap_nor.c index a24478102b11..ead0b2fab670 100644 --- a/drivers/mtd/maps/omap_nor.c +++ b/drivers/mtd/maps/omap_nor.c | |||
@@ -45,7 +45,7 @@ | |||
45 | #include <asm/io.h> | 45 | #include <asm/io.h> |
46 | #include <mach/hardware.h> | 46 | #include <mach/hardware.h> |
47 | #include <asm/mach/flash.h> | 47 | #include <asm/mach/flash.h> |
48 | #include <mach/tc.h> | 48 | #include <plat/tc.h> |
49 | 49 | ||
50 | #ifdef CONFIG_MTD_PARTITIONS | 50 | #ifdef CONFIG_MTD_PARTITIONS |
51 | static const char *part_probes[] = { /* "RedBoot", */ "cmdlinepart", NULL }; | 51 | static const char *part_probes[] = { /* "RedBoot", */ "cmdlinepart", NULL }; |
diff --git a/drivers/mtd/mtd_blkdevs.c b/drivers/mtd/mtd_blkdevs.c index 8ca17a3e96ea..64e2b379a350 100644 --- a/drivers/mtd/mtd_blkdevs.c +++ b/drivers/mtd/mtd_blkdevs.c | |||
@@ -59,12 +59,14 @@ static int do_blktrans_request(struct mtd_blktrans_ops *tr, | |||
59 | for (; nsect > 0; nsect--, block++, buf += tr->blksize) | 59 | for (; nsect > 0; nsect--, block++, buf += tr->blksize) |
60 | if (tr->readsect(dev, block, buf)) | 60 | if (tr->readsect(dev, block, buf)) |
61 | return -EIO; | 61 | return -EIO; |
62 | rq_flush_dcache_pages(req); | ||
62 | return 0; | 63 | return 0; |
63 | 64 | ||
64 | case WRITE: | 65 | case WRITE: |
65 | if (!tr->writesect) | 66 | if (!tr->writesect) |
66 | return -EIO; | 67 | return -EIO; |
67 | 68 | ||
69 | rq_flush_dcache_pages(req); | ||
68 | for (; nsect > 0; nsect--, block++, buf += tr->blksize) | 70 | for (; nsect > 0; nsect--, block++, buf += tr->blksize) |
69 | if (tr->writesect(dev, block, buf)) | 71 | if (tr->writesect(dev, block, buf)) |
70 | return -EIO; | 72 | return -EIO; |
diff --git a/drivers/mtd/nand/Kconfig b/drivers/mtd/nand/Kconfig index 6264bf14494c..0e35e1aefd22 100644 --- a/drivers/mtd/nand/Kconfig +++ b/drivers/mtd/nand/Kconfig | |||
@@ -356,7 +356,7 @@ endchoice | |||
356 | 356 | ||
357 | config MTD_NAND_PXA3xx | 357 | config MTD_NAND_PXA3xx |
358 | tristate "Support for NAND flash devices on PXA3xx" | 358 | tristate "Support for NAND flash devices on PXA3xx" |
359 | depends on MTD_NAND && PXA3xx | 359 | depends on MTD_NAND && (PXA3xx || ARCH_MMP) |
360 | help | 360 | help |
361 | This enables the driver for the NAND flash device found on | 361 | This enables the driver for the NAND flash device found on |
362 | PXA3xx processors | 362 | PXA3xx processors |
diff --git a/drivers/mtd/nand/ams-delta.c b/drivers/mtd/nand/ams-delta.c index 005b91f096f2..2548e1065bf8 100644 --- a/drivers/mtd/nand/ams-delta.c +++ b/drivers/mtd/nand/ams-delta.c | |||
@@ -25,7 +25,7 @@ | |||
25 | #include <mach/hardware.h> | 25 | #include <mach/hardware.h> |
26 | #include <asm/sizes.h> | 26 | #include <asm/sizes.h> |
27 | #include <mach/gpio.h> | 27 | #include <mach/gpio.h> |
28 | #include <mach/board-ams-delta.h> | 28 | #include <plat/board-ams-delta.h> |
29 | 29 | ||
30 | /* | 30 | /* |
31 | * MTD structure for E3 (Delta) | 31 | * MTD structure for E3 (Delta) |
diff --git a/drivers/mtd/nand/omap2.c b/drivers/mtd/nand/omap2.c index 090ab87086b5..1bb799f0125c 100644 --- a/drivers/mtd/nand/omap2.c +++ b/drivers/mtd/nand/omap2.c | |||
@@ -18,9 +18,9 @@ | |||
18 | #include <linux/mtd/partitions.h> | 18 | #include <linux/mtd/partitions.h> |
19 | #include <linux/io.h> | 19 | #include <linux/io.h> |
20 | 20 | ||
21 | #include <mach/dma.h> | 21 | #include <plat/dma.h> |
22 | #include <mach/gpmc.h> | 22 | #include <plat/gpmc.h> |
23 | #include <mach/nand.h> | 23 | #include <plat/nand.h> |
24 | 24 | ||
25 | #define GPMC_IRQ_STATUS 0x18 | 25 | #define GPMC_IRQ_STATUS 0x18 |
26 | #define GPMC_ECC_CONFIG 0x1F4 | 26 | #define GPMC_ECC_CONFIG 0x1F4 |
diff --git a/drivers/mtd/nand/pxa3xx_nand.c b/drivers/mtd/nand/pxa3xx_nand.c index 6ea520ae2410..1a5a0365c983 100644 --- a/drivers/mtd/nand/pxa3xx_nand.c +++ b/drivers/mtd/nand/pxa3xx_nand.c | |||
@@ -9,6 +9,7 @@ | |||
9 | * published by the Free Software Foundation. | 9 | * published by the Free Software Foundation. |
10 | */ | 10 | */ |
11 | 11 | ||
12 | #include <linux/kernel.h> | ||
12 | #include <linux/module.h> | 13 | #include <linux/module.h> |
13 | #include <linux/interrupt.h> | 14 | #include <linux/interrupt.h> |
14 | #include <linux/platform_device.h> | 15 | #include <linux/platform_device.h> |
@@ -22,7 +23,7 @@ | |||
22 | #include <linux/irq.h> | 23 | #include <linux/irq.h> |
23 | 24 | ||
24 | #include <mach/dma.h> | 25 | #include <mach/dma.h> |
25 | #include <mach/pxa3xx_nand.h> | 26 | #include <plat/pxa3xx_nand.h> |
26 | 27 | ||
27 | #define CHIP_DELAY_TIMEOUT (2 * HZ/10) | 28 | #define CHIP_DELAY_TIMEOUT (2 * HZ/10) |
28 | 29 | ||
@@ -84,10 +85,6 @@ | |||
84 | #define NDCB0_CMD1_MASK (0xff) | 85 | #define NDCB0_CMD1_MASK (0xff) |
85 | #define NDCB0_ADDR_CYC_SHIFT (16) | 86 | #define NDCB0_ADDR_CYC_SHIFT (16) |
86 | 87 | ||
87 | /* dma-able I/O address for the NAND data and commands */ | ||
88 | #define NDCB0_DMA_ADDR (0x43100048) | ||
89 | #define NDDB_DMA_ADDR (0x43100040) | ||
90 | |||
91 | /* macros for registers read/write */ | 88 | /* macros for registers read/write */ |
92 | #define nand_writel(info, off, val) \ | 89 | #define nand_writel(info, off, val) \ |
93 | __raw_writel((val), (info)->mmio_base + (off)) | 90 | __raw_writel((val), (info)->mmio_base + (off)) |
@@ -123,6 +120,7 @@ struct pxa3xx_nand_info { | |||
123 | 120 | ||
124 | struct clk *clk; | 121 | struct clk *clk; |
125 | void __iomem *mmio_base; | 122 | void __iomem *mmio_base; |
123 | unsigned long mmio_phys; | ||
126 | 124 | ||
127 | unsigned int buf_start; | 125 | unsigned int buf_start; |
128 | unsigned int buf_count; | 126 | unsigned int buf_count; |
@@ -228,13 +226,35 @@ static struct pxa3xx_nand_flash samsung512MbX16 = { | |||
228 | .chip_id = 0x46ec, | 226 | .chip_id = 0x46ec, |
229 | }; | 227 | }; |
230 | 228 | ||
229 | static struct pxa3xx_nand_flash samsung2GbX8 = { | ||
230 | .timing = &samsung512MbX16_timing, | ||
231 | .cmdset = &smallpage_cmdset, | ||
232 | .page_per_block = 64, | ||
233 | .page_size = 2048, | ||
234 | .flash_width = 8, | ||
235 | .dfc_width = 8, | ||
236 | .num_blocks = 2048, | ||
237 | .chip_id = 0xdaec, | ||
238 | }; | ||
239 | |||
240 | static struct pxa3xx_nand_flash samsung32GbX8 = { | ||
241 | .timing = &samsung512MbX16_timing, | ||
242 | .cmdset = &smallpage_cmdset, | ||
243 | .page_per_block = 128, | ||
244 | .page_size = 4096, | ||
245 | .flash_width = 8, | ||
246 | .dfc_width = 8, | ||
247 | .num_blocks = 8192, | ||
248 | .chip_id = 0xd7ec, | ||
249 | }; | ||
250 | |||
231 | static struct pxa3xx_nand_timing micron_timing = { | 251 | static struct pxa3xx_nand_timing micron_timing = { |
232 | .tCH = 10, | 252 | .tCH = 10, |
233 | .tCS = 25, | 253 | .tCS = 25, |
234 | .tWH = 15, | 254 | .tWH = 15, |
235 | .tWP = 25, | 255 | .tWP = 25, |
236 | .tRH = 15, | 256 | .tRH = 15, |
237 | .tRP = 25, | 257 | .tRP = 30, |
238 | .tR = 25000, | 258 | .tR = 25000, |
239 | .tWHR = 60, | 259 | .tWHR = 60, |
240 | .tAR = 10, | 260 | .tAR = 10, |
@@ -262,6 +282,28 @@ static struct pxa3xx_nand_flash micron1GbX16 = { | |||
262 | .chip_id = 0xb12c, | 282 | .chip_id = 0xb12c, |
263 | }; | 283 | }; |
264 | 284 | ||
285 | static struct pxa3xx_nand_flash micron4GbX8 = { | ||
286 | .timing = µn_timing, | ||
287 | .cmdset = &largepage_cmdset, | ||
288 | .page_per_block = 64, | ||
289 | .page_size = 2048, | ||
290 | .flash_width = 8, | ||
291 | .dfc_width = 8, | ||
292 | .num_blocks = 4096, | ||
293 | .chip_id = 0xdc2c, | ||
294 | }; | ||
295 | |||
296 | static struct pxa3xx_nand_flash micron4GbX16 = { | ||
297 | .timing = µn_timing, | ||
298 | .cmdset = &largepage_cmdset, | ||
299 | .page_per_block = 64, | ||
300 | .page_size = 2048, | ||
301 | .flash_width = 16, | ||
302 | .dfc_width = 16, | ||
303 | .num_blocks = 4096, | ||
304 | .chip_id = 0xcc2c, | ||
305 | }; | ||
306 | |||
265 | static struct pxa3xx_nand_timing stm2GbX16_timing = { | 307 | static struct pxa3xx_nand_timing stm2GbX16_timing = { |
266 | .tCH = 10, | 308 | .tCH = 10, |
267 | .tCS = 35, | 309 | .tCS = 35, |
@@ -287,8 +329,12 @@ static struct pxa3xx_nand_flash stm2GbX16 = { | |||
287 | 329 | ||
288 | static struct pxa3xx_nand_flash *builtin_flash_types[] = { | 330 | static struct pxa3xx_nand_flash *builtin_flash_types[] = { |
289 | &samsung512MbX16, | 331 | &samsung512MbX16, |
332 | &samsung2GbX8, | ||
333 | &samsung32GbX8, | ||
290 | µn1GbX8, | 334 | µn1GbX8, |
291 | µn1GbX16, | 335 | µn1GbX16, |
336 | µn4GbX8, | ||
337 | µn4GbX16, | ||
292 | &stm2GbX16, | 338 | &stm2GbX16, |
293 | }; | 339 | }; |
294 | #endif /* CONFIG_MTD_NAND_PXA3xx_BUILTIN */ | 340 | #endif /* CONFIG_MTD_NAND_PXA3xx_BUILTIN */ |
@@ -489,7 +535,7 @@ static int handle_data_pio(struct pxa3xx_nand_info *info) | |||
489 | switch (info->state) { | 535 | switch (info->state) { |
490 | case STATE_PIO_WRITING: | 536 | case STATE_PIO_WRITING: |
491 | __raw_writesl(info->mmio_base + NDDB, info->data_buff, | 537 | __raw_writesl(info->mmio_base + NDDB, info->data_buff, |
492 | info->data_size << 2); | 538 | DIV_ROUND_UP(info->data_size, 4)); |
493 | 539 | ||
494 | enable_int(info, NDSR_CS0_BBD | NDSR_CS0_CMDD); | 540 | enable_int(info, NDSR_CS0_BBD | NDSR_CS0_CMDD); |
495 | 541 | ||
@@ -501,7 +547,7 @@ static int handle_data_pio(struct pxa3xx_nand_info *info) | |||
501 | break; | 547 | break; |
502 | case STATE_PIO_READING: | 548 | case STATE_PIO_READING: |
503 | __raw_readsl(info->mmio_base + NDDB, info->data_buff, | 549 | __raw_readsl(info->mmio_base + NDDB, info->data_buff, |
504 | info->data_size << 2); | 550 | DIV_ROUND_UP(info->data_size, 4)); |
505 | break; | 551 | break; |
506 | default: | 552 | default: |
507 | printk(KERN_ERR "%s: invalid state %d\n", __func__, | 553 | printk(KERN_ERR "%s: invalid state %d\n", __func__, |
@@ -523,11 +569,11 @@ static void start_data_dma(struct pxa3xx_nand_info *info, int dir_out) | |||
523 | 569 | ||
524 | if (dir_out) { | 570 | if (dir_out) { |
525 | desc->dsadr = info->data_buff_phys; | 571 | desc->dsadr = info->data_buff_phys; |
526 | desc->dtadr = NDDB_DMA_ADDR; | 572 | desc->dtadr = info->mmio_phys + NDDB; |
527 | desc->dcmd |= DCMD_INCSRCADDR | DCMD_FLOWTRG; | 573 | desc->dcmd |= DCMD_INCSRCADDR | DCMD_FLOWTRG; |
528 | } else { | 574 | } else { |
529 | desc->dtadr = info->data_buff_phys; | 575 | desc->dtadr = info->data_buff_phys; |
530 | desc->dsadr = NDDB_DMA_ADDR; | 576 | desc->dsadr = info->mmio_phys + NDDB; |
531 | desc->dcmd |= DCMD_INCTRGADDR | DCMD_FLOWSRC; | 577 | desc->dcmd |= DCMD_INCTRGADDR | DCMD_FLOWSRC; |
532 | } | 578 | } |
533 | 579 | ||
@@ -669,6 +715,7 @@ static void pxa3xx_nand_cmdfunc(struct mtd_info *mtd, unsigned command, | |||
669 | /* disable HW ECC to get all the OOB data */ | 715 | /* disable HW ECC to get all the OOB data */ |
670 | info->buf_count = mtd->writesize + mtd->oobsize; | 716 | info->buf_count = mtd->writesize + mtd->oobsize; |
671 | info->buf_start = mtd->writesize + column; | 717 | info->buf_start = mtd->writesize + column; |
718 | memset(info->data_buff, 0xFF, info->buf_count); | ||
672 | 719 | ||
673 | if (prepare_read_prog_cmd(info, cmdset->read1, column, page_addr)) | 720 | if (prepare_read_prog_cmd(info, cmdset->read1, column, page_addr)) |
674 | break; | 721 | break; |
@@ -1239,13 +1286,17 @@ static int pxa3xx_nand_probe(struct platform_device *pdev) | |||
1239 | ret = -ENODEV; | 1286 | ret = -ENODEV; |
1240 | goto fail_free_res; | 1287 | goto fail_free_res; |
1241 | } | 1288 | } |
1289 | info->mmio_phys = r->start; | ||
1242 | 1290 | ||
1243 | ret = pxa3xx_nand_init_buff(info); | 1291 | ret = pxa3xx_nand_init_buff(info); |
1244 | if (ret) | 1292 | if (ret) |
1245 | goto fail_free_io; | 1293 | goto fail_free_io; |
1246 | 1294 | ||
1247 | ret = request_irq(IRQ_NAND, pxa3xx_nand_irq, IRQF_DISABLED, | 1295 | /* initialize all interrupts to be disabled */ |
1248 | pdev->name, info); | 1296 | disable_int(info, NDSR_MASK); |
1297 | |||
1298 | ret = request_irq(irq, pxa3xx_nand_irq, IRQF_DISABLED, | ||
1299 | pdev->name, info); | ||
1249 | if (ret < 0) { | 1300 | if (ret < 0) { |
1250 | dev_err(&pdev->dev, "failed to request IRQ\n"); | 1301 | dev_err(&pdev->dev, "failed to request IRQ\n"); |
1251 | goto fail_free_buf; | 1302 | goto fail_free_buf; |
@@ -1271,7 +1322,7 @@ static int pxa3xx_nand_probe(struct platform_device *pdev) | |||
1271 | return add_mtd_partitions(mtd, pdata->parts, pdata->nr_parts); | 1322 | return add_mtd_partitions(mtd, pdata->parts, pdata->nr_parts); |
1272 | 1323 | ||
1273 | fail_free_irq: | 1324 | fail_free_irq: |
1274 | free_irq(IRQ_NAND, info); | 1325 | free_irq(irq, info); |
1275 | fail_free_buf: | 1326 | fail_free_buf: |
1276 | if (use_dma) { | 1327 | if (use_dma) { |
1277 | pxa_free_dma(info->data_dma_ch); | 1328 | pxa_free_dma(info->data_dma_ch); |
@@ -1296,12 +1347,15 @@ static int pxa3xx_nand_remove(struct platform_device *pdev) | |||
1296 | struct mtd_info *mtd = platform_get_drvdata(pdev); | 1347 | struct mtd_info *mtd = platform_get_drvdata(pdev); |
1297 | struct pxa3xx_nand_info *info = mtd->priv; | 1348 | struct pxa3xx_nand_info *info = mtd->priv; |
1298 | struct resource *r; | 1349 | struct resource *r; |
1350 | int irq; | ||
1299 | 1351 | ||
1300 | platform_set_drvdata(pdev, NULL); | 1352 | platform_set_drvdata(pdev, NULL); |
1301 | 1353 | ||
1302 | del_mtd_device(mtd); | 1354 | del_mtd_device(mtd); |
1303 | del_mtd_partitions(mtd); | 1355 | del_mtd_partitions(mtd); |
1304 | free_irq(IRQ_NAND, info); | 1356 | irq = platform_get_irq(pdev, 0); |
1357 | if (irq >= 0) | ||
1358 | free_irq(irq, info); | ||
1305 | if (use_dma) { | 1359 | if (use_dma) { |
1306 | pxa_free_dma(info->data_dma_ch); | 1360 | pxa_free_dma(info->data_dma_ch); |
1307 | dma_free_writecombine(&pdev->dev, info->data_buff_size, | 1361 | dma_free_writecombine(&pdev->dev, info->data_buff_size, |
diff --git a/drivers/mtd/onenand/omap2.c b/drivers/mtd/onenand/omap2.c index 0108ed42e877..86c4f6dcdc65 100644 --- a/drivers/mtd/onenand/omap2.c +++ b/drivers/mtd/onenand/omap2.c | |||
@@ -36,13 +36,13 @@ | |||
36 | #include <linux/io.h> | 36 | #include <linux/io.h> |
37 | 37 | ||
38 | #include <asm/mach/flash.h> | 38 | #include <asm/mach/flash.h> |
39 | #include <mach/gpmc.h> | 39 | #include <plat/gpmc.h> |
40 | #include <mach/onenand.h> | 40 | #include <plat/onenand.h> |
41 | #include <mach/gpio.h> | 41 | #include <mach/gpio.h> |
42 | 42 | ||
43 | #include <mach/dma.h> | 43 | #include <plat/dma.h> |
44 | 44 | ||
45 | #include <mach/board.h> | 45 | #include <plat/board.h> |
46 | 46 | ||
47 | #define DRIVER_NAME "omap2-onenand" | 47 | #define DRIVER_NAME "omap2-onenand" |
48 | 48 | ||