From patchwork Wed Sep 26 17:18:07 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 11742 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id 26DC923E41 for ; Wed, 26 Sep 2012 17:18:33 +0000 (UTC) Received: from mail-ie0-f180.google.com (mail-ie0-f180.google.com [209.85.223.180]) by fiordland.canonical.com (Postfix) with ESMTP id AEC95A19001 for ; Wed, 26 Sep 2012 17:18:32 +0000 (UTC) Received: by ieje10 with SMTP id e10so1982737iej.11 for ; Wed, 26 Sep 2012 10:18:32 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-forwarded-to:x-forwarded-for:delivered-to:received-spf:from:to:cc :subject:date:message-id:x-mailer:mime-version:content-type :x-gm-message-state; bh=LIVQFEQhMb5gTgnGkAtvMKjanOhowM00JI8iiaujA84=; b=WQUuDu6tgLRO1+60p7IrgPnit/EeWOI/nvdP4JAHURKUY8sImgU1MYhl7fbnbIckFA MtLnE/4EAilLMiOXhiyUjd9AR/3/UWOIbM6WAsRpybJPkK9PxxGFgwl7ZzRbYjsY3vqe 7yTQNKN5L6VDpI0Id7uvvHaEwRQA3L4Ri6sD1nIaoKwjYLn3EAiqy1tA1LzECOUg+C4A DgZPS4mvwwliuBXv9/5Su5QQI6Q8lvZQiI4G1rs90w0U+kn97HSzKYOg7dCqX+f/r7lp zkW0umEdClkBGLLpu6dgzNBVqJLP+zUE1xuZU/22njyS6Dy7llHm4RRs+OI8g1DJjolw R7UQ== Received: by 10.42.109.194 with SMTP id m2mr913200icp.48.1348679911935; Wed, 26 Sep 2012 10:18:31 -0700 (PDT) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.50.184.232 with SMTP id ex8csp368721igc; Wed, 26 Sep 2012 10:18:30 -0700 (PDT) Received: by 10.14.180.68 with SMTP id i44mr2478206eem.20.1348679908840; Wed, 26 Sep 2012 10:18:28 -0700 (PDT) Received: from eu1sys200aog113.obsmtp.com (eu1sys200aog113.obsmtp.com [207.126.144.135]) by mx.google.com with SMTP id m5si3427998een.87.2012.09.26.10.18.22 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 26 Sep 2012 10:18:28 -0700 (PDT) Received-SPF: neutral (google.com: 207.126.144.135 is neither permitted nor denied by best guess record for domain of linus.walleij@stericsson.com) client-ip=207.126.144.135; Authentication-Results: mx.google.com; spf=neutral (google.com: 207.126.144.135 is neither permitted nor denied by best guess record for domain of linus.walleij@stericsson.com) smtp.mail=linus.walleij@stericsson.com Received: from beta.dmz-eu.st.com ([164.129.1.35]) (using TLSv1) by eu1sys200aob113.postini.com ([207.126.147.11]) with SMTP ID DSNKUGM43Irr2pfodTgmPwcMwzTTlMpNvAOG@postini.com; Wed, 26 Sep 2012 17:18:28 UTC Received: from zeta.dmz-eu.st.com (zeta.dmz-eu.st.com [164.129.230.9]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 789B9D5; Wed, 26 Sep 2012 17:18:16 +0000 (GMT) Received: from relay2.stm.gmessaging.net (unknown [10.230.100.18]) by zeta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 0A5932600; Wed, 26 Sep 2012 17:18:16 +0000 (GMT) Received: from exdcvycastm004.EQ1STM.local (alteon-source-exch [10.230.100.61]) (using TLSv1 with cipher RC4-MD5 (128/128 bits)) (Client CN "exdcvycastm004", Issuer "exdcvycastm004" (not verified)) by relay2.stm.gmessaging.net (Postfix) with ESMTPS id C1038A8065; Wed, 26 Sep 2012 19:18:08 +0200 (CEST) Received: from steludxu4075.lud.stericsson.com (10.230.100.153) by smtp.stericsson.com (10.230.100.2) with Microsoft SMTP Server (TLS) id 8.3.83.0; Wed, 26 Sep 2012 19:18:15 +0200 From: Linus Walleij To: , Cc: Stephen Warren , Anmar Oueja , Linus Walleij , Rob Herring Subject: [PATCH] pinctrl/nomadik: allocate IRQ descriptors dynamically Date: Wed, 26 Sep 2012 19:18:07 +0200 Message-ID: <1348679887-2135-1-git-send-email-linus.walleij@stericsson.com> X-Mailer: git-send-email 1.7.11.3 MIME-Version: 1.0 X-Gm-Message-State: ALoCoQmgFVUk53kx/8028Z0nQMf1wABaaBLPtmtxzcDPp6y/K/3uDzFmTmoH90ZbM4UxK5uQtE7b From: Linus Walleij This allocates the IRQ descriptors for the Nomadik pin controller dynamically so that we don't have to rely on some other mechanism doing it, and moving a step closer to a linear IRQ domain. Cc: Rob Herring Signed-off-by: Linus Walleij --- drivers/pinctrl/pinctrl-nomadik.c | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/drivers/pinctrl/pinctrl-nomadik.c b/drivers/pinctrl/pinctrl-nomadik.c index 3dde653..29921d1 100644 --- a/drivers/pinctrl/pinctrl-nomadik.c +++ b/drivers/pinctrl/pinctrl-nomadik.c @@ -1185,6 +1185,8 @@ static int __devinit nmk_gpio_probe(struct platform_device *dev) struct clk *clk; int secondary_irq; void __iomem *base; + int irq_start; + int irq_base; int irq; int ret; @@ -1288,9 +1290,22 @@ static int __devinit nmk_gpio_probe(struct platform_device *dev) platform_set_drvdata(dev, nmk_chip); + /* + * Allocate descriptors and IRQ domain using the legacy model, this + * should eventually be replaced with a linear IRQ domain as we get + * independent from the irq numbers with the switch to device tree. + */ + irq_start = NOMADIK_GPIO_TO_IRQ(pdata->first_gpio); + irq_base = irq_alloc_descs(irq_start, 0, NMK_GPIO_PER_CHIP, + numa_node_id()); + if (IS_ERR_VALUE(irq_base)) { + WARN(1, "Cannot allocate irq_descs @ IRQ%d, assuming pre-allocated\n", + irq_start); + irq_base = irq_start; + } nmk_chip->domain = irq_domain_add_legacy(np, NMK_GPIO_PER_CHIP, - NOMADIK_GPIO_TO_IRQ(pdata->first_gpio), - 0, &nmk_gpio_irq_simple_ops, nmk_chip); + irq_base, 0, + &nmk_gpio_irq_simple_ops, nmk_chip); if (!nmk_chip->domain) { dev_err(&dev->dev, "failed to create irqdomain\n"); ret = -ENOSYS;