[PATCH 2/2 v2] eSDHC: Fix errors when booting kernel with fsl esdhc

Zang Roy-R61911 r61911 at freescale.com
Tue Jul 26 20:29:55 EST 2011



> -----Original Message-----
> From: linux-mmc-owner at vger.kernel.org [mailto:linux-mmc-owner at vger.kernel.org]
> On Behalf Of Anton Vorontsov
> Sent: Friday, July 22, 2011 18:15 PM
> To: Zang Roy-R61911
> Cc: linux-mmc at vger.kernel.org; linuxppc-dev at lists.ozlabs.org; akpm at linux-
> foundation.org; Xu Lei-B33228; Kumar Gala
> Subject: Re: [PATCH 2/2 v2] eSDHC: Fix errors when booting kernel with fsl esdhc
> 
> On Fri, Jul 22, 2011 at 06:15:17PM +0800, Roy Zang wrote:
> [...]
> >  	if (host->version >= SDHCI_SPEC_200) {
> > -		ctrl = sdhci_readb(host, SDHCI_HOST_CONTROL);
> > -		ctrl &= ~SDHCI_CTRL_DMA_MASK;
> > -		if ((host->flags & SDHCI_REQ_USE_DMA) &&
> > -			(host->flags & SDHCI_USE_ADMA))
> > -			ctrl |= SDHCI_CTRL_ADMA32;
> > -		else
> > -			ctrl |= SDHCI_CTRL_SDMA;
> > -		sdhci_writeb(host, ctrl, SDHCI_HOST_CONTROL);
> > +		if (host->quirks & SDHCI_QUIRK_QORIQ_PROCTL_WEIRD) {
> > +#define ESDHCI_PROCTL_DMAS_MASK		0x00000300
> > +#define ESDHCI_PROCTL_ADMA32		0x00000200
> > +#define ESDHCI_PROCTL_SDMA		0x00000000
> > +			ctrl = sdhci_readl(host, SDHCI_HOST_CONTROL);
> > +			ctrl &= ~ESDHCI_PROCTL_DMAS_MASK;
> > +			if ((host->flags & SDHCI_REQ_USE_DMA) &&
> > +				(host->flags & SDHCI_USE_ADMA))
> > +				ctrl |= ESDHCI_PROCTL_ADMA32;
> > +			else
> > +				ctrl |= ESDHCI_PROCTL_SDMA;
> > +			sdhci_writel(host, ctrl, SDHCI_HOST_CONTROL);
> > +		} else {
> > +			ctrl = sdhci_readb(host, SDHCI_HOST_CONTROL);
> > +			ctrl &= ~SDHCI_CTRL_DMA_MASK;
> > +			if ((host->flags & SDHCI_REQ_USE_DMA) &&
> > +				(host->flags & SDHCI_USE_ADMA))
> > +				ctrl |= SDHCI_CTRL_ADMA32;
> > +			else
> > +				ctrl |= SDHCI_CTRL_SDMA;
> > +			sdhci_writeb(host, ctrl, SDHCI_HOST_CONTROL);
> 
> We try to not pollute generic sdhci.c driver with chip-specific
> quirks.
> 
> Maybe you can do the fixups via IO accessors? Or by introducing
> some additional sdhci op?
> 
> [...]
> >  	if (power != (unsigned short)-1) {
> >  		switch (1 << power) {
> > +#define	ESDHCI_FSL_POWER_MASK	0x40
> > +#define	ESDHCI_FSL_POWER_180	0x00
> > +#define	ESDHCI_FSL_POWER_300	0x40
> 
> Same here. The driver will rot quickly if everyone would start
> putting chip-specific quirks into sdhci.c. Please don't.
IO accessors or sdhci op might work, but it will look ugly 
and less performance efficient for io access.

If you search sdhci.c, you will see other board specific quirks.
Thanks.
Roy


More information about the Linuxppc-dev mailing list