mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] mci: register class device before card detection
@ 2026-03-20 13:56 Sascha Hauer
  2026-04-13 14:02 ` Ahmad Fatoum
  2026-04-13 14:34 ` Sascha Hauer
  0 siblings, 2 replies; 3+ messages in thread
From: Sascha Hauer @ 2026-03-20 13:56 UTC (permalink / raw)
  To: Barebox List

mci_card_probe() notifies OP-TEE about the presence of a RPMB device
which in turn tries to read from it. The OP-TEE request will end up
in mci_get_rpmb_dev() which iterates over MMC class devices in order
to find the correct one. Call class_add_device() earlier to make sure
the new device is available at that time.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 drivers/mci/mci-core.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/mci/mci-core.c b/drivers/mci/mci-core.c
index cdb20a5625..d3d7bd5e07 100644
--- a/drivers/mci/mci-core.c
+++ b/drivers/mci/mci-core.c
@@ -3111,6 +3111,8 @@ int mci_register(struct mci_host *host)
 	if (IS_ENABLED(CONFIG_MCI_INFO))
 		devinfo_add(&mci->dev, mci_info);
 
+	class_add_device(&mmc_class, &mci->dev);
+
 	/* if enabled, probe the attached card immediately */
 	if (IS_ENABLED(CONFIG_MCI_STARTUP) ||
 	   (IS_ENABLED(CONFIG_MCI_STARTUP_NONREMOVABLE) &&
@@ -3124,8 +3126,6 @@ int mci_register(struct mci_host *host)
 		of_register_fixup(of_broken_cd_fixup, host);
 	}
 
-	class_add_device(&mmc_class, &mci->dev);
-
 	return 0;
 
 err_free:
-- 
2.47.3




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

* Re: [PATCH] mci: register class device before card detection
  2026-03-20 13:56 [PATCH] mci: register class device before card detection Sascha Hauer
@ 2026-04-13 14:02 ` Ahmad Fatoum
  2026-04-13 14:34 ` Sascha Hauer
  1 sibling, 0 replies; 3+ messages in thread
From: Ahmad Fatoum @ 2026-04-13 14:02 UTC (permalink / raw)
  To: Sascha Hauer, Barebox List

On 3/20/26 2:56 PM, Sascha Hauer wrote:
> mci_card_probe() notifies OP-TEE about the presence of a RPMB device
> which in turn tries to read from it. The OP-TEE request will end up
> in mci_get_rpmb_dev() which iterates over MMC class devices in order
> to find the correct one. Call class_add_device() earlier to make sure
> the new device is available at that time.
> 
> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>

Reviewed-by: Ahmad Fatoum <a.fatoum@pengutronix.de>

> ---
>  drivers/mci/mci-core.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/mci/mci-core.c b/drivers/mci/mci-core.c
> index cdb20a5625..d3d7bd5e07 100644
> --- a/drivers/mci/mci-core.c
> +++ b/drivers/mci/mci-core.c
> @@ -3111,6 +3111,8 @@ int mci_register(struct mci_host *host)
>  	if (IS_ENABLED(CONFIG_MCI_INFO))
>  		devinfo_add(&mci->dev, mci_info);
>  
> +	class_add_device(&mmc_class, &mci->dev);
> +
>  	/* if enabled, probe the attached card immediately */
>  	if (IS_ENABLED(CONFIG_MCI_STARTUP) ||
>  	   (IS_ENABLED(CONFIG_MCI_STARTUP_NONREMOVABLE) &&
> @@ -3124,8 +3126,6 @@ int mci_register(struct mci_host *host)
>  		of_register_fixup(of_broken_cd_fixup, host);
>  	}
>  
> -	class_add_device(&mmc_class, &mci->dev);
> -
>  	return 0;
>  
>  err_free:

-- 
Pengutronix e.K.                  |                             |
Steuerwalder Str. 21              | http://www.pengutronix.de/  |
31137 Hildesheim, Germany         | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686  | Fax:   +49-5121-206917-5555 |




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

* Re: [PATCH] mci: register class device before card detection
  2026-03-20 13:56 [PATCH] mci: register class device before card detection Sascha Hauer
  2026-04-13 14:02 ` Ahmad Fatoum
@ 2026-04-13 14:34 ` Sascha Hauer
  1 sibling, 0 replies; 3+ messages in thread
From: Sascha Hauer @ 2026-04-13 14:34 UTC (permalink / raw)
  To: Barebox List, Sascha Hauer


On Fri, 20 Mar 2026 14:56:53 +0100, Sascha Hauer wrote:
> mci_card_probe() notifies OP-TEE about the presence of a RPMB device
> which in turn tries to read from it. The OP-TEE request will end up
> in mci_get_rpmb_dev() which iterates over MMC class devices in order
> to find the correct one. Call class_add_device() earlier to make sure
> the new device is available at that time.
> 
> 
> [...]

Applied, thanks!

[1/1] mci: register class device before card detection
      https://git.pengutronix.de/cgit/barebox/commit/?id=df83048c4a74 (link may not be stable)

Best regards,
-- 
Sascha Hauer <s.hauer@pengutronix.de>




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

end of thread, other threads:[~2026-04-13 14:35 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-03-20 13:56 [PATCH] mci: register class device before card detection Sascha Hauer
2026-04-13 14:02 ` Ahmad Fatoum
2026-04-13 14:34 ` Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox