10 #include <linux/module.h>
11 #include <linux/types.h>
12 #include <linux/kernel.h>
14 #include <linux/slab.h>
15 #include <linux/device.h>
24 #define MAX_RESOURCES 4
40 info = platform_get_drvdata(dev);
43 platform_set_drvdata(dev,
NULL);
45 physmap_data = dev->
dev.platform_data;
58 if (physmap_data->
exit)
59 physmap_data->
exit(dev);
72 physmap_data = pdev->
dev.platform_data;
77 info = platform_get_drvdata(pdev);
87 spin_unlock_irqrestore(&info->
vpp_lock, flags);
90 static const char *rom_probe_types[] = {
96 static const char *part_probe_types[] = {
"cmdlinepart",
"RedBoot",
"afs",
103 const char **probe_type;
104 const char **part_types;
107 int devices_found = 0;
109 physmap_data = dev->
dev.platform_data;
110 if (physmap_data ==
NULL)
120 if (physmap_data->
init) {
121 err = physmap_data->
init(dev);
126 platform_set_drvdata(dev, info);
130 (
unsigned long long)resource_size(&dev->
resource[i]),
131 (
unsigned long long)dev->
resource[i].start);
136 dev_name(&dev->
dev))) {
137 dev_err(&dev->
dev,
"Could not reserve memory region\n");
142 info->
map[
i].name = dev_name(&dev->
dev);
145 info->
map[
i].bankwidth = physmap_data->
width;
146 info->
map[
i].set_vpp = physmap_set_vpp;
148 info->
map[
i].map_priv_1 = (
unsigned long)dev;
152 if (info->
map[i].virt ==
NULL) {
153 dev_err(&dev->
dev,
"Failed to ioremap flash region\n");
160 probe_type = rom_probe_types;
162 for (; info->
mtd[
i] ==
NULL && *probe_type !=
NULL; probe_type++)
175 info->
mtd[
i]->dev.parent = &dev->
dev;
178 if (devices_found == 1) {
180 }
else if (devices_found > 1) {
200 physmap_flash_remove(dev);
210 for (i = 0; i < MAX_RESOURCES && info->
mtd[
i]; i++)
211 if (mtd_suspend(info->
mtd[i]) == 0)
212 mtd_resume(info->
mtd[i]);
215 #define physmap_flash_shutdown NULL
219 .probe = physmap_flash_probe,
220 .remove = physmap_flash_remove,
223 .name =
"physmap-flash",
229 #ifdef CONFIG_MTD_PHYSMAP_COMPAT
231 .
width = CONFIG_MTD_PHYSMAP_BANKWIDTH,
234 static struct resource physmap_flash_resource = {
235 .
start = CONFIG_MTD_PHYSMAP_START,
241 .
name =
"physmap-flash",
244 .platform_data = &physmap_flash_data,
247 .resource = &physmap_flash_resource,
251 static int __init physmap_init(
void)
256 #ifdef CONFIG_MTD_PHYSMAP_COMPAT
267 static void __exit physmap_exit(
void)
269 #ifdef CONFIG_MTD_PHYSMAP_COMPAT
283 #ifndef CONFIG_MTD_PHYSMAP_COMPAT