Skip to contentSkip to conversation

mmc: rtsx: usb add 74 clocks in poweron flow

PATCH Superseded Ricky Wu 2 participants 5 messages Apr 1, 2025 – Apr 11, 2025 MMC, SD and SDIO

v1 of 4 Superseded Latest is v4 →

lore
Share & tools
lore

Ricky Wu

author
#0 lore raw

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

SD spec definition:
"Host provides at least 74 Clocks before issuing first command" After 1ms for the voltage stable then start issuing the Clock signals

add if statement to issue/stop the clock signal to card:
The power state from POWER_OFF to POWER_UP issue the signal to card, POWER_UP to POWER_ON stop the signal

add 100ms delay in power_on to make sure the power cycle complete

---
 drivers/mmc/host/rtsx_usb_sdmmc.c | 28 +++++++++++++++++++++++++---
 1 file changed, 25 insertions(+), 3 deletions(-)
drivers/mmc/host/rtsx_usb_sdmmc.c +25 -3
index d229c2b83ea9..e5820b2bb380 100644
@@ -48,7 +48,7 @@ struct rtsx_usb_sdmmc {
 	bool			ddr_mode;
 
 	unsigned char		power_mode;
-
+	unsigned char		prev_power_mode;
 #ifdef RTSX_USB_USE_LEDS_CLASS
 	struct led_classdev	led;
 	char			led_name[32];
@@ -952,6 +952,8 @@ static int sd_power_on(struct rtsx_usb_sdmmc *host)
 	struct rtsx_ucr *ucr = host->ucr;
 	int err;
 
+	msleep(100);
+
 	dev_dbg(sdmmc_dev(host), "%s\n", __func__);
 	rtsx_usb_init_cmd(ucr);
 	rtsx_usb_add_cmd(ucr, WRITE_REG_CMD, CARD_SELECT, 0x07, SD_MOD_SEL);
@@ -1014,6 +1016,16 @@ static int sd_set_power_mode(struct rtsx_usb_sdmmc *host,
 		unsigned char power_mode)
 {
 	int err;
+	int power_mode_temp;
+	struct rtsx_ucr *ucr = host->ucr;
+
+	power_mode_temp = power_mode;
+
+	if ((power_mode == MMC_POWER_ON) && (host->power_mode == MMC_POWER_ON) &&
+			(host->prev_power_mode == MMC_POWER_UP)) {
+		host->prev_power_mode = MMC_POWER_ON;
+		rtsx_usb_write_register(ucr, SD_BUS_STAT, SD_CLK_TOGGLE_EN, 0x00);
+	}
 
 	if (power_mode != MMC_POWER_OFF)
 		power_mode = MMC_POWER_ON;
@@ -1029,9 +1041,18 @@ static int sd_set_power_mode(struct rtsx_usb_sdmmc *host,
 		err = sd_power_on(host);
 	}
 
-	if (!err)
-		host->power_mode = power_mode;
+	if (!err) {
+		if ((power_mode_temp == MMC_POWER_UP) && (host->power_mode == MMC_POWER_OFF)) {
+			host->prev_power_mode = MMC_POWER_UP;
+			rtsx_usb_write_register(ucr, SD_BUS_STAT, SD_CLK_TOGGLE_EN,
+					SD_CLK_TOGGLE_EN);
+		}
+
+		if ((power_mode_temp == MMC_POWER_OFF) && (host->power_mode == MMC_POWER_ON))
+			host->prev_power_mode = MMC_POWER_OFF;
 
+		host->power_mode = power_mode;
+	}
 	return err;
 }
 
@@ -1316,6 +1337,7 @@ static void rtsx_usb_init_host(struct rtsx_usb_sdmmc *host)
 	mmc->max_req_size = 524288;
 
 	host->power_mode = MMC_POWER_OFF;
+	host->prev_power_mode = MMC_POWER_OFF;
 }
 
 static int rtsx_usb_sdmmc_drv_probe(struct platform_device *pdev)
