From patchwork Thu Jan 10 21:41:13 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 155279 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp2390169jaa; Thu, 10 Jan 2019 13:43:23 -0800 (PST) X-Google-Smtp-Source: ALg8bN76j/nYeeJG7kP9bj3TbU0OBBpdZHuvCEnZwSPQcEE1fxBQWFPJbwTbRrLSLf+MfJSD4I2/ X-Received: by 2002:a17:902:e18d:: with SMTP id cd13mr12058618plb.262.1547156603768; Thu, 10 Jan 2019 13:43:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547156603; cv=none; d=google.com; s=arc-20160816; b=yICFlbLt2C/rtk+YqX/d1aueqsDfI5IaMGCRqvqA+Xu+KhNDogQjXyI0qMphLExUtd UGd4zZbx6w5+UTtcvNuVrMUuiFIF43e94IG5jv47ujVRoJQI7b1deeg83j7kZnNgVerF 9tusM969wu7IhMzg5R7+1IkhQMvxx/uSgMGaJOtykreG+YYilBamDzcGGWAjpTOjb2J6 pgp5/sGhrLa2a1thoxvs9QhiPrbFOQMwbALiYY6f/+cP71XCeFBavBOVRiaXgpOZumKM NuPBBbF5REvZ/fA+qPwb2J/o/kRyrip9CyFTb2zFIHIr/48j6IGZg/NvSvlMfeiCPLTW HYXw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=hnjGsYjnUVvZa5iF5lNXC8kCYQYXzN5f2G0J6QpX1GA=; b=O+t6iPzWrhil4bt2HULLfIxuyH/f52VRcpVuFr6h+4SfIwi2suQFtCWMerk4WK6wEm jzEsPJqxFv5AmtK/T1xZ6hgp7Rghbv7IF7Mp6qMPSCZlEKXAi84u818eoAXnfjUGoYVh XHotdhtwvTjTSvyIyiy2Al+tXirUTJY3Eci8jLpzYpPQjNUIBQZreTARblqElUNaGHdY kcHSNqfFB6PsW1SvXiSp3ve4Syfo9onc6KCU9NVeTXDEzwisWT8xxFSnb4ObaqTC8tQM PNQcl2KtdY4HCELH6v1NfPft6yj+oKc5d3pRqZYi78c51i9HQ03lhZMp50ABMoxdxlaK PNDw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Qru5C8Ta; spf=pass (google.com: best guess record for domain of linux-gpio-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-gpio-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c22si11599601pgb.254.2019.01.10.13.43.23; Thu, 10 Jan 2019 13:43:23 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-gpio-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Qru5C8Ta; spf=pass (google.com: best guess record for domain of linux-gpio-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-gpio-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728867AbfAJVnX (ORCPT + 5 others); Thu, 10 Jan 2019 16:43:23 -0500 Received: from mail-lj1-f196.google.com ([209.85.208.196]:33071 "EHLO mail-lj1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727861AbfAJVnX (ORCPT ); Thu, 10 Jan 2019 16:43:23 -0500 Received: by mail-lj1-f196.google.com with SMTP id v1-v6so11106726ljd.0 for ; Thu, 10 Jan 2019 13:43: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:mime-version :content-transfer-encoding; bh=hnjGsYjnUVvZa5iF5lNXC8kCYQYXzN5f2G0J6QpX1GA=; b=Qru5C8TafVUcTpsFMHnfiRn33kkcGYL5Co/vuUs18ZEhqPSq/SXDbG4qj9uxId1JKk bIamcvfDMX9qkJhCnC1fTy2fAWkoygbs7zPQxS6MFz2qS/oNao/lODPPUdjjhWJeOEGW GoFDAziYqEDEbUaKUSAHZebAkfDNxB2XVJs+Y= 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=hnjGsYjnUVvZa5iF5lNXC8kCYQYXzN5f2G0J6QpX1GA=; b=F6HEb+A5xnNLOjvgt06mcnN/yihUAzqGYin3eQW3exLHpVjBrLq27FDaMHBcmXtrOr fR29nb5qM8/NImqCn+fA12Eb7YcQLZBM42lowuPNQfrdphkD/HQZXYM0Y4uLJpesGXJa wN2HAQtwees/pxaJZwofJsKGY0g4033BbU0J1hd2Vt727674kppxjz4rU8uBySDqxtG1 UGZq8kNkU0b+Qe2ZFl86+IyQ4wHJfprUan3RzG5jdbZEDHtv7Gw/9CrSEBORWK6y9anu VYThylc7my8SIgqGXM8V1mJEH5PeFm/hS+DPwtGYQcsZh+h0pjTOK8SCuS16QCXyaogN yoTA== X-Gm-Message-State: AJcUukc+/bCFw2gcTc/o6NneU86dFkmuJ7KvPAwZwJnQLTJBfiLmyMgq FrL3IqVqUhWMV4PAG3atxIFUI0z26vZP0A== X-Received: by 2002:a2e:b04f:: with SMTP id d15-v6mr7597581ljl.3.1547156600824; Thu, 10 Jan 2019 13:43:20 -0800 (PST) Received: from localhost.localdomain (c-ae7b71d5.014-348-6c756e10.bbcust.telenor.se. [213.113.123.174]) by smtp.gmail.com with ESMTPSA id y10-v6sm582618ljy.65.2019.01.10.13.43.19 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 10 Jan 2019 13:43: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 , Wei Yongjun Subject: [PATCH] spi: cadence: Fix default polarity of native chipselect Date: Thu, 10 Jan 2019 22:41:13 +0100 Message-Id: <20190110214113.14855-1-linus.walleij@linaro.org> X-Mailer: git-send-email 2.19.2 MIME-Version: 1.0 Sender: linux-gpio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.org 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 --- drivers/spi/spi-cadence.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) -- 2.19.2 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 {