diff options
author | Janusz Krzysztofik <jkrzyszt@tis.icnet.pl> | 2010-12-14 15:09:40 -0500 |
---|---|---|
committer | David Woodhouse <David.Woodhouse@intel.com> | 2011-01-06 10:18:16 -0500 |
commit | 7e95d1f1714cb993bc5b7e3a3d532b715b32d80a (patch) | |
tree | 7ba9a6221620274da2b871b07cef891d0e916e32 | |
parent | 75c52a49630a478ffe9c1473441779676817fce6 (diff) |
mtd: nand: ams-delta: convert to platform driver
In its current form, the driver may interfere with different hardware on
different boards if built into the kernel, hence is not suitable for
inclusion into a defconfig, inteded to be usable with multiple OMAP1 cpu and
machine types.
Convert it to a platform driver, that should be free from this issue.
Created and tested against linux-2.6.37-rc5 on Amstrad Delta.
Signed-off-by: Janusz Krzysztofik <jkrzyszt@tis.icnet.pl>
Acked-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
-rw-r--r-- | arch/arm/mach-omap1/board-ams-delta.c | 6 | ||||
-rw-r--r-- | drivers/mtd/nand/ams-delta.c | 31 |
2 files changed, 32 insertions, 5 deletions
diff --git a/arch/arm/mach-omap1/board-ams-delta.c b/arch/arm/mach-omap1/board-ams-delta.c index 1d4163b9f0b7..81282f5e8b2d 100644 --- a/arch/arm/mach-omap1/board-ams-delta.c +++ b/arch/arm/mach-omap1/board-ams-delta.c | |||
@@ -181,6 +181,11 @@ static struct omap_board_config_kernel ams_delta_config[] = { | |||
181 | { OMAP_TAG_LCD, &ams_delta_lcd_config }, | 181 | { OMAP_TAG_LCD, &ams_delta_lcd_config }, |
182 | }; | 182 | }; |
183 | 183 | ||
184 | static struct platform_device ams_delta_nand_device = { | ||
185 | .name = "ams-delta-nand", | ||
186 | .id = -1 | ||
187 | }; | ||
188 | |||
184 | static struct resource ams_delta_kp_resources[] = { | 189 | static struct resource ams_delta_kp_resources[] = { |
185 | [0] = { | 190 | [0] = { |
186 | .start = INT_KEYBOARD, | 191 | .start = INT_KEYBOARD, |
@@ -263,6 +268,7 @@ static struct omap1_cam_platform_data ams_delta_camera_platform_data = { | |||
263 | }; | 268 | }; |
264 | 269 | ||
265 | static struct platform_device *ams_delta_devices[] __initdata = { | 270 | static struct platform_device *ams_delta_devices[] __initdata = { |
271 | &ams_delta_nand_device, | ||
266 | &ams_delta_kp_device, | 272 | &ams_delta_kp_device, |
267 | &ams_delta_lcd_device, | 273 | &ams_delta_lcd_device, |
268 | &ams_delta_led_device, | 274 | &ams_delta_led_device, |
diff --git a/drivers/mtd/nand/ams-delta.c b/drivers/mtd/nand/ams-delta.c index 2548e1065bf8..7d49f6a6b726 100644 --- a/drivers/mtd/nand/ams-delta.c +++ b/drivers/mtd/nand/ams-delta.c | |||
@@ -4,6 +4,7 @@ | |||
4 | * Copyright (C) 2006 Jonathan McDowell <noodles@earth.li> | 4 | * Copyright (C) 2006 Jonathan McDowell <noodles@earth.li> |
5 | * | 5 | * |
6 | * Derived from drivers/mtd/toto.c | 6 | * Derived from drivers/mtd/toto.c |
7 | * Converted to platform driver by Janusz Krzysztofik <jkrzyszt@tis.icnet.pl> | ||
7 | * | 8 | * |
8 | * This program is free software; you can redistribute it and/or modify | 9 | * This program is free software; you can redistribute it and/or modify |
9 | * it under the terms of the GNU General Public License version 2 as | 10 | * it under the terms of the GNU General Public License version 2 as |
@@ -151,7 +152,7 @@ static int ams_delta_nand_ready(struct mtd_info *mtd) | |||
151 | /* | 152 | /* |
152 | * Main initialization routine | 153 | * Main initialization routine |
153 | */ | 154 | */ |
154 | static int __init ams_delta_init(void) | 155 | static int __devinit ams_delta_init(struct platform_device *pdev) |
155 | { | 156 | { |
156 | struct nand_chip *this; | 157 | struct nand_chip *this; |
157 | int err = 0; | 158 | int err = 0; |
@@ -219,20 +220,40 @@ static int __init ams_delta_init(void) | |||
219 | return err; | 220 | return err; |
220 | } | 221 | } |
221 | 222 | ||
222 | module_init(ams_delta_init); | ||
223 | |||
224 | /* | 223 | /* |
225 | * Clean up routine | 224 | * Clean up routine |
226 | */ | 225 | */ |
227 | static void __exit ams_delta_cleanup(void) | 226 | static int __devexit ams_delta_cleanup(struct platform_device *pdev) |
228 | { | 227 | { |
229 | /* Release resources, unregister device */ | 228 | /* Release resources, unregister device */ |
230 | nand_release(ams_delta_mtd); | 229 | nand_release(ams_delta_mtd); |
231 | 230 | ||
232 | /* Free the MTD device structure */ | 231 | /* Free the MTD device structure */ |
233 | kfree(ams_delta_mtd); | 232 | kfree(ams_delta_mtd); |
233 | |||
234 | return 0; | ||
235 | } | ||
236 | |||
237 | static struct platform_driver ams_delta_nand_driver = { | ||
238 | .probe = ams_delta_init, | ||
239 | .remove = __devexit_p(ams_delta_cleanup), | ||
240 | .driver = { | ||
241 | .name = "ams-delta-nand", | ||
242 | .owner = THIS_MODULE, | ||
243 | }, | ||
244 | }; | ||
245 | |||
246 | static int __init ams_delta_nand_init(void) | ||
247 | { | ||
248 | return platform_driver_register(&ams_delta_nand_driver); | ||
249 | } | ||
250 | module_init(ams_delta_nand_init); | ||
251 | |||
252 | static void __exit ams_delta_nand_exit(void) | ||
253 | { | ||
254 | platform_driver_unregister(&ams_delta_nand_driver); | ||
234 | } | 255 | } |
235 | module_exit(ams_delta_cleanup); | 256 | module_exit(ams_delta_nand_exit); |
236 | 257 | ||
237 | MODULE_LICENSE("GPL"); | 258 | MODULE_LICENSE("GPL"); |
238 | MODULE_AUTHOR("Jonathan McDowell <noodles@earth.li>"); | 259 | MODULE_AUTHOR("Jonathan McDowell <noodles@earth.li>"); |