Signature · 1 line
2.25.1
#1 lore raw
Quoted 10 lines · Ricky Wu

SD spec definition:
"Host provides at least 74 Clocks before issuing first command" After 1ms for the voltage stable then start issuing the Clock signals

add if statement to issue/stop the clock signal to card:
The power state from POWER_OFF to POWER_UP issue the signal to card, POWER_UP to POWER_ON stop the signal

add 100ms delay in power_on to make sure the power cycle complete

Why 100ms? That sounds a lot to me?

Is this fixing a real problem or is just trying to better follow the spec?

Quoted 75 lines
---
 drivers/mmc/host/rtsx_usb_sdmmc.c | 28 +++++++++++++++++++++++++---
 1 file changed, 25 insertions(+), 3 deletions(-)
drivers/mmc/host/rtsx_usb_sdmmc.c +25 -4
index d229c2b83ea9..e5820b2bb380 100644
@@ -48,7 +48,7 @@ struct rtsx_usb_sdmmc {
        bool                    ddr_mode;
 
        unsigned char           power_mode;
-
+       unsigned char           prev_power_mode;
 #ifdef RTSX_USB_USE_LEDS_CLASS
        struct led_classdev     led;
        char                    led_name[32];
@@ -952,6 +952,8 @@ static int sd_power_on(struct rtsx_usb_sdmmc *host)
        struct rtsx_ucr *ucr = host->ucr;
        int err;
 
+       msleep(100);
+
        dev_dbg(sdmmc_dev(host), "%s\n", __func__);
        rtsx_usb_init_cmd(ucr);
        rtsx_usb_add_cmd(ucr, WRITE_REG_CMD, CARD_SELECT, 0x07, SD_MOD_SEL);
@@ -1014,6 +1016,16 @@ static int sd_set_power_mode(struct rtsx_usb_sdmmc *host,
                unsigned char power_mode)
 {
        int err;
+       int power_mode_temp;
+       struct rtsx_ucr *ucr = host->ucr;
+
+       power_mode_temp = power_mode;
+
+       if ((power_mode == MMC_POWER_ON) && (host->power_mode == MMC_POWER_ON) &&
+                       (host->prev_power_mode == MMC_POWER_UP)) {
+               host->prev_power_mode = MMC_POWER_ON;
+               rtsx_usb_write_register(ucr, SD_BUS_STAT, SD_CLK_TOGGLE_EN, 0x00);
+       }
 
        if (power_mode != MMC_POWER_OFF)
                power_mode = MMC_POWER_ON;
@@ -1029,9 +1041,18 @@ static int sd_set_power_mode(struct rtsx_usb_sdmmc *host,
                err = sd_power_on(host);
        }
 
-       if (!err)
-               host->power_mode = power_mode;
+       if (!err) {
+               if ((power_mode_temp == MMC_POWER_UP) && (host->power_mode == MMC_POWER_OFF)) {
+                       host->prev_power_mode = MMC_POWER_UP;
+                       rtsx_usb_write_register(ucr, SD_BUS_STAT, SD_CLK_TOGGLE_EN,
+                                       SD_CLK_TOGGLE_EN);
+               }
+
+               if ((power_mode_temp == MMC_POWER_OFF) && (host->power_mode == MMC_POWER_ON))
+                       host->prev_power_mode = MMC_POWER_OFF;
 
+               host->power_mode = power_mode;
+       }
        return err;
 }
 
@@ -1316,6 +1337,7 @@ static void rtsx_usb_init_host(struct rtsx_usb_sdmmc *host)
        mmc->max_req_size = 524288;
 
        host->power_mode = MMC_POWER_OFF;
+       host->prev_power_mode = MMC_POWER_OFF;
 }
 
 static int rtsx_usb_sdmmc_drv_probe(struct platform_device *pdev)
--
Quoted 2 lines

2.25.1

Kind regards
Uffe

author
#2 lore raw
Quoted 5 lines
Quoted 5 lines

