[U-Boot] [PATCH] fsl_esdhc: Correcting esdhc timeout counter calculation

Wolfgang Denk wd at denx.de
Thu Feb 24 10:50:10 CET 2011


Dear Kumar Gala,

In message <1298537614-20797-1-git-send-email-galak at kernel.crashing.org> you wrote:
> 
> - Timeout counter value is set as DTOCV bits in SYSCTL register
>   For counter value set as x,
>   Timeout period = (2^(13+x))/SD_CLOCK
> 
> - As per 4.6.2.2 section of SD Card specification v2.00, host should
>   cofigure timeout period value to minimum 250 msec.
> 
> - SD_CLOCK = mmc->trans_speed
> 
> - Calculating x based on
>   250 msec = (2^(13+x))/mmc->trans_speed

OK, here the theory is given...

> +	/* Timeout period = (2^(13+timeout))/mmc->trans_speed
> +	 * Timeout period should be minimum 250msec as per SD Card spec
> +	 */
> +	timeout = fls(mmc->tran_speed/4);
>  	timeout -= 13;

But how does this translate intothis formula?  I think there must be
missing something.

Also, should there not be some checking for valid input data ranges?


Nitpick: incorrect multi-line comment style.

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
"There's always been Tower of Babel sort of  bickering  inside  Unix,
but  this  is the most extreme form ever. This means at least several
years of confusion." - Bill Gates, founder and chairman of Microsoft,
about the Open Systems Foundation


More information about the U-Boot mailing list