Commit 4e7390e9 authored by Marc Kleine-Budde's avatar Marc Kleine-Budde Committed by Mark Brown

spi: spi-sun6i: sun6i_spi_transfer_one(): collate write to Interrupt Control Register

In sun6i_spi_transfer_one() the Interrupt Control Register is written three
times. This patch collates the three writes into one.
Signed-off-by: default avatarMarc Kleine-Budde <mkl@pengutronix.de>
Acked-by: default avatarMaxime Ripard <mripard@kernel.org>
Link: https://lore.kernel.org/r/20200706143443.9855-10-mkl@pengutronix.deSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent e4e8ca3f
...@@ -119,14 +119,6 @@ static inline u32 sun6i_spi_get_tx_fifo_count(struct sun6i_spi *sspi) ...@@ -119,14 +119,6 @@ static inline u32 sun6i_spi_get_tx_fifo_count(struct sun6i_spi *sspi)
return FIELD_GET(SUN6I_FIFO_STA_TF_CNT_MASK, reg); return FIELD_GET(SUN6I_FIFO_STA_TF_CNT_MASK, reg);
} }
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) static inline void sun6i_spi_disable_interrupt(struct sun6i_spi *sspi, u32 mask)
{ {
u32 reg = sun6i_spi_read(sspi, SUN6I_INT_CTL_REG); u32 reg = sun6i_spi_read(sspi, SUN6I_INT_CTL_REG);
...@@ -310,11 +302,12 @@ static int sun6i_spi_transfer_one(struct spi_master *master, ...@@ -310,11 +302,12 @@ static int sun6i_spi_transfer_one(struct spi_master *master,
sun6i_spi_fill_fifo(sspi); sun6i_spi_fill_fifo(sspi);
/* Enable the interrupts */ /* Enable the interrupts */
sun6i_spi_write(sspi, SUN6I_INT_CTL_REG, SUN6I_INT_CTL_TC); reg = SUN6I_INT_CTL_TC | SUN6I_INT_CTL_RF_RDY;
sun6i_spi_enable_interrupt(sspi, SUN6I_INT_CTL_TC |
SUN6I_INT_CTL_RF_RDY);
if (tx_len > sspi->fifo_depth) 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 */ /* Start the transfer */
reg = sun6i_spi_read(sspi, SUN6I_TFR_CTL_REG); reg = sun6i_spi_read(sspi, SUN6I_TFR_CTL_REG);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment