mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-01-11 07:39:47 +00:00
spi: quad: Make DT properties optional
The addition SPI quad support made the DT properties mandatory, breaking compatibility with existing systems. Fix that by making them optional, also improving the error messages while we're at it. Signed-off-by: Mark Brown <broonie@linaro.org> Tested-by: Stephen Warren <swarren@nvidia.com>
This commit is contained in:
parent
d5ee722ab9
commit
a822e99c70
@ -871,47 +871,43 @@ static void of_register_spi_devices(struct spi_master *master)
|
|||||||
|
|
||||||
/* Device DUAL/QUAD mode */
|
/* Device DUAL/QUAD mode */
|
||||||
prop = of_get_property(nc, "spi-tx-nbits", &len);
|
prop = of_get_property(nc, "spi-tx-nbits", &len);
|
||||||
if (!prop || len < sizeof(*prop)) {
|
if (prop && len == sizeof(*prop)) {
|
||||||
dev_err(&master->dev, "%s has no 'spi-tx-nbits' property\n",
|
switch (be32_to_cpup(prop)) {
|
||||||
nc->full_name);
|
case SPI_NBITS_SINGLE:
|
||||||
spi_dev_put(spi);
|
break;
|
||||||
continue;
|
case SPI_NBITS_DUAL:
|
||||||
}
|
spi->mode |= SPI_TX_DUAL;
|
||||||
switch (be32_to_cpup(prop)) {
|
break;
|
||||||
case SPI_NBITS_SINGLE:
|
case SPI_NBITS_QUAD:
|
||||||
break;
|
spi->mode |= SPI_TX_QUAD;
|
||||||
case SPI_NBITS_DUAL:
|
break;
|
||||||
spi->mode |= SPI_TX_DUAL;
|
default:
|
||||||
break;
|
dev_err(&master->dev,
|
||||||
case SPI_NBITS_QUAD:
|
"spi-tx-nbits %d not supported\n",
|
||||||
spi->mode |= SPI_TX_QUAD;
|
be32_to_cpup(prop));
|
||||||
break;
|
spi_dev_put(spi);
|
||||||
default:
|
continue;
|
||||||
dev_err(&master->dev, "spi-tx-nbits value is not supported\n");
|
}
|
||||||
spi_dev_put(spi);
|
|
||||||
continue;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
prop = of_get_property(nc, "spi-rx-nbits", &len);
|
prop = of_get_property(nc, "spi-rx-nbits", &len);
|
||||||
if (!prop || len < sizeof(*prop)) {
|
if (prop && len == sizeof(*prop)) {
|
||||||
dev_err(&master->dev, "%s has no 'spi-rx-nbits' property\n",
|
switch (be32_to_cpup(prop)) {
|
||||||
nc->full_name);
|
case SPI_NBITS_SINGLE:
|
||||||
spi_dev_put(spi);
|
break;
|
||||||
continue;
|
case SPI_NBITS_DUAL:
|
||||||
}
|
spi->mode |= SPI_RX_DUAL;
|
||||||
switch (be32_to_cpup(prop)) {
|
break;
|
||||||
case SPI_NBITS_SINGLE:
|
case SPI_NBITS_QUAD:
|
||||||
break;
|
spi->mode |= SPI_RX_QUAD;
|
||||||
case SPI_NBITS_DUAL:
|
break;
|
||||||
spi->mode |= SPI_RX_DUAL;
|
default:
|
||||||
break;
|
dev_err(&master->dev,
|
||||||
case SPI_NBITS_QUAD:
|
"spi-rx-nbits %d not supported\n",
|
||||||
spi->mode |= SPI_RX_QUAD;
|
be32_to_cpup(prop));
|
||||||
break;
|
spi_dev_put(spi);
|
||||||
default:
|
continue;
|
||||||
dev_err(&master->dev, "spi-rx-nbits value is not supported\n");
|
}
|
||||||
spi_dev_put(spi);
|
|
||||||
continue;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Device speed */
|
/* Device speed */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user