diff options
Diffstat (limited to 'arch/arm/mach-omap2/gpmc-onenand.c')
-rw-r--r-- | arch/arm/mach-omap2/gpmc-onenand.c | 27 |
1 files changed, 24 insertions, 3 deletions
diff --git a/arch/arm/mach-omap2/gpmc-onenand.c b/arch/arm/mach-omap2/gpmc-onenand.c index a0fa9bb2bda5..b66fb8e5faaa 100644 --- a/arch/arm/mach-omap2/gpmc-onenand.c +++ b/arch/arm/mach-omap2/gpmc-onenand.c | |||
@@ -18,16 +18,24 @@ | |||
18 | 18 | ||
19 | #include <asm/mach/flash.h> | 19 | #include <asm/mach/flash.h> |
20 | 20 | ||
21 | #include <plat/cpu.h> | ||
22 | #include <plat/onenand.h> | 21 | #include <plat/onenand.h> |
23 | #include <plat/board.h> | ||
24 | #include <plat/gpmc.h> | 22 | #include <plat/gpmc.h> |
25 | 23 | ||
24 | #include "soc.h" | ||
25 | |||
26 | #define ONENAND_IO_SIZE SZ_128K | ||
27 | |||
26 | static struct omap_onenand_platform_data *gpmc_onenand_data; | 28 | static struct omap_onenand_platform_data *gpmc_onenand_data; |
27 | 29 | ||
30 | static struct resource gpmc_onenand_resource = { | ||
31 | .flags = IORESOURCE_MEM, | ||
32 | }; | ||
33 | |||
28 | static struct platform_device gpmc_onenand_device = { | 34 | static struct platform_device gpmc_onenand_device = { |
29 | .name = "omap2-onenand", | 35 | .name = "omap2-onenand", |
30 | .id = -1, | 36 | .id = -1, |
37 | .num_resources = 1, | ||
38 | .resource = &gpmc_onenand_resource, | ||
31 | }; | 39 | }; |
32 | 40 | ||
33 | static int omap2_onenand_set_async_mode(int cs, void __iomem *onenand_base) | 41 | static int omap2_onenand_set_async_mode(int cs, void __iomem *onenand_base) |
@@ -390,6 +398,8 @@ static int gpmc_onenand_setup(void __iomem *onenand_base, int *freq_ptr) | |||
390 | 398 | ||
391 | void __init gpmc_onenand_init(struct omap_onenand_platform_data *_onenand_data) | 399 | void __init gpmc_onenand_init(struct omap_onenand_platform_data *_onenand_data) |
392 | { | 400 | { |
401 | int err; | ||
402 | |||
393 | gpmc_onenand_data = _onenand_data; | 403 | gpmc_onenand_data = _onenand_data; |
394 | gpmc_onenand_data->onenand_setup = gpmc_onenand_setup; | 404 | gpmc_onenand_data->onenand_setup = gpmc_onenand_setup; |
395 | gpmc_onenand_device.dev.platform_data = gpmc_onenand_data; | 405 | gpmc_onenand_device.dev.platform_data = gpmc_onenand_data; |
@@ -401,8 +411,19 @@ void __init gpmc_onenand_init(struct omap_onenand_platform_data *_onenand_data) | |||
401 | gpmc_onenand_data->flags |= ONENAND_SYNC_READ; | 411 | gpmc_onenand_data->flags |= ONENAND_SYNC_READ; |
402 | } | 412 | } |
403 | 413 | ||
414 | err = gpmc_cs_request(gpmc_onenand_data->cs, ONENAND_IO_SIZE, | ||
415 | (unsigned long *)&gpmc_onenand_resource.start); | ||
416 | if (err < 0) { | ||
417 | pr_err("%s: Cannot request GPMC CS\n", __func__); | ||
418 | return; | ||
419 | } | ||
420 | |||
421 | gpmc_onenand_resource.end = gpmc_onenand_resource.start + | ||
422 | ONENAND_IO_SIZE - 1; | ||
423 | |||
404 | if (platform_device_register(&gpmc_onenand_device) < 0) { | 424 | if (platform_device_register(&gpmc_onenand_device) < 0) { |
405 | printk(KERN_ERR "Unable to register OneNAND device\n"); | 425 | pr_err("%s: Unable to register OneNAND device\n", __func__); |
426 | gpmc_cs_free(gpmc_onenand_data->cs); | ||
406 | return; | 427 | return; |
407 | } | 428 | } |
408 | } | 429 | } |