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: 1023234 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=linux-gpio-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="Qru5C8Ta"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 43bKHc0ftcz9sCs for ; Fri, 11 Jan 2019 08:43:24 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728867AbfAJVnX (ORCPT ); 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-Google-Smtp-Source: ALg8bN7/HbDwz8RXpi5X1dU6emNaPcda9TrgMXYojq6XnZC4nGH7Cp01QwTvnR6TuPoOWsE77vNFwg== 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(-) 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 {