diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2013-09-09 13:33:19 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2013-09-09 13:33:19 -0400 |
commit | ef9a61bef917e38f8e096f6df303329aed6cf467 (patch) | |
tree | 31cfe2444d0270e77ff8ef792df11591fed6075c /drivers/mtd/maps | |
parent | b5f0998cae3d7ea56d3d8377e46328fe972b9546 (diff) | |
parent | 6c3b88970175e18a67eb8e55c4eba10614d0d5dc (diff) |
Merge tag 'for-linus-20130909' of git://git.infradead.org/linux-mtd
Pull mtd updates from David Woodhouse:
- factor out common code from MTD tests
- nand-gpio cleanup and portability to non-ARM
- m25p80 support for 4-byte addressing chips, other new chips
- pxa3xx cleanup and support for new platforms
- remove obsolete alauda, octagon-5066 drivers
- erase/write support for bcm47xxsflash
- improve detection of ECC requirements for NAND, controller setup
- NFC acceleration support for atmel-nand, read/write via SRAM
- etc
* tag 'for-linus-20130909' of git://git.infradead.org/linux-mtd: (184 commits)
mtd: chips: Add support for PMC SPI Flash chips in m25p80.c
mtd: ofpart: use for_each_child_of_node() macro
mtd: mtdswap: replace strict_strtoul() with kstrtoul()
mtd cs553x_nand: use kzalloc() instead of memset
mtd: atmel_nand: fix error return code in atmel_nand_probe()
mtd: bcm47xxsflash: writing support
mtd: bcm47xxsflash: implement erasing support
mtd: bcm47xxsflash: convert to module_platform_driver instead of init/exit
mtd: bcm47xxsflash: convert kzalloc to avoid invalid access
mtd: remove alauda driver
mtd: nand: mxc_nand: mark 'const' properly
mtd: maps: cfi_flagadm: add missing __iomem annotation
mtd: spear_smi: add missing __iomem annotation
mtd: r852: Staticize local symbols
mtd: nandsim: Staticize local symbols
mtd: impa7: add missing __iomem annotation
mtd: sm_ftl: Staticize local symbols
mtd: m25p80: add support for mr25h10
mtd: m25p80: make CONFIG_M25PXX_USE_FAST_READ safe to enable
mtd: m25p80: Pass flags through CAT25_INFO macro
...
Diffstat (limited to 'drivers/mtd/maps')
-rw-r--r-- | drivers/mtd/maps/Kconfig | 18 | ||||
-rw-r--r-- | drivers/mtd/maps/Makefile | 2 | ||||
-rw-r--r-- | drivers/mtd/maps/bfin-async-flash.c | 2 | ||||
-rw-r--r-- | drivers/mtd/maps/cfi_flagadm.c | 10 | ||||
-rw-r--r-- | drivers/mtd/maps/gpio-addr-flash.c | 2 | ||||
-rw-r--r-- | drivers/mtd/maps/impa7.c | 10 | ||||
-rw-r--r-- | drivers/mtd/maps/ixp4xx.c | 6 | ||||
-rw-r--r-- | drivers/mtd/maps/latch-addr-flash.c | 5 | ||||
-rw-r--r-- | drivers/mtd/maps/octagon-5066.c | 246 | ||||
-rw-r--r-- | drivers/mtd/maps/physmap.c | 7 | ||||
-rw-r--r-- | drivers/mtd/maps/plat-ram.c | 6 | ||||
-rw-r--r-- | drivers/mtd/maps/pxa2xx-flash.c | 4 | ||||
-rw-r--r-- | drivers/mtd/maps/rbtx4939-flash.c | 5 | ||||
-rw-r--r-- | drivers/mtd/maps/sa1100-flash.c | 5 | ||||
-rw-r--r-- | drivers/mtd/maps/vmax301.c | 196 |
15 files changed, 26 insertions, 498 deletions
diff --git a/drivers/mtd/maps/Kconfig b/drivers/mtd/maps/Kconfig index 8b27ca054c59..310dc7c93425 100644 --- a/drivers/mtd/maps/Kconfig +++ b/drivers/mtd/maps/Kconfig | |||
@@ -157,24 +157,6 @@ config MTD_PXA2XX | |||
157 | help | 157 | help |
158 | This provides a driver for the NOR flash attached to a PXA2xx chip. | 158 | This provides a driver for the NOR flash attached to a PXA2xx chip. |
159 | 159 | ||
160 | config MTD_OCTAGON | ||
161 | tristate "JEDEC Flash device mapped on Octagon 5066 SBC" | ||
162 | depends on X86 && MTD_JEDEC && MTD_COMPLEX_MAPPINGS | ||
163 | help | ||
164 | This provides a 'mapping' driver which supports the way in which | ||
165 | the flash chips are connected in the Octagon-5066 Single Board | ||
166 | Computer. More information on the board is available at | ||
167 | <http://www.octagonsystems.com/products/5066.aspx>. | ||
168 | |||
169 | config MTD_VMAX | ||
170 | tristate "JEDEC Flash device mapped on Tempustech VMAX SBC301" | ||
171 | depends on X86 && MTD_JEDEC && MTD_COMPLEX_MAPPINGS | ||
172 | help | ||
173 | This provides a 'mapping' driver which supports the way in which | ||
174 | the flash chips are connected in the Tempustech VMAX SBC301 Single | ||
175 | Board Computer. More information on the board is available at | ||
176 | <http://www.tempustech.com/>. | ||
177 | |||
178 | config MTD_SCx200_DOCFLASH | 160 | config MTD_SCx200_DOCFLASH |
179 | tristate "Flash device mapped with DOCCS on NatSemi SCx200" | 161 | tristate "Flash device mapped with DOCCS on NatSemi SCx200" |
180 | depends on SCx200 && MTD_CFI | 162 | depends on SCx200 && MTD_CFI |
diff --git a/drivers/mtd/maps/Makefile b/drivers/mtd/maps/Makefile index 9fdbd4ba6441..141c91a5b24c 100644 --- a/drivers/mtd/maps/Makefile +++ b/drivers/mtd/maps/Makefile | |||
@@ -16,7 +16,6 @@ obj-$(CONFIG_MTD_ICHXROM) += ichxrom.o | |||
16 | obj-$(CONFIG_MTD_CK804XROM) += ck804xrom.o | 16 | obj-$(CONFIG_MTD_CK804XROM) += ck804xrom.o |
17 | obj-$(CONFIG_MTD_TSUNAMI) += tsunami_flash.o | 17 | obj-$(CONFIG_MTD_TSUNAMI) += tsunami_flash.o |
18 | obj-$(CONFIG_MTD_PXA2XX) += pxa2xx-flash.o | 18 | obj-$(CONFIG_MTD_PXA2XX) += pxa2xx-flash.o |
19 | obj-$(CONFIG_MTD_OCTAGON) += octagon-5066.o | ||
20 | obj-$(CONFIG_MTD_PHYSMAP) += physmap.o | 19 | obj-$(CONFIG_MTD_PHYSMAP) += physmap.o |
21 | obj-$(CONFIG_MTD_PHYSMAP_OF) += physmap_of.o | 20 | obj-$(CONFIG_MTD_PHYSMAP_OF) += physmap_of.o |
22 | obj-$(CONFIG_MTD_PISMO) += pismo.o | 21 | obj-$(CONFIG_MTD_PISMO) += pismo.o |
@@ -28,7 +27,6 @@ obj-$(CONFIG_MTD_SC520CDP) += sc520cdp.o | |||
28 | obj-$(CONFIG_MTD_NETSC520) += netsc520.o | 27 | obj-$(CONFIG_MTD_NETSC520) += netsc520.o |
29 | obj-$(CONFIG_MTD_TS5500) += ts5500_flash.o | 28 | obj-$(CONFIG_MTD_TS5500) += ts5500_flash.o |
30 | obj-$(CONFIG_MTD_SUN_UFLASH) += sun_uflash.o | 29 | obj-$(CONFIG_MTD_SUN_UFLASH) += sun_uflash.o |
31 | obj-$(CONFIG_MTD_VMAX) += vmax301.o | ||
32 | obj-$(CONFIG_MTD_SCx200_DOCFLASH)+= scx200_docflash.o | 30 | obj-$(CONFIG_MTD_SCx200_DOCFLASH)+= scx200_docflash.o |
33 | obj-$(CONFIG_MTD_SOLUTIONENGINE)+= solutionengine.o | 31 | obj-$(CONFIG_MTD_SOLUTIONENGINE)+= solutionengine.o |
34 | obj-$(CONFIG_MTD_PCI) += pci.o | 32 | obj-$(CONFIG_MTD_PCI) += pci.o |
diff --git a/drivers/mtd/maps/bfin-async-flash.c b/drivers/mtd/maps/bfin-async-flash.c index 319b04a6c9d1..5434d8ded015 100644 --- a/drivers/mtd/maps/bfin-async-flash.c +++ b/drivers/mtd/maps/bfin-async-flash.c | |||
@@ -128,7 +128,7 @@ static const char * const part_probe_types[] = { | |||
128 | static int bfin_flash_probe(struct platform_device *pdev) | 128 | static int bfin_flash_probe(struct platform_device *pdev) |
129 | { | 129 | { |
130 | int ret; | 130 | int ret; |
131 | struct physmap_flash_data *pdata = pdev->dev.platform_data; | 131 | struct physmap_flash_data *pdata = dev_get_platdata(&pdev->dev); |
132 | struct resource *memory = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 132 | struct resource *memory = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
133 | struct resource *flash_ambctl = platform_get_resource(pdev, IORESOURCE_MEM, 1); | 133 | struct resource *flash_ambctl = platform_get_resource(pdev, IORESOURCE_MEM, 1); |
134 | struct async_state *state; | 134 | struct async_state *state; |
diff --git a/drivers/mtd/maps/cfi_flagadm.c b/drivers/mtd/maps/cfi_flagadm.c index d16fc9d3b8cd..d504b3d1791d 100644 --- a/drivers/mtd/maps/cfi_flagadm.c +++ b/drivers/mtd/maps/cfi_flagadm.c | |||
@@ -55,13 +55,13 @@ | |||
55 | #define FLASH_PARTITION3_SIZE 0x001C0000 | 55 | #define FLASH_PARTITION3_SIZE 0x001C0000 |
56 | 56 | ||
57 | 57 | ||
58 | struct map_info flagadm_map = { | 58 | static struct map_info flagadm_map = { |
59 | .name = "FlagaDM flash device", | 59 | .name = "FlagaDM flash device", |
60 | .size = FLASH_SIZE, | 60 | .size = FLASH_SIZE, |
61 | .bankwidth = 2, | 61 | .bankwidth = 2, |
62 | }; | 62 | }; |
63 | 63 | ||
64 | struct mtd_partition flagadm_parts[] = { | 64 | static struct mtd_partition flagadm_parts[] = { |
65 | { | 65 | { |
66 | .name = "Bootloader", | 66 | .name = "Bootloader", |
67 | .offset = FLASH_PARTITION0_ADDR, | 67 | .offset = FLASH_PARTITION0_ADDR, |
@@ -112,7 +112,7 @@ static int __init init_flagadm(void) | |||
112 | return 0; | 112 | return 0; |
113 | } | 113 | } |
114 | 114 | ||
115 | iounmap((void *)flagadm_map.virt); | 115 | iounmap((void __iomem *)flagadm_map.virt); |
116 | return -ENXIO; | 116 | return -ENXIO; |
117 | } | 117 | } |
118 | 118 | ||
@@ -123,8 +123,8 @@ static void __exit cleanup_flagadm(void) | |||
123 | map_destroy(mymtd); | 123 | map_destroy(mymtd); |
124 | } | 124 | } |
125 | if (flagadm_map.virt) { | 125 | if (flagadm_map.virt) { |
126 | iounmap((void *)flagadm_map.virt); | 126 | iounmap((void __iomem *)flagadm_map.virt); |
127 | flagadm_map.virt = 0; | 127 | flagadm_map.virt = NULL; |
128 | } | 128 | } |
129 | } | 129 | } |
130 | 130 | ||
diff --git a/drivers/mtd/maps/gpio-addr-flash.c b/drivers/mtd/maps/gpio-addr-flash.c index 5ede28294f9e..1adba86474a5 100644 --- a/drivers/mtd/maps/gpio-addr-flash.c +++ b/drivers/mtd/maps/gpio-addr-flash.c | |||
@@ -196,7 +196,7 @@ static int gpio_flash_probe(struct platform_device *pdev) | |||
196 | struct resource *gpios; | 196 | struct resource *gpios; |
197 | struct async_state *state; | 197 | struct async_state *state; |
198 | 198 | ||
199 | pdata = pdev->dev.platform_data; | 199 | pdata = dev_get_platdata(&pdev->dev); |
200 | memory = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 200 | memory = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
201 | gpios = platform_get_resource(pdev, IORESOURCE_IRQ, 0); | 201 | gpios = platform_get_resource(pdev, IORESOURCE_IRQ, 0); |
202 | 202 | ||
diff --git a/drivers/mtd/maps/impa7.c b/drivers/mtd/maps/impa7.c index 49686744d93c..15bbda03be65 100644 --- a/drivers/mtd/maps/impa7.c +++ b/drivers/mtd/maps/impa7.c | |||
@@ -79,7 +79,7 @@ static int __init init_impa7(void) | |||
79 | } | 79 | } |
80 | simple_map_init(&impa7_map[i]); | 80 | simple_map_init(&impa7_map[i]); |
81 | 81 | ||
82 | impa7_mtd[i] = 0; | 82 | impa7_mtd[i] = NULL; |
83 | type = rom_probe_types; | 83 | type = rom_probe_types; |
84 | for(; !impa7_mtd[i] && *type; type++) { | 84 | for(; !impa7_mtd[i] && *type; type++) { |
85 | impa7_mtd[i] = do_map_probe(*type, &impa7_map[i]); | 85 | impa7_mtd[i] = do_map_probe(*type, &impa7_map[i]); |
@@ -91,9 +91,9 @@ static int __init init_impa7(void) | |||
91 | mtd_device_parse_register(impa7_mtd[i], NULL, NULL, | 91 | mtd_device_parse_register(impa7_mtd[i], NULL, NULL, |
92 | partitions, | 92 | partitions, |
93 | ARRAY_SIZE(partitions)); | 93 | ARRAY_SIZE(partitions)); |
94 | } else { | ||
95 | iounmap((void __iomem *)impa7_map[i].virt); | ||
94 | } | 96 | } |
95 | else | ||
96 | iounmap((void *)impa7_map[i].virt); | ||
97 | } | 97 | } |
98 | return devicesfound == 0 ? -ENXIO : 0; | 98 | return devicesfound == 0 ? -ENXIO : 0; |
99 | } | 99 | } |
@@ -105,8 +105,8 @@ static void __exit cleanup_impa7(void) | |||
105 | if (impa7_mtd[i]) { | 105 | if (impa7_mtd[i]) { |
106 | mtd_device_unregister(impa7_mtd[i]); | 106 | mtd_device_unregister(impa7_mtd[i]); |
107 | map_destroy(impa7_mtd[i]); | 107 | map_destroy(impa7_mtd[i]); |
108 | iounmap((void *)impa7_map[i].virt); | 108 | iounmap((void __iomem *)impa7_map[i].virt); |
109 | impa7_map[i].virt = 0; | 109 | impa7_map[i].virt = NULL; |
110 | } | 110 | } |
111 | } | 111 | } |
112 | } | 112 | } |
diff --git a/drivers/mtd/maps/ixp4xx.c b/drivers/mtd/maps/ixp4xx.c index 52b3410a105c..10debfea81e7 100644 --- a/drivers/mtd/maps/ixp4xx.c +++ b/drivers/mtd/maps/ixp4xx.c | |||
@@ -152,11 +152,9 @@ static const char * const probes[] = { "RedBoot", "cmdlinepart", NULL }; | |||
152 | 152 | ||
153 | static int ixp4xx_flash_remove(struct platform_device *dev) | 153 | static int ixp4xx_flash_remove(struct platform_device *dev) |
154 | { | 154 | { |
155 | struct flash_platform_data *plat = dev->dev.platform_data; | 155 | struct flash_platform_data *plat = dev_get_platdata(&dev->dev); |
156 | struct ixp4xx_flash_info *info = platform_get_drvdata(dev); | 156 | struct ixp4xx_flash_info *info = platform_get_drvdata(dev); |
157 | 157 | ||
158 | platform_set_drvdata(dev, NULL); | ||
159 | |||
160 | if(!info) | 158 | if(!info) |
161 | return 0; | 159 | return 0; |
162 | 160 | ||
@@ -180,7 +178,7 @@ static int ixp4xx_flash_remove(struct platform_device *dev) | |||
180 | 178 | ||
181 | static int ixp4xx_flash_probe(struct platform_device *dev) | 179 | static int ixp4xx_flash_probe(struct platform_device *dev) |
182 | { | 180 | { |
183 | struct flash_platform_data *plat = dev->dev.platform_data; | 181 | struct flash_platform_data *plat = dev_get_platdata(&dev->dev); |
184 | struct ixp4xx_flash_info *info; | 182 | struct ixp4xx_flash_info *info; |
185 | struct mtd_part_parser_data ppdata = { | 183 | struct mtd_part_parser_data ppdata = { |
186 | .origin = dev->resource->start, | 184 | .origin = dev->resource->start, |
diff --git a/drivers/mtd/maps/latch-addr-flash.c b/drivers/mtd/maps/latch-addr-flash.c index ab0fead56b83..98bb5d5375d7 100644 --- a/drivers/mtd/maps/latch-addr-flash.c +++ b/drivers/mtd/maps/latch-addr-flash.c | |||
@@ -102,9 +102,8 @@ static int latch_addr_flash_remove(struct platform_device *dev) | |||
102 | info = platform_get_drvdata(dev); | 102 | info = platform_get_drvdata(dev); |
103 | if (info == NULL) | 103 | if (info == NULL) |
104 | return 0; | 104 | return 0; |
105 | platform_set_drvdata(dev, NULL); | ||
106 | 105 | ||
107 | latch_addr_data = dev->dev.platform_data; | 106 | latch_addr_data = dev_get_platdata(&dev->dev); |
108 | 107 | ||
109 | if (info->mtd != NULL) { | 108 | if (info->mtd != NULL) { |
110 | mtd_device_unregister(info->mtd); | 109 | mtd_device_unregister(info->mtd); |
@@ -135,7 +134,7 @@ static int latch_addr_flash_probe(struct platform_device *dev) | |||
135 | int chipsel; | 134 | int chipsel; |
136 | int err; | 135 | int err; |
137 | 136 | ||
138 | latch_addr_data = dev->dev.platform_data; | 137 | latch_addr_data = dev_get_platdata(&dev->dev); |
139 | if (latch_addr_data == NULL) | 138 | if (latch_addr_data == NULL) |
140 | return -ENODEV; | 139 | return -ENODEV; |
141 | 140 | ||
diff --git a/drivers/mtd/maps/octagon-5066.c b/drivers/mtd/maps/octagon-5066.c deleted file mode 100644 index 807ac2a2e686..000000000000 --- a/drivers/mtd/maps/octagon-5066.c +++ /dev/null | |||
@@ -1,246 +0,0 @@ | |||
1 | /* ###################################################################### | ||
2 | |||
3 | Octagon 5066 MTD Driver. | ||
4 | |||
5 | The Octagon 5066 is a SBC based on AMD's 586-WB running at 133 MHZ. It | ||
6 | comes with a builtin AMD 29F016 flash chip and a socketed EEPROM that | ||
7 | is replacable by flash. Both units are mapped through a multiplexer | ||
8 | into a 32k memory window at 0xe8000. The control register for the | ||
9 | multiplexing unit is located at IO 0x208 with a bit map of | ||
10 | 0-5 Page Selection in 32k increments | ||
11 | 6-7 Device selection: | ||
12 | 00 SSD off | ||
13 | 01 SSD 0 (Socket) | ||
14 | 10 SSD 1 (Flash chip) | ||
15 | 11 undefined | ||
16 | |||
17 | On each SSD, the first 128k is reserved for use by the bios | ||
18 | (actually it IS the bios..) This only matters if you are booting off the | ||
19 | flash, you must not put a file system starting there. | ||
20 | |||
21 | The driver tries to do a detection algorithm to guess what sort of devices | ||
22 | are plugged into the sockets. | ||
23 | |||
24 | ##################################################################### */ | ||
25 | |||
26 | #include <linux/module.h> | ||
27 | #include <linux/ioport.h> | ||
28 | #include <linux/init.h> | ||
29 | #include <asm/io.h> | ||
30 | |||
31 | #include <linux/mtd/map.h> | ||
32 | #include <linux/mtd/mtd.h> | ||
33 | |||
34 | #define WINDOW_START 0xe8000 | ||
35 | #define WINDOW_LENGTH 0x8000 | ||
36 | #define WINDOW_SHIFT 27 | ||
37 | #define WINDOW_MASK 0x7FFF | ||
38 | #define PAGE_IO 0x208 | ||
39 | |||
40 | static volatile char page_n_dev = 0; | ||
41 | static unsigned long iomapadr; | ||
42 | static DEFINE_SPINLOCK(oct5066_spin); | ||
43 | |||
44 | /* | ||
45 | * We use map_priv_1 to identify which device we are. | ||
46 | */ | ||
47 | |||
48 | static void __oct5066_page(struct map_info *map, __u8 byte) | ||
49 | { | ||
50 | outb(byte,PAGE_IO); | ||
51 | page_n_dev = byte; | ||
52 | } | ||
53 | |||
54 | static inline void oct5066_page(struct map_info *map, unsigned long ofs) | ||
55 | { | ||
56 | __u8 byte = map->map_priv_1 | (ofs >> WINDOW_SHIFT); | ||
57 | |||
58 | if (page_n_dev != byte) | ||
59 | __oct5066_page(map, byte); | ||
60 | } | ||
61 | |||
62 | |||
63 | static map_word oct5066_read8(struct map_info *map, unsigned long ofs) | ||
64 | { | ||
65 | map_word ret; | ||
66 | spin_lock(&oct5066_spin); | ||
67 | oct5066_page(map, ofs); | ||
68 | ret.x[0] = readb(iomapadr + (ofs & WINDOW_MASK)); | ||
69 | spin_unlock(&oct5066_spin); | ||
70 | return ret; | ||
71 | } | ||
72 | |||
73 | static void oct5066_copy_from(struct map_info *map, void *to, unsigned long from, ssize_t len) | ||
74 | { | ||
75 | while(len) { | ||
76 | unsigned long thislen = len; | ||
77 | if (len > (WINDOW_LENGTH - (from & WINDOW_MASK))) | ||
78 | thislen = WINDOW_LENGTH-(from & WINDOW_MASK); | ||
79 | |||
80 | spin_lock(&oct5066_spin); | ||
81 | oct5066_page(map, from); | ||
82 | memcpy_fromio(to, iomapadr + from, thislen); | ||
83 | spin_unlock(&oct5066_spin); | ||
84 | to += thislen; | ||
85 | from += thislen; | ||
86 | len -= thislen; | ||
87 | } | ||
88 | } | ||
89 | |||
90 | static void oct5066_write8(struct map_info *map, map_word d, unsigned long adr) | ||
91 | { | ||
92 | spin_lock(&oct5066_spin); | ||
93 | oct5066_page(map, adr); | ||
94 | writeb(d.x[0], iomapadr + (adr & WINDOW_MASK)); | ||
95 | spin_unlock(&oct5066_spin); | ||
96 | } | ||
97 | |||
98 | static void oct5066_copy_to(struct map_info *map, unsigned long to, const void *from, ssize_t len) | ||
99 | { | ||
100 | while(len) { | ||
101 | unsigned long thislen = len; | ||
102 | if (len > (WINDOW_LENGTH - (to & WINDOW_MASK))) | ||
103 | thislen = WINDOW_LENGTH-(to & WINDOW_MASK); | ||
104 | |||
105 | spin_lock(&oct5066_spin); | ||
106 | oct5066_page(map, to); | ||
107 | memcpy_toio(iomapadr + to, from, thislen); | ||
108 | spin_unlock(&oct5066_spin); | ||
109 | to += thislen; | ||
110 | from += thislen; | ||
111 | len -= thislen; | ||
112 | } | ||
113 | } | ||
114 | |||
115 | static struct map_info oct5066_map[2] = { | ||
116 | { | ||
117 | .name = "Octagon 5066 Socket", | ||
118 | .phys = NO_XIP, | ||
119 | .size = 512 * 1024, | ||
120 | .bankwidth = 1, | ||
121 | .read = oct5066_read8, | ||
122 | .copy_from = oct5066_copy_from, | ||
123 | .write = oct5066_write8, | ||
124 | .copy_to = oct5066_copy_to, | ||
125 | .map_priv_1 = 1<<6 | ||
126 | }, | ||
127 | { | ||
128 | .name = "Octagon 5066 Internal Flash", | ||
129 | .phys = NO_XIP, | ||
130 | .size = 2 * 1024 * 1024, | ||
131 | .bankwidth = 1, | ||
132 | .read = oct5066_read8, | ||
133 | .copy_from = oct5066_copy_from, | ||
134 | .write = oct5066_write8, | ||
135 | .copy_to = oct5066_copy_to, | ||
136 | .map_priv_1 = 2<<6 | ||
137 | } | ||
138 | }; | ||
139 | |||
140 | static struct mtd_info *oct5066_mtd[2] = {NULL, NULL}; | ||
141 | |||
142 | // OctProbe - Sense if this is an octagon card | ||
143 | // --------------------------------------------------------------------- | ||
144 | /* Perform a simple validity test, we map the window select SSD0 and | ||
145 | change pages while monitoring the window. A change in the window, | ||
146 | controlled by the PAGE_IO port is a functioning 5066 board. This will | ||
147 | fail if the thing in the socket is set to a uniform value. */ | ||
148 | static int __init OctProbe(void) | ||
149 | { | ||
150 | unsigned int Base = (1 << 6); | ||
151 | unsigned long I; | ||
152 | unsigned long Values[10]; | ||
153 | for (I = 0; I != 20; I++) | ||
154 | { | ||
155 | outb(Base + (I%10),PAGE_IO); | ||
156 | if (I < 10) | ||
157 | { | ||
158 | // Record the value and check for uniqueness | ||
159 | Values[I%10] = readl(iomapadr); | ||
160 | if (I > 0 && Values[I%10] == Values[0]) | ||
161 | return -EAGAIN; | ||
162 | } | ||
163 | else | ||
164 | { | ||
165 | // Make sure we get the same values on the second pass | ||
166 | if (Values[I%10] != readl(iomapadr)) | ||
167 | return -EAGAIN; | ||
168 | } | ||
169 | } | ||
170 | return 0; | ||
171 | } | ||
172 | |||
173 | void cleanup_oct5066(void) | ||
174 | { | ||
175 | int i; | ||
176 | for (i=0; i<2; i++) { | ||
177 | if (oct5066_mtd[i]) { | ||
178 | mtd_device_unregister(oct5066_mtd[i]); | ||
179 | map_destroy(oct5066_mtd[i]); | ||
180 | } | ||
181 | } | ||
182 | iounmap((void *)iomapadr); | ||
183 | release_region(PAGE_IO, 1); | ||
184 | } | ||
185 | |||
186 | static int __init init_oct5066(void) | ||
187 | { | ||
188 | int i; | ||
189 | int ret = 0; | ||
190 | |||
191 | // Do an autoprobe sequence | ||
192 | if (!request_region(PAGE_IO,1,"Octagon SSD")) { | ||
193 | printk(KERN_NOTICE "5066: Page Register in Use\n"); | ||
194 | return -EAGAIN; | ||
195 | } | ||
196 | iomapadr = (unsigned long)ioremap(WINDOW_START, WINDOW_LENGTH); | ||
197 | if (!iomapadr) { | ||
198 | printk(KERN_NOTICE "Failed to ioremap memory region\n"); | ||
199 | ret = -EIO; | ||
200 | goto out_rel; | ||
201 | } | ||
202 | if (OctProbe() != 0) { | ||
203 | printk(KERN_NOTICE "5066: Octagon Probe Failed, is this an Octagon 5066 SBC?\n"); | ||
204 | iounmap((void *)iomapadr); | ||
205 | ret = -EAGAIN; | ||
206 | goto out_unmap; | ||
207 | } | ||
208 | |||
209 | // Print out our little header.. | ||
210 | printk("Octagon 5066 SSD IO:0x%x MEM:0x%x-0x%x\n",PAGE_IO,WINDOW_START, | ||
211 | WINDOW_START+WINDOW_LENGTH); | ||
212 | |||
213 | for (i=0; i<2; i++) { | ||
214 | oct5066_mtd[i] = do_map_probe("cfi_probe", &oct5066_map[i]); | ||
215 | if (!oct5066_mtd[i]) | ||
216 | oct5066_mtd[i] = do_map_probe("jedec", &oct5066_map[i]); | ||
217 | if (!oct5066_mtd[i]) | ||
218 | oct5066_mtd[i] = do_map_probe("map_ram", &oct5066_map[i]); | ||
219 | if (!oct5066_mtd[i]) | ||
220 | oct5066_mtd[i] = do_map_probe("map_rom", &oct5066_map[i]); | ||
221 | if (oct5066_mtd[i]) { | ||
222 | oct5066_mtd[i]->owner = THIS_MODULE; | ||
223 | mtd_device_register(oct5066_mtd[i], NULL, 0); | ||
224 | } | ||
225 | } | ||
226 | |||
227 | if (!oct5066_mtd[0] && !oct5066_mtd[1]) { | ||
228 | cleanup_oct5066(); | ||
229 | return -ENXIO; | ||
230 | } | ||
231 | |||
232 | return 0; | ||
233 | |||
234 | out_unmap: | ||
235 | iounmap((void *)iomapadr); | ||
236 | out_rel: | ||
237 | release_region(PAGE_IO, 1); | ||
238 | return ret; | ||
239 | } | ||
240 | |||
241 | module_init(init_oct5066); | ||
242 | module_exit(cleanup_oct5066); | ||
243 | |||
244 | MODULE_LICENSE("GPL"); | ||
245 | MODULE_AUTHOR("Jason Gunthorpe <jgg@deltatee.com>, David Woodhouse <dwmw2@infradead.org>"); | ||
246 | MODULE_DESCRIPTION("MTD map driver for Octagon 5066 Single Board Computer"); | ||
diff --git a/drivers/mtd/maps/physmap.c b/drivers/mtd/maps/physmap.c index e7a592c8c765..f73cd461257c 100644 --- a/drivers/mtd/maps/physmap.c +++ b/drivers/mtd/maps/physmap.c | |||
@@ -40,9 +40,8 @@ static int physmap_flash_remove(struct platform_device *dev) | |||
40 | info = platform_get_drvdata(dev); | 40 | info = platform_get_drvdata(dev); |
41 | if (info == NULL) | 41 | if (info == NULL) |
42 | return 0; | 42 | return 0; |
43 | platform_set_drvdata(dev, NULL); | ||
44 | 43 | ||
45 | physmap_data = dev->dev.platform_data; | 44 | physmap_data = dev_get_platdata(&dev->dev); |
46 | 45 | ||
47 | if (info->cmtd) { | 46 | if (info->cmtd) { |
48 | mtd_device_unregister(info->cmtd); | 47 | mtd_device_unregister(info->cmtd); |
@@ -69,7 +68,7 @@ static void physmap_set_vpp(struct map_info *map, int state) | |||
69 | unsigned long flags; | 68 | unsigned long flags; |
70 | 69 | ||
71 | pdev = (struct platform_device *)map->map_priv_1; | 70 | pdev = (struct platform_device *)map->map_priv_1; |
72 | physmap_data = pdev->dev.platform_data; | 71 | physmap_data = dev_get_platdata(&pdev->dev); |
73 | 72 | ||
74 | if (!physmap_data->set_vpp) | 73 | if (!physmap_data->set_vpp) |
75 | return; | 74 | return; |
@@ -103,7 +102,7 @@ static int physmap_flash_probe(struct platform_device *dev) | |||
103 | int i; | 102 | int i; |
104 | int devices_found = 0; | 103 | int devices_found = 0; |
105 | 104 | ||
106 | physmap_data = dev->dev.platform_data; | 105 | physmap_data = dev_get_platdata(&dev->dev); |
107 | if (physmap_data == NULL) | 106 | if (physmap_data == NULL) |
108 | return -ENODEV; | 107 | return -ENODEV; |
109 | 108 | ||
diff --git a/drivers/mtd/maps/plat-ram.c b/drivers/mtd/maps/plat-ram.c index 71fdda29594b..676271659b37 100644 --- a/drivers/mtd/maps/plat-ram.c +++ b/drivers/mtd/maps/plat-ram.c | |||
@@ -84,8 +84,6 @@ static int platram_remove(struct platform_device *pdev) | |||
84 | { | 84 | { |
85 | struct platram_info *info = to_platram_info(pdev); | 85 | struct platram_info *info = to_platram_info(pdev); |
86 | 86 | ||
87 | platform_set_drvdata(pdev, NULL); | ||
88 | |||
89 | dev_dbg(&pdev->dev, "removing device\n"); | 87 | dev_dbg(&pdev->dev, "removing device\n"); |
90 | 88 | ||
91 | if (info == NULL) | 89 | if (info == NULL) |
@@ -130,13 +128,13 @@ static int platram_probe(struct platform_device *pdev) | |||
130 | 128 | ||
131 | dev_dbg(&pdev->dev, "probe entered\n"); | 129 | dev_dbg(&pdev->dev, "probe entered\n"); |
132 | 130 | ||
133 | if (pdev->dev.platform_data == NULL) { | 131 | if (dev_get_platdata(&pdev->dev) == NULL) { |
134 | dev_err(&pdev->dev, "no platform data supplied\n"); | 132 | dev_err(&pdev->dev, "no platform data supplied\n"); |
135 | err = -ENOENT; | 133 | err = -ENOENT; |
136 | goto exit_error; | 134 | goto exit_error; |
137 | } | 135 | } |
138 | 136 | ||
139 | pdata = pdev->dev.platform_data; | 137 | pdata = dev_get_platdata(&pdev->dev); |
140 | 138 | ||
141 | info = kzalloc(sizeof(*info), GFP_KERNEL); | 139 | info = kzalloc(sizeof(*info), GFP_KERNEL); |
142 | if (info == NULL) { | 140 | if (info == NULL) { |
diff --git a/drivers/mtd/maps/pxa2xx-flash.c b/drivers/mtd/maps/pxa2xx-flash.c index acb1dbcf7ce5..d210d131fef2 100644 --- a/drivers/mtd/maps/pxa2xx-flash.c +++ b/drivers/mtd/maps/pxa2xx-flash.c | |||
@@ -49,7 +49,7 @@ static const char * const probes[] = { "RedBoot", "cmdlinepart", NULL }; | |||
49 | 49 | ||
50 | static int pxa2xx_flash_probe(struct platform_device *pdev) | 50 | static int pxa2xx_flash_probe(struct platform_device *pdev) |
51 | { | 51 | { |
52 | struct flash_platform_data *flash = pdev->dev.platform_data; | 52 | struct flash_platform_data *flash = dev_get_platdata(&pdev->dev); |
53 | struct pxa2xx_flash_info *info; | 53 | struct pxa2xx_flash_info *info; |
54 | struct resource *res; | 54 | struct resource *res; |
55 | 55 | ||
@@ -107,8 +107,6 @@ static int pxa2xx_flash_remove(struct platform_device *dev) | |||
107 | { | 107 | { |
108 | struct pxa2xx_flash_info *info = platform_get_drvdata(dev); | 108 | struct pxa2xx_flash_info *info = platform_get_drvdata(dev); |
109 | 109 | ||
110 | platform_set_drvdata(dev, NULL); | ||
111 | |||
112 | mtd_device_unregister(info->mtd); | 110 | mtd_device_unregister(info->mtd); |
113 | 111 | ||
114 | map_destroy(info->mtd); | 112 | map_destroy(info->mtd); |
diff --git a/drivers/mtd/maps/rbtx4939-flash.c b/drivers/mtd/maps/rbtx4939-flash.c index ac02fbffd6df..93525121d69d 100644 --- a/drivers/mtd/maps/rbtx4939-flash.c +++ b/drivers/mtd/maps/rbtx4939-flash.c | |||
@@ -34,10 +34,9 @@ static int rbtx4939_flash_remove(struct platform_device *dev) | |||
34 | info = platform_get_drvdata(dev); | 34 | info = platform_get_drvdata(dev); |
35 | if (!info) | 35 | if (!info) |
36 | return 0; | 36 | return 0; |
37 | platform_set_drvdata(dev, NULL); | ||
38 | 37 | ||
39 | if (info->mtd) { | 38 | if (info->mtd) { |
40 | struct rbtx4939_flash_data *pdata = dev->dev.platform_data; | 39 | struct rbtx4939_flash_data *pdata = dev_get_platdata(&dev->dev); |
41 | 40 | ||
42 | mtd_device_unregister(info->mtd); | 41 | mtd_device_unregister(info->mtd); |
43 | map_destroy(info->mtd); | 42 | map_destroy(info->mtd); |
@@ -57,7 +56,7 @@ static int rbtx4939_flash_probe(struct platform_device *dev) | |||
57 | int err = 0; | 56 | int err = 0; |
58 | unsigned long size; | 57 | unsigned long size; |
59 | 58 | ||
60 | pdata = dev->dev.platform_data; | 59 | pdata = dev_get_platdata(&dev->dev); |
61 | if (!pdata) | 60 | if (!pdata) |
62 | return -ENODEV; | 61 | return -ENODEV; |
63 | 62 | ||
diff --git a/drivers/mtd/maps/sa1100-flash.c b/drivers/mtd/maps/sa1100-flash.c index 29e3dcaa1d90..8fc06bf111c4 100644 --- a/drivers/mtd/maps/sa1100-flash.c +++ b/drivers/mtd/maps/sa1100-flash.c | |||
@@ -248,7 +248,7 @@ static const char * const part_probes[] = { "cmdlinepart", "RedBoot", NULL }; | |||
248 | 248 | ||
249 | static int sa1100_mtd_probe(struct platform_device *pdev) | 249 | static int sa1100_mtd_probe(struct platform_device *pdev) |
250 | { | 250 | { |
251 | struct flash_platform_data *plat = pdev->dev.platform_data; | 251 | struct flash_platform_data *plat = dev_get_platdata(&pdev->dev); |
252 | struct sa_info *info; | 252 | struct sa_info *info; |
253 | int err; | 253 | int err; |
254 | 254 | ||
@@ -277,9 +277,8 @@ static int sa1100_mtd_probe(struct platform_device *pdev) | |||
277 | static int __exit sa1100_mtd_remove(struct platform_device *pdev) | 277 | static int __exit sa1100_mtd_remove(struct platform_device *pdev) |
278 | { | 278 | { |
279 | struct sa_info *info = platform_get_drvdata(pdev); | 279 | struct sa_info *info = platform_get_drvdata(pdev); |
280 | struct flash_platform_data *plat = pdev->dev.platform_data; | 280 | struct flash_platform_data *plat = dev_get_platdata(&pdev->dev); |
281 | 281 | ||
282 | platform_set_drvdata(pdev, NULL); | ||
283 | sa1100_destroy(info, plat); | 282 | sa1100_destroy(info, plat); |
284 | 283 | ||
285 | return 0; | 284 | return 0; |
diff --git a/drivers/mtd/maps/vmax301.c b/drivers/mtd/maps/vmax301.c deleted file mode 100644 index 5e68de73eabc..000000000000 --- a/drivers/mtd/maps/vmax301.c +++ /dev/null | |||
@@ -1,196 +0,0 @@ | |||
1 | /* ###################################################################### | ||
2 | |||
3 | Tempustech VMAX SBC301 MTD Driver. | ||
4 | |||
5 | The VMAx 301 is a SBC based on . It | ||
6 | comes with three builtin AMD 29F016B flash chips and a socket for SRAM or | ||
7 | more flash. Each unit has it's own 8k mapping into a settable region | ||
8 | (0xD8000). There are two 8k mappings for each MTD, the first is always set | ||
9 | to the lower 8k of the device the second is paged. Writing a 16 bit page | ||
10 | value to anywhere in the first 8k will cause the second 8k to page around. | ||
11 | |||
12 | To boot the device a bios extension must be installed into the first 8k | ||
13 | of flash that is smart enough to copy itself down, page in the rest of | ||
14 | itself and begin executing. | ||
15 | |||
16 | ##################################################################### */ | ||
17 | |||
18 | #include <linux/module.h> | ||
19 | #include <linux/ioport.h> | ||
20 | #include <linux/init.h> | ||
21 | #include <linux/spinlock.h> | ||
22 | #include <asm/io.h> | ||
23 | |||
24 | #include <linux/mtd/map.h> | ||
25 | #include <linux/mtd/mtd.h> | ||
26 | |||
27 | |||
28 | #define WINDOW_START 0xd8000 | ||
29 | #define WINDOW_LENGTH 0x2000 | ||
30 | #define WINDOW_SHIFT 25 | ||
31 | #define WINDOW_MASK 0x1FFF | ||
32 | |||
33 | /* Actually we could use two spinlocks, but we'd have to have | ||
34 | more private space in the struct map_info. We lose a little | ||
35 | performance like this, but we'd probably lose more by having | ||
36 | the extra indirection from having one of the map->map_priv | ||
37 | fields pointing to yet another private struct. | ||
38 | */ | ||
39 | static DEFINE_SPINLOCK(vmax301_spin); | ||
40 | |||
41 | static void __vmax301_page(struct map_info *map, unsigned long page) | ||
42 | { | ||
43 | writew(page, map->map_priv_2 - WINDOW_LENGTH); | ||
44 | map->map_priv_1 = page; | ||
45 | } | ||
46 | |||
47 | static inline void vmax301_page(struct map_info *map, | ||
48 | unsigned long ofs) | ||
49 | { | ||
50 | unsigned long page = (ofs >> WINDOW_SHIFT); | ||
51 | if (map->map_priv_1 != page) | ||
52 | __vmax301_page(map, page); | ||
53 | } | ||
54 | |||
55 | static map_word vmax301_read8(struct map_info *map, unsigned long ofs) | ||
56 | { | ||
57 | map_word ret; | ||
58 | spin_lock(&vmax301_spin); | ||
59 | vmax301_page(map, ofs); | ||
60 | ret.x[0] = readb(map->map_priv_2 + (ofs & WINDOW_MASK)); | ||
61 | spin_unlock(&vmax301_spin); | ||
62 | return ret; | ||
63 | } | ||
64 | |||
65 | static void vmax301_copy_from(struct map_info *map, void *to, unsigned long from, ssize_t len) | ||
66 | { | ||
67 | while(len) { | ||
68 | unsigned long thislen = len; | ||
69 | if (len > (WINDOW_LENGTH - (from & WINDOW_MASK))) | ||
70 | thislen = WINDOW_LENGTH-(from & WINDOW_MASK); | ||
71 | spin_lock(&vmax301_spin); | ||
72 | vmax301_page(map, from); | ||
73 | memcpy_fromio(to, map->map_priv_2 + from, thislen); | ||
74 | spin_unlock(&vmax301_spin); | ||
75 | to += thislen; | ||
76 | from += thislen; | ||
77 | len -= thislen; | ||
78 | } | ||
79 | } | ||
80 | |||
81 | static void vmax301_write8(struct map_info *map, map_word d, unsigned long adr) | ||
82 | { | ||
83 | spin_lock(&vmax301_spin); | ||
84 | vmax301_page(map, adr); | ||
85 | writeb(d.x[0], map->map_priv_2 + (adr & WINDOW_MASK)); | ||
86 | spin_unlock(&vmax301_spin); | ||
87 | } | ||
88 | |||
89 | static void vmax301_copy_to(struct map_info *map, unsigned long to, const void *from, ssize_t len) | ||
90 | { | ||
91 | while(len) { | ||
92 | unsigned long thislen = len; | ||
93 | if (len > (WINDOW_LENGTH - (to & WINDOW_MASK))) | ||
94 | thislen = WINDOW_LENGTH-(to & WINDOW_MASK); | ||
95 | |||
96 | spin_lock(&vmax301_spin); | ||
97 | vmax301_page(map, to); | ||
98 | memcpy_toio(map->map_priv_2 + to, from, thislen); | ||
99 | spin_unlock(&vmax301_spin); | ||
100 | to += thislen; | ||
101 | from += thislen; | ||
102 | len -= thislen; | ||
103 | } | ||
104 | } | ||
105 | |||
106 | static struct map_info vmax_map[2] = { | ||
107 | { | ||
108 | .name = "VMAX301 Internal Flash", | ||
109 | .phys = NO_XIP, | ||
110 | .size = 3*2*1024*1024, | ||
111 | .bankwidth = 1, | ||
112 | .read = vmax301_read8, | ||
113 | .copy_from = vmax301_copy_from, | ||
114 | .write = vmax301_write8, | ||
115 | .copy_to = vmax301_copy_to, | ||
116 | .map_priv_1 = WINDOW_START + WINDOW_LENGTH, | ||
117 | .map_priv_2 = 0xFFFFFFFF | ||
118 | }, | ||
119 | { | ||
120 | .name = "VMAX301 Socket", | ||
121 | .phys = NO_XIP, | ||
122 | .size = 0, | ||
123 | .bankwidth = 1, | ||
124 | .read = vmax301_read8, | ||
125 | .copy_from = vmax301_copy_from, | ||
126 | .write = vmax301_write8, | ||
127 | .copy_to = vmax301_copy_to, | ||
128 | .map_priv_1 = WINDOW_START + (3*WINDOW_LENGTH), | ||
129 | .map_priv_2 = 0xFFFFFFFF | ||
130 | } | ||
131 | }; | ||
132 | |||
133 | static struct mtd_info *vmax_mtd[2] = {NULL, NULL}; | ||
134 | |||
135 | static void __exit cleanup_vmax301(void) | ||
136 | { | ||
137 | int i; | ||
138 | |||
139 | for (i=0; i<2; i++) { | ||
140 | if (vmax_mtd[i]) { | ||
141 | mtd_device_unregister(vmax_mtd[i]); | ||
142 | map_destroy(vmax_mtd[i]); | ||
143 | } | ||
144 | } | ||
145 | iounmap((void *)vmax_map[0].map_priv_1 - WINDOW_START); | ||
146 | } | ||
147 | |||
148 | static int __init init_vmax301(void) | ||
149 | { | ||
150 | int i; | ||
151 | unsigned long iomapadr; | ||
152 | // Print out our little header.. | ||
153 | printk("Tempustech VMAX 301 MEM:0x%x-0x%x\n",WINDOW_START, | ||
154 | WINDOW_START+4*WINDOW_LENGTH); | ||
155 | |||
156 | iomapadr = (unsigned long)ioremap(WINDOW_START, WINDOW_LENGTH*4); | ||
157 | if (!iomapadr) { | ||
158 | printk("Failed to ioremap memory region\n"); | ||
159 | return -EIO; | ||
160 | } | ||
161 | /* Put the address in the map's private data area. | ||
162 | We store the actual MTD IO address rather than the | ||
163 | address of the first half, because it's used more | ||
164 | often. | ||
165 | */ | ||
166 | vmax_map[0].map_priv_2 = iomapadr + WINDOW_START; | ||
167 | vmax_map[1].map_priv_2 = iomapadr + (3*WINDOW_START); | ||
168 | |||
169 | for (i=0; i<2; i++) { | ||
170 | vmax_mtd[i] = do_map_probe("cfi_probe", &vmax_map[i]); | ||
171 | if (!vmax_mtd[i]) | ||
172 | vmax_mtd[i] = do_map_probe("jedec", &vmax_map[i]); | ||
173 | if (!vmax_mtd[i]) | ||
174 | vmax_mtd[i] = do_map_probe("map_ram", &vmax_map[i]); | ||
175 | if (!vmax_mtd[i]) | ||
176 | vmax_mtd[i] = do_map_probe("map_rom", &vmax_map[i]); | ||
177 | if (vmax_mtd[i]) { | ||
178 | vmax_mtd[i]->owner = THIS_MODULE; | ||
179 | mtd_device_register(vmax_mtd[i], NULL, 0); | ||
180 | } | ||
181 | } | ||
182 | |||
183 | if (!vmax_mtd[0] && !vmax_mtd[1]) { | ||
184 | iounmap((void *)iomapadr); | ||
185 | return -ENXIO; | ||
186 | } | ||
187 | |||
188 | return 0; | ||
189 | } | ||
190 | |||
191 | module_init(init_vmax301); | ||
192 | module_exit(cleanup_vmax301); | ||
193 | |||
194 | MODULE_LICENSE("GPL"); | ||
195 | MODULE_AUTHOR("David Woodhouse <dwmw2@infradead.org>"); | ||
196 | MODULE_DESCRIPTION("MTD map driver for Tempustech VMAX SBC301 board"); | ||