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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Heiner,

Heiner Kallweit <hkallweit1@xxxxxxxxx> writes:

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

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

--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux USB Devel]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux