From patchwork Wed Jun 11 08:56:29 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roger Quadros X-Patchwork-Id: 358557 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2001:1868:205::9]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id E99DE1400AB for ; Wed, 11 Jun 2014 19:01:51 +1000 (EST) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1WueOL-0005Sw-JB; Wed, 11 Jun 2014 09:00:21 +0000 Received: from bear.ext.ti.com ([192.94.94.41]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1WueMc-0002NX-SE; Wed, 11 Jun 2014 08:58:35 +0000 Received: from dlelxv90.itg.ti.com ([172.17.2.17]) by bear.ext.ti.com (8.13.7/8.13.7) with ESMTP id s5B8wEpL027190; Wed, 11 Jun 2014 03:58:14 -0500 Received: from DLEE70.ent.ti.com (dlee70.ent.ti.com [157.170.170.113]) by dlelxv90.itg.ti.com (8.14.3/8.13.8) with ESMTP id s5B8wEcb009583; Wed, 11 Jun 2014 03:58:14 -0500 Received: from dflp33.itg.ti.com (10.64.6.16) by DLEE70.ent.ti.com (157.170.170.113) with Microsoft SMTP Server id 14.3.174.1; Wed, 11 Jun 2014 03:58:14 -0500 Received: from localhost.localdomain (ileax41-snat.itg.ti.com [10.172.224.153]) by dflp33.itg.ti.com (8.14.3/8.13.8) with ESMTP id s5B8uiSw020510; Wed, 11 Jun 2014 03:58:11 -0500 From: Roger Quadros To: , , Subject: [PATCH 24/36] ARM: OMAP2+: gpmc: add NAND specific setup Date: Wed, 11 Jun 2014 11:56:29 +0300 Message-ID: <1402477001-31132-25-git-send-email-rogerq@ti.com> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1402477001-31132-1-git-send-email-rogerq@ti.com> References: <1402477001-31132-1-git-send-email-rogerq@ti.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140611_015835_081254_BEFBAB87 X-CRM114-Status: UNSURE ( 9.64 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -5.7 (-----) X-Spam-Report: SpamAssassin version 3.4.0 on bombadil.infradead.org summary: Content analysis details: (-5.7 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_MSPIKE_H3 RBL: Good reputation (+3) [192.94.94.41 listed in wl.mailspike.net] -5.0 RCVD_IN_DNSWL_HI RBL: Sender listed at http://www.dnswl.org/, high trust [192.94.94.41 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -0.7 RP_MATCHES_RCVD Envelope sender domain matches handover relay domain -0.0 RCVD_IN_MSPIKE_WL Mailspike good senders Cc: devicetree@vger.kernel.org, nsekhar@ti.com, linux-kernel@vger.kernel.org, kyungmin.park@samsung.com, linux-mtd@lists.infradead.org, pekon@ti.com, ezequiel.garcia@free-electrons.com, javier@dowhile0.org, linux-omap@vger.kernel.org, Roger Quadros X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-mtd" Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org Provide NAND specific resources and platform data. Signed-off-by: Roger Quadros --- 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,