Re: [PATCH] serial:ifx6x60:different SPI word width configure requires different swap process

Alan Cox
2012-10-24T12:26:26Z

On Wed, 24 Oct 2012 14:48:48 +0800
chao bi <chao.bi@intel.com> wrote:

>
> SPI protocol driver only provide one function (swap_buf()) to swap SPI data
> into big endian format, which is only available when SPI controller's word width
> is 16 bits. But word width could be configured as 8/16/32 bits, different word
> width configure should be mapped to different swap methods.This patch is to make
> SPI protocol driver choose the right swap function corresponding to SPI word
> width configuration.
>
> cc: liu chuansheng <chuansheng.liu@intel.com>
> cc: Chen Jun <jun.d.chen@intel.com>
> Signed-off-by: channing <chao.bi@intel.com>

> + len = (0 == (len&0x03)) ? (len >> 2) : ((len >> 2) + 1);

Minor question - is that not just (len + 3) >> 2 ?

The SPI swapping stuff at runtime looks right so.

Acked-by: Alan Cox <alan@linux.intel.com>