Linux-Amlogic Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH] mmc: meson-gx: limit segments to 1 when dram-access-quirk is needed
@ 2020-06-08  8:44 Neil Armstrong
  2020-06-09 14:54 ` Kevin Hilman
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Neil Armstrong @ 2020-06-08  8:44 UTC (permalink / raw)
  To: ulf.hansson
  Cc: Neil Armstrong, Christian Hewitt, linux-mmc, linux-kernel,
	linux-amlogic, Art Nikpal, linux-arm-kernel

The actual max_segs computation leads to failure while using the broadcom
sdio brcmfmac/bcmsdh driver, since the driver tries to make usage of scatter
gather.

But with the dram-access-quirk we use a 1,5K SRAM bounce buffer, and the
max_segs current value of 3 leads to max transfers to 4,5k, which doesn't work.

This patch sets max_segs to 1 to better describe the hardware limitation,
and fix the SDIO functionnality with the brcmfmac/bcmsdh driver on Amlogic
G12A/G12B SoCs on boards like SEI510 or Khadas VIM3.

Reported-by: Art Nikpal <art@khadas.com>
Reported-by: Christian Hewitt <christianshewitt@gmail.com>
Fixes: acdc8e71d9bb ("mmc: meson-gx: add dram-access-quirk")
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
---
 drivers/mmc/host/meson-gx-mmc.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/mmc/host/meson-gx-mmc.c b/drivers/mmc/host/meson-gx-mmc.c
index 35400cf2a2e4..cfaf8e7e22ec 100644
--- a/drivers/mmc/host/meson-gx-mmc.c
+++ b/drivers/mmc/host/meson-gx-mmc.c
@@ -1143,9 +1143,11 @@ static int meson_mmc_probe(struct platform_device *pdev)
 
 	mmc->caps |= MMC_CAP_CMD23;
 	if (host->dram_access_quirk) {
+		/* Limit segments to 1 due to low available sram memory */
+		mmc->max_segs = 1;
 		/* Limit to the available sram memory */
-		mmc->max_segs = SD_EMMC_SRAM_DATA_BUF_LEN / mmc->max_blk_size;
-		mmc->max_blk_count = mmc->max_segs;
+		mmc->max_blk_count = SD_EMMC_SRAM_DATA_BUF_LEN /
+				     mmc->max_blk_size;
 	} else {
 		mmc->max_blk_count = CMD_CFG_LENGTH_MASK;
 		mmc->max_segs = SD_EMMC_DESC_BUF_LEN /
-- 
2.22.0


_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] mmc: meson-gx: limit segments to 1 when dram-access-quirk is needed
  2020-06-08  8:44 [PATCH] mmc: meson-gx: limit segments to 1 when dram-access-quirk is needed Neil Armstrong
@ 2020-06-09 14:54 ` Kevin Hilman
  2020-06-16 11:32 ` Ulf Hansson
  2020-07-13 19:21 ` patchwork-bot+linux-amlogic
  2 siblings, 0 replies; 4+ messages in thread
From: Kevin Hilman @ 2020-06-09 14:54 UTC (permalink / raw)
  To: Neil Armstrong, ulf.hansson
  Cc: Neil Armstrong, Christian Hewitt, linux-mmc, linux-kernel,
	linux-amlogic, Art Nikpal, linux-arm-kernel

Neil Armstrong <narmstrong@baylibre.com> writes:

> The actual max_segs computation leads to failure while using the broadcom
> sdio brcmfmac/bcmsdh driver, since the driver tries to make usage of scatter
> gather.
>
> But with the dram-access-quirk we use a 1,5K SRAM bounce buffer, and the
> max_segs current value of 3 leads to max transfers to 4,5k, which doesn't work.
>
> This patch sets max_segs to 1 to better describe the hardware limitation,
> and fix the SDIO functionnality with the brcmfmac/bcmsdh driver on Amlogic
> G12A/G12B SoCs on boards like SEI510 or Khadas VIM3.
>
> Reported-by: Art Nikpal <art@khadas.com>
> Reported-by: Christian Hewitt <christianshewitt@gmail.com>
> Fixes: acdc8e71d9bb ("mmc: meson-gx: add dram-access-quirk")
> Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>

Reviewed-by: Kevin Hilman <khilman@baylibre.com>

