Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id AB41DC32774 for ; Tue, 23 Aug 2022 17:07:50 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id B684A81F4E; Tue, 23 Aug 2022 19:07:48 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=denx.de Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=denx.de; s=phobos-20191101; t=1661274468; bh=lVR8B2S98PFxhoJU2HRSrlB3MT1fkdUZeS2R6xGzFsE=; h=From:To:Cc:Subject:Date:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From; b=KncANtp9EmgK4C696Aw5ZaYQXfRxtIQTeWPMbshu/T9lV2mDfkiqL7YgPE+pQH8fj ZJIW/y0SiHHzbAe3Wr4QIvjCt9yNUe4rVaoDvhbPd/HTsZnbrNEe/YyY7uiD1JCwZY 1GdDLfx2dxVOGezARY7a67HSH7lvoC5Oh561BAW1ojYJcjQu1dSEGNC1fGI2bob2S5 rq9dZf/uvS3npr5/TilDFNE8rCvgMl8hqJ8Y0nh+uUoqZDotrkhYVRiWvU/3PEldv9 NJfEClmaRKYi2j0EYu6fBAQUScT4Xn6OTTnH5NJqhMjzq1wHVZdHfl7htqAWcbv0xn ywJMmxO7Q7yqA== Received: from tr.lan (ip-86-49-12-201.bb.vodafone.cz [86.49.12.201]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: marex@denx.de) by phobos.denx.de (Postfix) with ESMTPSA id 6AB6E81F4E; Tue, 23 Aug 2022 19:07:47 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=denx.de; s=phobos-20191101; t=1661274467; bh=lVR8B2S98PFxhoJU2HRSrlB3MT1fkdUZeS2R6xGzFsE=; h=From:To:Cc:Subject:Date:From; b=vQMO/LWo+TJxWRV0ozvcvU+NDXML5/gv1DHSUhoz9F7VtIBWsaSPGaOdZRCQFmZdE 4SXp0z7zqPyTSqbEYyHWhZQuuFQ9wW7OiXbUwe3fK6L3O73LdXcdsGnBQcFSJdE5wL Hq5QUV4jo+eBAUV0HSUr6rThxCbh/cHxRamD3cOeHbBusTt2lm6X8LNnIwPUecIAeR q2El0dMLszugMBEdw3xVc6M92mjxln7ofDP1ff1LvWs93ruZEndKENXKHTdOijvsYw QWes91/As05XlpVl04oGsC83vo5AmnuDNdVdZ3WaQeQnGmA41GxL+aPECdD/VRC2ZG 1AunYwvvZwVrQ== From: Marek Vasut To: u-boot@lists.denx.de Cc: Marek Vasut , Patrick Delaunay , Patrice Chotard Subject: [PATCH] spi: stm32_spi: Fix GPIO chipselect polarity handling Date: Tue, 23 Aug 2022 19:07:36 +0200 Message-Id: <20220823170736.302866-1-marex@denx.de> X-Mailer: git-send-email 2.35.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.6 at phobos.denx.de X-Virus-Status: Clean The GPIO chipselect signal polarity is handled by the GPIO core code, the driver code is only responsible for asserting and deasserting the GPIO. Do not invert the GPIO polarity in the driver code. For example, In case CS GPIO is active low, then the DT must contain GPIO_ACTIVE_LOW flag and the GPIO core code would set the GPIO accordingly. Signed-off-by: Marek Vasut Cc: Patrick Delaunay Cc: Patrice Chotard --- drivers/spi/stm32_spi.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/spi/stm32_spi.c b/drivers/spi/stm32_spi.c index fe5419e8518..0cb24546ca9 100644 --- a/drivers/spi/stm32_spi.c +++ b/drivers/spi/stm32_spi.c @@ -434,7 +434,7 @@ static int stm32_spi_xfer(struct udevice *slave, unsigned int bitlen, slave_plat = dev_get_parent_plat(slave); if (flags & SPI_XFER_BEGIN) - stm32_spi_set_cs(bus, slave_plat->cs, false); + stm32_spi_set_cs(bus, slave_plat->cs, true); /* Be sure to have data in fifo before starting data transfer */ if (priv->tx_buf) @@ -485,7 +485,7 @@ static int stm32_spi_xfer(struct udevice *slave, unsigned int bitlen, stm32_spi_stopxfer(bus); if (flags & SPI_XFER_END) - stm32_spi_set_cs(bus, slave_plat->cs, true); + stm32_spi_set_cs(bus, slave_plat->cs, false); return xfer_status; } -- 2.35.1