diff options
Diffstat (limited to 'drivers/mtd')
-rw-r--r-- | drivers/mtd/maps/pismo.c | 2 | ||||
-rw-r--r-- | drivers/mtd/mtdchar.c | 11 | ||||
-rw-r--r-- | drivers/mtd/nand/Kconfig | 21 | ||||
-rw-r--r-- | drivers/mtd/nand/fsl_upm.c | 17 | ||||
-rw-r--r-- | drivers/mtd/nand/mpc5121_nfc.c | 8 | ||||
-rw-r--r-- | drivers/mtd/nand/r852.c | 27 | ||||
-rw-r--r-- | drivers/mtd/nand/socrates_nand.c | 4 |
7 files changed, 47 insertions, 43 deletions
diff --git a/drivers/mtd/maps/pismo.c b/drivers/mtd/maps/pismo.c index eb476b7f8d11..f4ce273e93fd 100644 --- a/drivers/mtd/maps/pismo.c +++ b/drivers/mtd/maps/pismo.c | |||
@@ -234,7 +234,6 @@ static int __devexit pismo_remove(struct i2c_client *client) | |||
234 | /* FIXME: set_vpp needs saner arguments */ | 234 | /* FIXME: set_vpp needs saner arguments */ |
235 | pismo_setvpp_remove_fix(pismo); | 235 | pismo_setvpp_remove_fix(pismo); |
236 | 236 | ||
237 | i2c_set_clientdata(client, NULL); | ||
238 | kfree(pismo); | 237 | kfree(pismo); |
239 | 238 | ||
240 | return 0; | 239 | return 0; |
@@ -286,7 +285,6 @@ static int __devinit pismo_probe(struct i2c_client *client, | |||
286 | return 0; | 285 | return 0; |
287 | 286 | ||
288 | exit_free: | 287 | exit_free: |
289 | i2c_set_clientdata(client, NULL); | ||
290 | kfree(pismo); | 288 | kfree(pismo); |
291 | return ret; | 289 | return ret; |
292 | } | 290 | } |
diff --git a/drivers/mtd/mtdchar.c b/drivers/mtd/mtdchar.c index 000d65ea55a4..91c8013cf0d9 100644 --- a/drivers/mtd/mtdchar.c +++ b/drivers/mtd/mtdchar.c | |||
@@ -404,14 +404,9 @@ static int mtd_do_writeoob(struct file *file, struct mtd_info *mtd, | |||
404 | if (ops.ooboffs && ops.ooblen > (mtd->oobsize - ops.ooboffs)) | 404 | if (ops.ooboffs && ops.ooblen > (mtd->oobsize - ops.ooboffs)) |
405 | return -EINVAL; | 405 | return -EINVAL; |
406 | 406 | ||
407 | ops.oobbuf = kmalloc(length, GFP_KERNEL); | 407 | ops.oobbuf = memdup_user(ptr, length); |
408 | if (!ops.oobbuf) | 408 | if (IS_ERR(ops.oobbuf)) |
409 | return -ENOMEM; | 409 | return PTR_ERR(ops.oobbuf); |
410 | |||
411 | if (copy_from_user(ops.oobbuf, ptr, length)) { | ||
412 | kfree(ops.oobbuf); | ||
413 | return -EFAULT; | ||
414 | } | ||
415 | 410 | ||
416 | start &= ~((uint64_t)mtd->oobsize - 1); | 411 | start &= ~((uint64_t)mtd->oobsize - 1); |
417 | ret = mtd->write_oob(mtd, start, &ops); | 412 | ret = mtd->write_oob(mtd, start, &ops); |
diff --git a/drivers/mtd/nand/Kconfig b/drivers/mtd/nand/Kconfig index 98a04b3c9526..ffc3720929f1 100644 --- a/drivers/mtd/nand/Kconfig +++ b/drivers/mtd/nand/Kconfig | |||
@@ -1,13 +1,3 @@ | |||
1 | menuconfig MTD_NAND | ||
2 | tristate "NAND Device Support" | ||
3 | depends on MTD | ||
4 | select MTD_NAND_IDS | ||
5 | select MTD_NAND_ECC | ||
6 | help | ||
7 | This enables support for accessing all type of NAND flash | ||
8 | devices. For further information see | ||
9 | <http://www.linux-mtd.infradead.org/doc/nand.html>. | ||
10 | |||
11 | config MTD_NAND_ECC | 1 | config MTD_NAND_ECC |
12 | tristate | 2 | tristate |
13 | 3 | ||
@@ -19,6 +9,17 @@ config MTD_NAND_ECC_SMC | |||
19 | Software ECC according to the Smart Media Specification. | 9 | Software ECC according to the Smart Media Specification. |
20 | The original Linux implementation had byte 0 and 1 swapped. | 10 | The original Linux implementation had byte 0 and 1 swapped. |
21 | 11 | ||
12 | |||
13 | menuconfig MTD_NAND | ||
14 | tristate "NAND Device Support" | ||
15 | depends on MTD | ||
16 | select MTD_NAND_IDS | ||
17 | select MTD_NAND_ECC | ||
18 | help | ||
19 | This enables support for accessing all type of NAND flash | ||
20 | devices. For further information see | ||
21 | <http://www.linux-mtd.infradead.org/doc/nand.html>. | ||
22 | |||
22 | if MTD_NAND | 23 | if MTD_NAND |
23 | 24 | ||
24 | config MTD_NAND_VERIFY_WRITE | 25 | config MTD_NAND_VERIFY_WRITE |
diff --git a/drivers/mtd/nand/fsl_upm.c b/drivers/mtd/nand/fsl_upm.c index 00aea6f7d1f1..1312eda57ba6 100644 --- a/drivers/mtd/nand/fsl_upm.c +++ b/drivers/mtd/nand/fsl_upm.c | |||
@@ -232,7 +232,7 @@ static int __devinit fun_probe(struct of_device *ofdev, | |||
232 | if (!fun) | 232 | if (!fun) |
233 | return -ENOMEM; | 233 | return -ENOMEM; |
234 | 234 | ||
235 | ret = of_address_to_resource(ofdev->node, 0, &io_res); | 235 | ret = of_address_to_resource(ofdev->dev.of_node, 0, &io_res); |
236 | if (ret) { | 236 | if (ret) { |
237 | dev_err(&ofdev->dev, "can't get IO base\n"); | 237 | dev_err(&ofdev->dev, "can't get IO base\n"); |
238 | goto err1; | 238 | goto err1; |
@@ -244,7 +244,8 @@ static int __devinit fun_probe(struct of_device *ofdev, | |||
244 | goto err1; | 244 | goto err1; |
245 | } | 245 | } |
246 | 246 | ||
247 | prop = of_get_property(ofdev->node, "fsl,upm-addr-offset", &size); | 247 | prop = of_get_property(ofdev->dev.of_node, "fsl,upm-addr-offset", |
248 | &size); | ||
248 | if (!prop || size != sizeof(uint32_t)) { | 249 | if (!prop || size != sizeof(uint32_t)) { |
249 | dev_err(&ofdev->dev, "can't get UPM address offset\n"); | 250 | dev_err(&ofdev->dev, "can't get UPM address offset\n"); |
250 | ret = -EINVAL; | 251 | ret = -EINVAL; |
@@ -252,7 +253,7 @@ static int __devinit fun_probe(struct of_device *ofdev, | |||
252 | } | 253 | } |
253 | fun->upm_addr_offset = *prop; | 254 | fun->upm_addr_offset = *prop; |
254 | 255 | ||
255 | prop = of_get_property(ofdev->node, "fsl,upm-cmd-offset", &size); | 256 | prop = of_get_property(ofdev->dev.of_node, "fsl,upm-cmd-offset", &size); |
256 | if (!prop || size != sizeof(uint32_t)) { | 257 | if (!prop || size != sizeof(uint32_t)) { |
257 | dev_err(&ofdev->dev, "can't get UPM command offset\n"); | 258 | dev_err(&ofdev->dev, "can't get UPM command offset\n"); |
258 | ret = -EINVAL; | 259 | ret = -EINVAL; |
@@ -260,7 +261,7 @@ static int __devinit fun_probe(struct of_device *ofdev, | |||
260 | } | 261 | } |
261 | fun->upm_cmd_offset = *prop; | 262 | fun->upm_cmd_offset = *prop; |
262 | 263 | ||
263 | prop = of_get_property(ofdev->node, | 264 | prop = of_get_property(ofdev->dev.of_node, |
264 | "fsl,upm-addr-line-cs-offsets", &size); | 265 | "fsl,upm-addr-line-cs-offsets", &size); |
265 | if (prop && (size / sizeof(uint32_t)) > 0) { | 266 | if (prop && (size / sizeof(uint32_t)) > 0) { |
266 | fun->mchip_count = size / sizeof(uint32_t); | 267 | fun->mchip_count = size / sizeof(uint32_t); |
@@ -276,7 +277,7 @@ static int __devinit fun_probe(struct of_device *ofdev, | |||
276 | 277 | ||
277 | for (i = 0; i < fun->mchip_count; i++) { | 278 | for (i = 0; i < fun->mchip_count; i++) { |
278 | fun->rnb_gpio[i] = -1; | 279 | fun->rnb_gpio[i] = -1; |
279 | rnb_gpio = of_get_gpio(ofdev->node, i); | 280 | rnb_gpio = of_get_gpio(ofdev->dev.of_node, i); |
280 | if (rnb_gpio >= 0) { | 281 | if (rnb_gpio >= 0) { |
281 | ret = gpio_request(rnb_gpio, dev_name(&ofdev->dev)); | 282 | ret = gpio_request(rnb_gpio, dev_name(&ofdev->dev)); |
282 | if (ret) { | 283 | if (ret) { |
@@ -292,13 +293,13 @@ static int __devinit fun_probe(struct of_device *ofdev, | |||
292 | } | 293 | } |
293 | } | 294 | } |
294 | 295 | ||
295 | prop = of_get_property(ofdev->node, "chip-delay", NULL); | 296 | prop = of_get_property(ofdev->dev.of_node, "chip-delay", NULL); |
296 | if (prop) | 297 | if (prop) |
297 | fun->chip_delay = *prop; | 298 | fun->chip_delay = *prop; |
298 | else | 299 | else |
299 | fun->chip_delay = 50; | 300 | fun->chip_delay = 50; |
300 | 301 | ||
301 | prop = of_get_property(ofdev->node, "fsl,upm-wait-flags", &size); | 302 | prop = of_get_property(ofdev->dev.of_node, "fsl,upm-wait-flags", &size); |
302 | if (prop && size == sizeof(uint32_t)) | 303 | if (prop && size == sizeof(uint32_t)) |
303 | fun->wait_flags = *prop; | 304 | fun->wait_flags = *prop; |
304 | else | 305 | else |
@@ -315,7 +316,7 @@ static int __devinit fun_probe(struct of_device *ofdev, | |||
315 | fun->dev = &ofdev->dev; | 316 | fun->dev = &ofdev->dev; |
316 | fun->last_ctrl = NAND_CLE; | 317 | fun->last_ctrl = NAND_CLE; |
317 | 318 | ||
318 | ret = fun_chip_init(fun, ofdev->node, &io_res); | 319 | ret = fun_chip_init(fun, ofdev->dev.of_node, &io_res); |
319 | if (ret) | 320 | if (ret) |
320 | goto err2; | 321 | goto err2; |
321 | 322 | ||
diff --git a/drivers/mtd/nand/mpc5121_nfc.c b/drivers/mtd/nand/mpc5121_nfc.c index 3d0867d829cb..0a130dcaa129 100644 --- a/drivers/mtd/nand/mpc5121_nfc.c +++ b/drivers/mtd/nand/mpc5121_nfc.c | |||
@@ -650,7 +650,7 @@ static void mpc5121_nfc_free(struct device *dev, struct mtd_info *mtd) | |||
650 | static int __devinit mpc5121_nfc_probe(struct of_device *op, | 650 | static int __devinit mpc5121_nfc_probe(struct of_device *op, |
651 | const struct of_device_id *match) | 651 | const struct of_device_id *match) |
652 | { | 652 | { |
653 | struct device_node *rootnode, *dn = op->node; | 653 | struct device_node *rootnode, *dn = op->dev.of_node; |
654 | struct device *dev = &op->dev; | 654 | struct device *dev = &op->dev; |
655 | struct mpc5121_nfc_prv *prv; | 655 | struct mpc5121_nfc_prv *prv; |
656 | struct resource res; | 656 | struct resource res; |
@@ -889,12 +889,12 @@ static struct of_device_id mpc5121_nfc_match[] __devinitdata = { | |||
889 | }; | 889 | }; |
890 | 890 | ||
891 | static struct of_platform_driver mpc5121_nfc_driver = { | 891 | static struct of_platform_driver mpc5121_nfc_driver = { |
892 | .match_table = mpc5121_nfc_match, | ||
893 | .probe = mpc5121_nfc_probe, | 892 | .probe = mpc5121_nfc_probe, |
894 | .remove = __devexit_p(mpc5121_nfc_remove), | 893 | .remove = __devexit_p(mpc5121_nfc_remove), |
895 | .driver = { | 894 | .driver = { |
896 | .name = DRV_NAME, | 895 | .name = DRV_NAME, |
897 | .owner = THIS_MODULE, | 896 | .owner = THIS_MODULE, |
897 | .of_match_table = mpc5121_nfc_match, | ||
898 | }, | 898 | }, |
899 | }; | 899 | }; |
900 | 900 | ||
diff --git a/drivers/mtd/nand/r852.c b/drivers/mtd/nand/r852.c index 78a423295474..bcfc851fe550 100644 --- a/drivers/mtd/nand/r852.c +++ b/drivers/mtd/nand/r852.c | |||
@@ -150,7 +150,6 @@ static void r852_dma_done(struct r852_device *dev, int error) | |||
150 | if (dev->phys_dma_addr && dev->phys_dma_addr != dev->phys_bounce_buffer) | 150 | if (dev->phys_dma_addr && dev->phys_dma_addr != dev->phys_bounce_buffer) |
151 | pci_unmap_single(dev->pci_dev, dev->phys_dma_addr, R852_DMA_LEN, | 151 | pci_unmap_single(dev->pci_dev, dev->phys_dma_addr, R852_DMA_LEN, |
152 | dev->dma_dir ? PCI_DMA_FROMDEVICE : PCI_DMA_TODEVICE); | 152 | dev->dma_dir ? PCI_DMA_FROMDEVICE : PCI_DMA_TODEVICE); |
153 | complete(&dev->dma_done); | ||
154 | } | 153 | } |
155 | 154 | ||
156 | /* | 155 | /* |
@@ -182,6 +181,7 @@ static void r852_do_dma(struct r852_device *dev, uint8_t *buf, int do_read) | |||
182 | /* Set dma direction */ | 181 | /* Set dma direction */ |
183 | dev->dma_dir = do_read; | 182 | dev->dma_dir = do_read; |
184 | dev->dma_stage = 1; | 183 | dev->dma_stage = 1; |
184 | INIT_COMPLETION(dev->dma_done); | ||
185 | 185 | ||
186 | dbg_verbose("doing dma %s ", do_read ? "read" : "write"); | 186 | dbg_verbose("doing dma %s ", do_read ? "read" : "write"); |
187 | 187 | ||
@@ -494,6 +494,11 @@ int r852_ecc_correct(struct mtd_info *mtd, uint8_t *dat, | |||
494 | if (dev->card_unstable) | 494 | if (dev->card_unstable) |
495 | return 0; | 495 | return 0; |
496 | 496 | ||
497 | if (dev->dma_error) { | ||
498 | dev->dma_error = 0; | ||
499 | return -1; | ||
500 | } | ||
501 | |||
497 | r852_write_reg(dev, R852_CTL, dev->ctlreg | R852_CTL_ECC_ACCESS); | 502 | r852_write_reg(dev, R852_CTL, dev->ctlreg | R852_CTL_ECC_ACCESS); |
498 | ecc_reg = r852_read_reg_dword(dev, R852_DATALINE); | 503 | ecc_reg = r852_read_reg_dword(dev, R852_DATALINE); |
499 | r852_write_reg(dev, R852_CTL, dev->ctlreg); | 504 | r852_write_reg(dev, R852_CTL, dev->ctlreg); |
@@ -707,6 +712,7 @@ void r852_card_detect_work(struct work_struct *work) | |||
707 | container_of(work, struct r852_device, card_detect_work.work); | 712 | container_of(work, struct r852_device, card_detect_work.work); |
708 | 713 | ||
709 | r852_card_update_present(dev); | 714 | r852_card_update_present(dev); |
715 | r852_update_card_detect(dev); | ||
710 | dev->card_unstable = 0; | 716 | dev->card_unstable = 0; |
711 | 717 | ||
712 | /* False alarm */ | 718 | /* False alarm */ |
@@ -722,7 +728,6 @@ void r852_card_detect_work(struct work_struct *work) | |||
722 | else | 728 | else |
723 | r852_unregister_nand_device(dev); | 729 | r852_unregister_nand_device(dev); |
724 | exit: | 730 | exit: |
725 | /* Update detection logic */ | ||
726 | r852_update_card_detect(dev); | 731 | r852_update_card_detect(dev); |
727 | } | 732 | } |
728 | 733 | ||
@@ -796,6 +801,7 @@ static irqreturn_t r852_irq(int irq, void *data) | |||
796 | if (dma_status & R852_DMA_IRQ_ERROR) { | 801 | if (dma_status & R852_DMA_IRQ_ERROR) { |
797 | dbg("recieved dma error IRQ"); | 802 | dbg("recieved dma error IRQ"); |
798 | r852_dma_done(dev, -EIO); | 803 | r852_dma_done(dev, -EIO); |
804 | complete(&dev->dma_done); | ||
799 | goto out; | 805 | goto out; |
800 | } | 806 | } |
801 | 807 | ||
@@ -825,8 +831,10 @@ static irqreturn_t r852_irq(int irq, void *data) | |||
825 | r852_dma_enable(dev); | 831 | r852_dma_enable(dev); |
826 | 832 | ||
827 | /* Operation done */ | 833 | /* Operation done */ |
828 | if (dev->dma_stage == 3) | 834 | if (dev->dma_stage == 3) { |
829 | r852_dma_done(dev, 0); | 835 | r852_dma_done(dev, 0); |
836 | complete(&dev->dma_done); | ||
837 | } | ||
830 | goto out; | 838 | goto out; |
831 | } | 839 | } |
832 | 840 | ||
@@ -940,18 +948,19 @@ int r852_probe(struct pci_dev *pci_dev, const struct pci_device_id *id) | |||
940 | 948 | ||
941 | r852_dma_test(dev); | 949 | r852_dma_test(dev); |
942 | 950 | ||
951 | dev->irq = pci_dev->irq; | ||
952 | spin_lock_init(&dev->irqlock); | ||
953 | |||
954 | dev->card_detected = 0; | ||
955 | r852_card_update_present(dev); | ||
956 | |||
943 | /*register irq handler*/ | 957 | /*register irq handler*/ |
944 | error = -ENODEV; | 958 | error = -ENODEV; |
945 | if (request_irq(pci_dev->irq, &r852_irq, IRQF_SHARED, | 959 | if (request_irq(pci_dev->irq, &r852_irq, IRQF_SHARED, |
946 | DRV_NAME, dev)) | 960 | DRV_NAME, dev)) |
947 | goto error10; | 961 | goto error10; |
948 | 962 | ||
949 | dev->irq = pci_dev->irq; | ||
950 | spin_lock_init(&dev->irqlock); | ||
951 | |||
952 | /* kick initial present test */ | 963 | /* kick initial present test */ |
953 | dev->card_detected = 0; | ||
954 | r852_card_update_present(dev); | ||
955 | queue_delayed_work(dev->card_workqueue, | 964 | queue_delayed_work(dev->card_workqueue, |
956 | &dev->card_detect_work, 0); | 965 | &dev->card_detect_work, 0); |
957 | 966 | ||
@@ -1081,7 +1090,7 @@ int r852_resume(struct device *device) | |||
1081 | dev->card_detected ? "added" : "removed"); | 1090 | dev->card_detected ? "added" : "removed"); |
1082 | 1091 | ||
1083 | queue_delayed_work(dev->card_workqueue, | 1092 | queue_delayed_work(dev->card_workqueue, |
1084 | &dev->card_detect_work, 1000); | 1093 | &dev->card_detect_work, msecs_to_jiffies(1000)); |
1085 | return 0; | 1094 | return 0; |
1086 | } | 1095 | } |
1087 | 1096 | ||
diff --git a/drivers/mtd/nand/socrates_nand.c b/drivers/mtd/nand/socrates_nand.c index 884852dc7eb4..cc728b12de82 100644 --- a/drivers/mtd/nand/socrates_nand.c +++ b/drivers/mtd/nand/socrates_nand.c | |||
@@ -183,7 +183,7 @@ static int __devinit socrates_nand_probe(struct of_device *ofdev, | |||
183 | return -ENOMEM; | 183 | return -ENOMEM; |
184 | } | 184 | } |
185 | 185 | ||
186 | host->io_base = of_iomap(ofdev->node, 0); | 186 | host->io_base = of_iomap(ofdev->dev.of_node, 0); |
187 | if (host->io_base == NULL) { | 187 | if (host->io_base == NULL) { |
188 | printk(KERN_ERR "socrates_nand: ioremap failed\n"); | 188 | printk(KERN_ERR "socrates_nand: ioremap failed\n"); |
189 | kfree(host); | 189 | kfree(host); |
@@ -244,7 +244,7 @@ static int __devinit socrates_nand_probe(struct of_device *ofdev, | |||
244 | #ifdef CONFIG_MTD_OF_PARTS | 244 | #ifdef CONFIG_MTD_OF_PARTS |
245 | if (num_partitions == 0) { | 245 | if (num_partitions == 0) { |
246 | num_partitions = of_mtd_parse_partitions(&ofdev->dev, | 246 | num_partitions = of_mtd_parse_partitions(&ofdev->dev, |
247 | ofdev->node, | 247 | ofdev->dev.of_node, |
248 | &partitions); | 248 | &partitions); |
249 | if (num_partitions < 0) { | 249 | if (num_partitions < 0) { |
250 | res = num_partitions; | 250 | res = num_partitions; |