[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1402477001-31132-33-git-send-email-rogerq@ti.com>
Date: Wed, 11 Jun 2014 11:56:37 +0300
From: Roger Quadros <rogerq@...com>
To: <tony@...mide.com>, <dwmw2@...radead.org>,
<computersforpeace@...il.com>
CC: <kyungmin.park@...sung.com>, <pekon@...com>,
<ezequiel.garcia@...e-electrons.com>, <javier@...hile0.org>,
<nsekhar@...com>, <linux-omap@...r.kernel.org>,
<linux-mtd@...ts.infradead.org>, <devicetree@...r.kernel.org>,
<linux-kernel@...r.kernel.org>, Roger Quadros <rogerq@...com>
Subject: [PATCH 32/36] ARM: OMAP2+: onenand: Use gpmc_generic_init()
Don't access any GPMC registers here. Use gpmc_generic_init()
to pass GPMC Chip Select settings, platform device and platform data
to the GPMC driver.
Signed-off-by: Roger Quadros <rogerq@...com>
---
arch/arm/mach-omap2/gpmc-onenand.c | 53 ++++++++------------------------------
1 file changed, 11 insertions(+), 42 deletions(-)
diff --git a/arch/arm/mach-omap2/gpmc-onenand.c b/arch/arm/mach-omap2/gpmc-onenand.c
index 37ed4f1..139b3dd 100644
--- a/arch/arm/mach-omap2/gpmc-onenand.c
+++ b/arch/arm/mach-omap2/gpmc-onenand.c
@@ -27,7 +27,10 @@
#define ONENAND_IO_SIZE SZ_128K
static struct resource gpmc_onenand_resource = {
+/* GPMC driver will fixup the memory resource, see gpmc_probe_legacy() */
.flags = IORESOURCE_MEM,
+ .start = 0,
+ .end = ONENAND_IO_SIZE - 1,
};
static struct platform_device gpmc_onenand_device = {
@@ -68,29 +71,11 @@ static void omap2_onenand_get_async_timings(struct gpmc_device_timings *dev_t)
dev_t->t_wph = t_wph * 1000;
}
-static int omap2_onenand_setup_async(struct omap_onenand_platform_data
- *gpmc_onenand_data)
-{
- struct gpmc_timings gpmc_t;
- struct gpmc_device_timings dev_t;
- int ret;
-
- ret = gpmc_cs_program_settings(gpmc_onenand_data->cs, &onenand_async);
- if (ret < 0)
- return ret;
-
- omap2_onenand_get_async_timings(&dev_t);
- gpmc_calc_timings(&gpmc_t, &onenand_async, &dev_t);
- if (gpmc_cs_set_timings(gpmc_onenand_data->cs, &gpmc_t))
- return -EINVAL;
-
- return 0;
-}
-
void gpmc_onenand_init(struct omap_onenand_platform_data *gpmc_onenand_data)
{
int err;
struct device *dev = &gpmc_onenand_device.dev;
+ struct gpmc_device_timings dev_t;
gpmc_onenand_device.dev.platform_data = gpmc_onenand_data;
@@ -106,29 +91,13 @@ void gpmc_onenand_init(struct omap_onenand_platform_data *gpmc_onenand_data)
else
gpmc_onenand_data->flags &= ~ONENAND_IN_OMAP34XX;
- err = gpmc_cs_request(gpmc_onenand_data->cs, ONENAND_IO_SIZE,
- (unsigned long *)&gpmc_onenand_resource.start);
- if (err < 0) {
- dev_err(dev, "Cannot request GPMC CS %d, error %d\n",
- gpmc_onenand_data->cs, err);
- return;
- }
-
- gpmc_onenand_resource.end = gpmc_onenand_resource.start +
- ONENAND_IO_SIZE - 1;
-
- if (omap2_onenand_setup_async(gpmc_onenand_data)) {
- pr_err("%s: Failed to setup ASYNC timings\n", __func__);
- goto fail;
- }
-
- if (platform_device_register(&gpmc_onenand_device) < 0) {
- dev_err(dev, "Unable to register OneNAND device\n");
- goto fail;
- }
- return;
+ omap2_onenand_get_async_timings(&dev_t);
-fail:
- gpmc_cs_free(gpmc_onenand_data->cs);
+ err = gpmc_generic_init(gpmc_onenand_data->cs, false,
+ &onenand_async, &dev_t, NULL,
+ &gpmc_onenand_device,
+ sizeof(*gpmc_onenand_data));
+ if (err)
+ pr_err("%s: gpmc_generic_init() failed %d\n", __func__, err);
}
--
1.8.3.2
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists