From patchwork Sun Apr 7 07:10:30 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shawn Guo X-Patchwork-Id: 2404931 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) by patchwork1.kernel.org (Postfix) with ESMTP id 391F13FD40 for ; Mon, 8 Apr 2013 03:01:52 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1UOwjM-0008WB-Gp; Sun, 07 Apr 2013 21:02:28 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1UOjkQ-0004NB-3w; Sun, 07 Apr 2013 07:10:42 +0000 Received: from va3ehsobe002.messaging.microsoft.com ([216.32.180.12] helo=va3outboundpool.messaging.microsoft.com) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1UOjkL-0004Ms-WA for linux-arm-kernel@lists.infradead.org; Sun, 07 Apr 2013 07:10:38 +0000 Received: from mail186-va3-R.bigfish.com (10.7.14.252) by VA3EHSOBE001.bigfish.com (10.7.40.21) with Microsoft SMTP Server id 14.1.225.23; Sun, 7 Apr 2013 07:10:27 +0000 Received: from mail186-va3 (localhost [127.0.0.1]) by mail186-va3-R.bigfish.com (Postfix) with ESMTP id DB94D4200DA; Sun, 7 Apr 2013 07:10:27 +0000 (UTC) X-Forefront-Antispam-Report: CIP:70.37.183.190; KIP:(null); UIP:(null); IPV:NLI; H:mail.freescale.net; RD:none; EFVD:NLI X-SpamScore: 4 X-BigFish: VS4(za62pz98dI9371I148cI1432Izz1f42h1fc6h1ee6h1de0h1fdah1202h1e76h1d1ah1d2ahz8dhz8275dhz2dh87h2a8h668h839h944hd25hf0ah1220h1288h12a5h12a9h12bdh137ah13b6h1441h1504h1537h153bh162dh1631h1758h18e1h1946h19b5h1ad9h1b0ah1155h) X-FB-DOMAIN-IP-MATCH: fail Received: from mail186-va3 (localhost.localdomain [127.0.0.1]) by mail186-va3 (MessageSwitch) id 1365318624991123_31162; Sun, 7 Apr 2013 07:10:24 +0000 (UTC) Received: from VA3EHSMHS045.bigfish.com (unknown [10.7.14.234]) by mail186-va3.bigfish.com (Postfix) with ESMTP id EC0DD220063; Sun, 7 Apr 2013 07:10:24 +0000 (UTC) Received: from mail.freescale.net (70.37.183.190) by VA3EHSMHS045.bigfish.com (10.7.99.55) with Microsoft SMTP Server (TLS) id 14.1.225.23; Sun, 7 Apr 2013 07:10:24 +0000 Received: from tx30smr01.am.freescale.net (10.81.153.31) by 039-SN1MMR1-001.039d.mgd.msft.net (10.84.1.13) with Microsoft SMTP Server (TLS) id 14.2.328.11; Sun, 7 Apr 2013 07:10:24 +0000 Received: from S2101-09.ap.freescale.net ([10.192.185.71]) by tx30smr01.am.freescale.net (8.14.3/8.14.0) with ESMTP id r377AJSW031399; Sun, 7 Apr 2013 00:10:20 -0700 Date: Sun, 7 Apr 2013 15:10:30 +0800 From: Shawn Guo To: Fabio Estevam Subject: Re: [PATCH v2 0/3] Get rid of big array from imx pinctrl driver Message-ID: <20130407071028.GD11898@S2101-09.ap.freescale.net> References: <1361533888-18073-1-git-send-email-shawn.guo@linaro.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) X-OriginatorOrg: sigmatel.com X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130407_031038_120340_6CEEC175 X-CRM114-Status: GOOD ( 21.64 ) X-Spam-Score: -2.6 (--) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-2.6 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [216.32.180.12 listed in list.dnswl.org] -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: Linus Walleij , Dong Aisheng , Sascha Hauer , linux-arm-kernel@lists.infradead.org, Stephen Warren X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org On Sat, Apr 06, 2013 at 05:21:37PM -0300, Fabio Estevam wrote: > Hi Shawn, > > On Fri, Feb 22, 2013 at 8:51 AM, Shawn Guo wrote: > > Changes since v1: > > * Remove the absolute path of imxXX-pinfunc.h in binding doc > > * Remove the pin id from PIN_FUNC_ID/macro > > > > Shawn Guo (3): > > ARM: dts: imx: use pre-processor for device trees > > ARM: dts: imx: replace magic number with pin function name > > pinctrl: imx: move hard-coding data into device tree > > The last patch breaks audio on mx6qsabrelite: after a aplay command > the processor hangs. Thanks for spotting it, Fabio. There is indeed a bug with the patch. The select input register should not be defined in imx_pin_reg, because the same pad may have multiple select input registers for different mux setting values. So it should be something defined with pin group. The following code change should fix the problem. I just rebuilt imx/dt branch with the problem fixed and also had the branch based on Stephen Warren's for-3.10/dtc-cpp-chroot-std-headers branch so avoid all those dts files renaming. Shawn --8<---- diff --git a/drivers/pinctrl/pinctrl-imx.c b/drivers/pinctrl/pinctrl-imx.c index 479ceb6..b83be7c 100644 --- a/drivers/pinctrl/pinctrl-imx.c +++ b/drivers/pinctrl/pinctrl-imx.c @@ -198,6 +198,7 @@ static int imx_pmx_enable(struct pinctrl_dev *pctldev, unsigned selector, const struct imx_pinctrl_soc_info *info = ipctl->info; const struct imx_pin_reg *pin_reg; const unsigned *pins, *mux, *input_val; + u16 *input_reg; unsigned int npins, pin_id; int i; @@ -209,6 +210,7 @@ static int imx_pmx_enable(struct pinctrl_dev *pctldev, unsigned selector, npins = info->groups[group].npins; mux = info->groups[group].mux_mode; input_val = info->groups[group].input_val; + input_reg = info->groups[group].input_reg; WARN_ON(!pins || !npins || !mux || !input_val); @@ -230,11 +232,11 @@ static int imx_pmx_enable(struct pinctrl_dev *pctldev, unsigned selector, pin_reg->mux_reg, mux[i]); /* some pins also need select input setting, set it if found */ - if (pin_reg->input_reg) { - writel(input_val[i], ipctl->base + pin_reg->input_reg); + if (input_reg[i]) { + writel(input_val[i], ipctl->base + input_reg[i]); dev_dbg(ipctl->dev, "==>select_input: offset 0x%x val 0x%x\n", - pin_reg->input_reg, input_val[i]); + input_reg[i], input_val[i]); } } @@ -411,6 +413,8 @@ static int imx_pinctrl_parse_groups(struct device_node *np, GFP_KERNEL); grp->mux_mode = devm_kzalloc(info->dev, grp->npins * sizeof(unsigned int), GFP_KERNEL); + grp->input_reg = devm_kzalloc(info->dev, grp->npins * sizeof(u16), + GFP_KERNEL); grp->input_val = devm_kzalloc(info->dev, grp->npins * sizeof(unsigned int), GFP_KERNEL); grp->configs = devm_kzalloc(info->dev, grp->npins * sizeof(unsigned long), @@ -424,7 +428,7 @@ static int imx_pinctrl_parse_groups(struct device_node *np, grp->pins[i] = pin_id; pin_reg->mux_reg = mux_reg; pin_reg->conf_reg = conf_reg; - pin_reg->input_reg = be32_to_cpu(*list++); + grp->input_reg[i] = be32_to_cpu(*list++); grp->mux_mode[i] = be32_to_cpu(*list++); grp->input_val[i] = be32_to_cpu(*list++); diff --git a/drivers/pinctrl/pinctrl-imx.h b/drivers/pinctrl/pinctrl-imx.h index 4749b0a..1f27f24 100644 --- a/drivers/pinctrl/pinctrl-imx.h +++ b/drivers/pinctrl/pinctrl-imx.h @@ -26,6 +26,8 @@ struct platform_device; * elements in .pins so we can iterate over that array * @mux_mode: the mux mode for each pin in this group. The size of this * array is the same as pins. + * @input_reg: select input register offset for this mux if any + * 0 if no select input setting needed. * @input_val: the select input value for each pin in this group. The size of * this array is the same as pins. * @configs: the config for each pin in this group. The size of this @@ -36,6 +38,7 @@ struct imx_pin_group { unsigned int *pins; unsigned npins; unsigned int *mux_mode; + u16 *input_reg; unsigned int *input_val; unsigned long *configs; }; @@ -56,13 +59,10 @@ struct imx_pmx_func { * struct imx_pin_reg - describe a pin reg map * @mux_reg: mux register offset * @conf_reg: config register offset - * @input_reg: select input register offset for this mux if any - * 0 if no select input setting needed. */ struct imx_pin_reg { u16 mux_reg; u16 conf_reg; - u16 input_reg; }; struct imx_pinctrl_soc_info {