]> Pileus Git - ~andy/linux/blobdiff - drivers/spi/spi-davinci.c
Merge remote-tracking branch 'spi/topic/tle62x0' into spi-next
[~andy/linux] / drivers / spi / spi-davinci.c
index 50b13c9b1ab691fd5defcae44b98dc4bfccb5557..8fbfe2483ffdd12c20683e50194877c1a1ac85ca 100644 (file)
@@ -299,16 +299,15 @@ static int davinci_spi_setup_transfer(struct spi_device *spi,
         * Assign function pointer to appropriate transfer method
         * 8bit, 16bit or 32bit transfer
         */
-       if (bits_per_word <= 8 && bits_per_word >= 2) {
+       if (bits_per_word <= 8) {
                dspi->get_rx = davinci_spi_rx_buf_u8;
                dspi->get_tx = davinci_spi_tx_buf_u8;
                dspi->bytes_per_word[spi->chip_select] = 1;
-       } else if (bits_per_word <= 16 && bits_per_word >= 2) {
+       } else {
                dspi->get_rx = davinci_spi_rx_buf_u16;
                dspi->get_tx = davinci_spi_tx_buf_u16;
                dspi->bytes_per_word[spi->chip_select] = 2;
-       } else
-               return -EINVAL;
+       }
 
        if (!hz)
                hz = spi->max_speed_hz;
@@ -610,7 +609,7 @@ static int davinci_spi_bufs(struct spi_device *spi, struct spi_transfer *t)
                else
                        buf = (void *)t->tx_buf;
                t->tx_dma = dma_map_single(&spi->dev, buf,
-                               t->len, DMA_FROM_DEVICE);
+                               t->len, DMA_TO_DEVICE);
                if (!t->tx_dma) {
                        ret = -EFAULT;
                        goto err_tx_map;
@@ -865,7 +864,7 @@ static int davinci_spi_probe(struct platform_device *pdev)
                goto err;
        }
 
-       dev_set_drvdata(&pdev->dev, master);
+       platform_set_drvdata(pdev, master);
 
        dspi = spi_master_get_devdata(master);
        if (dspi == NULL) {
@@ -873,8 +872,8 @@ static int davinci_spi_probe(struct platform_device *pdev)
                goto free_master;
        }
 
-       if (pdev->dev.platform_data) {
-               pdata = pdev->dev.platform_data;
+       if (dev_get_platdata(&pdev->dev)) {
+               pdata = dev_get_platdata(&pdev->dev);
                dspi->pdata = *pdata;
        } else {
                /* update dspi pdata with that from the DT */
@@ -933,6 +932,7 @@ static int davinci_spi_probe(struct platform_device *pdev)
        master->dev.of_node = pdev->dev.of_node;
        master->bus_num = pdev->id;
        master->num_chipselect = pdata->num_chipselect;
+       master->bits_per_word_mask = SPI_BPW_RANGE_MASK(2, 16);
        master->setup = davinci_spi_setup;
 
        dspi->bitbang.chipselect = davinci_spi_chipselect;
@@ -1044,7 +1044,7 @@ static int davinci_spi_remove(struct platform_device *pdev)
        struct spi_master *master;
        struct resource *r;
 
-       master = dev_get_drvdata(&pdev->dev);
+       master = platform_get_drvdata(pdev);
        dspi = spi_master_get_devdata(master);
 
        spi_bitbang_stop(&dspi->bitbang);