diff options
Diffstat (limited to 'drivers/mmc/host/rtsx_pci_sdmmc.c')
-rw-r--r-- | drivers/mmc/host/rtsx_pci_sdmmc.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/drivers/mmc/host/rtsx_pci_sdmmc.c b/drivers/mmc/host/rtsx_pci_sdmmc.c index f981f7d1f6e3..ad13f4240c49 100644 --- a/drivers/mmc/host/rtsx_pci_sdmmc.c +++ b/drivers/mmc/host/rtsx_pci_sdmmc.c | |||
@@ -57,6 +57,9 @@ struct realtek_pci_sdmmc { | |||
57 | bool eject; | 57 | bool eject; |
58 | bool initial_mode; | 58 | bool initial_mode; |
59 | bool ddr_mode; | 59 | bool ddr_mode; |
60 | int power_state; | ||
61 | #define SDMMC_POWER_ON 1 | ||
62 | #define SDMMC_POWER_OFF 0 | ||
60 | }; | 63 | }; |
61 | 64 | ||
62 | static inline struct device *sdmmc_dev(struct realtek_pci_sdmmc *host) | 65 | static inline struct device *sdmmc_dev(struct realtek_pci_sdmmc *host) |
@@ -765,6 +768,9 @@ static int sd_power_on(struct realtek_pci_sdmmc *host) | |||
765 | struct rtsx_pcr *pcr = host->pcr; | 768 | struct rtsx_pcr *pcr = host->pcr; |
766 | int err; | 769 | int err; |
767 | 770 | ||
771 | if (host->power_state == SDMMC_POWER_ON) | ||
772 | return 0; | ||
773 | |||
768 | rtsx_pci_init_cmd(pcr); | 774 | rtsx_pci_init_cmd(pcr); |
769 | rtsx_pci_add_cmd(pcr, WRITE_REG_CMD, CARD_SELECT, 0x07, SD_MOD_SEL); | 775 | rtsx_pci_add_cmd(pcr, WRITE_REG_CMD, CARD_SELECT, 0x07, SD_MOD_SEL); |
770 | rtsx_pci_add_cmd(pcr, WRITE_REG_CMD, CARD_SHARE_MODE, | 776 | rtsx_pci_add_cmd(pcr, WRITE_REG_CMD, CARD_SHARE_MODE, |
@@ -787,6 +793,7 @@ static int sd_power_on(struct realtek_pci_sdmmc *host) | |||
787 | if (err < 0) | 793 | if (err < 0) |
788 | return err; | 794 | return err; |
789 | 795 | ||
796 | host->power_state = SDMMC_POWER_ON; | ||
790 | return 0; | 797 | return 0; |
791 | } | 798 | } |
792 | 799 | ||
@@ -795,6 +802,8 @@ static int sd_power_off(struct realtek_pci_sdmmc *host) | |||
795 | struct rtsx_pcr *pcr = host->pcr; | 802 | struct rtsx_pcr *pcr = host->pcr; |
796 | int err; | 803 | int err; |
797 | 804 | ||
805 | host->power_state = SDMMC_POWER_OFF; | ||
806 | |||
798 | rtsx_pci_init_cmd(pcr); | 807 | rtsx_pci_init_cmd(pcr); |
799 | 808 | ||
800 | rtsx_pci_add_cmd(pcr, WRITE_REG_CMD, CARD_CLK_EN, SD_CLK_EN, 0); | 809 | rtsx_pci_add_cmd(pcr, WRITE_REG_CMD, CARD_CLK_EN, SD_CLK_EN, 0); |
@@ -1260,6 +1269,7 @@ static int rtsx_pci_sdmmc_drv_probe(struct platform_device *pdev) | |||
1260 | host->pcr = pcr; | 1269 | host->pcr = pcr; |
1261 | host->mmc = mmc; | 1270 | host->mmc = mmc; |
1262 | host->pdev = pdev; | 1271 | host->pdev = pdev; |
1272 | host->power_state = SDMMC_POWER_OFF; | ||
1263 | platform_set_drvdata(pdev, host); | 1273 | platform_set_drvdata(pdev, host); |
1264 | pcr->slots[RTSX_SD_CARD].p_dev = pdev; | 1274 | pcr->slots[RTSX_SD_CARD].p_dev = pdev; |
1265 | pcr->slots[RTSX_SD_CARD].card_event = rtsx_pci_sdmmc_card_event; | 1275 | pcr->slots[RTSX_SD_CARD].card_event = rtsx_pci_sdmmc_card_event; |