mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Shawn Lin <shawn.lin@rock-chips.com>
To: Kamal Dasu <kamal.dasu@broadcom.com>, Ulf Hansson <ulfh@kernel.org>
Cc: shawn.lin@rock-chips.com,
	Wolfram Sang <wsa+renesas@sang-engineering.com>,
	Avri Altman <avri.altman@sandisk.com>,
	Florian Fainelli <florian.fainelli@broadcom.com>,
	bcm-kernel-feedback-list@broadcom.com, linux-mmc@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] mmc: core: fix host controller programming for fixed driver type
Date: Tue, 21 Apr 2026 10:02:00 +0800	[thread overview]
Message-ID: <b956b5d4-d24c-ea55-8694-b512129fcf03@rock-chips.com> (raw)
In-Reply-To: <20260417210225.3101961-1-kamal.dasu@broadcom.com>

在 2026/04/18 星期六 5:02, Kamal Dasu 写道:
> When using the fixed-emmc-driver-type device tree property, the MMC core
> correctly selects the driver strength for the card but fails to program
> the host controller accordingly. This causes a mismatch where the card
> uses the specified driver type while the host controller defaults to
> Type B (since ios->drv_type remains zero).
> 
> Split the driver type programming logic to handle both fixed and dynamic
> driver type selection paths. For fixed driver types, program the host
> controller with the selected drive_strength value. For dynamic selection,
> use the existing drv_type as before.
> 
> This ensures both the eMMC device and host controller use matching driver
> strengths, preventing potential signal integrity issues.
> 

I agree the host and card drive strengths should match. However, it
highlights a deeper issue: the drv_type(A/B/C/D) is only implemented by
sdhci-based hosts. Many other controllers configure their drive strength
in their GPIO or IOMUX/Pinmux modules, which currently have no
association with ios->drv_type. Moreover, the strength levels defined by
the type A/B/C/D standard may not have a direct mapping to the drive 
strength settings of these modules.

Therefore, the fixed-emmc-driver-type property may have introduced a
"signal configuration gap" from the start: it can specify a type for the 
eMMC device side, but the corresponding drive strength configuration on
the host side may not take effect, or may not even exist. This is not
just a missing driver implementation, but a lack of coordination at the
framework level.

Nevertheless, within the existing framework, this patch is a reasonable
and positive improvement to me. With one suggestion below, feel free to add:

Reviewed-by: Shawn Lin <shawn.lin@rock-chips.com>


> Fixes: 6186d06c519e ("mmc: parse new binding for eMMC fixed driver type")
> Signed-off-by: Kamal Dasu <kamal.dasu@broadcom.com>
> ---
>   drivers/mmc/core/mmc.c | 6 +++++-
>   1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c
> index 8846550a8892..3507a8d8610a 100644
> --- a/drivers/mmc/core/mmc.c
> +++ b/drivers/mmc/core/mmc.c
> @@ -1371,8 +1371,12 @@ static void mmc_select_driver_type(struct mmc_card *card)
>   
>   	card->drive_strength = drive_strength;
>   
> -	if (drv_type)
> +	if (fixed_drv_type >= 0) {

How about check in a single line: if (fixed_drv_type >= 0 && drive_strength)

> +		if (drive_strength)
> +			mmc_set_driver_type(card->host, drive_strength);
> +	} else if (drv_type) {
>   		mmc_set_driver_type(card->host, drv_type);
> +	}
>   }
>   
>   static int mmc_select_hs400es(struct mmc_card *card)

      reply	other threads:[~2026-04-21  2:17 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-17 21:02 Kamal Dasu
2026-04-21  2:02 ` Shawn Lin [this message]

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=b956b5d4-d24c-ea55-8694-b512129fcf03@rock-chips.com \
    --to=shawn.lin@rock-chips.com \
    --cc=avri.altman@sandisk.com \
    --cc=bcm-kernel-feedback-list@broadcom.com \
    --cc=florian.fainelli@broadcom.com \
    --cc=kamal.dasu@broadcom.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mmc@vger.kernel.org \
    --cc=ulfh@kernel.org \
    --cc=wsa+renesas@sang-engineering.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®