From patchwork Fri Sep 28 14:28:36 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomasz Figa X-Patchwork-Id: 1519851 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 4EA80DF283 for ; Fri, 28 Sep 2012 14:33:12 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1THbaK-0003mw-5Y; Fri, 28 Sep 2012 14:30:32 +0000 Received: from mailout2.samsung.com ([203.254.224.25]) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1THbZN-0003YB-KA for linux-arm-kernel@lists.infradead.org; Fri, 28 Sep 2012 14:29:34 +0000 Received: from epcpsbgm1.samsung.com (epcpsbgm1 [203.254.230.26]) by mailout2.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0MB2009Y9DKZWD10@mailout2.samsung.com> for linux-arm-kernel@lists.infradead.org; Fri, 28 Sep 2012 23:29:32 +0900 (KST) X-AuditID: cbfee61a-b7f726d000000ec7-62-5065b44c5f1c Received: from epmmp1.local.host ( [203.254.227.16]) by epcpsbgm1.samsung.com (EPCPMTA) with SMTP id 4A.19.03783.C44B5605; Fri, 28 Sep 2012 23:29:32 +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 <0MB200E7BDK3XB70@mmp1.samsung.com> for linux-arm-kernel@lists.infradead.org; Fri, 28 Sep 2012 23:29:32 +0900 (KST) From: Tomasz Figa To: linux-arm-kernel@lists.infradead.org Subject: [RFC PATCH 05/16] pinctrl: samsung: Parse bank-specific eint offset from DT Date: Fri, 28 Sep 2012 16:28:36 +0200 Message-id: <1348842527-22460-6-git-send-email-t.figa@samsung.com> X-Mailer: git-send-email 1.7.10 In-reply-to: <1348842527-22460-1-git-send-email-t.figa@samsung.com> References: <1348842527-22460-1-git-send-email-t.figa@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrHJMWRmVeSWpSXmKPExsVy+t9jAV2fLakBBk82KVpsenyN1YHRY/OS +gDGKC6blNSczLLUIn27BK6M9m02Bb0iFafeXmBvYHwq0MXIwSEhYCLxfn9FFyMnkCkmceHe erYuRi4OIYFFjBJT161jBUkICWxmkpj7WwzEZhNQk/jc8IgNxBYR0JCY0vWYHcRmFpjMJHFs QTqILSwQJrF54WawXhYBVYnON5dZQGxeASeJmQ9WskAsk5d4er+PDeQGTgFnibXzNCBWOUn0 /2lgmcDIu4CRYRWjaGpBckFxUnquoV5xYm5xaV66XnJ+7iZGsK+fSe1gXNlgcYhRgINRiYfX YmVKgBBrYllxZe4hRgkOZiUR3ozi1AAh3pTEyqrUovz4otKc1OJDjNIcLErivM0eQNUC6Ykl qdmpqQWpRTBZJg5OqQbGJXqP9xUEaUh6zngdpub9Vu67ZZOfT97myBNbgszuXIiv7/T50rFA 9xX7bXbrf5wu0c/ZKs/e2tzlnq9u1BLNmpPe//bD1XsM/n9+LbxpW3ci7f6B0Ln/ND6p7Dmy d0pvhvDfG7Y8XSnLdW6t+hO+3CbUquhtaK6SQvzSG/tXb+S9fz/zi4qlEktxRqKhFnNRcSIA qFggq/EBAAA= X-Spam-Note: CRM114 invocation failed X-Spam-Score: -7.7 (-------) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-7.7 points) pts rule name description ---- ---------------------- -------------------------------------------------- -5.0 RCVD_IN_DNSWL_HI RBL: Sender listed at http://www.dnswl.org/, high trust [203.254.224.25 listed in list.dnswl.org] -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.8 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, 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 Some SoCs, like Exynos4x12, have non-linear layout of EINT control registers and so current way of calculating register addresses does not work correctly for them. This patch adds parsing of samsung,eint-offset property from bank nodes and uses the read values instead of calculating the offsets from bank index. Signed-off-by: Tomasz Figa --- drivers/pinctrl/pinctrl-exynos.c | 5 ++--- drivers/pinctrl/pinctrl-samsung.c | 5 +++++ drivers/pinctrl/pinctrl-samsung.h | 1 + 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/drivers/pinctrl/pinctrl-exynos.c b/drivers/pinctrl/pinctrl-exynos.c index 134fecf..340bfc2 100644 --- a/drivers/pinctrl/pinctrl-exynos.c +++ b/drivers/pinctrl/pinctrl-exynos.c @@ -146,7 +146,7 @@ static struct exynos_geint_data *exynos_get_eint_data(irq_hw_number_t hw, struct samsung_pin_bank *bank = d->ctrl->pin_banks; struct exynos_geint_data *eint_data; unsigned int nr_banks = d->ctrl->nr_banks, idx; - unsigned int irq_base = 0, eint_offset = 0; + unsigned int irq_base = 0; if (hw >= d->ctrl->nr_gint) { dev_err(d->dev, "unsupported ext-gpio interrupt\n"); @@ -159,7 +159,6 @@ static struct exynos_geint_data *exynos_get_eint_data(irq_hw_number_t hw, if ((hw >= irq_base) && (hw < (irq_base + bank->nr_pins))) break; irq_base += bank->nr_pins; - eint_offset += 4; } if (idx == nr_banks) { @@ -175,7 +174,7 @@ static struct exynos_geint_data *exynos_get_eint_data(irq_hw_number_t hw, eint_data->bank = bank; eint_data->pin = hw - irq_base; - eint_data->eint_offset = eint_offset; + eint_data->eint_offset = bank->eint_offset; return eint_data; } diff --git a/drivers/pinctrl/pinctrl-samsung.c b/drivers/pinctrl/pinctrl-samsung.c index e828a0e..962320b 100644 --- a/drivers/pinctrl/pinctrl-samsung.c +++ b/drivers/pinctrl/pinctrl-samsung.c @@ -859,6 +859,11 @@ static int samsung_pinctrl_parse_dt_bank(struct samsung_pin_bank *bank, bank->eint_type = EINT_TYPE_GPIO; + ret = of_property_read_u32(np, "samsung,eint-offset", &val); + if (ret) + return ret; + bank->eint_offset = val; + return 0; } diff --git a/drivers/pinctrl/pinctrl-samsung.h b/drivers/pinctrl/pinctrl-samsung.h index db1907c..72303f1 100644 --- a/drivers/pinctrl/pinctrl-samsung.h +++ b/drivers/pinctrl/pinctrl-samsung.h @@ -122,6 +122,7 @@ struct samsung_pin_bank { u8 conpdn_width; u8 pudpdn_width; enum eint_type eint_type; + u32 eint_offset; u32 irq_base; const char *name; };