Skip to contentSkip to conversation

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

PATCH New Michal Simek 3 participants 3 messages Mar 16, 2021 – Mar 17, 2021 SPI

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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")

---

 drivers/spi/spi-uclass.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/spi/spi-uclass.c +2 -1
index 7155d4aebd6d..dd2c82165684 100644
@@ -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);
Signature · 1 line
2.30.1
#1 lore raw

PATCH 1/1 dm: spi: Prevent setting a speed of 0 Hz in spi_post_probe

Quoted 7 lines · Michal Simek

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")
Signature · 3 lines
Regards,
Pratyush Yadav
Texas Instruments Inc.
#2 lore raw

PATCH 1/1 dm: spi: Prevent setting a speed of 0 Hz in spi_post_probe

In reply to Michal Simek
Quoted 8 lines · Michal Simek

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")

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.

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20210317/df254d52/attachment.sig>