From patchwork Thu Sep 20 08:53:15 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomasz Figa X-Patchwork-Id: 1483431 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by patchwork1.kernel.org (Postfix) with ESMTP id 91F163FE65 for ; Thu, 20 Sep 2012 09:04:25 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1TEce4-0000UY-0M; Thu, 20 Sep 2012 09:02:05 +0000 Received: from mailout2.samsung.com ([203.254.224.25]) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1TEcW2-00059X-T7 for linux-arm-kernel@lists.infradead.org; Thu, 20 Sep 2012 08:53:48 +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 <0MAN009MV4P23OA0@mailout2.samsung.com> for linux-arm-kernel@lists.infradead.org; Thu, 20 Sep 2012 17:53:45 +0900 (KST) X-AuditID: cbfee61a-b7f726d000000ec7-d2-505ad999cf48 Received: from epmmp1.local.host ( [203.254.227.16]) by epcpsbgm1.samsung.com (EPCPMTA) with SMTP id 95.1F.03783.999DA505; Thu, 20 Sep 2012 17:53:45 +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 <0MAN00DG64OWJ930@mmp1.samsung.com> for linux-arm-kernel@lists.infradead.org; Thu, 20 Sep 2012 17:53:45 +0900 (KST) From: Tomasz Figa To: linux-arm-kernel@lists.infradead.org Subject: [RFC 4/6] pinctrl: samsung: Parse bank-specific eint offset from DT Date: Thu, 20 Sep 2012 10:53:15 +0200 Message-id: <1348131197-25506-5-git-send-email-t.figa@samsung.com> X-Mailer: git-send-email 1.7.10 In-reply-to: <1348131197-25506-1-git-send-email-t.figa@samsung.com> References: <1348131197-25506-1-git-send-email-t.figa@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrPJMWRmVeSWpSXmKPExsVy+t9jAd2ZN6MCDPav1rbY9PgaqwOjx+Yl 9QGMUVw2Kak5mWWpRfp2CVwZS498YSo4LlIxZ7tFA+MswS5GTg4JAROJlpP9bBC2mMSFe+uB bC4OIYFFjBL/v/ezQjibmSSm/JjLBFLFJqAm8bnhEViHiICGxJSux+wgRcwCjxklZs/fA+Rw cAgL+Egc+KAOYrIIqEpMeiYBUs4r4CSxs/8e1DJ5iaf3+8BsTgFnibd/DzODlAsB1Uw5oDaB kXcBI8MqRtHUguSC4qT0XEO94sTc4tK8dL3k/NxNjGBvP5PawbiyweIQowAHoxIPb+PyqAAh 1sSy4srcQ4wSHMxKIrwbJwKFeFMSK6tSi/Lji0pzUosPMUpzsCiJ8wp/CgwQEkhPLEnNTk0t SC2CyTJxcEo1MO45Id/pK2++NoHl4A2uN28+3H9SFd4nIhDgPi2/YtKMiXn1V9q33Q8zfbNv S2D/90PBP0/vfPb+Qpp/458nixmq111NKVDoFNxRdm1h7/Hz+6ZqvVkemmYVxbc3/rTcjhYm 3yYNg/boZWzff0VM3DmF8YzmsrCrriHn57w8tlVNI6zRoKOdnVGJpTgj0VCLuag4EQBLDOJB 8gEAAA== X-Bad-Reply: References and In-Reply-To but no 'Re:' in Subject. X-Spam-Note: CRM114 invocation failed X-Spam-Score: -7.4 (-------) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-7.4 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.5 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] X-Mailman-Approved-At: Thu, 20 Sep 2012 05:00:03 -0400 Cc: kgene.kim@samsung.com, devicetree-discuss@lists.ozlabs.org, 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 Signed-off-by: Kyungmin Park --- 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 3cbc632..836ac36 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 ff1d001..03bf743 100644 --- a/drivers/pinctrl/pinctrl-samsung.c +++ b/drivers/pinctrl/pinctrl-samsung.c @@ -832,6 +832,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; };