From patchwork Fri May 6 11:02:45 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Guennadi Liakhovetski X-Patchwork-Id: 761942 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter2.kernel.org (8.14.4/8.14.3) with ESMTP id p46B2kGh003312 for ; Fri, 6 May 2011 11:02:58 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755290Ab1EFLC5 (ORCPT ); Fri, 6 May 2011 07:02:57 -0400 Received: from moutng.kundenserver.de ([212.227.126.187]:55062 "EHLO moutng.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755005Ab1EFLC4 (ORCPT ); Fri, 6 May 2011 07:02:56 -0400 Received: from axis700.grange (pD9EB8F3A.dip0.t-ipconnect.de [217.235.143.58]) by mrelayeu.kundenserver.de (node=mrbap3) with ESMTP (Nemesis) id 0LeM6H-1PzDD62R9p-00qDIq; Fri, 06 May 2011 13:02:46 +0200 Received: by axis700.grange (Postfix, from userid 1000) id 46C74189B89; Fri, 6 May 2011 13:02:45 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by axis700.grange (Postfix) with ESMTP id 43EBB189B88; Fri, 6 May 2011 13:02:45 +0200 (CEST) Date: Fri, 6 May 2011 13:02:45 +0200 (CEST) From: Guennadi Liakhovetski X-X-Sender: lyakh@axis700.grange To: linux-sh@vger.kernel.org cc: cjb@laptop.org, Magnus Damm , Paul Mundt , horms@verge.net.au, linux-mmc@vger.kernel.org Subject: [PATCH 4/4] mmc: sdhi: support up to 3 interrupt sources In-Reply-To: Message-ID: References: MIME-Version: 1.0 X-Provags-ID: V02:K0:4cKhNcucMci6aKddB9Yi5VCaCZlK02ZfQlocTWO2/2Y rff8inL9493u1w0B3AtVKgMNndKQ7RZIC58DmcyDAh0g428JHX PQCUS4CCTG1KC5niYbeWiE/SFsMeoqX3ovfFUpBzPtlBXdZbBv lVi0TpB4qTYA1Zt9GcwoHCykuq++HJekgZJJcW5ZJNGf1l/Qer HIMAGVZuUp1liwJ1oNepyFxhNaym6qZxusFA7yQZF4= Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter2.kernel.org [140.211.167.43]); Fri, 06 May 2011 11:02:58 +0000 (UTC) From: Magnus Damm Convert the SDHI code to support more than a single interrupt source. Needed to support hardware that uses GIC instead of INTC as interrupt controller. Will also allow us to remove the irq forwarding workaround from the INTC code in the future. Signed-off-by: Simon Horman Signed-off-by: Magnus Damm Signed-off-by: Guennadi Liakhovetski --- drivers/mmc/host/sh_mobile_sdhi.c | 39 ++++++++++++++++++++++++++---------- 1 files changed, 28 insertions(+), 11 deletions(-) diff --git a/drivers/mmc/host/sh_mobile_sdhi.c b/drivers/mmc/host/sh_mobile_sdhi.c index 2bd235b..d264bbe 100644 --- a/drivers/mmc/host/sh_mobile_sdhi.c +++ b/drivers/mmc/host/sh_mobile_sdhi.c @@ -62,7 +62,7 @@ static int __devinit sh_mobile_sdhi_probe(struct platform_device *pdev) struct sh_mobile_sdhi_info *p = pdev->dev.platform_data; struct tmio_mmc_host *host; char clk_name[8]; - int irq, ret; + int i, irq, ret; priv = kzalloc(sizeof(struct sh_mobile_sdhi), GFP_KERNEL); if (priv == NULL) { @@ -116,16 +116,27 @@ static int __devinit sh_mobile_sdhi_probe(struct platform_device *pdev) if (ret < 0) goto eprobe; - irq = platform_get_irq(pdev, 0); - if (irq < 0) { - ret = irq; - goto eirq; + for (i = 0; i < 3; i++) { + irq = platform_get_irq(pdev, i); + if (irq < 0) { + if (i) { + continue; + } else { + ret = irq; + goto eirq; + } + } + ret = request_irq(irq, tmio_mmc_irq, 0, + dev_name(&pdev->dev), host); + if (ret) { + while (i--) { + irq = platform_get_irq(pdev, i); + if (irq >= 0) + free_irq(irq, host); + } + goto eirq; + } } - - ret = request_irq(irq, tmio_mmc_irq, 0, dev_name(&pdev->dev), host); - if (ret) - goto eirq; - dev_info(&pdev->dev, "%s base at 0x%08lx clock rate %u MHz\n", mmc_hostname(host->mmc), (unsigned long) (platform_get_resource(pdev,IORESOURCE_MEM, 0)->start), @@ -148,8 +159,14 @@ static int sh_mobile_sdhi_remove(struct platform_device *pdev) struct mmc_host *mmc = platform_get_drvdata(pdev); struct tmio_mmc_host *host = mmc_priv(mmc); struct sh_mobile_sdhi *priv = container_of(host->pdata, struct sh_mobile_sdhi, mmc_data); + int i, irq; + + for (i = 0; i < 3; i++) { + irq = platform_get_irq(pdev, i); + if (irq >= 0) + free_irq(irq, host); + } - free_irq(platform_get_irq(pdev, 0), host); tmio_mmc_host_remove(host); clk_disable(priv->clk); clk_put(priv->clk);