developer | ec4ebe4 | 2022-04-12 11:17:45 +0800 | [diff] [blame^] | 1 | From 671c3bf50ae498dc12aef6c70abe5cfa066b1348 Mon Sep 17 00:00:00 2001 |
| 2 | From: Chuanhong Guo <gch981213@gmail.com> |
| 3 | Date: Fri, 6 Mar 2020 16:50:49 +0800 |
| 4 | Subject: [PATCH 1/2] spi: make spi-max-frequency optional |
| 5 | |
| 6 | We only need a spi-max-frequency when we specifically request a |
| 7 | spi frequency lower than the max speed of spi host. |
| 8 | This property is already documented as optional property and current |
| 9 | host drivers are implemented to operate at highest speed possible |
| 10 | when spi->max_speed_hz is 0. |
| 11 | This patch makes spi-max-frequency an optional property so that |
| 12 | we could just omit it to use max controller speed. |
| 13 | |
| 14 | Signed-off-by: Chuanhong Guo <gch981213@gmail.com> |
| 15 | Link: https://lore.kernel.org/r/20200306085052.28258-2-gch981213@gmail.com |
| 16 | Signed-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 | } |