Skip to contentSkip to conversation

mmc: atmel_sdhci: re-enable sdhci after SD Card re-insertion

PATCH In review Sergiu Moga 2 participants 3 messages Jun 22, 2022 – Aug 17, 2022

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mmc: atmel_sdhci: re-enable sdhci after SD Card re-insertion

Whenever the SD Card would be removed and then re-inserted while in the U-Boot command line, the SDBPWR bit of the SDMMC_PCR register would remain unset afterwards. In order for the bit to be set again after re-insertion, register an additional deferred_probe method that the DM would then transparently call. This method will call the generic sdhci_probe which will, during its execution flow, set this bit to 1.

---
 drivers/mmc/atmel_sdhci.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)
drivers/mmc/atmel_sdhci.c +12 -0
index 2b5ceeab94..37b0beeed4 100644
@@ -52,6 +52,17 @@ struct atmel_sdhci_plat {
 	struct mmc mmc;
 };
 
+static int atmel_sdhci_deferred_probe(struct sdhci_host *host)
+{
+	struct udevice *dev = host->mmc->dev;
+
+	return sdhci_probe(dev);
+}
+
+static const struct sdhci_ops atmel_sdhci_ops = {
+	.deferred_probe	= atmel_sdhci_deferred_probe,
+};
+
 static int atmel_sdhci_probe(struct udevice *dev)
 {
 	struct mmc_uclass_priv *upriv = dev_get_uclass_priv(dev);
@@ -104,6 +115,7 @@ static int atmel_sdhci_probe(struct udevice *dev)
 		return ret;
 
 	host->mmc->priv = host;
+	host->ops = &atmel_sdhci_ops;
 	upriv->mmc = host->mmc;
 
 	clk_free(&clk);
Signature · 1 line
2.25.1
#1 lore raw
Quoted 11 lines · Sergiu Moga

Whenever the SD Card would be removed and then re-inserted while in the U-Boot command line, the SDBPWR bit of the SDMMC_PCR register would remain unset afterwards. In order for the bit to be set again after re-insertion, register an additional deferred_probe method that the DM would then transparently call. This method will call the generic sdhci_probe which will, during its execution flow, set this bit to 1.

---

Hi Peng,

To take this patch into my tree I would be happy if you had a look or reviewed it first.

Thanks,
Eugen

Quoted 34 lines
  drivers/mmc/atmel_sdhci.c | 12 ++++++++++++
  1 file changed, 12 insertions(+)
drivers/mmc/atmel_sdhci.c +12 -0
index 2b5ceeab94..37b0beeed4 100644
@@ -52,6 +52,17 @@ struct atmel_sdhci_plat {
  	struct mmc mmc;
  };
 
+static int atmel_sdhci_deferred_probe(struct sdhci_host *host)
+{
+	struct udevice *dev = host->mmc->dev;
+
+	return sdhci_probe(dev);
+}
+
+static const struct sdhci_ops atmel_sdhci_ops = {
+	.deferred_probe	= atmel_sdhci_deferred_probe,
+};
+
  static int atmel_sdhci_probe(struct udevice *dev)
  {
  	struct mmc_uclass_priv *upriv = dev_get_uclass_priv(dev);
@@ -104,6 +115,7 @@ static int atmel_sdhci_probe(struct udevice *dev)
  		return ret;
 
  	host->mmc->priv = host;
+	host->ops = &atmel_sdhci_ops;
  	upriv->mmc = host->mmc;
 
  	clk_free(&clk);
#2 lore raw
Quoted 13 lines · On 7/8/22 3:40 PM, Eugen Hristev - M18282 wrote:
Quoted 11 lines · Sergiu Moga

Whenever the SD Card would be removed and then re-inserted while in the U-Boot command line, the SDBPWR bit of the SDMMC_PCR register would remain unset afterwards. In order for the bit to be set again after re-insertion, register an additional deferred_probe method that the DM would then transparently call. This method will call the generic sdhci_probe which will, during its execution flow, set this bit to 1.

---

Quoted 8 lines

Hi Peng,

To take this patch into my tree I would be happy if you had a look or reviewed it first.

Thanks,
Eugen

Applied to u-boot-at91/next , thanks !