Skip to contentSkip to conversation

mmc: usdhi6rol0: Implement card_busy function

PATCH In review Mårten Lindahl 2 participants 2 messages Aug 16, 2021 – Aug 24, 2021

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

PATCH v3 1/1 mmc: usdhi6rol0: Implement card_busy function

When switching card voltage to UHS voltage the mmc framework tries to check the card busy signal, meaning the card pulling DAT0 line low, before the switch is made. Drivers that does not implement the card_busy function will manage to do the switch anyway, but the framework will print a warning about not being able to verify the voltage signal.

Implement card_busy function.

---

v2:
- Update commit message, since interface limitation for checking DAT lines is not valid for this fix.
- Skip check of SCLKDIVEN bit, and skip check of DAT3 line since SD specification only points out checking DAT0 for busy signal.
- Update comment about card_busy callback.

v3:
- Split header file change into separate patch.

 drivers/mmc/host/usdhi6rol0.c | 10 ++++++++++
 1 file changed, 10 insertions(+)
drivers/mmc/host/usdhi6rol0.c +10 -0
index b9b79b1089a0..b5ab133e9add 100644
@@ -1186,6 +1186,15 @@ static int usdhi6_sig_volt_switch(struct mmc_host *mmc, struct mmc_ios *ios)
 	return ret;
 }
 
+static int usdhi6_card_busy(struct mmc_host *mmc)
+{
+	struct usdhi6_host *host = mmc_priv(mmc);
+	u32 tmp = usdhi6_read(host, USDHI6_SD_INFO2);
+
+	/* Card is busy if it is pulling dat[0] low */
+	return !(tmp & USDHI6_SD_INFO2_SDDAT0);
+}
+
 static const struct mmc_host_ops usdhi6_ops = {
 	.request	= usdhi6_request,
 	.set_ios	= usdhi6_set_ios,
@@ -1193,6 +1202,7 @@ static const struct mmc_host_ops usdhi6_ops = {
 	.get_ro		= usdhi6_get_ro,
 	.enable_sdio_irq = usdhi6_enable_sdio_irq,
 	.start_signal_voltage_switch = usdhi6_sig_volt_switch,
+	.card_busy = usdhi6_card_busy,
 };
 
 /*			State machine handlers				*/
Signature · 1 line
2.20.1
#1 lore raw
Quoted 10 lines · Mårten Lindahl

When switching card voltage to UHS voltage the mmc framework tries to check the card busy signal, meaning the card pulling DAT0 line low, before the switch is made. Drivers that does not implement the card_busy function will manage to do the switch anyway, but the framework will print a warning about not being able to verify the voltage signal.

Implement card_busy function.

Applied for next, thanks!

Kind regards
Uffe

Quoted 46 lines

---

v2:
- Update commit message, since interface limitation for checking DAT lines is not valid for this fix.
- Skip check of SCLKDIVEN bit, and skip check of DAT3 line since SD specification only points out checking DAT0 for busy signal.
- Update comment about card_busy callback.

v3:
- Split header file change into separate patch.

 drivers/mmc/host/usdhi6rol0.c | 10 ++++++++++
 1 file changed, 10 insertions(+)
drivers/mmc/host/usdhi6rol0.c +10 -1
index b9b79b1089a0..b5ab133e9add 100644
@@ -1186,6 +1186,15 @@ static int usdhi6_sig_volt_switch(struct mmc_host *mmc, struct mmc_ios *ios)
        return ret;
 }
 
+static int usdhi6_card_busy(struct mmc_host *mmc)
+{
+       struct usdhi6_host *host = mmc_priv(mmc);
+       u32 tmp = usdhi6_read(host, USDHI6_SD_INFO2);
+
+       /* Card is busy if it is pulling dat[0] low */
+       return !(tmp & USDHI6_SD_INFO2_SDDAT0);
+}
+
 static const struct mmc_host_ops usdhi6_ops = {
        .request        = usdhi6_request,
        .set_ios        = usdhi6_set_ios,
@@ -1193,6 +1202,7 @@ static const struct mmc_host_ops usdhi6_ops = {
        .get_ro         = usdhi6_get_ro,
        .enable_sdio_irq = usdhi6_enable_sdio_irq,
        .start_signal_voltage_switch = usdhi6_sig_volt_switch,
+       .card_busy = usdhi6_card_busy,
 };
 
 /*                     State machine handlers                          */
--

2.20.1