From patchwork Thu Jan 10 21:24:51 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 155278 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp2376782jaa; Thu, 10 Jan 2019 13:26:57 -0800 (PST) X-Google-Smtp-Source: ALg8bN644Ltwa+U7O80CYMzZsnN8YSVn9wVVjBCh7Uc40RvewuMiIafDnQi5gCsFhxOMQApwAGnK X-Received: by 2002:a63:fb15:: with SMTP id o21mr10850583pgh.211.1547155617645; Thu, 10 Jan 2019 13:26:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547155617; cv=none; d=google.com; s=arc-20160816; b=jXXVGctqoqcndMFi8MLxK+dCxKEqv5pXhtpIKKAUwyAQL6R6VUbPkZ8NpEYRV/OZCY 0b99dav8HxCHRpv4Q3liqsjPi+JhSsC28gML2NXwGOaDTGuk013o6HQp1FhRsUyXP04M VjGI9HOqlMvnft10EU0jEgyYdMoQIQFX+e1vfc/md2qg3jtiqI6rvbCjlhWZqfXknWfp JQiA4aqpMr0k3gNQLuns/qfd4/Kfkoc/vfLphrJNcFXHEnryGbIDDupM29WML7zR1hXq JVWdgR9bDjsSbbzsH7VRn2S/AM98J5AdVV31T7SuIj6Kd4UKbQRkpZpbFD6PFbe36IEz xKWw== 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=lnTW1BHWZvwmVeT8D+HwSbWufOgzDNhKeATKVONbFpU=; b=BZeYWQRVrtR6HkehdO4jnwXd2mm2O0lVPt71kM9fckcwnOEZUO8UY0kQxotEN1wsO/ uvY5E3N7aHnHbpPNF3uqLa1mZak2A/yCuAuPXL/EWiLBMBawKKZr53Q7AwrppaogrzFp ZPpNfB+NdmEPcvkWmKy9uawc4wDJW7LPwE6O20YSDskozlgQsj6v3byPSy+aiHBltEoW kIx4kS5FbDCkNxk08mURJC8e1O2eahxAB3yDVIpTrpc+ofUNe4r/n0hEPmYEvFM1RYvd sOsxHVwVPxqyARp4lKM01oaTyFTPx59pZc+U/qQGNrobBFv0EYub1dH7s4M1cgheD59r jeGg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=advQzf2g; spf=pass (google.com: best guess record for domain of linux-spi-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-spi-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 q3si19831115plb.209.2019.01.10.13.26.57; Thu, 10 Jan 2019 13:26:57 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-spi-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=advQzf2g; spf=pass (google.com: best guess record for domain of linux-spi-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-spi-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 S1728786AbfAJV05 (ORCPT + 1 other); Thu, 10 Jan 2019 16:26:57 -0500 Received: from mail-lj1-f196.google.com ([209.85.208.196]:40092 "EHLO mail-lj1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728614AbfAJV05 (ORCPT ); Thu, 10 Jan 2019 16:26:57 -0500 Received: by mail-lj1-f196.google.com with SMTP id n18-v6so11060226lji.7 for ; Thu, 10 Jan 2019 13:26:55 -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=lnTW1BHWZvwmVeT8D+HwSbWufOgzDNhKeATKVONbFpU=; b=advQzf2g78xGZgQqkqBkhNRseWb0pzGL+lNT0ESrUs1EJ7ZLhQCE9YAS1nJwUz0JnD UQPJ56mjpE5rr74MG4hI6PhQ67QZETcs4WSSqC2+a1PpsSqro9V/5OTXsHEMbmFwjyVC 0LAWwNIUuEYAoU/SxLGFSYKpxcuWydI/z6tzA= 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=lnTW1BHWZvwmVeT8D+HwSbWufOgzDNhKeATKVONbFpU=; b=Kz4miVAYOIZ14fDKeBZlVdV3NfHzdr90k2TWvfe7mcavqPGwxzdVYFxCXUoUFckBKI ANryqDNu8uqeqAUFnDNABtjxO147qgNlVC6uwEKq6EozP0iy0ffWlpFn0H2uVOVq7E6M WFrILn2y+lV5teaNnU36PYNJQpJ7GNWdUjpAT4kiDUgZ5usQ3TJlygsM8Psy6QBULNlc VVeSjNY5EiKWfbTDzA5YsZkzbi7/tbWrzCKGvSpHzSc50dhBVYWItilG3N70w0EuKNgm AHrl2UeMpL2skH2N+XDbux/t76ujDyz5GZaup20NpnmsYfDxetJAQTLwx5BRJcWHYpV8 i+5g== X-Gm-Message-State: AJcUukdWfVl/mizpeKwd2I9928yMAMEni1Dss2OEiXZzB61KfYZMBrVi LLpJcYCHLkt0z+3iIAGRrXGpHQ== X-Received: by 2002:a2e:1f01:: with SMTP id f1-v6mr6862932ljf.129.1547155614820; Thu, 10 Jan 2019 13:26:54 -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 o88sm14581035lfk.38.2019.01.10.13.26.53 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 10 Jan 2019 13:26:53 -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 , Janek Kotas Subject: [PATCH v2] spi: dw: Fix default polarity of native chipselect Date: Thu, 10 Jan 2019 22:24:51 +0100 Message-Id: <20190110212451.12108-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 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: Janek Kotas Reported-by: Janek Kotas Fixes: 9400c41e77b8 ("spi: dw: Convert to use CS GPIO descriptors") Signed-off-by: Linus Walleij --- 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(-) -- 2.19.2 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);