diff options
Diffstat (limited to 'drivers/mtd/maps')
-rw-r--r-- | drivers/mtd/maps/Kconfig | 16 | ||||
-rw-r--r-- | drivers/mtd/maps/Makefile | 1 | ||||
-rw-r--r-- | drivers/mtd/maps/autcpu12-nvram.c | 153 | ||||
-rw-r--r-- | drivers/mtd/maps/pci.c | 23 | ||||
-rw-r--r-- | drivers/mtd/maps/physmap_of.c | 14 | ||||
-rw-r--r-- | drivers/mtd/maps/rbtx4939-flash.c | 2 | ||||
-rw-r--r-- | drivers/mtd/maps/uclinux.c | 15 | ||||
-rw-r--r-- | drivers/mtd/maps/wr_sbc82xx_flash.c | 174 |
8 files changed, 104 insertions, 294 deletions
diff --git a/drivers/mtd/maps/Kconfig b/drivers/mtd/maps/Kconfig index 5ba2458e799a..2e47c2ed0a2d 100644 --- a/drivers/mtd/maps/Kconfig +++ b/drivers/mtd/maps/Kconfig | |||
@@ -373,7 +373,7 @@ config MTD_FORTUNET | |||
373 | have such a board, say 'Y'. | 373 | have such a board, say 'Y'. |
374 | 374 | ||
375 | config MTD_AUTCPU12 | 375 | config MTD_AUTCPU12 |
376 | tristate "NV-RAM mapping AUTCPU12 board" | 376 | bool "NV-RAM mapping AUTCPU12 board" |
377 | depends on ARCH_AUTCPU12 | 377 | depends on ARCH_AUTCPU12 |
378 | help | 378 | help |
379 | This enables access to the NV-RAM on autronix autcpu12 board. | 379 | This enables access to the NV-RAM on autronix autcpu12 board. |
@@ -443,22 +443,10 @@ config MTD_GPIO_ADDR | |||
443 | 443 | ||
444 | config MTD_UCLINUX | 444 | config MTD_UCLINUX |
445 | bool "Generic uClinux RAM/ROM filesystem support" | 445 | bool "Generic uClinux RAM/ROM filesystem support" |
446 | depends on MTD_RAM=y && !MMU | 446 | depends on MTD_RAM=y && (!MMU || COLDFIRE) |
447 | help | 447 | help |
448 | Map driver to support image based filesystems for uClinux. | 448 | Map driver to support image based filesystems for uClinux. |
449 | 449 | ||
450 | config MTD_WRSBC8260 | ||
451 | tristate "Map driver for WindRiver PowerQUICC II MPC82xx board" | ||
452 | depends on (SBC82xx || SBC8560) | ||
453 | select MTD_MAP_BANK_WIDTH_4 | ||
454 | select MTD_MAP_BANK_WIDTH_1 | ||
455 | select MTD_CFI_I1 | ||
456 | select MTD_CFI_I4 | ||
457 | help | ||
458 | Map driver for WindRiver PowerQUICC II MPC82xx board. Drives | ||
459 | all three flash regions on CS0, CS1 and CS6 if they are configured | ||
460 | correctly by the boot loader. | ||
461 | |||
462 | config MTD_DMV182 | 450 | config MTD_DMV182 |
463 | tristate "Map driver for Dy-4 SVME/DMV-182 board." | 451 | tristate "Map driver for Dy-4 SVME/DMV-182 board." |
464 | depends on DMV182 | 452 | depends on DMV182 |
diff --git a/drivers/mtd/maps/Makefile b/drivers/mtd/maps/Makefile index 68a9a91d344f..deb43e9a1e7f 100644 --- a/drivers/mtd/maps/Makefile +++ b/drivers/mtd/maps/Makefile | |||
@@ -47,7 +47,6 @@ obj-$(CONFIG_MTD_SCB2_FLASH) += scb2_flash.o | |||
47 | obj-$(CONFIG_MTD_H720X) += h720x-flash.o | 47 | obj-$(CONFIG_MTD_H720X) += h720x-flash.o |
48 | obj-$(CONFIG_MTD_IXP4XX) += ixp4xx.o | 48 | obj-$(CONFIG_MTD_IXP4XX) += ixp4xx.o |
49 | obj-$(CONFIG_MTD_IXP2000) += ixp2000.o | 49 | obj-$(CONFIG_MTD_IXP2000) += ixp2000.o |
50 | obj-$(CONFIG_MTD_WRSBC8260) += wr_sbc82xx_flash.o | ||
51 | obj-$(CONFIG_MTD_DMV182) += dmv182.o | 50 | obj-$(CONFIG_MTD_DMV182) += dmv182.o |
52 | obj-$(CONFIG_MTD_PLATRAM) += plat-ram.o | 51 | obj-$(CONFIG_MTD_PLATRAM) += plat-ram.o |
53 | obj-$(CONFIG_MTD_INTEL_VR_NOR) += intel_vr_nor.o | 52 | obj-$(CONFIG_MTD_INTEL_VR_NOR) += intel_vr_nor.o |
diff --git a/drivers/mtd/maps/autcpu12-nvram.c b/drivers/mtd/maps/autcpu12-nvram.c index e5bfd0e093bb..76fb594bb1d9 100644 --- a/drivers/mtd/maps/autcpu12-nvram.c +++ b/drivers/mtd/maps/autcpu12-nvram.c | |||
@@ -15,43 +15,54 @@ | |||
15 | * You should have received a copy of the GNU General Public License | 15 | * You should have received a copy of the GNU General Public License |
16 | * along with this program; if not, write to the Free Software | 16 | * along with this program; if not, write to the Free Software |
17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | 17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
18 | * | ||
19 | */ | 18 | */ |
19 | #include <linux/sizes.h> | ||
20 | 20 | ||
21 | #include <linux/module.h> | ||
22 | #include <linux/types.h> | 21 | #include <linux/types.h> |
23 | #include <linux/kernel.h> | 22 | #include <linux/kernel.h> |
24 | #include <linux/ioport.h> | ||
25 | #include <linux/init.h> | 23 | #include <linux/init.h> |
26 | #include <asm/io.h> | 24 | #include <linux/device.h> |
27 | #include <asm/sizes.h> | 25 | #include <linux/module.h> |
28 | #include <mach/hardware.h> | 26 | #include <linux/platform_device.h> |
29 | #include <mach/autcpu12.h> | 27 | |
30 | #include <linux/mtd/mtd.h> | 28 | #include <linux/mtd/mtd.h> |
31 | #include <linux/mtd/map.h> | 29 | #include <linux/mtd/map.h> |
32 | #include <linux/mtd/partitions.h> | ||
33 | |||
34 | |||
35 | static struct mtd_info *sram_mtd; | ||
36 | 30 | ||
37 | struct map_info autcpu12_sram_map = { | 31 | struct autcpu12_nvram_priv { |
38 | .name = "SRAM", | 32 | struct mtd_info *mtd; |
39 | .size = 32768, | 33 | struct map_info map; |
40 | .bankwidth = 4, | ||
41 | .phys = 0x12000000, | ||
42 | }; | 34 | }; |
43 | 35 | ||
44 | static int __init init_autcpu12_sram (void) | 36 | static int __devinit autcpu12_nvram_probe(struct platform_device *pdev) |
45 | { | 37 | { |
46 | int err, save0, save1; | 38 | map_word tmp, save0, save1; |
39 | struct resource *res; | ||
40 | struct autcpu12_nvram_priv *priv; | ||
47 | 41 | ||
48 | autcpu12_sram_map.virt = ioremap(0x12000000, SZ_128K); | 42 | priv = devm_kzalloc(&pdev->dev, |
49 | if (!autcpu12_sram_map.virt) { | 43 | sizeof(struct autcpu12_nvram_priv), GFP_KERNEL); |
50 | printk("Failed to ioremap autcpu12 NV-RAM space\n"); | 44 | if (!priv) |
51 | err = -EIO; | 45 | return -ENOMEM; |
52 | goto out; | 46 | |
47 | platform_set_drvdata(pdev, priv); | ||
48 | |||
49 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | ||
50 | if (!res) { | ||
51 | dev_err(&pdev->dev, "failed to get memory resource\n"); | ||
52 | return -ENOENT; | ||
53 | } | ||
54 | |||
55 | priv->map.bankwidth = 4; | ||
56 | priv->map.phys = res->start; | ||
57 | priv->map.size = resource_size(res); | ||
58 | priv->map.virt = devm_request_and_ioremap(&pdev->dev, res); | ||
59 | strcpy((char *)priv->map.name, res->name); | ||
60 | if (!priv->map.virt) { | ||
61 | dev_err(&pdev->dev, "failed to remap mem resource\n"); | ||
62 | return -EBUSY; | ||
53 | } | 63 | } |
54 | simple_map_init(&autcpu_sram_map); | 64 | |
65 | simple_map_init(&priv->map); | ||
55 | 66 | ||
56 | /* | 67 | /* |
57 | * Check for 32K/128K | 68 | * Check for 32K/128K |
@@ -61,65 +72,59 @@ static int __init init_autcpu12_sram (void) | |||
61 | * Read and check result on ofs 0x0 | 72 | * Read and check result on ofs 0x0 |
62 | * Restore contents | 73 | * Restore contents |
63 | */ | 74 | */ |
64 | save0 = map_read32(&autcpu12_sram_map,0); | 75 | save0 = map_read(&priv->map, 0); |
65 | save1 = map_read32(&autcpu12_sram_map,0x10000); | 76 | save1 = map_read(&priv->map, 0x10000); |
66 | map_write32(&autcpu12_sram_map,~save0,0x10000); | 77 | tmp.x[0] = ~save0.x[0]; |
67 | /* if we find this pattern on 0x0, we have 32K size | 78 | map_write(&priv->map, tmp, 0x10000); |
68 | * restore contents and exit | 79 | tmp = map_read(&priv->map, 0); |
69 | */ | 80 | /* if we find this pattern on 0x0, we have 32K size */ |
70 | if ( map_read32(&autcpu12_sram_map,0) != save0) { | 81 | if (!map_word_equal(&priv->map, tmp, save0)) { |
71 | map_write32(&autcpu12_sram_map,save0,0x0); | 82 | map_write(&priv->map, save0, 0x0); |
72 | goto map; | 83 | priv->map.size = SZ_32K; |
84 | } else | ||
85 | map_write(&priv->map, save1, 0x10000); | ||
86 | |||
87 | priv->mtd = do_map_probe("map_ram", &priv->map); | ||
88 | if (!priv->mtd) { | ||
89 | dev_err(&pdev->dev, "probing failed\n"); | ||
90 | return -ENXIO; | ||
73 | } | 91 | } |
74 | /* We have a 128K found, restore 0x10000 and set size | ||
75 | * to 128K | ||
76 | */ | ||
77 | map_write32(&autcpu12_sram_map,save1,0x10000); | ||
78 | autcpu12_sram_map.size = SZ_128K; | ||
79 | |||
80 | map: | ||
81 | sram_mtd = do_map_probe("map_ram", &autcpu12_sram_map); | ||
82 | if (!sram_mtd) { | ||
83 | printk("NV-RAM probe failed\n"); | ||
84 | err = -ENXIO; | ||
85 | goto out_ioremap; | ||
86 | } | ||
87 | |||
88 | sram_mtd->owner = THIS_MODULE; | ||
89 | sram_mtd->erasesize = 16; | ||
90 | 92 | ||
91 | if (mtd_device_register(sram_mtd, NULL, 0)) { | 93 | priv->mtd->owner = THIS_MODULE; |
92 | printk("NV-RAM device addition failed\n"); | 94 | priv->mtd->erasesize = 16; |
93 | err = -ENOMEM; | 95 | priv->mtd->dev.parent = &pdev->dev; |
94 | goto out_probe; | 96 | if (!mtd_device_register(priv->mtd, NULL, 0)) { |
97 | dev_info(&pdev->dev, | ||
98 | "NV-RAM device size %ldKiB registered on AUTCPU12\n", | ||
99 | priv->map.size / SZ_1K); | ||
100 | return 0; | ||
95 | } | 101 | } |
96 | 102 | ||
97 | printk("NV-RAM device size %ldKiB registered on AUTCPU12\n",autcpu12_sram_map.size/SZ_1K); | 103 | map_destroy(priv->mtd); |
98 | 104 | dev_err(&pdev->dev, "NV-RAM device addition failed\n"); | |
99 | return 0; | 105 | return -ENOMEM; |
100 | |||
101 | out_probe: | ||
102 | map_destroy(sram_mtd); | ||
103 | sram_mtd = 0; | ||
104 | |||
105 | out_ioremap: | ||
106 | iounmap((void *)autcpu12_sram_map.virt); | ||
107 | out: | ||
108 | return err; | ||
109 | } | 106 | } |
110 | 107 | ||
111 | static void __exit cleanup_autcpu12_maps(void) | 108 | static int __devexit autcpu12_nvram_remove(struct platform_device *pdev) |
112 | { | 109 | { |
113 | if (sram_mtd) { | 110 | struct autcpu12_nvram_priv *priv = platform_get_drvdata(pdev); |
114 | mtd_device_unregister(sram_mtd); | 111 | |
115 | map_destroy(sram_mtd); | 112 | mtd_device_unregister(priv->mtd); |
116 | iounmap((void *)autcpu12_sram_map.virt); | 113 | map_destroy(priv->mtd); |
117 | } | 114 | |
115 | return 0; | ||
118 | } | 116 | } |
119 | 117 | ||
120 | module_init(init_autcpu12_sram); | 118 | static struct platform_driver autcpu12_nvram_driver = { |
121 | module_exit(cleanup_autcpu12_maps); | 119 | .driver = { |
120 | .name = "autcpu12_nvram", | ||
121 | .owner = THIS_MODULE, | ||
122 | }, | ||
123 | .probe = autcpu12_nvram_probe, | ||
124 | .remove = __devexit_p(autcpu12_nvram_remove), | ||
125 | }; | ||
126 | module_platform_driver(autcpu12_nvram_driver); | ||
122 | 127 | ||
123 | MODULE_AUTHOR("Thomas Gleixner"); | 128 | MODULE_AUTHOR("Thomas Gleixner"); |
124 | MODULE_DESCRIPTION("autcpu12 NV-RAM map driver"); | 129 | MODULE_DESCRIPTION("autcpu12 NVRAM map driver"); |
125 | MODULE_LICENSE("GPL"); | 130 | MODULE_LICENSE("GPL"); |
diff --git a/drivers/mtd/maps/pci.c b/drivers/mtd/maps/pci.c index f14ce0af763f..1c30c1a307f4 100644 --- a/drivers/mtd/maps/pci.c +++ b/drivers/mtd/maps/pci.c | |||
@@ -43,26 +43,14 @@ static map_word mtd_pci_read8(struct map_info *_map, unsigned long ofs) | |||
43 | struct map_pci_info *map = (struct map_pci_info *)_map; | 43 | struct map_pci_info *map = (struct map_pci_info *)_map; |
44 | map_word val; | 44 | map_word val; |
45 | val.x[0]= readb(map->base + map->translate(map, ofs)); | 45 | val.x[0]= readb(map->base + map->translate(map, ofs)); |
46 | // printk("read8 : %08lx => %02x\n", ofs, val.x[0]); | ||
47 | return val; | 46 | return val; |
48 | } | 47 | } |
49 | 48 | ||
50 | #if 0 | ||
51 | static map_word mtd_pci_read16(struct map_info *_map, unsigned long ofs) | ||
52 | { | ||
53 | struct map_pci_info *map = (struct map_pci_info *)_map; | ||
54 | map_word val; | ||
55 | val.x[0] = readw(map->base + map->translate(map, ofs)); | ||
56 | // printk("read16: %08lx => %04x\n", ofs, val.x[0]); | ||
57 | return val; | ||
58 | } | ||
59 | #endif | ||
60 | static map_word mtd_pci_read32(struct map_info *_map, unsigned long ofs) | 49 | static map_word mtd_pci_read32(struct map_info *_map, unsigned long ofs) |
61 | { | 50 | { |
62 | struct map_pci_info *map = (struct map_pci_info *)_map; | 51 | struct map_pci_info *map = (struct map_pci_info *)_map; |
63 | map_word val; | 52 | map_word val; |
64 | val.x[0] = readl(map->base + map->translate(map, ofs)); | 53 | val.x[0] = readl(map->base + map->translate(map, ofs)); |
65 | // printk("read32: %08lx => %08x\n", ofs, val.x[0]); | ||
66 | return val; | 54 | return val; |
67 | } | 55 | } |
68 | 56 | ||
@@ -75,22 +63,12 @@ static void mtd_pci_copyfrom(struct map_info *_map, void *to, unsigned long from | |||
75 | static void mtd_pci_write8(struct map_info *_map, map_word val, unsigned long ofs) | 63 | static void mtd_pci_write8(struct map_info *_map, map_word val, unsigned long ofs) |
76 | { | 64 | { |
77 | struct map_pci_info *map = (struct map_pci_info *)_map; | 65 | struct map_pci_info *map = (struct map_pci_info *)_map; |
78 | // printk("write8 : %08lx <= %02x\n", ofs, val.x[0]); | ||
79 | writeb(val.x[0], map->base + map->translate(map, ofs)); | 66 | writeb(val.x[0], map->base + map->translate(map, ofs)); |
80 | } | 67 | } |
81 | 68 | ||
82 | #if 0 | ||
83 | static void mtd_pci_write16(struct map_info *_map, map_word val, unsigned long ofs) | ||
84 | { | ||
85 | struct map_pci_info *map = (struct map_pci_info *)_map; | ||
86 | // printk("write16: %08lx <= %04x\n", ofs, val.x[0]); | ||
87 | writew(val.x[0], map->base + map->translate(map, ofs)); | ||
88 | } | ||
89 | #endif | ||
90 | static void mtd_pci_write32(struct map_info *_map, map_word val, unsigned long ofs) | 69 | static void mtd_pci_write32(struct map_info *_map, map_word val, unsigned long ofs) |
91 | { | 70 | { |
92 | struct map_pci_info *map = (struct map_pci_info *)_map; | 71 | struct map_pci_info *map = (struct map_pci_info *)_map; |
93 | // printk("write32: %08lx <= %08x\n", ofs, val.x[0]); | ||
94 | writel(val.x[0], map->base + map->translate(map, ofs)); | 72 | writel(val.x[0], map->base + map->translate(map, ofs)); |
95 | } | 73 | } |
96 | 74 | ||
@@ -358,4 +336,3 @@ MODULE_LICENSE("GPL"); | |||
358 | MODULE_AUTHOR("Russell King <rmk@arm.linux.org.uk>"); | 336 | MODULE_AUTHOR("Russell King <rmk@arm.linux.org.uk>"); |
359 | MODULE_DESCRIPTION("Generic PCI map driver"); | 337 | MODULE_DESCRIPTION("Generic PCI map driver"); |
360 | MODULE_DEVICE_TABLE(pci, mtd_pci_ids); | 338 | MODULE_DEVICE_TABLE(pci, mtd_pci_ids); |
361 | |||
diff --git a/drivers/mtd/maps/physmap_of.c b/drivers/mtd/maps/physmap_of.c index 2e6fb6831d55..6f19acadb06c 100644 --- a/drivers/mtd/maps/physmap_of.c +++ b/drivers/mtd/maps/physmap_of.c | |||
@@ -169,6 +169,7 @@ static int __devinit of_flash_probe(struct platform_device *dev) | |||
169 | struct mtd_info **mtd_list = NULL; | 169 | struct mtd_info **mtd_list = NULL; |
170 | resource_size_t res_size; | 170 | resource_size_t res_size; |
171 | struct mtd_part_parser_data ppdata; | 171 | struct mtd_part_parser_data ppdata; |
172 | bool map_indirect; | ||
172 | 173 | ||
173 | match = of_match_device(of_flash_match, &dev->dev); | 174 | match = of_match_device(of_flash_match, &dev->dev); |
174 | if (!match) | 175 | if (!match) |
@@ -192,6 +193,8 @@ static int __devinit of_flash_probe(struct platform_device *dev) | |||
192 | } | 193 | } |
193 | count /= reg_tuple_size; | 194 | count /= reg_tuple_size; |
194 | 195 | ||
196 | map_indirect = of_property_read_bool(dp, "no-unaligned-direct-access"); | ||
197 | |||
195 | err = -ENOMEM; | 198 | err = -ENOMEM; |
196 | info = kzalloc(sizeof(struct of_flash) + | 199 | info = kzalloc(sizeof(struct of_flash) + |
197 | sizeof(struct of_flash_list) * count, GFP_KERNEL); | 200 | sizeof(struct of_flash_list) * count, GFP_KERNEL); |
@@ -247,6 +250,17 @@ static int __devinit of_flash_probe(struct platform_device *dev) | |||
247 | 250 | ||
248 | simple_map_init(&info->list[i].map); | 251 | simple_map_init(&info->list[i].map); |
249 | 252 | ||
253 | /* | ||
254 | * On some platforms (e.g. MPC5200) a direct 1:1 mapping | ||
255 | * may cause problems with JFFS2 usage, as the local bus (LPB) | ||
256 | * doesn't support unaligned accesses as implemented in the | ||
257 | * JFFS2 code via memcpy(). By setting NO_XIP, the | ||
258 | * flash will not be exposed directly to the MTD users | ||
259 | * (e.g. JFFS2) any more. | ||
260 | */ | ||
261 | if (map_indirect) | ||
262 | info->list[i].map.phys = NO_XIP; | ||
263 | |||
250 | if (probe_type) { | 264 | if (probe_type) { |
251 | info->list[i].mtd = do_map_probe(probe_type, | 265 | info->list[i].mtd = do_map_probe(probe_type, |
252 | &info->list[i].map); | 266 | &info->list[i].map); |
diff --git a/drivers/mtd/maps/rbtx4939-flash.c b/drivers/mtd/maps/rbtx4939-flash.c index 6f52e1f288b6..49c3fe715eee 100644 --- a/drivers/mtd/maps/rbtx4939-flash.c +++ b/drivers/mtd/maps/rbtx4939-flash.c | |||
@@ -100,8 +100,6 @@ static int rbtx4939_flash_probe(struct platform_device *dev) | |||
100 | goto err_out; | 100 | goto err_out; |
101 | } | 101 | } |
102 | info->mtd->owner = THIS_MODULE; | 102 | info->mtd->owner = THIS_MODULE; |
103 | if (err) | ||
104 | goto err_out; | ||
105 | err = mtd_device_parse_register(info->mtd, NULL, NULL, pdata->parts, | 103 | err = mtd_device_parse_register(info->mtd, NULL, NULL, pdata->parts, |
106 | pdata->nr_parts); | 104 | pdata->nr_parts); |
107 | 105 | ||
diff --git a/drivers/mtd/maps/uclinux.c b/drivers/mtd/maps/uclinux.c index c3bb304eca07..299bf88a6f41 100644 --- a/drivers/mtd/maps/uclinux.c +++ b/drivers/mtd/maps/uclinux.c | |||
@@ -67,10 +67,16 @@ static int __init uclinux_mtd_init(void) | |||
67 | printk("uclinux[mtd]: RAM probe address=0x%x size=0x%x\n", | 67 | printk("uclinux[mtd]: RAM probe address=0x%x size=0x%x\n", |
68 | (int) mapp->phys, (int) mapp->size); | 68 | (int) mapp->phys, (int) mapp->size); |
69 | 69 | ||
70 | mapp->virt = ioremap_nocache(mapp->phys, mapp->size); | 70 | /* |
71 | * The filesystem is guaranteed to be in direct mapped memory. It is | ||
72 | * directly following the kernels own bss region. Following the same | ||
73 | * mechanism used by architectures setting up traditional initrds we | ||
74 | * use phys_to_virt to get the virtual address of its start. | ||
75 | */ | ||
76 | mapp->virt = phys_to_virt(mapp->phys); | ||
71 | 77 | ||
72 | if (mapp->virt == 0) { | 78 | if (mapp->virt == 0) { |
73 | printk("uclinux[mtd]: ioremap_nocache() failed\n"); | 79 | printk("uclinux[mtd]: no virtual mapping?\n"); |
74 | return(-EIO); | 80 | return(-EIO); |
75 | } | 81 | } |
76 | 82 | ||
@@ -79,7 +85,6 @@ static int __init uclinux_mtd_init(void) | |||
79 | mtd = do_map_probe("map_ram", mapp); | 85 | mtd = do_map_probe("map_ram", mapp); |
80 | if (!mtd) { | 86 | if (!mtd) { |
81 | printk("uclinux[mtd]: failed to find a mapping?\n"); | 87 | printk("uclinux[mtd]: failed to find a mapping?\n"); |
82 | iounmap(mapp->virt); | ||
83 | return(-ENXIO); | 88 | return(-ENXIO); |
84 | } | 89 | } |
85 | 90 | ||
@@ -102,10 +107,8 @@ static void __exit uclinux_mtd_cleanup(void) | |||
102 | map_destroy(uclinux_ram_mtdinfo); | 107 | map_destroy(uclinux_ram_mtdinfo); |
103 | uclinux_ram_mtdinfo = NULL; | 108 | uclinux_ram_mtdinfo = NULL; |
104 | } | 109 | } |
105 | if (uclinux_ram_map.virt) { | 110 | if (uclinux_ram_map.virt) |
106 | iounmap((void *) uclinux_ram_map.virt); | ||
107 | uclinux_ram_map.virt = 0; | 111 | uclinux_ram_map.virt = 0; |
108 | } | ||
109 | } | 112 | } |
110 | 113 | ||
111 | /****************************************************************************/ | 114 | /****************************************************************************/ |
diff --git a/drivers/mtd/maps/wr_sbc82xx_flash.c b/drivers/mtd/maps/wr_sbc82xx_flash.c deleted file mode 100644 index e7534c82f93a..000000000000 --- a/drivers/mtd/maps/wr_sbc82xx_flash.c +++ /dev/null | |||
@@ -1,174 +0,0 @@ | |||
1 | /* | ||
2 | * Map for flash chips on Wind River PowerQUICC II SBC82xx board. | ||
3 | * | ||
4 | * Copyright (C) 2004 Red Hat, Inc. | ||
5 | * | ||
6 | * Author: David Woodhouse <dwmw2@infradead.org> | ||
7 | * | ||
8 | */ | ||
9 | |||
10 | #include <linux/module.h> | ||
11 | #include <linux/types.h> | ||
12 | #include <linux/kernel.h> | ||
13 | #include <linux/init.h> | ||
14 | #include <linux/slab.h> | ||
15 | #include <asm/io.h> | ||
16 | #include <linux/mtd/mtd.h> | ||
17 | #include <linux/mtd/map.h> | ||
18 | #include <linux/mtd/partitions.h> | ||
19 | |||
20 | #include <asm/immap_cpm2.h> | ||
21 | |||
22 | static struct mtd_info *sbcmtd[3]; | ||
23 | |||
24 | struct map_info sbc82xx_flash_map[3] = { | ||
25 | {.name = "Boot flash"}, | ||
26 | {.name = "Alternate boot flash"}, | ||
27 | {.name = "User flash"} | ||
28 | }; | ||
29 | |||
30 | static struct mtd_partition smallflash_parts[] = { | ||
31 | { | ||
32 | .name = "space", | ||
33 | .size = 0x100000, | ||
34 | .offset = 0, | ||
35 | }, { | ||
36 | .name = "bootloader", | ||
37 | .size = MTDPART_SIZ_FULL, | ||
38 | .offset = MTDPART_OFS_APPEND, | ||
39 | } | ||
40 | }; | ||
41 | |||
42 | static struct mtd_partition bigflash_parts[] = { | ||
43 | { | ||
44 | .name = "bootloader", | ||
45 | .size = 0x00100000, | ||
46 | .offset = 0, | ||
47 | }, { | ||
48 | .name = "file system", | ||
49 | .size = 0x01f00000, | ||
50 | .offset = MTDPART_OFS_APPEND, | ||
51 | }, { | ||
52 | .name = "boot config", | ||
53 | .size = 0x00100000, | ||
54 | .offset = MTDPART_OFS_APPEND, | ||
55 | }, { | ||
56 | .name = "space", | ||
57 | .size = 0x01f00000, | ||
58 | .offset = MTDPART_OFS_APPEND, | ||
59 | } | ||
60 | }; | ||
61 | |||
62 | static const char *part_probes[] __initconst = {"cmdlinepart", "RedBoot", NULL}; | ||
63 | |||
64 | #define init_sbc82xx_one_flash(map, br, or) \ | ||
65 | do { \ | ||
66 | (map).phys = (br & 1) ? (br & 0xffff8000) : 0; \ | ||
67 | (map).size = (br & 1) ? (~(or & 0xffff8000) + 1) : 0; \ | ||
68 | switch (br & 0x00001800) { \ | ||
69 | case 0x00000000: \ | ||
70 | case 0x00000800: (map).bankwidth = 1; break; \ | ||
71 | case 0x00001000: (map).bankwidth = 2; break; \ | ||
72 | case 0x00001800: (map).bankwidth = 4; break; \ | ||
73 | } \ | ||
74 | } while (0); | ||
75 | |||
76 | static int __init init_sbc82xx_flash(void) | ||
77 | { | ||
78 | volatile memctl_cpm2_t *mc = &cpm2_immr->im_memctl; | ||
79 | int bigflash; | ||
80 | int i; | ||
81 | |||
82 | #ifdef CONFIG_SBC8560 | ||
83 | mc = ioremap(0xff700000 + 0x5000, sizeof(memctl_cpm2_t)); | ||
84 | #else | ||
85 | mc = &cpm2_immr->im_memctl; | ||
86 | #endif | ||
87 | |||
88 | bigflash = 1; | ||
89 | if ((mc->memc_br0 & 0x00001800) == 0x00001800) | ||
90 | bigflash = 0; | ||
91 | |||
92 | init_sbc82xx_one_flash(sbc82xx_flash_map[0], mc->memc_br0, mc->memc_or0); | ||
93 | init_sbc82xx_one_flash(sbc82xx_flash_map[1], mc->memc_br6, mc->memc_or6); | ||
94 | init_sbc82xx_one_flash(sbc82xx_flash_map[2], mc->memc_br1, mc->memc_or1); | ||
95 | |||
96 | #ifdef CONFIG_SBC8560 | ||
97 | iounmap((void *) mc); | ||
98 | #endif | ||
99 | |||
100 | for (i=0; i<3; i++) { | ||
101 | int8_t flashcs[3] = { 0, 6, 1 }; | ||
102 | int nr_parts; | ||
103 | struct mtd_partition *defparts; | ||
104 | |||
105 | printk(KERN_NOTICE "PowerQUICC II %s (%ld MiB on CS%d", | ||
106 | sbc82xx_flash_map[i].name, | ||
107 | (sbc82xx_flash_map[i].size >> 20), | ||
108 | flashcs[i]); | ||
109 | if (!sbc82xx_flash_map[i].phys) { | ||
110 | /* We know it can't be at zero. */ | ||
111 | printk("): disabled by bootloader.\n"); | ||
112 | continue; | ||
113 | } | ||
114 | printk(" at %08lx)\n", sbc82xx_flash_map[i].phys); | ||
115 | |||
116 | sbc82xx_flash_map[i].virt = ioremap(sbc82xx_flash_map[i].phys, | ||
117 | sbc82xx_flash_map[i].size); | ||
118 | |||
119 | if (!sbc82xx_flash_map[i].virt) { | ||
120 | printk("Failed to ioremap\n"); | ||
121 | continue; | ||
122 | } | ||
123 | |||
124 | simple_map_init(&sbc82xx_flash_map[i]); | ||
125 | |||
126 | sbcmtd[i] = do_map_probe("cfi_probe", &sbc82xx_flash_map[i]); | ||
127 | |||
128 | if (!sbcmtd[i]) | ||
129 | continue; | ||
130 | |||
131 | sbcmtd[i]->owner = THIS_MODULE; | ||
132 | |||
133 | /* No partitioning detected. Use default */ | ||
134 | if (i == 2) { | ||
135 | defparts = NULL; | ||
136 | nr_parts = 0; | ||
137 | } else if (i == bigflash) { | ||
138 | defparts = bigflash_parts; | ||
139 | nr_parts = ARRAY_SIZE(bigflash_parts); | ||
140 | } else { | ||
141 | defparts = smallflash_parts; | ||
142 | nr_parts = ARRAY_SIZE(smallflash_parts); | ||
143 | } | ||
144 | |||
145 | mtd_device_parse_register(sbcmtd[i], part_probes, NULL, | ||
146 | defparts, nr_parts); | ||
147 | } | ||
148 | return 0; | ||
149 | } | ||
150 | |||
151 | static void __exit cleanup_sbc82xx_flash(void) | ||
152 | { | ||
153 | int i; | ||
154 | |||
155 | for (i=0; i<3; i++) { | ||
156 | if (!sbcmtd[i]) | ||
157 | continue; | ||
158 | |||
159 | mtd_device_unregister(sbcmtd[i]); | ||
160 | |||
161 | map_destroy(sbcmtd[i]); | ||
162 | |||
163 | iounmap((void *)sbc82xx_flash_map[i].virt); | ||
164 | sbc82xx_flash_map[i].virt = 0; | ||
165 | } | ||
166 | } | ||
167 | |||
168 | module_init(init_sbc82xx_flash); | ||
169 | module_exit(cleanup_sbc82xx_flash); | ||
170 | |||
171 | |||
172 | MODULE_LICENSE("GPL"); | ||
173 | MODULE_AUTHOR("David Woodhouse <dwmw2@infradead.org>"); | ||
174 | MODULE_DESCRIPTION("Flash map driver for WindRiver PowerQUICC II"); | ||