Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp6776515ybc; Thu, 28 Nov 2019 05:21:03 -0800 (PST) X-Google-Smtp-Source: APXvYqwfOshROVkdWPhIMk/qFr4E4xIyDXL37miAP/caLWmxYCLxpG3LF21NmotKvpZIrw7hXWCE X-Received: by 2002:a17:906:aad0:: with SMTP id kt16mr29063944ejb.223.1574947262949; Thu, 28 Nov 2019 05:21:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574947262; cv=none; d=google.com; s=arc-20160816; b=VvbmZlUeOGJQHEzPQTvziaA0uPExCG3feMOzX6w0B16muIYgvINxP0JZSH6eg6+kRS 5SZMwGK9jIE7S7cBNbovktoJms8GP0AT+yDJlEfSrhc7nphw+tnvpdVKceptk1BhS7tW OyQiZt3GoS4SqlJirFhPV9d8aI7ZbjwxLuTlutppxB29a5xb+MdzW+OldID+/eJVT9wB jlrckA/Tu4CE3BztkL0UqwuXvnuPm2HYxExrbm164ayTtU56JiFdQkaSUG52I7HF5+2O pBt4FcIIlU2iy/t3jUR/QjBFr+yT5/XQPVaakkHrAx6agV9DxAJM3Un0WXrvZ6NV+Vby zlHQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:in-reply-to:subject:cc:to:from :date; bh=FAIniyQgo4T4Q+Kdw67io3fFQ1/GC+ejHfqABHoCepk=; b=lkCdHl/colB07sWKyrz+EbqtbGVF2rCB9jy/m3cMnLtzWBHxALLYAk+dZ25eyDz8By RLvoinb15Fb91GYgkPfxme4y6sY0xM1jQl6wm8d6XngLr0iB4N9K/UKi153NJ9uzqF0h N4IwoynTbMda0esLOkYIdtyUD8yT6qCHDGcXxNDJ9a3MbBubnb8od75XjECtC3pwpdEA /KFm2QNGwMH/SGZ78AJ9ojGH5mlsewSZtWIjXPmkiAe0e/9UqlYgjzRzA0GtC1fGd1xo c3zc//vchSHbJiVOQLnMyuG1cK27BTFG9iGMRQg7JPJItwiG4UoTLWUC05rtkHr1JB62 LdWw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s3si14426137edy.199.2019.11.28.05.20.39; Thu, 28 Nov 2019 05:21:02 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726856AbfK1NTF (ORCPT + 99 others); Thu, 28 Nov 2019 08:19:05 -0500 Received: from foss.arm.com ([217.140.110.172]:35314 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726734AbfK1NTF (ORCPT ); Thu, 28 Nov 2019 08:19:05 -0500 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id F122A30E; Thu, 28 Nov 2019 05:19:04 -0800 (PST) Received: from localhost (unknown [10.37.6.21]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 701773F52E; Thu, 28 Nov 2019 05:19:04 -0800 (PST) Date: Thu, 28 Nov 2019 13:19:02 +0000 From: Mark Brown To: Charles Keepax Cc: broonie@kernel.org, gregory.clement@bootlin.com, linus.walleij@linaro.org, Linus Walleij , linux-kernel@vger.kernel.org, linux-spi@vger.kernel.org, Mark Brown Subject: Applied "spi: dw: Correct handling of native chipselect" to the spi tree In-Reply-To: <20191127153936.29719-1-ckeepax@opensource.cirrus.com> Message-Id: X-Patchwork-Hint: ignore Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The patch spi: dw: Correct handling of native chipselect has been applied to the spi tree at https://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git for-5.5 All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted. You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed. If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced. Please add any relevant lists and maintainers to the CCs when replying to this mail. Thanks, Mark From ada9e3fcc175db4538f5b5e05abf5dedf626e550 Mon Sep 17 00:00:00 2001 From: Charles Keepax Date: Wed, 27 Nov 2019 15:39:36 +0000 Subject: [PATCH] spi: dw: Correct handling of native chipselect This patch reverts commit 6e0a32d6f376 ("spi: dw: Fix default polarity of native chipselect"). The SPI framework always called the set_cs callback with the logic level it desired on the chip select line, which is what the drivers original handling supported. commit f3186dd87669 ("spi: Optionally use GPIO descriptors for CS GPIOs") changed these symantics, but only in the case of drivers that also support GPIO chip selects, to true meaning apply slave select rather than logic high. This left things in an odd state where a driver that only supports hardware chip selects, the core would handle polarity but if the driver supported GPIOs as well the driver should handle polarity. At this point the reverted change was applied to change the logic in the driver to match new system. This was then broken by commit 3e5ec1db8bfe ("spi: Fix SPI_CS_HIGH setting when using native and GPIO CS") which reverted the core back to consistently calling set_cs with a logic level. This fix reverts the driver code back to its original state to match the current core code. This is probably a better fix as a) the set_cs callback is always called with consistent symantics and b) the inversion for SPI_CS_HIGH can be handled in the core and doesn't need to be coded in each driver supporting it. Fixes: 3e5ec1db8bfe ("spi: Fix SPI_CS_HIGH setting when using native and GPIO CS") Signed-off-by: Charles Keepax Acked-by: Linus Walleij Link: https://lore.kernel.org/r/20191127153936.29719-1-ckeepax@opensource.cirrus.com Signed-off-by: Mark Brown --- drivers/spi/spi-dw.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/spi/spi-dw.c b/drivers/spi/spi-dw.c index 466f5c67843b..9387f60eb496 100644 --- a/drivers/spi/spi-dw.c +++ b/drivers/spi/spi-dw.c @@ -129,10 +129,11 @@ 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); -- 2.20.1