[PATCH] dm: spi: Prevent setting a speed of 0 Hz in spi_post_probe

The commit 12bfb2e05fc2 ("dm: spi: prevent setting a speed of 0 Hz") changes default value from 0 to SPI_DEFAULT_SPEED_HZ but spi_post_probe() hasn't been updated in the same way. It should be also update to be aligned with previous patch.
Fixes: 12bfb2e05fc2 ("dm: spi: prevent setting a speed of 0 Hz") Signed-off-by: Michal Simek michal.simek@xilinx.com ---
drivers/spi/spi-uclass.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/spi/spi-uclass.c b/drivers/spi/spi-uclass.c index 7155d4aebd6d..dd2c82165684 100644 --- a/drivers/spi/spi-uclass.c +++ b/drivers/spi/spi-uclass.c @@ -178,7 +178,8 @@ static int spi_post_probe(struct udevice *bus) #if !CONFIG_IS_ENABLED(OF_PLATDATA) struct dm_spi_bus *spi = dev_get_uclass_priv(bus);
- spi->max_hz = dev_read_u32_default(bus, "spi-max-frequency", 0); + spi->max_hz = dev_read_u32_default(bus, "spi-max-frequency", + SPI_DEFAULT_SPEED_HZ); #endif #if defined(CONFIG_NEEDS_MANUAL_RELOC) struct dm_spi_ops *ops = spi_get_ops(bus);

On 16/03/21 01:33PM, Michal Simek wrote:
The commit 12bfb2e05fc2 ("dm: spi: prevent setting a speed of 0 Hz") changes default value from 0 to SPI_DEFAULT_SPEED_HZ but spi_post_probe() hasn't been updated in the same way. It should be also update to be aligned with previous patch.
Fixes: 12bfb2e05fc2 ("dm: spi: prevent setting a speed of 0 Hz") Signed-off-by: Michal Simek michal.simek@xilinx.com
Reviewed-by: Pratyush Yadav p.yadav@ti.com

On Tue, Mar 16, 2021 at 01:33:57PM +0100, Michal Simek wrote:
The commit 12bfb2e05fc2 ("dm: spi: prevent setting a speed of 0 Hz") changes default value from 0 to SPI_DEFAULT_SPEED_HZ but spi_post_probe() hasn't been updated in the same way. It should be also update to be aligned with previous patch.
Fixes: 12bfb2e05fc2 ("dm: spi: prevent setting a speed of 0 Hz") Signed-off-by: Michal Simek michal.simek@xilinx.com Reviewed-by: Pratyush Yadav p.yadav@ti.com
This breaks tests: => ut dm spi_claim_bus Test: dm_test_spi_claim_bus: spi.c SF: Detected m25p16 with page size 256 Bytes, erase size 64 KiB, total 2 MiB SF: Detected m25p16 with page size 256 Bytes, erase size 64 KiB, total 2 MiB test/dm/spi.c:120, dm_test_spi_switch_slaves(): slave_a->max_hz == bus_data->speed: Expected 0x2625a00 (40000000), got 0x186a0 (100000) test/dm/spi.c:120, dm_test_spi_switch_slaves(): slave_a->max_hz == bus_data->speed: Expected 0x2625a00 (40000000), got 0x186a0 (100000) test/dm/spi.c:120, dm_test_spi_switch_slaves(): slave_a->max_hz == bus_data->speed: Expected 0x2faf080 (50000000), got 0x186a0 (100000) Test: dm_test_spi_claim_bus: spi.c (flat tree) SF: Detected m25p16 with page size 256 Bytes, erase size 64 KiB, total 2 MiB SF: Detected m25p16 with page size 256 Bytes, erase size 64 KiB, total 2 MiB test/dm/spi.c:120, dm_test_spi_switch_slaves(): slave_a->max_hz == bus_data->speed: Expected 0x2625a00 (40000000), got 0x186a0 (100000) test/dm/spi.c:120, dm_test_spi_switch_slaves(): slave_a->max_hz == bus_data->speed: Expected 0x2625a00 (40000000), got 0x186a0 (100000) test/dm/spi.c:120, dm_test_spi_switch_slaves(): slave_a->max_hz == bus_data->speed: Expected 0x2faf080 (50000000), got 0x186a0 (100000) Failures: 6
So I assume a test needs updating too.
participants (3)
-
Michal Simek
-
Pratyush Yadav
-
Tom Rini