mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Lucas Stach <l.stach@pengutronix.de>
To: barebox@lists.infradead.org
Subject: [PATCH] mci: stm32_sdmmc2: add detect function
Date: Wed, 13 May 2020 14:08:47 +0200	[thread overview]
Message-ID: <20200513120847.7894-1-l.stach@pengutronix.de> (raw)

This way we can avoid probing for the SD/MMC devices at startup
and just detect them when actually needed.

Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
---
 drivers/mci/stm32_sdmmc2.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/drivers/mci/stm32_sdmmc2.c b/drivers/mci/stm32_sdmmc2.c
index 3ce3bb0f89d2..ac52b62fa0b7 100644
--- a/drivers/mci/stm32_sdmmc2.c
+++ b/drivers/mci/stm32_sdmmc2.c
@@ -571,6 +571,13 @@ static void stm32_sdmmc2_set_ios(struct mci_host *mci, struct mci_ios *ios)
 	       priv->base + SDMMC_CLKCR);
 }
 
+static int stm32_sdmmc2_detect(struct device_d *dev)
+{
+	struct stm32_sdmmc2_priv *priv = dev->priv;
+
+	return mci_detect_card(&priv->mci);
+}
+
 static int stm32_sdmmc2_probe(struct amba_device *adev,
 			      const struct amba_id *id)
 {
@@ -591,6 +598,9 @@ static int stm32_sdmmc2_probe(struct amba_device *adev,
 	mci->init = stm32_sdmmc2_reset;
 	mci->hw_dev = dev;
 
+	dev->priv = priv;
+	dev->detect = stm32_sdmmc2_detect;
+
 	priv->clk = clk_get(dev, NULL);
 	if (IS_ERR(priv->clk)) {
 		ret = PTR_ERR(priv->clk);
-- 
2.20.1


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

             reply	other threads:[~2020-05-13 12:08 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-13 12:08 Lucas Stach [this message]
2020-05-13 18:38 ` Ahmad Fatoum
2020-05-15  8:21   ` Lucas Stach

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=20200513120847.7894-1-l.stach@pengutronix.de \
    --to=l.stach@pengutronix.de \
    --cc=barebox@lists.infradead.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox