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: 10756985 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 C76F914E5 for ; Thu, 10 Jan 2019 21:43:24 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B3BF429DDF for ; Thu, 10 Jan 2019 21:43:24 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A4D3629DE2; Thu, 10 Jan 2019 21:43:24 +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 4EAA729DDF for ; Thu, 10 Jan 2019 21:43:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727861AbfAJVnY (ORCPT ); Thu, 10 Jan 2019 16:43:24 -0500 Received: from mail-lj1-f193.google.com ([209.85.208.193]:35630 "EHLO mail-lj1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728744AbfAJVnX (ORCPT ); Thu, 10 Jan 2019 16:43:23 -0500 Received: by mail-lj1-f193.google.com with SMTP id x85-v6so11104060ljb.2 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=BcWgbKG6tyuE3Uuhm6qq308KqYoYeZDNReLHkt1U27SvDakO8r3y7EagqjEK12iSk4 1XrZFNJsIfnSDKCPPMvS3qoukTrhrJ5l07h2KSj8bITqbSiI1EMtmqyJVq7emyFWhsdl 7oBb0yNj2JXrdbUnze479abWcPZQOr/vK6NMcFXO5VEVTRhOZ1U/g7qiw5SyvPwJ/L7H 8v50muND0YQzzNHljijRgVoGLA7orv/zNJwK/dMULmpxHVM4j7Z7w2HPEK9pHREqreR5 9A4S7w1OCjyvbXSCuJQHJ3eCgEWcupz6pz2KK49QRnGoHTqsjHJZ0ACATYlnE1eER9+C NOUg== X-Gm-Message-State: AJcUukexBX75belChoEAbYBtqYa0rUFg4iWLFEibJg2Pe7ZZZ+P8yzUG RkcewLLoaHcFdqksQvbSBIUKxQ== 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-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 --- 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 {