From patchwork Thu Jan 10 21: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: 10756979 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 EA3361399 for ; Thu, 10 Jan 2019 21:23:21 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D898329D8E for ; Thu, 10 Jan 2019 21:23:21 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CC94329D9E; Thu, 10 Jan 2019 21:23:21 +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 456F329D9D for ; Thu, 10 Jan 2019 21:23:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727401AbfAJVXU (ORCPT ); Thu, 10 Jan 2019 16:23:20 -0500 Received: from mail-lf1-f68.google.com ([209.85.167.68]:46852 "EHLO mail-lf1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728385AbfAJVXU (ORCPT ); Thu, 10 Jan 2019 16:23:20 -0500 Received: by mail-lf1-f68.google.com with SMTP id y14so9322796lfg.13 for ; Thu, 10 Jan 2019 13:23:18 -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=7ljTuh9wXcpceQd+LeLwlycG8+ReTi1ItqK/TulFhKk=; b=IM4qTiwOHhUMjK4ci9E0fgOShJF96OVkCNKNXBwUZ6EttKoTGwF3CIWplNgXaiJzY3 4kpFFHRn4w8YvhZEF5OOmYzaYQIXBKR+JrQhYPD46EPI0pfJAGlfor36qmsP3/rLDfeB gm13Io4NBy1+/Y3YqxuAUZnzyIEGlTxU/jiic= 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=7ljTuh9wXcpceQd+LeLwlycG8+ReTi1ItqK/TulFhKk=; b=tDWmbQglWMnRZr7gRZ6LKZvRU9FUeOxrzSgxkLgTJ5OXJaHaIEnDjkVTwZEW1RIhob 94cYX+bkT1hOUNqThtYGYkxWFyu2qxmcfRKABESHLeLgTXEtXZoX8RAUHFFw0XzjgKB7 D18HhVFPUjBxgGaVspy5uUPHR7MavTzBX1ReQLJ0Bm0nvsCxmLFQwrWleR1wta1EZLW2 INohdyYLcV10zS2oPM9F/b/c93+Nfyi/Z+719RyP4TEWls9/sVUoQrb/1XGCfZjt56ic qGQbLuUWMXZj/cOTxW5imKzHQsmZeutvfU33NBCz989juDOv4jQiF7d6Lvn3JJ0Pzwu5 OCNA== X-Gm-Message-State: AJcUukejeAOqaoGXOj9ilkieAWELjb+9VRqYmUZrae1fTudrVktXMd/k U6bc2odXezwC2srw8rsXKgvaig== X-Google-Smtp-Source: ALg8bN4j+w8M2kghIOj5iWh7aImd+N2/1fzSbTpsWRnSKM/KZFcQYQ98M66zzvyiboCx098P3gdaBA== X-Received: by 2002:a19:94d5:: with SMTP id o82mr6374030lfk.155.1547155397689; Thu, 10 Jan 2019 13:23:17 -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 j18-v6sm15364145ljc.52.2019.01.10.13.23.16 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 10 Jan 2019 13:23:16 -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] spi: dw: Fix default polarity of native chipselect Date: Thu, 10 Jan 2019 22:21:10 +0100 Message-Id: <20190110212110.11395-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 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. There are no in-kernel users of this native chip select callback so the breakage only affected out-of-tree code, but let's fix it. Cc: Janek Kotas Reported-by: Janek Kotas Fixes: 9400c41e77b8 ("spi: dw: Convert to use CS GPIO descriptors") Signed-off-by: Linus Walleij --- Janek can you confirm if this solves your problem? --- drivers/spi/spi-dw.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/spi/spi-dw.c b/drivers/spi/spi-dw.c index f54b498001a9..bf4dfdd056f9 100644 --- a/drivers/spi/spi-dw.c +++ b/drivers/spi/spi-dw.c @@ -137,9 +137,8 @@ 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) dw_writel(dws, DW_SPI_SER, BIT(spi->chip_select));