summaryrefslogtreecommitdiffstats
path: root/drivers/spi/spi-ep93xx.c
diff options
context:
space:
mode:
authorH Hartley Sweeten <hsweeten@visionengravers.com>2017-08-08 16:51:28 -0400
committerMark Brown <broonie@kernel.org>2017-08-09 12:53:00 -0400
commitac8d06df9a1f40a9feb759dd7ef5664328ae7694 (patch)
tree0e36c55beb7ef965fc3b0b79daaed10847339d98 /drivers/spi/spi-ep93xx.c
parent16779622be1c8959d6a665e2b6886bb33885fcb1 (diff)
spi: spi-ep93xx: absorb the interrupt enable/disable helpers
These are each only called once. Just absorb them into the callers. Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> [chris: use u32 instead of unsigned int] Signed-off-by: Chris Packham <chris.packham@alliedtelesis.co.nz> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com> Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'drivers/spi/spi-ep93xx.c')
-rw-r--r--drivers/spi/spi-ep93xx.c32
1 files changed, 12 insertions, 20 deletions
diff --git a/drivers/spi/spi-ep93xx.c b/drivers/spi/spi-ep93xx.c
index ce6ec164f2f2..041842e0d028 100644
--- a/drivers/spi/spi-ep93xx.c
+++ b/drivers/spi/spi-ep93xx.c
@@ -111,24 +111,6 @@ struct ep93xx_spi {
111/* converts bits per word to CR0.DSS value */ 111/* converts bits per word to CR0.DSS value */
112#define bits_per_word_to_dss(bpw) ((bpw) - 1) 112#define bits_per_word_to_dss(bpw) ((bpw) - 1)
113 113
114static void ep93xx_spi_enable_interrupts(const struct ep93xx_spi *espi)
115{
116 u32 val;
117
118 val = readl(espi->mmio + SSPCR1);
119 val |= (SSPCR1_RORIE | SSPCR1_TIE | SSPCR1_RIE);
120 writel(val, espi->mmio + SSPCR1);
121}
122
123static void ep93xx_spi_disable_interrupts(const struct ep93xx_spi *espi)
124{
125 u32 val;
126
127 val = readl(espi->mmio + SSPCR1);
128 val &= ~(SSPCR1_RORIE | SSPCR1_TIE | SSPCR1_RIE);
129 writel(val, espi->mmio + SSPCR1);
130}
131
132/** 114/**
133 * ep93xx_spi_calc_divisors() - calculates SPI clock divisors 115 * ep93xx_spi_calc_divisors() - calculates SPI clock divisors
134 * @espi: ep93xx SPI controller struct 116 * @espi: ep93xx SPI controller struct
@@ -282,7 +264,12 @@ static void ep93xx_spi_pio_transfer(struct ep93xx_spi *espi)
282 * FIFO, enable interrupts, and wait for the transfer to complete. 264 * FIFO, enable interrupts, and wait for the transfer to complete.
283 */ 265 */
284 if (ep93xx_spi_read_write(espi)) { 266 if (ep93xx_spi_read_write(espi)) {
285 ep93xx_spi_enable_interrupts(espi); 267 u32 val;
268
269 val = readl(espi->mmio + SSPCR1);
270 val |= (SSPCR1_RORIE | SSPCR1_TIE | SSPCR1_RIE);
271 writel(val, espi->mmio + SSPCR1);
272
286 wait_for_completion(&espi->wait); 273 wait_for_completion(&espi->wait);
287 } 274 }
288} 275}
@@ -604,6 +591,7 @@ static int ep93xx_spi_transfer_one_message(struct spi_master *master,
604static irqreturn_t ep93xx_spi_interrupt(int irq, void *dev_id) 591static irqreturn_t ep93xx_spi_interrupt(int irq, void *dev_id)
605{ 592{
606 struct ep93xx_spi *espi = dev_id; 593 struct ep93xx_spi *espi = dev_id;
594 u32 val;
607 595
608 /* 596 /*
609 * If we got ROR (receive overrun) interrupt we know that something is 597 * If we got ROR (receive overrun) interrupt we know that something is
@@ -635,8 +623,12 @@ static irqreturn_t ep93xx_spi_interrupt(int irq, void *dev_id)
635 * any case we disable interrupts and notify the worker to handle 623 * any case we disable interrupts and notify the worker to handle
636 * any post-processing of the message. 624 * any post-processing of the message.
637 */ 625 */
638 ep93xx_spi_disable_interrupts(espi); 626 val = readl(espi->mmio + SSPCR1);
627 val &= ~(SSPCR1_RORIE | SSPCR1_TIE | SSPCR1_RIE);
628 writel(val, espi->mmio + SSPCR1);
629
639 complete(&espi->wait); 630 complete(&espi->wait);
631
640 return IRQ_HANDLED; 632 return IRQ_HANDLED;
641} 633}
642 634