From patchwork Fri Nov 20 21:45:50 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: 7671611 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 EE4DFBF90C for ; Fri, 20 Nov 2015 22:04:45 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 235D9204D5 for ; Fri, 20 Nov 2015 22:04:45 +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 3B19B204AE for ; Fri, 20 Nov 2015 22:04:44 +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 1ZztlV-0003GI-Jk; Fri, 20 Nov 2015 22:02:45 +0000 Received: from mail-bn1on0144.outbound.protection.outlook.com ([157.56.110.144] helo=na01-bn1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZztlT-0003Bw-1s for linux-arm-kernel@lists.infradead.org; Fri, 20 Nov 2015 22:02:43 +0000 Received: from BY2PR03CA009.namprd03.prod.outlook.com (10.255.93.26) by CY1PR0301MB0732.namprd03.prod.outlook.com (10.160.159.150) with Microsoft SMTP Server (TLS) id 15.1.325.17; Fri, 20 Nov 2015 22:02:20 +0000 Received: from BN1AFFO11FD012.protection.gbl (10.255.93.4) by BY2PR03CA009.outlook.office365.com (10.255.93.26) with Microsoft SMTP Server (TLS) id 15.1.325.17 via Frontend Transport; Fri, 20 Nov 2015 22:02:20 +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 BN1AFFO11FD012.mail.protection.outlook.com (10.58.52.72) with Microsoft SMTP Server (TLS) id 15.1.331.11 via Frontend Transport; Fri, 20 Nov 2015 22:02:19 +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 tAKM2H8u011968; Fri, 20 Nov 2015 15:02:17 -0700 From: Li Yang To: Wolfram Sang Subject: [PATCH v2] i2c: imx: make bus recovery through pinctrl optional Date: Fri, 20 Nov 2015 15:45:50 -0600 Message-ID: <1448055950-21190-1-git-send-email-leoli@freescale.com> X-Mailer: git-send-email 2.3.3 X-EOPAttributedMessage: 0 X-Microsoft-Exchange-Diagnostics: 1; BN1AFFO11FD012; 1:mT30/W46GkPPLXm5Q8fzimfV1JyPRDoI5VMZy4x+O08RfpbIvt7L4uT/TqBBcnTpFzIbcWn+dpeIuLJ4VSQUyzrOwO88TEq/vTq4N3T2uT1L1wSETUZL0s5I+Nw5V1TLFOlpDiUKyNLl6gkpb9iuC+trtLldrbKvr0XN4z8pqVsdRilrc7gUQpsGMx5PcEBZ9NlFcLPxn9cTt3E2LLnEF5MnLsCrd5vfdaYSFzNe1y52H2vSRXmL2MkLtRryVKLzCJD/ECdlnxnnhNGvqH1KCoRStIo7ktb0+oAhNj9RbYU6f22kt7BJPgaQTBcdGQ6hz5vICDbAOpQJ2hoouFMGRG8yQ/0xnV+Tfe2VOudcessFzV5gYVq2ZAy1LgVYLa8qa/YQLShq4tFTXyFoSQRUUB0UMa5EE5MM0f0lN278lew= X-Forefront-Antispam-Report: CIP:192.88.168.50; CTRY:US; IPV:NLI; EFV:NLI; SFV:NSPM; SFS:(10019020)(6009001)(2980300002)(448002)(189002)(199003)(50986999)(229853001)(106466001)(50226001)(107886002)(5007970100001)(11100500001)(110136002)(33646002)(5001960100002)(77096005)(586003)(48376002)(189998001)(50466002)(19580395003)(86362001)(19580405001)(92566002)(80792005)(97736004)(36756003)(5008740100001)(5003940100001)(6806005)(47776003)(575784001)(81156007)(104016004)(4001430100002)(85326001)(87936001); DIR:OUT; SFP:1102; SCL:1; SRVR:CY1PR0301MB0732; 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; CY1PR0301MB0732; 2:A9goFbY27vodk1P977jyfLt1UPlKuuJ/OO/vLgTriR2l3JnErJQXiyETvZ174kErtxtesKBIcE/BQZleHF8tO09Cr+j604hBCpIYkQ27UgFIQPAmDpTH2NAdiJCuZkPD/wlXI7En7s1xEe4e/wm9WNBPuXL0cit9mzfQR7M+I6g=; 3:pp4sNhHgg1LUUPqOeUUYzCWbq36mDYidfSEsK+LNpiI3hpGC6GSiQ4ptU3YjLbryFz4WBg0hZxrPkTs4feum8PgtBWv+V85s/AZsASZNrxLFlBpX1j6g9azLPmtbjX0yjxd9b0HK6Ohohqw3l8pX5XPdtbjUjCarrWgSFpLE5k8/qG+y97StD5cEXmcFu8AKadUm5tj6rkj+eTosozwu/QYKuQ9o/1eKc4q+eOYC+24=; 25:XwxctHY3aiB8iSI2PPTmaEEd93OD1mZqQz02AlmOgvLMQku456zovJqBJkX7paAap+TLzqJPSa19xxtwiO7KbIMydfvzmk10du0Z6uMMQf07a+xpavsC+3XaZV6W3K1DJ7qPeHZfOfY3tlf0o3ujcuMA7+iY2S4ya4lx4qQtOEsTBK77d8VqbocFaLimKtgVyClEV2ttZqcX9XLYh2uH2AFu9UQv6k885iDUuxPR6C859j08rMGn19mU07pRTXri1YkbkIk4nUhQ6loZR+rA8g== X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:CY1PR0301MB0732; X-Microsoft-Exchange-Diagnostics: 1; CY1PR0301MB0732; 20:qfgJiQhIP2iPTdPJ8kKgeusnQ7wBc/qtGDAHCA4z4/xMHMge6CGl8CvHlaMtS+15dJNFtGWtTgQy5CjTjumTx+B1fufagND4/60MgDdWDv0cPjXSOHE+IeWdsTidOI60lSafnxmaikjzPKbtLAqiYor70Y1xSf7p0Re3AMn1tjEDKq0FjoihSRwhrexr79sSaugmV7sVfyjbPVWN3I6JQgeT4AmQ6Og+EaWWGfilaV/rFgkY1PliJsaDb+d0vijajf8WZ+rLQuI3Qgfft2w2V/iOBetwmV4XobqAsC2YCtxYhVFfYPrY2WCBjmkFpP/9BgmQM+7qQnt5upLSrLIHe+oFE/LS/P3Et/yrs6Me/8o=; 4:naxzVxbMgftKV5lyaB9hNgIUbVs6E3rOrR8pqoZLHM6T21gV1HEAj2IFE6Th+zwgfdFt0eD0SkrwdjjCJtg6S0WkqKbGfpSw+Gy37i9PF9iVZgSO1afmsndiBNB3C7evyz3eS3EwJmz65wCJGOXbq3t/HFGMW4hlmTKHoGgiuh+rqw9pv+FgwiR+c/LRYm1sFrPQ3Sx+G5St6YRBw1CtFkvn5W0tZaA+kzgTcqtf7o/osSIy+V6teRLSGCxPOMNFTBaAYeuovu41qRgRdlHDBheLyI0b+7gsV2YeVHah7mgJO2Yz/l0mZXJ7FbQHbVmzwSDGH9lztQo8cdpa5/uDoiXQJHYxAZSO4o+eP1kDqDJcsMRC6BIUmwysAoo4Ukk/3amq52RRXtYyWhXTD2sDqw== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(101931422205132); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(2401047)(8121501046)(5005006)(520078)(10201501046)(3002001); SRVR:CY1PR0301MB0732; BCL:0; PCL:0; RULEID:; SRVR:CY1PR0301MB0732; X-Forefront-PRVS: 07665BE9D1 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; CY1PR0301MB0732; 23:JybZTVDhrze+uqHa0SINd1hGcHFswOthCOvdcHa?= =?us-ascii?Q?Di3O3h7yrfYd3Qumu8f37aLKz0n1chJZD+SJ7GOPkI21/PEn/skdlDLRnjb3?= =?us-ascii?Q?ujGSWNUm6eF1aTHTJgSgcsJhO6bs5PUHUFOpLkFZKxlpwXS88EkDu2A5c9NF?= =?us-ascii?Q?NyR7GKOPsr/vbQFhdFsriqqdTu15Qh5jpJql42uPFJOoZJ52X7g7IcR1MXon?= =?us-ascii?Q?NffQqGhsD+S/LO9iJeTStAx/di/+i4VJHuba6nvtWLcy0nTpElkHcMdilClH?= =?us-ascii?Q?DJI5mREMoVevz08/+TpV9P2Veb2XHQOC4rUWYg+mDUIBP6EMy0njs0l7SQ/5?= =?us-ascii?Q?Ch7IXJMRdYt4/COjp39kQckTvAosj5yNuhmuLwtbui8Zbt6Dh+CFF7VLkOFX?= =?us-ascii?Q?kuFQSnoBd5fZy8O/qg3Z7pDSp8SBpu5I3x1FLDqq8KJJSQB/k9b46kp1oe8p?= =?us-ascii?Q?LZZTYW90sWxjhGyUPbpwacF3C/4kqYn516HfU9YIFx/+T5ihGiGvEMFUIB/d?= =?us-ascii?Q?NYnJPXXqDia8jaM/zeKduxCzLppIXHf1/SAYN+JqJXjB+w0DshhgsQs6JHoE?= =?us-ascii?Q?16rRUOHUpF8ioJnClT4qORCRSrpKZISGUzXW72jmmmtNQizb9Ep95gMC0Otn?= =?us-ascii?Q?ohEGwFhPC31pMpC3nIV+aoXofo4UklcVDuqiAjJrU+PaRUzTwk8YOs9+sMNd?= =?us-ascii?Q?PjreITFhNGAg4ImGOAaI581liYNn3UeVyk11kYAzolgR+zItpgdd8BBEbKVH?= =?us-ascii?Q?FgdGDHabsdcS1726VieTc3mG4wSJfEh4gSmVm7XupGcjI4uYaqIXB/mBdEef?= =?us-ascii?Q?xu8qzSHPBu9Km0hx7gLwCcNjBxp5hlrSkY4BOhOmyrOoAZVnQhK3dmstlhEg?= =?us-ascii?Q?9scx7vvcR0ORMnq6geCTXAfj7nus6YwzIzkMr8pRUGOjnqrD3mpUVikKNJIc?= =?us-ascii?Q?WA8qomNCAS8Aa2Bgr/RZEd0xnRqYnGThG5Bc0R93eAy6ds+gdBK/8CVH7k70?= =?us-ascii?Q?2HCVD7CZfQzfigoa1Q5CZ1uVO?= X-Microsoft-Exchange-Diagnostics: 1; CY1PR0301MB0732; 5:fNFrx/mWeBoSumIDK0RNXIi05W1rb9mqpJekCDKP+MVIGlO8i2o8JJ5k54SfnuePnjDt1vhYw3IQHkzQUrDulanVNVpUll0rOfF2M37tpHYhQTia7/unVQq3MiQm2I8J8FXcRd+2KugQdoUV0aoB8A==; 24:uYl/0q74JJzkcc+3bITygSFXyQxM2Zr/9iidFhSNsf2xu48PNxoFMZfp0zrHoQvzy52BaF1j1K1XG/F1XRm5t8pVYjwqiGciYjdFW6cYqK0=; 20:YS/TAOYHdnoZwBOh3SSLrn0C62d4F1RATnMBeqcPQqFMCuBWz+TDnCA5Ezsiz7lnppP9dUHCC419zTJw3R5SaA== X-OriginatorOrg: freescale.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Nov 2015 22:02:19.5543 (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: CY1PR0301MB0732 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20151120_140243_313963_C59355E6 X-CRM114-Status: GOOD ( 17.09 ) 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: Linus Walleij , linux-kernel@vger.kernel.org, Gao Pan , linux-gpio@vger.kernel.org, linux-i2c@vger.kernel.org, =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= , Li Yang , linux-arm-kernel@lists.infradead.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 --- v2: bailout on -ENOMEM and -EPROBE_DEFER drivers/i2c/busses/i2c-imx.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/drivers/i2c/busses/i2c-imx.c b/drivers/i2c/busses/i2c-imx.c index 9bb0b05..41289f8 100644 --- a/drivers/i2c/busses/i2c-imx.c +++ b/drivers/i2c/busses/i2c-imx.c @@ -1087,8 +1087,11 @@ static int i2c_imx_probe(struct platform_device *pdev) return ret; } + /* optional bus recovery feature through pinctrl */ i2c_imx->pinctrl = devm_pinctrl_get(&pdev->dev); - if (IS_ERR(i2c_imx->pinctrl)) { + /* bailout on -ENOMEM or -EPROBE_DEFER, continue for other errors */ + if (PTR_ERR(i2c_imx->pinctrl) == -ENOMEM || + PTR_ERR(i2c_imx->pinctrl) == -EPROBE_DEFER) { ret = PTR_ERR(i2c_imx->pinctrl); goto clk_disable; } @@ -1126,7 +1129,10 @@ static int i2c_imx_probe(struct platform_device *pdev) goto clk_disable; } - i2c_imx_init_recovery_info(i2c_imx, pdev); + 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);