From patchwork Fri Aug 24 13:06:52 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roland Stigge X-Patchwork-Id: 1370901 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by patchwork2.kernel.org (Postfix) with ESMTP id 95FCEDF28C for ; Fri, 24 Aug 2012 13:11:03 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1T4tbu-0001KD-8y; Fri, 24 Aug 2012 13:07:38 +0000 Received: from mail.work-microwave.de ([62.245.205.51] helo=work-microwave.de) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1T4tbi-0001GE-NR; Fri, 24 Aug 2012 13:07:27 +0000 Received: from rst-pc1.lan.work-microwave.de ([192.168.11.78]) (authenticated bits=0) by mail.work-microwave.de with ESMTP id q7OD74EH025036 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 24 Aug 2012 14:07:05 +0100 Received: by rst-pc1.lan.work-microwave.de (Postfix, from userid 1000) id AD27DAE06B; Fri, 24 Aug 2012 15:07:04 +0200 (CEST) From: Roland Stigge To: linux@arm.linux.org.uk, artem.bityutskiy@linux.intel.com, linux-arm-kernel@lists.infradead.org, arnd@arndb.de, linux-kernel@vger.kernel.org, kevin.wells@nxp.com, srinivas.bakki@nxp.com, aletes.xgr@gmail.com, dwmw2@infradead.org, linux-mtd@lists.infradead.org Subject: [PATCH 2/2] mtd: lpc32xx_mlc: Cleanup after DT-only conversion Date: Fri, 24 Aug 2012 15:06:52 +0200 Message-Id: <1345813612-4234-2-git-send-email-stigge@antcom.de> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1345813612-4234-1-git-send-email-stigge@antcom.de> References: <1345813612-4234-1-git-send-email-stigge@antcom.de> X-FEAS-SYSTEM-WL: rst@work-microwave.de, 192.168.11.78 X-Spam-Note: CRM114 invocation failed X-Spam-Score: -2.1 (--) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-2.1 points) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 KHOP_BIG_TO_CC Sent to 10+ recipients instaed of Bcc or a list -0.2 RP_MATCHES_RCVD Envelope sender domain matches handover relay domain -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: Roland Stigge X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org The LPC32xx's DT-only conversion of the MLC NAND driver makes NAND config via platform_data obsolete. Dropped by this patch. Further, the driver really needs CONFIG_OF, which is already reflected by the dependency on ARCH_LPC32XX which depends on CONFIG_OF. So also dropping CONFIG_OF ifdefs. There is still platform_data necessary to supply the dma_filter callback for the dma engine. This is a completely different data structure than the old platform_data for NAND config, so renaming some old "pdata" variable to "ncfg" to prevent confusion with the new platform data. Signed-off-by: Roland Stigge --- drivers/mtd/nand/lpc32xx_mlc.c | 46 ++++++++++++++++------------------------- 1 file changed, 18 insertions(+), 28 deletions(-) --- linux-2.6.orig/drivers/mtd/nand/lpc32xx_mlc.c +++ linux-2.6/drivers/mtd/nand/lpc32xx_mlc.c @@ -621,43 +621,36 @@ out1: return -ENXIO; } -#ifdef CONFIG_OF static struct lpc32xx_nand_cfg_mlc *lpc32xx_parse_dt(struct device *dev) { - struct lpc32xx_nand_cfg_mlc *pdata; + struct lpc32xx_nand_cfg_mlc *ncfg; struct device_node *np = dev->of_node; - pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL); - if (!pdata) { + ncfg = devm_kzalloc(dev, sizeof(*ncfg), GFP_KERNEL); + if (!ncfg) { dev_err(dev, "could not allocate memory for platform data\n"); return NULL; } - of_property_read_u32(np, "nxp,tcea-delay", &pdata->tcea_delay); - of_property_read_u32(np, "nxp,busy-delay", &pdata->busy_delay); - of_property_read_u32(np, "nxp,nand-ta", &pdata->nand_ta); - of_property_read_u32(np, "nxp,rd-high", &pdata->rd_high); - of_property_read_u32(np, "nxp,rd-low", &pdata->rd_low); - of_property_read_u32(np, "nxp,wr-high", &pdata->wr_high); - of_property_read_u32(np, "nxp,wr-low", &pdata->wr_low); - - if (!pdata->tcea_delay || !pdata->busy_delay || !pdata->nand_ta || - !pdata->rd_high || !pdata->rd_low || !pdata->wr_high || - !pdata->wr_low) { + of_property_read_u32(np, "nxp,tcea-delay", &ncfg->tcea_delay); + of_property_read_u32(np, "nxp,busy-delay", &ncfg->busy_delay); + of_property_read_u32(np, "nxp,nand-ta", &ncfg->nand_ta); + of_property_read_u32(np, "nxp,rd-high", &ncfg->rd_high); + of_property_read_u32(np, "nxp,rd-low", &ncfg->rd_low); + of_property_read_u32(np, "nxp,wr-high", &ncfg->wr_high); + of_property_read_u32(np, "nxp,wr-low", &ncfg->wr_low); + + if (!ncfg->tcea_delay || !ncfg->busy_delay || !ncfg->nand_ta || + !ncfg->rd_high || !ncfg->rd_low || !ncfg->wr_high || + !ncfg->wr_low) { dev_err(dev, "chip parameters not specified correctly\n"); return NULL; } - pdata->wp_gpio = of_get_named_gpio(np, "gpios", 0); + ncfg->wp_gpio = of_get_named_gpio(np, "gpios", 0); - return pdata; + return ncfg; } -#else -static struct lpc32xx_nand_cfg_mlc *lpc32xx_parse_dt(struct device *dev) -{ - return NULL; -} -#endif /* * Probe for NAND controller @@ -695,10 +688,9 @@ static int __devinit lpc32xx_nand_probe( nand_chip = &host->nand_chip; if (pdev->dev.of_node) host->ncfg = lpc32xx_parse_dt(&pdev->dev); - else - host->ncfg = pdev->dev.platform_data; if (!host->ncfg) { - dev_err(&pdev->dev, "Missing platform data\n"); + dev_err(&pdev->dev, + "Missing or bad NAND config from device tree\n"); return -ENOENT; } if (host->ncfg->wp_gpio == -EPROBE_DEFER) @@ -907,13 +899,11 @@ static int lpc32xx_nand_suspend(struct p #define lpc32xx_nand_suspend NULL #endif -#if defined(CONFIG_OF) static const struct of_device_id lpc32xx_nand_match[] = { { .compatible = "nxp,lpc3220-mlc" }, { /* sentinel */ }, }; MODULE_DEVICE_TABLE(of, lpc32xx_nand_match); -#endif static struct platform_driver lpc32xx_nand_driver = { .probe = lpc32xx_nand_probe,