Root/target/linux/lantiq/patches-3.3/0006-mtd-support.patch

1From 4bd56362cd1780530d981e2e9f3793c4d7da7e02 Mon Sep 17 00:00:00 2001
2From: John Crispin <blogic@openwrt.org>
3Date: Fri, 3 Aug 2012 09:53:27 +0200
4Subject: [PATCH 06/25] mtd support
5
6---
7 drivers/mtd/devices/m25p80.c | 1 +
8 drivers/mtd/maps/lantiq-flash.c | 22 +++-------------------
9 drivers/mtd/nand/plat_nand.c | 1 +
10 include/linux/mtd/nand.h | 1 +
11 4 files changed, 6 insertions(+), 19 deletions(-)
12
13diff --git a/drivers/mtd/devices/m25p80.c b/drivers/mtd/devices/m25p80.c
14index b06f46c..33bfd9b 100644
15--- a/drivers/mtd/devices/m25p80.c
16+++ b/drivers/mtd/devices/m25p80.c
17@@ -684,6 +684,7 @@ static const struct spi_device_id m25p_ids[] = {
18     { "640s33b", INFO(0x898913, 0, 64 * 1024, 128, 0) },
19 
20     /* Macronix */
21+ { "mx25l2005a", INFO(0xc22012, 0, 64 * 1024, 8, SECT_4K) },
22     { "mx25l4005a", INFO(0xc22013, 0, 64 * 1024, 8, SECT_4K) },
23     { "mx25l8005", INFO(0xc22014, 0, 64 * 1024, 16, 0) },
24     { "mx25l1606e", INFO(0xc22015, 0, 64 * 1024, 32, SECT_4K) },
25diff --git a/drivers/mtd/maps/lantiq-flash.c b/drivers/mtd/maps/lantiq-flash.c
26index cf7a3cd..ccc6954 100644
27--- a/drivers/mtd/maps/lantiq-flash.c
28+++ b/drivers/mtd/maps/lantiq-flash.c
29@@ -108,7 +108,7 @@ ltq_copy_to(struct map_info *map, unsigned long to,
30     spin_unlock_irqrestore(&ebu_lock, flags);
31 }
32 
33-static int __init
34+static int __devinit
35 ltq_mtd_probe(struct platform_device *pdev)
36 {
37     struct physmap_flash_data *ltq_mtd_data = dev_get_platdata(&pdev->dev);
38@@ -204,6 +204,7 @@ ltq_mtd_remove(struct platform_device *pdev)
39 }
40 
41 static struct platform_driver ltq_mtd_driver = {
42+ .probe = ltq_mtd_probe,
43     .remove = __devexit_p(ltq_mtd_remove),
44     .driver = {
45         .name = "ltq_nor",
46@@ -211,24 +212,7 @@ static struct platform_driver ltq_mtd_driver = {
47     },
48 };
49 
50-static int __init
51-init_ltq_mtd(void)
52-{
53- int ret = platform_driver_probe(&ltq_mtd_driver, ltq_mtd_probe);
54-
55- if (ret)
56- pr_err("ltq_nor: error registering platform driver");
57- return ret;
58-}
59-
60-static void __exit
61-exit_ltq_mtd(void)
62-{
63- platform_driver_unregister(&ltq_mtd_driver);
64-}
65-
66-module_init(init_ltq_mtd);
67-module_exit(exit_ltq_mtd);
68+module_platform_driver(ltq_mtd_driver);
69 
70 MODULE_LICENSE("GPL");
71 MODULE_AUTHOR("John Crispin <blogic@openwrt.org>");
72diff --git a/drivers/mtd/nand/plat_nand.c b/drivers/mtd/nand/plat_nand.c
73index 10f142d..4cb118b 100644
74--- a/drivers/mtd/nand/plat_nand.c
75+++ b/drivers/mtd/nand/plat_nand.c
76@@ -75,6 +75,7 @@ static int __devinit plat_nand_probe(struct platform_device *pdev)
77     data->chip.select_chip = pdata->ctrl.select_chip;
78     data->chip.write_buf = pdata->ctrl.write_buf;
79     data->chip.read_buf = pdata->ctrl.read_buf;
80+ data->chip.read_byte = pdata->ctrl.read_byte;
81     data->chip.chip_delay = pdata->chip.chip_delay;
82     data->chip.options |= pdata->chip.options;
83     data->chip.bbt_options |= pdata->chip.bbt_options;
84diff --git a/include/linux/mtd/nand.h b/include/linux/mtd/nand.h
85index c2761fd..5e44cda 100644
86--- a/include/linux/mtd/nand.h
87+++ b/include/linux/mtd/nand.h
88@@ -652,6 +652,7 @@ struct platform_nand_ctrl {
89     void (*cmd_ctrl)(struct mtd_info *mtd, int dat, unsigned int ctrl);
90     void (*write_buf)(struct mtd_info *mtd, const uint8_t *buf, int len);
91     void (*read_buf)(struct mtd_info *mtd, uint8_t *buf, int len);
92+ unsigned char (*read_byte)(struct mtd_info *mtd);
93     void *priv;
94 };
95 
96--
971.7.9.1
98
99

Archive Download this file



interactive