blob: 79ce15c37b61b2854a3f4c7a63c7ef3838953b84 [file] [log] [blame]
developerec4ebe42022-04-12 11:17:45 +08001From 671c3bf50ae498dc12aef6c70abe5cfa066b1348 Mon Sep 17 00:00:00 2001
2From: Chuanhong Guo <gch981213@gmail.com>
3Date: Fri, 6 Mar 2020 16:50:49 +0800
4Subject: [PATCH 1/2] spi: make spi-max-frequency optional
5
6We only need a spi-max-frequency when we specifically request a
7spi frequency lower than the max speed of spi host.
8This property is already documented as optional property and current
9host drivers are implemented to operate at highest speed possible
10when spi->max_speed_hz is 0.
11This patch makes spi-max-frequency an optional property so that
12we could just omit it to use max controller speed.
13
14Signed-off-by: Chuanhong Guo <gch981213@gmail.com>
15Link: https://lore.kernel.org/r/20200306085052.28258-2-gch981213@gmail.com
16Signed-off-by: Mark Brown <broonie@kernel.org>
17---
18 drivers/spi/spi.c | 9 ++-------
19 1 file changed, 2 insertions(+), 7 deletions(-)
20
21--- a/drivers/spi/spi.c
22+++ b/drivers/spi/spi.c
23@@ -1809,13 +1809,8 @@ static int of_spi_parse_dt(struct spi_co
24 spi->mode |= SPI_CS_HIGH;
25
26 /* Device speed */
27- rc = of_property_read_u32(nc, "spi-max-frequency", &value);
28- if (rc) {
29- dev_err(&ctlr->dev,
30- "%pOF has no valid 'spi-max-frequency' property (%d)\n", nc, rc);
31- return rc;
32- }
33- spi->max_speed_hz = value;
34+ if (!of_property_read_u32(nc, "spi-max-frequency", &value))
35+ spi->max_speed_hz = value;
36
37 return 0;
38 }