lkml.org 
[lkml]   [2014]   [Jun]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 24/36] ARM: OMAP2+: gpmc: add NAND specific setup
Date
Provide NAND specific resources and platform data.

Signed-off-by: Roger Quadros <rogerq@ti.com>
---
arch/arm/mach-omap2/gpmc.c | 45 +++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 45 insertions(+)

diff --git a/arch/arm/mach-omap2/gpmc.c b/arch/arm/mach-omap2/gpmc.c
index c26ba3f..5563360 100644
--- a/arch/arm/mach-omap2/gpmc.c
+++ b/arch/arm/mach-omap2/gpmc.c
@@ -1350,6 +1350,42 @@ static int gpmc_probe_dt(struct platform_device *pdev)
}
#endif

+static int gpmc_nand_setup(struct platform_device *parent_pdev,
+ struct gpmc_omap_cs_data *cs)
+{
+ struct resource *res;
+ struct resource *res_gpmc;
+
+ if (!cs->pdev)
+ return -EINVAL;
+
+ res = cs->pdev->resource;
+
+ if (cs->pdev->num_resources < 3)
+ return -EINVAL;
+
+ if (resource_type(&res[1]) != IORESOURCE_MEM ||
+ resource_type(&res[2]) != IORESOURCE_IRQ)
+ return -EINVAL;
+
+ if (!cs->settings)
+ return -EINVAL;
+
+ /* GPMC register space */
+ res_gpmc = platform_get_resource(parent_pdev, IORESOURCE_MEM, 0);
+ if (!res_gpmc)
+ return -EINVAL;
+
+ res[1] = *res_gpmc;
+
+ /* setup IRQ resources */
+ res[2].start = gpmc_irq;
+
+ cs->settings->device_nand = true;
+
+ return 0;
+}
+
static void gpmc_probe_legacy(struct platform_device *pdev)
{
int i, rc;
@@ -1401,6 +1437,15 @@ static void gpmc_probe_legacy(struct platform_device *pdev)
/* FIXME: When do we need to call gpmc_cs_remap()? */
skip_mem:

+ /* Customized NAND setup */
+ if (cs->is_nand) {
+ if (gpmc_nand_setup(pdev, cs)) {
+ dev_err(dev, "Error setting up NAND on CS %d\n",
+ i);
+ continue;
+ }
+ }
+
if (cs->settings) {
if (gpmc_cs_program_settings(i, cs->settings)) {
dev_err(dev,
--
1.8.3.2


\
 
 \ /
  Last update: 2014-06-11 11:41    [W:0.257 / U:0.056 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site