Skip to content

Commit 2255b03

Browse files
Larisa Grigoregregkh
authored andcommitted
spi: spi-fsl-lpspi: Set correct chip-select polarity bit
[ Upstream commit cbe3370 ] The driver currently supports multiple chip-selects, but only sets the polarity for the first one (CS 0). Fix it by setting the PCSPOL bit for the desired chip-select. Fixes: 5314987 ("spi: imx: add lpspi bus driver") Signed-off-by: Larisa Grigore <larisa.grigore@nxp.com> Signed-off-by: James Clark <james.clark@linaro.org> Reviewed-by: Frank Li <Frank.Li@nxp.com> Link: https://patch.msgid.link/20250828-james-nxp-lpspi-v2-2-6262b9aa9be4@linaro.org Signed-off-by: Mark Brown <broonie@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent 6768188 commit 2255b03

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

drivers/spi/spi-fsl-lpspi.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
// Copyright 2016 Freescale Semiconductor, Inc.
66
// Copyright 2018, 2023, 2025 NXP
77

8+
#include <linux/bitfield.h>
89
#include <linux/clk.h>
910
#include <linux/completion.h>
1011
#include <linux/delay.h>
@@ -70,7 +71,7 @@
7071
#define DER_TDDE BIT(0)
7172
#define CFGR1_PCSCFG BIT(27)
7273
#define CFGR1_PINCFG (BIT(24)|BIT(25))
73-
#define CFGR1_PCSPOL BIT(8)
74+
#define CFGR1_PCSPOL_MASK GENMASK(11, 8)
7475
#define CFGR1_NOSTALL BIT(3)
7576
#define CFGR1_HOST BIT(0)
7677
#define FSR_TXCOUNT (0xFF)
@@ -424,7 +425,9 @@ static int fsl_lpspi_config(struct fsl_lpspi_data *fsl_lpspi)
424425
else
425426
temp = CFGR1_PINCFG;
426427
if (fsl_lpspi->config.mode & SPI_CS_HIGH)
427-
temp |= CFGR1_PCSPOL;
428+
temp |= FIELD_PREP(CFGR1_PCSPOL_MASK,
429+
BIT(fsl_lpspi->config.chip_select));
430+
428431
writel(temp, fsl_lpspi->base + IMX7ULP_CFGR1);
429432

430433
temp = readl(fsl_lpspi->base + IMX7ULP_CR);

0 commit comments

Comments
 (0)