RE: [PATCH 3/4 v5] SDHCI: add sdhci_get_cd callback to detect the card

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




> -----Original Message-----
> From: Aaron Lu [mailto:aaron.lu@xxxxxxx]
> Sent: Friday, January 13, 2012 11:27 AM
> To: Huang Changming-R66093
> Cc: linux-mmc@xxxxxxxxxxxxxxx; Chris Ball
> Subject: Re: [PATCH 3/4 v5] SDHCI: add sdhci_get_cd callback to detect
> the card
> 
> Hi,
> 
> On Fri, Jan 13, 2012 at 02:25:18AM +0000, Huang Changming-R66093 wrote:
> > Hi, Chris,
> > Could you have any comment about this patch?
> > Can it go into 3.3 or 3.4?
> >
> > Thanks
> > Jerry Huang
> >
> > > -----Original Message-----
> > > From: Huang Changming-R66093
> > > Sent: Wednesday, December 14, 2011 10:18 AM
> > > To: linux-mmc@xxxxxxxxxxxxxxx
> > > Cc: Huang Changming-R66093; Chris Ball
> > > Subject: [PATCH 3/4 v5] SDHCI: add sdhci_get_cd callback to detect
> the
> > > card
> > >
> > > From: Jerry Huang <Chang-Ming.Huang@xxxxxxxxxxxxx>
> > >
> > > Add callback function sdhci_get_cd to detect the card.
> > > And one new callback added to implement the card detect in sdhci
> > > struncture.
> > > If special platform has the card detect callback, it will return the
> card
> > > state, the value zero is for absent cardi and one is for present card.
> > > If the controller don't support card detect, sdhci_get_cd will return
> -
> > > ENOSYS.
> > >
> > > Signed-off-by: Jerry Huang <Chang-Ming.Huang@xxxxxxxxxxxxx>
> > > CC: Chris Ball <cjb@xxxxxxxxxx>
> > > ---
> > > changes for v2:
> > > 	- when controller don't support get_cd, return -ENOSYS
> > > 	- add new callback for sdhci to detect the card
> > > 	- add the CC
> > > changes for v3:
> > > 	- use pin_lock only when get_cd defined
> > > changes for v4:
> > > 	- enalbe the controller clock in platform, instead of core
> > > changes for v5:
> > > 	- remove the copyright
> > >
> > >  drivers/mmc/host/sdhci.c |   21 ++++++++++++++++++++++
> > >  drivers/mmc/host/sdhci.h |    2 ++
> > >  2 files changed, 23 insertions(+), 0 deletions(-)
> > >
> > > diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
> > > index 6d8eea3..fbe2f46 100644
> > > --- a/drivers/mmc/host/sdhci.c
> > > +++ b/drivers/mmc/host/sdhci.c
> > > @@ -1518,6 +1519,26 @@ static int sdhci_get_ro(struct mmc_host *mmc)
> > >  	return ret;
> > >  }
> 
> snip
> > >
> > > +/* Return values for the sdjco_get_cd callback:
> > > + *   0 for a absent card
> > > + *   1 for a present card
> > > + *   -ENOSYS when not supported (equal to NULL callback)
> > > + */
> > > +static int sdhci_get_cd(struct mmc_host *mmc)
> > > +{
> > > +	struct sdhci_host *host = mmc_priv(mmc);
> > > +	unsigned long flags;
> > > +	int present = -ENOSYS;
> > > +
> > > +	if (host->ops->get_cd) {
> > > +		spin_lock_irqsave(&host->lock, flags);
> > > +		present = host->ops->get_cd(host);
> > > +		spin_unlock_irqrestore(&host->lock, flags);
> > > +	}
> > > +
> > > +	return present;
> > > +}
> > > +
> 
> I think this function has to take care of standard sd host behaviour: if
> a specific host has implemented the get_cd callback, then use it; if
> not, then see the BROKEN_DETECT quirk; finally, use the present register
> to get the value like the sdhci_request function does.
> 
Yes, I have thought about it.
In this patch, only FSL eSDHC use it.
For the other platform, the get_cd is NULL.

--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux USB Devel]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux