From patchwork Fri Sep 25 19:07:25 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shawn Guo X-Patchwork-Id: 7267351 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 0DB819F44C for ; Fri, 25 Sep 2015 19:09:44 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 2D1BC20834 for ; Fri, 25 Sep 2015 19:09:43 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 3678920832 for ; Fri, 25 Sep 2015 19:09:42 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZfYLa-0006zN-Pq; Fri, 25 Sep 2015 19:07:54 +0000 Received: from mail.kernel.org ([198.145.29.136]) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZfYLY-0006xB-PQ for linux-arm-kernel@lists.infradead.org; Fri, 25 Sep 2015 19:07:53 +0000 Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id E0BD920834; Fri, 25 Sep 2015 19:07:31 +0000 (UTC) Received: from tiger (unknown [70.35.39.2]) (using TLSv1.2 with cipher DHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 63CFC20832; Fri, 25 Sep 2015 19:07:30 +0000 (UTC) Date: Fri, 25 Sep 2015 12:07:25 -0700 From: Shawn Guo To: Markus Pargmann Subject: Re: [PATCH v5 4/7] pinctrl: freescale: imx: allow mux_reg offset zero Message-ID: <20150925190725.GX3529@tiger> References: <1443128043-21063-1-git-send-email-aalonso@freescale.com> <1443128043-21063-4-git-send-email-aalonso@freescale.com> <20150925104726.GJ11805@pengutronix.de> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20150925104726.GJ11805@pengutronix.de> User-Agent: Mutt/1.5.21 (2010-09-15) X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150925_120752_895607_B93D99A4 X-CRM114-Status: GOOD ( 22.77 ) X-Spam-Score: -4.2 (----) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, Adrian Alonso , Frank.Li@freescale.com, nitin.garg@freescale.com, linus.walleij@linaro.org, linux-gpio@vger.kernel.org, robh+dt@kernel.org, kernel@pengutronix.de, lznuaa@gmail.com, shawn.guo@linaro.org, Anson.Huang@freescale.com, linux-arm-kernel@lists.infradead.org, yibin.gong@freescale.com Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP On Fri, Sep 25, 2015 at 12:47:26PM +0200, Markus Pargmann wrote: > On Thu, Sep 24, 2015 at 03:54:00PM -0500, Adrian Alonso wrote: > > Allow mux_reg offset zero to be a valid pin_id, on imx7d > > mux_conf reg offset is zero for iomuxc-lspr controller > > > > Signed-off-by: Adrian Alonso > > --- > > Changes for V2: Resend > > Changes for V3: Resend > > Changes for V4: Simplify pin_id assigment when ZERO_OFFSET_VALID is set > > Changes for V5: > > - Drop patch pinctrl: freescale: imx: add ZERO_OFFSET_VALID flag > > - Allow mux_reg ZERO OFFSET as pin_id > > > > drivers/pinctrl/freescale/pinctrl-imx.c | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/drivers/pinctrl/freescale/pinctrl-imx.c b/drivers/pinctrl/freescale/pinctrl-imx.c > > index b9c6deb..23348d8 100644 > > --- a/drivers/pinctrl/freescale/pinctrl-imx.c > > +++ b/drivers/pinctrl/freescale/pinctrl-imx.c > > @@ -550,7 +550,7 @@ static int imx_pinctrl_parse_groups(struct device_node *np, > > conf_reg = -1; > > } > > > > - pin_id = mux_reg ? mux_reg / 4 : conf_reg / 4; > > + pin_id = (mux_reg != -1) ? mux_reg / 4 : conf_reg / 4; > > This will break compatibility with imx35 and imx25 pinctrl drivers. They > have definitions where mux_reg can be 0x0. See imx35-pinfunc.h and > imx25-pinfunc.h: > > git grep -E "0x0+ 0x.* 0x.* 0x.* 0x.*" > > This mux_reg behaviour was not described in the DT binding > documentation. But it is used by some platforms. So even if you change > the pincfunc headers to use "-1", it would break devicetrees compiled > with earlier kernel versions. Ah, sorry, I'm screwed on the previous review. So we still need the flag ZERO_OFFSET_VALID to convert invalid 0 mux_reg to -1. @Adrian, Will the following change just work for you? Shawn diff --git a/drivers/pinctrl/freescale/pinctrl-imx.c b/drivers/pinctrl/freescale/pinctrl-imx.c index d7b98ba36825..ae801ba7e226 100644 --- a/drivers/pinctrl/freescale/pinctrl-imx.c +++ b/drivers/pinctrl/freescale/pinctrl-imx.c @@ -542,6 +542,9 @@ static int imx_pinctrl_parse_groups(struct device_node *np, struct imx_pin_reg *pin_reg; struct imx_pin *pin = &grp->pins[i]; + if (!(info->flags & ZERO_OFFSET_VALID) && !mux_reg) + mux_reg = -1; + if (info->flags & SHARE_MUX_CONF_REG) { conf_reg = mux_reg; } else { @@ -550,7 +553,7 @@ static int imx_pinctrl_parse_groups(struct device_node *np, conf_reg = -1; } - pin_id = mux_reg ? mux_reg / 4 : conf_reg / 4; + pin_id = (mux_reg != -1) ? mux_reg / 4 : conf_reg / 4; pin_reg = &info->pin_regs[pin_id]; pin->pin = pin_id; grp->pin_ids[i] = pin_id;