From patchwork Thu Sep 10 19:21:45 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adrian Alonso X-Patchwork-Id: 7155731 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 A4E89BEEC1 for ; Thu, 10 Sep 2015 19:34:56 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id B89EB20850 for ; Thu, 10 Sep 2015 19:34:55 +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 D161F20614 for ; Thu, 10 Sep 2015 19:34:54 +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 1Za7aK-0001A3-Pg; Thu, 10 Sep 2015 19:32:40 +0000 Received: from casper.infradead.org ([2001:770:15f::2]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Za7aI-00019I-5s for linux-arm-kernel@bombadil.infradead.org; Thu, 10 Sep 2015 19:32:38 +0000 Received: from mail-bn1on0148.outbound.protection.outlook.com ([157.56.110.148] helo=na01-bn1-obe.outbound.protection.outlook.com) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Za7SI-0002dK-MS for linux-arm-kernel@lists.infradead.org; Thu, 10 Sep 2015 19:24:24 +0000 Received: from BLUPR0301CA0033.namprd03.prod.outlook.com (10.162.113.171) by BLUPR0301MB1634.namprd03.prod.outlook.com (10.162.214.140) with Microsoft SMTP Server (TLS) id 15.1.268.17; Thu, 10 Sep 2015 19:23:58 +0000 Received: from BY2FFO11FD003.protection.gbl (2a01:111:f400:7c0c::163) by BLUPR0301CA0033.outlook.office365.com (2a01:111:e400:5259::43) with Microsoft SMTP Server (TLS) id 15.1.268.17 via Frontend Transport; Thu, 10 Sep 2015 19:23:58 +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 BY2FFO11FD003.mail.protection.outlook.com (10.1.14.125) with Microsoft SMTP Server (TLS) id 15.1.262.18 via Frontend Transport; Thu, 10 Sep 2015 19:23:58 +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 t8AJNfTU019448; Thu, 10 Sep 2015 12:23:57 -0700 From: Adrian Alonso To: , , , , Subject: [PATCH v3 5/8] pinctrl: freescale: imx: add ZERO_OFFSET_VALID flag Date: Thu, 10 Sep 2015 14:21:45 -0500 Message-ID: <1441912908-21946-5-git-send-email-aalonso@freescale.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1441912908-21946-1-git-send-email-aalonso@freescale.com> References: <1441912908-21946-1-git-send-email-aalonso@freescale.com> X-EOPAttributedMessage: 0 X-Microsoft-Exchange-Diagnostics: 1; BY2FFO11FD003; 1:8IGUHds09pYDebWKTjVYFn9RtaWI9hKkj+QfI28q7JHg6gIC6Uxbsg/RvqBH3KaxSKH7t82wEOJCVX4ReR4E/n4iRz0mCgACZwUyL2M9npnJ8vxdNi7Ltx08iGQOSUubKlQFNAVBMCvVNhhwUUjGCi87Yx2uhDZZ51FBY7ALzfD67JzLc0S4EuAdgGA9mrJqScJPWqjPRHTyssjjDqjntDXl68sf8Nc2pcTPVJUEC6Y03MjObYbDP93bEq0nGZmeWmp6bXxmtz+NigCxf82XZeERJw4S+YPMCDnIlQ6Dh/EVYqBkLdwHeuWqbReH/cx/iD7TYu+FHmtWr8CAGF572rohJVSBWeFyQHpgp+ukMV2nsECBWxvGWl1tLXXF9rkxMt4KCnmFGFhJyJzMMG/PQg== 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)(81156007)(76176999)(97736004)(64706001)(50986999)(4001540100001)(47776003)(50466002)(48376002)(19580405001)(19580395003)(6806004)(2201001)(86362001)(77096005)(5001770100001)(5001830100001)(68736005)(5003940100001)(46102003)(5007970100001)(36756003)(106466001)(11100500001)(107886002)(189998001)(50226001)(5001960100002)(5001860100001)(2950100001)(105606002)(87936001)(92566002)(229853001)(33646002)(104016003)(85426001)(62966003)(77156002)(2101003)(4001430100001); DIR:OUT; SFP:1102; SCL:1; SRVR:BLUPR0301MB1634; 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; BLUPR0301MB1634; 2:nhe+PQhizbM5XjxM4SHnoKH+OEq20Ugc6zHZer2u7ioRUgxuTv1jH30B3rHGhhUoE0Sm5SQrDr22Y9YZEwHtTfSCVz20JXYg36AXXqcUMUrTfZ49o/Vc5g5lrLErL4qb4Zt2rFprE0oh0jQLfXZVBTB7TLjoOiWuOmVdnMQTelQ=; 3:ERkZFiclSYXe04/SJZSV2GTnj4u9qydAdCxjqeQUxmaLiZtPgsX96bclshuTBbUrga4YvWu7uQpGc1zB4k4p2V7FZD8MYrFDAc5974eO+KCclF3nN9CR+B5CvxHWWHe1iV8HOfaPTacfKcF6bKh2M+zRGhi5ppxWMTBiDqXTWhmC8bYwAiiMmbCPNma7GRhG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9mlcliH1wM0X1VIGxSj73iCn0t75TZD X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(5005006)(8121501046)(3002001); SRVR:BLUPR0301MB1634; BCL:0; PCL:0; RULEID:; SRVR:BLUPR0301MB1634; X-Forefront-PRVS: 06952FC175 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BLUPR0301MB1634; 23:VvnTy4QUL8+9CBTu6fgP/nu2CzEIP00AMpOgwST?= =?us-ascii?Q?64oCKtHfnlU2lz+DoAMtseepQKmoctt3+G3lemKqoceia7fJVt88DwIFcnjM?= =?us-ascii?Q?SdsAsGOW/W8rjHD8tbk2orHNeZDRN7NNsHXEUVN88pFhy1iTI84U+5G716Gq?= =?us-ascii?Q?cIqUPkdcA7bOdZOj1ISJTYhgABTMHNeUns9nYLLNUrhuPCNVhDY0niivY1Lc?= =?us-ascii?Q?SB2K8y++I465ymqYC4qq6pi9lu4JKlkbPtSfR1iEN2NOL/OjodM92ZOU+khY?= =?us-ascii?Q?P6Bt+NDve+jalEL93ZHXm2aqBuA6zx0AQC2e/b70cIcwyTL0pwFWczBq4sYp?= =?us-ascii?Q?fn5JgIudCAKXNbYaMgL5gjO/OfLZ/H5tgsRO4Mq4k0KaLid2GtCbJ5gb+rh5?= =?us-ascii?Q?qw/Lu52szDHObLfkecf+WgKQDC6T47JNUipdAhCmmr0EL/Y+Vxh3mf6xat2F?= =?us-ascii?Q?PP2q7mLfSC5WC9dLieuAL+JpvcouB88QyaPLsJAqKWK3gkXwCGjQ7+3OHFjM?= =?us-ascii?Q?AZeMbyiSoasUTUsJhN1QxFuGGF6GkwAJ7poabaZQOzKXHInMkD1FlMj/ziMN?= =?us-ascii?Q?36hYu1/YUsDAZ9eupgeeJl7FS46pz2jNdRPT32MfNH8RT17UNVzpghKR9Ixj?= =?us-ascii?Q?zW4yMEe6glydnAvUp9NMGSdvFzy4vCVpD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4SniRqM6Z4Z5ehW7RVcf83ns=; 20:rffbglSKZbeYKfHV0QuG9jaJpQ+WZbR3zCdMoV1ndtbllTjv54iVlYzwXjJ3QOBpXMMMFSjMXLFSJ8nNeCIENQ== X-OriginatorOrg: freescale.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Sep 2015 19:23:58.3407 (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: BLUPR0301MB1634 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150910_202423_008937_DE207D9A X-CRM114-Status: GOOD ( 25.84 ) 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 drivers/pinctrl/freescale/pinctrl-imx.c | 23 +++++++++++++---------- drivers/pinctrl/freescale/pinctrl-imx.h | 1 + 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/drivers/pinctrl/freescale/pinctrl-imx.c b/drivers/pinctrl/freescale/pinctrl-imx.c index b9c6deb..5edbca5 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,29 @@ 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; + if (info->flags & ZERO_OFFSET_VALID) + pin_id = mux_reg / 4; + else + pin_id = mux_reg ? 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 +692,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 +710,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