From patchwork Wed Aug 22 22:25:11 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: stigge@antcom.de X-Patchwork-Id: 179423 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from merlin.infradead.org (merlin.infradead.org [IPv6:2001:4978:20e::2]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 416382C0085 for ; Thu, 23 Aug 2012 08:26:43 +1000 (EST) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1T4JMl-0002EO-6E; Wed, 22 Aug 2012 22:25:35 +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 1T4JMh-0002Ds-Ac; Wed, 22 Aug 2012 22:25:32 +0000 Received: from rst-pc1.lan.work-microwave.de ([192.168.11.78]) (authenticated bits=0) by mail.work-microwave.de with ESMTP id q7MMPFi9017554 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 22 Aug 2012 23:25:16 +0100 Received: by rst-pc1.lan.work-microwave.de (Postfix, from userid 1000) id DA5FEAE0A2; Thu, 23 Aug 2012 00:25:15 +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 RESEND] mtd: lpc32xx_slc: Make driver independent of AMBA DMA engine driver Date: Thu, 23 Aug 2012 00:25:11 +0200 Message-Id: <1345674311-16874-2-git-send-email-stigge@antcom.de> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1345674311-16874-1-git-send-email-stigge@antcom.de> References: <1345674311-16874-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.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-mtd@lists.infradead.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: linux-mtd-bounces@lists.infradead.org Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org This patch makes the SLC NAND driver independent of the single AMBA DMA engine driver by using the platform data provided dma_filter callback. (This also fixes the build error of the SLC NAND driver in case of module linking because the (not exported) reference to pl08x_filter_id is gone now.) Signed-off-by: Roland Stigge --- Applies to: v3.6-rc2 drivers/mtd/nand/lpc32xx_slc.c | 13 +++++++++++-- include/linux/mtd/lpc32xx_slc.h | 20 ++++++++++++++++++++ 2 files changed, 31 insertions(+), 2 deletions(-) --- linux-2.6.orig/drivers/mtd/nand/lpc32xx_slc.c +++ linux-2.6/drivers/mtd/nand/lpc32xx_slc.c @@ -37,7 +37,7 @@ #include #include #include -#include +#include #define LPC32XX_MODNAME "lpc32xx-nand" @@ -199,6 +199,7 @@ struct lpc32xx_nand_cfg_slc { struct lpc32xx_nand_host { struct nand_chip nand_chip; + struct lpc32xx_slc_platform_data *pdata; struct clk *clk; struct mtd_info mtd; void __iomem *io_base; @@ -714,9 +715,15 @@ static int lpc32xx_nand_dma_setup(struct struct mtd_info *mtd = &host->mtd; dma_cap_mask_t mask; + if (!host->pdata || !host->pdata->dma_filter) { + dev_err(mtd->dev.parent, "no DMA platform data\n"); + return -ENOENT; + } + dma_cap_zero(mask); dma_cap_set(DMA_SLAVE, mask); - host->dma_chan = dma_request_channel(mask, pl08x_filter_id, "nand-slc"); + host->dma_chan = dma_request_channel(mask, host->pdata->dma_filter, + "nand-slc"); if (!host->dma_chan) { dev_err(mtd->dev.parent, "Failed to request DMA channel\n"); return -EBUSY; @@ -814,6 +821,8 @@ static int __devinit lpc32xx_nand_probe( } lpc32xx_wp_disable(host); + host->pdata = pdev->dev.platform_data; + mtd = &host->mtd; chip = &host->nand_chip; chip->priv = host; --- /dev/null +++ linux-2.6/include/linux/mtd/lpc32xx_slc.h @@ -0,0 +1,20 @@ +/* + * Platform data for LPC32xx SoC SLC NAND controller + * + * Copyright (C) 2012 Roland Stigge + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + */ + +#ifndef __LINUX_MTD_LPC32XX_SLC_H +#define __LINUX_MTD_LPC32XX_SLC_H + +#include + +struct lpc32xx_slc_platform_data { + bool (*dma_filter)(struct dma_chan *chan, void *filter_param); +}; + +#endif /* __LINUX_MTD_LPC32XX_SLC_H */