Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

spi: spi-fsl-lpspi: fsl_lpspi_set_watermark(): use FIELD_PREP() to encode FIFO Control register

Instead of open coding mask and shift operations and to increase
readability use FIELD_PREP() to encode the FIFO Control register.

Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Link: https://patch.msgid.link/20260319-spi-fsl-lpspi-cleanups-v2-2-02b56c5d44a8@pengutronix.de
Signed-off-by: Mark Brown <broonie@kernel.org>

authored by

Marc Kleine-Budde and committed by
Mark Brown
732b903e 8292eded

+7 -4
+7 -4
drivers/spi/spi-fsl-lpspi.c
··· 75 75 #define CFGR1_PCSPOL_MASK GENMASK(11, 8) 76 76 #define CFGR1_NOSTALL BIT(3) 77 77 #define CFGR1_HOST BIT(0) 78 + #define FCR_RXWATER GENMASK(18, 16) 79 + #define FCR_TXWATER GENMASK(2, 0) 78 80 #define FSR_TXCOUNT (0xFF) 79 81 #define RSR_RXEMPTY BIT(1) 80 82 #define TCR_CPOL BIT(31) ··· 321 319 322 320 static void fsl_lpspi_set_watermark(struct fsl_lpspi_data *fsl_lpspi) 323 321 { 322 + u8 watermark = fsl_lpspi->watermark >> 1; 324 323 u32 temp; 325 324 326 325 if (!fsl_lpspi->usedma) 327 - temp = fsl_lpspi->watermark >> 1 | 328 - (fsl_lpspi->watermark >> 1) << 16; 326 + temp = FIELD_PREP(FCR_TXWATER, watermark) | 327 + FIELD_PREP(FCR_RXWATER, watermark); 329 328 else 330 - temp = fsl_lpspi->watermark >> 1; 329 + temp = FIELD_PREP(FCR_TXWATER, watermark); 331 330 332 331 writel(temp, fsl_lpspi->base + IMX7ULP_FCR); 333 332 334 - dev_dbg(fsl_lpspi->dev, "FCR=0x%x\n", temp); 333 + dev_dbg(fsl_lpspi->dev, "FCR=0x%08x\n", temp); 335 334 } 336 335 337 336 static int fsl_lpspi_set_bitrate(struct fsl_lpspi_data *fsl_lpspi)