From patchwork Wed Jan 16 08:21:07 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 10765487 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C293E13B5 for ; Wed, 16 Jan 2019 08:21:20 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B28282CAE3 for ; Wed, 16 Jan 2019 08:21:20 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A69582D3AB; Wed, 16 Jan 2019 08:21:20 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI 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 76A9F2D3A2 for ; Wed, 16 Jan 2019 08:21:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729127AbfAPIVS (ORCPT ); Wed, 16 Jan 2019 03:21:18 -0500 Received: from mail-lf1-f68.google.com ([209.85.167.68]:41965 "EHLO mail-lf1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728726AbfAPIVS (ORCPT ); Wed, 16 Jan 2019 03:21:18 -0500 Received: by mail-lf1-f68.google.com with SMTP id c16so4172379lfj.8 for ; Wed, 16 Jan 2019 00:21:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=z27WWP/cKKdfJ/qLFUMIj0GJqLOsy7raZASVRvwLgfs=; b=jjwzezcWZEE8g8Q99D8U6tHCQjOMAkFpQQtBkBxEnUlirOIkQjKlFv+TkaHD83Qy+Q Ah23STm+kAjeMet8PZ7IdRuHqWr4QIv0VoSrWxvrB8mmXtxEu60GhD3y4y0wkhQaWv2a 1zFHm/5F/rJD92PSA0NsPgnBKeChgOmFNExe8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=z27WWP/cKKdfJ/qLFUMIj0GJqLOsy7raZASVRvwLgfs=; b=SNnbXu2fxFJHwGXRedN59F7mBXysHSagrs/54IGsu4/scAFsRTF1MfOJpvLtV4MwTl sSpBMleTHPxeZZsjcgGMFQlcqdLDNCSXbfU7/usDCSpAhN4/sc7Au1j7RFoMpaxudH3i hxGM9Zr/wk5dkrYajhU6XUADyM0SsRIUvNMG9WrcjIPhh98VYtglxMtAuqotEZQ9fW4y zSTBbsZ2zmDtbA0vV9OaK4vXqGJJ76IL9+AQmbR21155yTehZN6K7rykoZlI7+W+Wn6H orjm/Zb2+zAggv7OLZNv1Cwp271QWKdBM0mlnfdYbSqeVWC7BNXq5P/q8UnjF1+0T+UU /3bg== X-Gm-Message-State: AJcUukcjtKBPuqkTNzyvH5+r/V6yTgaHs0jYPHOpUtz3csqpTTQFEb1k 12B9Al99mb+xgQFuDFAG4+w7Tw== X-Google-Smtp-Source: ALg8bN5217BqrgrZVriZ79sphq38uZraFcfOu88crUktgYKjZARxqAGjifCLtyQSIqitW2dxmFstBg== X-Received: by 2002:a19:db82:: with SMTP id t2mr6181815lfi.130.1547626876662; Wed, 16 Jan 2019 00:21:16 -0800 (PST) Received: from genomnajs.ideon.se ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id z9sm1035095lfj.79.2019.01.16.00.21.14 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 16 Jan 2019 00:21:15 -0800 (PST) From: Linus Walleij To: Mark Brown , linux-spi@vger.kernel.org Cc: linux-gpio@vger.kernel.org, Bartosz Golaszewski , linuxarm@huawei.com, Linus Walleij , Jan Kotas Subject: [PATCH 1/4 v3] spi: Support high CS when using descriptors Date: Wed, 16 Jan 2019 09:21:07 +0100 Message-Id: <20190116082110.5604-1-linus.walleij@linaro.org> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 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 All controllers using GPIO descriptors can by definition support high CS connections, so just enforce this when registering an SPI controller. This fixes a regression where controllers were missing SPI_CS_HIGH, the drivers would fail like this: spi spi0.0: setup: unsupported mode bits 4 cdns-spi fd0b0000.spi: can't setup spi0.0, status -22 This is because as using descriptors moves the CS inversion logic over to gpiolib, all such controllers are registered with CS active high. Cc: Jan Kotas Reported-by: Jan Kotas Tested-by: Jan Kotas Fixes: f3186dd87669 ("spi: Optionally use GPIO descriptors for CS GPIOs") Signed-off-by: Linus Walleij --- ChangeLog v1->v3: - Collected Jan's Tested-by --- drivers/spi/spi.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c index 06b9139664a3..31696f2fc8d5 100644 --- a/drivers/spi/spi.c +++ b/drivers/spi/spi.c @@ -2336,6 +2336,11 @@ int spi_register_controller(struct spi_controller *ctlr) status = spi_get_gpio_descs(ctlr); if (status) return status; + /* + * A controller using GPIO descriptors always + * supports SPI_CS_HIGH if need be. + */ + ctlr->mode_bits |= SPI_CS_HIGH; } else { /* Legacy code path for GPIOs from DT */ status = of_spi_register_master(ctlr); From patchwork Wed Jan 16 08:21:08 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 10765489 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B984B186E for ; Wed, 16 Jan 2019 08:21:43 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A9C922D3B9 for ; Wed, 16 Jan 2019 08:21:43 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9D5412D3C8; Wed, 16 Jan 2019 08:21:43 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI 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 3CDE82D3B9 for ; Wed, 16 Jan 2019 08:21:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730345AbfAPIV1 (ORCPT ); Wed, 16 Jan 2019 03:21:27 -0500 Received: from mail-lj1-f193.google.com ([209.85.208.193]:38146 "EHLO mail-lj1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728658AbfAPIVX (ORCPT ); Wed, 16 Jan 2019 03:21:23 -0500 Received: by mail-lj1-f193.google.com with SMTP id c19-v6so4680611lja.5 for ; Wed, 16 Jan 2019 00:21:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=DN8sKjFf4O+UFXK/DJwxmaNJcVTsvwJ3Eq5nhk+Hpm4=; b=LG4OXX5skaOYsMsApsA++LC1dH0cw1iMiBxA2pPt4l2wnkxLBzR5tSzgeD4TXi3DRE sWSa3ynZwWKLuMPptMNyBH03j4MDBcgu/J+TjI5osPCw8EJ2JH5EL3y6JwWpHUeu+hjQ cr0lQjnxwNYD2MR05JYGpUR+eLjp5+wjXBnag= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=DN8sKjFf4O+UFXK/DJwxmaNJcVTsvwJ3Eq5nhk+Hpm4=; b=blVoxvGGNOpHOBmImlgtjpLMvP655q96oM938rGVPqiUp/EmeVRaES6lK+2szmDaao Lq63EJ+3Ma94BMxJ8Ndee2AuHdlee73UiBPYJjF073MGzt7LrbD5TXir8Ys/ojWU6EDt GMfSccucmDpxSCE21conT1Vr7Se+NrIFEsj4A0k3cgzzlNRk7cG0q2pEt7/bu+CbRH45 1osGoEsRzBuWV6XDLGhfTY4SL+VCaJYoboXzvAbJ3blzURW6zvph0rt8rz5bveuNtQv0 JqGAMIVtyHVxnMcF/mzJRw03JwUbplRcW62m7RGScKP7c9JwAp4JrjaIf1E0Wit6o9re lGhw== X-Gm-Message-State: AJcUukfUTbc3uC3Sw6S8DAW7GbsNZ+KXcgp2FUxSEP9KhtG8VrtVhy5j JoNEN3CBaaqwbbNnur0G62EZrA== X-Google-Smtp-Source: ALg8bN6bSA6NrVOy0DDNGQdgufHzLiA8WEEQmZyx990VbjnanFOIrJQWf+X3zLmuaMnMd5JIKYjlBg== X-Received: by 2002:a2e:2a06:: with SMTP id q6-v6mr5421922ljq.37.1547626880620; Wed, 16 Jan 2019 00:21:20 -0800 (PST) Received: from genomnajs.ideon.se ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id z9sm1035095lfj.79.2019.01.16.00.21.19 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 16 Jan 2019 00:21:19 -0800 (PST) From: Linus Walleij To: Mark Brown , linux-spi@vger.kernel.org Cc: linux-gpio@vger.kernel.org, Bartosz Golaszewski , linuxarm@huawei.com, Linus Walleij , Jan Kotas Subject: [PATCH 2/4 v3] spi: dw: Fix default polarity of native chipselect Date: Wed, 16 Jan 2019 09:21:08 +0100 Message-Id: <20190116082110.5604-2-linus.walleij@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190116082110.5604-1-linus.walleij@linaro.org> References: <20190116082110.5604-1-linus.walleij@linaro.org> MIME-Version: 1.0 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 DW controller also supports platforms specifying native chipselects. When I enforce the use of high CS for drivers opting in for using GPIO descriptors, I inadvertedly switched the driver to also use active high chip select for native chip selects. As it turns out, the DW hardware driving chip selects also thinks it is weird with active low chip selects so all we need to do is remove an inversion in the driver. Cc: Jan Kotas Reported-by: Jan Kotas Tested-by: Jan Kotas Fixes: 9400c41e77b8 ("spi: dw: Convert to use CS GPIO descriptors") Signed-off-by: Linus Walleij --- ChangeLog v1->v3: - Collected Jan's Tested-by ChangeLog v1->v2: - Missed to alter the actually native chip select line control code. I need to be more awake. Janek can you confirm if this in combination with the previous patch solves your problem? --- drivers/spi/spi-dw.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/spi/spi-dw.c b/drivers/spi/spi-dw.c index f54b498001a9..64164f1a83f4 100644 --- a/drivers/spi/spi-dw.c +++ b/drivers/spi/spi-dw.c @@ -137,11 +137,10 @@ void dw_spi_set_cs(struct spi_device *spi, bool enable) struct dw_spi *dws = spi_controller_get_devdata(spi->controller); struct chip_data *chip = spi_get_ctldata(spi); - /* Chip select logic is inverted from spi_set_cs() */ if (chip && chip->cs_control) - chip->cs_control(!enable); + chip->cs_control(enable); - if (!enable) + if (enable) dw_writel(dws, DW_SPI_SER, BIT(spi->chip_select)); else if (dws->cs_override) dw_writel(dws, DW_SPI_SER, 0); From patchwork Wed Jan 16 08:21:09 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 10765493 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 887AF186E for ; Wed, 16 Jan 2019 08:21:44 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7AA5D2D3B0 for ; Wed, 16 Jan 2019 08:21:44 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6E9172D3BA; Wed, 16 Jan 2019 08:21:44 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI 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 1C63D2D3B0 for ; Wed, 16 Jan 2019 08:21:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388579AbfAPIVZ (ORCPT ); Wed, 16 Jan 2019 03:21:25 -0500 Received: from mail-lf1-f67.google.com ([209.85.167.67]:41971 "EHLO mail-lf1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388578AbfAPIVZ (ORCPT ); Wed, 16 Jan 2019 03:21:25 -0500 Received: by mail-lf1-f67.google.com with SMTP id c16so4172591lfj.8 for ; Wed, 16 Jan 2019 00:21:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=UPa/YKHzg8QHfVtFHuz+IOXkWhk9XCGi6iwwT/+Ih94=; b=GUIaGw6+Vbc4PwSUs42d9NzRrpbccX+Ic5qi/fuieH8pdTHCaBtlzjCLiZ1w6kuLQR WKftHzbX7U1+tSVsp7ucXSyb+UMTUHIuC4AZPr20Wn2UFpnhoQZiF+CS1xyXFSQHHA2o DqBsbG/huYZquDI3iV/ZyYyGpc7hXz/zCuFEI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=UPa/YKHzg8QHfVtFHuz+IOXkWhk9XCGi6iwwT/+Ih94=; b=PhCifIH6yXSM5q6CBDxPeqziwN5nSHAXyQ6vl60TxL1FnQdbfP1TihjGI8Frfb2zIw tOvDpmxI07Foz1jinl0JjsyuWcEH2xoPOgZdo8FAvgqkJyuLOK7re/QlBCawuvmwOZ/c 90CQRL1f3wXTmqRMOPRDa5TJqdvj936iOMA3xNS8q80Zs/wxPfOeJ1fhmcxAmnKmSh1+ 61vnbUY3NrHOfDeDALbyNDqKxQnfwkozrMgeNkorRxSB18GXahFQXVd3L0fZf2T6aiJQ jj6gHuURdvh0QWlXdTSZLtA/alA4G1kxYoSj7DT3Vql+G/h5n5Mvt5mtlUNojOpZdajp Eh7Q== X-Gm-Message-State: AJcUukd8R920VgYMKlR2uVRLloOTspvmWZ4pwJPg+e8qR97/+JcoCmLK tuWgddrJUmFehh2q7B8ohkw82w== X-Google-Smtp-Source: ALg8bN6nexG4rpiYuH5P12Q4u4XAR3wGItstqNyie1DvcWfimZEBZPtKoEFAaCSW+YjyZRBeil7dBg== X-Received: by 2002:a19:4948:: with SMTP id l8mr6021684lfj.156.1547626882916; Wed, 16 Jan 2019 00:21:22 -0800 (PST) Received: from genomnajs.ideon.se ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id z9sm1035095lfj.79.2019.01.16.00.21.21 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 16 Jan 2019 00:21:21 -0800 (PST) From: Linus Walleij To: Mark Brown , linux-spi@vger.kernel.org Cc: linux-gpio@vger.kernel.org, Bartosz Golaszewski , linuxarm@huawei.com, Linus Walleij , Wei Yongjun Subject: [PATCH 3/4 v3] spi: cadence: Fix default polarity of native chipselect Date: Wed, 16 Jan 2019 09:21:09 +0100 Message-Id: <20190116082110.5604-3-linus.walleij@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190116082110.5604-1-linus.walleij@linaro.org> References: <20190116082110.5604-1-linus.walleij@linaro.org> MIME-Version: 1.0 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 Cadence controller also supports platforms specifying native chipselects. When I enforce the use of high CS for drivers opting in for using GPIO descriptors, I inadvertedly switched the driver to also use active high chip select for native chip selects. Fix this by inverting the logic in the callback for the native chip select. Rename the parameter from "is_high" (which is interpreted as being high when 0, which is confusing, I will not make any drug-related jokes here) to "enabled" which is more intuitive, especially now that it is true when CS is supposed to be enabled. Cc: Wei Yongjun Fixes: cfeefa79dc37 ("spi: cadence: Convert to use CS GPIO descriptors") Signed-off-by: Linus Walleij --- ChangeLog v1->v3: - Resending --- drivers/spi/spi-cadence.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/spi/spi-cadence.c b/drivers/spi/spi-cadence.c index e332d173dbf9..f635cf073601 100644 --- a/drivers/spi/spi-cadence.c +++ b/drivers/spi/spi-cadence.c @@ -172,16 +172,16 @@ static void cdns_spi_init_hw(struct cdns_spi *xspi) /** * cdns_spi_chipselect - Select or deselect the chip select line * @spi: Pointer to the spi_device structure - * @is_high: Select(0) or deselect (1) the chip select line + * @enable: Select (1) or deselect (0) the chip select line */ -static void cdns_spi_chipselect(struct spi_device *spi, bool is_high) +static void cdns_spi_chipselect(struct spi_device *spi, bool enable) { struct cdns_spi *xspi = spi_master_get_devdata(spi->master); u32 ctrl_reg; ctrl_reg = cdns_spi_read(xspi, CDNS_SPI_CR); - if (is_high) { + if (!enable) { /* Deselect the slave */ ctrl_reg |= CDNS_SPI_CR_SSCTRL; } else { From patchwork Wed Jan 16 08:21:10 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 10765491 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id F168C1580 for ; Wed, 16 Jan 2019 08:21:43 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E06492D3B9 for ; Wed, 16 Jan 2019 08:21:43 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D47B12D3BC; Wed, 16 Jan 2019 08:21:43 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI 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 5D1B12D3BA for ; Wed, 16 Jan 2019 08:21:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388587AbfAPIV1 (ORCPT ); Wed, 16 Jan 2019 03:21:27 -0500 Received: from mail-lf1-f68.google.com ([209.85.167.68]:32956 "EHLO mail-lf1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730345AbfAPIV0 (ORCPT ); Wed, 16 Jan 2019 03:21:26 -0500 Received: by mail-lf1-f68.google.com with SMTP id i26so4212493lfc.0 for ; Wed, 16 Jan 2019 00:21:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=6k8cr/CmrKNAb1C1hzUSi8bPXmLFBSBSAM8T1laVsvk=; b=hTmI0RIBL1+bi7xFbqd2a/maAZmsceWp5kp15PRy2KaJZQA9I2H2duIf1GN75Bik/G 7QniA6L/OURrwPC22RydGW7Q2t47JpORx24wwUE2JAaux3rxMGzKoVW49UH1QKmJY7ZR j5wwXvAQm90DmkxDM/FBeKWbWyoON3mZN/WLk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=6k8cr/CmrKNAb1C1hzUSi8bPXmLFBSBSAM8T1laVsvk=; b=WPWGnH5bzqh+T8wrPU8onkO2pv4QIaTFFwcS0K6EfGF5GUpwMuGJndyuRDWqwcm1XO tRyZkYOuUgAsr2n28V4d5NPjFOVeK9g7oPbqK3LWgSJ0V7BsS6xRP7XO78v9H3uYAYR1 euZTAEdj4oUxd3EiEnkgN+38Cbh/ZM1NqvkeYF+xvMMQL3L1GugHGbY49xVxgOPXMbUx dX5he9CANShFCGmGxF+TpwLY8gl6JlycSTt2EpCKRnduCRKF2ao6l0L7o+4BUZhp9l5l YVIFrTejA1QeNMctyxLJmfU0h4GcxPzmCKTidAGohJkyzcy6SPcpdHK4OJ6A4IzmOwKd 4TWA== X-Gm-Message-State: AJcUukeixdHhHIfCeb+X8ZfCdYBdx5rgnsw4ZK8sRNOZW4ImUHYkTOpG 8V5wPosKymD6UvwmtC+iRSgv7g== X-Google-Smtp-Source: ALg8bN4/zdwPNnT4jEeSLazSOYVYFWusA0RrEG3KQGBqgz4gFh5ViVMJSt03qAh6L9vDpNPyanOGCg== X-Received: by 2002:a19:ef15:: with SMTP id n21mr6133854lfh.21.1547626885096; Wed, 16 Jan 2019 00:21:25 -0800 (PST) Received: from genomnajs.ideon.se ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id z9sm1035095lfj.79.2019.01.16.00.21.23 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 16 Jan 2019 00:21:24 -0800 (PST) From: Linus Walleij To: Mark Brown , linux-spi@vger.kernel.org Cc: linux-gpio@vger.kernel.org, Bartosz Golaszewski , linuxarm@huawei.com, Linus Walleij , Jan Kotas Subject: [PATCH 4/4 v3] gpio: of: Fix logic inversion Date: Wed, 16 Jan 2019 09:21:10 +0100 Message-Id: <20190116082110.5604-4-linus.walleij@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190116082110.5604-1-linus.walleij@linaro.org> References: <20190116082110.5604-1-linus.walleij@linaro.org> MIME-Version: 1.0 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 SPI chip selects were not properly inspected due to a logic inversion. This made SPI GPIOs not work. Cc: Jan Kotas Reported-by: Jan Kotas Tested-by: Jan Kotas Fixes: f3186dd87669 ("spi: Optionally use GPIO descriptors for CS GPIOs") Signed-off-by: Linus Walleij --- ChangeLog v1->v3: - New patch - Collected Jan's Tested-by This was rootcaused by Jan, Mark please apply this to the SPI tree with the rest of the fixes! --- drivers/gpio/gpiolib-of.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpio/gpiolib-of.c b/drivers/gpio/gpiolib-of.c index a6e1891217e2..c34eb9d9c59a 100644 --- a/drivers/gpio/gpiolib-of.c +++ b/drivers/gpio/gpiolib-of.c @@ -125,7 +125,7 @@ static void of_gpio_flags_quirks(struct device_node *np, for_each_child_of_node(np, child) { ret = of_property_read_u32(child, "reg", &cs); - if (!ret) + if (ret) continue; if (cs == index) { /*