* [PATCH] mmc/host:rtsx: Don't execute power up sequence repeatedly
@ 2013-03-08 7:05 wei_wang
2013-03-22 16:36 ` Chris Ball
0 siblings, 1 reply; 2+ messages in thread
From: wei_wang @ 2013-03-08 7:05 UTC (permalink / raw)
To: cjb, sameo; +Cc: devel, linux-kernel, linux-mmc, gregkh, rogerable, Wei WANG
From: Wei WANG <wei_wang@realsil.com.cn>
For some Realtek's card reader, power up sequence can only be executed
when power has been turned off fully.
So 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 <wei_wang@realsil.com.cn>
---
drivers/mmc/host/rtsx_pci_sdmmc.c | 10 ++++++++++
1 file changed, 10 insertions(+)
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;
--
1.7.9.5
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] mmc/host:rtsx: Don't execute power up sequence repeatedly
2013-03-08 7:05 [PATCH] mmc/host:rtsx: Don't execute power up sequence repeatedly wei_wang
@ 2013-03-22 16:36 ` Chris Ball
0 siblings, 0 replies; 2+ messages in thread
From: Chris Ball @ 2013-03-22 16:36 UTC (permalink / raw)
To: wei_wang; +Cc: sameo, devel, linux-kernel, linux-mmc, gregkh, rogerable
Hi,
On Fri, Mar 08 2013, wei_wang@realsil.com.cn wrote:
> From: Wei WANG <wei_wang@realsil.com.cn>
>
> For some Realtek's card reader, power up sequence can only be executed
> when power has been turned off fully.
> So 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 <wei_wang@realsil.com.cn>
> ---
> drivers/mmc/host/rtsx_pci_sdmmc.c | 10 ++++++++++
> 1 file changed, 10 insertions(+)
Thanks, pushed to mmc-next for 3.10.
- Chris.
--
Chris Ball <cjb@laptop.org> <http://printf.net/>
One Laptop Per Child
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2013-03-22 16:36 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-03-08 7:05 [PATCH] mmc/host:rtsx: Don't execute power up sequence repeatedly wei_wang
2013-03-22 16:36 ` Chris Ball
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox