public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Ricky WU <ricky_wu@realtek.com>
To: Ulf Hansson <ulf.hansson@linaro.org>
Cc: "wenchao.chen@unisoc.com" <wenchao.chen@unisoc.com>,
	"ricardo@marliere.net" <ricardo@marliere.net>,
	"marex@denx.de" <marex@denx.de>,
	"linux-mmc@vger.kernel.org" <linux-mmc@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: RE: [PATCH] mmc: core: resume not check card exist before powerup
Date: Fri, 19 Apr 2024 06:53:16 +0000	[thread overview]
Message-ID: <8b966794f2bb4fda8cc7d3e111bfef70@realtek.com> (raw)
In-Reply-To: CAPDyKFo3dkzDDEU7Lk14zH0td0AP=z2RJQibj8SP6JeUuz=iFA@mail.gmail.com

Soft reminder

If this solution, you still have concert on sd.c.
can we just do this check card flow in mmc host power up call_back? 

> > >
> > > _mmc_sd_resume
> > > add get_cd before call powerup, make sure the card exist
> >
> > Please elaborate more on what problem you are trying to solve, the
> > above doesn't make much sense to me, sorry.
> >
> > Yes, the card may be removed while the system is suspended. Then, even
> > if ->get_cd() indicates that there is no card inserted in the
> > SD-card-slot, we may still have the card being registered - and then
> > we need to unregister it.
> > That said, we need to call mmc_power_up() in order to try to
> > communicate with the card again. At least that is what the
> > mmc_rescan() work assumes when it runs the bus_ops->detect() callback
> > at some point later in time.
> >
> 
> We saw the power up in a short time from waveform when removing the card,
> So we saw mmc_sd_resume call the power up did not check the card exist.
> 
> We think this the short time power up maybe cause OCP if no card exist.
> And this power up we think is unnecessary when no card exist.
> 
> 
> > >
> > > Signed-off-by: Ricky Wu <ricky_wu@realtek.com>
> > > ---
> > >  drivers/mmc/core/sd.c | 3 +++
> > >  1 file changed, 3 insertions(+)
> > >
> > > diff --git a/drivers/mmc/core/sd.c b/drivers/mmc/core/sd.c index
> > > 1c8148cdda50..35e036672cfb 100644
> > > --- a/drivers/mmc/core/sd.c
> > > +++ b/drivers/mmc/core/sd.c
> > > @@ -1750,6 +1750,9 @@ static int _mmc_sd_resume(struct mmc_host
> > *host)
> > >         if (!mmc_card_suspended(host->card))
> > >                 goto out;
> > >
> > > +       if (host->ops->get_cd && !host->ops->get_cd(host))
> > > +               goto out;
> > > +
> > >         mmc_power_up(host, host->card->ocr);
> > >         err = mmc_sd_init_card(host, host->card->ocr, host->card);
> > >         mmc_card_clr_suspended(host->card);
> > > --
> > > 2.25.1
> > >
> >
> > Kind regards
> > Uffe

  parent reply	other threads:[~2024-04-19  6:53 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-27  2:45 [PATCH] mmc: core: resume not check card exist before powerup Ricky Wu
2024-03-28 12:38 ` Ulf Hansson
2024-03-29  9:03   ` Ricky WU
2024-04-19  6:53   ` Ricky WU [this message]
2024-04-25 16:59     ` Ulf Hansson
2024-04-29  6:56       ` Ricky WU

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=8b966794f2bb4fda8cc7d3e111bfef70@realtek.com \
    --to=ricky_wu@realtek.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mmc@vger.kernel.org \
    --cc=marex@denx.de \
    --cc=ricardo@marliere.net \
    --cc=ulf.hansson@linaro.org \
    --cc=wenchao.chen@unisoc.com \
    /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