diff mbox

[1/4,v2] spi/bfin_spi: fix handling of default bits per word setting

Message ID 1308299737-3806-1-git-send-email-vapier@gentoo.org (mailing list archive)
State Superseded, archived
Headers show

Commit Message

Mike Frysinger June 17, 2011, 8:35 a.m. UTC
The default bits per word setting should be 8 bits, but since most of our
devices have been explicitly setting this up, we didn't notice when the
default stopped working.

At the moment, any default transfers without an explicit bit size setting
error out with:
bfin-spi bfin-spi.0: transfer: unsupported bits_per_word

So in the transfer logic, have a bits_per_word setting of 0 fall into the
8 bit transfer logic.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
---
v2
	- wasn't quite as simple as i'd hope ...

 drivers/spi/spi_bfin5xx.c |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

Comments

Grant Likely June 17, 2011, 2:37 p.m. UTC | #1
On Fri, Jun 17, 2011 at 04:35:37AM -0400, Mike Frysinger wrote:
> The default bits per word setting should be 8 bits, but since most of our
> devices have been explicitly setting this up, we didn't notice when the
> default stopped working.
> 
> At the moment, any default transfers without an explicit bit size setting
> error out with:
> bfin-spi bfin-spi.0: transfer: unsupported bits_per_word
> 
> So in the transfer logic, have a bits_per_word setting of 0 fall into the
> 8 bit transfer logic.
> 
> Signed-off-by: Mike Frysinger <vapier@gentoo.org>

Merged for v3.0, thanks.

g.

> ---
> v2
> 	- wasn't quite as simple as i'd hope ...
> 
>  drivers/spi/spi_bfin5xx.c |    7 ++++---
>  1 files changed, 4 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/spi/spi_bfin5xx.c b/drivers/spi/spi_bfin5xx.c
> index ae30fa3..1f123b9 100644
> --- a/drivers/spi/spi_bfin5xx.c
> +++ b/drivers/spi/spi_bfin5xx.c
> @@ -681,13 +681,14 @@ static void bfin_spi_pump_transfers(unsigned long data)
>  	drv_data->cs_change = transfer->cs_change;
>  
>  	/* Bits per word setup */
> -	bits_per_word = transfer->bits_per_word ? : message->spi->bits_per_word;
> -	if ((bits_per_word > 0) && (bits_per_word % 16 == 0)) {
> +	bits_per_word = transfer->bits_per_word ? :
> +		message->spi->bits_per_word ? : 8;
> +	if (bits_per_word % 16 == 0) {
>  		drv_data->n_bytes = bits_per_word/8;
>  		drv_data->len = (transfer->len) >> 1;
>  		cr_width = BIT_CTL_WORDSIZE;
>  		drv_data->ops = &bfin_bfin_spi_transfer_ops_u16;
> -	} else if ((bits_per_word > 0) && (bits_per_word % 8 == 0)) {
> +	} else if (bits_per_word % 8 == 0) {
>  		drv_data->n_bytes = bits_per_word/8;
>  		drv_data->len = transfer->len;
>  		cr_width = 0;
> -- 
> 1.7.5.3
> 

------------------------------------------------------------------------------
EditLive Enterprise is the world's most technically advanced content
authoring tool. Experience the power of Track Changes, Inline Image
Editing and ensure content is compliant with Accessibility Checking.
http://p.sf.net/sfu/ephox-dev2dev
diff mbox

Patch

diff --git a/drivers/spi/spi_bfin5xx.c b/drivers/spi/spi_bfin5xx.c
index ae30fa3..1f123b9 100644
--- a/drivers/spi/spi_bfin5xx.c
+++ b/drivers/spi/spi_bfin5xx.c
@@ -681,13 +681,14 @@  static void bfin_spi_pump_transfers(unsigned long data)
 	drv_data->cs_change = transfer->cs_change;
 
 	/* Bits per word setup */
-	bits_per_word = transfer->bits_per_word ? : message->spi->bits_per_word;
-	if ((bits_per_word > 0) && (bits_per_word % 16 == 0)) {
+	bits_per_word = transfer->bits_per_word ? :
+		message->spi->bits_per_word ? : 8;
+	if (bits_per_word % 16 == 0) {
 		drv_data->n_bytes = bits_per_word/8;
 		drv_data->len = (transfer->len) >> 1;
 		cr_width = BIT_CTL_WORDSIZE;
 		drv_data->ops = &bfin_bfin_spi_transfer_ops_u16;
-	} else if ((bits_per_word > 0) && (bits_per_word % 8 == 0)) {
+	} else if (bits_per_word % 8 == 0) {
 		drv_data->n_bytes = bits_per_word/8;
 		drv_data->len = transfer->len;
 		cr_width = 0;