> -----Original Message-----
> From: Anton Vorontsov [mailto:[email protected]]
> Sent: Monday, November 19, 2012 11:06 AM
> To: Huang Changming-R66093
> Cc: [email protected]; Huang Changming-R66093; Chris Ball
> Subject: Re: [PATCH 2/4 v4] MMC/SD: Add callback function to detect card
>
> On Tue, Oct 30, 2012 at 04:12:47PM +0800, [email protected] wrote:
> [..]
> > If the card is present, 1 will return, if the card is absent, 0 will
> return.
> > If the controller will not support this feature, -ENOSYS will return.
> >
> > Signed-off-by: Jerry Huang <[email protected]>
> > CC: Anton Vorontsov <[email protected]>
> > CC: Chris Ball <[email protected]>
> > ---
> [...]
> > int _mmc_detect_card_removed(struct mmc_host *host)
> > {
> > - int ret;
> > + int ret = -ENOSYS;
> >
> > if ((host->caps & MMC_CAP_NONREMOVABLE) || !host->bus_ops->alive)
> > return 0;
> > @@ -2081,7 +2081,13 @@ int _mmc_detect_card_removed(struct mmc_host
> *host)
> > if (!host->card || mmc_card_removed(host->card))
> > return 1;
> >
> > - ret = host->bus_ops->alive(host);
> > + if (host->ops->get_cd) {
> > + ret = host->ops->get_cd(host);
> > + if (ret >= 0)
> > + ret = !ret;
>
> o_O
>
> Oh, I see...
>
> Reviewed-by: Anton Vorontsov <[email protected]>
>
> (But I must confess I didn't follow the whole discussion about
> get_cd()-via-gpio being unreliable. I'm assuming you fixed this?)
>
If the GPIO is unreliable, the related driver may not implement the callback
function get_cd.
For eSDHC, the GPIO is reliable, so I do it.