All of lore.kernel.org
 help / color / mirror / Atom feed
From: Yixun Lan <dlan@kernel.org>
To: Dave Klotz <DaveWK225@protonmail.com>
Cc: Eric Chung <eric.chung@riscstar.com>, Peng Fan <peng.fan@nxp.com>,
	u-boot@lists.u-boot-project.org,
	Jaehoon Chung <jh80.chung@samsung.com>,
	Tanmay Kathpalia <tanmay.kathpalia@altera.com>,
	Tom Rini <trini@konsulko.com>
Subject: Re: [PATCH v2 3/3] mmc: k1: do not release the shared AXI clock and reset on probe failure
Date: Sat, 10 Oct 2026 07:14:23 +0000	[thread overview]
Message-ID: <20261010071423-GKC26088@kernel.org> (raw)
In-Reply-To: <20261005T140306-0400.mmc-v2-0003.DaveWK225@protonmail.com>

Hi Dave,

On 18:11 Mon 05 Oct     , Dave Klotz wrote:
> When the probe fails, the driver releases its clock and reset bulks.
> clk_release_bulk() disables every clock and reset_release_bulk()
> asserts every reset, and the first entry of each is the SDH AXI bus
> clock and reset, which all three SDHCI controllers of the K1 share.
> 
> One controller failing to probe therefore stops the bus of the others,
> and the next register access to any of them hangs the hart. On an
> OrangePi RV2, whose device tree enables the eMMC controller without a
> max-frequency, the eMMC probe failed in sdhci_setup_cfg() and U-Boot
> then hung at "MMC:" probing the microSD controller.
> 
> Keep the clocks running and the resets deasserted on failure.
> 
For the clock part:

This doesn't make sense to me, but I've not put my hands on board to 
test and actually replicate the case myself..

It occur to me the clk driver should take care of the consumers and
only disable the clock once 'enable_count' drop to zero, see

https://git.u-boot-project.org/u-boot/custodians/u-boot-spacemit/-/blob/main/drivers/clk/clk-uclass.c?ref_type=heads#L744


For the reset part:
As I checked the code, it seems exactly match what you described here,
where there is no enable count tracking mechanism, so release() will
trigger an assert() operation in hardware layer

so, would this issue only relate to reset?

> Signed-off-by: Dave Klotz <DaveWK225@protonmail.com>
> Reviewed-by: Tanmay Kathpalia <tanmay.kathpalia@altera.com>
> ---
> Validation: executable diff unchanged from v1; exact-base replay and
> checkpatch pass. Combined-firmware warm-boot results are in the cover;
> probe-failure paths have not been retested on hardware.
> 
>  drivers/mmc/spacemit_sdhci.c | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/mmc/spacemit_sdhci.c b/drivers/mmc/spacemit_sdhci.c
> index 4284553177..88e06a681c 100644
> --- a/drivers/mmc/spacemit_sdhci.c
> +++ b/drivers/mmc/spacemit_sdhci.c
> @@ -642,10 +642,14 @@
>  	spacemit_sdhci_phy_init(dev, host);
>  	return 0;
>  
> +	/*
> +	 * Leave the clocks and resets alone on failure. The "core" clock and
> +	 * the "axi" reset are the AXI clock and reset that every SDHCI
> +	 * controller of the K1 shares: releasing them would gate the bus of
> +	 * the other controllers, and the next access to one of them hangs.
> +	 */
>  err_reset:
> -	reset_release_bulk(&plat->resets);
>  err_clk:
> -	clk_release_bulk(&plat->clks);
>  	return ret;
>  }
>  
> -- 
> 2.55.0
> 

-- 
Yixun Lan (dlan)

  reply	other threads:[~2026-10-10  7:14 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-02 21:29 [PATCH 0/3] mmc: k1: fixes for the SpacemiT K1 SDHCI driver Dave Klotz
2026-10-02 21:29 ` [PATCH 1/3] mmc: k1: handle a missing max-frequency and clk_set_rate()'s return value Dave Klotz
2026-10-04  9:14   ` Kathpalia, Tanmay
2026-10-04  9:30   ` Kathpalia, Tanmay
2026-10-05 17:46     ` Dave Klotz
2026-10-02 21:29 ` [PATCH 2/3] mmc: k1: let the SPL read SD cards more than one block at a time Dave Klotz
2026-10-04  9:28   ` Kathpalia, Tanmay
2026-10-02 21:29 ` [PATCH 3/3] mmc: k1: do not release the shared AXI clock and reset on probe failure Dave Klotz
2026-10-04  9:28   ` Kathpalia, Tanmay
2026-10-02 22:06 ` [PATCH 0/3] mmc: k1: fixes for the SpacemiT K1 SDHCI driver Dave Klotz
2026-10-05 17:50 ` [PATCH v2 " Dave Klotz
2026-10-05 17:55   ` [PATCH v2 1/3] mmc: k1: handle a missing max-frequency and clk_set_rate()'s return value Dave Klotz
2026-10-06  5:40     ` Kathpalia, Tanmay
2026-10-10  8:45     ` Yixun Lan
2026-10-05 18:01   ` [PATCH v2 2/3] mmc: k1: let the SPL read SD cards more than one block at a time Dave Klotz
2026-10-10  6:17     ` Zixian Zeng
2026-10-10 19:02       ` Kathpalia, Tanmay
2026-10-10 19:16         ` Kathpalia, Tanmay
2026-10-11  3:38           ` Zixian Zeng
2026-10-11 14:31             ` Kathpalia, Tanmay
2026-10-11 15:33               ` Anand Moon
2026-10-11 19:41                 ` Kathpalia, Tanmay
2026-10-12 13:15               ` Zixian Zeng
2026-10-12 14:00                 ` Kathpalia, Tanmay
2026-10-12 14:30                   ` Yixun Lan
2026-10-12 14:50                     ` Kathpalia, Tanmay
2026-10-12 15:22                       ` Yixun Lan
2026-10-12 16:07                 ` Anand Moon
2026-10-13  0:15                   ` Yixun Lan
2026-10-13  3:44                     ` Anand Moon
2026-10-05 18:11   ` [PATCH v2 3/3] mmc: k1: do not release the shared AXI clock and reset on probe failure Dave Klotz
2026-10-10  7:14     ` Yixun Lan [this message]
2026-10-10 19:27       ` Kathpalia, Tanmay

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=20261010071423-GKC26088@kernel.org \
    --to=dlan@kernel.org \
    --cc=DaveWK225@protonmail.com \
    --cc=eric.chung@riscstar.com \
    --cc=jh80.chung@samsung.com \
    --cc=peng.fan@nxp.com \
    --cc=tanmay.kathpalia@altera.com \
    --cc=trini@konsulko.com \
    --cc=u-boot@lists.u-boot-project.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.