RE: [PATCH] serial:ifx6x60:different SPI word width configure requires different swap process
From: Bi, Chao <hidden>
Date: 2012-10-25 05:13:01
Minor question - is that not just (len + 3) >> 2 ?
Yes, I'll update it in another mail. Thanks. Chao -----Original Message----- From: Alan Cox [mailto:alan@lxorguk.ukuu.org.uk] Sent: Wednesday, October 24, 2012 8:31 PM To: Bi, Chao Cc: alan@linux.intel.com; linux-serial@vger.kernel.org; Gorby, Russ; Liu, Chuansheng; Chen, Jun D Subject: Re: [PATCH] serial:ifx6x60:different SPI word width configure requires different swap process On Wed, 24 Oct 2012 14:48:48 +0800 chao bi [off-list ref] 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 <redacted> cc: Chen Jun <redacted> Signed-off-by: channing <redacted>
+ 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 <redacted>