From patchwork Fri Oct 13 18:22:01 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Trent Piepho X-Patchwork-Id: 10005633 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 0A11860230 for ; Fri, 13 Oct 2017 18:22:53 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 03F832912E for ; Fri, 13 Oct 2017 18:22:53 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id ECBA429130; Fri, 13 Oct 2017 18:22:52 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 9847B2912E for ; Fri, 13 Oct 2017 18:22:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Content-ID:Message-ID:Date :Subject:To:From:Reply-To:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=ssUoXGcSMT1VmFddqm+ni1WE9+ofiUYZ6AgLqVsJcMs=; b=sggUkgY6OjPSZy GGU10GBhF3ZXXczQRS9t7iM62xAs8jLcQdT0NMlqpov3pfAzBiicEp9kJQWpfhJKNh5Cdpwx1VDHf FI0HCvnYh6INiiLytw3NK2GIxOSceEZn3Cbc/Rb/qioBUs4s1N4J3f7m9T53Xw+CAmrBouWaSnOyO Bu6Sqfdcbwil3dwvGpEnyDR1QmnmRAEsBwfRWOJjCwDcNpUDdL05ErNu5ruA7O4FF54pjB2/tXsOY WmB7XsXdF6vRz1u3GDs4NKLijFEr07IZornrPxwlU8HZJ+0D1EWvTX241/rtkbaudDasTepHs4lBS 2uo7ulr1E/xWILa8YzUw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1e34bO-0004Nq-0Z; Fri, 13 Oct 2017 18:22:30 +0000 Received: from mail-sn1nam02on0138.outbound.protection.outlook.com ([104.47.36.138] helo=NAM02-SN1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1e34bH-0004CX-Rh for linux-arm-kernel@lists.infradead.org; Fri, 13 Oct 2017 18:22:27 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=impinj.onmicrosoft.com; s=selector1-impinj-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=QulqOfwyJSLNka8cv+Gn7lf7R5W1T9p1qdUFLQb2gkY=; b=RbVsWE7snqKKpq+NIn9mpK7AeP63pP0njZ53tPcx6IGMs3JbJiM2qerB5bArLlAwcoIUqTzUrlX79I6TTW0dtrZJXAWVbTPHXm3uEubRa6zlOvNedbCWJc3mfaz/x1MFldyimaNV37HMiGsZnDzkTiggtvazCnCSb37Cr05+quM= Received: from DM5PR06MB2812.namprd06.prod.outlook.com (10.175.107.150) by DM5PR06MB2809.namprd06.prod.outlook.com (10.175.107.147) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.77.7; Fri, 13 Oct 2017 18:22:01 +0000 Received: from DM5PR06MB2812.namprd06.prod.outlook.com ([10.175.107.150]) by DM5PR06MB2812.namprd06.prod.outlook.com ([10.175.107.150]) with mapi id 15.20.0077.021; Fri, 13 Oct 2017 18:22:01 +0000 From: Trent Piepho To: "linux-spi@vger.kernel.org" , "linux-arm-kernel@lists.infradead.org" Subject: [PATCH 1/4] spi: imx: GPIO based chip selects should not be required Thread-Topic: [PATCH 1/4] spi: imx: GPIO based chip selects should not be required Thread-Index: AQHTRFApqZZe5nt8okqp8oHpDtgZyA== Date: Fri, 13 Oct 2017 18:22:01 +0000 Message-ID: <1507918921.24265.8.camel@impinj.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=tpiepho@impinj.com; x-originating-ip: [216.243.31.162] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; DM5PR06MB2809; 6:ddpqxaBEWMU4PzDlzmklXMQ8AkwM4RyzIGrii269k7YbVq7qrR0DZujCJP/qfBC0qmSTvfFJXO6BS6BrENf4HgAiajhHXe36nFTtCWX2eCeNmXkIF+7X6V5c61+Cw2T+u/ANXvogP6EcvUhW0TZQ6tO0FkdwelQzBbyDoXZJOZjhmCzKlhH0GZQ37YwF6VeZw4HE5TQ4qv8WyUPUEANJYZLTT5nmlDYBRmbNxmBcFgNrMOIKpi1hnPN52ER91alWUO1eAkmf8VrROdwiIUHW2c0natWmzDIMspOSKfUevXI6UsadhaUW1ZXVNWc40NCWENbI+jD8lbLw/I0WoPSWGA==; 5:1Y1GDGuWBcfR/ZqjbK7jtB3G50kIhdi4gIAXXSWXmPT/piNdDkn5eIEUN4nZD1jKtz1wT7sEa22WUkz6QJouk4tvOet4enIsz/UNQShcHRFavhPhJyTXSEbPvu+G6zLXaLk5xFp1WA0at6o3Op8STg==; 24:4HLV8eA3GWLKntNhb6tioEl81cBEVY1ghNIcFKOIDUMwAOn/f2dw2zII/2R2bSGwFdOzccVQ2Y6RiZXKptKiMP66HR8//sFkVEiZ8dVBUog=; 7:KuQ8PvsZLZiyt7yDERtXNuZulUFpJdb9N6LFm+tBSe00CfSWnmISb8AgdqZpQ7GayeFzLVN0Ya9N9F3XKTmcIpxBNKMQZ22Jk1g7ZSSIgYDAVSYiBm8DYT30mPaLemlvtQfAXUuv+Gjf26ZJFtZ2ZquiizLXa93kXmyQa5heUJjYYDjYbK9cZt0ENzuI5+K3awUyyrQyEKe2EhrViQ27QgLNtL4bbB3/3VkhutduM94= x-ms-exchange-antispam-srfa-diagnostics: SSOS; x-ms-office365-filtering-correlation-id: 97c38ab7-37f7-4b80-cfa4-08d512674c8e x-microsoft-antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(2017030254152)(2017052603199)(201703131423075)(201703031133081)(201702281549075); SRVR:DM5PR06MB2809; x-ms-traffictypediagnostic: DM5PR06MB2809: x-exchange-antispam-report-test: UriScan:; x-microsoft-antispam-prvs: x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(2401047)(8121501046)(5005006)(10201501046)(3002001)(100000703101)(100105400095)(93006095)(93001095)(6041248)(20161123555025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123564025)(20161123560025)(20161123558100)(20161123562025)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:DM5PR06MB2809; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:DM5PR06MB2809; x-forefront-prvs: 04599F3534 x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(979002)(6009001)(346002)(376002)(199003)(189002)(3660700001)(81166006)(2900100001)(189998001)(316002)(81156014)(25786009)(36756003)(106356001)(8656003)(8676002)(305945005)(97736004)(86362001)(99286003)(101416001)(7736002)(103116003)(5660300001)(8936002)(105586002)(110136005)(4326008)(54906003)(33646002)(14454004)(50986999)(68736007)(478600001)(2501003)(77096006)(6486002)(6506006)(6436002)(54356999)(3280700002)(53936002)(6116002)(6512007)(66066001)(3846002)(102836003)(2906002)(969003)(989001)(999001)(1009001)(1019001); DIR:OUT; SFP:1102; SCL:1; SRVR:DM5PR06MB2809; H:DM5PR06MB2812.namprd06.prod.outlook.com; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX:1; LANG:en; received-spf: None (protection.outlook.com: impinj.com does not designate permitted sender hosts) spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-ID: MIME-Version: 1.0 X-OriginatorOrg: impinj.com X-MS-Exchange-CrossTenant-originalarrivaltime: 13 Oct 2017 18:22:01.7214 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 6de70f0f-7357-4529-a415-d8cbb7e93e5e X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR06MB2809 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20171013_112224_128599_2BD24BD7 X-CRM114-Status: GOOD ( 13.71 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "fabio.estevam@nxp.com" , "shawnguo@kernel.org" , "gerg@linux-m68k.org" , "kernel@pengutronix.de" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP The driver will fail to load if no gpio chip selects are specified, this patch changes this so that it no longer fails. It's possible to use all native chip selects, in which case there is no reason to have a gpio chip select array. This is what happens if the *optional* device tree property "cs-gpios" is omitted. The spi core already checks for the absence of gpio chip selects in the master and assigns any slaves the gpio_cs value of -ENOENT. Signed-off-by: Trent Piepho Reviewed-by: Oleksij Rempel --- drivers/spi/spi-imx.c | 29 +++++++++++++---------------- 1 file changed, 13 insertions(+), 16 deletions(-) diff --git a/drivers/spi/spi-imx.c b/drivers/spi/spi-imx.c index babb15f07995..07e6250f2dad 100644 --- a/drivers/spi/spi-imx.c +++ b/drivers/spi/spi-imx.c @@ -1457,22 +1457,19 @@ static int spi_imx_probe(struct platform_device *pdev) goto out_clk_put; } - if (!master->cs_gpios) { - dev_err(&pdev->dev, "No CS GPIOs available\n"); - ret = -EINVAL; - goto out_clk_put; - } - - for (i = 0; i < master->num_chipselect; i++) { - if (!gpio_is_valid(master->cs_gpios[i])) - continue; - - ret = devm_gpio_request(&pdev->dev, master->cs_gpios[i], - DRIVER_NAME); - if (ret) { - dev_err(&pdev->dev, "Can't get CS GPIO %i\n", - master->cs_gpios[i]); - goto out_clk_put; + /* Request GPIO CS lines, if any */ + if (master->cs_gpios) { + for (i = 0; i < master->num_chipselect; i++) { + if (!gpio_is_valid(master->cs_gpios[i])) + continue; + + ret = devm_gpio_request(&pdev->dev, master->cs_gpios[i], + DRIVER_NAME); + if (ret) { + dev_err(&pdev->dev, "Can't get CS GPIO %i\n", + master->cs_gpios[i]); + goto out_clk_put; + } } }