lkml.org 
[lkml]   [2013]   [Feb]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH v7 08/10] spi: omap2-mcspi: convert to dma_request_slave_channel_compat()
    Date
    Convert dmaengine channel requests to use
    dma_request_slave_channel_compat(). This supports the DT case of
    platforms requiring channel selection from either the OMAP DMA or
    the EDMA engine. AM33xx only boots from DT and is the only user
    implementing EDMA so in the !DT case we can default to the OMAP DMA
    filter.

    Signed-off-by: Matt Porter <mporter@ti.com>
    Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
    ---
    drivers/spi/spi-omap2-mcspi.c | 65 ++++++++++++++++++++++++++++-------------
    1 file changed, 45 insertions(+), 20 deletions(-)

    diff --git a/drivers/spi/spi-omap2-mcspi.c b/drivers/spi/spi-omap2-mcspi.c
    index b610f52..2c02c02 100644
    --- a/drivers/spi/spi-omap2-mcspi.c
    +++ b/drivers/spi/spi-omap2-mcspi.c
    @@ -102,6 +102,9 @@ struct omap2_mcspi_dma {

    struct completion dma_tx_completion;
    struct completion dma_rx_completion;
    +
    + char dma_rx_ch_name[14];
    + char dma_tx_ch_name[14];
    };

    /* use PIO for small transfers, avoiding DMA setup/teardown overhead and
    @@ -822,14 +825,23 @@ static int omap2_mcspi_request_dma(struct spi_device *spi)
    dma_cap_zero(mask);
    dma_cap_set(DMA_SLAVE, mask);
    sig = mcspi_dma->dma_rx_sync_dev;
    - mcspi_dma->dma_rx = dma_request_channel(mask, omap_dma_filter_fn, &sig);
    +
    + mcspi_dma->dma_rx =
    + dma_request_slave_channel_compat(mask, omap_dma_filter_fn,
    + &sig, &master->dev,
    + mcspi_dma->dma_rx_ch_name);
    +
    if (!mcspi_dma->dma_rx) {
    dev_err(&spi->dev, "no RX DMA engine channel for McSPI\n");
    return -EAGAIN;
    }

    sig = mcspi_dma->dma_tx_sync_dev;
    - mcspi_dma->dma_tx = dma_request_channel(mask, omap_dma_filter_fn, &sig);
    + mcspi_dma->dma_tx =
    + dma_request_slave_channel_compat(mask, omap_dma_filter_fn,
    + &sig, &master->dev,
    + mcspi_dma->dma_tx_ch_name);
    +
    if (!mcspi_dma->dma_tx) {
    dev_err(&spi->dev, "no TX DMA engine channel for McSPI\n");
    dma_release_channel(mcspi_dma->dma_rx);
    @@ -1223,29 +1235,42 @@ static int omap2_mcspi_probe(struct platform_device *pdev)
    goto free_master;

    for (i = 0; i < master->num_chipselect; i++) {
    - char dma_ch_name[14];
    + char *dma_rx_ch_name = mcspi->dma_channels[i].dma_rx_ch_name;
    + char *dma_tx_ch_name = mcspi->dma_channels[i].dma_tx_ch_name;
    struct resource *dma_res;

    - sprintf(dma_ch_name, "rx%d", i);
    - dma_res = platform_get_resource_byname(pdev, IORESOURCE_DMA,
    - dma_ch_name);
    - if (!dma_res) {
    - dev_dbg(&pdev->dev, "cannot get DMA RX channel\n");
    - status = -ENODEV;
    - break;
    - }
    + sprintf(dma_rx_ch_name, "rx%d", i);
    + if (!pdev->dev.of_node) {
    + dma_res =
    + platform_get_resource_byname(pdev,
    + IORESOURCE_DMA,
    + dma_rx_ch_name);
    + if (!dma_res) {
    + dev_dbg(&pdev->dev,
    + "cannot get DMA RX channel\n");
    + status = -ENODEV;
    + break;
    + }

    - mcspi->dma_channels[i].dma_rx_sync_dev = dma_res->start;
    - sprintf(dma_ch_name, "tx%d", i);
    - dma_res = platform_get_resource_byname(pdev, IORESOURCE_DMA,
    - dma_ch_name);
    - if (!dma_res) {
    - dev_dbg(&pdev->dev, "cannot get DMA TX channel\n");
    - status = -ENODEV;
    - break;
    + mcspi->dma_channels[i].dma_rx_sync_dev =
    + dma_res->start;
    }
    + sprintf(dma_tx_ch_name, "tx%d", i);
    + if (!pdev->dev.of_node) {
    + dma_res =
    + platform_get_resource_byname(pdev,
    + IORESOURCE_DMA,
    + dma_tx_ch_name);
    + if (!dma_res) {
    + dev_dbg(&pdev->dev,
    + "cannot get DMA TX channel\n");
    + status = -ENODEV;
    + break;
    + }

    - mcspi->dma_channels[i].dma_tx_sync_dev = dma_res->start;
    + mcspi->dma_channels[i].dma_tx_sync_dev =
    + dma_res->start;
    + }
    }

    if (status < 0)
    --
    1.7.9.5


    \
     
     \ /
      Last update: 2013-02-01 20:01    [W:3.044 / U:0.048 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site