SD spec definition:
"Host provides at least 74 Clocks before issuing first command" After 1ms for the voltage stable then start issuing the Clock signals

Quoted 8 lines
Quoted 5 lines

add if statement to issue/stop the clock signal to card:
The power state from POWER_OFF to POWER_UP issue the signal to card, POWER_UP to POWER_ON stop the signal

add 100ms delay in power_on to make sure the power cycle complete

Why 100ms? That sounds a lot to me?

Hi Ulf,

This 100ms delay is to ensure the voltage is below 0.5V before power on during a power cycle, The delays in the mmc core is not sufficient for the rtsx usb device.
Because during the card recognition process, the card power will be toggled once in 1ms. If the card power is not fully discharged within that 1ms before being turned on again, It may affect the card recognition

Quoted 2 lines

Is this fixing a real problem or is just trying to better follow the spec?

We found some cards not be recognized if not issue this 74 clocks

Quoted 91 lines
Quoted 4 lines
---
 drivers/mmc/host/rtsx_usb_sdmmc.c | 28

+++++++++++++++++++++++++---

drivers/mmc/host/rtsx_usb_sdmmc.c static int sd_power_on(struct rtsx_usb_sdmmc

Quoted 17 lines
 1 file changed, 25 insertions(+), 3 deletions(-)
drivers/mmc/host/rtsx_usb_sdmmc.c +1 -1
index d229c2b83ea9..e5820b2bb380 100644
@@ -48,7 +48,7 @@ struct rtsx_usb_sdmmc {
        bool                    ddr_mode;
 
        unsigned char           power_mode;
-
+       unsigned char           prev_power_mode;
 #ifdef RTSX_USB_USE_LEDS_CLASS
        struct led_classdev     led;
        char                    led_name[32];
@@ -952,6 +952,8 @@ static int sd_power_on(struct rtsx_usb_sdmmc

*host)

Quoted 9 lines
drivers/mmc/host/rtsx_usb_sdmmc.c +2 -0
        struct rtsx_ucr *ucr = host->ucr;
        int err;
 
+       msleep(100);
+
        dev_dbg(sdmmc_dev(host), "%s\n", __func__);
        rtsx_usb_init_cmd(ucr);
        rtsx_usb_add_cmd(ucr, WRITE_REG_CMD, CARD_SELECT, 0x07,

SD_MOD_SEL); @@ -1014,6 +1016,16 @@ static int

sd_set_power_mode(struct rtsx_usb_sdmmc *host,

drivers/mmc/host/rtsx_usb_sdmmc.c static int sd_set_power_mode(struct rtsx_usb_sdmmc *host,

Quoted 8 lines
                unsigned char power_mode)  {
        int err;
drivers/mmc/host/rtsx_usb_sdmmc.c +6 -0
+       int power_mode_temp;
+       struct rtsx_ucr *ucr = host->ucr;
+
+       power_mode_temp = power_mode;
+
+       if ((power_mode == MMC_POWER_ON) && (host->power_mode

== MMC_POWER_ON) &&

Quoted 1 line

+ (host->prev_power_mode ==

MMC_POWER_UP)) {

drivers/mmc/host/rtsx_usb_sdmmc.c

Quoted 2 lines
drivers/mmc/host/rtsx_usb_sdmmc.c +2 -0
+               host->prev_power_mode = MMC_POWER_ON;
+               rtsx_usb_write_register(ucr, SD_BUS_STAT,

SD_CLK_TOGGLE_EN, 0x00);

Quoted 4 lines

+ }

        if (power_mode != MMC_POWER_OFF)
                power_mode = MMC_POWER_ON; @@ -1029,9

+1041,18 @@

drivers/mmc/host/rtsx_usb_sdmmc.c static int sd_set_power_mode(struct rtsx_usb_sdmmc *host,

Quoted 8 lines

static int sd_set_power_mode(struct rtsx_usb_sdmmc *host,

                err = sd_power_on(host);
        }
drivers/mmc/host/rtsx_usb_sdmmc.c +2 -2
-       if (!err)
-               host->power_mode = power_mode;
+       if (!err) {
+               if ((power_mode_temp == MMC_POWER_UP) &&

(host->power_mode == MMC_POWER_OFF)) {

drivers/mmc/host/rtsx_usb_sdmmc.c

Quoted 2 lines
drivers/mmc/host/rtsx_usb_sdmmc.c +2 -0
+                       host->prev_power_mode = MMC_POWER_UP;
+                       rtsx_usb_write_register(ucr, SD_BUS_STAT,

SD_CLK_TOGGLE_EN,

drivers/mmc/host/rtsx_usb_sdmmc.c static int sd_set_power_mode(struct rtsx_usb_sdmmc *host,

Quoted 4 lines
drivers/mmc/host/rtsx_usb_sdmmc.c +4 -0
+                                       SD_CLK_TOGGLE_EN);
+               }
+
+               if ((power_mode_temp == MMC_POWER_OFF) &&

(host->power_mode == MMC_POWER_ON))

drivers/mmc/host/rtsx_usb_sdmmc.c static void rtsx_usb_init_host(struct

Quoted 8 lines
drivers/mmc/host/rtsx_usb_sdmmc.c +3 -0
+                       host->prev_power_mode = MMC_POWER_OFF;
 
+               host->power_mode = power_mode;
+       }
        return err;
 }
@@ -1316,6 +1337,7 @@ static void rtsx_usb_init_host(struct

rtsx_usb_sdmmc *host)

Quoted 10 lines
drivers/mmc/host/rtsx_usb_sdmmc.c +1 -1
        mmc->max_req_size = 524288;
 
        host->power_mode = MMC_POWER_OFF;
+       host->prev_power_mode = MMC_POWER_OFF;
 }
 
 static int rtsx_usb_sdmmc_drv_probe(struct platform_device *pdev)
--

2.25.1

Kind regards
Uffe

#3 lore raw
Quoted 14 lines · Ricky WU
Quoted 6 lines
Quoted 6 lines

SD spec definition:
"Host provides at least 74 Clocks before issuing first command" After 1ms for the voltage stable then start issuing the Clock signals

Quoted 8 lines
Quoted 5 lines

add if statement to issue/stop the clock signal to card:
The power state from POWER_OFF to POWER_UP issue the signal to card, POWER_UP to POWER_ON stop the signal

add 100ms delay in power_on to make sure the power cycle complete

Why 100ms? That sounds a lot to me?

Quoted 7 lines

Hi Ulf,

This 100ms delay is to ensure the voltage is below 0.5V before power on during a power cycle, The delays in the mmc core is not sufficient for the rtsx usb device.
Because during the card recognition process, the card power will be toggled once in 1ms. If the card power is not fully discharged within that 1ms before being turned on again, It may affect the card recognition

Okay, I see. So 1ms isn't sufficient for your case.

Is there a regulator described somewhere? Could this delay be part of the regulator enable/disable instead?

Quoted 5 lines
Quoted 3 lines

Is this fixing a real problem or is just trying to better follow the spec?

We found some cards not be recognized if not issue this 74 clocks

That still doesn't explain why you picked exactly 100ms as the delay. Assuming we are running at lowest initialization frequency for SD/eMMC at 100kHz, then 74 clocks are:

74/100000 = 0,00074s.

Kind regards
Uffe

Quoted 92 lines
Quoted 92 lines
Quoted 5 lines
---
 drivers/mmc/host/rtsx_usb_sdmmc.c | 28

+++++++++++++++++++++++++---

drivers/mmc/host/rtsx_usb_sdmmc.c static int sd_power_on(struct rtsx_usb_sdmmc

Quoted 17 lines
 1 file changed, 25 insertions(+), 3 deletions(-)
drivers/mmc/host/rtsx_usb_sdmmc.c +1 -1
index d229c2b83ea9..e5820b2bb380 100644
@@ -48,7 +48,7 @@ struct rtsx_usb_sdmmc {
        bool                    ddr_mode;
 
        unsigned char           power_mode;
-
+       unsigned char           prev_power_mode;
 #ifdef RTSX_USB_USE_LEDS_CLASS
        struct led_classdev     led;
        char                    led_name[32];
@@ -952,6 +952,8 @@ static int sd_power_on(struct rtsx_usb_sdmmc

*host)

Quoted 9 lines
drivers/mmc/host/rtsx_usb_sdmmc.c +2 -0
        struct rtsx_ucr *ucr = host->ucr;
        int err;
 
+       msleep(100);
+
        dev_dbg(sdmmc_dev(host), "%s\n", __func__);
        rtsx_usb_init_cmd(ucr);
        rtsx_usb_add_cmd(ucr, WRITE_REG_CMD, CARD_SELECT, 0x07,

SD_MOD_SEL); @@ -1014,6 +1016,16 @@ static int

sd_set_power_mode(struct rtsx_usb_sdmmc *host,

drivers/mmc/host/rtsx_usb_sdmmc.c static int sd_set_power_mode(struct rtsx_usb_sdmmc *host,

Quoted 8 lines
                unsigned char power_mode)  {
        int err;
drivers/mmc/host/rtsx_usb_sdmmc.c +6 -0
+       int power_mode_temp;
+       struct rtsx_ucr *ucr = host->ucr;
+
+       power_mode_temp = power_mode;
+
+       if ((power_mode == MMC_POWER_ON) && (host->power_mode

== MMC_POWER_ON) &&

Quoted 1 line

+ (host->prev_power_mode ==

MMC_POWER_UP)) {

drivers/mmc/host/rtsx_usb_sdmmc.c

Quoted 2 lines
drivers/mmc/host/rtsx_usb_sdmmc.c +2 -0
+               host->prev_power_mode = MMC_POWER_ON;
+               rtsx_usb_write_register(ucr, SD_BUS_STAT,

SD_CLK_TOGGLE_EN, 0x00);

Quoted 4 lines

+ }

        if (power_mode != MMC_POWER_OFF)
                power_mode = MMC_POWER_ON; @@ -1029,9

+1041,18 @@

drivers/mmc/host/rtsx_usb_sdmmc.c static int sd_set_power_mode(struct rtsx_usb_sdmmc *host,

Quoted 8 lines

static int sd_set_power_mode(struct rtsx_usb_sdmmc *host,

                err = sd_power_on(host);
        }
drivers/mmc/host/rtsx_usb_sdmmc.c +2 -2
-       if (!err)
-               host->power_mode = power_mode;
+       if (!err) {
+               if ((power_mode_temp == MMC_POWER_UP) &&

(host->power_mode == MMC_POWER_OFF)) {

drivers/mmc/host/rtsx_usb_sdmmc.c

Quoted 2 lines
drivers/mmc/host/rtsx_usb_sdmmc.c +2 -0
+                       host->prev_power_mode = MMC_POWER_UP;
+                       rtsx_usb_write_register(ucr, SD_BUS_STAT,

SD_CLK_TOGGLE_EN,

drivers/mmc/host/rtsx_usb_sdmmc.c static int sd_set_power_mode(struct rtsx_usb_sdmmc *host,

Quoted 4 lines
drivers/mmc/host/rtsx_usb_sdmmc.c +4 -0
+                                       SD_CLK_TOGGLE_EN);
+               }
+
+               if ((power_mode_temp == MMC_POWER_OFF) &&

(host->power_mode == MMC_POWER_ON))

drivers/mmc/host/rtsx_usb_sdmmc.c static void rtsx_usb_init_host(struct

Quoted 8 lines
drivers/mmc/host/rtsx_usb_sdmmc.c +3 -0
+                       host->prev_power_mode = MMC_POWER_OFF;
 
+               host->power_mode = power_mode;
+       }
        return err;
 }
@@ -1316,6 +1337,7 @@ static void rtsx_usb_init_host(struct

rtsx_usb_sdmmc *host)

Quoted 10 lines
drivers/mmc/host/rtsx_usb_sdmmc.c +1 -1
        mmc->max_req_size = 524288;
 
        host->power_mode = MMC_POWER_OFF;
+       host->prev_power_mode = MMC_POWER_OFF;
 }
 
 static int rtsx_usb_sdmmc_drv_probe(struct platform_device *pdev)
--

2.25.1

Kind regards
Uffe

author
#4 lore raw
Quoted 34 lines
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines

SD spec definition:
"Host provides at least 74 Clocks before issuing first command" After 1ms for the voltage stable then start issuing the Clock signals

add if statement to issue/stop the clock signal to card:
The power state from POWER_OFF to POWER_UP issue the signal to card, POWER_UP to POWER_ON stop the signal

Quoted 8 lines
Quoted 4 lines
Quoted 1 line

add 100ms delay in power_on to make sure the power cycle complete

Why 100ms? That sounds a lot to me?

Hi Ulf,

This 100ms delay is to ensure the voltage is below 0.5V before power on during a power cycle, The delays in the mmc core is not sufficient for the

rtsx usb device.

Quoted 1 line

Because during the card recognition process, the card power will be toggled

once in 1ms.

Quoted 2 lines

If the card power is not fully discharged within that 1ms before being turned on again, It may affect the card recognition

Okay, I see. So 1ms isn't sufficient for your case.

Is there a regulator described somewhere? Could this delay be part of the regulator enable/disable instead?

Quoted 4 lines
Quoted 3 lines

Is this fixing a real problem or is just trying to better follow the spec?

Quoted 8 lines
Quoted 1 line

We found some cards not be recognized if not issue this 74 clocks

That still doesn't explain why you picked exactly 100ms as the delay. Assuming we are running at lowest initialization frequency for SD/eMMC at 100kHz, then 74 clocks are:

74/100000 = 0,00074s.

I think we got a little mixed up...
I think I need to separate this patch into 2 part
1) for 74 clocks issue
2) add delay 100ms before rtsx power on

I think 1) is no problem for you? It is for SD spec and some cards check this.
2) add 100ms before power on it is to make sure the last time power off did the discharge clean, Because during the card recognition process, the card power will be toggled in 1ms, and we found 1ms is not enough for discharge

if (1) and (2) are ok for you I will separate it In V2 1/2 and 2/2
or two unrelated patches (1) for 74 clock issue, (2) for make sure the voltage is below 0.5V before power on which one you think is good?

Ricky

Quoted 97 lines
Quoted 25 lines
Quoted 25 lines
Quoted 6 lines
---
 drivers/mmc/host/rtsx_usb_sdmmc.c | 28

+++++++++++++++++++++++++---

drivers/mmc/host/rtsx_usb_sdmmc.c static int sd_power_on(struct rtsx_usb_sdmmc

Quoted 17 lines
 1 file changed, 25 insertions(+), 3 deletions(-)
drivers/mmc/host/rtsx_usb_sdmmc.c +1 -1
index d229c2b83ea9..e5820b2bb380 100644
@@ -48,7 +48,7 @@ struct rtsx_usb_sdmmc {
        bool                    ddr_mode;
 
        unsigned char           power_mode;
-
+       unsigned char           prev_power_mode;
 #ifdef RTSX_USB_USE_LEDS_CLASS
        struct led_classdev     led;
        char                    led_name[32];
@@ -952,6 +952,8 @@ static int sd_power_on(struct rtsx_usb_sdmmc

*host)

Quoted 8 lines
Quoted 8 lines

drivers/mmc/host/rtsx_usb_sdmmc.c static int sd_power_on(struct rtsx_usb_sdmmc *host)

Quoted 8 lines
drivers/mmc/host/rtsx_usb_sdmmc.c +2 -0
        struct rtsx_ucr *ucr = host->ucr;
        int err;
 
+       msleep(100);
+
        dev_dbg(sdmmc_dev(host), "%s\n", __func__);
        rtsx_usb_init_cmd(ucr);
        rtsx_usb_add_cmd(ucr, WRITE_REG_CMD, CARD_SELECT,

0x07,

Quoted 10 lines
Quoted 10 lines
Quoted 1 line

SD_MOD_SEL); @@ -1014,6 +1016,16 @@ static int

sd_set_power_mode(struct rtsx_usb_sdmmc *host,

drivers/mmc/host/rtsx_usb_sdmmc.c static int sd_set_power_mode(struct rtsx_usb_sdmmc *host,

Quoted 8 lines
                unsigned char power_mode)  {
        int err;
drivers/mmc/host/rtsx_usb_sdmmc.c +6 -0
+       int power_mode_temp;
+       struct rtsx_ucr *ucr = host->ucr;
+
+       power_mode_temp = power_mode;
+
+       if ((power_mode == MMC_POWER_ON) &&

(host->power_mode

Quoted 15 lines
Quoted 15 lines

== MMC_POWER_ON) &&

Quoted 1 line

+ (host->prev_power_mode ==

MMC_POWER_UP)) {

drivers/mmc/host/rtsx_usb_sdmmc.c

Quoted 2 lines
drivers/mmc/host/rtsx_usb_sdmmc.c +2 -0
+               host->prev_power_mode = MMC_POWER_ON;
+               rtsx_usb_write_register(ucr, SD_BUS_STAT,

SD_CLK_TOGGLE_EN, 0x00);

Quoted 4 lines

+ }

        if (power_mode != MMC_POWER_OFF)
                power_mode = MMC_POWER_ON; @@ -1029,9

+1041,18 @@

Quoted 4 lines

static int sd_set_power_mode(struct rtsx_usb_sdmmc *host,

                err = sd_power_on(host);
        }
Quoted 6 lines
Quoted 6 lines

drivers/mmc/host/rtsx_usb_sdmmc.c static int sd_set_power_mode(struct rtsx_usb_sdmmc *host,

Quoted 4 lines
drivers/mmc/host/rtsx_usb_sdmmc.c +2 -2
-       if (!err)
-               host->power_mode = power_mode;
+       if (!err) {
+               if ((power_mode_temp == MMC_POWER_UP) &&

(host->power_mode == MMC_POWER_OFF)) {

Quoted 1 line

+ host->prev_power_mode =

MMC_POWER_UP;

Quoted 8 lines
Quoted 8 lines
Quoted 1 line

+ rtsx_usb_write_register(ucr, SD_BUS_STAT,

SD_CLK_TOGGLE_EN,

drivers/mmc/host/rtsx_usb_sdmmc.c static int sd_set_power_mode(struct rtsx_usb_sdmmc *host,

Quoted 4 lines
drivers/mmc/host/rtsx_usb_sdmmc.c +4 -0
+                                       SD_CLK_TOGGLE_EN);
+               }
+
+               if ((power_mode_temp == MMC_POWER_OFF) &&

(host->power_mode == MMC_POWER_ON))

Quoted 1 line

+ host->prev_power_mode =

MMC_POWER_OFF;

Quoted 21 lines
Quoted 21 lines

drivers/mmc/host/rtsx_usb_sdmmc.c static void rtsx_usb_init_host(struct

Quoted 7 lines
drivers/mmc/host/rtsx_usb_sdmmc.c +2 -0
+               host->power_mode = power_mode;
+       }
        return err;
 }
@@ -1316,6 +1337,7 @@ static void rtsx_usb_init_host(struct

rtsx_usb_sdmmc *host)

Quoted 10 lines
drivers/mmc/host/rtsx_usb_sdmmc.c +1 -1
        mmc->max_req_size = 524288;
 
        host->power_mode = MMC_POWER_OFF;
+       host->prev_power_mode = MMC_POWER_OFF;
 }
 
 static int rtsx_usb_sdmmc_drv_probe(struct platform_device *pdev)
--

2.25.1

Kind regards
Uffe