From patchwork Fri Oct 27 01:08:38 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Trent Piepho X-Patchwork-Id: 10028935 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 C6624602D6 for ; Fri, 27 Oct 2017 01:09:25 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B771728D4D for ; Fri, 27 Oct 2017 01:09:25 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id ABDD228E5D; Fri, 27 Oct 2017 01:09:25 +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=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CE9C428D4D for ; Fri, 27 Oct 2017 01:09:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932481AbdJ0BJY (ORCPT ); Thu, 26 Oct 2017 21:09:24 -0400 Received: from mail-dm3nam03on0113.outbound.protection.outlook.com ([104.47.41.113]:57668 "EHLO NAM03-DM3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S932364AbdJ0BJX (ORCPT ); Thu, 26 Oct 2017 21:09:23 -0400 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=RDlsoMFiVb3WnL+fDZbK6/oaHJm9sB8/P9qnYr24+Mg=; b=PAWSeJL9JEgFvom2ffL6ul0mGSj7scaw7LW8eCUxk3OQWXMcxsWMj/Uu/a4RjhiI4qFcaUvB/LU7aFEG983FfYY89XyTtl5wu431FA9LwyCovRZIpN5aKN4tGtG7JDGTySqpHCh1sRIAEl4c9Sm99LHSOsYOfQMaq94wh8nY1/c= Received: from impinj.com (216.243.31.162) by CY4PR06MB2805.namprd06.prod.outlook.com (10.175.117.149) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.178.6; Fri, 27 Oct 2017 01:09:21 +0000 From: Trent Piepho To: linux-arm-kernel@lists.infradead.org, linux-spi@vger.kernel.org Cc: Trent Piepho , Mark Brown , Shawn Guo , Sascha Hauer , Fabio Estevam Subject: [PATCH v2 1/4] spi: imx: GPIO based chip selects should not be required Date: Thu, 26 Oct 2017 18:08:38 -0700 Message-Id: <20171027010841.28624-2-tpiepho@impinj.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20171027010841.28624-1-tpiepho@impinj.com> References: <20171027010841.28624-1-tpiepho@impinj.com> MIME-Version: 1.0 X-Originating-IP: [216.243.31.162] X-ClientProxiedBy: MWHPR14CA0045.namprd14.prod.outlook.com (10.171.142.159) To CY4PR06MB2805.namprd06.prod.outlook.com (10.175.117.149) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 287a158d-a44b-447a-6732-08d51cd75b65 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(4534020)(4602075)(2017052603238); SRVR:CY4PR06MB2805; X-Microsoft-Exchange-Diagnostics: 1; CY4PR06MB2805; 3:zwCTYeZXsK6N7SGNJenHjLcwxSk6ZISHXzhMce4nJVV76eVtccM9BY3yOL8YS0Xop2VhgioeU+4ETqFXRsUCz44eJDWRyQkQ0ieMt/Peq/El0Q9QR2FI/osE5NMW9aF+bZodiW6QgobA5qRkirNiflHcfGrwYiFQNokKtZjXZvtr06L5wA4cYlulFqqT5+bjXnGJc9h/e7sunHycpoGyR12w0tre5LbD63iqb90veAUmLPPjZz+Xh5Xn7KRIQgvl; 25:A4X8fbubb1Ar2xWTluD3dCL1xIeVcng06shmr9yXFaSb7+BRFy7DOGO+rkCCaUyIvRH4MA/PZFsxlI02Gh/h3zOqmtkIa/dYZlSJaJdDn77FwEUEYxp5fNidbw37isT6EHFRYWeKY9uE3svfAOFVZrPr1je9x90lx4AbNNgbdCklbMl0yJOSlhWbw/Miqt41EqSZEp7wFmgH1OQ92hvh6jw/RGggNWJT4jjHm8ocl16cSyCbtzbZJswlJ/DzD2IqcE+4Ouz1T/YictbAYoVFDQO9nug+8S33g+guLz9pmEHfEMa4qhE+cveEWa6u7Gi4JIbjfq+9C9pTdDkPvwJPGg==; 31:wKaUG9WQLdVXg0rYT1xwDn4tixDeNfZ3oj40oHOaFY7liiU4/YrGAPY09VMKG1o+dQG7HcUAKQohF6nhD2eykv4b8CcwQ04xMbkweByeizCftb/19GL6W0Y3bxvNbcpngqcyk3Jv/l9KcEdCqMBaameF+Fnh4TuFg19XhwkTYna4wkyzAgigEW33ZTH56Dgul4XCRFQXDEOns1+qEDPrOQi4FXWWIPw5DMsNbnmYMDY= X-MS-TrafficTypeDiagnostic: CY4PR06MB2805: Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=tpiepho@impinj.com; X-Microsoft-Exchange-Diagnostics: 1; CY4PR06MB2805; 20:NoPahP3hQxDe5P7e9SKpK6AwUz+JiWgYcBj4T/CHiFkQfIz9fXBwdPkTHyyXee+VdCloXqozrSJq6Ge5aNfUA4B5tiGw9kMfs/Pqa/zQQA/+ToHTsbZFtInq/CfjVDjCDOdP6Uwnm3ZCxr0TMra3Ibzcx+azHvNOnP3rTuI0qXlN/1D9nv3cQ3MqfJR3JMaqxd//9mtQ2Dx4zmH5P3jC9aK271DnQfYJl0BIkFXOSSzNM8Jx+fHG+hYI8dZQiAVJSjKMu52GB5zaNAHdodTZJD1OCGV/HDp2Oj0U4GPTuehLYJ3s92KZYVdcbR1JnVKlurz+8jCqdOi4pVq6l1ts/HY21WH0NmIQCzQDzelf9oxoQj5V1KlWQtggqNrv2qNAFA6Au8WZiIa9TaZSV97n57N8BbLJud0x3LXhDtKju9M9KsgLSMyf/0T0tB/xW5UczjnmsC1qU+jyLjNpIO55Z+2OAlT2Fj6XZ2MtVkH4BcVxy/r0ihU9soFvY0zbxF3C; 4:5K5ImYFX1p+spOyesryPRochqdrqVfYIjXpO0uVXxc2n7YkqiN8pFpoDZxYeebQBOjzMCF2yieZgmZudx56wWxE9wy8uQNA35NFBUtad1E6DmkgfSq2PGWuxQBRTnDBqbF5/5Z71g2XEtXOeNVQ3IVxcBD1lB1Mp5rkRu4FJvugHvB9avK226uHqimqGLVffu6t9AN7UTRGolbp07TX9D0JNUqsb52PZt8sbTe2R/WgBV4yrjz1T4FfWh5Nh73oQG+cJVgeCqfCMhmorCHnkiTyB0Vlp6VObg2KxSX+CKvR/50PufO6k09pmrH+OQ2M6 X-Exchange-Antispam-Report-Test: UriScan:(185117386973197); X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(2401047)(5005006)(8121501046)(10201501046)(3231020)(93006095)(93001095)(3002001)(100000703101)(100105400095)(6041248)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123555025)(20161123560025)(20161123562025)(20161123564025)(20161123558100)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:CY4PR06MB2805; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:CY4PR06MB2805; X-Forefront-PRVS: 0473A03F3F X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(6009001)(346002)(376002)(39830400002)(189002)(199003)(25786009)(53936002)(3846002)(189998001)(21086003)(101416001)(50986999)(8936002)(6116002)(33646002)(1076002)(305945005)(7736002)(97736004)(2950100002)(8656006)(5660300001)(16586007)(16526018)(54906003)(4326008)(6666003)(69596002)(478600001)(68736007)(36756003)(5003940100001)(86362001)(316002)(81156014)(2906002)(50226002)(81166006)(106356001)(8676002)(105586002)(76176999)(55016002)(48376002)(50466002)(47776003)(66066001); DIR:OUT; SFP:1102; SCL:1; SRVR:CY4PR06MB2805; H:impinj.com; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A: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; CY4PR06MB2805; 23:BAQeM0Ul8vsVZpmGfzrPkFzB4Oc4FeZYgYo0l/URc?= =?us-ascii?Q?egB5O10EdRVmxgFRcxALG0MBh+QP/Ug0MCXpqHdLTH918q1CH1EAFHYNf42+?= =?us-ascii?Q?S66sSoZBXWzrH0VUKjpHtmZU3vLcaUbdZCm2Vah0/3P0AN3ZSE04LHWDYPG7?= =?us-ascii?Q?H+qzs+sviIqqq1Y0NmnISIohrjfWVImcE9E3TmWRd5zOUwztFe6yilt0sjL8?= =?us-ascii?Q?hiiQzY+5PFz2c+f7snM7zcvzBDED2i37o8J8yboLq4urPdntV1Wtvx3mG8Q4?= =?us-ascii?Q?o9xH7yjv2em6v7ttx8EpN4B/q4qs5tCoZggdMVztVlTypd+HjvCHQoBLfuHo?= =?us-ascii?Q?HIXcEYkoQJNoTnvj1B02TRKcdmkbmPTKeuCCXePINgPR3ZneXKNzLn+41LLc?= =?us-ascii?Q?ob24WrNOp1L077Aa6Wh/zY39M2OJS8No65cOlU1WNpU2dxgfD76Q+TG/PS+B?= =?us-ascii?Q?BKAW1ot29dkEOrZ1ULvHzA9O0dbA4wQSXOl34j8tGSBcxRSu2SpoaFYxS/vR?= =?us-ascii?Q?ASLlmYoRpOhWSI8TOLHA32TN66G5KbHJqPxUzRuVXCKwDMFMWzP57H8IaCB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mBM9z4s1wptgg52rLI2ct9LmXxjQ4GjhrA8=; 5:C+3hZgVZH7zYW3uXMBzhBgo3C2OsGGR4grD/e3A4YxpqXPhjNyY3UuOB/xFh1+3mossoAHujS7cmkm307qro1/LDDbhd6FnDk6ce2KQ+qb9cfQ18VWKcdYVwtnvxLrJd7LQyUOFrP8Z5HIFTZuF7FoFh55XqzNymSXpXgWq4DMM=; 24:GnmhqKTr70B9IWORN3G9vWrwxPqM06KivpbuRLOMb8ltmw1g49vyUs+0cBN+abB6RioUxfOKWmPPEzlwuK7/VK/3uCAIuM/JUKRNGbIJFGU=; 7:DaDV0cjIZ6jKudhmcooEIWbaJXhc73hb5oKH55PebnbZxz75vwX+Wrsw7x+1VFtQ43uCuKBOLNQ2Oh+Eb3KYCIFf4y/d4iPbaOzBwW30cdPd1MKQ/GNtM3QxDb+mKybC27ums4p70wB/m/xQhcPrznDxkylYKyN+yurj39/5iPrIDz9HYypIvpyiH65FJqyHSTP8hbHsT1cPqSHjN7glZWSlnuX5VRzOVPK4g0l+GWTYXcWDeMrIKOol0Ba62pZm SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: impinj.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Oct 2017 01:09:21.7211 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 287a158d-a44b-447a-6732-08d51cd75b65 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 6de70f0f-7357-4529-a415-d8cbb7e93e5e X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR06MB2805 Sender: linux-spi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-spi@vger.kernel.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. CC: Mark Brown CC: Shawn Guo CC: Sascha Hauer CC: Fabio Estevam Reviewed-by: Oleksij Rempel 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; + } } }