diff options
author | Mark Brown <broonie@linaro.org> | 2013-08-30 22:19:40 (GMT) |
---|---|---|
committer | Mark Brown <broonie@linaro.org> | 2013-08-31 00:31:40 (GMT) |
commit | a822e99c70f448c4068ea85bb195dac0b2eb3afe (patch) | |
tree | 4fd6620e3d1412196acc0142dbf60337c310543f /drivers/spi | |
parent | d5ee722ab942451929ccf5bec4fb41f6d044b5c7 (diff) | |
download | linux-a822e99c70f448c4068ea85bb195dac0b2eb3afe.tar.xz |
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>
Diffstat (limited to 'drivers/spi')
-rw-r--r-- | drivers/spi/spi.c | 72 |
1 files changed, 34 insertions, 38 deletions
diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c index f0a6582..7557f61 100644 --- a/drivers/spi/spi.c +++ b/drivers/spi/spi.c @@ -871,47 +871,43 @@ static void of_register_spi_devices(struct spi_master *master) /* Device DUAL/QUAD mode */ prop = of_get_property(nc, "spi-tx-nbits", &len); - if (!prop || len < sizeof(*prop)) { - dev_err(&master->dev, "%s has no 'spi-tx-nbits' property\n", - nc->full_name); - spi_dev_put(spi); - continue; - } - switch (be32_to_cpup(prop)) { - case SPI_NBITS_SINGLE: - break; - case SPI_NBITS_DUAL: - spi->mode |= SPI_TX_DUAL; - break; - case SPI_NBITS_QUAD: - spi->mode |= SPI_TX_QUAD; - break; - default: - dev_err(&master->dev, "spi-tx-nbits value is not supported\n"); - spi_dev_put(spi); - continue; + if (prop && len == sizeof(*prop)) { + switch (be32_to_cpup(prop)) { + case SPI_NBITS_SINGLE: + break; + case SPI_NBITS_DUAL: + spi->mode |= SPI_TX_DUAL; + break; + case SPI_NBITS_QUAD: + spi->mode |= SPI_TX_QUAD; + break; + default: + dev_err(&master->dev, + "spi-tx-nbits %d not supported\n", + be32_to_cpup(prop)); + spi_dev_put(spi); + continue; + } } prop = of_get_property(nc, "spi-rx-nbits", &len); - if (!prop || len < sizeof(*prop)) { - dev_err(&master->dev, "%s has no 'spi-rx-nbits' property\n", - nc->full_name); - spi_dev_put(spi); - continue; - } - switch (be32_to_cpup(prop)) { - case SPI_NBITS_SINGLE: - break; - case SPI_NBITS_DUAL: - spi->mode |= SPI_RX_DUAL; - break; - case SPI_NBITS_QUAD: - spi->mode |= SPI_RX_QUAD; - break; - default: - dev_err(&master->dev, "spi-rx-nbits value is not supported\n"); - spi_dev_put(spi); - continue; + if (prop && len == sizeof(*prop)) { + switch (be32_to_cpup(prop)) { + case SPI_NBITS_SINGLE: + break; + case SPI_NBITS_DUAL: + spi->mode |= SPI_RX_DUAL; + break; + case SPI_NBITS_QUAD: + spi->mode |= SPI_RX_QUAD; + break; + default: + dev_err(&master->dev, + "spi-rx-nbits %d not supported\n", + be32_to_cpup(prop)); + spi_dev_put(spi); + continue; + } } /* Device speed */ |