summaryrefslogtreecommitdiffstats
path: root/drivers/spi/spi-sun6i.c
diff options
context:
space:
mode:
authorMarc Kleine-Budde <mkl@pengutronix.de>2020-07-06 16:34:42 +0200
committerMark Brown <broonie@kernel.org>2020-07-07 11:41:40 +0200
commit4e7390e997af380e20c5979a9963b521e62b4a58 (patch)
tree1b25b5cb2769992c24af7683d2e7269966dfe9db /drivers/spi/spi-sun6i.c
parentspi: spi-sun6i: sun6i_spi_fill_fifo(): remove not needed length argument (diff)
downloadlinux-4e7390e997af380e20c5979a9963b521e62b4a58.tar.xz
linux-4e7390e997af380e20c5979a9963b521e62b4a58.zip
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: Marc Kleine-Budde <mkl@pengutronix.de> Acked-by: Maxime Ripard <mripard@kernel.org> Link: https://lore.kernel.org/r/20200706143443.9855-10-mkl@pengutronix.de Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to '')
-rw-r--r--drivers/spi/spi-sun6i.c17
1 files changed, 5 insertions, 12 deletions
diff --git a/drivers/spi/spi-sun6i.c b/drivers/spi/spi-sun6i.c
index 2442006c4229..bba9843c40c5 100644
--- a/drivers/spi/spi-sun6i.c
+++ b/drivers/spi/spi-sun6i.c
@@ -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);
}
-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);
@@ -310,11 +302,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);