Commit a822e99c authored by Mark Brown's avatar Mark Brown

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: default avatarMark Brown <broonie@linaro.org>
Tested-by: default avatarStephen Warren <swarren@nvidia.com>
parent d5ee722a
...@@ -871,12 +871,7 @@ static void of_register_spi_devices(struct spi_master *master) ...@@ -871,12 +871,7 @@ 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",
nc->full_name);
spi_dev_put(spi);
continue;
}
switch (be32_to_cpup(prop)) { switch (be32_to_cpup(prop)) {
case SPI_NBITS_SINGLE: case SPI_NBITS_SINGLE:
break; break;
...@@ -887,18 +882,16 @@ static void of_register_spi_devices(struct spi_master *master) ...@@ -887,18 +882,16 @@ static void of_register_spi_devices(struct spi_master *master)
spi->mode |= SPI_TX_QUAD; spi->mode |= SPI_TX_QUAD;
break; break;
default: default:
dev_err(&master->dev, "spi-tx-nbits value is not supported\n"); dev_err(&master->dev,
"spi-tx-nbits %d not supported\n",
be32_to_cpup(prop));
spi_dev_put(spi); spi_dev_put(spi);
continue; 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",
nc->full_name);
spi_dev_put(spi);
continue;
}
switch (be32_to_cpup(prop)) { switch (be32_to_cpup(prop)) {
case SPI_NBITS_SINGLE: case SPI_NBITS_SINGLE:
break; break;
...@@ -909,10 +902,13 @@ static void of_register_spi_devices(struct spi_master *master) ...@@ -909,10 +902,13 @@ static void of_register_spi_devices(struct spi_master *master)
spi->mode |= SPI_RX_QUAD; spi->mode |= SPI_RX_QUAD;
break; break;
default: default:
dev_err(&master->dev, "spi-rx-nbits value is not supported\n"); dev_err(&master->dev,
"spi-rx-nbits %d not supported\n",
be32_to_cpup(prop));
spi_dev_put(spi); spi_dev_put(spi);
continue; continue;
} }
}
/* Device speed */ /* Device speed */
prop = of_get_property(nc, "spi-max-frequency", &len); prop = of_get_property(nc, "spi-max-frequency", &len);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment