linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: "yong.mao@mediatek.com" <yong.mao@mediatek.com>
To: Ulf Hansson <ulf.hansson@linaro.org>
Cc: srv_heupstream <srv_heupstream@mediatek.com>,
	"linux-mmc@vger.kernel.org" <linux-mmc@vger.kernel.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Matthias Kaehlcke <mka@chromium.org>,
	"moderated list:ARM/Mediatek SoC support"
	<linux-mediatek@lists.infradead.org>,
	Chaotian Jing <chaotian.jing@mediatek.com>,
	Matthias Brugger <matthias.bgg@gmail.com>,
	Linux ARM <linux-arm-kernel@lists.infradead.org>
Subject: Re: [PATCH 1/3] mmc: core: need do mmc_power_cycle in mmc_sdio_resend_if_cond
Date: Wed, 29 Apr 2020 16:20:17 +0800	[thread overview]
Message-ID: <1588148417.10768.18.camel@mhfsdcap03> (raw)
In-Reply-To: <CAPDyKFrBd0E2Qy89JgTE3YH0iiXB7due0JmnSVAhYL5aubSczA@mail.gmail.com>

On Tue, 2020-04-28 at 14:13 +0200, Ulf Hansson wrote:
> On Tue, 28 Apr 2020 at 11:28, yong.mao@mediatek.com
> <yong.mao@mediatek.com> wrote:
> >
> >
> > On Fri, 2020-04-24 at 12:09 +0200, Ulf Hansson wrote:
> > > On Tue, 14 Apr 2020 at 05:40, Yong Mao <yong.mao@mediatek.com> wrote:
> > > >
> > > > From: yong mao <yong.mao@mediatek.com>
> > > >
> > > > When mmc_sdio_resned_if_cond is invoked, it indicates the SDIO
> > > > device is not in the right state. In this condition, the previous
> > > > implementation of mmc_sdio_resend_if_cond can't make sure SDIO
> > > > device be back to idle state. mmc_power_cycle can reset the SDIO
> > > > device by HW and also make sure SDIO device enter to idle state
> > > > correctly.
> > > >
> > > > Signed-off-by: Yong Mao <yong.mao@mediatek.com>
> > > > ---
> > > >  drivers/mmc/core/sdio.c | 1 +
> > > >  1 file changed, 1 insertion(+)
> > > >
> > > > diff --git a/drivers/mmc/core/sdio.c b/drivers/mmc/core/sdio.c
> > > > index ebb387a..ada0a80 100644
> > > > --- a/drivers/mmc/core/sdio.c
> > > > +++ b/drivers/mmc/core/sdio.c
> > > > @@ -546,6 +546,7 @@ static int mmc_sdio_init_uhs_card(struct mmc_card *card)
> > > >  static void mmc_sdio_resend_if_cond(struct mmc_host *host,
> > > >                                     struct mmc_card *card)
> > > >  {
> > > > +       mmc_power_cycle(host, host->card->ocr);
> > >
> > > This looks wrong to me. mmc_sdio_resend_if_cond() is called from two places.
> > >
> > > 1. In the case when mmc_set_uhs_voltage() fails in
> > > mmc_sdio_init_card(), which means a call to mmc_power_cycle() has
> > > already been done.
> > >
> >   Thanks for your comment.
> >   Yes. It is right that mmc_power_cycle() has already been done when
> >   mmc_sdio_resend_if_cond() is called. In normal re-initialization case,
> >   this mmc_power_cycle() (currently in 1.8v voltage and 208Mhz clock)
> >   can make SDIO device really back to idle state. Unfortunately, in some
> >   special SDIO device, it will enter to unstable state.
> >
> >   At this unstable state, device may keep data0 always low after receiving CMD11.
> >   And then every other SDIO CMD can't be sent to device any more due to card
> >   is busy(data0 is low). Therefore, previous implementation can't save the
> >   device. At this time, mmc_power_cycle() may be the final solution to make
> >   sure SDIO device can back to idle state correctly.
> 
> Well, this still sounds a bit vague to me. I need to understand more
> exactly under what circumstances the problem occurs.
> 
> What platform are you testing with and what SDIO card is being used?
 The platform information is mt8173 + Marvell sdio device + kernel-3.18

> 
> Is the problem happening during the system resume phase?
  The problem happen when mmc_sdio_runtime_resume is invoked.
> 
> Are the SDIO func driver using runtime PM and then is the host capable
> of MMC_CAP_POWER_OFF_CARD?
> 
  Yes. SDIO func driver uses runtime PM and MMC_CAP_POWER_OFF_CARD is
enabled.

> Is it easy to reproduce the problem for you?
> 
 There are only two units out of many produced units that can always
reproduce this issue.
 
> >
> > > 2. Wen sdio_read_cccr() fails and when we decide to retry the UHS-I
> > > voltage switch. Then perhaps it could make sense to run a power cycle.
> > > But if so, we better do it only for that path.
> > >
> > > I will continue to look a bit, as I think there are really more issues
> > > that we may want to look into while looking at this piece of code.
> > > However, allow me some more time before I can provide some more ideas
> > > of how to move forward.
> >   In the actual project, we do encounter many relative issues about re-initialized card.
> >   The following two categories are the most common issue we met before.
> >   A. the SDIO card is initialized by UHS-I mode at the first time, but will be
> >      re-initialized by High Speed mode at the second time.
> >      ==> All this type of issues is relative with S18A in response of CMD5.
> >          And most of the issues are related to the interval between powering off and
> >          powering on card.
> >   B. If there is something wrong in the flow of voltage switch(after CMD11), card will
> >      always keep all data pins to low. And then it hangs up because data0 is always low.
> >   Hope this information will be helpful for you.
> 
> Thanks for sharing these details! I think we need to continue to debug
> this issue, to fully understand.
> 
> In principle, it sounds to me that maybe mmc_power_cycle(), isn't
> really successfully power-cycling the SDIO card. Perhaps insert a few
> delays or so in that code to see how that would affect things?
> 
> Anyway, how is the power to the SDIO card controlled in this case? Are
> you using a mmc-pwrseq?
> 
  vmmc is controlled through GPIO to supply 3.3v power.
  And the vqmmc is supplied from PMIC which is always 1.8v.
  (There is no 3.3v here. Perhaps this is one of the reasons to happen
this issues)

> >
> >   Anyway, we will wait for your advises.
> > >
> > > >         sdio_reset(host);
> > > >         mmc_go_idle(host);
> > > >         mmc_send_if_cond(host, host->ocr_avail);
> > > > --
> > > > 1.9.1
> > >
> > > Kind regards
> > > Uffe
> 
> I have a few patches in the pipe, which fixes some other problems in
> mmc_sdio_init_card(). Possibly those can be related, but I need a day
> or so to post them, let's see.
The codebase of this project is kernel-3.18. Maybe it is hard to apply 
these new patches. Anyway, We will try it when we get the patches.
Thanks. 


> 
> Kind regards
> Uffe

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2020-04-29  8:21 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-14  3:40 Fix sdio reinit card fail issue Yong Mao
2020-04-14  3:40 ` [PATCH 1/3] mmc: core: need do mmc_power_cycle in mmc_sdio_resend_if_cond Yong Mao
2020-04-20 19:15   ` Matthias Kaehlcke
2020-04-21  7:03     ` yong.mao
2020-04-24 10:09   ` Ulf Hansson
2020-04-28  9:27     ` yong.mao
2020-04-28 12:13       ` Ulf Hansson
2020-04-29  8:20         ` yong.mao [this message]
2020-05-05 13:13           ` Ulf Hansson
2020-04-14  3:40 ` [PATCH 2/3] mmc: core: rocr verification Yong Mao
2020-04-14  3:40 ` [PATCH 3/3] mmc: core: fix mmc_sdio_reinit_card fail issue Yong Mao
2020-04-22 22:46   ` Matthias Kaehlcke

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=1588148417.10768.18.camel@mhfsdcap03 \
    --to=yong.mao@mediatek.com \
    --cc=chaotian.jing@mediatek.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=linux-mmc@vger.kernel.org \
    --cc=matthias.bgg@gmail.com \
    --cc=mka@chromium.org \
    --cc=srv_heupstream@mediatek.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).