Merge remote-tracking branch 'spi/topic/rspi' into spi-pdata
[deliverable/linux.git] / drivers / spi / spi-xilinx.c
index e5d3716da21a0cfe5a8c830fcdc53e3cb0bbe4e0..08ea84a6eb3283418484d4012298271ec6ab77ae 100644 (file)
@@ -82,7 +82,7 @@ struct xilinx_spi {
        struct completion done;
        void __iomem    *regs;  /* virt. address of the control registers */
 
-       u32             irq;
+       int             irq;
 
        u8 *rx_ptr;             /* pointer in the Tx buffer */
        const u8 *tx_ptr;       /* pointer in the Rx buffer */
@@ -232,6 +232,21 @@ static int xilinx_spi_setup_transfer(struct spi_device *spi,
        return 0;
 }
 
+static int xilinx_spi_setup(struct spi_device *spi)
+{
+       /* always return 0, we can not check the number of bits.
+        * There are cases when SPI setup is called before any driver is
+        * there, in that case the SPI core defaults to 8 bits, which we
+        * do not support in some cases. But if we return an error, the
+        * SPI device would not be registered and no driver can get hold of it
+        * When the driver is there, it will call SPI setup again with the
+        * correct number of bits per transfer.
+        * If a driver setups with the wrong bit number, it will fail when
+        * it tries to do a transfer
+        */
+       return 0;
+}
+
 static void xilinx_spi_fill_tx_fifo(struct xilinx_spi *xspi)
 {
        u8 sr;
@@ -349,7 +364,7 @@ static int xilinx_spi_probe(struct platform_device *pdev)
        u32 tmp;
        u8 i;
 
-       pdata = pdev->dev.platform_data;
+       pdata = dev_get_platdata(&pdev->dev);
        if (pdata) {
                num_cs = pdata->num_chipselect;
                bits_per_word = pdata->bits_per_word;
@@ -376,6 +391,7 @@ static int xilinx_spi_probe(struct platform_device *pdev)
        xspi->bitbang.chipselect = xilinx_spi_chipselect;
        xspi->bitbang.setup_transfer = xilinx_spi_setup_transfer;
        xspi->bitbang.txrx_bufs = xilinx_spi_txrx_bufs;
+       xspi->bitbang.master->setup = xilinx_spi_setup;
        init_completion(&xspi->done);
 
        res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
This page took 0.023842 seconds and 5 git commands to generate.