aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Mundt <lethal@linux-sh.org>2010-01-20 15:49:45 -0500
committerGrant Likely <grant.likely@secretlab.ca>2010-01-20 15:49:45 -0500
commit9778214990af88ec6720bd771d7fc0fa1b140b02 (patch)
tree64f4f5550795ae5e4c81fcbb49bb5266c677a2f4
parentf4d4ecfe788b4141d8c90cfc3ac2831f620f5c1b (diff)
spi: xilinx_spi: Fix up I/O routine wrapping bogosity.
xilinx_spi presently makes some fairly questionable assumptions about I/O routines, and attempts to assign ioread32/iowrite32 and friends directly to its own internal function pointers. On many platforms these I/O routines are macros or wrappers and not actual functions on their own, resulting in things like: ERROR: "ioread32be" [drivers/spi/xilinx_spi.ko] undefined! ERROR: "iowrite32be" [drivers/spi/xilinx_spi.ko] undefined! ERROR: "iowrite32" [drivers/spi/xilinx_spi.ko] undefined! ERROR: "ioread32" [drivers/spi/xilinx_spi.ko] undefined! If xilinx_spi wants to do this sort of casting, it needs to provide its own wrappers for these, or change how it does accesses completely. I've opted for the first approach, and the attached silly patch does that. If someone with the hardware available wants to give the second option a try that's ok too. In any event, the current code is broken for at least: arm, avr32, blackfin, microblaze, mn10300, and sh. Signed-off-by: Paul Mundt <lethal@linux-sh.org> Acked-by: Richard Röjfors <richard.rojfors@pelagicore.com> Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
-rw-r--r--drivers/spi/xilinx_spi.c28
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
96static void xspi_write32(u32 val, void __iomem *addr)
97{
98 iowrite32(val, addr);
99}
100
101static unsigned int xspi_read32(void __iomem *addr)
102{
103 return ioread32(addr);
104}
105
106static void xspi_write32_be(u32 val, void __iomem *addr)
107{
108 iowrite32be(val, addr);
109}
110
111static unsigned int xspi_read32_be(void __iomem *addr)
112{
113 return ioread32be(addr);
114}
115
96static void xspi_tx8(struct xilinx_spi *xspi) 116static 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) {