mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Yann Gautier <yann.gautier@foss.st.com>
To: Ulf Hansson <ulf.hansson@linaro.org>
Cc: <linux-kernel@vger.kernel.org>, <linux-mmc@vger.kernel.org>,
	<linux-stm32@st-md-mailman.stormreply.com>,
	Christophe Kerello <christophe.kerello@foss.st.com>,
	Linus Walleij <linus.walleij@linaro.org>,
	Ludovic Barre <ludovic.barre@foss.st.com>,
	Philipp Zabel <p.zabel@pengutronix.de>,
	Russell King <linux@armlinux.org.uk>, Marek Vasut <marex@denx.de>,
	<kernel@dh-electronics.com>,
	Manivannan Sadhasivam <mani@kernel.org>,
	Grzegorz Szymaszek <gszymaszek@short.pl>
Subject: Re: [PATCH v2] mmc: mmci: manage MMC_PM_KEEP_POWER per variant config
Date: Mon, 14 Mar 2022 17:51:53 +0100	[thread overview]
Message-ID: <ce29e53a-59ff-000a-6b88-0b7ae538c515@foss.st.com> (raw)
In-Reply-To: <CAPDyKFq2Du1UWpvRFpVF_qL65SP0DfEV872U9Xe-9i7xKxXhqg@mail.gmail.com>

On 3/14/22 17:18, Ulf Hansson wrote:
> On Mon, 14 Mar 2022 at 15:34, Yann Gautier <yann.gautier@foss.st.com> wrote:
>>
>> On 3/14/22 14:03, Ulf Hansson wrote:
>>> On Mon, 14 Mar 2022 at 13:56, Yann Gautier <yann.gautier@foss.st.com> wrote:
>>>>
>>>> Add a disable_keep_power field in variant_data struct. The
>>>> MMC_PM_KEEP_POWER flag will be enabled if disable_keep_power is not set.
>>>> It is only set to true for stm32_sdmmc variants.
>>>>
>>>> The issue was seen on STM32MP157C-DK2 board, which embeds a wifi chip.
>>>> It doesn't correctly support low power on this board. The Wifi chip
>>>> awaits an always-on regulator, but it was connected to v3v3 which is off
>>>> in low-power sequence. MMC_PM_KEEP_POWER should then be disabled.
>>>
>>> Just to make sure I get this correct.
>>>
>>> Why can't the regulator stay on during system suspend? The point is,
>>> we don't need an always on regulator to cope with this.
>>>
>>> Kind regards
>>> Uffe
>>
>> Hi Ulf,
>>
>> This v3v3 regulator powers most of the devices on this board. So we need
>> to switch it off to gain power in suspend mode.
> 
> I see. Thanks for sharing that information.
> 
> The MMC_PM_KEEP_POWER flag is there to describe what is supported by
> the platform/host. It doesn't mean that the card *must* stay powered
> on during system suspend. Instead that depends on whether system
> wakeup for the SDIO/WiFi is supported too - and if that is enabled by
> userspace. If not, the regulator will be turned off for the SDIO card
> during system suspend.
> 
> Assuming the regulator is implemented as a proper regulator and can
> remain on during system suspend, the right thing would be to keep the
> MMC_PM_KEEP_POWER flag around.
> 
> Kind regards
> Uffe
> 

OK, but in the wifi driver we use on this platform (brcmfmac), the 
suspend/resume functions (brcmf_ops_sdio_suspend/brcmf_ops_sdio_resume) 
use the flag to check regu was off, and then call probe function during 
resume, to re-init Wifi chip and reload its firmware.


Best regards,
Yann

