From: Wei WANG Date: Fri, 8 Mar 2013 07:05:57 +0000 (+0800) Subject: mmc: rtsx_pci_sdmmc: Don't execute power up sequence repeatedly X-Git-Tag: v3.10-rc1~96^2~48 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=d88691be7b37c9bba6c5dafbbaff569dd83475da;p=platform%2Fupstream%2Fkernel-adaptation-pc.git mmc: rtsx_pci_sdmmc: Don't execute power up sequence repeatedly For some Realtek card readers, the power up sequence can only be executed when power has been turned off fully. So the rtsx host should not start power up sequence again when set_ios been called if the power has been turned on. Signed-off-by: Wei WANG Signed-off-by: Chris Ball --- diff --git a/drivers/mmc/host/rtsx_pci_sdmmc.c b/drivers/mmc/host/rtsx_pci_sdmmc.c index f981f7d..ad13f42 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 { bool eject; bool initial_mode; bool ddr_mode; + int power_state; +#define SDMMC_POWER_ON 1 +#define SDMMC_POWER_OFF 0 }; 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) struct rtsx_pcr *pcr = host->pcr; int err; + if (host->power_state == SDMMC_POWER_ON) + return 0; + 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, @@ -787,6 +793,7 @@ static int sd_power_on(struct realtek_pci_sdmmc *host) if (err < 0) return err; + host->power_state = SDMMC_POWER_ON; return 0; } @@ -795,6 +802,8 @@ static int sd_power_off(struct realtek_pci_sdmmc *host) struct rtsx_pcr *pcr = host->pcr; int err; + host->power_state = SDMMC_POWER_OFF; + rtsx_pci_init_cmd(pcr); 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) host->pcr = pcr; host->mmc = mmc; host->pdev = pdev; + host->power_state = SDMMC_POWER_OFF; platform_set_drvdata(pdev, host); pcr->slots[RTSX_SD_CARD].p_dev = pdev; pcr->slots[RTSX_SD_CARD].card_event = rtsx_pci_sdmmc_card_event;