mmc: rtsx: add 74 Clocks in power on flow
Subsystems (2)
PATCH 1/1 mmc: rtsx: add 74 Clocks in power on flow
commit 1f311c94aabd ("mmc: rtsx: add 74 Clocks in power on flow") upstream. backport note: removed unavailable power_delay_ms 5ms as 10ms is fine, too.
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
if POWER STATE isMMC_POWER_OFF to MMC_POWER_UP to issue Clock signal to card MMC_POWER_UP to MMC_POWER_ON to stop issuing signal to card
--- drivers/mmc/host/rtsx_pci_sdmmc.c | 30 ++++++++++++++++++++---------- 1 file changed, 20 insertions(+), 10 deletions(-)
drivers/mmc/host/rtsx_pci_sdmmc.c +20 -10
@@ -49,10 +49,7 @@ struct realtek_pci_sdmmc {bool double_clk;bool eject;bool initial_mode; -int power_state; -#define SDMMC_POWER_ON 1 -#define SDMMC_POWER_OFF 0 - +int prev_power_state;int sg_count;s32 cookie;int cookie_sg_count;
@@ -913,14 +910,21 @@ static int sd_set_bus_width(struct realtek_pci_sdmmc *host,return err; } -static int sd_power_on (struct realtek_pci_sdmmc *host) +static int sd_power_on (struct realtek_pci_sdmmc *host,unsigned char power_mode) {struct rtsx_pcr *pcr = host->pcr;int err; -if (host->power_state ==SDMMC_POWER_ON ) +if (host->prev_power_state ==MMC_POWER_ON )return 0 ; +if (host->prev_power_state ==MMC_POWER_UP ) { +rtsx_pci_write_register (pcr,SD_BUS_STAT ,SD_CLK_TOGGLE_EN ,0 ); + goto finish; + } + +msleep (100 ); +rtsx_pci_init_cmd (pcr);rtsx_pci_add_cmd (pcr,WRITE_REG_CMD ,CARD_SELECT ,0x07 ,SD_MOD_SEL ); rtsx_pci_add_cmd(pcr, WRITE_REG_CMD, CARD_SHARE_MODE,
@@ -939,11 +943,17 @@ static int sd_power_on(struct realtek_pci_sdmmc *host)if (err <0 )return err; +mdelay (1 ); + err =rtsx_pci_write_register (pcr,CARD_OE ,SD_OUTPUT_EN ,SD_OUTPUT_EN );if (err <0 )return err; - host->power_state =SDMMC_POWER_ON ; +/* send at least 74 clocks */ +rtsx_pci_write_register (pcr,SD_BUS_STAT ,SD_CLK_TOGGLE_EN ,SD_CLK_TOGGLE_EN ); + +finish: + host->prev_power_state = power_mode;return 0 ; }
@@ -952,7 +962,7 @@ static int sd_power_off(struct realtek_pci_sdmmc *host)struct rtsx_pcr *pcr = host->pcr;int err; - host->power_state =SDMMC_POWER_OFF ; + host->prev_power_state =MMC_POWER_OFF ;rtsx_pci_init_cmd (pcr);
@@ -978,7 +988,7 @@ static int sd_set_power_mode(struct realtek_pci_sdmmc *host,if (power_mode ==MMC_POWER_OFF ) err =sd_power_off (host);else - err =sd_power_on (host); + err =sd_power_on (host, power_mode);return err; }
@@ -1416,7 +1426,7 @@ static int rtsx_pci_sdmmc_drv_probe(struct platform_device *pdev) host->mmc = mmc; host->pdev = pdev; host->cookie =-1 ; - host->power_state =SDMMC_POWER_OFF ; + host->prev_power_state =MMC_POWER_OFF ;INIT_WORK (&host->work, sd_request);platform_set_drvdata (pdev, host); pcr->slots[RTSX_SD_CARD ].p_dev = pdev;
Signature · 4 lines
2.34.1= Hyperstone GmbH | Reichenaustr. 39a | 78467 Konstanz Managing Director: Dr. Jan Peter Berns. Commercial register of local courts: Freiburg HRB381782
Quoted 7 lines
commit
1f311c94aabd("mmc: rtsx: add 74 Clocks in power on flow") upstream. backport note: removed unavailablepower_delay_ms5ms as 10ms is fine, too.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
if POWER STATE is
MMC_POWER_OFFtoMMC_POWER_UPto issue Clock signal to cardMMC_POWER_UPtoMMC_POWER_ONto stop issuing signal to cardSigned-off-by Ricky Wu <[email protected]>Signed-off-by Ulf Hansson <[email protected]>Signed-off-by Christian Loehle <[email protected]>---
Now for 4.9.y and 4.14.y, my bad and thanks a lot.
Regards,
Christian=
Hyperstone GmbH | Reichenaustr. 39a | 78467 Konstanz Managing Director: Dr. Jan Peter Berns. Commercial register of local courts: Freiburg HRB381782
Greg Kroah-Hartman
maintainerQuoted 11 lines · Christian Löhle
Quoted 11 lines
commit
1f311c94aabd("mmc: rtsx: add 74 Clocks in power on flow") upstream. backport note: removed unavailablepower_delay_ms5ms as 10ms is fine, too.SD spec definition:
"Host provides at least 74 Clocks before issuing first command" After 1ms for the voltage stable then start issuing the Clock signalsif POWER STATE is
MMC_POWER_OFFtoMMC_POWER_UPto issue Clock signal to cardMMC_POWER_UPtoMMC_POWER_ONto stop issuing signal to card
Quoted 6 lines
Quoted 4 lines
Signed-off-by Ricky Wu <[email protected]>Signed-off-by Ulf Hansson <[email protected]>Signed-off-by Christian Loehle <[email protected]>---
Now for 4.9.y and 4.14.y, my bad and thanks a lot.
Now queued up, thanks.
greg k-h