>>
>>
>> Yann
>>
>>>
>>>>
>>>> The flag can still be enabled through DT property:
>>>> keep-power-in-suspend.
>>>>
>>>> Signed-off-by: Yann Gautier <yann.gautier@foss.st.com>
>>>> ---
>>>> Update in v2:
>>>> Reword commit message to better explain the issue.
>>>>
>>>> Resend the patch alone. It was previoulsy in a series [1] for which the
>>>> other patches will be reworked.
>>>>
>>>> [1] https://lore.kernel.org/lkml/20220304135134.47827-1-yann.gautier@foss.st.com/
>>>>
>>>>    drivers/mmc/host/mmci.c | 5 ++++-
>>>>    drivers/mmc/host/mmci.h | 1 +
>>>>    2 files changed, 5 insertions(+), 1 deletion(-)
>>>>
>>>> diff --git a/drivers/mmc/host/mmci.c b/drivers/mmc/host/mmci.c
>>>> index 45b8608c935c..0e2f2f5d6a52 100644
>>>> --- a/drivers/mmc/host/mmci.c
>>>> +++ b/drivers/mmc/host/mmci.c
>>>> @@ -274,6 +274,7 @@ static struct variant_data variant_stm32_sdmmc = {
>>>>           .busy_detect            = true,
>>>>           .busy_detect_flag       = MCI_STM32_BUSYD0,
>>>>           .busy_detect_mask       = MCI_STM32_BUSYD0ENDMASK,
>>>> +       .disable_keep_power     = true,
>>>>           .init                   = sdmmc_variant_init,
>>>>    };
>>>>
>>>> @@ -301,6 +302,7 @@ static struct variant_data variant_stm32_sdmmcv2 = {
>>>>           .busy_detect            = true,
>>>>           .busy_detect_flag       = MCI_STM32_BUSYD0,
>>>>           .busy_detect_mask       = MCI_STM32_BUSYD0ENDMASK,
>>>> +       .disable_keep_power     = true,
>>>>           .init                   = sdmmc_variant_init,
>>>>    };
>>>>
>>>> @@ -2172,7 +2174,8 @@ static int mmci_probe(struct amba_device *dev,
>>>>           host->stop_abort.flags = MMC_RSP_R1B | MMC_CMD_AC;
>>>>
>>>>           /* We support these PM capabilities. */
>>>> -       mmc->pm_caps |= MMC_PM_KEEP_POWER;
>>>> +       if (!variant->disable_keep_power)
>>>> +               mmc->pm_caps |= MMC_PM_KEEP_POWER;
>>>>
>>>>           /*
>>>>            * We can do SGIO
>>>> diff --git a/drivers/mmc/host/mmci.h b/drivers/mmc/host/mmci.h
>>>> index e1a9b96a3396..2cad1ef9766a 100644
>>>> --- a/drivers/mmc/host/mmci.h
>>>> +++ b/drivers/mmc/host/mmci.h
>>>> @@ -361,6 +361,7 @@ struct variant_data {
>>>>           u32                     opendrain;
>>>>           u8                      dma_lli:1;
>>>>           u32                     stm32_idmabsize_mask;
>>>> +       u8                      disable_keep_power:1;
>>>>           void (*init)(struct mmci_host *host);
>>>>    };
>>>>
>>>> --
>>>> 2.25.1
>>>>
>>


  reply	other threads:[~2022-03-14 16:52 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-14  9:52 [PATCH RESEND] " Yann Gautier
2022-03-14 11:17 ` Ulf Hansson
2022-03-14 12:20   ` Yann Gautier
2022-03-14 12:53     ` Ulf Hansson
2022-03-14 12:55 ` [PATCH v2] " Yann Gautier
2022-03-14 13:03   ` Ulf Hansson
2022-03-14 14:34     ` Yann Gautier
2022-03-14 16:18       ` Ulf Hansson
2022-03-14 16:51         ` Yann Gautier [this message]
2022-03-15  9:07           ` Ulf Hansson
2022-03-15 10:07             ` Yann Gautier
2022-03-15 12:30               ` Ulf Hansson
2022-03-14 13:05   ` Philipp Zabel
2022-03-14 13:45     ` Yann Gautier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ce29e53a-59ff-000a-6b88-0b7ae538c515@foss.st.com \
    --to=yann.gautier@foss.st.com \
    --cc=christophe.kerello@foss.st.com \
    --cc=gszymaszek@short.pl \
    --cc=kernel@dh-electronics.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mmc@vger.kernel.org \
    --cc=linux-stm32@st-md-mailman.stormreply.com \
    --cc=linux@armlinux.org.uk \
    --cc=ludovic.barre@foss.st.com \
    --cc=mani@kernel.org \
    --cc=marex@denx.de \
    --cc=p.zabel@pengutronix.de \
    --cc=ulf.hansson@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®