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

spi: atmel: simplify MR register update in cs_activate()

simplified the MR register configuration by updating only the PCS field
using SPI_BFINS() instead of rewriting the entire register.
Avoids code duplication.

Signed-off-by: Manikandan Muralidharan <manikandan.m@microchip.com>
Link: https://patch.msgid.link/20250730101015.323964-1-manikandan.m@microchip.com
Signed-off-by: Mark Brown <broonie@kernel.org>

authored by

Manikandan Muralidharan and committed by
Mark Brown
379f8197 f1ac30a8

+2 -12
+2 -12
drivers/spi/spi-atmel.c
··· 397 397 * on CS1,2,3 needs SPI_CSR0.BITS config as SPI_CSR1,2,3.BITS 398 398 */ 399 399 spi_writel(as, CSR0, asd->csr); 400 - if (as->caps.has_wdrbt) { 401 - spi_writel(as, MR, 402 - SPI_BF(PCS, ~(0x01 << chip_select)) 403 - | SPI_BIT(WDRBT) 404 - | SPI_BIT(MODFDIS) 405 - | SPI_BIT(MSTR)); 406 - } else { 407 - spi_writel(as, MR, 408 - SPI_BF(PCS, ~(0x01 << chip_select)) 409 - | SPI_BIT(MODFDIS) 410 - | SPI_BIT(MSTR)); 411 - } 412 400 413 401 mr = spi_readl(as, MR); 402 + mr = SPI_BFINS(PCS, ~(0x01 << chip_select), mr); 403 + spi_writel(as, MR, mr); 414 404 415 405 /* 416 406 * Ensures the clock polarity is valid before we actually