Skip to content

Commit 18fac61

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 5255b99 commit 18fac61

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, 2023, 2025 NXP
77

8+
#include <linux/bitfield.h>
89
#include <linux/clk.h>
910
#include <linux/completion.h>
1011
#include <linux/delay.h>
@@ -71,7 +72,7 @@
7172
#define DER_TDDE BIT(0)
7273
#define CFGR1_PCSCFG BIT(27)
7374
#define CFGR1_PINCFG (BIT(24)|BIT(25))
74-
#define CFGR1_PCSPOL BIT(8)
75+
#define CFGR1_PCSPOL_MASK GENMASK(11, 8)
7576
#define CFGR1_NOSTALL BIT(3)
7677
#define CFGR1_MASTER BIT(0)
7778
#define FSR_TXCOUNT (0xFF)
@@ -395,7 +396,9 @@ static int fsl_lpspi_config(struct fsl_lpspi_data *fsl_lpspi)
395396
else
396397
temp = CFGR1_PINCFG;
397398
if (fsl_lpspi->config.mode & SPI_CS_HIGH)
398-
temp |= CFGR1_PCSPOL;
399+
temp |= FIELD_PREP(CFGR1_PCSPOL_MASK,
400+
BIT(fsl_lpspi->config.chip_select));
401+
399402
writel(temp, fsl_lpspi->base + IMX7ULP_CFGR1);
400403

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

0 commit comments

Comments
 (0)