Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 681988ba authored by Afzal Mohammed's avatar Afzal Mohammed Committed by Tony Lindgren
Browse files

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: default avatarAfzal Mohammed <afzal@ti.com>
Signed-off-by: default avatarTony Lindgren <tony@atomide.com>
parent 9222e3a7
Loading
Loading
Loading
Loading
+22 −1
Original line number Diff line number Diff line
@@ -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;
	}
}