diff options
| -rw-r--r-- | drivers/spi/spi-omap2-mcspi.c | 64 |
1 files changed, 44 insertions, 20 deletions
diff --git a/drivers/spi/spi-omap2-mcspi.c b/drivers/spi/spi-omap2-mcspi.c index 6802806d1f18..bb9afc3f043b 100644 --- a/drivers/spi/spi-omap2-mcspi.c +++ b/drivers/spi/spi-omap2-mcspi.c | |||
| @@ -109,6 +109,9 @@ struct omap2_mcspi_dma { | |||
| 109 | 109 | ||
| 110 | struct completion dma_tx_completion; | 110 | struct completion dma_tx_completion; |
| 111 | struct completion dma_rx_completion; | 111 | struct completion dma_rx_completion; |
| 112 | |||
| 113 | char dma_rx_ch_name[14]; | ||
| 114 | char dma_tx_ch_name[14]; | ||
| 112 | }; | 115 | }; |
| 113 | 116 | ||
| 114 | /* use PIO for small transfers, avoiding DMA setup/teardown overhead and | 117 | /* use PIO for small transfers, avoiding DMA setup/teardown overhead and |
| @@ -936,12 +939,20 @@ static int omap2_mcspi_request_dma(struct spi_device *spi) | |||
| 936 | dma_cap_zero(mask); | 939 | dma_cap_zero(mask); |
| 937 | dma_cap_set(DMA_SLAVE, mask); | 940 | dma_cap_set(DMA_SLAVE, mask); |
| 938 | sig = mcspi_dma->dma_rx_sync_dev; | 941 | sig = mcspi_dma->dma_rx_sync_dev; |
| 939 | mcspi_dma->dma_rx = dma_request_channel(mask, omap_dma_filter_fn, &sig); | 942 | |
| 943 | mcspi_dma->dma_rx = | ||
| 944 | dma_request_slave_channel_compat(mask, omap_dma_filter_fn, | ||
| 945 | &sig, &master->dev, | ||
| 946 | mcspi_dma->dma_rx_ch_name); | ||
| 940 | if (!mcspi_dma->dma_rx) | 947 | if (!mcspi_dma->dma_rx) |
| 941 | goto no_dma; | 948 | goto no_dma; |
| 942 | 949 | ||
| 943 | sig = mcspi_dma->dma_tx_sync_dev; | 950 | sig = mcspi_dma->dma_tx_sync_dev; |
| 944 | mcspi_dma->dma_tx = dma_request_channel(mask, omap_dma_filter_fn, &sig); | 951 | mcspi_dma->dma_tx = |
| 952 | dma_request_slave_channel_compat(mask, omap_dma_filter_fn, | ||
| 953 | &sig, &master->dev, | ||
| 954 | mcspi_dma->dma_tx_ch_name); | ||
| 955 | |||
| 945 | if (!mcspi_dma->dma_tx) { | 956 | if (!mcspi_dma->dma_tx) { |
| 946 | dma_release_channel(mcspi_dma->dma_rx); | 957 | dma_release_channel(mcspi_dma->dma_rx); |
| 947 | mcspi_dma->dma_rx = NULL; | 958 | mcspi_dma->dma_rx = NULL; |
| @@ -1374,29 +1385,42 @@ static int omap2_mcspi_probe(struct platform_device *pdev) | |||
| 1374 | goto free_master; | 1385 | goto free_master; |
| 1375 | 1386 | ||
| 1376 | for (i = 0; i < master->num_chipselect; i++) { | 1387 | for (i = 0; i < master->num_chipselect; i++) { |
| 1377 | char dma_ch_name[14]; | 1388 | char *dma_rx_ch_name = mcspi->dma_channels[i].dma_rx_ch_name; |
| 1389 | char *dma_tx_ch_name = mcspi->dma_channels[i].dma_tx_ch_name; | ||
| 1378 | struct resource *dma_res; | 1390 | struct resource *dma_res; |
| 1379 | 1391 | ||
| 1380 | sprintf(dma_ch_name, "rx%d", i); | 1392 | sprintf(dma_rx_ch_name, "rx%d", i); |
| 1381 | dma_res = platform_get_resource_byname(pdev, IORESOURCE_DMA, | 1393 | if (!pdev->dev.of_node) { |
| 1382 | dma_ch_name); | 1394 | dma_res = |
| 1383 | if (!dma_res) { | 1395 | platform_get_resource_byname(pdev, |
| 1384 | dev_dbg(&pdev->dev, "cannot get DMA RX channel\n"); | 1396 | IORESOURCE_DMA, |
| 1385 | status = -ENODEV; | 1397 | dma_rx_ch_name); |
| 1386 | break; | 1398 | if (!dma_res) { |
| 1387 | } | 1399 | dev_dbg(&pdev->dev, |
| 1400 | "cannot get DMA RX channel\n"); | ||
| 1401 | status = -ENODEV; | ||
| 1402 | break; | ||
| 1403 | } | ||
| 1388 | 1404 | ||
| 1389 | mcspi->dma_channels[i].dma_rx_sync_dev = dma_res->start; | 1405 | mcspi->dma_channels[i].dma_rx_sync_dev = |
| 1390 | sprintf(dma_ch_name, "tx%d", i); | 1406 | dma_res->start; |
| 1391 | dma_res = platform_get_resource_byname(pdev, IORESOURCE_DMA, | ||
| 1392 | dma_ch_name); | ||
| 1393 | if (!dma_res) { | ||
| 1394 | dev_dbg(&pdev->dev, "cannot get DMA TX channel\n"); | ||
| 1395 | status = -ENODEV; | ||
| 1396 | break; | ||
| 1397 | } | 1407 | } |
| 1408 | sprintf(dma_tx_ch_name, "tx%d", i); | ||
| 1409 | if (!pdev->dev.of_node) { | ||
| 1410 | dma_res = | ||
| 1411 | platform_get_resource_byname(pdev, | ||
| 1412 | IORESOURCE_DMA, | ||
| 1413 | dma_tx_ch_name); | ||
| 1414 | if (!dma_res) { | ||
| 1415 | dev_dbg(&pdev->dev, | ||
| 1416 | "cannot get DMA TX channel\n"); | ||
| 1417 | status = -ENODEV; | ||
| 1418 | break; | ||
| 1419 | } | ||
| 1398 | 1420 | ||
| 1399 | mcspi->dma_channels[i].dma_tx_sync_dev = dma_res->start; | 1421 | mcspi->dma_channels[i].dma_tx_sync_dev = |
| 1422 | dma_res->start; | ||
| 1423 | } | ||
| 1400 | } | 1424 | } |
| 1401 | 1425 | ||
| 1402 | if (status < 0) | 1426 | if (status < 0) |
