From patchwork Thu Oct 11 08:11:13 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomasz Figa X-Patchwork-Id: 1581371 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 A8D1ADFABE for ; Thu, 11 Oct 2012 08:16:43 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1TMDuQ-0007rj-Jn; Thu, 11 Oct 2012 08:14:22 +0000 Received: from mailout4.samsung.com ([203.254.224.34]) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1TMDsE-0006jl-4K for linux-arm-kernel@lists.infradead.org; Thu, 11 Oct 2012 08:12:07 +0000 Received: from epcpsbgm2.samsung.com (epcpsbgm2 [203.254.230.27]) by mailout4.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0MBP00EJJYRJYEI0@mailout4.samsung.com> for linux-arm-kernel@lists.infradead.org; Thu, 11 Oct 2012 17:12:05 +0900 (KST) X-AuditID: cbfee61b-b7f2b6d000000f14-a3-50767f5596d9 Received: from epmmp1.local.host ( [203.254.227.16]) by epcpsbgm2.samsung.com (EPCPMTA) with SMTP id 9F.C5.03860.55F76705; Thu, 11 Oct 2012 17:12:05 +0900 (KST) Received: from mcdsrvbld02.digital.local ([106.116.37.23]) by mmp1.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0MBP005FVYR04E50@mmp1.samsung.com> for linux-arm-kernel@lists.infradead.org; Thu, 11 Oct 2012 17:12:05 +0900 (KST) From: Tomasz Figa To: linux-arm-kernel@lists.infradead.org Subject: [PATCH 07/15] pinctrl: samsung: Match pin banks with their device nodes Date: Thu, 11 Oct 2012 10:11:13 +0200 Message-id: <1349943081-27939-8-git-send-email-t.figa@samsung.com> X-Mailer: git-send-email 1.7.10 In-reply-to: <1349943081-27939-1-git-send-email-t.figa@samsung.com> References: <1349943081-27939-1-git-send-email-t.figa@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrEJMWRmVeSWpSXmKPExsVy+t9jAd3Q+rIAg4UtnBabHl9jdWD02Lyk PoAxissmJTUnsyy1SN8ugSvjw7bnLAWf+SveXp3O3sD4k6eLkZNDQsBE4sHvN0wQtpjEhXvr 2boYuTiEBBYxSvR+P8kM4Wxmkvh4tZ8FpIpNQE3ic8MjNhBbREBDYkrXY3aQImaBpUwS25ZM AEsICwRILG3fCtTNwcEioCoxaYYzSJhXwEniw+ybrBDb5CWe3u8DK+cUcJb4umkF2BVCQDVn Xz9mn8DIu4CRYRWjaGpBckFxUnqukV5xYm5xaV66XnJ+7iZGsM+fSe9gXNVgcYhRgINRiYfX YV1pgBBrYllxZe4hRgkOZiUR3su1ZQFCvCmJlVWpRfnxRaU5qcWHGKU5WJTEeZs9UgKEBNIT S1KzU1MLUotgskwcnFINjLz7/ios9g7eKths+JRjUcvPlLTbb8UlO7NNNx515Ns77xrjJh2T /PUnJjmY/d52cWewo7pCVcMH/c4Pe52Tpy4L32+76saJaYaCi2bW9n5QbZ70xKiQy+jtght/ Ul0X/zw8V7vb4PixmMv2M3atWeR6/qXoLnNnb09mnokFcq5zOpY2rbdfqaLEUpyRaKjFXFSc CAAk8Af99QEAAA== X-Spam-Note: CRM114 invocation failed X-Spam-Score: -9.0 (---------) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-9.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- -5.0 RCVD_IN_DNSWL_HI RBL: Sender listed at http://www.dnswl.org/, high trust [203.254.224.34 listed in list.dnswl.org] -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -2.1 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: kgene.kim@samsung.com, swarren@wwwdotorg.org, tony@atomide.com, devicetree-discuss@lists.ozlabs.org, tomasz.figa@gmail.com, t.figa@samsung.com, kyungmin.park@samsung.com, linux-samsung-soc@vger.kernel.org, thomas.abraham@linaro.org, linus.walleij@linaro.org, m.szyprowski@samsung.com 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 This patch is a preparation for converting the pinctrl-samsung driver to one GPIO chip and IRQ domain per bank. It binds banks defined by internal driver data with bank nodes in device tree. Signed-off-by: Tomasz Figa --- drivers/pinctrl/pinctrl-samsung.c | 13 +++++++++++++ drivers/pinctrl/pinctrl-samsung.h | 2 ++ 2 files changed, 15 insertions(+) diff --git a/drivers/pinctrl/pinctrl-samsung.c b/drivers/pinctrl/pinctrl-samsung.c index 94e1378..f266710 100644 --- a/drivers/pinctrl/pinctrl-samsung.c +++ b/drivers/pinctrl/pinctrl-samsung.c @@ -794,6 +794,7 @@ static struct samsung_pin_ctrl *samsung_pinctrl_get_soc_data( int id; const struct of_device_id *match; const struct device_node *node = pdev->dev.of_node; + struct device_node *np; struct samsung_pin_ctrl *ctrl; struct samsung_pin_bank *bank; int i; @@ -816,6 +817,18 @@ static struct samsung_pin_ctrl *samsung_pinctrl_get_soc_data( } } + for_each_child_of_node(node, np) { + if (!of_find_property(np, "gpio-controller", NULL)) + continue; + bank = ctrl->pin_banks; + for (i = 0; i < ctrl->nr_banks; ++i, ++bank) { + if (!strcmp(bank->name, np->name)) { + bank->of_node = np; + break; + } + } + } + ctrl->base = pin_base; pin_base += ctrl->nr_pins; diff --git a/drivers/pinctrl/pinctrl-samsung.h b/drivers/pinctrl/pinctrl-samsung.h index b895693..5c53f32 100644 --- a/drivers/pinctrl/pinctrl-samsung.h +++ b/drivers/pinctrl/pinctrl-samsung.h @@ -111,6 +111,7 @@ struct samsung_pinctrl_drv_data; * @eint_type: type of the external interrupt supported by the bank. * @irq_base: starting controller local irq number of the bank. * @name: name to be prefixed for each pin in this pin bank. + * @of_node: OF node of the bank. */ struct samsung_pin_bank { u32 pctl_offset; @@ -124,6 +125,7 @@ struct samsung_pin_bank { enum eint_type eint_type; u32 irq_base; char *name; + struct device_node *of_node; }; /**