diff mbox series

[v3,1/4] spi: make spi-max-frequency optional

Message ID 20200306085052.28258-2-gch981213@gmail.com
State New
Delegated to: Ambarus Tudor
Headers show
Series rewrite mtk-quadspi spi-nor driver with spi-mem | expand

Commit Message

Chuanhong Guo March 6, 2020, 8:50 a.m. UTC
We only need a spi-max-frequency when we specifically request a
spi frequency lower than the max speed of spi host.
This property is already documented as optional property and current
host drivers are implemented to operate at highest speed possible
when spi->max_speed_hz is 0.
This patch makes spi-max-frequency an optional property so that
we could just omit it to use max controller speed.

Signed-off-by: Chuanhong Guo <gch981213@gmail.com>
Change since v2:

Change since v1:
 new patch

 drivers/spi/spi.c | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)
diff mbox series


diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
index 22baf204a09d..e317fb30329f 100644
--- a/drivers/spi/spi.c
+++ b/drivers/spi/spi.c
@@ -1951,13 +1951,8 @@  static int of_spi_parse_dt(struct spi_controller *ctlr, struct spi_device *spi,
 		spi->mode |= SPI_CS_HIGH;
 	/* Device speed */
-	rc = of_property_read_u32(nc, "spi-max-frequency", &value);
-	if (rc) {
-		dev_err(&ctlr->dev,
-			"%pOF has no valid 'spi-max-frequency' property (%d)\n", nc, rc);
-		return rc;
-	}
-	spi->max_speed_hz = value;
+	if (!of_property_read_u32(nc, "spi-max-frequency", &value))
+		spi->max_speed_hz = value;
 	return 0;