Skip to content

Commit

Permalink
mmc: omap_hsmmc: set max_segs based on dma engine limitations
Browse files Browse the repository at this point in the history
The EDMA DMAC has a hardware limitation that prevents supporting
scatter gather lists with any number of segments. The DMA Engine
API reports the maximum number of segments a channel can support
via the optional dma_get_channel_caps() API. If the nr_segs
capability is present, the value is used to configure mmc->max_segs
appropriately.

Signed-off-by: Matt Porter <mporter@ti.com>
  • Loading branch information
Matt Porter committed Jan 11, 2013
1 parent 526a1f7 commit b4c9220
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions drivers/mmc/host/omap_hsmmc.c
Original file line number Diff line number Diff line change
Expand Up @@ -1769,6 +1769,7 @@ static int omap_hsmmc_probe(struct platform_device *pdev)
const struct of_device_id *match;
dma_cap_mask_t mask;
unsigned tx_req, rx_req;
struct dmaengine_chan_caps *dma_chan_caps;
struct pinctrl *pinctrl;

match = of_match_device(of_match_ptr(omap_mmc_of_match), &pdev->dev);
Expand Down Expand Up @@ -1935,6 +1936,11 @@ static int omap_hsmmc_probe(struct platform_device *pdev)
goto err_irq;
}

/* Some DMA Engines only handle a limited number of SG segments */
dma_chan_caps = dma_get_channel_caps(host->rx_chan, DMA_DEV_TO_MEM);
if (dma_chan_caps && dma_chan_caps->seg_nr)
mmc->max_segs = dma_chan_caps->seg_nr;

/* Request IRQ for MMC operations */
ret = request_irq(host->irq, omap_hsmmc_irq, 0,
mmc_hostname(mmc), host);
Expand Down

0 comments on commit b4c9220

Please sign in to comment.