[8/9] spi: spi-sun6i: sun6i_spi_transfer_one(): collate write to Interrupt Control Register
diff mbox series

Message ID 20200706071801.558394-9-mkl@pengutronix.de
State New
Headers show
Series
  • spi: spi-sun6i: One fix and some improvements
Related show

Commit Message

Marc Kleine-Budde July 6, 2020, 7:18 a.m. UTC
In sun6i_spi_transfer_one() the Interrupt Control Register is written three
times. This patch collates the three writes into one.

Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
 drivers/spi/spi-sun6i.c | 17 +++++------------
 1 file changed, 5 insertions(+), 12 deletions(-)

Patch
diff mbox series

diff --git a/drivers/spi/spi-sun6i.c b/drivers/spi/spi-sun6i.c
index da56e9bc2cc3..21b4436a72de 100644
--- a/drivers/spi/spi-sun6i.c
+++ b/drivers/spi/spi-sun6i.c
@@ -124,14 +124,6 @@  static inline u32 sun6i_spi_get_tx_fifo_count(struct sun6i_spi *sspi)
 	return reg & SUN6I_FIFO_STA_TF_CNT_MASK;
 }
 
-static inline void sun6i_spi_enable_interrupt(struct sun6i_spi *sspi, u32 mask)
-{
-	u32 reg = sun6i_spi_read(sspi, SUN6I_INT_CTL_REG);
-
-	reg |= mask;
-	sun6i_spi_write(sspi, SUN6I_INT_CTL_REG, reg);
-}
-
 static inline void sun6i_spi_disable_interrupt(struct sun6i_spi *sspi, u32 mask)
 {
 	u32 reg = sun6i_spi_read(sspi, SUN6I_INT_CTL_REG);
@@ -315,11 +307,12 @@  static int sun6i_spi_transfer_one(struct spi_master *master,
 	sun6i_spi_fill_fifo(sspi);
 
 	/* Enable the interrupts */
-	sun6i_spi_write(sspi, SUN6I_INT_CTL_REG, SUN6I_INT_CTL_TC);
-	sun6i_spi_enable_interrupt(sspi, SUN6I_INT_CTL_TC |
-					 SUN6I_INT_CTL_RF_RDY);
+	reg = SUN6I_INT_CTL_TC | SUN6I_INT_CTL_RF_RDY;
+
 	if (tx_len > sspi->fifo_depth)
-		sun6i_spi_enable_interrupt(sspi, SUN6I_INT_CTL_TF_ERQ);
+		reg |= SUN6I_INT_CTL_TF_ERQ;
+
+	sun6i_spi_write(sspi, SUN6I_INT_CTL_REG, reg);
 
 	/* Start the transfer */
 	reg = sun6i_spi_read(sspi, SUN6I_TFR_CTL_REG);