[U-Boot] [PATCH] mxs: i2c: Implement algorithm to set up arbitrary i2c speed

Marek Vasut marex at denx.de
Fri Nov 30 16:21:46 CET 2012


Dear Wolfgang Denk,

> Dear Marek Vasut,
> 
> In message <1354280910-17539-1-git-send-email-marex at denx.de> you wrote:
> > This algorithm computes the values of TIMING{0,1,2} registers for the
> > MX28 I2C block. This algorithm was derived by using a scope, but the
> > result seems correct.
> 
> Thanks!  I like that!
> 
> ...
> 
> > +	uint32_t base = ((24000000 / speed) - 38) / 2;
> 
> ...
> 
> > +	return 24000000 / ((((timing0 >> 16) - 3) * 2) + 38);
> 
> But we should get rid of this magic constant.  On other i.MX systems
> that would probably be MXC_HCLK ?

It's APBX clock ... you are so right ... I rolled the patch out too fast.
[...]

Best regards,
Marek Vasut


More information about the U-Boot mailing list