From: Sascha Hauer <s.hauer@pengutronix.de>
To: Ulf Hansson <ulf.hansson@linaro.org>
Cc: Daniel Willmann <daniel@totalueberwachung.de>,
Chris Ball <chris@printf.net>,
linux-mmc <linux-mmc@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
Shawn Guo <shawn.guo@linaro.org>
Subject: Re: [PATCH] mmc: mxs: fix card detection function for broken card detect
Date: Mon, 28 Apr 2014 11:36:19 +0200 [thread overview]
Message-ID: <20140428093619.GP5858@pengutronix.de> (raw)
In-Reply-To: <CAPDyKFqP_cDTyC38+8XDPLWN0C6wWs9e6iZD06nkb_LqqLjjnw@mail.gmail.com>
On Mon, Apr 28, 2014 at 11:31:03AM +0200, Ulf Hansson wrote:
> On 28 April 2014 11:13, Sascha Hauer <s.hauer@pengutronix.de> wrote:
> > On Sat, Apr 19, 2014 at 11:59:18PM +0200, Daniel Willmann wrote:
> >> Return -ENOSYS in get_cd if broken-cd is specified in the device tree.
> >>
> >> Commit a91fe279ae75 (mmc: mxs: use standard flag for broken card
> >> detection) sets MMC_CAP_NEEDS_POLL when broken-cd is specified. This
> >> driver sets this flag unconditionally as it does not support a card
> >> detect interrupt. Instead, broken-cd means that there is no card detect
> >> signal connected.
> >>
> >> The mmc core checks the get_cd function return value to determine if a
> >> card is present. Only for a non-zero return value it will attempt to
> >> initialize the card. So retuning -ENOSYS will allow the card to be
> >> initialized.
> >> For comparison, mmc_gpio_get_cd in slot-gpio.c also returns -ENOSYS if
> >> the card detect GPIO is not valid.
> >
> > Short answer for fixing this regression:
> >
> > Acked-by: Sascha Hauer <s.hauer@pengutronix.de>
> >
> > Long answer:
> >
> > This is broken in the MMC OF parser. When the parser finds the
> > 'broken-cd' property it just sets the MMC_CAP_NEEDS_POLL flag. This is
> > wrong. broken-cd means that we cannot rely on any card detection, but
> > instead have to talk to the card to find out if it's available.
> > Currently there is no flag to signal this situation, so the host driver
> > has to handle this by returning true in the get_cd callback, just like
> > the patch below does.
> >
> > IMO the correct solution would be to add a MMC_CAP_CD_NEEDS_TALK_TO_CARD
> > flag to the core.
> >
>
> So if I understand correct, you want the host-ops->get_cd function to
> be invoked from the mmc rescan - only when it actually can provide
> useful information?
Yes.
Sascha
--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
next prev parent reply other threads:[~2014-04-28 9:36 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-04-19 21:59 [PATCH] mmc: mxs: fix card detection function for broken card detect Daniel Willmann
2014-04-28 9:13 ` Sascha Hauer
2014-04-28 9:31 ` Ulf Hansson
2014-04-28 9:36 ` Sascha Hauer [this message]
2014-05-05 9:14 ` 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=20140428093619.GP5858@pengutronix.de \
--to=s.hauer@pengutronix.de \
--cc=chris@printf.net \
--cc=daniel@totalueberwachung.de \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mmc@vger.kernel.org \
--cc=shawn.guo@linaro.org \
--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).