bsp/atsam: Accept only 8/16 bits per word

For proper 16 bits per word support we need probably some DMA
adjustments.  For 9 to 15 bits per word we need support for the variable
peripheral select, see SR_MR[PS] register bit.
This commit is contained in:
Sebastian Huber
2019-03-06 13:26:29 +01:00
parent b82a4b4f52
commit 85d5f6c17c

View File

@@ -326,8 +326,7 @@ static int atsam_check_configure_spi(atsam_spi_bus *bus, const spi_ioc_transfer
|| msg->cs != bus->base.cs || msg->cs != bus->base.cs
) { ) {
if ( if (
msg->bits_per_word < 8 (msg->bits_per_word != 8 && msg->bits_per_word != 16)
|| msg->bits_per_word > 16
|| msg->mode > 3 || msg->mode > 3
|| msg->speed_hz > bus->base.max_speed_hz || msg->speed_hz > bus->base.max_speed_hz
) { ) {
@@ -458,9 +457,8 @@ static int atsam_spi_setup(spi_bus *base)
atsam_spi_bus *bus = (atsam_spi_bus *)base; atsam_spi_bus *bus = (atsam_spi_bus *)base;
if ( if (
bus->base.speed_hz > MAX_SPI_FREQUENCY || bus->base.speed_hz > MAX_SPI_FREQUENCY
bus->base.bits_per_word < 8 || || (bus->base.bits_per_word != 8 && bus->base.bits_per_word != 16)
bus->base.bits_per_word > 16
) { ) {
return -EINVAL; return -EINVAL;
} }