diff options
Diffstat (limited to 'drivers/spi/spi-dw-dma.c')
-rw-r--r-- | drivers/spi/spi-dw-dma.c | 55 |
1 files changed, 28 insertions, 27 deletions
diff --git a/drivers/spi/spi-dw-dma.c b/drivers/spi/spi-dw-dma.c index a09831c62192..63e5260100ec 100644 --- a/drivers/spi/spi-dw-dma.c +++ b/drivers/spi/spi-dw-dma.c @@ -10,6 +10,7 @@ #include <linux/dmaengine.h> #include <linux/irqreturn.h> #include <linux/jiffies.h> +#include <linux/module.h> #include <linux/pci.h> #include <linux/platform_data/dma-dw.h> #include <linux/spi/spi.h> @@ -17,10 +18,10 @@ #include "spi-dw.h" -#define RX_BUSY 0 -#define RX_BURST_LEVEL 16 -#define TX_BUSY 1 -#define TX_BURST_LEVEL 16 +#define DW_SPI_RX_BUSY 0 +#define DW_SPI_RX_BURST_LEVEL 16 +#define DW_SPI_TX_BUSY 1 +#define DW_SPI_TX_BURST_LEVEL 16 static bool dw_spi_dma_chan_filter(struct dma_chan *chan, void *param) { @@ -45,7 +46,7 @@ static void dw_spi_dma_maxburst_init(struct dw_spi *dws) if (!ret && caps.max_burst) max_burst = caps.max_burst; else - max_burst = RX_BURST_LEVEL; + max_burst = DW_SPI_RX_BURST_LEVEL; dws->rxburst = min(max_burst, def_burst); dw_writel(dws, DW_SPI_DMARDLR, dws->rxburst - 1); @@ -54,7 +55,7 @@ static void dw_spi_dma_maxburst_init(struct dw_spi *dws) if (!ret && caps.max_burst) max_burst = caps.max_burst; else - max_burst = TX_BURST_LEVEL; + max_burst = DW_SPI_TX_BURST_LEVEL; /* * Having a Rx DMA channel serviced with higher priority than a Tx DMA @@ -226,13 +227,13 @@ static int dw_spi_dma_wait(struct dw_spi *dws, unsigned int len, u32 speed) static inline bool dw_spi_dma_tx_busy(struct dw_spi *dws) { - return !(dw_readl(dws, DW_SPI_SR) & SR_TF_EMPT); + return !(dw_readl(dws, DW_SPI_SR) & DW_SPI_SR_TF_EMPT); } static int dw_spi_dma_wait_tx_done(struct dw_spi *dws, struct spi_transfer *xfer) { - int retry = SPI_WAIT_RETRIES; + int retry = DW_SPI_WAIT_RETRIES; struct spi_delay delay; u32 nents; @@ -259,8 +260,8 @@ static void dw_spi_dma_tx_done(void *arg) { struct dw_spi *dws = arg; - clear_bit(TX_BUSY, &dws->dma_chan_busy); - if (test_bit(RX_BUSY, &dws->dma_chan_busy)) + clear_bit(DW_SPI_TX_BUSY, &dws->dma_chan_busy); + if (test_bit(DW_SPI_RX_BUSY, &dws->dma_chan_busy)) return; complete(&dws->dma_completion); @@ -304,19 +305,19 @@ static int dw_spi_dma_submit_tx(struct dw_spi *dws, struct scatterlist *sgl, return ret; } - set_bit(TX_BUSY, &dws->dma_chan_busy); + set_bit(DW_SPI_TX_BUSY, &dws->dma_chan_busy); return 0; } static inline bool dw_spi_dma_rx_busy(struct dw_spi *dws) { - return !!(dw_readl(dws, DW_SPI_SR) & SR_RF_NOT_EMPT); + return !!(dw_readl(dws, DW_SPI_SR) & DW_SPI_SR_RF_NOT_EMPT); } static int dw_spi_dma_wait_rx_done(struct dw_spi *dws) { - int retry = SPI_WAIT_RETRIES; + int retry = DW_SPI_WAIT_RETRIES; struct spi_delay delay; unsigned long ns, us; u32 nents; @@ -360,8 +361,8 @@ static void dw_spi_dma_rx_done(void *arg) { struct dw_spi *dws = arg; - clear_bit(RX_BUSY, &dws->dma_chan_busy); - if (test_bit(TX_BUSY, &dws->dma_chan_busy)) + clear_bit(DW_SPI_RX_BUSY, &dws->dma_chan_busy); + if (test_bit(DW_SPI_TX_BUSY, &dws->dma_chan_busy)) return; complete(&dws->dma_completion); @@ -405,7 +406,7 @@ static int dw_spi_dma_submit_rx(struct dw_spi *dws, struct scatterlist *sgl, return ret; } - set_bit(RX_BUSY, &dws->dma_chan_busy); + set_bit(DW_SPI_RX_BUSY, &dws->dma_chan_busy); return 0; } @@ -430,16 +431,16 @@ static int dw_spi_dma_setup(struct dw_spi *dws, struct spi_transfer *xfer) } /* Set the DMA handshaking interface */ - dma_ctrl = SPI_DMA_TDMAE; + dma_ctrl = DW_SPI_DMACR_TDMAE; if (xfer->rx_buf) - dma_ctrl |= SPI_DMA_RDMAE; + dma_ctrl |= DW_SPI_DMACR_RDMAE; dw_writel(dws, DW_SPI_DMACR, dma_ctrl); /* Set the interrupt mask */ - imr = SPI_INT_TXOI; + imr = DW_SPI_INT_TXOI; if (xfer->rx_buf) - imr |= SPI_INT_RXUI | SPI_INT_RXOI; - spi_umask_intr(dws, imr); + imr |= DW_SPI_INT_RXUI | DW_SPI_INT_RXOI; + dw_spi_umask_intr(dws, imr); reinit_completion(&dws->dma_completion); @@ -615,13 +616,13 @@ static int dw_spi_dma_transfer(struct dw_spi *dws, struct spi_transfer *xfer) static void dw_spi_dma_stop(struct dw_spi *dws) { - if (test_bit(TX_BUSY, &dws->dma_chan_busy)) { + if (test_bit(DW_SPI_TX_BUSY, &dws->dma_chan_busy)) { dmaengine_terminate_sync(dws->txchan); - clear_bit(TX_BUSY, &dws->dma_chan_busy); + clear_bit(DW_SPI_TX_BUSY, &dws->dma_chan_busy); } - if (test_bit(RX_BUSY, &dws->dma_chan_busy)) { + if (test_bit(DW_SPI_RX_BUSY, &dws->dma_chan_busy)) { dmaengine_terminate_sync(dws->rxchan); - clear_bit(RX_BUSY, &dws->dma_chan_busy); + clear_bit(DW_SPI_RX_BUSY, &dws->dma_chan_busy); } } @@ -638,7 +639,7 @@ void dw_spi_dma_setup_mfld(struct dw_spi *dws) { dws->dma_ops = &dw_spi_dma_mfld_ops; } -EXPORT_SYMBOL_GPL(dw_spi_dma_setup_mfld); +EXPORT_SYMBOL_NS_GPL(dw_spi_dma_setup_mfld, SPI_DW_CORE); static const struct dw_spi_dma_ops dw_spi_dma_generic_ops = { .dma_init = dw_spi_dma_init_generic, @@ -653,4 +654,4 @@ void dw_spi_dma_setup_generic(struct dw_spi *dws) { dws->dma_ops = &dw_spi_dma_generic_ops; } -EXPORT_SYMBOL_GPL(dw_spi_dma_setup_generic); +EXPORT_SYMBOL_NS_GPL(dw_spi_dma_setup_generic, SPI_DW_CORE); |