From: khilman@baylibre.com (Kevin Hilman)
To: linus-amlogic@lists.infradead.org
Subject: [PATCH 5/5] mmc: meson-gx: switch to descriptor chain mode
Date: Fri, 24 Mar 2017 12:04:02 -0700 [thread overview]
Message-ID: <m2bmsqijj1.fsf@baylibre.com> (raw)
In-Reply-To: <57af6536-edf9-a2aa-40fe-a90338245d0e@gmail.com> (Heiner Kallweit's message of "Wed, 15 Mar 2017 20:34:46 +0100")
Hi Heiner,
Heiner Kallweit <hkallweit1@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@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
WARNING: multiple messages have this Message-ID (diff)
From: Kevin Hilman <khilman@baylibre.com>
To: Heiner Kallweit <hkallweit1@gmail.com>
Cc: Ulf Hansson <ulf.hansson@linaro.org>,
"linux-mmc@vger.kernel.org" <linux-mmc@vger.kernel.org>,
linux-amlogic@lists.infradead.org
Subject: Re: [PATCH 5/5] mmc: meson-gx: switch to descriptor chain mode
Date: Fri, 24 Mar 2017 12:04:02 -0700 [thread overview]
Message-ID: <m2bmsqijj1.fsf@baylibre.com> (raw)
In-Reply-To: <57af6536-edf9-a2aa-40fe-a90338245d0e@gmail.com> (Heiner Kallweit's message of "Wed, 15 Mar 2017 20:34:46 +0100")
Hi Heiner,
Heiner Kallweit <hkallweit1@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@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
next prev parent reply other threads:[~2017-03-24 19:04 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-03-15 19:16 [PATCH 0/5] mmc: meson-gx: add cmd23 and descriptor chain mode Heiner Kallweit
2017-03-15 19:16 ` Heiner Kallweit
2017-03-15 19:33 ` [PATCH 1/5] mmc: meson-gx: switch irq name to DT node name Heiner Kallweit
2017-03-15 19:33 ` Heiner Kallweit
2017-03-15 19:33 ` [PATCH 2/5] mmc: meson-gx: improve response reading Heiner Kallweit
2017-03-15 19:33 ` Heiner Kallweit
2017-03-15 19:34 ` [PATCH 3/5] mmc: meson-gx: use block mode also for just one block Heiner Kallweit
2017-03-15 19:34 ` Heiner Kallweit
2017-03-15 19:34 ` [PATCH 4/5] mmc: meson-gx: add support for CMD23 mode Heiner Kallweit
2017-03-15 19:34 ` Heiner Kallweit
2017-03-15 19:34 ` [PATCH 5/5] mmc: meson-gx: switch to descriptor chain mode Heiner Kallweit
2017-03-15 19:34 ` Heiner Kallweit
2017-03-24 19:04 ` Kevin Hilman [this message]
2017-03-24 19:04 ` Kevin Hilman
2017-03-24 7:27 ` [PATCH 0/5] mmc: meson-gx: add cmd23 and " Ulf Hansson
2017-03-24 7:27 ` Ulf Hansson
2017-03-24 18:00 ` Heiner Kallweit
2017-03-24 18:00 ` Heiner Kallweit
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=m2bmsqijj1.fsf@baylibre.com \
--to=khilman@baylibre.com \
--cc=linus-amlogic@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.