diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2009-09-23 13:07:49 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-09-23 13:07:49 -0400 |
commit | a7c367b95a9d8e65e0f0e7da31f700a556794efb (patch) | |
tree | 5b1bb202801e29e3237381aa7aad5aa288378d5b /drivers/mtd/onenand | |
parent | 15f964bed054821d6d940d3752508c5f96a9ffd3 (diff) | |
parent | e1070211f7327a1f197d535aa886f721a241c32f (diff) |
Merge git://git.infradead.org/mtd-2.6
* git://git.infradead.org/mtd-2.6: (58 commits)
mtd: jedec_probe: add PSD4256G6V id
mtd: OneNand support for Nomadik 8815 SoC (on NHK8815 board)
mtd: nand: driver for Nomadik 8815 SoC (on NHK8815 board)
m25p80: Add Spansion S25FL129P serial flashes
jffs2: Use SLAB_HWCACHE_ALIGN for jffs2_raw_{dirent,inode} slabs
mtd: sh_flctl: register sh_flctl using platform_driver_probe()
mtd: nand: txx9ndfmc: transfer 512 byte at a time if possible
mtd: nand: fix tmio_nand ecc correction
mtd: nand: add __nand_correct_data helper function
mtd: cfi_cmdset_0002: add 0xFF intolerance for M29W128G
mtd: inftl: fix fold chain block number
mtd: jedec: fix compilation problem with I28F640C3B definition
mtd: nand: fix ECC Correction bug for SMC ordering for NDFC driver
mtd: ofpart: Check availability of reg property instead of name property
driver/Makefile: Initialize "mtd" and "spi" before "net"
mtd: omap: adding DMA mode support in nand prefetch/post-write
mtd: omap: add support for nand prefetch-read and post-write
mtd: add nand support for w90p910 (v2)
mtd: maps: add mtd-ram support to physmap_of
mtd: pxa3xx_nand: add single-bit error corrections reporting
...
Diffstat (limited to 'drivers/mtd/onenand')
-rw-r--r-- | drivers/mtd/onenand/Kconfig | 3 | ||||
-rw-r--r-- | drivers/mtd/onenand/generic.c | 24 | ||||
-rw-r--r-- | drivers/mtd/onenand/onenand_base.c | 20 |
3 files changed, 25 insertions, 22 deletions
diff --git a/drivers/mtd/onenand/Kconfig b/drivers/mtd/onenand/Kconfig index 79fa79e8f8de..a38f580c2bb3 100644 --- a/drivers/mtd/onenand/Kconfig +++ b/drivers/mtd/onenand/Kconfig | |||
@@ -5,6 +5,7 @@ | |||
5 | menuconfig MTD_ONENAND | 5 | menuconfig MTD_ONENAND |
6 | tristate "OneNAND Device Support" | 6 | tristate "OneNAND Device Support" |
7 | depends on MTD | 7 | depends on MTD |
8 | select MTD_PARTITIONS | ||
8 | help | 9 | help |
9 | This enables support for accessing all type of OneNAND flash | 10 | This enables support for accessing all type of OneNAND flash |
10 | devices. For further information see | 11 | devices. For further information see |
@@ -23,7 +24,6 @@ config MTD_ONENAND_VERIFY_WRITE | |||
23 | 24 | ||
24 | config MTD_ONENAND_GENERIC | 25 | config MTD_ONENAND_GENERIC |
25 | tristate "OneNAND Flash device via platform device driver" | 26 | tristate "OneNAND Flash device via platform device driver" |
26 | depends on ARM | ||
27 | help | 27 | help |
28 | Support for OneNAND flash via platform device driver. | 28 | Support for OneNAND flash via platform device driver. |
29 | 29 | ||
@@ -66,7 +66,6 @@ config MTD_ONENAND_2X_PROGRAM | |||
66 | 66 | ||
67 | config MTD_ONENAND_SIM | 67 | config MTD_ONENAND_SIM |
68 | tristate "OneNAND simulator support" | 68 | tristate "OneNAND simulator support" |
69 | depends on MTD_PARTITIONS | ||
70 | help | 69 | help |
71 | The simulator may simulate various OneNAND flash chips for the | 70 | The simulator may simulate various OneNAND flash chips for the |
72 | OneNAND MTD layer. | 71 | OneNAND MTD layer. |
diff --git a/drivers/mtd/onenand/generic.c b/drivers/mtd/onenand/generic.c index 3a496c33fb52..e78914938c5c 100644 --- a/drivers/mtd/onenand/generic.c +++ b/drivers/mtd/onenand/generic.c | |||
@@ -19,12 +19,16 @@ | |||
19 | #include <linux/mtd/mtd.h> | 19 | #include <linux/mtd/mtd.h> |
20 | #include <linux/mtd/onenand.h> | 20 | #include <linux/mtd/onenand.h> |
21 | #include <linux/mtd/partitions.h> | 21 | #include <linux/mtd/partitions.h> |
22 | |||
23 | #include <asm/io.h> | 22 | #include <asm/io.h> |
24 | #include <asm/mach/flash.h> | ||
25 | |||
26 | #define DRIVER_NAME "onenand" | ||
27 | 23 | ||
24 | /* | ||
25 | * Note: Driver name and platform data format have been updated! | ||
26 | * | ||
27 | * This version of the driver is named "onenand-flash" and takes struct | ||
28 | * onenand_platform_data as platform data. The old ARM-specific version | ||
29 | * with the name "onenand" used to take struct flash_platform_data. | ||
30 | */ | ||
31 | #define DRIVER_NAME "onenand-flash" | ||
28 | 32 | ||
29 | #ifdef CONFIG_MTD_PARTITIONS | 33 | #ifdef CONFIG_MTD_PARTITIONS |
30 | static const char *part_probes[] = { "cmdlinepart", NULL, }; | 34 | static const char *part_probes[] = { "cmdlinepart", NULL, }; |
@@ -39,16 +43,16 @@ struct onenand_info { | |||
39 | static int __devinit generic_onenand_probe(struct platform_device *pdev) | 43 | static int __devinit generic_onenand_probe(struct platform_device *pdev) |
40 | { | 44 | { |
41 | struct onenand_info *info; | 45 | struct onenand_info *info; |
42 | struct flash_platform_data *pdata = pdev->dev.platform_data; | 46 | struct onenand_platform_data *pdata = pdev->dev.platform_data; |
43 | struct resource *res = pdev->resource; | 47 | struct resource *res = pdev->resource; |
44 | unsigned long size = res->end - res->start + 1; | 48 | unsigned long size = resource_size(res); |
45 | int err; | 49 | int err; |
46 | 50 | ||
47 | info = kzalloc(sizeof(struct onenand_info), GFP_KERNEL); | 51 | info = kzalloc(sizeof(struct onenand_info), GFP_KERNEL); |
48 | if (!info) | 52 | if (!info) |
49 | return -ENOMEM; | 53 | return -ENOMEM; |
50 | 54 | ||
51 | if (!request_mem_region(res->start, size, pdev->dev.driver->name)) { | 55 | if (!request_mem_region(res->start, size, dev_name(&pdev->dev))) { |
52 | err = -EBUSY; | 56 | err = -EBUSY; |
53 | goto out_free_info; | 57 | goto out_free_info; |
54 | } | 58 | } |
@@ -59,7 +63,7 @@ static int __devinit generic_onenand_probe(struct platform_device *pdev) | |||
59 | goto out_release_mem_region; | 63 | goto out_release_mem_region; |
60 | } | 64 | } |
61 | 65 | ||
62 | info->onenand.mmcontrol = pdata->mmcontrol; | 66 | info->onenand.mmcontrol = pdata ? pdata->mmcontrol : 0; |
63 | info->onenand.irq = platform_get_irq(pdev, 0); | 67 | info->onenand.irq = platform_get_irq(pdev, 0); |
64 | 68 | ||
65 | info->mtd.name = dev_name(&pdev->dev); | 69 | info->mtd.name = dev_name(&pdev->dev); |
@@ -75,7 +79,7 @@ static int __devinit generic_onenand_probe(struct platform_device *pdev) | |||
75 | err = parse_mtd_partitions(&info->mtd, part_probes, &info->parts, 0); | 79 | err = parse_mtd_partitions(&info->mtd, part_probes, &info->parts, 0); |
76 | if (err > 0) | 80 | if (err > 0) |
77 | add_mtd_partitions(&info->mtd, info->parts, err); | 81 | add_mtd_partitions(&info->mtd, info->parts, err); |
78 | else if (err <= 0 && pdata->parts) | 82 | else if (err <= 0 && pdata && pdata->parts) |
79 | add_mtd_partitions(&info->mtd, pdata->parts, pdata->nr_parts); | 83 | add_mtd_partitions(&info->mtd, pdata->parts, pdata->nr_parts); |
80 | else | 84 | else |
81 | #endif | 85 | #endif |
@@ -99,7 +103,7 @@ static int __devexit generic_onenand_remove(struct platform_device *pdev) | |||
99 | { | 103 | { |
100 | struct onenand_info *info = platform_get_drvdata(pdev); | 104 | struct onenand_info *info = platform_get_drvdata(pdev); |
101 | struct resource *res = pdev->resource; | 105 | struct resource *res = pdev->resource; |
102 | unsigned long size = res->end - res->start + 1; | 106 | unsigned long size = resource_size(res); |
103 | 107 | ||
104 | platform_set_drvdata(pdev, NULL); | 108 | platform_set_drvdata(pdev, NULL); |
105 | 109 | ||
diff --git a/drivers/mtd/onenand/onenand_base.c b/drivers/mtd/onenand/onenand_base.c index 6e829095ea9d..ff66e4330aa7 100644 --- a/drivers/mtd/onenand/onenand_base.c +++ b/drivers/mtd/onenand/onenand_base.c | |||
@@ -1191,7 +1191,7 @@ static int onenand_read_ops_nolock(struct mtd_info *mtd, loff_t from, | |||
1191 | /* | 1191 | /* |
1192 | * Chip boundary handling in DDP | 1192 | * Chip boundary handling in DDP |
1193 | * Now we issued chip 1 read and pointed chip 1 | 1193 | * Now we issued chip 1 read and pointed chip 1 |
1194 | * bufferam so we have to point chip 0 bufferam. | 1194 | * bufferram so we have to point chip 0 bufferram. |
1195 | */ | 1195 | */ |
1196 | if (ONENAND_IS_DDP(this) && | 1196 | if (ONENAND_IS_DDP(this) && |
1197 | unlikely(from == (this->chipsize >> 1))) { | 1197 | unlikely(from == (this->chipsize >> 1))) { |
@@ -1867,8 +1867,8 @@ static int onenand_write_ops_nolock(struct mtd_info *mtd, loff_t to, | |||
1867 | ONENAND_SET_NEXT_BUFFERRAM(this); | 1867 | ONENAND_SET_NEXT_BUFFERRAM(this); |
1868 | 1868 | ||
1869 | /* | 1869 | /* |
1870 | * 2 PLANE, MLC, and Flex-OneNAND doesn't support | 1870 | * 2 PLANE, MLC, and Flex-OneNAND do not support |
1871 | * write-while-programe feature. | 1871 | * write-while-program feature. |
1872 | */ | 1872 | */ |
1873 | if (!ONENAND_IS_2PLANE(this) && !first) { | 1873 | if (!ONENAND_IS_2PLANE(this) && !first) { |
1874 | ONENAND_SET_PREV_BUFFERRAM(this); | 1874 | ONENAND_SET_PREV_BUFFERRAM(this); |
@@ -1879,7 +1879,7 @@ static int onenand_write_ops_nolock(struct mtd_info *mtd, loff_t to, | |||
1879 | onenand_update_bufferram(mtd, prev, !ret && !prev_subpage); | 1879 | onenand_update_bufferram(mtd, prev, !ret && !prev_subpage); |
1880 | if (ret) { | 1880 | if (ret) { |
1881 | written -= prevlen; | 1881 | written -= prevlen; |
1882 | printk(KERN_ERR "onenand_write_ops_nolock: write filaed %d\n", ret); | 1882 | printk(KERN_ERR "onenand_write_ops_nolock: write failed %d\n", ret); |
1883 | break; | 1883 | break; |
1884 | } | 1884 | } |
1885 | 1885 | ||
@@ -1905,7 +1905,7 @@ static int onenand_write_ops_nolock(struct mtd_info *mtd, loff_t to, | |||
1905 | /* In partial page write we don't update bufferram */ | 1905 | /* In partial page write we don't update bufferram */ |
1906 | onenand_update_bufferram(mtd, to, !ret && !subpage); | 1906 | onenand_update_bufferram(mtd, to, !ret && !subpage); |
1907 | if (ret) { | 1907 | if (ret) { |
1908 | printk(KERN_ERR "onenand_write_ops_nolock: write filaed %d\n", ret); | 1908 | printk(KERN_ERR "onenand_write_ops_nolock: write failed %d\n", ret); |
1909 | break; | 1909 | break; |
1910 | } | 1910 | } |
1911 | 1911 | ||
@@ -2201,7 +2201,7 @@ static int onenand_erase(struct mtd_info *mtd, struct erase_info *instr) | |||
2201 | /* Grab the lock and see if the device is available */ | 2201 | /* Grab the lock and see if the device is available */ |
2202 | onenand_get_device(mtd, FL_ERASING); | 2202 | onenand_get_device(mtd, FL_ERASING); |
2203 | 2203 | ||
2204 | /* Loop throught the pages */ | 2204 | /* Loop through the blocks */ |
2205 | instr->state = MTD_ERASING; | 2205 | instr->state = MTD_ERASING; |
2206 | 2206 | ||
2207 | while (len) { | 2207 | while (len) { |
@@ -2328,7 +2328,7 @@ static int onenand_default_block_markbad(struct mtd_info *mtd, loff_t ofs) | |||
2328 | if (bbm->bbt) | 2328 | if (bbm->bbt) |
2329 | bbm->bbt[block >> 2] |= 0x01 << ((block & 0x03) << 1); | 2329 | bbm->bbt[block >> 2] |= 0x01 << ((block & 0x03) << 1); |
2330 | 2330 | ||
2331 | /* We write two bytes, so we dont have to mess with 16 bit access */ | 2331 | /* We write two bytes, so we don't have to mess with 16-bit access */ |
2332 | ofs += mtd->oobsize + (bbm->badblockpos & ~0x01); | 2332 | ofs += mtd->oobsize + (bbm->badblockpos & ~0x01); |
2333 | /* FIXME : What to do when marking SLC block in partition | 2333 | /* FIXME : What to do when marking SLC block in partition |
2334 | * with MLC erasesize? For now, it is not advisable to | 2334 | * with MLC erasesize? For now, it is not advisable to |
@@ -2557,7 +2557,7 @@ static void onenand_unlock_all(struct mtd_info *mtd) | |||
2557 | 2557 | ||
2558 | #ifdef CONFIG_MTD_ONENAND_OTP | 2558 | #ifdef CONFIG_MTD_ONENAND_OTP |
2559 | 2559 | ||
2560 | /* Interal OTP operation */ | 2560 | /* Internal OTP operation */ |
2561 | typedef int (*otp_op_t)(struct mtd_info *mtd, loff_t form, size_t len, | 2561 | typedef int (*otp_op_t)(struct mtd_info *mtd, loff_t form, size_t len, |
2562 | size_t *retlen, u_char *buf); | 2562 | size_t *retlen, u_char *buf); |
2563 | 2563 | ||
@@ -2921,7 +2921,7 @@ static void onenand_check_features(struct mtd_info *mtd) | |||
2921 | this->options |= ONENAND_HAS_2PLANE; | 2921 | this->options |= ONENAND_HAS_2PLANE; |
2922 | 2922 | ||
2923 | case ONENAND_DEVICE_DENSITY_2Gb: | 2923 | case ONENAND_DEVICE_DENSITY_2Gb: |
2924 | /* 2Gb DDP don't have 2 plane */ | 2924 | /* 2Gb DDP does not have 2 plane */ |
2925 | if (!ONENAND_IS_DDP(this)) | 2925 | if (!ONENAND_IS_DDP(this)) |
2926 | this->options |= ONENAND_HAS_2PLANE; | 2926 | this->options |= ONENAND_HAS_2PLANE; |
2927 | this->options |= ONENAND_HAS_UNLOCK_ALL; | 2927 | this->options |= ONENAND_HAS_UNLOCK_ALL; |
@@ -3364,7 +3364,7 @@ static int onenand_probe(struct mtd_info *mtd) | |||
3364 | /* It's real page size */ | 3364 | /* It's real page size */ |
3365 | this->writesize = mtd->writesize; | 3365 | this->writesize = mtd->writesize; |
3366 | 3366 | ||
3367 | /* REVIST: Multichip handling */ | 3367 | /* REVISIT: Multichip handling */ |
3368 | 3368 | ||
3369 | if (FLEXONENAND(this)) | 3369 | if (FLEXONENAND(this)) |
3370 | flexonenand_get_size(mtd); | 3370 | flexonenand_get_size(mtd); |