Skip to content

Commit dac01db

Browse files
Larisa GrigoreUlrich Hecht
authored andcommitted
spi: spi-fsl-lpspi: Set correct chip-select polarity bit
[ Upstream commit cbe33705864ba2697a2939de715b81538cf32430 ] 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> Signed-off-by: Ulrich Hecht <uli@kernel.org>
1 parent 38d4e25 commit dac01db

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

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 NXP Semiconductors
77

8+
#include <linux/bitfield.h>
89
#include <linux/clk.h>
910
#include <linux/completion.h>
1011
#include <linux/delay.h>
@@ -56,7 +57,7 @@
5657
#define IER_TDIE BIT(0)
5758
#define CFGR1_PCSCFG BIT(27)
5859
#define CFGR1_PINCFG (BIT(24)|BIT(25))
59-
#define CFGR1_PCSPOL BIT(8)
60+
#define CFGR1_PCSPOL_MASK GENMASK(11, 8)
6061
#define CFGR1_NOSTALL BIT(3)
6162
#define CFGR1_MASTER BIT(0)
6263
#define RSR_RXEMPTY BIT(1)
@@ -312,7 +313,9 @@ static int fsl_lpspi_config(struct fsl_lpspi_data *fsl_lpspi)
312313
else
313314
temp = CFGR1_PINCFG;
314315
if (fsl_lpspi->config.mode & SPI_CS_HIGH)
315-
temp |= CFGR1_PCSPOL;
316+
temp |= FIELD_PREP(CFGR1_PCSPOL_MASK,
317+
BIT(fsl_lpspi->config.chip_select));
318+
316319
writel(temp, fsl_lpspi->base + IMX7ULP_CFGR1);
317320

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

0 commit comments

Comments
 (0)