[PATCH 5/5] mmc: meson-gx: switch to descriptor chain mode

Kevin Hilman khilman at baylibre.com
Fri Mar 24 12:04:02 PDT 2017


Hi Heiner,

Heiner Kallweit <hkallweit1 at gmail.com> writes:

> Switch the driver from using a linearized bounce buffer to descriptor
> chain mode. This drastically improves performance.
>
> Signed-off-by: Heiner Kallweit <hkallweit1 at gmail.com>

I know this series needs a respin on top of your other cleanups, and
I'll have a closer look at it then, but one comment for the respin...

[...]

>  static int meson_mmc_probe(struct platform_device *pdev)
> @@ -764,15 +790,14 @@ static int meson_mmc_probe(struct platform_device *pdev)
>  
>  	mmc->caps |= MMC_CAP_CMD23;
>  	mmc->max_blk_count = CMD_CFG_LENGTH_MASK;
> -	mmc->max_req_size = mmc->max_blk_count * mmc->max_blk_size;
> -
> -	/* data bounce buffer */
> -	host->bounce_buf_size = mmc->max_req_size;
> -	host->bounce_buf =
> -		dma_alloc_coherent(host->dev, host->bounce_buf_size,
> -				   &host->bounce_dma_addr, GFP_KERNEL);
> -	if (host->bounce_buf == NULL) {
> -		dev_err(host->dev, "Unable to map allocate DMA bounce buffer.\n");
> +	mmc->max_segs = PAGE_SIZE / sizeof(struct sd_emmc_desc);
> +	mmc->max_seg_size = mmc->max_blk_count * mmc->max_blk_size;
> +	mmc->max_req_size = mmc->max_seg_size * mmc->max_segs;
> +
> +	host->descs = dma_alloc_coherent(host->dev, PAGE_SIZE,
> +					 &host->descs_dma_addr, GFP_KERNEL);
> +	if (!host->descs) {
> +		dev_err(host->dev, "Allocating descriptor DMA buffer failed\n");
>  		ret = -ENOMEM;
>  		goto err_div_clk;
>  	}
> @@ -797,8 +822,8 @@ static int meson_mmc_remove(struct platform_device *pdev)
>  	/* disable interrupts */
>  	writel(0, host->regs + SD_EMMC_IRQ_EN);
>  
> -	dma_free_coherent(host->dev, host->bounce_buf_size,
> -			  host->bounce_buf, host->bounce_dma_addr);
> +	dma_free_coherent(host->dev, PAGE_SIZE, host->descs,
> +			  host->descs_dma_addr);
>  
>  	clk_disable_unprepare(host->cfg_div_clk);
>  	clk_disable_unprepare(host->core_clk);

Please replace the usage of PAGE_SIZE above with a #define at the top of
the driver for the max number of descriptors/segments.  Right now, if
you wanted to change that, you'd have to change it in at least three
places.

Kevin




More information about the linux-amlogic mailing list