From patchwork Wed Nov 18 00:02:59 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Li Yang-R58472 X-Patchwork-Id: 7643781 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 D0DF29F2EC for ; Wed, 18 Nov 2015 00:22:04 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 03F122054A for ; Wed, 18 Nov 2015 00:22:04 +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 F1C1F2053F for ; Wed, 18 Nov 2015 00:22:02 +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 1ZyqTc-0003U4-Me; Wed, 18 Nov 2015 00:19:56 +0000 Received: from mail-bn1bon0137.outbound.protection.outlook.com ([157.56.111.137] helo=na01-bn1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZyqTZ-0003RU-G6 for linux-arm-kernel@lists.infradead.org; Wed, 18 Nov 2015 00:19:54 +0000 Received: from CH1PR03CA012.namprd03.prod.outlook.com (10.255.156.157) by CY1PR0301MB0859.namprd03.prod.outlook.com (10.160.163.153) with Microsoft SMTP Server (TLS) id 15.1.325.17; Wed, 18 Nov 2015 00:19:31 +0000 Received: from BN1BFFO11FD006.protection.gbl (10.255.156.132) by CH1PR03CA012.outlook.office365.com (10.255.156.157) with Microsoft SMTP Server (TLS) id 15.1.325.17 via Frontend Transport; Wed, 18 Nov 2015 00:19:30 +0000 Authentication-Results: spf=permerror (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: PermError (protection.outlook.com: domain of freescale.com used an invalid SPF mechanism) Received: from tx30smr01.am.freescale.net (192.88.168.50) by BN1BFFO11FD006.mail.protection.outlook.com (10.58.144.69) with Microsoft SMTP Server (TLS) id 15.1.325.5 via Frontend Transport; Wed, 18 Nov 2015 00:19:30 +0000 Received: from right.am.freescale.net (right.am.freescale.net [10.81.116.70]) by tx30smr01.am.freescale.net (8.14.3/8.14.0) with ESMTP id tAI0JTFr030327; Tue, 17 Nov 2015 17:19:29 -0700 From: Li Yang To: Wolfram Sang Subject: [PATCH] i2c: imx: make bus recovery through pinctrl optional Date: Tue, 17 Nov 2015 18:02:59 -0600 Message-ID: <1447804979-29550-1-git-send-email-leoli@freescale.com> X-Mailer: git-send-email 2.3.3 X-EOPAttributedMessage: 0 X-Microsoft-Exchange-Diagnostics: 1; BN1BFFO11FD006; 1:o+66nhJX9knemEMBtf5lDEhDhBX9fueh/KpA9O2fdziACfPZlwdiwUH8CId6MXTNggXYMw1GSbr+gVMjyp16tkDdcmke7VJn6A/GJEsv5ItCCDtZc5O6GxwgoCU2i/W112vWxyeVXP5ZoW5/jZ+U/Qqp/R6I3TRxsCb1tf0mdyjAaVJkudJwQ0tRvlPVeDQrUHnmJ261rrU0KUmLC1XXuG7rgdokXYh4vf2k4iB9UN8pjk8z1hIKz1Jn6M/Hgwh/79ycTxo+Cb+Mdh+a7WLkVu422SfFA01SZT1HMXnqQXxxzDBxvmqMOeLjtn5lPc/RpedcT7KZQ+z8WnQkN9AQsZG15L/ljMXyaYy5CDP79HpRd18oHKj+YoEwHF0zL42Zm795vr53bI1kr37pnMRxjJ4IVpEwvEjf6gCI8/nImUxabj6UbzyZe10lsvZWQbws0nkEwtad+JfDGF/fIdO4Cg== X-Forefront-Antispam-Report: CIP:192.88.168.50; CTRY:US; IPV:NLI; EFV:NLI; SFV:NSPM; SFS:(10019020)(6009001)(2980300002)(448002)(3190300001)(189002)(199003)(50986999)(97736004)(92566002)(229853001)(11100500001)(107886002)(86362001)(5001920100001)(586003)(47776003)(5001960100002)(110136002)(189998001)(5003940100001)(33646002)(81156007)(80792005)(50226001)(77096005)(5007970100001)(4001430100002)(48376002)(6806005)(85326001)(36756003)(50466002)(104016004)(19580405001)(87936001)(5008740100001)(19580395003)(106466001); DIR:OUT; SFP:1102; SCL:1; SRVR:CY1PR0301MB0859; H:tx30smr01.am.freescale.net; FPR:; SPF:PermError; PTR:InfoDomainNonexistent; MX:1; A:1; LANG:en; MIME-Version: 1.0 X-Microsoft-Exchange-Diagnostics: 1; CY1PR0301MB0859; 2:Vi6iqON8kLSO+Hb39cAWp9WUZlP8oznubFp0UbixUlVVyeHgJsaFAXWij2dQdjh7ux+PyXQADIUQti3b0kbfzwBF1t3EdVaTmlx0uqbCQK3rnLsFE0jv6oN4aFdVaajM96Dz/WQjbdHc4nv3yH/vBQnScY+5uwpnUQSSbcdsPQ4=; 3:7iJwLgVpi0xzARa5ZFCWEsTUhHdxkdzGVgrNhVjOY9PhMaunRLXlGce3BonMcb5x/cutnj9VC+ggKNzO6taIpzDWiJFQm4nP9nr9nwEHg7dE/QtZSrwliIIf0dFpfcp2PsAX25OYnj/WWI9PjiFOCMtBBvPFEdaOx5u0Vsx5shcSR65s50WC3dMX1f5YrDZq5364tAyBm9643n0kx7/WNMPPwv+xHJOexUw0X1xAkyA=; 25:NYwUwaEBuYNlxOhJs97bqi6oZhWzGcQc26ucL0TR2tpK2Qt7CZrGkHFvKiebcbPu7ulkEuvpwr0jiBN4HeMCT5XqhU7IQXhUkPYZP3oCak55jgjEkeL27EUy6ESeeN+7GH5elv0/BUyOPo2gLk+fI6q73BHZH3oPiC5JaswMPt+fq1ql1sLLUWudCxgE7EqJOdJ9/ZlQKI+PuAAW1ts3CcF1CyYwb5ubeWlvyVO3Su4NzxmWFhc4xI7XLvh25iKU1l16ESaLH4zUsnAOUNBbGw== X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:CY1PR0301MB0859; X-Microsoft-Exchange-Diagnostics: 1; CY1PR0301MB0859; 20:b2QZjbWZMjMhdmjUVyr4QrFKISgI83P8oaePs+VKUkbZQ6gPlAnQVbvqse1Qf3h4tzDgAAlDDRnrrZF04sT+mcqeT6dgZXm2tCmjQtThQLlpNIOZGvXfol0COdGfMc5u9pV+slASdZjkck03PraQBsoiz/05f4I6dKjHD3pqw5tADYUI99a6WiLFuzpRZEMqv4QpMpNYFFhZ2IEKG/GevDgu//64qunu4kNSDZCjAEQQpa5GVHAEYkLYfx6Q4jGMJoD2vU304FBArrKNkAgGQG0c4+fuK3Q/ysJ5RIPEHx1ReIvyK1McfWH0RNNPVUbPUDsVLPcvhHDC/UA/P/1DnbWVZ+8M4ZHmafVZLb1hIxw=; 4:QeiQ3ms7lmcJ47h30bYGcI2n9gIxv7Yl2JdLaqjLYknUVhMiqsCIn1iQAcXV2qp03SbNCI1bZ/Ab0PNzquRWB0yEzDtb33Lvv0vhzijWWBGN7yumYJQ0v9R4EO8DqYIGAJCAho/Qczev4rQk5Ffy9UEXB4HuhCPsznleDB9cY3GuAsDmHAxUnqXEUzoWwDDSiNgkd9Pknom9c3E1hfy87Z+s8fw+2ZZ/ZNUKV9OtuT5zx0e7c1IpWuneYdPQ92g67sgRKlE/aujdDTQq0tHwcw1bTbp+XBhUTovsoj5Q2JIygrvoaDxwhefwrxo9buwhX7km94IdENYt7UOSirmpWMZKt+jAekHN2oeA74fXTpWZsR8n82P0+70GqQW07VrB X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(101931422205132); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(2401047)(5005006)(520078)(8121501046)(10201501046)(3002001); SRVR:CY1PR0301MB0859; BCL:0; PCL:0; RULEID:; SRVR:CY1PR0301MB0859; X-Forefront-PRVS: 0764C4A8CD X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; CY1PR0301MB0859; 23:BJrCfDd/AXemgKMjrFTmP4vZG8KS3IR+pMGGPTp?= =?us-ascii?Q?B444wX+wLlIfdAU6jfCP9Wp8EAvEFV21Y2L3nq1mLXxmbQPS80Br+/z1DLyB?= =?us-ascii?Q?o+caHeLw72YtDV5dRVyb/SVbm/hC/gOeUfWD8+/QirQMkV5O+zzc4wAPTmV4?= =?us-ascii?Q?s/e1sBtMYroZ0CUV4RavRLOzLU65LS8JozDPS6exTqpDZT0SzpgcdW1QOGpo?= =?us-ascii?Q?0/MHKJDbqo0rtZaE6QDmNMQsMJyj0oZHo5dR9LDxIdbmd1BJ8WivFn9/8mQj?= =?us-ascii?Q?YpRatQa1bL3z7pfUMOOqJkSsCUi71PIraJ6RH+6hch8XA4DIonERVk17U/Zm?= =?us-ascii?Q?BQ8LkXYUP/5WGWY5FSn68DpvRVLbYxbwgjUw/R9p5Op08qviogK4tG1KDqwL?= =?us-ascii?Q?Yu0UaourhuiiUtKs8RIHSrMLNfnZf4OjqbBmRd3pCYfOFYn89JmO9HVUvywz?= =?us-ascii?Q?LwissWu+ziFmtUuMxgHhjT2IQmjrMSLMc5tgFsg8TLUlV3NoIG6dIA86j5vr?= =?us-ascii?Q?CJrFiFMckMH7EmtM67ThcO2zvTPt6q08aqc7evIWrQ8KiD0T6e9AIzrOjiO9?= =?us-ascii?Q?WiV+8b9NThDXipLSFT1DBMMXfezm8dTq4upmEalAjJAJUghmNjwAWPRU8wW+?= =?us-ascii?Q?NWNEUBhlyKZIrAJnQ3YRPcANvOQpthhdPaG1EBC0JFPoSkxp7y5tCCND2kTE?= =?us-ascii?Q?R9buW1jz6Amxz56S52D5wvv+GExDs93lgGnGioaf/60Hyr+uxXsEsFYHYKww?= =?us-ascii?Q?4nU/T1rnauD0xcO1f9/c7yW6+/f4dPPSSx15/jm7NcAWmHosvRQA7o9fxH/F?= =?us-ascii?Q?HOo5NQHt5Or9QPGkPGJOAQfSvvhJ5j8BKh8kWwmH/oUGug2+AZXqvAT5SwWi?= =?us-ascii?Q?LvoC/qBHOYpKAiebDKz6mtq33sQwDVjuHoUvHXQvZEx0zGlHtCtUFHFTGcIj?= =?us-ascii?Q?f59jA0UptHF+RXX4mVRYNHniLCpyGJLzamsAdqn9dbMY+rnHaPKXbVPReRWP?= =?us-ascii?Q?bsiNIObdp390qv65QnJ6syKTl8lLdThJ3TI2IC8kQKY+QcNrNEQ/T8pbPJdc?= =?us-ascii?Q?4JX4lkj4=3D?= X-Microsoft-Exchange-Diagnostics: 1; CY1PR0301MB0859; 5:hvU74jfceHLIz+JYxWOL/79oy8AoljJP78rPQkF/DqeMsFskvGDErVCOacPSOnmGoHq64Vp6Bph4TZpDwn3MsvoROP9ru4gI3ZMVx6FAe5NwvlPMh8wGmBKv2NWbEXHKH4T3MRmQqD9kfLwfl39H0Q==; 24:aD4eEcdy8GvuzMP8u+dZ3VoeJJGderhpax2oWP2fbfo4/EPUS4Zi0nm62fbOKh1niWFqjcLqlpw7dtkvatv8ELU/AEiVmdR5knQnZsKkpLU=; 20:18GCAhA8FIShoMsTFCV5a/IZQBosaMFWh34hBBYuXH5leeQbbOtUaYS4uZ3sEL1J94w/XAVfk1uVacJXF/GhZQ== X-OriginatorOrg: freescale.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Nov 2015 00:19:30.7884 (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: CY1PR0301MB0859 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20151117_161953_739715_083A151E X-CRM114-Status: GOOD ( 17.35 ) 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: Gao Pan , Li Yang , linux-i2c@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org 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.8 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 Since commit 1c4b6c3bcf30 ("i2c: imx: implement bus recovery") the driver starts to use gpio/pinctrl to do i2c bus recovery. But pinctrl is not always available for platforms using this driver such as ls1021a and ls1043a, and the device tree binding also mentioned this gpio based recovery mechanism as optional. The patch make it really optional that the probe function won't bailout when pinctrl is not available and it won't try to register recovery functions if pinctrl is NULL when the PINCTRL is not enabled at all. Signed-off-by: Li Yang Cc: Gao Pan --- drivers/i2c/busses/i2c-imx.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/drivers/i2c/busses/i2c-imx.c b/drivers/i2c/busses/i2c-imx.c index 1e4d99d..7813153 100644 --- a/drivers/i2c/busses/i2c-imx.c +++ b/drivers/i2c/busses/i2c-imx.c @@ -1086,12 +1086,6 @@ static int i2c_imx_probe(struct platform_device *pdev) return ret; } - i2c_imx->pinctrl = devm_pinctrl_get(&pdev->dev); - if (IS_ERR(i2c_imx->pinctrl)) { - ret = PTR_ERR(i2c_imx->pinctrl); - goto clk_disable; - } - /* Request IRQ */ ret = devm_request_irq(&pdev->dev, irq, i2c_imx_isr, 0, pdev->name, i2c_imx); @@ -1125,7 +1119,12 @@ static int i2c_imx_probe(struct platform_device *pdev) goto clk_disable; } - i2c_imx_init_recovery_info(i2c_imx, pdev); + /* optional bus recovery feature through pinctrl */ + i2c_imx->pinctrl = devm_pinctrl_get(&pdev->dev); + if (IS_ERR_OR_NULL(i2c_imx->pinctrl)) + dev_info(&pdev->dev, "can't get pinctrl, bus recovery feature disabled\n"); + else + i2c_imx_init_recovery_info(i2c_imx, pdev); /* Set up platform driver data */ platform_set_drvdata(pdev, i2c_imx);