lkml.org 
[lkml]   [2019]   [May]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH 2/3] mmc: meson-gx: add ddr-access-quirk
Hi Neil,

On Mon, May 13, 2019 at 11:16 AM Neil Armstrong <narmstrong@baylibre.com> wrote:
[...]
> @@ -1158,15 +1183,27 @@ static int meson_mmc_probe(struct platform_device *pdev)
> */
> mmc->caps2 &= ~MMC_CAP2_HS400;
>
> - /* 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");
> - ret = -ENOMEM;
> - goto err_free_irq;
> + if (host->ddr_access_quirk) {
> + /*
> + * The MMC Controller embeds 1,5KiB of internal SRAM
> + * that can be used to be used as bounce buffer.
> + * In the case of the G12A SDIO controller, use these
> + * instead of the DDR memory
> + */
> + host->bounce_buf_size = SD_EMMC_SRAM_DATA_BUF_LEN;
> + host->bounce_buf = host->regs + SD_EMMC_SRAM_DATA_BUF_OFF;
> + host->bounce_dma_addr = res->start + SD_EMMC_SRAM_DATA_BUF_OFF;
I'm curious: why do you need to set bounce_dma_addr in this case?

> + } else {
> + /* 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");
> + ret = -ENOMEM;
> + goto err_free_irq;
> + }
> }
>
> host->descs = dma_alloc_coherent(host->dev, SD_EMMC_DESC_BUF_LEN,
if host->descs cannot be allocated then you need to conditionally skip
dma_free_coherent for the bounce buffer in the goto err_bounce_buf
case a few lines below (just like you did in meson_mmc_remove)


Martin

\
 
 \ /
  Last update: 2019-05-14 19:59    [W:0.157 / U:5.044 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site