From patchwork Thu Sep 10 19:21:41 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adrian Alonso X-Patchwork-Id: 7155701 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 70EAABF036 for ; Thu, 10 Sep 2015 19:27:01 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 6B67320852 for ; Thu, 10 Sep 2015 19:27:00 +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 6BA79206EB for ; Thu, 10 Sep 2015 19:26:59 +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 1Za7S5-0001zD-RV; Thu, 10 Sep 2015 19:24:09 +0000 Received: from mail-by2on0105.outbound.protection.outlook.com ([207.46.100.105] helo=na01-by2-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Za7S3-0001s5-9C for linux-arm-kernel@lists.infradead.org; Thu, 10 Sep 2015 19:24:07 +0000 Received: from BN3PR0301CA0053.namprd03.prod.outlook.com (10.160.152.149) by BY1PR0301MB1221.namprd03.prod.outlook.com (10.161.203.17) with Microsoft SMTP Server (TLS) id 15.1.262.15; Thu, 10 Sep 2015 19:23:45 +0000 Received: from BY2FFO11FD028.protection.gbl (2a01:111:f400:7c0c::143) by BN3PR0301CA0053.outlook.office365.com (2a01:111:e400:401e::21) with Microsoft SMTP Server (TLS) id 15.1.268.17 via Frontend Transport; Thu, 10 Sep 2015 19:23:44 +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 BY2FFO11FD028.mail.protection.outlook.com (10.1.15.217) with Microsoft SMTP Server (TLS) id 15.1.262.18 via Frontend Transport; Thu, 10 Sep 2015 19:23:43 +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 t8AJNfTQ019448; Thu, 10 Sep 2015 12:23:41 -0700 From: Adrian Alonso To: , , , , Subject: [PATCH v3 1/8] pinctrl: freescale: imx: fix system crash if enable two pinctl instances Date: Thu, 10 Sep 2015 14:21:41 -0500 Message-ID: <1441912908-21946-1-git-send-email-aalonso@freescale.com> X-Mailer: git-send-email 2.1.4 X-EOPAttributedMessage: 0 X-Microsoft-Exchange-Diagnostics: 1; BY2FFO11FD028; 1:ye7FgtCm1UzJO9grmJAWhOlMVlxhonfT8sP5TDplqOUp4Dvi7IYtyRsmv2rzdCrobJVvu9ekTHtD2QTP9/G+JirEKC48q9OhAqcRq+8TfOPC4z+fIlAw+JJC6j75TF06iksw+FzIzHWFuy9pjFgQyMfdO49F00XJJ6mLB9FxdC185jtlccnHosm0r3x0yXTXAkIOLLtwuBdlbHc2JFRPn2Bc3PlOdJPzzzCUBeUJ+kDozchM5YpomaiO8wZNo0S5PFBICmxiN84F0PcetJKXdcWrRM09k18SQmf4CyCHiKW3ga7j+GZqo6Zl9fD/WvnIHXMLY5UX2d+RwCtiV7lusTgvtf2FyNQP2HMH/hYNq9DmhUKYdHojoH6fg6FDfxlKikMHbTLrmtFGgFmEugxsIg== X-Forefront-Antispam-Report: CIP:192.88.168.50; CTRY:US; IPV:NLI; EFV:NLI; SFV:NSPM; SFS:(10019020)(6009001)(2980300002)(1110001)(1109001)(339900001)(199003)(189002)(85426001)(33646002)(97736004)(46102003)(47776003)(2201001)(81156007)(68736005)(77156002)(92566002)(62966003)(5001770100001)(5001830100001)(48376002)(104016003)(36756003)(50986999)(189998001)(229853001)(64706001)(107886002)(4001540100001)(86362001)(77096005)(5890100001)(105606002)(19580395003)(5007970100001)(19580405001)(50466002)(50226001)(106466001)(5001960100002)(5003940100001)(5001860100001)(6806004)(87936001)(4001430100001)(2101003); DIR:OUT; SFP:1102; SCL:1; SRVR:BY1PR0301MB1221; 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; BY1PR0301MB1221; 2:JG3603Fyi7DtxGyF1Bg7csOlqTjiHgxtP6fQoEaVcElLr/xvOvt7f24anXE139gQoF5ZRfDI/cnlXl5tRneY05O8ZRJVD/msQFQxmrSYNGV2doQjZYxuxIcMDW3veq/7ZnxeD7UBUW32dJ1kLNIomk06geKQLcixdhysgY8pJoE=; 3:gKxzmjjNS0TOkECms5toj8wME1Esf8mEudpDjAhY7juUxzlCzB8VEntEfB9nbMZosuPpAAdJbkebzMMfUKlnoR2xPG8cPbupT9ROdtZDaaywzX1f4FkEIltrzBPAzr6mwPyYG4Vg6HATXEW6KHrWKBEgm+41rNrJb402VZ/wC91i8PkC58chntDD4k/DuiPRRLXV0cz3r7OGgIqt/JtBqzFbduHSl4ntx3wMrQQsSJ0=; 25:qsf2jhRdEIb/mSuyPrEDfIi+pxOlC9NaKJ2sqv3I2Xym6asQsMJ7pfgdkaAGPKcbH3z2cCqdybVygBeFYUaFlqY59WZWdZ2oYw4vK2DleC32FbqtjZ1qjzAo65upLL3GctC/tDMW3lFXC09FXNK+U53nwFaSczRGbVdyoNqTH/as0dQvWdnYQSg/z2RJOtVPYJ9MCo01tt8Jxdv2yLHGw28LlqC1DDZ5QG+IY4jFyHjM8drKR4LHPKo9GFrbo/OR4uFJRSnxI5eh9C6idIjNQA== X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:BY1PR0301MB1221; X-Microsoft-Exchange-Diagnostics: 1; BY1PR0301MB1221; 20:fnxizNgu7xKbwZoTCcRBj93PK04vNF4toM4ELxR2ZPuBx/cZTdoKPhw2vNHHQAIVAMteEEsweCcxfs2rlDc5Jfi7EbbzXF7qEr83byP0akjdbmP1ZHH97ApV8iC+o8XpvzBLNgQHQkaEQ6pwd2R/+7YlLDdv+S6SZrRcTa5BPbU0fviKdQNlRB3qDwVx6ZR0eLD5XenKXzQmdCSo4rXkVaStJ/Hm8LvAg5SBNYHJWLVnujv0j1WhlBvE0u54fWHPLph2iYtFYgD2d+sApYa2pZoUFGopF+rNK5sAbHvg26CwmrJHtRYW7uBdGJWm7TCMxi+VCsJv8M8q5FFczIj/EMc8DnZOXQMdlfOkG2CM/pM=; 4:vksIREG+G1jngiiyqroHSTq8suKy62uVM8TvyImr4zxvZ8DM7Nu/Shc8Hq7dY4yn4dmNGN/KER9pYJ+3tJaAiAtYlrZDNUZ2+mwqDS3k1kqCZe/cyg5dlxd4zNshvAc2UPegOEAwDvHq+kLKX+pEZLD2UrTMrAr9nmKDV2Pzz6aLc+s9KzNQAxf1a4qAlMu4ydq7btA7rehBXczBZ/2lhl8Y7wWhoPDCx8+ihcbqYIT3FLJlnzohSmxzR1QTCsGB1U3TzNkbZLS3/8Bbes5+CD1IChXVj5sd2eZCWf3zCnodVbmpjpGcr+iuo75cnDfQ 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:BY1PR0301MB1221; BCL:0; PCL:0; RULEID:; SRVR:BY1PR0301MB1221; X-Forefront-PRVS: 06952FC175 X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SqLCdKPPrA/turekfQ/kL0r3tISUEputVAs1JuQ4tdaDHjeabyBv83o?= =?us-ascii?Q?KdNOUSAhgpajATtXSmYO347Rl6nohGskom1MVIvzjQkJF8o0ad8tjc2E1zWu?= =?us-ascii?Q?NAQBVuS8TFC/eHEtQT2PsjpturYl/O2jpS86/6sNm7UXgjh1PunbDs+LDEor?= =?us-ascii?Q?STJZCwBFT572qAnqrU1bdArwN8tM5ry/5a84M8mhHvg+BYBr0uHvICuY1duX?= =?us-ascii?Q?J7qN4dsDo+Wy2mkXNXXixF6lSJFo/sIi7JLRowljoitjP33bKYBJwBG6F48u?= =?us-ascii?Q?wcXjHQqBwyioF+FlY8er5pRYyTYbVRcTgcAhIaoOfHxXyfqk5jEzUXiv3JH8?= =?us-ascii?Q?dxN5DhQnmqLIDIRJI/dThfoXvY8AqdC8uKLvo1fQcd9vb9l5JowBRF/fFioE?= =?us-ascii?Q?N8nG2gpiNi3zAsxLRqiM=3D?= X-Microsoft-Exchange-Diagnostics: 1; BY1PR0301MB1221; 5:6g56aM4sb0Hpwny0E4M2r5gin6qcBJbx4rbaCbXM+ZZb+J60el6en1ptLAOaWSWlHELxLdRzo3ltg3+TjhXa1R9x9DorQ75WmM3unI0bSuIAA1WKZ3ScW3T9B+AmDs/mJIBLNqMXt65VTqT/3b+cLg==; 24:BuTIPQ5pbPwD90PZig+saf0Bmci95QVk+DG4gTSo5qx84O15BU+5/UfV57740XNgoGre3BHhGjlx7AE9W7GSjK/y3Qra7BRVb8hRf1o8v3Y=; 20:ko0dkd9pNOH/7I4NBBFCkVcBTu5cbjXVOu+EG6P5LxncwIQnHUDspfWiGhqvimYGAKxvGiviny+Ks94v6fK96g== X-OriginatorOrg: freescale.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Sep 2015 19:23:43.7163 (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: BY1PR0301MB1221 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150910_122407_339968_21E3B50E X-CRM114-Status: GOOD ( 18.81 ) 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 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;