From patchwork Thu Sep 24 20:53:57 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adrian Alonso X-Patchwork-Id: 7261041 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 B57B7BEEC1 for ; Thu, 24 Sep 2015 20:58:56 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id C0B3220A97 for ; Thu, 24 Sep 2015 20:58: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 BAB8020AA5 for ; Thu, 24 Sep 2015 20:58: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 1ZfDZ7-0000s3-NW; Thu, 24 Sep 2015 20:56:29 +0000 Received: from mail-bl2on0118.outbound.protection.outlook.com ([65.55.169.118] helo=na01-bl2-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZfDZ3-0000gf-UU for linux-arm-kernel@lists.infradead.org; Thu, 24 Sep 2015 20:56:26 +0000 Received: from BN3PR0301CA0021.namprd03.prod.outlook.com (10.160.180.159) by DM2PR0301MB1232.namprd03.prod.outlook.com (10.160.219.21) with Microsoft SMTP Server (TLS) id 15.1.268.17; Thu, 24 Sep 2015 20:56:02 +0000 Received: from BY2FFO11FD008.protection.gbl (2a01:111:f400:7c0c::156) by BN3PR0301CA0021.outlook.office365.com (2a01:111:e400:4000::31) with Microsoft SMTP Server (TLS) id 15.1.280.20 via Frontend Transport; Thu, 24 Sep 2015 20:56:02 +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 BY2FFO11FD008.mail.protection.outlook.com (10.1.14.159) with Microsoft SMTP Server (TLS) id 15.1.274.4 via Frontend Transport; Thu, 24 Sep 2015 20:56:01 +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 t8OKu0F0030281; Thu, 24 Sep 2015 13:56:01 -0700 From: Adrian Alonso To: , , , , Subject: [PATCH v5 1/7] pinctrl: freescale: imx: fix system crash if enable two pinctl instances Date: Thu, 24 Sep 2015 15:53:57 -0500 Message-ID: <1443128043-21063-1-git-send-email-aalonso@freescale.com> X-Mailer: git-send-email 2.1.4 X-EOPAttributedMessage: 0 X-Microsoft-Exchange-Diagnostics: 1; BY2FFO11FD008; 1:+RGkDID4qLC0y75cTF8ogGOigGJ7wFJEc+MXFhOnNTE/vHSBKTh/lFpsOXekrGJr9uqYROAscrZpn1psdQgcecI48Q3J6rcaYsOpA27JVewbofF9ggNbUPHR5f1LsHJ4pihlpxb0uatmf97pjcGrPTNuu6QVWDAKHucTF9iQlqccGwCTrAnozHn5em2z21+EbSpvQmfnOUp9YLyffCoQP6eWq6cfGtXRwkrPRsfbQrUyn8RFec8kln7Kbw5wnGTmxCgdotEQ4TAv4E4Eg/J4xPuDvSGf9ls714P9iPCj6NVDStpyElNmkG5ydxrP2vNnxso0gSKHd0fUgSsJrvOPScbu6QftFrwG2GYZ6HLOv1zY8fCDK72BAMqFRzQ+jXrmB7L3UhOcnlx6Ag8z5TpAbg== X-Forefront-Antispam-Report: CIP:192.88.168.50; CTRY:US; IPV:NLI; EFV:NLI; SFV:NSPM; SFS:(10019020)(6009001)(2980300002)(1110001)(1109001)(339900001)(189002)(199003)(5001830100001)(47776003)(64706001)(87936001)(5001860100001)(46102003)(11100500001)(85426001)(107886002)(2201001)(50986999)(86362001)(33646002)(5003940100001)(5007970100001)(5890100001)(77096005)(62966003)(5001960100002)(77156002)(36756003)(19580395003)(68736005)(189998001)(4001540100001)(106466001)(92566002)(50226001)(105606002)(229853001)(81156007)(104016004)(6806005)(5001770100001)(50466002)(97736004)(19580405001)(48376002)(2101003)(4001430100001); DIR:OUT; SFP:1102; SCL:1; SRVR:DM2PR0301MB1232; 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; DM2PR0301MB1232; 2:zLfCLB2p3vxF4BuCWWvsK8aKVdbhMYzDQ9KQORf6PLPpHh1zgPTkvbDOD0q5rAgFnCXlW2SJ11+bUaq4YDdECbjT4Ldjso0rHU2sGOmiSN1md1c4ytkpMauIOuRW1hHKc6ESU2MAgyI/IfRLzjEgxQil+DHeH4isSvUFxvi+rAo=; 3:+rUrvLjZJ07dGUFEWrXUguSkdR3epp7mWqtzp7D8GBy5XvjO/StgGPMOMaY5lreiPB6tqijbcJdg1nlv4W6TGCPXoorkWjXsOwoVq+KEeELA20vEvl+SNm7vuyb5fdgNdXhIPes2Im8rhbSAmUGqJawBo+0zprjxmYQYWMS7B2EmR/baEJVW+zlk4ULLOHXSoNMmBeSWEjA2+FC4WpEVLBiXXAMnXo5NhjDG7a2J5hc=; 25:1OwZWjxxd66H9eFYERDBU4hR0phekH40ibX8WEhQ+5LTVkgaypxYSrn4pNxqGQnvOv8rzibUQRlFkiSjSTDRjpdlVxZZM88DnxUqpMTqlgpRlIU1uqkk5Y0WsGePy/sD20qGv75JJQhAg4xVfJjyj/LkkRnKYZ2sIrw+E0Be8zv9YNMqrw0ISz64DYiNxVGOZwfIjVY5N9WPzM9HBZHW0iTycx/+C1yXuNBED2fEIFlF9P/F0jUNwR+2zQ4Fu8/f2EGqdERgg/i5Gv1drdnVwA== X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:DM2PR0301MB1232; X-Microsoft-Exchange-Diagnostics: 1; DM2PR0301MB1232; 20:qlMp7fAhZVAsszxMgXaFcfbU+gXqxlnjZiWI+eNpe1iUYMZBZND58xJ6grlnOAoOpUS63GgbVOd3KRS+rL+xqN+bELQ24Mla9PPsiHtm7ei+EYPo0CABYNvJ0oE9/hSX4DZ485MtJEGPDj0FQiCVFkTKKytKMnhuvZJ4Rtm6mc2woZlnsZ5s+XNZfy9JoEHldSjOXAVPCgNC3kc2JrQQo0uBKFMYTVlzjUYRFACEYEpoHhQFcx1pAVu9BBS1Cp3RX6tee2SByYqsdjLcELC5KCI+YVhdy8Yc/WjPO/FrP7ycv6M7/7xZFR+Omb12+J12Nj8YtTRConf6hOIGYOOFgnEQ5rXQ6o5hJjVDlzxBn0w=; 4:pAXuqDgpRLjdv+cDZorsEGwDjI6/qZMe5X8wLgOO8MGWaaYI2zH0QSy/eUlV7i/daGAHOgvnmuwWQ4vG98O+AiWns24AMxdMWjZLIv0vAf6yEhFVANmdB7kcywvualdlG/S41YXerDadVX1HcFVdDPliP3cJu5I3SYs9YotSKQ2rtyI8Lia0ryTiXM8js+0oO3qS1lT8DJfavzTiO2dVIvSyz61VRkqBFAgLDygldHvDCuFWwF4yjrTnAsZqXLrXyDuoatYJL7YsysXZzxL8lUG5SnCAQI6FVy1sXhGZT5YkVqiKjvUWrlByFvAehvnnP04rXYXQIjrGRoRyrNH0mtnRM2jbi/+reBvIIleEXeE= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(2401047)(8121501046)(5005006)(520078)(3002001); SRVR:DM2PR0301MB1232; BCL:0; PCL:0; RULEID:; SRVR:DM2PR0301MB1232; X-Forefront-PRVS: 070912876F X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; DM2PR0301MB1232; 23:tg07OK2rs5kYWPjQDKSJbVXhrnRkpsYRY9bHHTu?= =?us-ascii?Q?htuoYxdzWROxByh7i5yXcurbAqKxbZC6GMyaVpsNzcOikFgnzIuqdt2Zm6bN?= =?us-ascii?Q?wK6bOmWZZgP7thqR39NDS5bB61cV6pQceO7CK4eRfLYdbHikIwvxFbjf8scf?= =?us-ascii?Q?4EL0ObnkCYeuBY2xiYdnBJ00eS1hD/BZRsji5or4NO8Abssfm/VEdPVietNb?= =?us-ascii?Q?vKs1MlkFPzpZjMvUAsEpFpcfYbBnTUl6FMteHab2K7q3eVTf+hddiQeVNQoJ?= =?us-ascii?Q?fTbMciw/5YAkh2tjQfp6YNfVn4671x1lJis4M7l/puGL6Z5YfhqA11cAFoYw?= =?us-ascii?Q?MycfNf6vYXmEprJ1ENokHIqlc/oJzSrN3FqrdAqeRzpoGKkc89txlz/NNORo?= =?us-ascii?Q?Ig5ZvuVWq2Lrt3Dcgx9Mnt2qlKrSEKeSt3w04O2dGvSKI5cotX72V+qMpHvY?= =?us-ascii?Q?0LADx9CHIjyupDLZUibb5kfjEcXdZVJXWEHLi1ccQnsBWjQ1AV8yuNQVENW3?= =?us-ascii?Q?aa0zutdbSb/bwWY5p5aMYb5Rp3Q7OPuBuhErypiCmZoHeSoQVZ4jwW+Gab6n?= =?us-ascii?Q?qjsWn3LWF2vIJq2bbRGYq0g85X1mUY237M7raZ690pBTcFY6Ee5Fu4SjditW?= =?us-ascii?Q?qd5r3Qg0oNDfs1+CDtHJTxT40q4JwgjonerLaXaf5izT21wKiip17Jjqouxz?= =?us-ascii?Q?xPs/2wHidyOjXeBQApgFIu954BmuVlprqCbamnow9yP747FzM8pazg95L5Ip?= =?us-ascii?Q?58/t9kpeShKwHYOuwLFHPen1js5NoOuU0t/w+2vkOz8ho+RFJu6U2F+n/TQl?= =?us-ascii?Q?voSQKAhoH32/5cy3xdu1J1WsUmuIEFW6sNfiLt7YuhNoXvH4CD0n5nNZHU5X?= =?us-ascii?Q?0YWXhTYzVctjul3S0sIaPp5E87QqxLLytQsAHT6v3s1KVhQFs3bT3BX3z4uG?= =?us-ascii?Q?V8oEV7Vm9sEeTXetyk51vTHooJyfPG4uOJWBkiJjE1hzcft2M/GPrg89joC+?= =?us-ascii?Q?9VibnVF56scIu14zaM9SyOQ/oh17tvPN4gv3BtAg1nRzBZx11Vj3QQNZBXcL?= =?us-ascii?Q?y2vsjNBL/IPPVcVjm1foBOCKJNVPEXnAo3Hk5OPwzWRAhlr4ygPcLy8KQTwJ?= =?us-ascii?Q?jfOpBnU55a21offmLaOzVhdjvIf+NliXgPNg03EdZ1Urbys+Jk7AtqFCY/aK?= =?us-ascii?Q?LC/DTkF0yY6XCdV9Wdw8wo5CxHcfJJxjceL3Sbq45tY1xbTWTZiImnSTHqpD?= =?us-ascii?Q?yDmz0LPHDDDisR1641rGGzvoxCDdG5alJszW/oWHi?= X-Microsoft-Exchange-Diagnostics: 1; DM2PR0301MB1232; 5:A3oaXFV3JvUwZX0xkQlLNThJ9o8xolKfNBn/n+znCeuLiqeGbZ00GTj8/QfaPAuTTzj2ReMh2Q6ivOTIHFFPj0UWoCA86wuHfoKtC2uFVnuaWtxWgo/tMy/Q3uDllz1EgE/viaDY/Ac840XukiefKg==; 24:7O39lEpDRoXZzNfHohuLlxHWdFhfuP6zXGnFHcX7cjPhpWRPq4H+55VnYzKmbiCMh+2ZvdEijbQNORcy2Ur7Tgxutsgi7JlhEhZtLLJu7OI=; 20:usdGuYEuuRNbRBP6VeDQrN4nD3rtW6ZRrpgIR1yUvBYF/4F35lcBRkHoYIkrfSoDvbFTEKd238C9JNkAOBQeyA== X-OriginatorOrg: freescale.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Sep 2015 20:56:01.8892 (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: DM2PR0301MB1232 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150924_135626_232806_A2A6FD78 X-CRM114-Status: GOOD ( 19.15 ) 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, 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 From: Robin Gong Fix system chrash caused by groups whose number is smaller than the number of groups of the last pinctl instance which is not initialized. iMX7D supports two iomux controllers (iomuxc-lpsr and iomuxc) on probing the second instance (iomuxc) the chrash below occurs. Uncompressing Linux... done, booting the kernel. [ 0.000000] Booting Linux on physical CPU 0x0 [ 0.000000] Linux version 4.2.0-next-20150901-00006-gebfa43c (aalonso@bluefly) [ 0.000000] CPU: ARMv7 Processor [410fc075] revision 5 (ARMv7) [ 0.000000] CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasin instruction cache [ 0.000000] Machine model: Freescale i.MX7 SabreSD Board [ 0.661012] [<802a6cb0>] (strcmp) from [<802cc80c>] (imx_dt_node_to_map+0x58/0x208) [ 0.668879] [<802cc80c>] (imx_dt_node_to_map) from [<802cbe24>] (pinctrl_dt_to_map+0x174/0x2b0) [ 0.677654] [<802cbe24>] (pinctrl_dt_to_map) from [<802c8f18>] (pinctrl_get+0x100/0x424) [ 0.685878] [<802c8f18>] (pinctrl_get) from [<802c9510>] (pinctrl_register+0x26c/0x480) [ 0.694104] [<802c9510>] (pinctrl_register) from [<802ccf3c>] (imx_pinctrl_probe+0x580/0x6e8) [ 0.702706] [<802ccf3c>] (imx_pinctrl_probe) from [<80351b58>] (platform_drv_probe+0x44/0xa4) [ 0.711455] [<80351b58>] (platform_drv_probe) from [<803503ec>] (driver_probe_device+0x174/0x2b4) [ 0.720405] [<803503ec>] (driver_probe_device) from [<803505fc>] (__driver_attach+0x8c/0x90) [ 0.728982] [<803505fc>] (__driver_attach) from [<8034e930>] (bus_for_each_dev+0x6c/0xa0) [ 0.737381] [<8034e930>] (bus_for_each_dev) from [<8034fb88>] (bus_add_driver+0x148/0x1f0) [ 0.745804] [<8034fb88>] (bus_add_driver) from [<80350c00>] (driver_register+0x78/0xf8) [ 0.753880] [<80350c00>] (driver_register) from [<800097d0>] (do_one_initcall+0x8c/0x1d4) [ 0.762282] [<800097d0>] (do_one_initcall) from [<80987dac>] (kernel_init_freeable+0x144/0x1e4) [ 0.771061] [<80987dac>] (kernel_init_freeable) from [<806d9c7c>] (kernel_init+0x8/0xe8) [ 0.779285] [<806d9c7c>] (kernel_init) from [<8000f628>] (ret_from_fork+0x14/0x2c) [ 0.786981] Code: e3520000 e5e32001 1afffffb e12fff1e (e4d03001) Signed-off-by: Robin Gong Signed-off-by: Adrian Alonso Acked-by: Shawn Guo --- Chages for V2: - Reorder patch series - Add platform boot up information on kernel error - Move gpr_index to imx_pinctrl_soc_info Changes for V3: - Rename grp_index to group_index Changes for V4: Resend Changes for V5: Resend drivers/pinctrl/freescale/pinctrl-imx.c | 3 +-- drivers/pinctrl/freescale/pinctrl-imx.h | 1 + 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/pinctrl/freescale/pinctrl-imx.c b/drivers/pinctrl/freescale/pinctrl-imx.c index d7b98ba..b9c6deb 100644 --- a/drivers/pinctrl/freescale/pinctrl-imx.c +++ b/drivers/pinctrl/freescale/pinctrl-imx.c @@ -580,7 +580,6 @@ static int imx_pinctrl_parse_functions(struct device_node *np, struct device_node *child; struct imx_pmx_func *func; struct imx_pin_group *grp; - static u32 grp_index; u32 i = 0; dev_dbg(info->dev, "parse function(%d): %s\n", index, np->name); @@ -599,7 +598,7 @@ static int imx_pinctrl_parse_functions(struct device_node *np, for_each_child_of_node(np, child) { func->groups[i] = child->name; - grp = &info->groups[grp_index++]; + grp = &info->groups[info->group_index++]; imx_pinctrl_parse_groups(child, grp, info, i++); } diff --git a/drivers/pinctrl/freescale/pinctrl-imx.h b/drivers/pinctrl/freescale/pinctrl-imx.h index 49e55d3..2a5fe72 100644 --- a/drivers/pinctrl/freescale/pinctrl-imx.h +++ b/drivers/pinctrl/freescale/pinctrl-imx.h @@ -78,6 +78,7 @@ struct imx_pinctrl_soc_info { struct imx_pin_reg *pin_regs; struct imx_pin_group *groups; unsigned int ngroups; + unsigned int group_index; struct imx_pmx_func *functions; unsigned int nfunctions; unsigned int flags;