diff options
Diffstat (limited to 'drivers/spi/xilinx_spi.c')
-rw-r--r-- | drivers/spi/xilinx_spi.c | 28 |
1 files changed, 24 insertions, 4 deletions
diff --git a/drivers/spi/xilinx_spi.c b/drivers/spi/xilinx_spi.c index 9f386379c169..1b47363cb73f 100644 --- a/drivers/spi/xilinx_spi.c +++ b/drivers/spi/xilinx_spi.c | |||
@@ -93,6 +93,26 @@ struct xilinx_spi { | |||
93 | void (*rx_fn) (struct xilinx_spi *); | 93 | void (*rx_fn) (struct xilinx_spi *); |
94 | }; | 94 | }; |
95 | 95 | ||
96 | static void xspi_write32(u32 val, void __iomem *addr) | ||
97 | { | ||
98 | iowrite32(val, addr); | ||
99 | } | ||
100 | |||
101 | static unsigned int xspi_read32(void __iomem *addr) | ||
102 | { | ||
103 | return ioread32(addr); | ||
104 | } | ||
105 | |||
106 | static void xspi_write32_be(u32 val, void __iomem *addr) | ||
107 | { | ||
108 | iowrite32be(val, addr); | ||
109 | } | ||
110 | |||
111 | static unsigned int xspi_read32_be(void __iomem *addr) | ||
112 | { | ||
113 | return ioread32be(addr); | ||
114 | } | ||
115 | |||
96 | static void xspi_tx8(struct xilinx_spi *xspi) | 116 | static void xspi_tx8(struct xilinx_spi *xspi) |
97 | { | 117 | { |
98 | xspi->write_fn(*xspi->tx_ptr, xspi->regs + XSPI_TXD_OFFSET); | 118 | xspi->write_fn(*xspi->tx_ptr, xspi->regs + XSPI_TXD_OFFSET); |
@@ -374,11 +394,11 @@ struct spi_master *xilinx_spi_init(struct device *dev, struct resource *mem, | |||
374 | xspi->mem = *mem; | 394 | xspi->mem = *mem; |
375 | xspi->irq = irq; | 395 | xspi->irq = irq; |
376 | if (pdata->little_endian) { | 396 | if (pdata->little_endian) { |
377 | xspi->read_fn = ioread32; | 397 | xspi->read_fn = xspi_read32; |
378 | xspi->write_fn = iowrite32; | 398 | xspi->write_fn = xspi_write32; |
379 | } else { | 399 | } else { |
380 | xspi->read_fn = ioread32be; | 400 | xspi->read_fn = xspi_read32_be; |
381 | xspi->write_fn = iowrite32be; | 401 | xspi->write_fn = xspi_write32_be; |
382 | } | 402 | } |
383 | xspi->bits_per_word = pdata->bits_per_word; | 403 | xspi->bits_per_word = pdata->bits_per_word; |
384 | if (xspi->bits_per_word == 8) { | 404 | if (xspi->bits_per_word == 8) { |