From patchwork Tue Aug 18 15:48: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: 7032051 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 82DDE9F372 for ; Tue, 18 Aug 2015 15:53:42 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 9919F20547 for ; Tue, 18 Aug 2015 15:53:41 +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 301B5205FA for ; Tue, 18 Aug 2015 15:53:40 +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 1ZRjAO-0003Gv-TF; Tue, 18 Aug 2015 15:51:12 +0000 Received: from mail-bn1bn0106.outbound.protection.outlook.com ([157.56.110.106] helo=na01-bn1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZRjAD-000382-UL for linux-arm-kernel@lists.infradead.org; Tue, 18 Aug 2015 15:51:02 +0000 Received: from CO2PR03CA0012.namprd03.prod.outlook.com (10.141.194.139) by BY2PR0301MB1638.namprd03.prod.outlook.com (10.163.28.140) with Microsoft SMTP Server (TLS) id 15.1.231.21; Tue, 18 Aug 2015 15:50:38 +0000 Received: from BN1AFFO11OLC004.protection.gbl (2a01:111:f400:7c10::126) by CO2PR03CA0012.outlook.office365.com (2a01:111:e400:1414::11) with Microsoft SMTP Server (TLS) id 15.1.256.11 via Frontend Transport; Tue, 18 Aug 2015 15:50:37 +0000 Authentication-Results: spf=fail (sender IP is 192.88.158.2) smtp.mailfrom=freescale.com; freescale.mail.onmicrosoft.com; dkim=none (message not signed) header.d=none; Received-SPF: Fail (protection.outlook.com: domain of freescale.com does not designate 192.88.158.2 as permitted sender) receiver=protection.outlook.com; client-ip=192.88.158.2; helo=az84smr01.freescale.net; Received: from az84smr01.freescale.net (192.88.158.2) by BN1AFFO11OLC004.mail.protection.outlook.com (10.58.53.75) with Microsoft SMTP Server (TLS) id 15.1.243.9 via Frontend Transport; Tue, 18 Aug 2015 15:50:37 +0000 Received: from bluefly.am.freescale.net (bluefly.am.freescale.net [10.81.17.130]) by az84smr01.freescale.net (8.14.3/8.14.0) with ESMTP id t7IFoNEJ021180; Tue, 18 Aug 2015 08:50:35 -0700 From: Adrian Alonso To: , , , , Subject: [PATCH 4/8] pinctrl: freescale: imx: add ZERO_OFFSET_VALID flag Date: Tue, 18 Aug 2015 10:48:55 -0500 Message-ID: <1439912939-17535-4-git-send-email-aalonso@freescale.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1439912939-17535-1-git-send-email-aalonso@freescale.com> References: <1439912939-17535-1-git-send-email-aalonso@freescale.com> X-EOPAttributedMessage: 0 X-Microsoft-Exchange-Diagnostics: 1; BN1AFFO11OLC004; 1:qCQJ6oe3db77boXW3YI5mFtA8VzyZNMEhmU5wRjmlOSraX7aUPbOKchvQZyusJfIfQ1tu4Kis6Z+L4PtN0/s9lp5hXbJ8MMAjiEVsme8sIGxRlv3EL95LRrbml47BBg3+pqNMH6VoP9yO0yKIv22z3kNvZc1nyu0wUfbFOLQDzfUqC0v1HDzfpOcZ9/y5Z7wWHkXRly0frR7zu/V2lCaODACiGbyhnpCg7+ieanwFnrPv/rj19s3jAbGwogsOGpOlEVPM6PG/XLGYlXNGmLVox4gaJ7T7Z+935/gxS7SPRJVzl9FVN3FcIhgVqGOf3/E51hIU/YesHkOIj/20oE0FYAvZCi2EnfIRqG6Qs5pArU6bm5RLxU3bA8pFCyBMydGoh4aJIw9B9keJqDvCqmoYg== X-Forefront-Antispam-Report: CIP:192.88.158.2; CTRY:US; IPV:NLI; EFV:NLI; SFV:NSPM; SFS:(10019020)(6009001)(2980300002)(339900001)(3050300001)(199003)(189002)(5001860100001)(97736004)(5001830100001)(229853001)(48376002)(47776003)(81156007)(106466001)(4001540100001)(50466002)(105606002)(104016003)(92566002)(33646002)(77096005)(36756003)(107886002)(68736005)(5001770100001)(50226001)(46102003)(5001960100002)(575784001)(76176999)(69596002)(86362001)(50986999)(64706001)(5003940100001)(87936001)(62966003)(77156002)(2201001)(85426001)(2950100001)(19580405001)(19580395003)(6806004)(189998001)(2101003)(4001430100001); DIR:OUT; SFP:1102; SCL:1; SRVR:BY2PR0301MB1638; H:az84smr01.freescale.net; FPR:; SPF:Fail; PTR:InfoDomainNonexistent; A:1; MX:1; LANG:en; MIME-Version: 1.0 X-Microsoft-Exchange-Diagnostics: 1; BY2PR0301MB1638; 2:M1e87hftuibg6H7BAWIPWNQZ9kdgh8aXspDMWT/hkcByyK0WtjnXvUt/GEpbaAiuUKuWgTXsrRUX7lklE2OINcMD84CbYU9crz+jJqqng9wIgVRWRLJ5IsYfO+y8NMqMm+ZvXdH3I8UgymRHbhVvF1AyAh1Q0T93uDKSg81Kp1w=; 3:fCUMZmuq5Bx9AZGJ2eMBpw1Y4gfQM4/qOC/H3r3QCKTYjOR3/Pg9WYdfCFdAaCzllIJNo43z7j7V91tPQZ2OJDW6eBTodULMh+zQL/rAnZsv1dFpJovaQam5EBvzlyI234jG91OxmdjHKWLei59OwLA7TGf60E+1Sgbfx2Uz6GlAtjuSKDTJyNPtsk2oySvkQ+fySCQJd9M0o/APxhavce5FfUWK5khpNH+Gfe120FY=; 25:K1gRcyQp7NvVDJInQeD8tfiiukv0AXP5zYA7XeiPjmccwS6r8sFROoBc70np5K2IRoz2gdY66rdOHhpKCFAlLHALyrhM5h0IGqQsLOoXi2KeLwZ4RIRhig2mv06tnObAG1R9dbc/ftmXy0/qkt8ws5U2GEjBkosMYudNHJ5MOCp8aNrbrzIciaSXXKWLygEEeDMezjmDUMK6j58ETdzo+1dsXFsi6UW6r0VLYFLVNyi+L43dW5rFomlsk0j4QD/66uVkTxEHeqYADpNllRMsZg== X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:BY2PR0301MB1638; X-Microsoft-Exchange-Diagnostics: 1; BY2PR0301MB1638; 20:Y0dWD7sggj7SYvNesQZw3T8BauKyoTNyDEWB0sJzgCNwoTS7Ftn/kRKDligLb+XyFix7rWLX4X2MOa9qJ12mi/EgUf8pvmsQGUNO88mGRP6zu+7AAAhStareiSAfi6g5Z7CvaC/uxSPToXkvmtRUlZIEU7LwU3dWYIhbCLBG8z3A7cmKho4sNybUzOhl+ZLST38SEvHmqHYXKBmxmeeu2e94tVe7EgiLqgSsGclnZUIpsM3O9zqxu2e5rYSvt6JC2/s/eQzgkIcpQ51Ot6Q/N6vxTX9yWDnXQRVL7fcQWuRDH0GT7HnqyET5yEATGDKSLCEX8KQXYLOOoha+BzH/tFXTxsFyG5iQ2SkQJrTpUCQ=; 4:pWmIBLxYrthPsVPTSaVBi4Eo7MqmmHCTeTDDyzxoRLiqmU1Hk3+WyF5l4MmHysWO8qzfm9wPoiekHryazY5JZU7aAjIA0cpHXMW9ld5yM0BZEwE3X665gJ9PRcsBay1viNKXqL8X+Gj8wJ5bgWUEJl3DR4ZLyIxNxJ7kFXX8vRhTr5nyv9P+3hxJer5+KrdklnP1ljleGT02rtXMBGeU2ScoMNVq3Fmswi22S3cySOX+GT5Gg/YiB4pVY1+hO0UMyN0isD8Ck9vqZwuatN/KoVzY90w+pJ/WA1cSJ2hOJEiz9ThYuTCjjyUe5NdUJB2y X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(8121501046)(5005006)(3002001); SRVR:BY2PR0301MB1638; BCL:0; PCL:0; RULEID:; SRVR:BY2PR0301MB1638; X-Forefront-PRVS: 067270ECAF X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BY2PR0301MB1638; 23:sGoyHvfUoZb2HwaoPBzBpGobTj4pkxTYi69f/i9?= =?us-ascii?Q?2B+7D/tI51puv20KeQrEQ53VpUKwqZ6bnAqzzsSSR5s4Js31wcYXpmolXtjG?= =?us-ascii?Q?0SAKw3dJFxpuchpb4fgeEA4qiAvaZY1PZHxeWJ7dBmEi0gxptJ9WuJM1A3ju?= =?us-ascii?Q?S5pUU1L5/YXa2uXB0+4l9SzO25QZSRQj1dtNxeWIGaxiukmE2uGk8tb0OiPr?= =?us-ascii?Q?FoinWSIAVZbksiuux92rhL6jBtaNR7oT8G8sOTHKqW05Hnh0YjOH7YD3anqR?= =?us-ascii?Q?yy0Puz1J5WXMWwAEmt821WKWXMmPMnUtf1uzIKcjTLMSbR3jcxIA1EFJS3CW?= =?us-ascii?Q?UKhriIx3ZZlnbY5CsOzI26PnwYK/9yvE3nnIrivifIcOnh8XnAyYl+HDoysH?= =?us-ascii?Q?9MvoYxh5o8kySv1ib04ffD075vPl65bSpfVhfUuYNmoHHD/oYCFuuokd8rLo?= =?us-ascii?Q?L3LNChmiKwbVsvVr3x7lWSI8ANCfKXm3ikdMCjxaSxgYD9gaYsnTE7Cwykl8?= =?us-ascii?Q?U1ExNrmAC4CWMdIT85KQUD6oTRgzI5VilCMAOrY0YiWJSCYobLB2remAQiE8?= =?us-ascii?Q?L4otVJfD7tOQupVJbAA2Ni0F2AvmIQUVNDROIvFzfxkbjD+CA9venfESGQ0x?= =?us-ascii?Q?M2++VnVxdMEdHNtPFM0K2LY3maDuZhoa7NXmL16BUy6kQfvk5nBNv4vPFPbO?= =?us-ascii?Q?ld8qYj0f4YwSO9RNfI9HUpHBtphWPMOoKLI4lHinBTgwzB7XkRaWo6kHtFHo?= =?us-ascii?Q?eXxqLfbXzras6dke4HAcOVMNZx8GiPPW7TaYSgWQTa28nuRtiqjj0KZTRo24?= =?us-ascii?Q?fCHjUbFZkjm1u9MNPEesm2VsaUG31J6IIqcjzxthFPFjLnlZa3cnxTdsA5qa?= =?us-ascii?Q?LpifGcJth8/NkdhzN6HCvCt1xrJ79nKnxIviDp7ido8uXJ/5ZKOAyhpUtOX8?= =?us-ascii?Q?1SOOKw5iiXOyeN1qb+85ia9jPIDskT/0pTNapWZ0sQ6qeYUGfG6uIv7LUd7x?= =?us-ascii?Q?HjPbSp1Jz+nQaREYRUpOghFzhpgCpRrVG4976E0CY+q221XLYgIeH5ec3eut?= =?us-ascii?Q?7UbTFkkRjKN7B4udquq+3v8anIuOsbhoVhvSPkQi7aLrGLJWGo2tB3DeRC5F?= =?us-ascii?Q?MWcdURIfDM6P/FUj67vK7C0WNGjkmlTa+M6ErYInw7Ql8l8szgw9fYLV0x1i?= =?us-ascii?Q?yjmimLtbiK2rbX4WriNq7c+M1Qgfp8Z/JpSTYZCTjMWntiZ5fzdLwZz6LXsc?= =?us-ascii?Q?UNjvv88PUYX18XfQGWGIiAbxiadWV/UTDUoAEnB8o?= X-Microsoft-Exchange-Diagnostics: 1; BY2PR0301MB1638; 5:vgsXGW15REMNsjntnzymUB2yqpDs7Eerg1No2PzsSEkr4fZJaRHBjxlG1Xiz8S7PCbAT4e/41a99HDUwLUNNyI3lcUaHvofakVvmYeCS4iKHVNMQyYMS+7cfvN8kCj7hnEQuuqw+lAjJu4xRRbUi+Q==; 24:UNYZFKMOfxe3Pq14tbv6TatWJEchb68nLqgwWUJbsCNPijLsiiJn3yySoW719ZNZASJdLAx+Y5UaNaHtO7ceQPx5eXNjOfxHbT8hOHg4ZQk=; 20:54SB21XpThZVVm+bhrTpQNXvtAb6KEqWCv3LXIA07V/qXX/Xp37CMcCHpgnR4pO2zkv4NK0wVafRFNWsh7HRlg== X-OriginatorOrg: freescale.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Aug 2015 15:50:37.4723 (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.158.2]; Helo=[az84smr01.freescale.net] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY2PR0301MB1638 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150818_085102_274209_3DFDC9EF X-CRM114-Status: GOOD ( 16.43 ) 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.6 required=5.0 tests=BAD_ENC_HEADER,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 - 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 --- 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 d7b98ba..0440b0b 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; @@ -685,7 +693,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"); @@ -703,11 +711,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 49e55d3..d22b8f6 100644 --- a/drivers/pinctrl/freescale/pinctrl-imx.h +++ b/drivers/pinctrl/freescale/pinctrl-imx.h @@ -84,6 +84,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