Skip to contentSkip to conversation

mmc: rtsx: add delay before power on

PATCH In review [email protected] 2 participants 5 messages Dec 30, 2020 – Jan 13, 2021 MMC, SD and SDIO

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 mmc: rtsx: add delay before power on

From: Ricky Wu <[email protected]>

Make sure voltage below 0.5V before power on
when do power cycle

---
 drivers/mmc/host/rtsx_pci_sdmmc.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/mmc/host/rtsx_pci_sdmmc.c +2 -0
index e6f5bbce5685..d21b99962b36 100644
@@ -906,6 +906,8 @@ static int sd_power_on(struct realtek_pci_sdmmc *host)
 	if (host->power_state == SDMMC_POWER_ON)
 		return 0;
 
+	mdelay(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,
Signature · 1 line
2.17.1
#1 lore raw

PATCH 2/2 mmc: rtsx: Add MMC_CAP2_NO_SDIO flag

From: Ricky Wu <[email protected]>

Added flag MMC_CAP2_NO_SDIO to mmc->caps2
Card Reader not support SDIO

---
 drivers/mmc/host/rtsx_pci_sdmmc.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/mmc/host/rtsx_pci_sdmmc.c +2 -1
index d21b99962b36..6a8b0282f272 100644
@@ -1427,7 +1427,8 @@ static void realtek_init_host(struct realtek_pci_sdmmc *host)
 		MMC_CAP_UHS_SDR12 | MMC_CAP_UHS_SDR25;
 	if (pcr->rtd3_en)
 		mmc->caps = mmc->caps | MMC_CAP_AGGRESSIVE_PM;
-	mmc->caps2 = MMC_CAP2_NO_PRESCAN_POWERUP | MMC_CAP2_FULL_PWR_CYCLE;
+	mmc->caps2 = MMC_CAP2_NO_PRESCAN_POWERUP | MMC_CAP2_FULL_PWR_CYCLE |
+		MMC_CAP2_NO_SDIO;
 	mmc->max_current_330 = 400;
 	mmc->max_current_180 = 800;
 	mmc->ops = &realtek_pci_sdmmc_ops;
Signature · 1 line
2.17.1
#2 lore raw

Re: [PATCH 2/2] mmc: rtsx: Add MMC_CAP2_NO_SDIO flag

Quoted 7 lines · On Wed, 30 Dec 2020 at 10:04, <[email protected]> wrote:

From: Ricky Wu <[email protected]>

Added flag MMC_CAP2_NO_SDIO to mmc->caps2
Card Reader not support SDIO

Applied for next, thanks!

Kind regards
Uffe

Quoted 21 lines
---
 drivers/mmc/host/rtsx_pci_sdmmc.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/mmc/host/rtsx_pci_sdmmc.c +2 -2
index d21b99962b36..6a8b0282f272 100644
@@ -1427,7 +1427,8 @@ static void realtek_init_host(struct realtek_pci_sdmmc *host)
                MMC_CAP_UHS_SDR12 | MMC_CAP_UHS_SDR25;
        if (pcr->rtd3_en)
                mmc->caps = mmc->caps | MMC_CAP_AGGRESSIVE_PM;
-       mmc->caps2 = MMC_CAP2_NO_PRESCAN_POWERUP | MMC_CAP2_FULL_PWR_CYCLE;
+       mmc->caps2 = MMC_CAP2_NO_PRESCAN_POWERUP | MMC_CAP2_FULL_PWR_CYCLE |
+               MMC_CAP2_NO_SDIO;
        mmc->max_current_330 = 400;
        mmc->max_current_180 = 800;
        mmc->ops = &realtek_pci_sdmmc_ops;
--

2.17.1

#3 lore raw
In reply to [email protected]
Quoted 16 lines · On Wed, 30 Dec 2020 at 10:04, <[email protected]> wrote:

From: Ricky Wu <[email protected]>

Make sure voltage below 0.5V before power on
when do power cycle

---
 drivers/mmc/host/rtsx_pci_sdmmc.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/mmc/host/rtsx_pci_sdmmc.c +0 -0
index e6f5bbce5685..d21b99962b36 100644

drivers/mmc/host/rtsx_pci_sdmmc.c static int sd_power_on(struct realtek_pci_sdmmc *host) · line 910

Quoted 5 lines
drivers/mmc/host/rtsx_pci_sdmmc.c +2 -0
@@ -906,6 +906,8 @@ static int sd_power_on(struct realtek_pci_sdmmc *host)
        if (host->power_state == SDMMC_POWER_ON)
                return 0;
 
+       mdelay(100);
+

Why exactly 100 ms? Can you at least add a comment about why in the code?

Moreover, I think you should convert to use msleep() rather than mdelay.

Quoted 6 lines
drivers/mmc/host/rtsx_pci_sdmmc.c +0 -1
        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,
--

2.17.1

Kind regards
Uffe

#4 lore raw
Quoted 21 lines · On Wed, 30 Dec 2020 at 10:04, <[email protected]> wrote:

drivers/mmc/host/rtsx_pci_sdmmc.c static int sd_power_on(struct realtek_pci_sdmmc

Quoted 16 lines

From: Ricky Wu <[email protected]>

Make sure voltage below 0.5V before power on when do power cycle

---
 drivers/mmc/host/rtsx_pci_sdmmc.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/mmc/host/rtsx_pci_sdmmc.c +0 -0
index e6f5bbce5685..d21b99962b36 100644
@@ -906,6 +906,8 @@ static int sd_power_on(struct realtek_pci_sdmmc

*host)

Quoted 3 lines
drivers/mmc/host/rtsx_pci_sdmmc.c +0 -0
        if (host->power_state == SDMMC_POWER_ON)
                return 0;
 
Quoted 7 lines

drivers/mmc/host/rtsx_pci_sdmmc.c static int sd_power_on(struct realtek_pci_sdmmc *host) · line 910

Quoted 2 lines
drivers/mmc/host/rtsx_pci_sdmmc.c +2 -0
+       mdelay(100);
+

Why exactly 100 ms? Can you at least add a comment about why in the code?

Moreover, I think you should convert to use msleep() rather than mdelay.

Because we need to make sure voltage below 0.5V before power on mmc-core will do quickly power cycle at recognition card phase, we need at least 100ms to make our device voltage below 0.5V

I will change mdelay() to msleep()

Quoted 12 lines

drivers/mmc/host/rtsx_pci_sdmmc.c static int sd_power_on(struct realtek_pci_sdmmc · line 912

Quoted 2 lines
drivers/mmc/host/rtsx_pci_sdmmc.c +0 -0
        rtsx_pci_init_cmd(pcr);
        rtsx_pci_add_cmd(pcr, WRITE_REG_CMD, CARD_SELECT, 0x07,

SD_MOD_SEL);

Quoted 4 lines
drivers/mmc/host/rtsx_pci_sdmmc.c +0 -1
        rtsx_pci_add_cmd(pcr, WRITE_REG_CMD, CARD_SHARE_MODE,
--

2.17.1

Kind regards
Uffe

------Please consider the environment before printing this e-mail.