ARM: OMAP2+: gpmc-onenand: provide memory as resource
Currently omap onenand driver invokes gpmc_cs_request, obtains address space allocated by gpmc to onenand. Remove this, instead use resource structure; this is now updated with address space for onenand by gpmc initialization with the help of gpmc_cs_request. And remove usage of gpmc_cs_request in onenand driver. This helps in smooth migration of gpmc to driver. Signed-off-by: Afzal Mohammed <afzal@ti.com> Signed-off-by: Tony Lindgren <tony@atomide.com>
This commit is contained in:
parent
9222e3a7bb
commit
681988ba0c
1 changed files with 22 additions and 1 deletions
|
@ -23,11 +23,19 @@
|
|||
#include <plat/board.h>
|
||||
#include <plat/gpmc.h>
|
||||
|
||||
#define ONENAND_IO_SIZE SZ_128K
|
||||
|
||||
static struct omap_onenand_platform_data *gpmc_onenand_data;
|
||||
|
||||
static struct resource gpmc_onenand_resource = {
|
||||
.flags = IORESOURCE_MEM,
|
||||
};
|
||||
|
||||
static struct platform_device gpmc_onenand_device = {
|
||||
.name = "omap2-onenand",
|
||||
.id = -1,
|
||||
.num_resources = 1,
|
||||
.resource = &gpmc_onenand_resource,
|
||||
};
|
||||
|
||||
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)
|
|||
|
||||
void __init gpmc_onenand_init(struct omap_onenand_platform_data *_onenand_data)
|
||||
{
|
||||
int err;
|
||||
|
||||
gpmc_onenand_data = _onenand_data;
|
||||
gpmc_onenand_data->onenand_setup = gpmc_onenand_setup;
|
||||
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)
|
|||
gpmc_onenand_data->flags |= ONENAND_SYNC_READ;
|
||||
}
|
||||
|
||||
err = gpmc_cs_request(gpmc_onenand_data->cs, ONENAND_IO_SIZE,
|
||||
(unsigned long *)&gpmc_onenand_resource.start);
|
||||
if (err < 0) {
|
||||
pr_err("%s: Cannot request GPMC CS\n", __func__);
|
||||
return;
|
||||
}
|
||||
|
||||
gpmc_onenand_resource.end = gpmc_onenand_resource.start +
|
||||
ONENAND_IO_SIZE - 1;
|
||||
|
||||
if (platform_device_register(&gpmc_onenand_device) < 0) {
|
||||
printk(KERN_ERR "Unable to register OneNAND device\n");
|
||||
pr_err("%s: Unable to register OneNAND device\n", __func__);
|
||||
gpmc_cs_free(gpmc_onenand_data->cs);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue