Skip to contentSkip to conversation

mmc: Add power_mode MMC_POWER_UNDEFINED

PATCH Applied Roger Tseng 2 participants 5 messages Sep 24, 2014 MMC, SD and SDIO

lore
Share & tools
lore
#0 lore raw

cover mmc: Add power_mode MMC_POWER_UNDEFINED

Invent MMC_POWER_UNDEFINED to describe the initial host power_mode which might be either off or turned on by an early driver such as BIOS or UEFI driver. This lets the later mmc_power_off() do actual power-off things and power_mode will be in a known state eventually.

Roger Tseng (2):
mmc: core: Add new power_mode MMC_POWER_UNDEFINED
mmc: rtsx_pci: Set power related cap2 macros

 drivers/mmc/core/core.c           |    1 +
 drivers/mmc/host/rtsx_pci_sdmmc.c |    1 +
 drivers/mmc/host/rtsx_usb_sdmmc.c |    1 +
 include/linux/mmc/host.h          |    1 +
 4 files changed, 4 insertions(+)
Signature · 1 line
1.7.10.4
#1 lore raw

PATCH 1/2 mmc: core: Add new power_mode MMC_POWER_UNDEFINED

Define new macro MMC_POWER_UNDEFINED for power_mode in struct mmc_ios. It will also be set as the initial value of host->ios.power_mode in mmc_start_host().

For hosts with MMC_CAP2_NO_PRESCAN_POWERUP, this makes the later mmc_power_off() do real power-off things instead of NOP, and further prevents state messed up in cards that was already initialized(eg. by BIOS of UEFI driver).

---
 drivers/mmc/core/core.c  |    1 +
 include/linux/mmc/host.h |    1 +
 2 files changed, 2 insertions(+)
drivers/mmc/core/core.c +1 -0
index d03a080fb9cd..7dad1a1adf18 100644
@@ -2489,6 +2489,7 @@ void mmc_start_host(struct mmc_host *host)
 {
 	host->f_init = max(freqs[0], host->f_min);
 	host->rescan_disable = 0;
+	host->ios.power_mode = MMC_POWER_UNDEFINED;
 	if (host->caps2 & MMC_CAP2_NO_PRESCAN_POWERUP)
 		mmc_power_off(host);
 	else
include/linux/mmc/host.h +1 -0
index 7960424d0bc0..b3bfa609816a 100644
@@ -42,6 +42,7 @@ struct mmc_ios {
 #define MMC_POWER_OFF		0
 #define MMC_POWER_UP		1
 #define MMC_POWER_ON		2
+#define MMC_POWER_UNDEFINED	3
 
 	unsigned char	bus_width;		/* data bus width */
 
Signature · 1 line
1.7.10.4
Applied
#2 lore raw

Re: [PATCH 1/2] mmc: core: Add new power_mode MMC_POWER_UNDEFINED

Quoted 10 lines · Roger Tseng

Define new macro MMC_POWER_UNDEFINED for power_mode in struct mmc_ios. It will also be set as the initial value of host->ios.power_mode in mmc_start_host().

For hosts with MMC_CAP2_NO_PRESCAN_POWERUP, this makes the later mmc_power_off() do real power-off things instead of NOP, and further prevents state messed up in cards that was already initialized(eg. by BIOS of UEFI driver).

Thanks! Applied for next!

I changes some minor parts of the commit message and set the author of the patch to "Roger Tseng <[email protected]>" instead of "<[email protected]>". Please fix that in for future patches.

Kind regards
Uffe

Quoted 32 lines
---
 drivers/mmc/core/core.c  |    1 +
 include/linux/mmc/host.h |    1 +
 2 files changed, 2 insertions(+)
drivers/mmc/core/core.c +1 -0
index d03a080fb9cd..7dad1a1adf18 100644
@@ -2489,6 +2489,7 @@ void mmc_start_host(struct mmc_host *host)
 {
        host->f_init = max(freqs[0], host->f_min);
        host->rescan_disable = 0;
+       host->ios.power_mode = MMC_POWER_UNDEFINED;
        if (host->caps2 & MMC_CAP2_NO_PRESCAN_POWERUP)
                mmc_power_off(host);
        else
include/linux/mmc/host.h +1 -1
index 7960424d0bc0..b3bfa609816a 100644
@@ -42,6 +42,7 @@ struct mmc_ios {
 #define MMC_POWER_OFF          0
 #define MMC_POWER_UP           1
 #define MMC_POWER_ON           2
+#define MMC_POWER_UNDEFINED    3
 
        unsigned char   bus_width;              /* data bus width */
 
--

1.7.10.4

#3 lore raw

PATCH 2/2 mmc: rtsx_pci: Set power related cap2 macros

In reply to Roger Tseng

Set MMC_CAP2_NO_PRESCAN_POWERUP and MMC_CAP2_FULL_PWR_CYCLE for rtsx_pci_sdmmc and rtsx_usb_sdmmc to reflect properties of Realtek card reader hosts.

---
 drivers/mmc/host/rtsx_pci_sdmmc.c |    1 +
 drivers/mmc/host/rtsx_usb_sdmmc.c |    1 +
 2 files changed, 2 insertions(+)
drivers/mmc/host/rtsx_pci_sdmmc.c +1 -0
index dfde4a210238..d49460b5ff07 100644
@@ -1292,6 +1292,7 @@ static void realtek_init_host(struct realtek_pci_sdmmc *host)
 	mmc->caps = MMC_CAP_4_BIT_DATA | MMC_CAP_SD_HIGHSPEED |
 		MMC_CAP_MMC_HIGHSPEED | MMC_CAP_BUS_WIDTH_TEST |
 		MMC_CAP_UHS_SDR12 | MMC_CAP_UHS_SDR25;
+	mmc->caps2 = MMC_CAP2_NO_PRESCAN_POWERUP | MMC_CAP2_FULL_PWR_CYCLE;
 	mmc->max_current_330 = 400;
 	mmc->max_current_180 = 800;
 	mmc->ops = &realtek_pci_sdmmc_ops;
drivers/mmc/host/rtsx_usb_sdmmc.c +1 -0
index 5d3766e792f0..a884631d7eea 100644
@@ -1329,6 +1329,7 @@ static void rtsx_usb_init_host(struct rtsx_usb_sdmmc *host)
 		MMC_CAP_MMC_HIGHSPEED | MMC_CAP_BUS_WIDTH_TEST |
 		MMC_CAP_UHS_SDR12 | MMC_CAP_UHS_SDR25 | MMC_CAP_UHS_SDR50 |
 		MMC_CAP_NEEDS_POLL;
+	mmc->caps2 = MMC_CAP2_NO_PRESCAN_POWERUP | MMC_CAP2_FULL_PWR_CYCLE;
 
 	mmc->max_current_330 = 400;
 	mmc->max_current_180 = 800;
Signature · 1 line
1.7.10.4
Applied
#4 lore raw

Re: [PATCH 2/2] mmc: rtsx_pci: Set power related cap2 macros

Quoted 5 lines · Roger Tseng

Set MMC_CAP2_NO_PRESCAN_POWERUP and MMC_CAP2_FULL_PWR_CYCLE for rtsx_pci_sdmmc and rtsx_usb_sdmmc to reflect properties of Realtek card reader hosts.

Thanks! Applied for next!

Kind regards
Uffe

Quoted 32 lines
---
 drivers/mmc/host/rtsx_pci_sdmmc.c |    1 +
 drivers/mmc/host/rtsx_usb_sdmmc.c |    1 +
 2 files changed, 2 insertions(+)
drivers/mmc/host/rtsx_pci_sdmmc.c +1 -0
index dfde4a210238..d49460b5ff07 100644
@@ -1292,6 +1292,7 @@ static void realtek_init_host(struct realtek_pci_sdmmc *host)
        mmc->caps = MMC_CAP_4_BIT_DATA | MMC_CAP_SD_HIGHSPEED |
                MMC_CAP_MMC_HIGHSPEED | MMC_CAP_BUS_WIDTH_TEST |
                MMC_CAP_UHS_SDR12 | MMC_CAP_UHS_SDR25;
+       mmc->caps2 = MMC_CAP2_NO_PRESCAN_POWERUP | MMC_CAP2_FULL_PWR_CYCLE;
        mmc->max_current_330 = 400;
        mmc->max_current_180 = 800;
        mmc->ops = &realtek_pci_sdmmc_ops;
drivers/mmc/host/rtsx_usb_sdmmc.c +1 -1
index 5d3766e792f0..a884631d7eea 100644
@@ -1329,6 +1329,7 @@ static void rtsx_usb_init_host(struct rtsx_usb_sdmmc *host)
                MMC_CAP_MMC_HIGHSPEED | MMC_CAP_BUS_WIDTH_TEST |
                MMC_CAP_UHS_SDR12 | MMC_CAP_UHS_SDR25 | MMC_CAP_UHS_SDR50 |
                MMC_CAP_NEEDS_POLL;
+       mmc->caps2 = MMC_CAP2_NO_PRESCAN_POWERUP | MMC_CAP2_FULL_PWR_CYCLE;
 
        mmc->max_current_330 = 400;
        mmc->max_current_180 = 800;
--

1.7.10.4