[U-Boot] [PATCH v2] SPI: Fix 32 bit transfers in mxc_spi.c
Magnus Lilja
lilja.magnus at gmail.com
Mon Feb 8 21:06:53 CET 2010
Tom skrev:
> Magnus Lilja wrote:
>> Commit f9b6a1575d9f1ca192e4cb60e547aa66f08baa3f, "i.MX31: fix SPI
>> driver for shorter than 32 bit" broke 32 bit transfers. This patch
>> makes single 32 bit transfer work again.
>>
>> Transfer lengths that are known not to work will abort and print
>> an error message.
>>
>> Tested on i.MX31 Litekit and i.MX31 PDK using 32 bit transfers to
>> the MC13783/ATLAS chip (using the 'date' command).
>>
>> Signed-off-by: Magnus Lilja <lilja.magnus at gmail.com>
>> ---
>>
>> As discussed on the mailing list, Guennadi Liakhovetski thinks that
>> all transfers > 16 bits are broken. This patch fixes the 32 bit case
>> and makes sure the user is notified if a broken bitlength is used.
>>
>> drivers/spi/mxc_spi.c | 9 +++++++++
>> 1 files changed, 9 insertions(+), 0 deletions(-)
>>
>> diff --git a/drivers/spi/mxc_spi.c b/drivers/spi/mxc_spi.c
>> index fad9840..93c2bd7 100644
>> --- a/drivers/spi/mxc_spi.c
>> +++ b/drivers/spi/mxc_spi.c
>> @@ -131,6 +131,13 @@ int spi_xfer(struct spi_slave *slave, unsigned
>> int bitlen, const void *dout,
>> return 1;
>> }
>>
>> + /* This driver is currently partly broken, alert the user */
>> + if (bitlen > 16 && bitlen != 32) {
>
> I believe this check can be improved
> The transfer loops over 32 bit blks.
> so bitlen that are multiples of 32 should work.
> so
>
> bitlen != 32
>
> can change to
>
> (bitlen % 32)
Patch updated, but I want to test it first. Having tftp problems at the moment with my newly re-installed machine, will post new version as soon as possible.
Regards/Magnus
More information about the U-Boot
mailing list