From patchwork Fri Oct 13 19:54:07 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Trent Piepho X-Patchwork-Id: 10005827 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 930AA60230 for ; Fri, 13 Oct 2017 19:55:13 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 85E242915D for ; Fri, 13 Oct 2017 19:55:13 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7A7DD29160; Fri, 13 Oct 2017 19:55:13 +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=BAD_ENC_HEADER,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 EA2DE2915D for ; Fri, 13 Oct 2017 19:55:12 +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:Message-Id:Date:Subject:To :From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=sDayQBqQxU1kp83T11eIO3bvP/208Plyu/GmvSHHbWs=; b=JTkngzOIvAlWFN 83A44QKm9Rk91LiNt98Y/nr9mfVgyhmm8bLvv9otfMmvs27YIJJY5s+mD/ocEDkfu6P6RIU+mkqq2 WQYUnT6P38tRckiQTqQsN3rMTjfnpq6LY5wIKBSQ+GP9iR7tqC0ZZnoNDCetsBZX27AWnmkEtcch+ OKZ7Od9fOpxLAqqgXaUA8tSaNGyON1dFnzL7+RWeV2vCbgCd9Kls9ouzQIwwB5hCa6U3+DwlSWknJ liVGOiouDv00SfoahQrdv4Z0ZX9P7A8p+NmKrTeaVeaIETBaE9wOSSAJSRpYu8ur+RDEIU8B63LXL N5Qx2dkC7Ct+GQ0wbLVA==; 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 1e3631-0003cS-3X; Fri, 13 Oct 2017 19:55:07 +0000 Received: from mail-by2nam03on0136.outbound.protection.outlook.com ([104.47.42.136] helo=NAM03-BY2-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1e362x-0003E7-5L for linux-arm-kernel@lists.infradead.org; Fri, 13 Oct 2017 19:55:05 +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=55gXQ97WTZMPG+O8/WoD/anUpRr3G5aDSNwx1ns7KcM=; b=Uv0lovTPZFFP4YSbUXSY4PPZM7t2U4TB5BF6NphI5/VbNhOl0yplSRsdyQdTFhCy/sTcx++yNLxt8LNVcgf3LX8teFKoCWc1CLIt+doRZey4wyQyE0mrBIxhZ/btgEyxSgTXXgVlGdTEPjFIXPGAIzB9oyax1MYJswDJFSUC8jI= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=tpiepho@impinj.com; Received: from impinj.com (216.243.31.162) by BN6PR06MB2803.namprd06.prod.outlook.com (10.175.127.21) 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 19:54:40 +0000 From: Trent Piepho To: linux-spi , linux-arm-kernel Subject: [PATCH 1/4] spi: imx: GPIO based chip selects should not be required Date: Fri, 13 Oct 2017 12:54:07 -0700 Message-Id: <20171013195410.30767-1-tpiepho@impinj.com> X-Mailer: git-send-email 2.13.6 MIME-Version: 1.0 X-Originating-IP: [216.243.31.162] X-ClientProxiedBy: MWHPR21CA0064.namprd21.prod.outlook.com (10.172.93.154) To BN6PR06MB2803.namprd06.prod.outlook.com (10.175.127.21) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: a6d87104-b4f5-4740-b987-08d512743e13 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(2017030254152)(2017052603199)(201703131423075)(201703031133081)(201702281549075); SRVR:BN6PR06MB2803; X-Microsoft-Exchange-Diagnostics: 1; BN6PR06MB2803; 3:T6YYZxirK4/6A488zztw3jUV5aILcvGdqQcJIg5Y/bimEwUwBdZUwtu4Nlyteqwbdijwq6n9AS13t2VvlvkThtyAbK8we+WilE3VeCAGy9eNXA5pjlfvN8Sr9VzM1f5Tmg9/TKEGBt4n/kkPMeIVo9mdEVqz3Nwli0BD5pmNaUji6JUWIFHrQcUu2r7GACPqfNK+hpbRV5TFA+ujV5sl1nneh6HWNSlUcsbqFy75PZnuUvYYWXQBqhJ1gM1VAMqR; 25:ULkhhcG0hIgDxYmmbPqWf/lloxF80fhC9+aKEHaPCNI3nCjYk49RVyzJ7uSvrspjjgBfw5dd51EUkqJcT5kLx0ICS7HZxhkkIldnBFdrZQ1e2MKmIHesMHLNJLRZZxcq69heT3X3UU4flc+82vuunBnTcztoeRGoWnc1PtmY8qp3cUD0L661l/K4Lzo1CIFe9W9106YlbmU8kOOWQ/8eoltO2+h5ZiKFtoTbXyuxdF8aL9zIfSu8TElwLB26XZsHspsBsPJjVXKITzjgdZX0kP+3b/kZcF2JCa4XdNvBqUPurNqIm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DI+WokkGcKeOdqNBgiZYPLnQ1zVGVKcSjWdZ7XSONApSJ/9Tbvgwa 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)(100000703101)(100105400095)(3002001)(93006095)(93001095)(10201501046)(6041248)(20161123560025)(20161123562025)(20161123564025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123555025)(20161123558100)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:BN6PR06MB2803; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:BN6PR06MB2803; X-Forefront-PRVS: 04599F3534 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(6009001)(346002)(39830400002)(376002)(199003)(189002)(47776003)(6666003)(107886003)(8656003)(4326008)(53936002)(21086003)(68736007)(66066001)(2906002)(5003940100001)(3846002)(1076002)(69596002)(33646002)(6116002)(8676002)(105586002)(55016002)(189998001)(106356001)(48376002)(478600001)(50466002)(110136005)(50986999)(97736004)(5660300001)(54906003)(50226002)(16586007)(81166006)(8936002)(316002)(305945005)(16526018)(86362001)(7736002)(25786009)(101416001)(36756003)(81156014); DIR:OUT; SFP:1102; SCL:1; SRVR:BN6PR06MB2803; H:impinj.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) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BN6PR06MB2803; 23:wEvrlZ3fNBgjk1DCeZgS7nYBFyw21JOxwk/srPdNX?= =?us-ascii?Q?Sl+VYREQAt2Q1egeEVrfL3hjMhjNubS+Mr/+YcD3VAjpxUjwJEfE8SoTXqJF?= =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D6B/P7lgSOPdFJjFSK9vFJTjd5Q/X3yjHmQbumTrEUP/u2uKk8Rmx/0F8OaRf+FPLCYIVeaA= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: impinj.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Oct 2017 19:54:40.2904 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 6de70f0f-7357-4529-a415-d8cbb7e93e5e X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR06MB2803 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20171013_125503_333813_5E13041A X-CRM114-Status: GOOD ( 13.50 ) 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 , Shawn Guo , Greg Ungerer , Sascha Hauer , Trent Piepho 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 --- 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; + } } }