aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/spi/xilinx_spi.c
diff options
context:
space:
mode:
authorGrant Likely <grant.likely@secretlab.ca>2010-10-14 10:54:55 -0400
committerGrant Likely <grant.likely@secretlab.ca>2010-11-09 23:41:27 -0500
commit91565c4068042b3d8e37e64e393ca105476419bd (patch)
tree3281cb89e60641766c8cfe94ebf4fbe47baa54f0 /drivers/spi/xilinx_spi.c
parentf6614b7bb405a9b35dd28baea989a749492c46b2 (diff)
spi/xilinx: Eliminate pdata references from common code.
The current code has the OF binding modifying the platform_data pointer which it must not do, and the common code doesn't really need to use a pdata pointer. This patch eliminates the platform_data references from the common part of the driver in preparation for merging the OF and non-OF versions. Signed-off-by: Grant Likely <grant.likely@secretlab.ca> Tested-by: Michal Simek <monstr@monstr.eu>
Diffstat (limited to 'drivers/spi/xilinx_spi.c')
-rw-r--r--drivers/spi/xilinx_spi.c14
1 files changed, 4 insertions, 10 deletions
diff --git a/drivers/spi/xilinx_spi.c b/drivers/spi/xilinx_spi.c
index 80f2db5bcfd6..efb28ba4a4ec 100644
--- a/drivers/spi/xilinx_spi.c
+++ b/drivers/spi/xilinx_spi.c
@@ -351,18 +351,12 @@ static irqreturn_t xilinx_spi_irq(int irq, void *dev_id)
351} 351}
352 352
353struct spi_master *xilinx_spi_init(struct device *dev, struct resource *mem, 353struct spi_master *xilinx_spi_init(struct device *dev, struct resource *mem,
354 u32 irq, s16 bus_num) 354 u32 irq, s16 bus_num, int num_cs, int little_endian, int bits_per_word)
355{ 355{
356 struct spi_master *master; 356 struct spi_master *master;
357 struct xilinx_spi *xspi; 357 struct xilinx_spi *xspi;
358 struct xspi_platform_data *pdata = dev->platform_data;
359 int ret; 358 int ret;
360 359
361 if (!pdata) {
362 dev_err(dev, "No platform data attached\n");
363 return NULL;
364 }
365
366 master = spi_alloc_master(dev, sizeof(struct xilinx_spi)); 360 master = spi_alloc_master(dev, sizeof(struct xilinx_spi));
367 if (!master) 361 if (!master)
368 return NULL; 362 return NULL;
@@ -389,21 +383,21 @@ struct spi_master *xilinx_spi_init(struct device *dev, struct resource *mem,
389 } 383 }
390 384
391 master->bus_num = bus_num; 385 master->bus_num = bus_num;
392 master->num_chipselect = pdata->num_chipselect; 386 master->num_chipselect = num_cs;
393#ifdef CONFIG_OF 387#ifdef CONFIG_OF
394 master->dev.of_node = dev->of_node; 388 master->dev.of_node = dev->of_node;
395#endif 389#endif
396 390
397 xspi->mem = *mem; 391 xspi->mem = *mem;
398 xspi->irq = irq; 392 xspi->irq = irq;
399 if (pdata->little_endian) { 393 if (little_endian) {
400 xspi->read_fn = xspi_read32; 394 xspi->read_fn = xspi_read32;
401 xspi->write_fn = xspi_write32; 395 xspi->write_fn = xspi_write32;
402 } else { 396 } else {
403 xspi->read_fn = xspi_read32_be; 397 xspi->read_fn = xspi_read32_be;
404 xspi->write_fn = xspi_write32_be; 398 xspi->write_fn = xspi_write32_be;
405 } 399 }
406 xspi->bits_per_word = pdata->bits_per_word; 400 xspi->bits_per_word = bits_per_word;
407 if (xspi->bits_per_word == 8) { 401 if (xspi->bits_per_word == 8) {
408 xspi->tx_fn = xspi_tx8; 402 xspi->tx_fn = xspi_tx8;
409 xspi->rx_fn = xspi_rx8; 403 xspi->rx_fn = xspi_rx8;