Skip to contentSkip to conversation

mmc: rtsx: usb add 74 clocks in poweron flow

PATCH In review Ricky Wu 2 participants 2 messages Jun 16, 2025 – Jun 19, 2025 MMC, SD and SDIO

lore
Share & tools
lore

Ricky Wu

author
#0 lore raw

PATCH v4 1/1 mmc: rtsx: usb add 74 clocks in poweron flow

SD spec definition:
"Host provides at least 74 Clocks before issuing first command"

add issue the clocks when power_mode is POWER_UP and stop the signal when power_mode is POWER_ON

---
v2: remove delay 100ms in power_on
v3: Use switch-case instead of if statements
v4: re-base on the patches
https://lore.kernel.org/all/[email protected]/

---
 drivers/mmc/host/rtsx_usb_sdmmc.c | 5 +++++
 1 file changed, 5 insertions(+)
drivers/mmc/host/rtsx_usb_sdmmc.c +5 -0
index c1fdcc334c8f..239eb9acf7a7 100644
@@ -1014,6 +1014,7 @@ static void sd_set_power_mode(struct rtsx_usb_sdmmc *host,
 		unsigned char power_mode)
 {
 	int err;
+	struct rtsx_ucr *ucr = host->ucr;
 
 	if (power_mode == host->power_mode)
 		return;
@@ -1031,9 +1032,13 @@ static void sd_set_power_mode(struct rtsx_usb_sdmmc *host,
 		err = sd_power_on(host);
 		if (err)
 			dev_dbg(sdmmc_dev(host), "power-on (err = %d)\n", err);
+		/* issue the clock signals to card at least 74 clocks */
+		rtsx_usb_write_register(ucr, SD_BUS_STAT, SD_CLK_TOGGLE_EN, SD_CLK_TOGGLE_EN);
 		break;
 
 	case MMC_POWER_ON:
+		/* stop to send the clock signals */
+		rtsx_usb_write_register(ucr, SD_BUS_STAT, SD_CLK_TOGGLE_EN, 0x00);
 	case MMC_POWER_UNDEFINED:
 		break;
 
Signature · 1 line
2.25.1
#1 lore raw
Quoted 8 lines · Ricky Wu

SD spec definition:
"Host provides at least 74 Clocks before issuing first command"

add issue the clocks when power_mode is POWER_UP and stop the signal when power_mode is POWER_ON

Applied for next, thanks!

Kind regards
Uffe

Quoted 38 lines

---
v2: remove delay 100ms in power_on
v3: Use switch-case instead of if statements
v4: re-base on the patches
https://lore.kernel.org/all/[email protected]/

---
 drivers/mmc/host/rtsx_usb_sdmmc.c | 5 +++++
 1 file changed, 5 insertions(+)
drivers/mmc/host/rtsx_usb_sdmmc.c +5 -1
index c1fdcc334c8f..239eb9acf7a7 100644
@@ -1014,6 +1014,7 @@ static void sd_set_power_mode(struct rtsx_usb_sdmmc *host,
                unsigned char power_mode)
 {
        int err;
+       struct rtsx_ucr *ucr = host->ucr;
 
        if (power_mode == host->power_mode)
                return;
@@ -1031,9 +1032,13 @@ static void sd_set_power_mode(struct rtsx_usb_sdmmc *host,
                err = sd_power_on(host);
                if (err)
                        dev_dbg(sdmmc_dev(host), "power-on (err = %d)\n", err);
+               /* issue the clock signals to card at least 74 clocks */
+               rtsx_usb_write_register(ucr, SD_BUS_STAT, SD_CLK_TOGGLE_EN, SD_CLK_TOGGLE_EN);
                break;
 
        case MMC_POWER_ON:
+               /* stop to send the clock signals */
+               rtsx_usb_write_register(ucr, SD_BUS_STAT, SD_CLK_TOGGLE_EN, 0x00);
        case MMC_POWER_UNDEFINED:
                break;
 
--

2.25.1