[U-Boot] [PATCH 1/9] i.MX31: fix SPI driver for shorter than 32 bit transfers

Guennadi Liakhovetski lg at denx.de
Thu Feb 5 09:28:17 CET 2009


On Wed, 4 Feb 2009, Mike Frysinger wrote:

> On Wednesday 04 February 2009 17:39:45 Jean-Christophe PLAGNIOL-VILLARD wrote:
> > On 17:59 Wed 04 Feb     , Guennadi Liakhovetski wrote:
> > > Fix 8 and 16-bit transfers in mxc_spi driver and a wrong pointer in the
> > > free routine.
> > >
> > > Signed-off-by: Guennadi Liakhovetski <lg at denx.de>
> > > ---
> > >
> > > No SPI custodian, so, Jean-Christophe will have to Ack it?
> >
> > I'd like to have Mike and Haaward ack too
> 
> i dont have any arm hardware let alone familiar with any hardware-level things 
> like the SPI controller.  so from a quick high level look ...
> 
> does this controller actually support transfers that arent a multiple of 8 ?  

Yes, it does.

> if the smallest increment you can do is 8bits, then you should be rejecting 
> anything that isnt a multiple of it rather than holding the user's hand.  as 
> for the assumption that "more than 32bits means do 32bit transfers", that 
> sounds plain wrong to me.  u-boot should do exactly as instructed and nothing 
> more/less.  so if the user tries to send 40bits, that better be 40bits and not 
> 64bits.

That's what my patch would do, but it is actually unclear to me what you 
should do for 40 bits? Do you want to send 32 + 8 or 20 + 20 or?.. In 
fact, I would reject if (bitlen > 32 && (bitlen & 31)). But, for example, 
mpc8xxx_spi.c also first sends data in 32-bit chunks, and then the rest. 
But I just noticed there is another bug in my driver, the bit-length in 
the control register is set wrongly if (bitlen > 32). Also, the function 
can be simplified by putting the 32-bit loop bofore residue transfer. I'll 
change both in the next revision.

> the spi_free_slave() change looks correct ... not that it should change the 
> generated code as spi_slave is the first member of mxc_spi_slave, so they'll 
> be the same pointer and gcc will do the right thing.

Thanks
Guennadi
---
Guennadi Liakhovetski, Ph.D.

DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80  Email: office at denx.de


More information about the U-Boot mailing list