[U-Boot] [PATCH v4 4/4] Tegra: MMC: Add DT support to MMCdriver for all T20 boards

Marc Dietrich marvin24 at gmx.de
Fri Feb 15 17:42:07 CET 2013


Stephen,

On Thursday 14 February 2013 16:12:42 Stephen Warren wrote:
> On 02/14/2013 02:04 PM, Tom Warren wrote:
> > tegra_mmc_init() now parses the DT info for bus width, WP/CD GPIOs, etc.
> > Tested on Seaboard, fully functional.
> > 
> > Tamonten boards (medcom-wide, plutux, and tec) use a different/new
> > dtsi file w/common settings.
> > 
> > diff --git a/drivers/mmc/tegra_mmc.c b/drivers/mmc/tegra_mmc.c
> > 
> > @@ -515,44 +483,47 @@ static int mmc_core_init(struct mmc *mmc)
> > 
> >  int tegra_mmc_getcd(struct mmc *mmc)
> >  {
> >  
> >  	struct mmc_host *host = (struct mmc_host *)mmc->priv;
> > 
> > +	debug("%s called, host->cd_gpio = 0x%08X\n", __func__,
> > +		(unsigned)&host->cd_gpio);
> 
> That last line should be:
> 
> host->cd_gpio.gpio;
> 
> The case is because it's a struct address, not the GPIO you want to print.
> 
> > +static int do_mmc_init(int dev_index)
> > 
> > -	if (host->pwr_gpio >= 0) {
> > +	if (fdt_gpio_isvalid(&host->pwr_gpio)) {
> > 
> >  		sprintf(gpusage, "SD/MMC%d PWR", dev_index);
> > 
> > -		gpio_request(host->pwr_gpio, gpusage);
> > -		gpio_direction_output(host->pwr_gpio, 1);
> > +		gpio_request(host->pwr_gpio.gpio, gpusage);
> > +		fdtdec_set_gpio(&host->pwr_gpio, 1);
> 
> That change completely removes the call to gpio_direction_output;
> fdtdec_set_gpio() doesn't do that. This is the cause of the problem on
> PAZ00, and Harmony.
> 
> > -	if (host->cd_gpio >= 0) {
> > +	if (fdt_gpio_isvalid(&host->cd_gpio)) {
> > 
> >  		sprintf(gpusage, "SD/MMC%d CD", dev_index);
> > 
> > -		gpio_request(host->cd_gpio, gpusage);
> > -		gpio_direction_input(host->cd_gpio);
> > +		gpio_request(host->cd_gpio.gpio, gpusage);
> > +		card_det = fdtdec_get_gpio(&host->cd_gpio);
> 
> Similarly, this change removes the call to gpio_direction_input();
> fdtdec_get_gpio() just reads the GPIO's value and is pointless here.
> 
> I'll go retest all the boards after fixing that...

yup - with these changes, everything is fine again on PAZ00.

Marc





More information about the U-Boot mailing list