spi: omap-uwire: Convert to use bits_per_word_mask
Set bits_per_word_mask so spi core will reject transfers that attempt to use an unsupported bits_per_word value. Signed-off-by: Axel Lin <axel.lin@ingics.com> Signed-off-by: Mark Brown <broonie@linaro.org>
This commit is contained in:
parent
354312f16e
commit
790fc55a77
|
@ -99,7 +99,6 @@ struct uwire_spi {
|
||||||
};
|
};
|
||||||
|
|
||||||
struct uwire_state {
|
struct uwire_state {
|
||||||
unsigned bits_per_word;
|
|
||||||
unsigned div1_idx;
|
unsigned div1_idx;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -210,9 +209,8 @@ static void uwire_chipselect(struct spi_device *spi, int value)
|
||||||
|
|
||||||
static int uwire_txrx(struct spi_device *spi, struct spi_transfer *t)
|
static int uwire_txrx(struct spi_device *spi, struct spi_transfer *t)
|
||||||
{
|
{
|
||||||
struct uwire_state *ust = spi->controller_state;
|
|
||||||
unsigned len = t->len;
|
unsigned len = t->len;
|
||||||
unsigned bits = ust->bits_per_word;
|
unsigned bits = t->bits_per_word ? : spi->bits_per_word;
|
||||||
unsigned bytes;
|
unsigned bytes;
|
||||||
u16 val, w;
|
u16 val, w;
|
||||||
int status = 0;
|
int status = 0;
|
||||||
|
@ -322,7 +320,6 @@ static int uwire_setup_transfer(struct spi_device *spi, struct spi_transfer *t)
|
||||||
struct uwire_state *ust = spi->controller_state;
|
struct uwire_state *ust = spi->controller_state;
|
||||||
struct uwire_spi *uwire;
|
struct uwire_spi *uwire;
|
||||||
unsigned flags = 0;
|
unsigned flags = 0;
|
||||||
unsigned bits;
|
|
||||||
unsigned hz;
|
unsigned hz;
|
||||||
unsigned long rate;
|
unsigned long rate;
|
||||||
int div1_idx;
|
int div1_idx;
|
||||||
|
@ -332,17 +329,6 @@ static int uwire_setup_transfer(struct spi_device *spi, struct spi_transfer *t)
|
||||||
|
|
||||||
uwire = spi_master_get_devdata(spi->master);
|
uwire = spi_master_get_devdata(spi->master);
|
||||||
|
|
||||||
bits = spi->bits_per_word;
|
|
||||||
if (t != NULL && t->bits_per_word)
|
|
||||||
bits = t->bits_per_word;
|
|
||||||
|
|
||||||
if (bits > 16) {
|
|
||||||
pr_debug("%s: wordsize %d?\n", dev_name(&spi->dev), bits);
|
|
||||||
status = -ENODEV;
|
|
||||||
goto done;
|
|
||||||
}
|
|
||||||
ust->bits_per_word = bits;
|
|
||||||
|
|
||||||
/* mode 0..3, clock inverted separately;
|
/* mode 0..3, clock inverted separately;
|
||||||
* standard nCS signaling;
|
* standard nCS signaling;
|
||||||
* don't treat DI=high as "not ready"
|
* don't treat DI=high as "not ready"
|
||||||
|
@ -509,7 +495,7 @@ static int uwire_probe(struct platform_device *pdev)
|
||||||
|
|
||||||
/* the spi->mode bits understood by this driver: */
|
/* the spi->mode bits understood by this driver: */
|
||||||
master->mode_bits = SPI_CPOL | SPI_CPHA | SPI_CS_HIGH;
|
master->mode_bits = SPI_CPOL | SPI_CPHA | SPI_CS_HIGH;
|
||||||
|
master->bits_per_word_mask = SPI_BPW_RANGE_MASK(1, 16);
|
||||||
master->flags = SPI_MASTER_HALF_DUPLEX;
|
master->flags = SPI_MASTER_HALF_DUPLEX;
|
||||||
|
|
||||||
master->bus_num = 2; /* "official" */
|
master->bus_num = 2; /* "official" */
|
||||||
|
|
Loading…
Reference in New Issue