]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
spi: atmel: simplify MR register update in cs_activate()
authorManikandan Muralidharan <manikandan.m@microchip.com>
Wed, 30 Jul 2025 10:10:13 +0000 (15:40 +0530)
committerMark Brown <broonie@kernel.org>
Sun, 10 Aug 2025 20:11:40 +0000 (21:11 +0100)
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>
drivers/spi/spi-atmel.c

index 89a6b46cd3191a991d838155296f20b5d7a2cc64..409f544d898375c802c7ded97a57d02ed332991d 100644 (file)
@@ -397,20 +397,10 @@ static void cs_activate(struct atmel_spi *as, struct spi_device *spi)
                 * on CS1,2,3 needs SPI_CSR0.BITS config as SPI_CSR1,2,3.BITS
                 */
                spi_writel(as, CSR0, asd->csr);
-               if (as->caps.has_wdrbt) {
-                       spi_writel(as, MR,
-                                       SPI_BF(PCS, ~(0x01 << chip_select))
-                                       | SPI_BIT(WDRBT)
-                                       | SPI_BIT(MODFDIS)
-                                       | SPI_BIT(MSTR));
-               } else {
-                       spi_writel(as, MR,
-                                       SPI_BF(PCS, ~(0x01 << chip_select))
-                                       | SPI_BIT(MODFDIS)
-                                       | SPI_BIT(MSTR));
-               }
 
                mr = spi_readl(as, MR);
+               mr = SPI_BFINS(PCS, ~(0x01 << chip_select), mr);
+               spi_writel(as, MR, mr);
 
                /*
                 * Ensures the clock polarity is valid before we actually