From patchwork Wed Oct 14 09:02:30 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Martin_Hundeb=C3=B8ll?= X-Patchwork-Id: 11837087 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id BC49B1744 for ; Wed, 14 Oct 2020 09:09:50 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 71D4520BED for ; Wed, 14 Oct 2020 09:09:48 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=geanix.com header.i=@geanix.com header.b="QcYSlGx8" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729064AbgJNJJq (ORCPT ); Wed, 14 Oct 2020 05:09:46 -0400 Received: from first.geanix.com ([116.203.34.67]:53572 "EHLO first.geanix.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728922AbgJNJJj (ORCPT ); Wed, 14 Oct 2020 05:09:39 -0400 X-Greylist: delayed 411 seconds by postgrey-1.27 at vger.kernel.org; Wed, 14 Oct 2020 05:09:38 EDT Received: from zen.localdomain (unknown [185.17.218.86]) by first.geanix.com (Postfix) with ESMTPSA id 05D16F41496; Wed, 14 Oct 2020 09:02:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=geanix.com; s=first; t=1602666165; bh=aUqpmVAAjoLv03iR1lJWlTTuq3Ra9mS4JJvcrMl80zQ=; h=From:To:Cc:Subject:Date; b=QcYSlGx8F2sB7kmz03FAAv1M7+kRXre/GguSc7U4PJJ8+IIe8Dh94yJ53k2fI8XYF a5sRm/MWvWXFODTETN/HObcw8Ol5k5UQj6SeZhQCd9dbs+ErMBzpluhuYnI5SEuBxi 2P9tzE8NSOIiraaIhoufXXsiwr18KzNjHCMtYrvmoySnSNG4NzaYKjOwGKBXftW7Ae rT/J80Cy/ANS8+OrZKg2oIyC5xEhwAPbT2b6gy0GKro/p+diILKXmUGqBaPdpeqNiM EgCmac227s8YKodVqSBuCE70rwYm+4tPgvPBOaCcu3AvI/H5hl/AqLHG6cWhO7cn20 Q1+83MApLj99w== From: =?utf-8?q?Martin_Hundeb=C3=B8ll?= To: Mark Brown , linux-spi@vger.kernel.org Cc: =?utf-8?q?Martin_Hundeb=C3=B8ll?= , linux-rpi-kernel@lists.infradead.org, linux-arm-kernel@lists.infradead.org, bcm-kernel-feedback-list@broadcom.com, Scott Branden , Ray Jui , Florian Fainelli , Nicolas Saenz Julienne , Gregory CLEMENT , stable@vger.kernel.org Subject: [PATCH] spi: bcm2835: fix gpio cs level inversion Date: Wed, 14 Oct 2020 11:02:30 +0200 Message-Id: <20201014090230.2706810-1-martin@geanix.com> X-Mailer: git-send-email 2.28.0 MIME-Version: 1.0 X-Spam-Status: No, score=-3.1 required=4.0 tests=ALL_TRUSTED,BAYES_00, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,URIBL_BLOCKED autolearn=disabled version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on ff3d05386fc5 Precedence: bulk List-ID: X-Mailing-List: linux-spi@vger.kernel.org The work on improving gpio chip-select in spi core, and the following fixes, has caused the bcm2835 spi driver to use wrong levels. Fix this by simply removing level handling in the bcm2835 driver, and let the core do its work. Fixes: 3e5ec1db8bfe ("spi: Fix SPI_CS_HIGH setting when using native and GPIO CS") Cc: Signed-off-by: Martin Hundebøll --- drivers/spi/spi-bcm2835.c | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/drivers/spi/spi-bcm2835.c b/drivers/spi/spi-bcm2835.c index b87116e9b413..9b6ba94fe878 100644 --- a/drivers/spi/spi-bcm2835.c +++ b/drivers/spi/spi-bcm2835.c @@ -1259,18 +1259,6 @@ static int bcm2835_spi_setup(struct spi_device *spi) if (!chip) return 0; - /* - * Retrieve the corresponding GPIO line used for CS. - * The inversion semantics will be handled by the GPIO core - * code, so we pass GPIOD_OUT_LOW for "unasserted" and - * the correct flag for inversion semantics. The SPI_CS_HIGH - * on spi->mode cannot be checked for polarity in this case - * as the flag use_gpio_descriptors enforces SPI_CS_HIGH. - */ - if (of_property_read_bool(spi->dev.of_node, "spi-cs-high")) - lflags = GPIO_ACTIVE_HIGH; - else - lflags = GPIO_ACTIVE_LOW; spi->cs_gpiod = gpiochip_request_own_desc(chip, 8 - spi->chip_select, DRV_NAME, lflags,