From: Mark Brown broonie@linaro.org
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 ---
Not tested, I have no systems with SPI that use DT.
drivers/spi/spi.c | 72 ++++++++++++++++++++++++++----------------------------- 1 file changed, 34 insertions(+), 38 deletions(-)
diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c index 0813fc4..ced0703 100644 --- a/drivers/spi/spi.c +++ b/drivers/spi/spi.c @@ -887,47 +887,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 */
On 08/30/2013 04:21 PM, Mark Brown wrote:
From: Mark Brown broonie@linaro.org
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.
Sort-of-tested-by: Stephen Warren swarren@nvidia.com
This certainly solves the following kernel error during boot:
spi_master spi32766: /spi@7000da00/spi-flash@1 has no 'spi-tx-nbits' property
But I'm still left with the following:
m25p80: probe of spi32766.1 failed with error -22
If instead of applying this patch, I revert the following:
db90a44 spi: conditional checking of mode and transfer bits. f477b7f spi: DUAL and QUAD support
Then everything works. I'll try and track down the remaining issue...
On 08/30/2013 05:20 PM, Stephen Warren wrote:
On 08/30/2013 04:21 PM, Mark Brown wrote:
From: Mark Brown broonie@linaro.org
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.
Sort-of-tested-by: Stephen Warren swarren@nvidia.com
I just sent a patch that fixes the other issue I was having, so feel free to upgrade this to:
Tested-by: Stephen Warren swarren@nvidia.com
linaro-kernel@lists.linaro.org