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