linux-mmc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jaehoon Chung <jh80.chung@samsung.com>
To: Doug Anderson <dianders@chromium.org>
Cc: Seungwon Jeon <tgih.jun@samsung.com>,
	Ulf Hansson <ulf.hansson@linaro.org>,
	Alim Akhtar <alim.akhtar@samsung.com>,
	Sonny Rao <sonnyrao@chromium.org>,
	Andrew Bresticker <abrestic@chromium.org>,
	Heiko Stuebner <heiko@sntech.de>, Chris Ball <chris@printf.net>,
	"linux-mmc@vger.kernel.org" <linux-mmc@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v5 3/4] mmc: dw_mmc: Cleanup disable of low power mode w/ SDIO interrupts
Date: Wed, 03 Dec 2014 10:06:09 +0900	[thread overview]
Message-ID: <547E6201.1090804@samsung.com> (raw)
In-Reply-To: <CAD=FV=VU5804WD5SRwr8HAOXwvumkUY+yzjM81oNbPUwwv=nTQ@mail.gmail.com>

Hi Doug

On 12/03/2014 09:36 AM, Doug Anderson wrote:
> Jaehoon,
> 
> On Tue, Dec 2, 2014 at 4:17 PM, Jaehoon Chung <jh80.chung@samsung.com> wrote:
>>> @@ -1245,27 +1246,37 @@ static int dw_mci_get_cd(struct mmc_host *mmc)
>>>       return present;
>>>  }
>>>
>>> -/*
>>> - * Disable lower power mode.
>>> - *
>>> - * Low power mode will stop the card clock when idle.  According to the
>>> - * description of the CLKENA register we should disable low power mode
>>> - * for SDIO cards if we need SDIO interrupts to work.
>>> - *
>>> - * This function is fast if low power mode is already disabled.
>>> - */
>>> -static void dw_mci_disable_low_power(struct dw_mci_slot *slot)
>>> +static void dw_mci_init_card(struct mmc_host *mmc, struct mmc_card *card)
>>>  {
>>> +     struct dw_mci_slot *slot = mmc_priv(mmc);
>>>       struct dw_mci *host = slot->host;
>>> -     u32 clk_en_a;
>>> -     const u32 clken_low_pwr = SDMMC_CLKEN_LOW_PWR << slot->id;
>>>
>>> -     clk_en_a = mci_readl(host, CLKENA);
>>> +     /*
>>> +      * Low power mode will stop the card clock when idle.  According to the
>>> +      * description of the CLKENA register we should disable low power mode
>>> +      * for SDIO cards if we need SDIO interrupts to work.
>>> +      */
>>> +     if (mmc->caps & MMC_CAP_SDIO_IRQ) {
>>> +             const u32 clken_low_pwr = SDMMC_CLKEN_LOW_PWR << slot->id;
>>> +             u32 clk_en_a_old;
>>> +             u32 clk_en_a;
>>>
>>> -     if (clk_en_a & clken_low_pwr) {
>>> -             mci_writel(host, CLKENA, clk_en_a & ~clken_low_pwr);
>>> -             mci_send_cmd(slot, SDMMC_CMD_UPD_CLK |
>>> -                          SDMMC_CMD_PRV_DAT_WAIT, 0);
>>> +             clk_en_a_old = mci_readl(host, CLKENA);
>>> +
>>> +             if (card->type == MMC_TYPE_SDIO ||
>>> +                 card->type == MMC_TYPE_SD_COMBO) {
>>> +                     set_bit(DW_MMC_CARD_NO_LOW_PWR, &slot->flags);
>>> +                     clk_en_a = clk_en_a_old & ~clken_low_pwr;
>>> +             } else {
>>
>> I wonder this point. When entered at this point?
>>
>> MMC_CAP_SDIO_IRQ is sdio capability. and card->type is also related with SDIO, isn't?
> 
> Right.  As I understand it:
> 
> * You can certainly add MMC_CAP_SDIO_IRQ to an external card slot that
> might have an MMC card, and SD card, or an SDIO card.  You still want
> the LOW_PWR mode for MMC/SD cards but don't want it for SDIO cards in
> that case.

Ok, I understood your purpose.
Your mean is MMC_CAP_SIDO_IRQ can be set to MMC or SD...not only SDIO card.
It's reasonable.
But i think it doesn't need to set LOW_PWR_mode for SD/eMMC at here. it should be already set to Low-power mode.
And SDIO case should not enter at here.

> 
> * If you don't set MMC_CAP_SDIO_IRQ then presumably you've got some
> problem where the SDIO interrupt is broken on your board.  That means
> you're using polling mode to find interrupts.  As I understand it that
> would allow you to use LOW_PWR since you don't need to detect SDIO
> interrupts.  I know on Marvell WiFi modules I tested this seemed to
> work OK, but I doubt anyone is really running a production device in
> this way.

No, we needs to set MMC_CAP_SDIO_IRQ, if i didn't set to it, i will also see the problem.
Since I knew which slot is used as SDIO card, i thought MMC_CAP_SDIO_IRQ is set for only sdio card.
Then it would be check the twice whether card is SDIO or not.

Actually, i didn't test WiFi module with this patch. but concept is not problem.

Best Regards,
Jaehoon Chung

> 
> 
> Basically I was trying to mirror the functionality of the old code as
> closely as possible.  In the old code if you were using polling mode
> then dw_mci_enable_sdio_irq() should never be called and you'd never
> go out of low power mode.
> 
> -Doug
> 


  reply	other threads:[~2014-12-03  1:06 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-02 23:42 [PATCH v5 0/4] Fixes for SDIO interrupts for dw_mmc Doug Anderson
2014-12-02 23:42 ` [PATCH v5 2/4] mmc: core: Support the optional init_card() callback for MMC and SD Doug Anderson
2014-12-02 23:42 ` [PATCH v5 3/4] mmc: dw_mmc: Cleanup disable of low power mode w/ SDIO interrupts Doug Anderson
2014-12-03  0:17   ` Jaehoon Chung
2014-12-03  0:36     ` Doug Anderson
2014-12-03  1:06       ` Jaehoon Chung [this message]
2014-12-03  1:12         ` Doug Anderson
2014-12-03  1:19           ` Jaehoon Chung
2014-12-02 23:42 ` [PATCH v5 4/4] mmc: dw_mmc: Protect read-modify-write of INTMASK with a lock Doug Anderson
2014-12-19 10:17 ` [PATCH v5 0/4] Fixes for SDIO interrupts for dw_mmc Ulf Hansson
2014-12-19 19:02   ` Doug Anderson
2014-12-30 10:29     ` Ulf Hansson
2015-01-02 10:28       ` Javier Martinez Canillas
2015-01-02 17:06       ` Doug Anderson
2015-01-02 17:11         ` Tony Lindgren
2015-01-03  9:31           ` Ulf Hansson

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=547E6201.1090804@samsung.com \
    --to=jh80.chung@samsung.com \
    --cc=abrestic@chromium.org \
    --cc=alim.akhtar@samsung.com \
    --cc=chris@printf.net \
    --cc=dianders@chromium.org \
    --cc=heiko@sntech.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mmc@vger.kernel.org \
    --cc=sonnyrao@chromium.org \
    --cc=tgih.jun@samsung.com \
    --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;
as well as URLs for NNTP newsgroup(s).