From patchwork Fri Sep 18 16:29:55 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adrian Alonso X-Patchwork-Id: 7219321 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 9C893BEEC1 for ; Fri, 18 Sep 2015 16:49:06 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id B12F3208CC for ; Fri, 18 Sep 2015 16:49:05 +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 C017F208BC for ; Fri, 18 Sep 2015 16:49:04 +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 1Zcyox-0001BI-2N; Fri, 18 Sep 2015 16:47:35 +0000 Received: from merlin.infradead.org ([2001:4978:20e::2]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Zcync-0007xm-Gj for linux-arm-kernel@bombadil.infradead.org; Fri, 18 Sep 2015 16:46:12 +0000 Received: from mail-bn1bon0132.outbound.protection.outlook.com ([157.56.111.132] helo=na01-bn1-obe.outbound.protection.outlook.com) by merlin.infradead.org with esmtps (Exim 4.85 #2 (Red Hat Linux)) id 1ZcyaH-0001bS-H5 for linux-arm-kernel@lists.infradead.org; Fri, 18 Sep 2015 16:32:25 +0000 Received: from BY2PR03CA009.namprd03.prod.outlook.com (10.255.93.26) by BN3PR0301MB1217.namprd03.prod.outlook.com (10.161.207.17) with Microsoft SMTP Server (TLS) id 15.1.268.17; Fri, 18 Sep 2015 16:32:03 +0000 Received: from BL2FFO11FD050.protection.gbl (10.255.93.4) by BY2PR03CA009.outlook.office365.com (10.255.93.26) with Microsoft SMTP Server (TLS) id 15.1.274.16 via Frontend Transport; Fri, 18 Sep 2015 16:32:03 +0000 Authentication-Results: spf=fail (sender IP is 192.88.168.50) smtp.mailfrom=freescale.com; freescale.mail.onmicrosoft.com; dkim=none (message not signed) header.d=none; freescale.mail.onmicrosoft.com; dmarc=none action=none header.from=freescale.com; Received-SPF: Fail (protection.outlook.com: domain of freescale.com does not designate 192.88.168.50 as permitted sender) receiver=protection.outlook.com; client-ip=192.88.168.50; helo=tx30smr01.am.freescale.net; Received: from tx30smr01.am.freescale.net (192.88.168.50) by BL2FFO11FD050.mail.protection.outlook.com (10.173.161.212) with Microsoft SMTP Server (TLS) id 15.1.274.4 via Frontend Transport; Fri, 18 Sep 2015 16:32:02 +0000 Received: from bluefly.am.freescale.net (bluefly.am.freescale.net [10.81.17.130]) by tx30smr01.am.freescale.net (8.14.3/8.14.0) with ESMTP id t8IGVgDc032121; Fri, 18 Sep 2015 09:32:02 -0700 From: Adrian Alonso To: , , , , Subject: [PATCH v4 5/8] pinctrl: freescale: imx: add ZERO_OFFSET_VALID flag Date: Fri, 18 Sep 2015 11:29:55 -0500 Message-ID: <1442593798-11501-5-git-send-email-aalonso@freescale.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1442593798-11501-1-git-send-email-aalonso@freescale.com> References: <1442593798-11501-1-git-send-email-aalonso@freescale.com> X-EOPAttributedMessage: 0 X-Microsoft-Exchange-Diagnostics: 1; BL2FFO11FD050; 1:AKZhCMtlcKYat6dzKtcfo++he3cIbWvaefQLHkKAl6wb7OY1h7XWHMxF8WsYoWeyVV7uKrJdb8vtcvUOdO413TbgXToYWRdXk9PMGZuDtvordO2+r3yorrBjcuf56YOT6Bo47I/Vs4eVlxK/yhyWwBQwmVICD+ZWUWk/jD2gYvg8mylPxTU8DdjVI5AOyYnP293ILCshIKz77SgTYyZlSBJ8dhHoF/WRAqEcYJLK6sdAl4ixyAMzZ+2ch9ccsfXoaZTuiDr/quWL9JlIJWt6ZBiVqO3wErMUIWcib5rhJozgbChQfM7/s2uubgIAm/QnG4xnJX1IsTn08enjtHT/dl0h6RMZNrorJxT9JxXDSISOMQeZyiTU3XbJ0JmUR2PWWJIo+S4HSxgCKDPxSN4nWA== X-Forefront-Antispam-Report: CIP:192.88.168.50; CTRY:US; IPV:NLI; EFV:NLI; SFV:NSPM; SFS:(10019020)(6009001)(2980300002)(1109001)(1110001)(339900001)(189002)(199003)(5007970100001)(85426001)(104016003)(19580395003)(64706001)(106466001)(47776003)(105606002)(229853001)(46102003)(6806004)(19580405001)(76176999)(33646002)(50226001)(50986999)(87936001)(189998001)(92566002)(97736004)(4001540100001)(107886002)(81156007)(86362001)(77096005)(2201001)(5001770100001)(36756003)(68736005)(5003940100001)(50466002)(5001860100001)(2950100001)(5001960100002)(5001830100001)(48376002)(77156002)(5001920100001)(11100500001)(62966003)(4001430100001)(2101003); DIR:OUT; SFP:1102; SCL:1; SRVR:BN3PR0301MB1217; H:tx30smr01.am.freescale.net; FPR:; SPF:Fail; PTR:InfoDomainNonexistent; MX:1; A:1; LANG:en; MIME-Version: 1.0 X-Microsoft-Exchange-Diagnostics: 1; BN3PR0301MB1217; 2:y/hiYz5z0R9GX5H9RUYfgIvqb0+SZiPdjtONLOdp7Dnb7+kRDzwmveU7leJsEdcfFuie7V5SSKKdw3hhm6akHJH2cpVpNvIUXoLTFa6jnEIAHFPBjCquJoD8+bAAHc7vqnAjQZEXyZpIJEuMfJb/Oo1oYY30lB4YK/GfxwXkUJ0=; 3:JAjJGdMQeHdzH1YkO9+6gqML/sNO/YBZtcNaqhR10+AG2B46s/yn1aJooWdLFoy8rMd0wqObSsXTjU9oDHPx9fW3R3zE1BCOQ2sl8aOIU+ZERWBaRYsyYQDUcESvwD0/6ow56OnrduOy3ZRf+iK9vwWcBrcrP14S8J5liZ52XSV2UWEhFhH4nejNdjLEKU3wIEJfIvH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y1r8ghOebKEw1LjTgOq23L6XliPyymxJbx+fNGa2DMmb8X4dZ4lHaEn7IUG8m8d8DBtykW9cJETWts9pBzRY= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(8121501046)(520078)(520075)(5005006)(3002001); SRVR:BN3PR0301MB1217; BCL:0; PCL:0; RULEID:; SRVR:BN3PR0301MB1217; X-Forefront-PRVS: 0703B549E4 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BN3PR0301MB1217; 23:dQwPtZldX8Mw53FQOpMzgx0gotQAkl8cTt9UvuH?= =?us-ascii?Q?bhAXZdTijAAJIjClNMCLn30klMigW1F4SibzMdjcdqpbJs6pJ45hXPeZ93oh?= =?us-ascii?Q?drtTix94CxEn4SENuD6Ux/mnNRnpIn26DY5D7LabYuKE7oz27Yktyvqa+OWc?= =?us-ascii?Q?tN/S1PVbp+8fFc/fQoDzJWh4FzQskD/gqYvmGf0Rv7PRZztNiXemhzBRQyS7?= =?us-ascii?Q?OC8Ep1m8EHYgHP+LHs971hSNl8DR7ap/YCq8KWBGf3QZ58AywmJPME5atqgH?= =?us-ascii?Q?90H2HQs+oR1cWbp6pJJ0Ao/tpOQkdR+0z8xx2zsDNsD72FxOpNXVLbji8UyG?= =?us-ascii?Q?RZMmsYyNMZj6P2v8U4sG4KTiVJOouOZJe19S86lNU755Chge49PRsjP05T3N?= =?us-ascii?Q?DjzFi0oyZ/9uOtNzaAX8ZxG/TvooV0wFPNd9m1+oAj3fv3xc3znctHJe1MdK?= =?us-ascii?Q?18tp35MC9AC0ceyDyJUSqedhpYjrJW+8IOO1DjN4tsi/MFvUYTBaASxKEuql?= =?us-ascii?Q?qjQK3mqkWLc5eP32FdxTVO3a4RUETA14ego7Btxe3m8iFUMtfl+kKjfI15Kf?= =?us-ascii?Q?AI0oGlyqjjeZzpZQ6SDodrNWpS12Yib5iMHJkGFMt8pStn3926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WvqyF4PPsCihj3voH/MoAg3P3FTB9oUJYwrIcQm4GGsnHza6TDG0WvpVsrnkYRaW4ElGLtYRbfYx+MZrD2i6ppf2ahk=; 20:gU7QeUzvfSfwsPmtjJbJJl4PcTn6DChsPh4s1UD81ldjzJdez2h+VQ7YsX7VvpqfwwDQl6AVOmtWSB6THLcddg== X-OriginatorOrg: freescale.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Sep 2015 16:32:02.6867 (UTC) X-MS-Exchange-CrossTenant-Id: 710a03f5-10f6-4d38-9ff4-a80b81da590d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=710a03f5-10f6-4d38-9ff4-a80b81da590d; Ip=[192.88.168.50]; Helo=[tx30smr01.am.freescale.net] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN3PR0301MB1217 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150918_123225_673254_A66A9646 X-CRM114-Status: GOOD ( 22.61 ) X-Spam-Score: -1.9 (-) 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, Frank.Li@freescale.com, nitin.garg@freescale.com, Anson.Huang@freescale.com, linux-gpio@vger.kernel.org, robh+dt@kernel.org, kernel@pengutronix.de, yibin.gong@freescale.com Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAD_ENC_HEADER,BAYES_00, RCVD_IN_DNSWL_MED, T_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 - Add ZERO_OFFSET_VALID flag, on imx7d mux_conf reg offset is zero for iomuxc-lspr controller - Do default initialization on parse group function. 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 drivers/pinctrl/freescale/pinctrl-imx.c | 20 ++++++++++---------- drivers/pinctrl/freescale/pinctrl-imx.h | 1 + 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/drivers/pinctrl/freescale/pinctrl-imx.c b/drivers/pinctrl/freescale/pinctrl-imx.c index b9c6deb..866d864 100644 --- a/drivers/pinctrl/freescale/pinctrl-imx.c +++ b/drivers/pinctrl/freescale/pinctrl-imx.c @@ -437,7 +437,7 @@ static void imx_pinconf_dbg_show(struct pinctrl_dev *pctldev, const struct imx_pin_reg *pin_reg = &info->pin_regs[pin_id]; unsigned long config; - if (!pin_reg || pin_reg->conf_reg == -1) { + if (pin_reg->conf_reg == -1) { seq_printf(s, "N/A"); return; } @@ -536,21 +536,26 @@ static int imx_pinctrl_parse_groups(struct device_node *np, return -ENOMEM; for (i = 0; i < grp->npins; i++) { - u32 mux_reg = be32_to_cpu(*list++); + u32 mux_reg; u32 conf_reg; unsigned int pin_id; struct imx_pin_reg *pin_reg; struct imx_pin *pin = &grp->pins[i]; + mux_reg = be32_to_cpu(*list++); + if (!(info->flags & ZERO_OFFSET_VALID) && !mux_reg) + mux_reg = -1; + if (info->flags & SHARE_MUX_CONF_REG) { conf_reg = mux_reg; } else { conf_reg = be32_to_cpu(*list++); - if (!conf_reg) + if (!(info->flags & ZERO_OFFSET_VALID) && !conf_reg) 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; @@ -684,7 +689,7 @@ int imx_pinctrl_probe(struct platform_device *pdev, { struct imx_pinctrl *ipctl; struct resource *res; - int ret, i; + int ret; if (!info || !info->pins || !info->npins) { dev_err(&pdev->dev, "wrong pinctrl info\n"); @@ -702,11 +707,6 @@ int imx_pinctrl_probe(struct platform_device *pdev, if (!info->pin_regs) return -ENOMEM; - for (i = 0; i < info->npins; i++) { - info->pin_regs[i].mux_reg = -1; - info->pin_regs[i].conf_reg = -1; - } - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); ipctl->base = devm_ioremap_resource(&pdev->dev, res); if (IS_ERR(ipctl->base)) diff --git a/drivers/pinctrl/freescale/pinctrl-imx.h b/drivers/pinctrl/freescale/pinctrl-imx.h index 2a5fe72..2a592f6 100644 --- a/drivers/pinctrl/freescale/pinctrl-imx.h +++ b/drivers/pinctrl/freescale/pinctrl-imx.h @@ -85,6 +85,7 @@ struct imx_pinctrl_soc_info { }; #define SHARE_MUX_CONF_REG 0x1 +#define ZERO_OFFSET_VALID 0x2 #define NO_MUX 0x0 #define NO_PAD 0x0