* [PATCH] mmc: rtsx: add card power off during probe @ 2014-09-12 1:39 micky_ching 2014-09-16 18:01 ` Ulf Hansson 0 siblings, 1 reply; 9+ messages in thread From: micky_ching @ 2014-09-12 1:39 UTC (permalink / raw) To: chris, ulf.hansson, sameo Cc: gregkh, dan.carpenter, devel, linux-kernel, linux-mmc, rogerable, wei_wang, Micky Ching From: Roger Tseng <rogerable@realtek.com> Some platform have both UEFI driver and MFD/mmc driver, if entering linux while card in the slot, the card power is already on, and rtsx-mmc driver have no chance to make card power off. This will lead UHSI card failed to enter UHSI mode. It is hard to control the UEFI driver leaving state, so we power off the card power during probe. Signed-off-by: Roger Tseng <rogerable@realtek.com> Signed-off-by: Micky Ching <micky_ching@realsil.com.cn> --- drivers/mmc/host/rtsx_pci_sdmmc.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/mmc/host/rtsx_pci_sdmmc.c b/drivers/mmc/host/rtsx_pci_sdmmc.c index dfde4a2..57b0796 100644 --- a/drivers/mmc/host/rtsx_pci_sdmmc.c +++ b/drivers/mmc/host/rtsx_pci_sdmmc.c @@ -1341,8 +1341,13 @@ 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; INIT_WORK(&host->work, sd_request); + sd_power_off(host); + /* + * ref: SD spec 3.01: 6.4.1.2 Power On or Power Cycle + */ + usleep_range(1000, 2000); + 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] 9+ messages in thread
* Re: [PATCH] mmc: rtsx: add card power off during probe 2014-09-12 1:39 [PATCH] mmc: rtsx: add card power off during probe micky_ching @ 2014-09-16 18:01 ` Ulf Hansson 2014-09-17 9:11 ` micky 0 siblings, 1 reply; 9+ messages in thread From: Ulf Hansson @ 2014-09-16 18:01 UTC (permalink / raw) To: micky Cc: Chris Ball, Samuel Ortiz, Greg Kroah-Hartman, Dan Carpenter, driverdev-devel@linuxdriverproject.org, linux-kernel@vger.kernel.org, linux-mmc, Roger, Wei WANG On 12 September 2014 03:39, <micky_ching@realsil.com.cn> wrote: > From: Roger Tseng <rogerable@realtek.com> > > Some platform have both UEFI driver and MFD/mmc driver, if entering > linux while card in the slot, the card power is already on, and rtsx-mmc > driver have no chance to make card power off. This will lead UHSI card > failed to enter UHSI mode. > > It is hard to control the UEFI driver leaving state, so we power off the > card power during probe. > > Signed-off-by: Roger Tseng <rogerable@realtek.com> > Signed-off-by: Micky Ching <micky_ching@realsil.com.cn> > --- > drivers/mmc/host/rtsx_pci_sdmmc.c | 7 ++++++- > 1 file changed, 6 insertions(+), 1 deletion(-) > > diff --git a/drivers/mmc/host/rtsx_pci_sdmmc.c b/drivers/mmc/host/rtsx_pci_sdmmc.c > index dfde4a2..57b0796 100644 > --- a/drivers/mmc/host/rtsx_pci_sdmmc.c > +++ b/drivers/mmc/host/rtsx_pci_sdmmc.c > @@ -1341,8 +1341,13 @@ 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; > INIT_WORK(&host->work, sd_request); > + sd_power_off(host); > + /* > + * ref: SD spec 3.01: 6.4.1.2 Power On or Power Cycle > + */ > + usleep_range(1000, 2000); > + This won't work in cases were you power off eMMC cards, unless you can do a full power cycle - cut both VCC and VCCQ. Can you? There are also another option you might want to use, MMC_CAP2_NO_PRESCAN_POWERUP. But again, it must only be used for those hosts that you are able to do a full power cycle for. Kind regards Uffe > 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 [flat|nested] 9+ messages in thread
* Re: [PATCH] mmc: rtsx: add card power off during probe 2014-09-16 18:01 ` Ulf Hansson @ 2014-09-17 9:11 ` micky 2014-09-17 19:29 ` Ulf Hansson 0 siblings, 1 reply; 9+ messages in thread From: micky @ 2014-09-17 9:11 UTC (permalink / raw) To: Ulf Hansson Cc: Chris Ball, Samuel Ortiz, Greg Kroah-Hartman, Dan Carpenter, driverdev-devel@linuxdriverproject.org, linux-kernel@vger.kernel.org, linux-mmc, Roger, Wei WANG On 09/17/2014 02:01 AM, Ulf Hansson wrote: > On 12 September 2014 03:39, <micky_ching@realsil.com.cn> wrote: >> From: Roger Tseng <rogerable@realtek.com> >> >> Some platform have both UEFI driver and MFD/mmc driver, if entering >> linux while card in the slot, the card power is already on, and rtsx-mmc >> driver have no chance to make card power off. This will lead UHSI card >> failed to enter UHSI mode. >> >> It is hard to control the UEFI driver leaving state, so we power off the >> card power during probe. >> >> Signed-off-by: Roger Tseng <rogerable@realtek.com> >> Signed-off-by: Micky Ching <micky_ching@realsil.com.cn> >> --- >> drivers/mmc/host/rtsx_pci_sdmmc.c | 7 ++++++- >> 1 file changed, 6 insertions(+), 1 deletion(-) >> >> diff --git a/drivers/mmc/host/rtsx_pci_sdmmc.c b/drivers/mmc/host/rtsx_pci_sdmmc.c >> index dfde4a2..57b0796 100644 >> --- a/drivers/mmc/host/rtsx_pci_sdmmc.c >> +++ b/drivers/mmc/host/rtsx_pci_sdmmc.c >> @@ -1341,8 +1341,13 @@ 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; >> INIT_WORK(&host->work, sd_request); >> + sd_power_off(host); >> + /* >> + * ref: SD spec 3.01: 6.4.1.2 Power On or Power Cycle >> + */ >> + usleep_range(1000, 2000); >> + > This won't work in cases were you power off eMMC cards, unless you can > do a full power cycle - cut both VCC and VCCQ. Can you? Hi Uffe, VCCQ will poweroff at the same time. if MMC_CAP2_NO_PRESCAN_POWERUP enable, will call mmc_power_off() at start, then it will check ios.power_mode, but the state is MMC_POWER_OFF and just return. Best Regards. micky. > There are also another option you might want to use, > MMC_CAP2_NO_PRESCAN_POWERUP. But again, it must only be used for those > hosts that you are able to do a full power cycle for. > > Kind regards > Uffe > >> 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 [flat|nested] 9+ messages in thread
* Re: [PATCH] mmc: rtsx: add card power off during probe 2014-09-17 9:11 ` micky @ 2014-09-17 19:29 ` Ulf Hansson 2014-09-18 7:19 ` Roger Tseng 0 siblings, 1 reply; 9+ messages in thread From: Ulf Hansson @ 2014-09-17 19:29 UTC (permalink / raw) To: micky Cc: Chris Ball, Samuel Ortiz, Greg Kroah-Hartman, Dan Carpenter, driverdev-devel@linuxdriverproject.org, linux-kernel@vger.kernel.org, linux-mmc, Roger, Wei WANG On 17 September 2014 11:11, micky <micky_ching@realsil.com.cn> wrote: > On 09/17/2014 02:01 AM, Ulf Hansson wrote: >> >> On 12 September 2014 03:39, <micky_ching@realsil.com.cn> wrote: >>> >>> From: Roger Tseng <rogerable@realtek.com> >>> >>> Some platform have both UEFI driver and MFD/mmc driver, if entering >>> linux while card in the slot, the card power is already on, and rtsx-mmc >>> driver have no chance to make card power off. This will lead UHSI card >>> failed to enter UHSI mode. >>> >>> It is hard to control the UEFI driver leaving state, so we power off the >>> card power during probe. >>> >>> Signed-off-by: Roger Tseng <rogerable@realtek.com> >>> Signed-off-by: Micky Ching <micky_ching@realsil.com.cn> >>> --- >>> drivers/mmc/host/rtsx_pci_sdmmc.c | 7 ++++++- >>> 1 file changed, 6 insertions(+), 1 deletion(-) >>> >>> diff --git a/drivers/mmc/host/rtsx_pci_sdmmc.c >>> b/drivers/mmc/host/rtsx_pci_sdmmc.c >>> index dfde4a2..57b0796 100644 >>> --- a/drivers/mmc/host/rtsx_pci_sdmmc.c >>> +++ b/drivers/mmc/host/rtsx_pci_sdmmc.c >>> @@ -1341,8 +1341,13 @@ 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; >>> INIT_WORK(&host->work, sd_request); >>> + sd_power_off(host); >>> + /* >>> + * ref: SD spec 3.01: 6.4.1.2 Power On or Power Cycle >>> + */ >>> + usleep_range(1000, 2000); >>> + >> >> This won't work in cases were you power off eMMC cards, unless you can >> do a full power cycle - cut both VCC and VCCQ. Can you? > > Hi Uffe, > > VCCQ will poweroff at the same time. In that case, don't forget to enable MMC_CAP2_FULL_PWR_CYCLE. > > if MMC_CAP2_NO_PRESCAN_POWERUP enable, will call mmc_power_off() at start, > then it will check ios.power_mode, but the state is MMC_POWER_OFF and just > return. Uhh, that's right! So, I wonder why we invokes mmc_power_off() from that path at all. Hmm, I think we should change the behavior in mmc_start_host(), like below: 1) Add a "MMC_POWER_UNDEFINED" state which is what the power state should be assigned to at allocation. 2 ) From mmc_start_host(), invoke mmc_power_off() when MMC_CAP2_NO_PRESCAN_POWERUP and MMC_CAP2_FULL_PWR_CYCLE is set. Would that work? Kind regards Uffe > Best Regards. > micky. > >> There are also another option you might want to use, >> MMC_CAP2_NO_PRESCAN_POWERUP. But again, it must only be used for those >> hosts that you are able to do a full power cycle for. >> >> Kind regards >> Uffe >> >>> 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 [flat|nested] 9+ messages in thread
* Re: [PATCH] mmc: rtsx: add card power off during probe 2014-09-17 19:29 ` Ulf Hansson @ 2014-09-18 7:19 ` Roger Tseng 2014-09-18 21:14 ` Ulf Hansson 0 siblings, 1 reply; 9+ messages in thread From: Roger Tseng @ 2014-09-18 7:19 UTC (permalink / raw) To: Ulf Hansson Cc: micky, Chris Ball, Samuel Ortiz, Greg Kroah-Hartman, Dan Carpenter, driverdev-devel@linuxdriverproject.org, linux-kernel@vger.kernel.org, linux-mmc, Wei_wang [-- Warning: decoded text below may be mangled, UTF-8 assumed --] [-- Attachment #1: Type: text/plain; charset="utf-8", Size: 5251 bytes --] On Wed, 2014-09-17 at 21:29 +0200, Ulf Hansson wrote: > On 17 September 2014 11:11, micky <micky_ching@realsil.com.cn> wrote: > > On 09/17/2014 02:01 AM, Ulf Hansson wrote: > >> > >> On 12 September 2014 03:39, <micky_ching@realsil.com.cn> wrote: > >>> > >>> From: Roger Tseng <rogerable@realtek.com> > >>> > >>> Some platform have both UEFI driver and MFD/mmc driver, if entering > >>> linux while card in the slot, the card power is already on, and rtsx-mmc > >>> driver have no chance to make card power off. This will lead UHSI card > >>> failed to enter UHSI mode. > >>> > >>> It is hard to control the UEFI driver leaving state, so we power off the > >>> card power during probe. > >>> > >>> Signed-off-by: Roger Tseng <rogerable@realtek.com> > >>> Signed-off-by: Micky Ching <micky_ching@realsil.com.cn> > >>> --- > >>> drivers/mmc/host/rtsx_pci_sdmmc.c | 7 ++++++- > >>> 1 file changed, 6 insertions(+), 1 deletion(-) > >>> > >>> diff --git a/drivers/mmc/host/rtsx_pci_sdmmc.c > >>> b/drivers/mmc/host/rtsx_pci_sdmmc.c > >>> index dfde4a2..57b0796 100644 > >>> --- a/drivers/mmc/host/rtsx_pci_sdmmc.c > >>> +++ b/drivers/mmc/host/rtsx_pci_sdmmc.c > >>> @@ -1341,8 +1341,13 @@ 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; > >>> INIT_WORK(&host->work, sd_request); > >>> + sd_power_off(host); > >>> + /* > >>> + * ref: SD spec 3.01: 6.4.1.2 Power On or Power Cycle > >>> + */ > >>> + usleep_range(1000, 2000); > >>> + > >> > >> This won't work in cases were you power off eMMC cards, unless you can > >> do a full power cycle - cut both VCC and VCCQ. Can you? > > > > Hi Uffe, > > > > VCCQ will poweroff at the same time. > > In that case, don't forget to enable MMC_CAP2_FULL_PWR_CYCLE. > > > > > if MMC_CAP2_NO_PRESCAN_POWERUP enable, will call mmc_power_off() at start, > > then it will check ios.power_mode, but the state is MMC_POWER_OFF and just > > return. > > Uhh, that's right! So, I wonder why we invokes mmc_power_off() from > that path at all. > > Hmm, I think we should change the behavior in mmc_start_host(), like below: > 1) Add a "MMC_POWER_UNDEFINED" state which is what the power state > should be assigned to at allocation. > 2 ) From mmc_start_host(), invoke mmc_power_off() when > MMC_CAP2_NO_PRESCAN_POWERUP and MMC_CAP2_FULL_PWR_CYCLE is set. > > Would that work? Yes. I have confirmed this by following changes. The MMC_POWER_UNDEFINED designation in mmc_start_host() will eventually cause a power-off operation. But I wonder if we need to additionally check MMC_CAP2_FULL_PWR_CYCLE before calling mmc_power_off()? diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c index d03a080fb9cd..3457b0f74b71 100644 --- a/drivers/mmc/core/core.c +++ b/drivers/mmc/core/core.c @@ -2489,7 +2489,9 @@ void mmc_start_host(struct mmc_host *host) { host->f_init = max(freqs[0], host->f_min); host->rescan_disable = 0; - if (host->caps2 & MMC_CAP2_NO_PRESCAN_POWERUP) + host->ios.power_mode = MMC_POWER_UNDEFINED; + if (host->caps2 & (MMC_CAP2_NO_PRESCAN_POWERUP | + MMC_CAP2_FULL_PWR_CYCLE)) mmc_power_off(host); else mmc_power_up(host, host->ocr_avail); diff --git a/drivers/mmc/host/rtsx_pci_sdmmc.c b/drivers/mmc/host/rtsx_pci_sdmmc.c index dfde4a210238..d49460b5ff07 100644 --- a/drivers/mmc/host/rtsx_pci_sdmmc.c +++ b/drivers/mmc/host/rtsx_pci_sdmmc.c @@ -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; diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h index 7960424d0bc0..b3bfa609816a 100644 --- a/include/linux/mmc/host.h +++ b/include/linux/mmc/host.h @@ -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 */ > Kind regards > Uffe > > > Best Regards. > > micky. > > > >> There are also another option you might want to use, > >> MMC_CAP2_NO_PRESCAN_POWERUP. But again, it must only be used for those > >> hosts that you are able to do a full power cycle for. > >> > >> Kind regards > >> Uffe > >> > >>> 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 > >>> > >> . > >> > > > > ------Please consider the environment before printing this e-mail. -- Best regards, Roger Tseng ÿôèº{.nÇ+·®+%Ëÿ±éݶ\x17¥wÿº{.nÇ+·¥{±þG«éÿ{ayº\x1dÊÚë,j\a¢f£¢·hïêÿêçz_è®\x03(éÝ¢j"ú\x1a¶^[m§ÿÿ¾\a«þG«éÿ¢¸?¨èÚ&£ø§~á¶iOæ¬z·vØ^\x14\x04\x1a¶^[m§ÿÿÃ\fÿ¶ìÿ¢¸?I¥ ^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH] mmc: rtsx: add card power off during probe 2014-09-18 7:19 ` Roger Tseng @ 2014-09-18 21:14 ` Ulf Hansson 2014-09-22 10:09 ` Roger Tseng 0 siblings, 1 reply; 9+ messages in thread From: Ulf Hansson @ 2014-09-18 21:14 UTC (permalink / raw) To: Roger Tseng Cc: micky, Chris Ball, Samuel Ortiz, Greg Kroah-Hartman, Dan Carpenter, driverdev-devel@linuxdriverproject.org, linux-kernel@vger.kernel.org, linux-mmc, Wei_wang [...] >> >> In that case, don't forget to enable MMC_CAP2_FULL_PWR_CYCLE. >> >> > >> > if MMC_CAP2_NO_PRESCAN_POWERUP enable, will call mmc_power_off() at start, >> > then it will check ios.power_mode, but the state is MMC_POWER_OFF and just >> > return. >> >> Uhh, that's right! So, I wonder why we invokes mmc_power_off() from >> that path at all. >> >> Hmm, I think we should change the behavior in mmc_start_host(), like below: >> 1) Add a "MMC_POWER_UNDEFINED" state which is what the power state >> should be assigned to at allocation. >> 2 ) From mmc_start_host(), invoke mmc_power_off() when >> MMC_CAP2_NO_PRESCAN_POWERUP and MMC_CAP2_FULL_PWR_CYCLE is set. >> >> Would that work? > Yes. I have confirmed this by following changes. The MMC_POWER_UNDEFINED > designation in mmc_start_host() will eventually cause a power-off > operation. > > But I wonder if we need to additionally check MMC_CAP2_FULL_PWR_CYCLE > before calling mmc_power_off()? The intent from my side was to keep the current behaviour for those that already used MMC_CAP2_NO_PRESCAN_POWERUP, but it's s not a big deal. So, let's try your proposal, thus don't check MMC_CAP2_FULL_PWR_CYCLE. Can you repost new version of your patches and please split them up on core and host separately. Kind regards Uffe ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] mmc: rtsx: add card power off during probe 2014-09-18 21:14 ` Ulf Hansson @ 2014-09-22 10:09 ` Roger Tseng 2014-09-23 9:20 ` Ulf Hansson 0 siblings, 1 reply; 9+ messages in thread From: Roger Tseng @ 2014-09-22 10:09 UTC (permalink / raw) To: Ulf Hansson Cc: micky, Chris Ball, Samuel Ortiz, Greg Kroah-Hartman, Dan Carpenter, driverdev-devel@linuxdriverproject.org, linux-kernel@vger.kernel.org, linux-mmc, Wei_wang [-- Warning: decoded text below may be mangled, UTF-8 assumed --] [-- Attachment #1: Type: text/plain; charset="utf-8", Size: 2094 bytes --] On Thu, 2014-09-18 at 23:14 +0200, Ulf Hansson wrote: > [...] > > >> > >> In that case, don't forget to enable MMC_CAP2_FULL_PWR_CYCLE. > >> > >> > > >> > if MMC_CAP2_NO_PRESCAN_POWERUP enable, will call mmc_power_off() at start, > >> > then it will check ios.power_mode, but the state is MMC_POWER_OFF and just > >> > return. > >> > >> Uhh, that's right! So, I wonder why we invokes mmc_power_off() from > >> that path at all. > >> > >> Hmm, I think we should change the behavior in mmc_start_host(), like below: > >> 1) Add a "MMC_POWER_UNDEFINED" state which is what the power state > >> should be assigned to at allocation. > >> 2 ) From mmc_start_host(), invoke mmc_power_off() when > >> MMC_CAP2_NO_PRESCAN_POWERUP and MMC_CAP2_FULL_PWR_CYCLE is set. > >> > >> Would that work? > > Yes. I have confirmed this by following changes. The MMC_POWER_UNDEFINED > > designation in mmc_start_host() will eventually cause a power-off > > operation. > > > > But I wonder if we need to additionally check MMC_CAP2_FULL_PWR_CYCLE > > before calling mmc_power_off()? > > The intent from my side was to keep the current behaviour for those > that already used MMC_CAP2_NO_PRESCAN_POWERUP, but it's s not a big > deal. > I checked the log and found the commit that invokes mmc_power_off(): a08b17be8b984a7c51cd5a480cd977363df353f9 0d3e3350d5871c53464be4c92d57198744247005 (https://www.mail-archive.com/linux-mmc@vger.kernel.org/msg19638.html ) The proposed change might bring back some delay since invoking mmc_power_off() in mmc_start_host() is more than NOP now and triggers real power-off and re-init in sdhci. Will this be OK? > So, let's try your proposal, thus don't check MMC_CAP2_FULL_PWR_CYCLE. > > Can you repost new version of your patches and please split them up on > core and host separately. > > Kind regards > Uffe > > ------Please consider the environment before printing this e-mail. -- Best regards, Roger Tseng ÿôèº{.nÇ+·®+%Ëÿ±éݶ\x17¥wÿº{.nÇ+·¥{±þG«éÿ{ayº\x1dÊÚë,j\a¢f£¢·hïêÿêçz_è®\x03(éÝ¢j"ú\x1a¶^[m§ÿÿ¾\a«þG«éÿ¢¸?¨èÚ&£ø§~á¶iOæ¬z·vØ^\x14\x04\x1a¶^[m§ÿÿÃ\fÿ¶ìÿ¢¸?I¥ ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] mmc: rtsx: add card power off during probe 2014-09-22 10:09 ` Roger Tseng @ 2014-09-23 9:20 ` Ulf Hansson 2014-09-23 19:51 ` Adrian Hunter 0 siblings, 1 reply; 9+ messages in thread From: Ulf Hansson @ 2014-09-23 9:20 UTC (permalink / raw) To: Roger Tseng Cc: micky, Chris Ball, Samuel Ortiz, Greg Kroah-Hartman, Dan Carpenter, driverdev-devel@linuxdriverproject.org, linux-kernel@vger.kernel.org, linux-mmc, Wei_wang, Adrian Hunter On 22 September 2014 12:09, Roger Tseng <rogerable@realtek.com> wrote: > On Thu, 2014-09-18 at 23:14 +0200, Ulf Hansson wrote: >> [...] >> >> >> >> >> In that case, don't forget to enable MMC_CAP2_FULL_PWR_CYCLE. >> >> >> >> > >> >> > if MMC_CAP2_NO_PRESCAN_POWERUP enable, will call mmc_power_off() at start, >> >> > then it will check ios.power_mode, but the state is MMC_POWER_OFF and just >> >> > return. >> >> >> >> Uhh, that's right! So, I wonder why we invokes mmc_power_off() from >> >> that path at all. >> >> >> >> Hmm, I think we should change the behavior in mmc_start_host(), like below: >> >> 1) Add a "MMC_POWER_UNDEFINED" state which is what the power state >> >> should be assigned to at allocation. >> >> 2 ) From mmc_start_host(), invoke mmc_power_off() when >> >> MMC_CAP2_NO_PRESCAN_POWERUP and MMC_CAP2_FULL_PWR_CYCLE is set. >> >> >> >> Would that work? >> > Yes. I have confirmed this by following changes. The MMC_POWER_UNDEFINED >> > designation in mmc_start_host() will eventually cause a power-off >> > operation. >> > >> > But I wonder if we need to additionally check MMC_CAP2_FULL_PWR_CYCLE >> > before calling mmc_power_off()? >> >> The intent from my side was to keep the current behaviour for those >> that already used MMC_CAP2_NO_PRESCAN_POWERUP, but it's s not a big >> deal. >> > > I checked the log and found the commit that invokes mmc_power_off(): > a08b17be8b984a7c51cd5a480cd977363df353f9 > 0d3e3350d5871c53464be4c92d57198744247005 > (https://www.mail-archive.com/linux-mmc@vger.kernel.org/msg19638.html ) > > The proposed change might bring back some delay since invoking > mmc_power_off() in mmc_start_host() is more than NOP now and triggers > real power-off and re-init in sdhci. Actually the above commits was added due to the below commit: fa5501890d8974301042e0202d342a6cbe8609f4 But the commits you refer to, didn't bring back the old behaviour, which I think was the intent. Instead we added a NOP call to mmc_power_off() from mmc_start_host(). We have few options on how to go forward, but let's loop in Adrian Hunter first, since he might be able to comment on this as well. Kind regards Uffe ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] mmc: rtsx: add card power off during probe 2014-09-23 9:20 ` Ulf Hansson @ 2014-09-23 19:51 ` Adrian Hunter 0 siblings, 0 replies; 9+ messages in thread From: Adrian Hunter @ 2014-09-23 19:51 UTC (permalink / raw) To: Ulf Hansson, Roger Tseng Cc: micky, Chris Ball, Samuel Ortiz, Greg Kroah-Hartman, Dan Carpenter, driverdev-devel@linuxdriverproject.org, linux-kernel@vger.kernel.org, linux-mmc, Wei_wang On 23/09/2014 12:20 p.m., Ulf Hansson wrote: > On 22 September 2014 12:09, Roger Tseng <rogerable@realtek.com> wrote: >> On Thu, 2014-09-18 at 23:14 +0200, Ulf Hansson wrote: >>> [...] >>> >>>>> >>>>> In that case, don't forget to enable MMC_CAP2_FULL_PWR_CYCLE. >>>>> >>>>>> >>>>>> if MMC_CAP2_NO_PRESCAN_POWERUP enable, will call mmc_power_off() at start, >>>>>> then it will check ios.power_mode, but the state is MMC_POWER_OFF and just >>>>>> return. >>>>> >>>>> Uhh, that's right! So, I wonder why we invokes mmc_power_off() from >>>>> that path at all. >>>>> >>>>> Hmm, I think we should change the behavior in mmc_start_host(), like below: >>>>> 1) Add a "MMC_POWER_UNDEFINED" state which is what the power state >>>>> should be assigned to at allocation. >>>>> 2 ) From mmc_start_host(), invoke mmc_power_off() when >>>>> MMC_CAP2_NO_PRESCAN_POWERUP and MMC_CAP2_FULL_PWR_CYCLE is set. >>>>> >>>>> Would that work? >>>> Yes. I have confirmed this by following changes. The MMC_POWER_UNDEFINED >>>> designation in mmc_start_host() will eventually cause a power-off >>>> operation. >>>> >>>> But I wonder if we need to additionally check MMC_CAP2_FULL_PWR_CYCLE >>>> before calling mmc_power_off()? >>> >>> The intent from my side was to keep the current behaviour for those >>> that already used MMC_CAP2_NO_PRESCAN_POWERUP, but it's s not a big >>> deal. >>> >> >> I checked the log and found the commit that invokes mmc_power_off(): >> a08b17be8b984a7c51cd5a480cd977363df353f9 >> 0d3e3350d5871c53464be4c92d57198744247005 >> (https://www.mail-archive.com/linux-mmc@vger.kernel.org/msg19638.html ) >> >> The proposed change might bring back some delay since invoking >> mmc_power_off() in mmc_start_host() is more than NOP now and triggers >> real power-off and re-init in sdhci. > > Actually the above commits was added due to the below commit: > > fa5501890d8974301042e0202d342a6cbe8609f4 > > But the commits you refer to, didn't bring back the old behaviour, > which I think was the intent. Instead we added a NOP call to > mmc_power_off() from mmc_start_host(). > > We have few options on how to go forward, but let's loop in Adrian > Hunter first, since he might be able to comment on this as well. Having mmc_power_off() in mmc_start_host() actually power off should be OK. ^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2014-09-23 19:51 UTC | newest] Thread overview: 9+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2014-09-12 1:39 [PATCH] mmc: rtsx: add card power off during probe micky_ching 2014-09-16 18:01 ` Ulf Hansson 2014-09-17 9:11 ` micky 2014-09-17 19:29 ` Ulf Hansson 2014-09-18 7:19 ` Roger Tseng 2014-09-18 21:14 ` Ulf Hansson 2014-09-22 10:09 ` Roger Tseng 2014-09-23 9:20 ` Ulf Hansson 2014-09-23 19:51 ` Adrian Hunter
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).