mmc: Add power_mode MMC_POWER_UNDEFINED
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
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
@@ -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
@@ -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 3unsigned char bus_width;/* data bus width */
Signature · 1 line
1.7.10.4
Ulf Hansson
AppliedRe: [PATCH 1/2] mmc: core: Add new power_mode MMC_POWER_UNDEFINED
Quoted 10 lines · Roger Tseng
Define new macro
MMC_POWER_UNDEFINEDforpower_modein structmmc_ios. It will also be set as the initial value ofhost->ios.power_modeinmmc_start_host().For hosts with
MMC_CAP2_NO_PRESCAN_POWERUP, this makes the latermmc_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).Signed-off-by Roger Tseng <[email protected]>
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@@ -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@@ -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 3unsigned char bus_width;/* data bus width */ --1.7.10.4
PATCH 2/2 mmc: rtsx_pci: Set power related cap2 macros
In reply to Roger TsengSet 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
@@ -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
@@ -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
Ulf Hansson
AppliedRe: [PATCH 2/2] mmc: rtsx_pci: Set power related cap2 macros
Quoted 5 lines · Roger Tseng
Set
MMC_CAP2_NO_PRESCAN_POWERUPandMMC_CAP2_FULL_PWR_CYCLEforrtsx_pci_sdmmcandrtsx_usb_sdmmcto reflect properties of Realtek card reader hosts.Signed-off-by Roger Tseng <[email protected]>
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@@ -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@@ -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