_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] mmc: meson-gx: limit segments to 1 when dram-access-quirk is needed
  2020-06-08  8:44 [PATCH] mmc: meson-gx: limit segments to 1 when dram-access-quirk is needed Neil Armstrong
  2020-06-09 14:54 ` Kevin Hilman
@ 2020-06-16 11:32 ` Ulf Hansson
  2020-07-13 19:21 ` patchwork-bot+linux-amlogic
  2 siblings, 0 replies; 4+ messages in thread
From: Ulf Hansson @ 2020-06-16 11:32 UTC (permalink / raw)
  To: Neil Armstrong
  Cc: linux-mmc, Christian Hewitt, Linux Kernel Mailing List,
	open list:ARM/Amlogic Meson...,
	Art Nikpal, Linux ARM

On Mon, 8 Jun 2020 at 10:45, Neil Armstrong <narmstrong@baylibre.com> wrote:
>
> The actual max_segs computation leads to failure while using the broadcom
> sdio brcmfmac/bcmsdh driver, since the driver tries to make usage of scatter
> gather.
>
> But with the dram-access-quirk we use a 1,5K SRAM bounce buffer, and the
> max_segs current value of 3 leads to max transfers to 4,5k, which doesn't work.
>
> This patch sets max_segs to 1 to better describe the hardware limitation,
> and fix the SDIO functionnality with the brcmfmac/bcmsdh driver on Amlogic
> G12A/G12B SoCs on boards like SEI510 or Khadas VIM3.
>
> Reported-by: Art Nikpal <art@khadas.com>
> Reported-by: Christian Hewitt <christianshewitt@gmail.com>
> Fixes: acdc8e71d9bb ("mmc: meson-gx: add dram-access-quirk")
> Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>

Applied for fixes and by adding a stable tag, thanks!

Kind regards
Uffe


> ---
>  drivers/mmc/host/meson-gx-mmc.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/mmc/host/meson-gx-mmc.c b/drivers/mmc/host/meson-gx-mmc.c
> index 35400cf2a2e4..cfaf8e7e22ec 100644
> --- a/drivers/mmc/host/meson-gx-mmc.c
> +++ b/drivers/mmc/host/meson-gx-mmc.c
> @@ -1143,9 +1143,11 @@ static int meson_mmc_probe(struct platform_device *pdev)
>
>         mmc->caps |= MMC_CAP_CMD23;
>         if (host->dram_access_quirk) {
> +               /* Limit segments to 1 due to low available sram memory */
> +               mmc->max_segs = 1;
>                 /* Limit to the available sram memory */
> -               mmc->max_segs = SD_EMMC_SRAM_DATA_BUF_LEN / mmc->max_blk_size;
> -               mmc->max_blk_count = mmc->max_segs;
> +               mmc->max_blk_count = SD_EMMC_SRAM_DATA_BUF_LEN /
> +                                    mmc->max_blk_size;
>         } else {
>                 mmc->max_blk_count = CMD_CFG_LENGTH_MASK;
>                 mmc->max_segs = SD_EMMC_DESC_BUF_LEN /
> --
> 2.22.0
>

_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] mmc: meson-gx: limit segments to 1 when dram-access-quirk is needed
  2020-06-08  8:44 [PATCH] mmc: meson-gx: limit segments to 1 when dram-access-quirk is needed Neil Armstrong
  2020-06-09 14:54 ` Kevin Hilman
  2020-06-16 11:32 ` Ulf Hansson
@ 2020-07-13 19:21 ` patchwork-bot+linux-amlogic
  2 siblings, 0 replies; 4+ messages in thread
From: patchwork-bot+linux-amlogic @ 2020-07-13 19:21 UTC (permalink / raw)
  To: Neil Armstrong; +Cc: linux-amlogic, khilman

Hello:

This patch was applied to khilman/linux-amlogic.git (refs/heads/for-next).

On Mon,  8 Jun 2020 10:44:58 +0200 you wrote:
> The actual max_segs computation leads to failure while using the broadcom
> sdio brcmfmac/bcmsdh driver, since the driver tries to make usage of scatter
> gather.
> 
> But with the dram-access-quirk we use a 1,5K SRAM bounce buffer, and the
> max_segs current value of 3 leads to max transfers to 4,5k, which doesn't work.
> 
> [...]


Here is a summary with links:
  - mmc: meson-gx: limit segments to 1 when dram-access-quirk is needed
    https://git.kernel.org/khilman/linux-amlogic/c/27a5e7d36d383970affae801d77141deafd536a8

You are awesome, thank you!

-- 
Deet-doot-dot, I am a bot.
https://korg.wiki.kernel.org/userdoc/pwbot

_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, back to index

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-08  8:44 [PATCH] mmc: meson-gx: limit segments to 1 when dram-access-quirk is needed Neil Armstrong
2020-06-09 14:54 ` Kevin Hilman
2020-06-16 11:32 ` Ulf Hansson
2020-07-13 19:21 ` patchwork-bot+linux-amlogic

Linux-Amlogic Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-amlogic/0 linux-amlogic/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-amlogic linux-amlogic/ https://lore.kernel.org/linux-amlogic \
		linux-amlogic@lists.infradead.org
	public-inbox-index linux-amlogic

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.infradead.lists.linux-amlogic


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git