lkml.org 
[lkml]   [2018]   [Aug]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [PATCH v2] spi: dw: support 4-16 bits per word
Date
On Fri, 2018-08-17 at 09:01 +0200, Simon Goldschmidt wrote:
> The spi-dw driver currently only supports 8 or 16 bits per word.
>
> Since the hardware supports 4-16 bits per word, adapt the driver
> to also support this.
>
>

> @@ -307,15 +307,13 @@ static int dw_spi_transfer_one(struct spi_controller *master,
> +
> + if ((transfer->bits_per_word < 4) || (transfer->bits_per_word > 16))
> return -EINVAL;
> - }

You don't need this check as the spi core validates the transfer
against master->bits_per_word_mask.

> master->mode_bits = SPI_CPOL | SPI_CPHA | SPI_LOOP;
> - master->bits_per_word_mask = SPI_BPW_MASK(8) | SPI_BPW_MASK(16);
> + master->bits_per_word_mask = SPI_BPW_RANGE_MASK(4, 16);
> master->bus_num = dws->bus_num;
>
\
 
 \ /
  Last update: 2018-08-17 18:33    [W:0.093 / U:9.460 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site