From patchwork Tue Sep 1 22:49:10 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adrian Alonso X-Patchwork-Id: 7107491 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 2A439BEEC1 for ; Tue, 1 Sep 2015 22:53:50 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 3CEAD205B1 for ; Tue, 1 Sep 2015 22:53:49 +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 60DED2026D for ; Tue, 1 Sep 2015 22:53:48 +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 1ZWuP3-0003I1-Ic; Tue, 01 Sep 2015 22:51:45 +0000 Received: from mail-by2on0138.outbound.protection.outlook.com ([207.46.100.138] helo=na01-by2-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZWuOq-00036U-MC for linux-arm-kernel@lists.infradead.org; Tue, 01 Sep 2015 22:51:33 +0000 Received: from CO2PR03CA0042.namprd03.prod.outlook.com (10.141.194.169) by BN1PR0301MB0772.namprd03.prod.outlook.com (10.160.78.153) with Microsoft SMTP Server (TLS) id 15.1.256.15; Tue, 1 Sep 2015 22:51:09 +0000 Received: from BY2FFO11FD047.protection.gbl (2a01:111:f400:7c0c::174) by CO2PR03CA0042.outlook.office365.com (2a01:111:e400:1414::41) with Microsoft SMTP Server (TLS) id 15.1.262.13 via Frontend Transport; Tue, 1 Sep 2015 22:51:08 +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 BY2FFO11FD047.mail.protection.outlook.com (10.1.15.175) with Microsoft SMTP Server (TLS) id 15.1.256.10 via Frontend Transport; Tue, 1 Sep 2015 22:51:08 +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 t81MolNH028361; Tue, 1 Sep 2015 15:51:07 -0700 From: Adrian Alonso To: , , , , Subject: [PATCH v2 5/8] pinctrl: freescale: imx: add ZERO_OFFSET_VALID flag Date: Tue, 1 Sep 2015 17:49:10 -0500 Message-ID: <1441147753-13239-5-git-send-email-aalonso@freescale.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1441147753-13239-1-git-send-email-aalonso@freescale.com> References: <1441147753-13239-1-git-send-email-aalonso@freescale.com> X-EOPAttributedMessage: 0 X-Microsoft-Exchange-Diagnostics: 1; BY2FFO11FD047; 1:1gemCNq7aiG/NtrNIoGOqJdg+WIcMpOVxROUHbFwKbij7dGbk+Skhe91sFqS8yT9E582he1/zeuJD6U6Ux7RUNUo1B9+bCSycNXpTZJZAc19TvmOqDpRTqF3c11XDwtMnLwFp7NGV61iw0nyD42757wMEIJhelPqSodOZueaiFk2joH+hXV/n1Mp4z4Bg0v82mN/HLyOh7NSsa0THphuusYcjcc9O/+7LyQM6yN7Uyq1UFzxTJqgS5zhxTvhVcYGgAOtWSYdrl1gY9XvLV8xzspU0S+kbI1+9A5/EaQOq6Ga6o8SOfseL8uMJhcc3C2kddcC4RfiFM60XrdWY2H0SHMdolOyZEhIFqlTZ/GFdeztvGvsGaByc1OU9pxfRcRKFtaEupLGqvDKpd3jhItLBw== X-Forefront-Antispam-Report: CIP:192.88.168.50; CTRY:US; IPV:NLI; EFV:NLI; SFV:NSPM; SFS:(10019020)(6009001)(2980300002)(3050300001)(339900001)(189002)(199003)(50986999)(85426001)(76176999)(5007970100001)(50226001)(5003940100001)(19580395003)(19580405001)(6806004)(77156002)(62966003)(77096005)(68736005)(81156007)(4001540100001)(2201001)(86362001)(48376002)(47776003)(64706001)(87936001)(5001770100001)(97736004)(50466002)(92566002)(2950100001)(46102003)(5001960100002)(36756003)(107886002)(229853001)(106466001)(189998001)(105606002)(104016003)(5001860100001)(5001920100001)(5001830100001)(33646002)(4001430100001)(2101003); DIR:OUT; SFP:1102; SCL:1; SRVR:BN1PR0301MB0772; H:tx30smr01.am.freescale.net; FPR:; SPF:Fail; PTR:InfoDomainNonexistent; MX:1; A:1; LANG:; MIME-Version: 1.0 X-Microsoft-Exchange-Diagnostics: 1; BN1PR0301MB0772; 2:WUIwnKIEhCvc/uWr7OUyCkQ5I/HqPZhfVnJv1NegLKtxhC9soTcsehX4zfO9N0uru1FiYIOypaYo8J6mE7dnsCSwXDq3VXuvFF8JQf8V/2VEOzJIu2ZwW0K1uNCWJNGuelpxJ6OeFkFQXBq/P+PKtf/AKxVfolkbFgU052+xxOk=; 3:9jhQ9mmzDtjpwfRm1iPxHa4Ra/fmUU91BEOG6LqJe36/9vhMwG56Pc7phA0fZC9m/X5iQaN6jF8MyiqNs/6OB2iP2Y5Nzet2Z0Z1WqnYHKeSIdlryBRXmEafWr+pwr8IeZ4Ai1LPGtzCVri5W5482tY+sdMq6jHY96Mw5RDdCBIyU3OBkSHVbJ2ZhTGB0p233gfFqjZB1/2LkdLk9gUbDssd9C4L+IKoa6MsE7MaA9s=; 25:VjVG7GWRWnt/4u7/P7KcOvWr5oO2/3Wbm4+3cd54c7b1pNBk3U7r1QwXdqJynlNXo2J98EWvperzyjq3hT+3JLc1VFqiOH2U441trT62Tzw8OO4KioX1x0GUyjVMcYOfg1jm4bpMC6DwJFv9DsefNUqpdHRaQD8LL1jlJIvZoJ95K+3Sil/42AycTLxdwwgmcQ9KMctr09U0bJEslJ3lM7l1shXYSHFW+yejnjU78zr5mGk2FikKKwD0JcrNOOJhsxEuikGIlBpgjowr6PVwFA== X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:BN1PR0301MB0772; X-Microsoft-Exchange-Diagnostics: 1; BN1PR0301MB0772; 20:mDTbEnysNPCeO1FO4sp6I8U1X/KVkabS31sSkTsQlIKMNcFrXdyHg/FQ48RhQlZZZEVfVqT/0LyYJ2KBG2e/tXNBXI9qzWnxw1Wr5+rHu9dP7tVHtjP3Tzi2afJRaeVhGOgMyo+CYGGmX2lmCTh7/LVJiK2NHY9V1XRIB6ZqiXCvcwstz1kGrypi/ru6/UTkxCV15PIMqWn1L/eTdQ9+dPYiF5yajNLq5C4UsgozM9gpewnjKF8acLCuZ2PA64lLgsEtHU61sgzZVLdFuSqeNuyDxC+ydk2qkXeOn87x+WWRMZTAWNQvbZEP5OSRA9rNRh4YxFiLtCipkY06eNzlZKQLAV1lHH7DnLqal+0uCjI=; 4:Thr1SsSAgpTf5b+xMt5iGcSBpaYfYUqmTqDABWipMwsMElSUhvLi1KrWQ3xdV2to5psruy5QQnksscmXQ0zp4sUUE/kWjYLV9mffoKJVxHF/KcaqqvTKLCE0Svy50I7fBeGb3JgaHIwIptfJ297YzVunvsl5+iqPrPPa8Ty+8loB/klQwDR+YHAStMcSF5aGrOcVhhPPEi32+l64Wa5Nqxb5YC4ORPu5pRvQOAGEd6Q3F2Orzm7aEaAthyjxoU5JvWgpJWys2mgqagwvHzjoxNpu92mT4zItvcu9erSOu5l1L9TiUi3bnp4YxYAoNStC+zxfvdhUX+A1XBoQ0HFAIw== 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:BN1PR0301MB0772; BCL:0; PCL:0; RULEID:; SRVR:BN1PR0301MB0772; X-Forefront-PRVS: 06860EDC7B X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BN1PR0301MB0772; 23:O40zci/RyIF8JCQWeYKtYBXldKgzBVvvD5sIEI6?= =?us-ascii?Q?d4IxmyiQKmeFmO74g1/8I5eOCcAEkn5P9si0ds5h8ekNE5RKHcsnzVeaCALU?= =?us-ascii?Q?fUWgVtgBbWVisqM8M5DShn74lvaZRHXMYta7aj6runHwMUjuOfKEmYJ+GUf4?= =?us-ascii?Q?yi9efUDSXKmobpoPMkp9jGTxXtVKNcHaMBOzFZTISqjAKjJKjuqoi6Geb0Rx?= =?us-ascii?Q?qkvZN9lUwvwtFi31Qz0gNRiXFsoMwZUJUmEtZRf8S3aOeBK6Pu4gfZa553d+?= =?us-ascii?Q?TQc3Q/+RKNx7u088LBF+bjPjx/SDROzbtkf5ALNVjgQ1dcOr5eIUxxhE7jeC?= =?us-ascii?Q?ek7ZDKHYODd7iNO0qBQFS5kF4Vd2hXZznnfBR85cOp9K9ykERcYLIHNSB83w?= =?us-ascii?Q?nhiDicLqdQeFQr801mKPcrR9sIdH/hY8plFrx/s3Kq09W0kFydjxLzPA1/6B?= =?us-ascii?Q?/Im8CQjCWe1q11sOEJEEExbHrATjHQY1h38tYAqeeGw3DDEmKGntVNBs+gEa?= =?us-ascii?Q?7LgLYt07ija50Ck/PUh5pPHmltxvwd3QKT0z1EwB0nsrWmP1cVZ7NXLKt3sW?= =?us-ascii?Q?DYKncWofQc50HZ4ZHAGPLswcNiCIrxAMKz6Y/RuTMhNAWLe/aa7n7reeuee6?= =?us-ascii?Q?vPhpZA3hUVFELpsr8Z16ZpJPTw+E7wCJWf08aPaHlf128dwQDuyzBZSwTgX9?= =?us-ascii?Q?OsaXfSFaSIHPlQHaFHVUzbb3JOLV9Un3Kfq3TKNWOxEYHHy0b3oqab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b5jJm+g9MOQg+3CBNx1rA== X-OriginatorOrg: freescale.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Sep 2015 22:51:08.0212 (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: BN1PR0301MB0772 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150901_155132_976130_F7188A89 X-CRM114-Status: GOOD ( 20.80 ) 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, 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 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 95db9e8..9f019be 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 26f8f1c..67c07c2 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