[PATCH spi-next 10/11] spi: spi-fsl-lpspi: fsl_lpspi_set_cmd(): use mode from (struct fsl_lpspi_data::config::mode

From: Marc Kleine-Budde

Date: Mon Mar 16 2026 - 04:41:32 EST


Commit 7ae4d097b752 ("spi: spi-fsl-lpspi: Handle clock polarity and phase")
enhances the driver with clock polarity and phase handling. That commit
adds a 2nd argument ("struct spi_device *spi") to the fsl_lpspi_set_cmd()
function.

The "spi" pointer is used to access the "mode" of the current transfer.
However the mode is already available via "fsl_lpspi->config.mode".

To simplify the driver remove the 2nd argument and use
"fsl_lpspi->config.mode" to access the mode.

Cc: Marek Vasut <marex@xxxxxxxxxxxx>
Signed-off-by: Marc Kleine-Budde <mkl@xxxxxxxxxxxxxx>
---
drivers/spi/spi-fsl-lpspi.c | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/drivers/spi/spi-fsl-lpspi.c b/drivers/spi/spi-fsl-lpspi.c
index 9ec5554b4fc0..3a0e9726fa71 100644
--- a/drivers/spi/spi-fsl-lpspi.c
+++ b/drivers/spi/spi-fsl-lpspi.c
@@ -289,8 +289,7 @@ static void fsl_lpspi_read_rx_fifo(struct fsl_lpspi_data *fsl_lpspi)
fsl_lpspi->rx(fsl_lpspi);
}

-static void fsl_lpspi_set_cmd(struct fsl_lpspi_data *fsl_lpspi,
- struct spi_device *spi)
+static void fsl_lpspi_set_cmd(struct fsl_lpspi_data *fsl_lpspi)
{
u32 temp = 0;

@@ -313,10 +312,10 @@ static void fsl_lpspi_set_cmd(struct fsl_lpspi_data *fsl_lpspi,
}
}

- if (spi->mode & SPI_CPOL)
+ if (fsl_lpspi->config.mode & SPI_CPOL)
temp |= TCR_CPOL;

- if (spi->mode & SPI_CPHA)
+ if (fsl_lpspi->config.mode & SPI_CPHA)
temp |= TCR_CPHA;

writel(temp, fsl_lpspi->base + IMX7ULP_TCR);
@@ -527,7 +526,7 @@ static int fsl_lpspi_prepare_message(struct spi_controller *controller,
if (ret < 0)
return ret;

- fsl_lpspi_set_cmd(fsl_lpspi, spi);
+ fsl_lpspi_set_cmd(fsl_lpspi);

/* No IRQs */
writel(0, fsl_lpspi->base + IMX7ULP_IER);
@@ -802,7 +801,7 @@ static int fsl_lpspi_transfer_one(struct spi_controller *controller,

t->effective_speed_hz = fsl_lpspi->config.effective_speed_hz;

- fsl_lpspi_set_cmd(fsl_lpspi, spi);
+ fsl_lpspi_set_cmd(fsl_lpspi);
fsl_lpspi->is_first_byte = false;

if (fsl_lpspi->usedma)

--
2.51.0