Re: [PATCH RESEND v2 7/8] mmc: sdhci-of-k1: Improve RX tuning window
From: Adrian Hunter
Date: Thu Dec 03 2026 - 11:40:59 EST
On 01/12/2026 12:54, Yixun Lan wrote:
> From: Long Wan <long.wan@xxxxxxxxxxxxxxxxxx>
>
> Raise the minimum delay codes of RX tuning window from 3 to 50, to more
> accurately retrieve a valid configuration.
>
> A window of 3 codes wide leaves no sampling margin, which will result
> tuning tests reporting success on a configuration that drifts out of the
> window under thermal or power variation.
How does more readily returning an error help?
>
> Fixes: e9cb83c10071 ("mmc: sdhci-of-k1: add comprehensive SDR tuning support")
> Signed-off-by: Long Wan <long.wan@xxxxxxxxxxxxxxxxxx>
> Signed-off-by: Yixun Lan <dlan@xxxxxxxxxx>
> ---
> drivers/mmc/host/sdhci-of-k1.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/mmc/host/sdhci-of-k1.c b/drivers/mmc/host/sdhci-of-k1.c
> index ba01434284eb..9f15cc6a4a8c 100644
> --- a/drivers/mmc/host/sdhci-of-k1.c
> +++ b/drivers/mmc/host/sdhci-of-k1.c
> @@ -87,6 +87,7 @@
> #define SPACEMIT_RX_DLINE_REG 0
> #define SPACEMIT_RX_TUNE_DELAY_MIN 0x0
> #define SPACEMIT_RX_TUNE_DELAY_MAX 0xFF
> +#define SPACEMIT_RX_TUNE_WINDOW_LIMIT 50
>
> #define SPACEMIT_TX_TUNING_DLINE_REG 0x00
> #define SPACEMIT_TX_TUNING_DELAYCODE 127
> @@ -316,7 +317,7 @@ static int spacemit_sdhci_execute_tuning(struct sdhci_host *host, u32 opcode)
> max_pass_start = current_start;
> }
>
> - if (max_pass_len < 3) {
> + if (max_pass_len < SPACEMIT_RX_TUNE_WINDOW_LIMIT) {
> dev_err(mmc_dev(host->mmc), "Tuning failed: no stable window found\n");
> return -EIO;
> }
>