diff options
author | Marc Zyngier <Marc.Zyngier@arm.com> | 2011-05-18 05:51:55 -0400 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2011-05-20 17:27:34 -0400 |
commit | 667f390bee987d45351402e42008c52cdfb77d76 (patch) | |
tree | 93b6a563915a4013c842302dd45dc3b4ee926d4e | |
parent | adf0040096e4b45b9d1c12f59f9045951178ca00 (diff) |
ARM: 6910/1: MTD: physmap: let set_vpp() pass a platform_device instead of a map_info
The set_vpp() method provided by physmap passes a map_info back to
the platform code, which has little relevance as far as the platform
is concerned (this parameter is completely unused).
Instead, pass the platform_device, which can be used in the pismo
driver to retrieve some important information in a nicer way, instead
of the hack that was in place.
The empty set_vpp function in board-at572d940hf_ek.c is left untouched,
as the board/SoC is scheduled for removal.
Cc: Andrew Victor <linux@maxim.org.za>
Cc: Nicolas Ferre <nicolas.ferre@atmel.com>
Acked-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Cc: Philipp Zabel <philipp.zabel@gmail.com>
Cc: Eric Miao <eric.y.miao@gmail.com>
Cc: Ben Dooks <ben-linux@fluff.org>
Acked-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Acked-by: David Woodhouse <dwmw2@infradead.org>
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
-rw-r--r-- | arch/arm/mach-integrator/integrator_ap.c | 2 | ||||
-rw-r--r-- | arch/arm/mach-integrator/integrator_cp.c | 2 | ||||
-rw-r--r-- | arch/arm/mach-omap1/flash.c | 2 | ||||
-rw-r--r-- | arch/arm/mach-pxa/hx4700.c | 2 | ||||
-rw-r--r-- | arch/arm/mach-pxa/magician.c | 2 | ||||
-rw-r--r-- | arch/arm/mach-realview/core.c | 2 | ||||
-rw-r--r-- | arch/arm/mach-s3c2410/nor-simtec.c | 2 | ||||
-rw-r--r-- | arch/arm/mach-versatile/core.c | 2 | ||||
-rw-r--r-- | arch/arm/mach-vexpress/v2m.c | 2 | ||||
-rw-r--r-- | arch/arm/plat-omap/include/plat/flash.h | 2 | ||||
-rw-r--r-- | drivers/mtd/maps/physmap.c | 20 | ||||
-rw-r--r-- | drivers/mtd/maps/pismo.c | 40 | ||||
-rw-r--r-- | include/linux/mtd/physmap.h | 2 |
13 files changed, 29 insertions, 53 deletions
diff --git a/arch/arm/mach-integrator/integrator_ap.c b/arch/arm/mach-integrator/integrator_ap.c index 11bd49e8b663..2aa98ee41b8d 100644 --- a/arch/arm/mach-integrator/integrator_ap.c +++ b/arch/arm/mach-integrator/integrator_ap.c | |||
@@ -263,7 +263,7 @@ static void ap_flash_exit(struct platform_device *dev) | |||
263 | } | 263 | } |
264 | } | 264 | } |
265 | 265 | ||
266 | static void ap_flash_set_vpp(struct map_info *map, int on) | 266 | static void ap_flash_set_vpp(struct platform_device *pdev, int on) |
267 | { | 267 | { |
268 | void __iomem *reg = on ? SC_CTRLS : SC_CTRLC; | 268 | void __iomem *reg = on ? SC_CTRLS : SC_CTRLC; |
269 | 269 | ||
diff --git a/arch/arm/mach-integrator/integrator_cp.c b/arch/arm/mach-integrator/integrator_cp.c index ec9628fe7109..b676b41d70e2 100644 --- a/arch/arm/mach-integrator/integrator_cp.c +++ b/arch/arm/mach-integrator/integrator_cp.c | |||
@@ -259,7 +259,7 @@ static void intcp_flash_exit(struct platform_device *dev) | |||
259 | writel(val, INTCP_VA_CTRL_BASE + INTCP_FLASHPROG); | 259 | writel(val, INTCP_VA_CTRL_BASE + INTCP_FLASHPROG); |
260 | } | 260 | } |
261 | 261 | ||
262 | static void intcp_flash_set_vpp(struct map_info *map, int on) | 262 | static void intcp_flash_set_vpp(struct platform_device *pdev, int on) |
263 | { | 263 | { |
264 | u32 val; | 264 | u32 val; |
265 | 265 | ||
diff --git a/arch/arm/mach-omap1/flash.c b/arch/arm/mach-omap1/flash.c index acd161666408..1749cb37dda0 100644 --- a/arch/arm/mach-omap1/flash.c +++ b/arch/arm/mach-omap1/flash.c | |||
@@ -13,7 +13,7 @@ | |||
13 | #include <plat/tc.h> | 13 | #include <plat/tc.h> |
14 | #include <plat/flash.h> | 14 | #include <plat/flash.h> |
15 | 15 | ||
16 | void omap1_set_vpp(struct map_info *map, int enable) | 16 | void omap1_set_vpp(struct platform_device *pdev, int enable) |
17 | { | 17 | { |
18 | static int count; | 18 | static int count; |
19 | u32 l; | 19 | u32 l; |
diff --git a/arch/arm/mach-pxa/hx4700.c b/arch/arm/mach-pxa/hx4700.c index 9cdcca597924..f941a495a4a8 100644 --- a/arch/arm/mach-pxa/hx4700.c +++ b/arch/arm/mach-pxa/hx4700.c | |||
@@ -735,7 +735,7 @@ static struct platform_device bq24022 = { | |||
735 | * StrataFlash | 735 | * StrataFlash |
736 | */ | 736 | */ |
737 | 737 | ||
738 | static void hx4700_set_vpp(struct map_info *map, int vpp) | 738 | static void hx4700_set_vpp(struct platform_device *pdev, int vpp) |
739 | { | 739 | { |
740 | gpio_set_value(GPIO91_HX4700_FLASH_VPEN, vpp); | 740 | gpio_set_value(GPIO91_HX4700_FLASH_VPEN, vpp); |
741 | } | 741 | } |
diff --git a/arch/arm/mach-pxa/magician.c b/arch/arm/mach-pxa/magician.c index 9984ef70bd79..e1920572948a 100644 --- a/arch/arm/mach-pxa/magician.c +++ b/arch/arm/mach-pxa/magician.c | |||
@@ -662,7 +662,7 @@ static struct pxaohci_platform_data magician_ohci_info = { | |||
662 | * StrataFlash | 662 | * StrataFlash |
663 | */ | 663 | */ |
664 | 664 | ||
665 | static void magician_set_vpp(struct map_info *map, int vpp) | 665 | static void magician_set_vpp(struct platform_device *pdev, int vpp) |
666 | { | 666 | { |
667 | gpio_set_value(EGPIO_MAGICIAN_FLASH_VPP, vpp); | 667 | gpio_set_value(EGPIO_MAGICIAN_FLASH_VPP, vpp); |
668 | } | 668 | } |
diff --git a/arch/arm/mach-realview/core.c b/arch/arm/mach-realview/core.c index d3f1dde70fc9..c8ec08886633 100644 --- a/arch/arm/mach-realview/core.c +++ b/arch/arm/mach-realview/core.c | |||
@@ -77,7 +77,7 @@ void __init realview_adjust_zones(unsigned long *size, unsigned long *hole) | |||
77 | 77 | ||
78 | #define REALVIEW_FLASHCTRL (__io_address(REALVIEW_SYS_BASE) + REALVIEW_SYS_FLASH_OFFSET) | 78 | #define REALVIEW_FLASHCTRL (__io_address(REALVIEW_SYS_BASE) + REALVIEW_SYS_FLASH_OFFSET) |
79 | 79 | ||
80 | static void realview_flash_set_vpp(struct map_info *map, int on) | 80 | static void realview_flash_set_vpp(struct platform_device *pdev, int on) |
81 | { | 81 | { |
82 | u32 val; | 82 | u32 val; |
83 | 83 | ||
diff --git a/arch/arm/mach-s3c2410/nor-simtec.c b/arch/arm/mach-s3c2410/nor-simtec.c index 598d130633dc..ad9f750f1e55 100644 --- a/arch/arm/mach-s3c2410/nor-simtec.c +++ b/arch/arm/mach-s3c2410/nor-simtec.c | |||
@@ -32,7 +32,7 @@ | |||
32 | 32 | ||
33 | #include "nor-simtec.h" | 33 | #include "nor-simtec.h" |
34 | 34 | ||
35 | static void simtec_nor_vpp(struct map_info *map, int vpp) | 35 | static void simtec_nor_vpp(struct platform_device *pdev, int vpp) |
36 | { | 36 | { |
37 | unsigned int val; | 37 | unsigned int val; |
38 | unsigned long flags; | 38 | unsigned long flags; |
diff --git a/arch/arm/mach-versatile/core.c b/arch/arm/mach-versatile/core.c index 06f406ad8edd..335d8250e364 100644 --- a/arch/arm/mach-versatile/core.c +++ b/arch/arm/mach-versatile/core.c | |||
@@ -190,7 +190,7 @@ void __init versatile_map_io(void) | |||
190 | 190 | ||
191 | #define VERSATILE_FLASHCTRL (__io_address(VERSATILE_SYS_BASE) + VERSATILE_SYS_FLASH_OFFSET) | 191 | #define VERSATILE_FLASHCTRL (__io_address(VERSATILE_SYS_BASE) + VERSATILE_SYS_FLASH_OFFSET) |
192 | 192 | ||
193 | static void versatile_flash_set_vpp(struct map_info *map, int on) | 193 | static void versatile_flash_set_vpp(struct platform_device *pdev, int on) |
194 | { | 194 | { |
195 | u32 val; | 195 | u32 val; |
196 | 196 | ||
diff --git a/arch/arm/mach-vexpress/v2m.c b/arch/arm/mach-vexpress/v2m.c index e3268152c834..f860314ef7f6 100644 --- a/arch/arm/mach-vexpress/v2m.c +++ b/arch/arm/mach-vexpress/v2m.c | |||
@@ -206,7 +206,7 @@ static struct platform_device v2m_usb_device = { | |||
206 | .dev.platform_data = &v2m_usb_config, | 206 | .dev.platform_data = &v2m_usb_config, |
207 | }; | 207 | }; |
208 | 208 | ||
209 | static void v2m_flash_set_vpp(struct map_info *map, int on) | 209 | static void v2m_flash_set_vpp(struct platform_device *pdev, int on) |
210 | { | 210 | { |
211 | writel(on != 0, MMIO_P2V(V2M_SYS_FLASH)); | 211 | writel(on != 0, MMIO_P2V(V2M_SYS_FLASH)); |
212 | } | 212 | } |
diff --git a/arch/arm/plat-omap/include/plat/flash.h b/arch/arm/plat-omap/include/plat/flash.h index 3e6327016b40..3083195123ea 100644 --- a/arch/arm/plat-omap/include/plat/flash.h +++ b/arch/arm/plat-omap/include/plat/flash.h | |||
@@ -11,6 +11,6 @@ | |||
11 | 11 | ||
12 | #include <linux/mtd/map.h> | 12 | #include <linux/mtd/map.h> |
13 | 13 | ||
14 | extern void omap1_set_vpp(struct map_info *map, int enable); | 14 | extern void omap1_set_vpp(struct platform_device *pdev, int enable); |
15 | 15 | ||
16 | #endif | 16 | #endif |
diff --git a/drivers/mtd/maps/physmap.c b/drivers/mtd/maps/physmap.c index 49676b7a53a4..1a9b94f0ee54 100644 --- a/drivers/mtd/maps/physmap.c +++ b/drivers/mtd/maps/physmap.c | |||
@@ -74,6 +74,18 @@ static int physmap_flash_remove(struct platform_device *dev) | |||
74 | return 0; | 74 | return 0; |
75 | } | 75 | } |
76 | 76 | ||
77 | static void physmap_set_vpp(struct map_info *map, int state) | ||
78 | { | ||
79 | struct platform_device *pdev; | ||
80 | struct physmap_flash_data *physmap_data; | ||
81 | |||
82 | pdev = (struct platform_device *)map->map_priv_1; | ||
83 | physmap_data = pdev->dev.platform_data; | ||
84 | |||
85 | if (physmap_data->set_vpp) | ||
86 | physmap_data->set_vpp(pdev, state); | ||
87 | } | ||
88 | |||
77 | static const char *rom_probe_types[] = { | 89 | static const char *rom_probe_types[] = { |
78 | "cfi_probe", | 90 | "cfi_probe", |
79 | "jedec_probe", | 91 | "jedec_probe", |
@@ -81,10 +93,7 @@ static const char *rom_probe_types[] = { | |||
81 | "map_rom", | 93 | "map_rom", |
82 | NULL }; | 94 | NULL }; |
83 | #ifdef CONFIG_MTD_PARTITIONS | 95 | #ifdef CONFIG_MTD_PARTITIONS |
84 | static const char *part_probe_types[] = { "cmdlinepart", "RedBoot", | 96 | static const char *part_probe_types[] = { "cmdlinepart", "RedBoot", "afs", |
85 | #ifdef CONFIG_MTD_AFS_PARTS | ||
86 | "afs", | ||
87 | #endif | ||
88 | NULL }; | 97 | NULL }; |
89 | #endif | 98 | #endif |
90 | 99 | ||
@@ -134,8 +143,9 @@ static int physmap_flash_probe(struct platform_device *dev) | |||
134 | info->map[i].phys = dev->resource[i].start; | 143 | info->map[i].phys = dev->resource[i].start; |
135 | info->map[i].size = resource_size(&dev->resource[i]); | 144 | info->map[i].size = resource_size(&dev->resource[i]); |
136 | info->map[i].bankwidth = physmap_data->width; | 145 | info->map[i].bankwidth = physmap_data->width; |
137 | info->map[i].set_vpp = physmap_data->set_vpp; | 146 | info->map[i].set_vpp = physmap_set_vpp; |
138 | info->map[i].pfow_base = physmap_data->pfow_base; | 147 | info->map[i].pfow_base = physmap_data->pfow_base; |
148 | info->map[i].map_priv_1 = (unsigned long)dev; | ||
139 | 149 | ||
140 | info->map[i].virt = devm_ioremap(&dev->dev, info->map[i].phys, | 150 | info->map[i].virt = devm_ioremap(&dev->dev, info->map[i].phys, |
141 | info->map[i].size); | 151 | info->map[i].size); |
diff --git a/drivers/mtd/maps/pismo.c b/drivers/mtd/maps/pismo.c index f4ce273e93fd..65bd1cd4d627 100644 --- a/drivers/mtd/maps/pismo.c +++ b/drivers/mtd/maps/pismo.c | |||
@@ -50,39 +50,13 @@ struct pismo_data { | |||
50 | struct platform_device *dev[PISMO_NUM_CS]; | 50 | struct platform_device *dev[PISMO_NUM_CS]; |
51 | }; | 51 | }; |
52 | 52 | ||
53 | /* FIXME: set_vpp could do with a better calling convention */ | 53 | static void pismo_set_vpp(struct platform_device *pdev, int on) |
54 | static struct pismo_data *vpp_pismo; | ||
55 | static DEFINE_MUTEX(pismo_mutex); | ||
56 | |||
57 | static int pismo_setvpp_probe_fix(struct pismo_data *pismo) | ||
58 | { | 54 | { |
59 | mutex_lock(&pismo_mutex); | 55 | struct i2c_client *client = to_i2c_client(pdev->dev.parent); |
60 | if (vpp_pismo) { | 56 | struct pismo_data *pismo = i2c_get_clientdata(client); |
61 | mutex_unlock(&pismo_mutex); | ||
62 | kfree(pismo); | ||
63 | return -EBUSY; | ||
64 | } | ||
65 | vpp_pismo = pismo; | ||
66 | mutex_unlock(&pismo_mutex); | ||
67 | return 0; | ||
68 | } | ||
69 | |||
70 | static void pismo_setvpp_remove_fix(struct pismo_data *pismo) | ||
71 | { | ||
72 | mutex_lock(&pismo_mutex); | ||
73 | if (vpp_pismo == pismo) | ||
74 | vpp_pismo = NULL; | ||
75 | mutex_unlock(&pismo_mutex); | ||
76 | } | ||
77 | |||
78 | static void pismo_set_vpp(struct map_info *map, int on) | ||
79 | { | ||
80 | struct pismo_data *pismo = vpp_pismo; | ||
81 | 57 | ||
82 | pismo->vpp(pismo->vpp_data, on); | 58 | pismo->vpp(pismo->vpp_data, on); |
83 | } | 59 | } |
84 | /* end of hack */ | ||
85 | |||
86 | 60 | ||
87 | static unsigned int __devinit pismo_width_to_bytes(unsigned int width) | 61 | static unsigned int __devinit pismo_width_to_bytes(unsigned int width) |
88 | { | 62 | { |
@@ -231,9 +205,6 @@ static int __devexit pismo_remove(struct i2c_client *client) | |||
231 | for (i = 0; i < ARRAY_SIZE(pismo->dev); i++) | 205 | for (i = 0; i < ARRAY_SIZE(pismo->dev); i++) |
232 | platform_device_unregister(pismo->dev[i]); | 206 | platform_device_unregister(pismo->dev[i]); |
233 | 207 | ||
234 | /* FIXME: set_vpp needs saner arguments */ | ||
235 | pismo_setvpp_remove_fix(pismo); | ||
236 | |||
237 | kfree(pismo); | 208 | kfree(pismo); |
238 | 209 | ||
239 | return 0; | 210 | return 0; |
@@ -257,11 +228,6 @@ static int __devinit pismo_probe(struct i2c_client *client, | |||
257 | if (!pismo) | 228 | if (!pismo) |
258 | return -ENOMEM; | 229 | return -ENOMEM; |
259 | 230 | ||
260 | /* FIXME: set_vpp needs saner arguments */ | ||
261 | ret = pismo_setvpp_probe_fix(pismo); | ||
262 | if (ret) | ||
263 | return ret; | ||
264 | |||
265 | pismo->client = client; | 231 | pismo->client = client; |
266 | if (pdata) { | 232 | if (pdata) { |
267 | pismo->vpp = pdata->set_vpp; | 233 | pismo->vpp = pdata->set_vpp; |
diff --git a/include/linux/mtd/physmap.h b/include/linux/mtd/physmap.h index d37cca05e62c..49b959029417 100644 --- a/include/linux/mtd/physmap.h +++ b/include/linux/mtd/physmap.h | |||
@@ -24,7 +24,7 @@ struct physmap_flash_data { | |||
24 | unsigned int width; | 24 | unsigned int width; |
25 | int (*init)(struct platform_device *); | 25 | int (*init)(struct platform_device *); |
26 | void (*exit)(struct platform_device *); | 26 | void (*exit)(struct platform_device *); |
27 | void (*set_vpp)(struct map_info *, int); | 27 | void (*set_vpp)(struct platform_device *, int); |
28 | unsigned int nr_parts; | 28 | unsigned int nr_parts; |
29 | unsigned int pfow_base; | 29 | unsigned int pfow_base; |
30 | char *probe_type; | 30 | char *probe_type; |