diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2011-01-17 14:15:30 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-01-17 14:15:30 -0500 |
commit | ab2020f2f11fc7fb81e6c71298b0830d85412011 (patch) | |
tree | c9a6342063461dcf31278d65585bca73bdda4a84 /drivers/mtd/nand | |
parent | 235646a486d10891bd86af28d8eac75d9f22bd2d (diff) | |
parent | 154bf89f5e3e3dc59666926f27ca4a0866f39157 (diff) |
Merge git://git.infradead.org/mtd-2.6
* git://git.infradead.org/mtd-2.6: (59 commits)
mtd: mtdpart: disallow reading OOB past the end of the partition
mtd: pxa3xx_nand: NULL dereference in pxa3xx_nand_probe
UBI: use mtd->writebufsize to set minimal I/O unit size
mtd: initialize writebufsize in the MTD object of a partition
mtd: onenand: add mtd->writebufsize initialization
mtd: nand: add mtd->writebufsize initialization
mtd: cfi: add writebufsize initialization
mtd: add writebufsize field to mtd_info struct
mtd: OneNAND: OMAP2/3: prevent regulator sleeping while OneNAND is in use
mtd: OneNAND: add enable / disable methods to onenand_chip
mtd: m25p80: Fix JEDEC ID for AT26DF321
mtd: txx9ndfmc: limit transfer bytes to 512 (ECC provides 6 bytes max)
mtd: cfi_cmdset_0002: add support for Samsung K8D3x16UxC NOR chips
mtd: cfi_cmdset_0002: add support for Samsung K8D6x16UxM NOR chips
mtd: nand: ams-delta: drop omap_read/write, use ioremap
mtd: m25p80: add debugging trace in sst_write
mtd: nand: ams-delta: select for built-in by default
mtd: OneNAND: lighten scary initial bad block messages
mtd: OneNAND: OMAP2/3: add support for command line partitioning
mtd: nand: rearrange ONFI revision checking, add ONFI 2.3
...
Fix up trivial conflict in drivers/mtd/Kconfig as per DavidW.
Diffstat (limited to 'drivers/mtd/nand')
-rw-r--r-- | drivers/mtd/nand/Kconfig | 1 | ||||
-rw-r--r-- | drivers/mtd/nand/ams-delta.c | 80 | ||||
-rw-r--r-- | drivers/mtd/nand/fsl_elbc_nand.c | 2 | ||||
-rw-r--r-- | drivers/mtd/nand/fsmc_nand.c | 89 | ||||
-rw-r--r-- | drivers/mtd/nand/jz4740_nand.c | 57 | ||||
-rw-r--r-- | drivers/mtd/nand/mxc_nand.c | 2 | ||||
-rw-r--r-- | drivers/mtd/nand/nand_base.c | 25 | ||||
-rw-r--r-- | drivers/mtd/nand/nand_bbt.c | 3 | ||||
-rw-r--r-- | drivers/mtd/nand/nandsim.c | 39 | ||||
-rw-r--r-- | drivers/mtd/nand/pasemi_nand.c | 2 | ||||
-rw-r--r-- | drivers/mtd/nand/pxa3xx_nand.c | 2 | ||||
-rw-r--r-- | drivers/mtd/nand/txx9ndfmc.c | 5 |
12 files changed, 183 insertions, 124 deletions
diff --git a/drivers/mtd/nand/Kconfig b/drivers/mtd/nand/Kconfig index 8229802b4346..c89592239bc7 100644 --- a/drivers/mtd/nand/Kconfig +++ b/drivers/mtd/nand/Kconfig | |||
@@ -96,6 +96,7 @@ config MTD_NAND_SPIA | |||
96 | config MTD_NAND_AMS_DELTA | 96 | config MTD_NAND_AMS_DELTA |
97 | tristate "NAND Flash device on Amstrad E3" | 97 | tristate "NAND Flash device on Amstrad E3" |
98 | depends on MACH_AMS_DELTA | 98 | depends on MACH_AMS_DELTA |
99 | default y | ||
99 | help | 100 | help |
100 | Support for NAND flash on Amstrad E3 (Delta). | 101 | Support for NAND flash on Amstrad E3 (Delta). |
101 | 102 | ||
diff --git a/drivers/mtd/nand/ams-delta.c b/drivers/mtd/nand/ams-delta.c index 2548e1065bf8..a067d090cb31 100644 --- a/drivers/mtd/nand/ams-delta.c +++ b/drivers/mtd/nand/ams-delta.c | |||
@@ -4,6 +4,8 @@ | |||
4 | * Copyright (C) 2006 Jonathan McDowell <noodles@earth.li> | 4 | * Copyright (C) 2006 Jonathan McDowell <noodles@earth.li> |
5 | * | 5 | * |
6 | * Derived from drivers/mtd/toto.c | 6 | * Derived from drivers/mtd/toto.c |
7 | * Converted to platform driver by Janusz Krzysztofik <jkrzyszt@tis.icnet.pl> | ||
8 | * Partially stolen from drivers/mtd/nand/plat_nand.c | ||
7 | * | 9 | * |
8 | * This program is free software; you can redistribute it and/or modify | 10 | * This program is free software; you can redistribute it and/or modify |
9 | * it under the terms of the GNU General Public License version 2 as | 11 | * it under the terms of the GNU General Public License version 2 as |
@@ -62,9 +64,10 @@ static struct mtd_partition partition_info[] = { | |||
62 | static void ams_delta_write_byte(struct mtd_info *mtd, u_char byte) | 64 | static void ams_delta_write_byte(struct mtd_info *mtd, u_char byte) |
63 | { | 65 | { |
64 | struct nand_chip *this = mtd->priv; | 66 | struct nand_chip *this = mtd->priv; |
67 | void __iomem *io_base = this->priv; | ||
65 | 68 | ||
66 | omap_writew(0, (OMAP1_MPUIO_BASE + OMAP_MPUIO_IO_CNTL)); | 69 | writew(0, io_base + OMAP_MPUIO_IO_CNTL); |
67 | omap_writew(byte, this->IO_ADDR_W); | 70 | writew(byte, this->IO_ADDR_W); |
68 | ams_delta_latch2_write(AMS_DELTA_LATCH2_NAND_NWE, 0); | 71 | ams_delta_latch2_write(AMS_DELTA_LATCH2_NAND_NWE, 0); |
69 | ndelay(40); | 72 | ndelay(40); |
70 | ams_delta_latch2_write(AMS_DELTA_LATCH2_NAND_NWE, | 73 | ams_delta_latch2_write(AMS_DELTA_LATCH2_NAND_NWE, |
@@ -75,11 +78,12 @@ static u_char ams_delta_read_byte(struct mtd_info *mtd) | |||
75 | { | 78 | { |
76 | u_char res; | 79 | u_char res; |
77 | struct nand_chip *this = mtd->priv; | 80 | struct nand_chip *this = mtd->priv; |
81 | void __iomem *io_base = this->priv; | ||
78 | 82 | ||
79 | ams_delta_latch2_write(AMS_DELTA_LATCH2_NAND_NRE, 0); | 83 | ams_delta_latch2_write(AMS_DELTA_LATCH2_NAND_NRE, 0); |
80 | ndelay(40); | 84 | ndelay(40); |
81 | omap_writew(~0, (OMAP1_MPUIO_BASE + OMAP_MPUIO_IO_CNTL)); | 85 | writew(~0, io_base + OMAP_MPUIO_IO_CNTL); |
82 | res = omap_readw(this->IO_ADDR_R); | 86 | res = readw(this->IO_ADDR_R); |
83 | ams_delta_latch2_write(AMS_DELTA_LATCH2_NAND_NRE, | 87 | ams_delta_latch2_write(AMS_DELTA_LATCH2_NAND_NRE, |
84 | AMS_DELTA_LATCH2_NAND_NRE); | 88 | AMS_DELTA_LATCH2_NAND_NRE); |
85 | 89 | ||
@@ -151,11 +155,16 @@ static int ams_delta_nand_ready(struct mtd_info *mtd) | |||
151 | /* | 155 | /* |
152 | * Main initialization routine | 156 | * Main initialization routine |
153 | */ | 157 | */ |
154 | static int __init ams_delta_init(void) | 158 | static int __devinit ams_delta_init(struct platform_device *pdev) |
155 | { | 159 | { |
156 | struct nand_chip *this; | 160 | struct nand_chip *this; |
161 | struct resource *res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | ||
162 | void __iomem *io_base; | ||
157 | int err = 0; | 163 | int err = 0; |
158 | 164 | ||
165 | if (!res) | ||
166 | return -ENXIO; | ||
167 | |||
159 | /* Allocate memory for MTD device structure and private data */ | 168 | /* Allocate memory for MTD device structure and private data */ |
160 | ams_delta_mtd = kmalloc(sizeof(struct mtd_info) + | 169 | ams_delta_mtd = kmalloc(sizeof(struct mtd_info) + |
161 | sizeof(struct nand_chip), GFP_KERNEL); | 170 | sizeof(struct nand_chip), GFP_KERNEL); |
@@ -177,9 +186,25 @@ static int __init ams_delta_init(void) | |||
177 | /* Link the private data with the MTD structure */ | 186 | /* Link the private data with the MTD structure */ |
178 | ams_delta_mtd->priv = this; | 187 | ams_delta_mtd->priv = this; |
179 | 188 | ||
189 | if (!request_mem_region(res->start, resource_size(res), | ||
190 | dev_name(&pdev->dev))) { | ||
191 | dev_err(&pdev->dev, "request_mem_region failed\n"); | ||
192 | err = -EBUSY; | ||
193 | goto out_free; | ||
194 | } | ||
195 | |||
196 | io_base = ioremap(res->start, resource_size(res)); | ||
197 | if (io_base == NULL) { | ||
198 | dev_err(&pdev->dev, "ioremap failed\n"); | ||
199 | err = -EIO; | ||
200 | goto out_release_io; | ||
201 | } | ||
202 | |||
203 | this->priv = io_base; | ||
204 | |||
180 | /* Set address of NAND IO lines */ | 205 | /* Set address of NAND IO lines */ |
181 | this->IO_ADDR_R = (OMAP1_MPUIO_BASE + OMAP_MPUIO_INPUT_LATCH); | 206 | this->IO_ADDR_R = io_base + OMAP_MPUIO_INPUT_LATCH; |
182 | this->IO_ADDR_W = (OMAP1_MPUIO_BASE + OMAP_MPUIO_OUTPUT); | 207 | this->IO_ADDR_W = io_base + OMAP_MPUIO_OUTPUT; |
183 | this->read_byte = ams_delta_read_byte; | 208 | this->read_byte = ams_delta_read_byte; |
184 | this->write_buf = ams_delta_write_buf; | 209 | this->write_buf = ams_delta_write_buf; |
185 | this->read_buf = ams_delta_read_buf; | 210 | this->read_buf = ams_delta_read_buf; |
@@ -195,6 +220,8 @@ static int __init ams_delta_init(void) | |||
195 | this->chip_delay = 30; | 220 | this->chip_delay = 30; |
196 | this->ecc.mode = NAND_ECC_SOFT; | 221 | this->ecc.mode = NAND_ECC_SOFT; |
197 | 222 | ||
223 | platform_set_drvdata(pdev, io_base); | ||
224 | |||
198 | /* Set chip enabled, but */ | 225 | /* Set chip enabled, but */ |
199 | ams_delta_latch2_write(NAND_MASK, AMS_DELTA_LATCH2_NAND_NRE | | 226 | ams_delta_latch2_write(NAND_MASK, AMS_DELTA_LATCH2_NAND_NRE | |
200 | AMS_DELTA_LATCH2_NAND_NWE | | 227 | AMS_DELTA_LATCH2_NAND_NWE | |
@@ -214,25 +241,56 @@ static int __init ams_delta_init(void) | |||
214 | goto out; | 241 | goto out; |
215 | 242 | ||
216 | out_mtd: | 243 | out_mtd: |
244 | platform_set_drvdata(pdev, NULL); | ||
245 | iounmap(io_base); | ||
246 | out_release_io: | ||
247 | release_mem_region(res->start, resource_size(res)); | ||
248 | out_free: | ||
217 | kfree(ams_delta_mtd); | 249 | kfree(ams_delta_mtd); |
218 | out: | 250 | out: |
219 | return err; | 251 | return err; |
220 | } | 252 | } |
221 | 253 | ||
222 | module_init(ams_delta_init); | ||
223 | |||
224 | /* | 254 | /* |
225 | * Clean up routine | 255 | * Clean up routine |
226 | */ | 256 | */ |
227 | static void __exit ams_delta_cleanup(void) | 257 | static int __devexit ams_delta_cleanup(struct platform_device *pdev) |
228 | { | 258 | { |
259 | void __iomem *io_base = platform_get_drvdata(pdev); | ||
260 | struct resource *res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | ||
261 | |||
229 | /* Release resources, unregister device */ | 262 | /* Release resources, unregister device */ |
230 | nand_release(ams_delta_mtd); | 263 | nand_release(ams_delta_mtd); |
231 | 264 | ||
265 | iounmap(io_base); | ||
266 | release_mem_region(res->start, resource_size(res)); | ||
267 | |||
232 | /* Free the MTD device structure */ | 268 | /* Free the MTD device structure */ |
233 | kfree(ams_delta_mtd); | 269 | kfree(ams_delta_mtd); |
270 | |||
271 | return 0; | ||
272 | } | ||
273 | |||
274 | static struct platform_driver ams_delta_nand_driver = { | ||
275 | .probe = ams_delta_init, | ||
276 | .remove = __devexit_p(ams_delta_cleanup), | ||
277 | .driver = { | ||
278 | .name = "ams-delta-nand", | ||
279 | .owner = THIS_MODULE, | ||
280 | }, | ||
281 | }; | ||
282 | |||
283 | static int __init ams_delta_nand_init(void) | ||
284 | { | ||
285 | return platform_driver_register(&ams_delta_nand_driver); | ||
286 | } | ||
287 | module_init(ams_delta_nand_init); | ||
288 | |||
289 | static void __exit ams_delta_nand_exit(void) | ||
290 | { | ||
291 | platform_driver_unregister(&ams_delta_nand_driver); | ||
234 | } | 292 | } |
235 | module_exit(ams_delta_cleanup); | 293 | module_exit(ams_delta_nand_exit); |
236 | 294 | ||
237 | MODULE_LICENSE("GPL"); | 295 | MODULE_LICENSE("GPL"); |
238 | MODULE_AUTHOR("Jonathan McDowell <noodles@earth.li>"); | 296 | MODULE_AUTHOR("Jonathan McDowell <noodles@earth.li>"); |
diff --git a/drivers/mtd/nand/fsl_elbc_nand.c b/drivers/mtd/nand/fsl_elbc_nand.c index c141b07b25d1..7a13d42cbabd 100644 --- a/drivers/mtd/nand/fsl_elbc_nand.c +++ b/drivers/mtd/nand/fsl_elbc_nand.c | |||
@@ -388,6 +388,8 @@ static void fsl_elbc_cmdfunc(struct mtd_info *mtd, unsigned int command, | |||
388 | "page_addr: 0x%x, column: 0x%x.\n", | 388 | "page_addr: 0x%x, column: 0x%x.\n", |
389 | page_addr, column); | 389 | page_addr, column); |
390 | 390 | ||
391 | elbc_fcm_ctrl->column = column; | ||
392 | elbc_fcm_ctrl->oob = 0; | ||
391 | elbc_fcm_ctrl->use_mdr = 1; | 393 | elbc_fcm_ctrl->use_mdr = 1; |
392 | 394 | ||
393 | fcr = (NAND_CMD_STATUS << FCR_CMD1_SHIFT) | | 395 | fcr = (NAND_CMD_STATUS << FCR_CMD1_SHIFT) | |
diff --git a/drivers/mtd/nand/fsmc_nand.c b/drivers/mtd/nand/fsmc_nand.c index 02edfba25b0c..205b10b9f9b9 100644 --- a/drivers/mtd/nand/fsmc_nand.c +++ b/drivers/mtd/nand/fsmc_nand.c | |||
@@ -31,6 +31,7 @@ | |||
31 | #include <linux/io.h> | 31 | #include <linux/io.h> |
32 | #include <linux/slab.h> | 32 | #include <linux/slab.h> |
33 | #include <linux/mtd/fsmc.h> | 33 | #include <linux/mtd/fsmc.h> |
34 | #include <linux/amba/bus.h> | ||
34 | #include <mtd/mtd-abi.h> | 35 | #include <mtd/mtd-abi.h> |
35 | 36 | ||
36 | static struct nand_ecclayout fsmc_ecc1_layout = { | 37 | static struct nand_ecclayout fsmc_ecc1_layout = { |
@@ -119,21 +120,36 @@ static struct fsmc_eccplace fsmc_ecc4_sp_place = { | |||
119 | } | 120 | } |
120 | }; | 121 | }; |
121 | 122 | ||
122 | /* | ||
123 | * Default partition tables to be used if the partition information not | ||
124 | * provided through platform data | ||
125 | */ | ||
126 | #define PARTITION(n, off, sz) {.name = n, .offset = off, .size = sz} | ||
127 | 123 | ||
124 | #ifdef CONFIG_MTD_PARTITIONS | ||
128 | /* | 125 | /* |
126 | * Default partition tables to be used if the partition information not | ||
127 | * provided through platform data. | ||
128 | * | ||
129 | * Default partition layout for small page(= 512 bytes) devices | 129 | * Default partition layout for small page(= 512 bytes) devices |
130 | * Size for "Root file system" is updated in driver based on actual device size | 130 | * Size for "Root file system" is updated in driver based on actual device size |
131 | */ | 131 | */ |
132 | static struct mtd_partition partition_info_16KB_blk[] = { | 132 | static struct mtd_partition partition_info_16KB_blk[] = { |
133 | PARTITION("X-loader", 0, 4 * 0x4000), | 133 | { |
134 | PARTITION("U-Boot", 0x10000, 20 * 0x4000), | 134 | .name = "X-loader", |
135 | PARTITION("Kernel", 0x60000, 256 * 0x4000), | 135 | .offset = 0, |
136 | PARTITION("Root File System", 0x460000, 0), | 136 | .size = 4*0x4000, |
137 | }, | ||
138 | { | ||
139 | .name = "U-Boot", | ||
140 | .offset = 0x10000, | ||
141 | .size = 20*0x4000, | ||
142 | }, | ||
143 | { | ||
144 | .name = "Kernel", | ||
145 | .offset = 0x60000, | ||
146 | .size = 256*0x4000, | ||
147 | }, | ||
148 | { | ||
149 | .name = "Root File System", | ||
150 | .offset = 0x460000, | ||
151 | .size = 0, | ||
152 | }, | ||
137 | }; | 153 | }; |
138 | 154 | ||
139 | /* | 155 | /* |
@@ -141,19 +157,37 @@ static struct mtd_partition partition_info_16KB_blk[] = { | |||
141 | * Size for "Root file system" is updated in driver based on actual device size | 157 | * Size for "Root file system" is updated in driver based on actual device size |
142 | */ | 158 | */ |
143 | static struct mtd_partition partition_info_128KB_blk[] = { | 159 | static struct mtd_partition partition_info_128KB_blk[] = { |
144 | PARTITION("X-loader", 0, 4 * 0x20000), | 160 | { |
145 | PARTITION("U-Boot", 0x80000, 12 * 0x20000), | 161 | .name = "X-loader", |
146 | PARTITION("Kernel", 0x200000, 48 * 0x20000), | 162 | .offset = 0, |
147 | PARTITION("Root File System", 0x800000, 0), | 163 | .size = 4*0x20000, |
164 | }, | ||
165 | { | ||
166 | .name = "U-Boot", | ||
167 | .offset = 0x80000, | ||
168 | .size = 12*0x20000, | ||
169 | }, | ||
170 | { | ||
171 | .name = "Kernel", | ||
172 | .offset = 0x200000, | ||
173 | .size = 48*0x20000, | ||
174 | }, | ||
175 | { | ||
176 | .name = "Root File System", | ||
177 | .offset = 0x800000, | ||
178 | .size = 0, | ||
179 | }, | ||
148 | }; | 180 | }; |
149 | 181 | ||
150 | #ifdef CONFIG_MTD_CMDLINE_PARTS | 182 | #ifdef CONFIG_MTD_CMDLINE_PARTS |
151 | const char *part_probes[] = { "cmdlinepart", NULL }; | 183 | const char *part_probes[] = { "cmdlinepart", NULL }; |
152 | #endif | 184 | #endif |
185 | #endif | ||
153 | 186 | ||
154 | /** | 187 | /** |
155 | * struct fsmc_nand_data - atructure for FSMC NAND device state | 188 | * struct fsmc_nand_data - structure for FSMC NAND device state |
156 | * | 189 | * |
190 | * @pid: Part ID on the AMBA PrimeCell format | ||
157 | * @mtd: MTD info for a NAND flash. | 191 | * @mtd: MTD info for a NAND flash. |
158 | * @nand: Chip related info for a NAND flash. | 192 | * @nand: Chip related info for a NAND flash. |
159 | * @partitions: Partition info for a NAND Flash. | 193 | * @partitions: Partition info for a NAND Flash. |
@@ -169,6 +203,7 @@ const char *part_probes[] = { "cmdlinepart", NULL }; | |||
169 | * @regs_va: FSMC regs base address. | 203 | * @regs_va: FSMC regs base address. |
170 | */ | 204 | */ |
171 | struct fsmc_nand_data { | 205 | struct fsmc_nand_data { |
206 | u32 pid; | ||
172 | struct mtd_info mtd; | 207 | struct mtd_info mtd; |
173 | struct nand_chip nand; | 208 | struct nand_chip nand; |
174 | struct mtd_partition *partitions; | 209 | struct mtd_partition *partitions; |
@@ -508,7 +543,9 @@ static int __init fsmc_nand_probe(struct platform_device *pdev) | |||
508 | struct nand_chip *nand; | 543 | struct nand_chip *nand; |
509 | struct fsmc_regs *regs; | 544 | struct fsmc_regs *regs; |
510 | struct resource *res; | 545 | struct resource *res; |
511 | int nr_parts, ret = 0; | 546 | int ret = 0; |
547 | u32 pid; | ||
548 | int i; | ||
512 | 549 | ||
513 | if (!pdata) { | 550 | if (!pdata) { |
514 | dev_err(&pdev->dev, "platform data is NULL\n"); | 551 | dev_err(&pdev->dev, "platform data is NULL\n"); |
@@ -598,6 +635,18 @@ static int __init fsmc_nand_probe(struct platform_device *pdev) | |||
598 | if (ret) | 635 | if (ret) |
599 | goto err_probe1; | 636 | goto err_probe1; |
600 | 637 | ||
638 | /* | ||
639 | * This device ID is actually a common AMBA ID as used on the | ||
640 | * AMBA PrimeCell bus. However it is not a PrimeCell. | ||
641 | */ | ||
642 | for (pid = 0, i = 0; i < 4; i++) | ||
643 | pid |= (readl(host->regs_va + resource_size(res) - 0x20 + 4 * i) & 255) << (i * 8); | ||
644 | host->pid = pid; | ||
645 | dev_info(&pdev->dev, "FSMC device partno %03x, manufacturer %02x, " | ||
646 | "revision %02x, config %02x\n", | ||
647 | AMBA_PART_BITS(pid), AMBA_MANF_BITS(pid), | ||
648 | AMBA_REV_BITS(pid), AMBA_CONFIG_BITS(pid)); | ||
649 | |||
601 | host->bank = pdata->bank; | 650 | host->bank = pdata->bank; |
602 | host->select_chip = pdata->select_bank; | 651 | host->select_chip = pdata->select_bank; |
603 | regs = host->regs_va; | 652 | regs = host->regs_va; |
@@ -625,7 +674,7 @@ static int __init fsmc_nand_probe(struct platform_device *pdev) | |||
625 | 674 | ||
626 | fsmc_nand_setup(regs, host->bank, nand->options & NAND_BUSWIDTH_16); | 675 | fsmc_nand_setup(regs, host->bank, nand->options & NAND_BUSWIDTH_16); |
627 | 676 | ||
628 | if (get_fsmc_version(host->regs_va) == FSMC_VER8) { | 677 | if (AMBA_REV_BITS(host->pid) >= 8) { |
629 | nand->ecc.read_page = fsmc_read_page_hwecc; | 678 | nand->ecc.read_page = fsmc_read_page_hwecc; |
630 | nand->ecc.calculate = fsmc_read_hwecc_ecc4; | 679 | nand->ecc.calculate = fsmc_read_hwecc_ecc4; |
631 | nand->ecc.correct = fsmc_correct_data; | 680 | nand->ecc.correct = fsmc_correct_data; |
@@ -645,7 +694,7 @@ static int __init fsmc_nand_probe(struct platform_device *pdev) | |||
645 | goto err_probe; | 694 | goto err_probe; |
646 | } | 695 | } |
647 | 696 | ||
648 | if (get_fsmc_version(host->regs_va) == FSMC_VER8) { | 697 | if (AMBA_REV_BITS(host->pid) >= 8) { |
649 | if (host->mtd.writesize == 512) { | 698 | if (host->mtd.writesize == 512) { |
650 | nand->ecc.layout = &fsmc_ecc4_sp_layout; | 699 | nand->ecc.layout = &fsmc_ecc4_sp_layout; |
651 | host->ecc_place = &fsmc_ecc4_sp_place; | 700 | host->ecc_place = &fsmc_ecc4_sp_place; |
@@ -676,11 +725,9 @@ static int __init fsmc_nand_probe(struct platform_device *pdev) | |||
676 | * Check if partition info passed via command line | 725 | * Check if partition info passed via command line |
677 | */ | 726 | */ |
678 | host->mtd.name = "nand"; | 727 | host->mtd.name = "nand"; |
679 | nr_parts = parse_mtd_partitions(&host->mtd, part_probes, | 728 | host->nr_partitions = parse_mtd_partitions(&host->mtd, part_probes, |
680 | &host->partitions, 0); | 729 | &host->partitions, 0); |
681 | if (nr_parts > 0) { | 730 | if (host->nr_partitions <= 0) { |
682 | host->nr_partitions = nr_parts; | ||
683 | } else { | ||
684 | #endif | 731 | #endif |
685 | /* | 732 | /* |
686 | * Check if partition info passed via command line | 733 | * Check if partition info passed via command line |
diff --git a/drivers/mtd/nand/jz4740_nand.c b/drivers/mtd/nand/jz4740_nand.c index 67343fc31bd5..cea38a5d4ac5 100644 --- a/drivers/mtd/nand/jz4740_nand.c +++ b/drivers/mtd/nand/jz4740_nand.c | |||
@@ -251,58 +251,6 @@ static int jz_nand_correct_ecc_rs(struct mtd_info *mtd, uint8_t *dat, | |||
251 | return 0; | 251 | return 0; |
252 | } | 252 | } |
253 | 253 | ||
254 | |||
255 | /* Copy paste of nand_read_page_hwecc_oob_first except for different eccpos | ||
256 | * handling. The ecc area is for 4k chips 72 bytes long and thus does not fit | ||
257 | * into the eccpos array. */ | ||
258 | static int jz_nand_read_page_hwecc_oob_first(struct mtd_info *mtd, | ||
259 | struct nand_chip *chip, uint8_t *buf, int page) | ||
260 | { | ||
261 | int i, eccsize = chip->ecc.size; | ||
262 | int eccbytes = chip->ecc.bytes; | ||
263 | int eccsteps = chip->ecc.steps; | ||
264 | uint8_t *p = buf; | ||
265 | unsigned int ecc_offset = chip->page_shift; | ||
266 | |||
267 | /* Read the OOB area first */ | ||
268 | chip->cmdfunc(mtd, NAND_CMD_READOOB, 0, page); | ||
269 | chip->read_buf(mtd, chip->oob_poi, mtd->oobsize); | ||
270 | chip->cmdfunc(mtd, NAND_CMD_READ0, 0, page); | ||
271 | |||
272 | for (i = ecc_offset; eccsteps; eccsteps--, i += eccbytes, p += eccsize) { | ||
273 | int stat; | ||
274 | |||
275 | chip->ecc.hwctl(mtd, NAND_ECC_READ); | ||
276 | chip->read_buf(mtd, p, eccsize); | ||
277 | |||
278 | stat = chip->ecc.correct(mtd, p, &chip->oob_poi[i], NULL); | ||
279 | if (stat < 0) | ||
280 | mtd->ecc_stats.failed++; | ||
281 | else | ||
282 | mtd->ecc_stats.corrected += stat; | ||
283 | } | ||
284 | return 0; | ||
285 | } | ||
286 | |||
287 | /* Copy-and-paste of nand_write_page_hwecc with different eccpos handling. */ | ||
288 | static void jz_nand_write_page_hwecc(struct mtd_info *mtd, | ||
289 | struct nand_chip *chip, const uint8_t *buf) | ||
290 | { | ||
291 | int i, eccsize = chip->ecc.size; | ||
292 | int eccbytes = chip->ecc.bytes; | ||
293 | int eccsteps = chip->ecc.steps; | ||
294 | const uint8_t *p = buf; | ||
295 | unsigned int ecc_offset = chip->page_shift; | ||
296 | |||
297 | for (i = ecc_offset; eccsteps; eccsteps--, i += eccbytes, p += eccsize) { | ||
298 | chip->ecc.hwctl(mtd, NAND_ECC_WRITE); | ||
299 | chip->write_buf(mtd, p, eccsize); | ||
300 | chip->ecc.calculate(mtd, p, &chip->oob_poi[i]); | ||
301 | } | ||
302 | |||
303 | chip->write_buf(mtd, chip->oob_poi, mtd->oobsize); | ||
304 | } | ||
305 | |||
306 | #ifdef CONFIG_MTD_CMDLINE_PARTS | 254 | #ifdef CONFIG_MTD_CMDLINE_PARTS |
307 | static const char *part_probes[] = {"cmdline", NULL}; | 255 | static const char *part_probes[] = {"cmdline", NULL}; |
308 | #endif | 256 | #endif |
@@ -393,9 +341,6 @@ static int __devinit jz_nand_probe(struct platform_device *pdev) | |||
393 | chip->ecc.size = 512; | 341 | chip->ecc.size = 512; |
394 | chip->ecc.bytes = 9; | 342 | chip->ecc.bytes = 9; |
395 | 343 | ||
396 | chip->ecc.read_page = jz_nand_read_page_hwecc_oob_first; | ||
397 | chip->ecc.write_page = jz_nand_write_page_hwecc; | ||
398 | |||
399 | if (pdata) | 344 | if (pdata) |
400 | chip->ecc.layout = pdata->ecc_layout; | 345 | chip->ecc.layout = pdata->ecc_layout; |
401 | 346 | ||
@@ -489,7 +434,7 @@ static int __devexit jz_nand_remove(struct platform_device *pdev) | |||
489 | return 0; | 434 | return 0; |
490 | } | 435 | } |
491 | 436 | ||
492 | struct platform_driver jz_nand_driver = { | 437 | static struct platform_driver jz_nand_driver = { |
493 | .probe = jz_nand_probe, | 438 | .probe = jz_nand_probe, |
494 | .remove = __devexit_p(jz_nand_remove), | 439 | .remove = __devexit_p(jz_nand_remove), |
495 | .driver = { | 440 | .driver = { |
diff --git a/drivers/mtd/nand/mxc_nand.c b/drivers/mtd/nand/mxc_nand.c index 214b03afdd48..ef932ba55a0b 100644 --- a/drivers/mtd/nand/mxc_nand.c +++ b/drivers/mtd/nand/mxc_nand.c | |||
@@ -1009,7 +1009,7 @@ static int __init mxcnd_probe(struct platform_device *pdev) | |||
1009 | struct mxc_nand_platform_data *pdata = pdev->dev.platform_data; | 1009 | struct mxc_nand_platform_data *pdata = pdev->dev.platform_data; |
1010 | struct mxc_nand_host *host; | 1010 | struct mxc_nand_host *host; |
1011 | struct resource *res; | 1011 | struct resource *res; |
1012 | int err = 0, nr_parts = 0; | 1012 | int err = 0, __maybe_unused nr_parts = 0; |
1013 | struct nand_ecclayout *oob_smallpage, *oob_largepage; | 1013 | struct nand_ecclayout *oob_smallpage, *oob_largepage; |
1014 | 1014 | ||
1015 | /* Allocate memory for MTD device structure and private data */ | 1015 | /* Allocate memory for MTD device structure and private data */ |
diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c index 31bf376b82a0..a9c6ce745767 100644 --- a/drivers/mtd/nand/nand_base.c +++ b/drivers/mtd/nand/nand_base.c | |||
@@ -2865,20 +2865,24 @@ static int nand_flash_detect_onfi(struct mtd_info *mtd, struct nand_chip *chip, | |||
2865 | 2865 | ||
2866 | /* check version */ | 2866 | /* check version */ |
2867 | val = le16_to_cpu(p->revision); | 2867 | val = le16_to_cpu(p->revision); |
2868 | if (val == 1 || val > (1 << 4)) { | 2868 | if (val & (1 << 5)) |
2869 | printk(KERN_INFO "%s: unsupported ONFI version: %d\n", | 2869 | chip->onfi_version = 23; |
2870 | __func__, val); | 2870 | else if (val & (1 << 4)) |
2871 | return 0; | ||
2872 | } | ||
2873 | |||
2874 | if (val & (1 << 4)) | ||
2875 | chip->onfi_version = 22; | 2871 | chip->onfi_version = 22; |
2876 | else if (val & (1 << 3)) | 2872 | else if (val & (1 << 3)) |
2877 | chip->onfi_version = 21; | 2873 | chip->onfi_version = 21; |
2878 | else if (val & (1 << 2)) | 2874 | else if (val & (1 << 2)) |
2879 | chip->onfi_version = 20; | 2875 | chip->onfi_version = 20; |
2880 | else | 2876 | else if (val & (1 << 1)) |
2881 | chip->onfi_version = 10; | 2877 | chip->onfi_version = 10; |
2878 | else | ||
2879 | chip->onfi_version = 0; | ||
2880 | |||
2881 | if (!chip->onfi_version) { | ||
2882 | printk(KERN_INFO "%s: unsupported ONFI version: %d\n", | ||
2883 | __func__, val); | ||
2884 | return 0; | ||
2885 | } | ||
2882 | 2886 | ||
2883 | sanitize_string(p->manufacturer, sizeof(p->manufacturer)); | 2887 | sanitize_string(p->manufacturer, sizeof(p->manufacturer)); |
2884 | sanitize_string(p->model, sizeof(p->model)); | 2888 | sanitize_string(p->model, sizeof(p->model)); |
@@ -2887,7 +2891,7 @@ static int nand_flash_detect_onfi(struct mtd_info *mtd, struct nand_chip *chip, | |||
2887 | mtd->writesize = le32_to_cpu(p->byte_per_page); | 2891 | mtd->writesize = le32_to_cpu(p->byte_per_page); |
2888 | mtd->erasesize = le32_to_cpu(p->pages_per_block) * mtd->writesize; | 2892 | mtd->erasesize = le32_to_cpu(p->pages_per_block) * mtd->writesize; |
2889 | mtd->oobsize = le16_to_cpu(p->spare_bytes_per_page); | 2893 | mtd->oobsize = le16_to_cpu(p->spare_bytes_per_page); |
2890 | chip->chipsize = le32_to_cpu(p->blocks_per_lun) * mtd->erasesize; | 2894 | chip->chipsize = (uint64_t)le32_to_cpu(p->blocks_per_lun) * mtd->erasesize; |
2891 | busw = 0; | 2895 | busw = 0; |
2892 | if (le16_to_cpu(p->features) & 1) | 2896 | if (le16_to_cpu(p->features) & 1) |
2893 | busw = NAND_BUSWIDTH_16; | 2897 | busw = NAND_BUSWIDTH_16; |
@@ -3157,7 +3161,7 @@ ident_done: | |||
3157 | printk(KERN_INFO "NAND device: Manufacturer ID:" | 3161 | printk(KERN_INFO "NAND device: Manufacturer ID:" |
3158 | " 0x%02x, Chip ID: 0x%02x (%s %s)\n", *maf_id, *dev_id, | 3162 | " 0x%02x, Chip ID: 0x%02x (%s %s)\n", *maf_id, *dev_id, |
3159 | nand_manuf_ids[maf_idx].name, | 3163 | nand_manuf_ids[maf_idx].name, |
3160 | chip->onfi_version ? type->name : chip->onfi_params.model); | 3164 | chip->onfi_version ? chip->onfi_params.model : type->name); |
3161 | 3165 | ||
3162 | return type; | 3166 | return type; |
3163 | } | 3167 | } |
@@ -3435,6 +3439,7 @@ int nand_scan_tail(struct mtd_info *mtd) | |||
3435 | mtd->resume = nand_resume; | 3439 | mtd->resume = nand_resume; |
3436 | mtd->block_isbad = nand_block_isbad; | 3440 | mtd->block_isbad = nand_block_isbad; |
3437 | mtd->block_markbad = nand_block_markbad; | 3441 | mtd->block_markbad = nand_block_markbad; |
3442 | mtd->writebufsize = mtd->writesize; | ||
3438 | 3443 | ||
3439 | /* propagate ecc.layout to mtd_info */ | 3444 | /* propagate ecc.layout to mtd_info */ |
3440 | mtd->ecclayout = chip->ecc.layout; | 3445 | mtd->ecclayout = chip->ecc.layout; |
diff --git a/drivers/mtd/nand/nand_bbt.c b/drivers/mtd/nand/nand_bbt.c index 586b981f0e61..6ebd869993aa 100644 --- a/drivers/mtd/nand/nand_bbt.c +++ b/drivers/mtd/nand/nand_bbt.c | |||
@@ -1092,7 +1092,8 @@ static void mark_bbt_region(struct mtd_info *mtd, struct nand_bbt_descr *td) | |||
1092 | 1092 | ||
1093 | /** | 1093 | /** |
1094 | * verify_bbt_descr - verify the bad block description | 1094 | * verify_bbt_descr - verify the bad block description |
1095 | * @bd: the table to verify | 1095 | * @mtd: MTD device structure |
1096 | * @bd: the table to verify | ||
1096 | * | 1097 | * |
1097 | * This functions performs a few sanity checks on the bad block description | 1098 | * This functions performs a few sanity checks on the bad block description |
1098 | * table. | 1099 | * table. |
diff --git a/drivers/mtd/nand/nandsim.c b/drivers/mtd/nand/nandsim.c index a6a73aab1253..a5aa99f014ba 100644 --- a/drivers/mtd/nand/nandsim.c +++ b/drivers/mtd/nand/nandsim.c | |||
@@ -210,12 +210,12 @@ MODULE_PARM_DESC(bbt, "0 OOB, 1 BBT with marker in OOB, 2 BBT with marker in d | |||
210 | #define STATE_CMD_READ0 0x00000001 /* read data from the beginning of page */ | 210 | #define STATE_CMD_READ0 0x00000001 /* read data from the beginning of page */ |
211 | #define STATE_CMD_READ1 0x00000002 /* read data from the second half of page */ | 211 | #define STATE_CMD_READ1 0x00000002 /* read data from the second half of page */ |
212 | #define STATE_CMD_READSTART 0x00000003 /* read data second command (large page devices) */ | 212 | #define STATE_CMD_READSTART 0x00000003 /* read data second command (large page devices) */ |
213 | #define STATE_CMD_PAGEPROG 0x00000004 /* start page programm */ | 213 | #define STATE_CMD_PAGEPROG 0x00000004 /* start page program */ |
214 | #define STATE_CMD_READOOB 0x00000005 /* read OOB area */ | 214 | #define STATE_CMD_READOOB 0x00000005 /* read OOB area */ |
215 | #define STATE_CMD_ERASE1 0x00000006 /* sector erase first command */ | 215 | #define STATE_CMD_ERASE1 0x00000006 /* sector erase first command */ |
216 | #define STATE_CMD_STATUS 0x00000007 /* read status */ | 216 | #define STATE_CMD_STATUS 0x00000007 /* read status */ |
217 | #define STATE_CMD_STATUS_M 0x00000008 /* read multi-plane status (isn't implemented) */ | 217 | #define STATE_CMD_STATUS_M 0x00000008 /* read multi-plane status (isn't implemented) */ |
218 | #define STATE_CMD_SEQIN 0x00000009 /* sequential data imput */ | 218 | #define STATE_CMD_SEQIN 0x00000009 /* sequential data input */ |
219 | #define STATE_CMD_READID 0x0000000A /* read ID */ | 219 | #define STATE_CMD_READID 0x0000000A /* read ID */ |
220 | #define STATE_CMD_ERASE2 0x0000000B /* sector erase second command */ | 220 | #define STATE_CMD_ERASE2 0x0000000B /* sector erase second command */ |
221 | #define STATE_CMD_RESET 0x0000000C /* reset */ | 221 | #define STATE_CMD_RESET 0x0000000C /* reset */ |
@@ -230,7 +230,7 @@ MODULE_PARM_DESC(bbt, "0 OOB, 1 BBT with marker in OOB, 2 BBT with marker in d | |||
230 | #define STATE_ADDR_ZERO 0x00000040 /* one byte zero address was accepted */ | 230 | #define STATE_ADDR_ZERO 0x00000040 /* one byte zero address was accepted */ |
231 | #define STATE_ADDR_MASK 0x00000070 /* address states mask */ | 231 | #define STATE_ADDR_MASK 0x00000070 /* address states mask */ |
232 | 232 | ||
233 | /* Durind data input/output the simulator is in these states */ | 233 | /* During data input/output the simulator is in these states */ |
234 | #define STATE_DATAIN 0x00000100 /* waiting for data input */ | 234 | #define STATE_DATAIN 0x00000100 /* waiting for data input */ |
235 | #define STATE_DATAIN_MASK 0x00000100 /* data input states mask */ | 235 | #define STATE_DATAIN_MASK 0x00000100 /* data input states mask */ |
236 | 236 | ||
@@ -248,7 +248,7 @@ MODULE_PARM_DESC(bbt, "0 OOB, 1 BBT with marker in OOB, 2 BBT with marker in d | |||
248 | 248 | ||
249 | /* Simulator's actions bit masks */ | 249 | /* Simulator's actions bit masks */ |
250 | #define ACTION_CPY 0x00100000 /* copy page/OOB to the internal buffer */ | 250 | #define ACTION_CPY 0x00100000 /* copy page/OOB to the internal buffer */ |
251 | #define ACTION_PRGPAGE 0x00200000 /* programm the internal buffer to flash */ | 251 | #define ACTION_PRGPAGE 0x00200000 /* program the internal buffer to flash */ |
252 | #define ACTION_SECERASE 0x00300000 /* erase sector */ | 252 | #define ACTION_SECERASE 0x00300000 /* erase sector */ |
253 | #define ACTION_ZEROOFF 0x00400000 /* don't add any offset to address */ | 253 | #define ACTION_ZEROOFF 0x00400000 /* don't add any offset to address */ |
254 | #define ACTION_HALFOFF 0x00500000 /* add to address half of page */ | 254 | #define ACTION_HALFOFF 0x00500000 /* add to address half of page */ |
@@ -263,18 +263,18 @@ MODULE_PARM_DESC(bbt, "0 OOB, 1 BBT with marker in OOB, 2 BBT with marker in d | |||
263 | #define OPT_PAGE512 0x00000002 /* 512-byte page chips */ | 263 | #define OPT_PAGE512 0x00000002 /* 512-byte page chips */ |
264 | #define OPT_PAGE2048 0x00000008 /* 2048-byte page chips */ | 264 | #define OPT_PAGE2048 0x00000008 /* 2048-byte page chips */ |
265 | #define OPT_SMARTMEDIA 0x00000010 /* SmartMedia technology chips */ | 265 | #define OPT_SMARTMEDIA 0x00000010 /* SmartMedia technology chips */ |
266 | #define OPT_AUTOINCR 0x00000020 /* page number auto inctimentation is possible */ | 266 | #define OPT_AUTOINCR 0x00000020 /* page number auto incrementation is possible */ |
267 | #define OPT_PAGE512_8BIT 0x00000040 /* 512-byte page chips with 8-bit bus width */ | 267 | #define OPT_PAGE512_8BIT 0x00000040 /* 512-byte page chips with 8-bit bus width */ |
268 | #define OPT_PAGE4096 0x00000080 /* 4096-byte page chips */ | 268 | #define OPT_PAGE4096 0x00000080 /* 4096-byte page chips */ |
269 | #define OPT_LARGEPAGE (OPT_PAGE2048 | OPT_PAGE4096) /* 2048 & 4096-byte page chips */ | 269 | #define OPT_LARGEPAGE (OPT_PAGE2048 | OPT_PAGE4096) /* 2048 & 4096-byte page chips */ |
270 | #define OPT_SMALLPAGE (OPT_PAGE256 | OPT_PAGE512) /* 256 and 512-byte page chips */ | 270 | #define OPT_SMALLPAGE (OPT_PAGE256 | OPT_PAGE512) /* 256 and 512-byte page chips */ |
271 | 271 | ||
272 | /* Remove action bits ftom state */ | 272 | /* Remove action bits from state */ |
273 | #define NS_STATE(x) ((x) & ~ACTION_MASK) | 273 | #define NS_STATE(x) ((x) & ~ACTION_MASK) |
274 | 274 | ||
275 | /* | 275 | /* |
276 | * Maximum previous states which need to be saved. Currently saving is | 276 | * Maximum previous states which need to be saved. Currently saving is |
277 | * only needed for page programm operation with preceeded read command | 277 | * only needed for page program operation with preceded read command |
278 | * (which is only valid for 512-byte pages). | 278 | * (which is only valid for 512-byte pages). |
279 | */ | 279 | */ |
280 | #define NS_MAX_PREVSTATES 1 | 280 | #define NS_MAX_PREVSTATES 1 |
@@ -380,16 +380,16 @@ static struct nandsim_operations { | |||
380 | /* Read OOB */ | 380 | /* Read OOB */ |
381 | {OPT_SMALLPAGE, {STATE_CMD_READOOB | ACTION_OOBOFF, STATE_ADDR_PAGE | ACTION_CPY, | 381 | {OPT_SMALLPAGE, {STATE_CMD_READOOB | ACTION_OOBOFF, STATE_ADDR_PAGE | ACTION_CPY, |
382 | STATE_DATAOUT, STATE_READY}}, | 382 | STATE_DATAOUT, STATE_READY}}, |
383 | /* Programm page starting from the beginning */ | 383 | /* Program page starting from the beginning */ |
384 | {OPT_ANY, {STATE_CMD_SEQIN, STATE_ADDR_PAGE, STATE_DATAIN, | 384 | {OPT_ANY, {STATE_CMD_SEQIN, STATE_ADDR_PAGE, STATE_DATAIN, |
385 | STATE_CMD_PAGEPROG | ACTION_PRGPAGE, STATE_READY}}, | 385 | STATE_CMD_PAGEPROG | ACTION_PRGPAGE, STATE_READY}}, |
386 | /* Programm page starting from the beginning */ | 386 | /* Program page starting from the beginning */ |
387 | {OPT_SMALLPAGE, {STATE_CMD_READ0, STATE_CMD_SEQIN | ACTION_ZEROOFF, STATE_ADDR_PAGE, | 387 | {OPT_SMALLPAGE, {STATE_CMD_READ0, STATE_CMD_SEQIN | ACTION_ZEROOFF, STATE_ADDR_PAGE, |
388 | STATE_DATAIN, STATE_CMD_PAGEPROG | ACTION_PRGPAGE, STATE_READY}}, | 388 | STATE_DATAIN, STATE_CMD_PAGEPROG | ACTION_PRGPAGE, STATE_READY}}, |
389 | /* Programm page starting from the second half */ | 389 | /* Program page starting from the second half */ |
390 | {OPT_PAGE512, {STATE_CMD_READ1, STATE_CMD_SEQIN | ACTION_HALFOFF, STATE_ADDR_PAGE, | 390 | {OPT_PAGE512, {STATE_CMD_READ1, STATE_CMD_SEQIN | ACTION_HALFOFF, STATE_ADDR_PAGE, |
391 | STATE_DATAIN, STATE_CMD_PAGEPROG | ACTION_PRGPAGE, STATE_READY}}, | 391 | STATE_DATAIN, STATE_CMD_PAGEPROG | ACTION_PRGPAGE, STATE_READY}}, |
392 | /* Programm OOB */ | 392 | /* Program OOB */ |
393 | {OPT_SMALLPAGE, {STATE_CMD_READOOB, STATE_CMD_SEQIN | ACTION_OOBOFF, STATE_ADDR_PAGE, | 393 | {OPT_SMALLPAGE, {STATE_CMD_READOOB, STATE_CMD_SEQIN | ACTION_OOBOFF, STATE_ADDR_PAGE, |
394 | STATE_DATAIN, STATE_CMD_PAGEPROG | ACTION_PRGPAGE, STATE_READY}}, | 394 | STATE_DATAIN, STATE_CMD_PAGEPROG | ACTION_PRGPAGE, STATE_READY}}, |
395 | /* Erase sector */ | 395 | /* Erase sector */ |
@@ -470,7 +470,7 @@ static int alloc_device(struct nandsim *ns) | |||
470 | err = -EINVAL; | 470 | err = -EINVAL; |
471 | goto err_close; | 471 | goto err_close; |
472 | } | 472 | } |
473 | ns->pages_written = vmalloc(ns->geom.pgnum); | 473 | ns->pages_written = vzalloc(ns->geom.pgnum); |
474 | if (!ns->pages_written) { | 474 | if (!ns->pages_written) { |
475 | NS_ERR("alloc_device: unable to allocate pages written array\n"); | 475 | NS_ERR("alloc_device: unable to allocate pages written array\n"); |
476 | err = -ENOMEM; | 476 | err = -ENOMEM; |
@@ -483,7 +483,6 @@ static int alloc_device(struct nandsim *ns) | |||
483 | goto err_free; | 483 | goto err_free; |
484 | } | 484 | } |
485 | ns->cfile = cfile; | 485 | ns->cfile = cfile; |
486 | memset(ns->pages_written, 0, ns->geom.pgnum); | ||
487 | return 0; | 486 | return 0; |
488 | } | 487 | } |
489 | 488 | ||
@@ -1171,9 +1170,9 @@ static inline void switch_to_ready_state(struct nandsim *ns, u_char status) | |||
1171 | * of supported operations. | 1170 | * of supported operations. |
1172 | * | 1171 | * |
1173 | * Operation can be unknown because of the following. | 1172 | * Operation can be unknown because of the following. |
1174 | * 1. New command was accepted and this is the firs call to find the | 1173 | * 1. New command was accepted and this is the first call to find the |
1175 | * correspondent states chain. In this case ns->npstates = 0; | 1174 | * correspondent states chain. In this case ns->npstates = 0; |
1176 | * 2. There is several operations which begin with the same command(s) | 1175 | * 2. There are several operations which begin with the same command(s) |
1177 | * (for example program from the second half and read from the | 1176 | * (for example program from the second half and read from the |
1178 | * second half operations both begin with the READ1 command). In this | 1177 | * second half operations both begin with the READ1 command). In this |
1179 | * case the ns->pstates[] array contains previous states. | 1178 | * case the ns->pstates[] array contains previous states. |
@@ -1186,7 +1185,7 @@ static inline void switch_to_ready_state(struct nandsim *ns, u_char status) | |||
1186 | * ns->ops, ns->state, ns->nxstate are initialized, ns->npstate is | 1185 | * ns->ops, ns->state, ns->nxstate are initialized, ns->npstate is |
1187 | * zeroed). | 1186 | * zeroed). |
1188 | * | 1187 | * |
1189 | * If there are several maches, the current state is pushed to the | 1188 | * If there are several matches, the current state is pushed to the |
1190 | * ns->pstates. | 1189 | * ns->pstates. |
1191 | * | 1190 | * |
1192 | * The operation can be unknown only while commands are input to the chip. | 1191 | * The operation can be unknown only while commands are input to the chip. |
@@ -1195,10 +1194,10 @@ static inline void switch_to_ready_state(struct nandsim *ns, u_char status) | |||
1195 | * operation is searched using the following pattern: | 1194 | * operation is searched using the following pattern: |
1196 | * ns->pstates[0], ... ns->pstates[ns->npstates], <address input> | 1195 | * ns->pstates[0], ... ns->pstates[ns->npstates], <address input> |
1197 | * | 1196 | * |
1198 | * It is supposed that this pattern must either match one operation on | 1197 | * It is supposed that this pattern must either match one operation or |
1199 | * none. There can't be ambiguity in that case. | 1198 | * none. There can't be ambiguity in that case. |
1200 | * | 1199 | * |
1201 | * If no matches found, the functions does the following: | 1200 | * If no matches found, the function does the following: |
1202 | * 1. if there are saved states present, try to ignore them and search | 1201 | * 1. if there are saved states present, try to ignore them and search |
1203 | * again only using the last command. If nothing was found, switch | 1202 | * again only using the last command. If nothing was found, switch |
1204 | * to the STATE_READY state. | 1203 | * to the STATE_READY state. |
@@ -1668,7 +1667,7 @@ static int do_state_action(struct nandsim *ns, uint32_t action) | |||
1668 | 1667 | ||
1669 | case ACTION_PRGPAGE: | 1668 | case ACTION_PRGPAGE: |
1670 | /* | 1669 | /* |
1671 | * Programm page - move internal buffer data to the page. | 1670 | * Program page - move internal buffer data to the page. |
1672 | */ | 1671 | */ |
1673 | 1672 | ||
1674 | if (ns->lines.wp) { | 1673 | if (ns->lines.wp) { |
@@ -1933,7 +1932,7 @@ static u_char ns_nand_read_byte(struct mtd_info *mtd) | |||
1933 | NS_DBG("read_byte: all bytes were read\n"); | 1932 | NS_DBG("read_byte: all bytes were read\n"); |
1934 | 1933 | ||
1935 | /* | 1934 | /* |
1936 | * The OPT_AUTOINCR allows to read next conseqitive pages without | 1935 | * The OPT_AUTOINCR allows to read next consecutive pages without |
1937 | * new read operation cycle. | 1936 | * new read operation cycle. |
1938 | */ | 1937 | */ |
1939 | if ((ns->options & OPT_AUTOINCR) && NS_STATE(ns->state) == STATE_DATAOUT) { | 1938 | if ((ns->options & OPT_AUTOINCR) && NS_STATE(ns->state) == STATE_DATAOUT) { |
diff --git a/drivers/mtd/nand/pasemi_nand.c b/drivers/mtd/nand/pasemi_nand.c index 6ddb2461d740..bb277a54986f 100644 --- a/drivers/mtd/nand/pasemi_nand.c +++ b/drivers/mtd/nand/pasemi_nand.c | |||
@@ -107,7 +107,7 @@ static int __devinit pasemi_nand_probe(struct platform_device *ofdev, | |||
107 | if (pasemi_nand_mtd) | 107 | if (pasemi_nand_mtd) |
108 | return -ENODEV; | 108 | return -ENODEV; |
109 | 109 | ||
110 | pr_debug("pasemi_nand at %llx-%llx\n", res.start, res.end); | 110 | pr_debug("pasemi_nand at %pR\n", &res); |
111 | 111 | ||
112 | /* Allocate memory for MTD device structure and private data */ | 112 | /* Allocate memory for MTD device structure and private data */ |
113 | pasemi_nand_mtd = kzalloc(sizeof(struct mtd_info) + | 113 | pasemi_nand_mtd = kzalloc(sizeof(struct mtd_info) + |
diff --git a/drivers/mtd/nand/pxa3xx_nand.c b/drivers/mtd/nand/pxa3xx_nand.c index 17f8518cc5eb..ea2c288df3f6 100644 --- a/drivers/mtd/nand/pxa3xx_nand.c +++ b/drivers/mtd/nand/pxa3xx_nand.c | |||
@@ -885,6 +885,7 @@ static int pxa3xx_nand_detect_config(struct pxa3xx_nand_info *info) | |||
885 | /* set info fields needed to __readid */ | 885 | /* set info fields needed to __readid */ |
886 | info->read_id_bytes = (info->page_size == 2048) ? 4 : 2; | 886 | info->read_id_bytes = (info->page_size == 2048) ? 4 : 2; |
887 | info->reg_ndcr = ndcr; | 887 | info->reg_ndcr = ndcr; |
888 | info->cmdset = &default_cmdset; | ||
888 | 889 | ||
889 | if (__readid(info, &id)) | 890 | if (__readid(info, &id)) |
890 | return -ENODEV; | 891 | return -ENODEV; |
@@ -915,7 +916,6 @@ static int pxa3xx_nand_detect_config(struct pxa3xx_nand_info *info) | |||
915 | 916 | ||
916 | info->ndtr0cs0 = nand_readl(info, NDTR0CS0); | 917 | info->ndtr0cs0 = nand_readl(info, NDTR0CS0); |
917 | info->ndtr1cs0 = nand_readl(info, NDTR1CS0); | 918 | info->ndtr1cs0 = nand_readl(info, NDTR1CS0); |
918 | info->cmdset = &default_cmdset; | ||
919 | 919 | ||
920 | return 0; | 920 | return 0; |
921 | } | 921 | } |
diff --git a/drivers/mtd/nand/txx9ndfmc.c b/drivers/mtd/nand/txx9ndfmc.c index 054a41c0ef4a..ca270a4881a4 100644 --- a/drivers/mtd/nand/txx9ndfmc.c +++ b/drivers/mtd/nand/txx9ndfmc.c | |||
@@ -277,8 +277,9 @@ static int txx9ndfmc_nand_scan(struct mtd_info *mtd) | |||
277 | ret = nand_scan_ident(mtd, 1, NULL); | 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 | /* Hardware ECC 6 byte ECC per 512 Byte data */ |
281 | chip->ecc.bytes = 3 * (mtd->writesize / 256); | 281 | chip->ecc.size = 512; |
282 | chip->ecc.bytes = 6; | ||
282 | } | 283 | } |
283 | ret = nand_scan_tail(mtd); | 284 | ret = nand_scan_tail(mtd); |
284 | } | 285 | } |