From patchwork Fri Sep 18 16:29:51 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adrian Alonso X-Patchwork-Id: 7219121 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 2D65B9F372 for ; Fri, 18 Sep 2015 16:34:23 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 4419620886 for ; Fri, 18 Sep 2015 16:34:22 +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 3966D20903 for ; Fri, 18 Sep 2015 16:34:21 +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 1ZcyaD-0000a4-II; Fri, 18 Sep 2015 16:32:21 +0000 Received: from merlin.infradead.org ([205.233.59.134]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Zcya7-0000TL-Ci for linux-arm-kernel@bombadil.infradead.org; Fri, 18 Sep 2015 16:32:15 +0000 Received: from mail-bn1on0135.outbound.protection.outlook.com ([157.56.110.135] helo=na01-bn1-obe.outbound.protection.outlook.com) by merlin.infradead.org with esmtps (Exim 4.85 #2 (Red Hat Linux)) id 1Zcya5-0001b7-Pu for linux-arm-kernel@lists.infradead.org; Fri, 18 Sep 2015 16:32:14 +0000 Received: from DM2PR03CA0051.namprd03.prod.outlook.com (10.141.96.50) by DM2PR0301MB1230.namprd03.prod.outlook.com (10.160.219.19) with Microsoft SMTP Server (TLS) id 15.1.268.17; Fri, 18 Sep 2015 16:31:45 +0000 Received: from BN1AFFO11FD016.protection.gbl (2a01:111:f400:7c10::163) by DM2PR03CA0051.outlook.office365.com (2a01:111:e400:2428::50) with Microsoft SMTP Server (TLS) id 15.1.274.16 via Frontend Transport; Fri, 18 Sep 2015 16:31:45 +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 BN1AFFO11FD016.mail.protection.outlook.com (10.58.52.76) with Microsoft SMTP Server (TLS) id 15.1.274.4 via Frontend Transport; Fri, 18 Sep 2015 16:31:44 +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 t8IGVgDY032121; Fri, 18 Sep 2015 09:31:43 -0700 From: Adrian Alonso To: , , , , Subject: [PATCH v4 1/8] pinctrl: freescale: imx: fix system crash if enable two pinctl instances Date: Fri, 18 Sep 2015 11:29:51 -0500 Message-ID: <1442593798-11501-1-git-send-email-aalonso@freescale.com> X-Mailer: git-send-email 2.1.4 X-EOPAttributedMessage: 0 X-Microsoft-Exchange-Diagnostics: 1; BN1AFFO11FD016; 1:dyOTcVfv88vq/9vBEzLZ4TcBftJ2Qo9vugMUNuCcZM7ExciBtI+qjMyyaPKBxoYhi/+ZxNoPw+3fSgqdA5TAl2kDEN8i0MFBYjvbdvPm3kkf/JodoJWXViCk/F8jtgXF5pHzSfanmO67dOIecxv3wfHUL7OktpBmy6raISJsFc2DRysxFAITZl4jqo3uDEuA5CltZGSiaitl5lhPkFM/yZJZTUu6UkSebdYAP6iXkyLgQwehScs4y7X40b+xNNOjH58cwaKaFMhVNgCO85mvz+/PzRk5r9ZZ+uE+FQWBY1c9QIQdAcidjsui3bdaf86wmsmEwcrn/CWChTHl+9wm4RsWge/zTajRP72L7wJaIjoAHPMAMxV19aWEzP8gIISbfAaXtsPVNlPu5X/iQPpICw== X-Forefront-Antispam-Report: CIP:192.88.168.50; CTRY:US; IPV:NLI; EFV:NLI; SFV:NSPM; SFS:(10019020)(6009001)(2980300002)(1109001)(1110001)(339900001)(199003)(189002)(36756003)(11100500001)(64706001)(47776003)(105606002)(104016003)(33646002)(106466001)(229853001)(5890100001)(5007970100001)(62966003)(50226001)(107886002)(86362001)(5001860100001)(189998001)(92566002)(46102003)(5001920100001)(50466002)(68736005)(87936001)(5001960100002)(77096005)(50986999)(85426001)(2201001)(77156002)(48376002)(19580405001)(97736004)(5001770100001)(6806004)(5001830100001)(19580395003)(4001540100001)(81156007)(5003940100001)(4001430100001)(2101003); DIR:OUT; SFP:1102; SCL:1; SRVR:DM2PR0301MB1230; H:tx30smr01.am.freescale.net; FPR:; SPF:Fail; PTR:InfoDomainNonexistent; A:1; MX:1; LANG:en; MIME-Version: 1.0 X-Microsoft-Exchange-Diagnostics: 1; DM2PR0301MB1230; 2:jfzWumZ7EftvSmJ76fWYH7MkD480q13Q4/H9cdVkXp3fbh7/pC/fFcYT25K4fM3EM0rRjcgEAtHgwcb40jEzc6CgGmKMt/j3LCewitBXNy/arVzvjxinNCOJiqFpbD2sJcmGJ41Zkz2UEJ1CogRY0HyKAk4xX51zvYBuW3IeGoo=; 3:rcPpCUVxHBOyZCjhokkspmCFECtELBZ6/F9fNMZUEPIg83SN8y6tXAx+kwz70lxold9G1PEeopj6nbpk0xw6NkzW2Gp/CRmy4gfh+oFxoUrnBGQXiaRyouRrQB/vtjU6UN2UaXsAv5Jqad/Oj7JBwYW5uN9OAz3tU16PIYlyb96osxZlO+XVa513zcMXjU9sARkWG5deZs4BTHd+MizGj3ktaz/+ccV3UfXDkeUum7I=; 25:GaROFSzCnAYFnSE78BlLSmoY2IGg0mbrYD9pF5sxGwLBGXdfcqegmVf5m4hOn2UKsPfO8N7mPSGbxR4kTkhX2135CDGJsfCKUy5Xt2ZhZJd1f23T4OAMoCkKS591HLzuvaATsQRlQcT919orXgL5Rb7tj8NDrZe04PgnCBDa2HtGwZ+rdwiNttxqDgWIw9eylqj9sKXsJfTJF7ZT4RPwCo38DzOUhyxnGI0mLbf2OxUbvJw0SMg+KZjTFuEKB9iG4fkQpveqMz9cOhjnfj411A== X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:DM2PR0301MB1230; X-Microsoft-Exchange-Diagnostics: 1; DM2PR0301MB1230; 20:3F+pwuw2qNKaUYi2EC5vBg2HP0GxvToivbB4/ZPz5w3YpDChnJE12paRmBa2a/B5UDaz8R3xWTU1TtxVdgmLhAfj3LOyez2LLgQkzf07qo4m3ySlT58+uM1YNPS9C/3vbkF4eJcWdo+ytxRgDpRwhiiGeEolOM63WsYTDB3EG9CpS/r3bOtz0ihuZ8hZmLJJNAUbsWPoG0mVy9qtHbm+SZ8+NDrWrOcElbZqBZfKxcdY4lLqUrfSSglFZfcE2btTD6rubLJ5atjbIFavnGTSUQc3KdovXeQtiPj8b53mxVkMCiVq2K4i0FMe2iabajzY0JKXh8wfUJOvt43G6n4Wj53f57L6I4HpvXOSUEe3BOo=; 4:O4Ea0c2lcv5CXiTj4Ntt0v2jnWlWRH32d5bs5jWxFVon5/M2UVZkiDECLPW8PHLbivwGjfLlTKiZAbcJSZAVGPsbiUeHx1ugpP6C3H8iwwSKlEjQgJwXecDqniq+cNGVrfQo8RnHOOs7KwpGCrw/BWQqbTmCajCJnl8gqigsEaaXoJrLs9ahrb+Z7avZsWpJU2qHM2dWNcx6kXrzohYJ10OKVUucBOa5u6z5IvuzbuukjMdVRU34GsHg2u+aOr7WJY4jUjsAeOITX02hc84oJWkODBvayeMOW7bEOQzjYV8LdM6nftuUXcovcHWkQgUwBfoH97HpzbO1eMhyB3vqGQ== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(8121501046)(5005006)(520078)(3002001); SRVR:DM2PR0301MB1230; BCL:0; PCL:0; RULEID:; SRVR:DM2PR0301MB1230; X-Forefront-PRVS: 0703B549E4 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; DM2PR0301MB1230; 23:fLU/aLPrH1b6jJbPzLdRbdjnK4NvagjX3GBpmfk?= =?us-ascii?Q?madb7ZJUhdwXUKVf7/byTUYP6NeHXF7JlLJnP8p3tZSrRkunaKza7GRL6a90?= =?us-ascii?Q?zhpGjDh8ua229C5dNxI7Mg/oplD0Gp4zQX2TU71kG5DWY5qRUZQw29zv+ShQ?= =?us-ascii?Q?xZD980X15t1LRxLFpDpUy2V8IvG1iVAyQwIt8uwTeoXoPeCJ4Enqi9NsjwrP?= =?us-ascii?Q?YzCWj5Td57J1i3tWiZO6yEejtRpoFzZtDsdfr4DPfdOuHWog2X2olmL5GHTz?= =?us-ascii?Q?WteJLCGwo+wvd38pKpFahzRTYV4cYYRh1Z2LdzJtH7ObFcwpg6emiIvmzgZi?= =?us-ascii?Q?BsDdknGVy2bt9yHDn87NTHcI07CDkHXTxg8StmOKiIoy9/4X6mkxKl3Ev6Tb?= =?us-ascii?Q?EevHTQkLeRYtaUzVKgZBdEe67ik5jKmp72FDUDcmbMozHP2OEmfPaSdU1/X/?= =?us-ascii?Q?FUT2HjVcXLiugdlVVKcxsR1bgHYug2Ep4wxJ//0F1idKUAGTFv4htG1UtYcr?= =?us-ascii?Q?lRqQ1JDHiwTJJ1rdR/ysb7gBafayAlwqCFibGUkGqnYvXes0/1kCVnMkqm/z?= =?us-ascii?Q?FTWpgNyoFn1yrb+mEoWIR1mVXm5IMz1XSaLuKT+vsnDrpH2WAdeiCqBIV1ub?= =?us-ascii?Q?NarDyB9c5keReIf69c8fvhBswhv81I4/ewoU88ru1TZBwnVqhtjScFQ2L4s2?= =?us-ascii?Q?2BMYNMGai2ZiAGijXPQ7bJrokgIaD0LcN89smQ35/37GhbBjx7n93HzDJo/2?= =?us-ascii?Q?lLEd63Yzt5xOj7euqfUEaDShWa2esZ7f8haokCo4Zxy4jqbAX3tlpItcHvlA?= =?us-ascii?Q?wblHdscLpbYqSwbn1+aRY4VZlYPZ6wMYyUpZwd03sTZ9D1Z/FAAmxRtqLiMl?= =?us-ascii?Q?hGXo1JqK3ydurOdVZo5Wd9mNG5uYdvF2PoJ7l2gzrNEdGAmqTkrEr0VPIbYo?= =?us-ascii?Q?ySlb3w797LoVj3GAbNSZzxdv5TKT71OTvES6m+6V5rLTICRx4j1jh8t7X+Y8?= =?us-ascii?Q?Leaw1WxlNf70J/OVi9HCWe0P3+HN8JRFIFI9H6JYAlpWEm1vf3a0zuw66exK?= =?us-ascii?Q?iSmi11NAYx9/5nTeRMkNybsQz2wNgZna8LjR7+SPxWbxATy6JaPxoPHx3kwU?= =?us-ascii?Q?zK502w58NbkfvCZ9OK1hVmNZCEc1gE2LErI76YR0A+io/ju13FqNfsIUdIYz?= =?us-ascii?Q?zmr0/+AVbRv+Yl2Vlv9QLxOs7hbsBE6i7S5/fqPYydIj9/1zATYgKXNinzQd?= =?us-ascii?Q?fEADAchev8SZuU4mKygtEs+4zZSet6CvG3AtnLKS2VZ0JeQZGCvhdxp2JbEl?= =?us-ascii?Q?qQw2/CeupvSSAQecFjE7Tqqo=3D?= X-Microsoft-Exchange-Diagnostics: 1; DM2PR0301MB1230; 5:3YSLh8dBhwhCgDodIqLagyRUSu03BfOWMXn3du35XiThzuHsMNog2O089fl/2slLSFpf6HpraqWuwIQ3WLIzNgRwwd7m0kRm7o25ftO8mkSW8Haahvwau21OifKsfa9B+ih2ruucZa5SWO2I58SK2g==; 24:oIggAPV8JfqfOPvcg+TA2zjIpUCBWdRQr6nykuSJqkLIcq7qWE+Z3eeIQjpza04qXNuj85I2UzoA5HBNFuPPR/r7IWS2UgnoJwKuTajbj0U=; 20:V5v6thYBuroyewbFQisdkOlrRYsPZWF7bSA/w63RUkq5BBWxpfFIpxWeRgqc0FQCnb+QIudHpBoO8Gg9G5O1vg== X-OriginatorOrg: freescale.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Sep 2015 16:31:44.9864 (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: DM2PR0301MB1230 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150918_123213_984115_E2883648 X-CRM114-Status: GOOD ( 21.16 ) 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 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 --- 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 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;