[PATCH v1 3/3] spi: kirkwood: prevent limiting speed to 0

Stefan Roese sr at denx.de
Fri Apr 30 15:26:31 CEST 2021

From: Grzegorz Jaszczyk <jaz at semihalf.com>

After commit 1fe929ed497bcc8975be8d37383ebafd22b99dd2
("spi: kirkwood: prevent configuring speed exceeding max controller freq")
the spi frequency could be set to 0 on platform where spi-max-frequency
is not defined (e.g. on armada-388-gp). Prevent limiting speed in
mentioned cases.

Signed-off-by: Grzegorz Jaszczyk <jaz at semihalf.com>
Tested-by: Kostya Porotchkin <kostap at marvell.com>
Reviewed-by: Marcin Wojtas <marcin at marvell.com>
Reviewed-by: Kostya Porotchkin <kostap at marvell.com>
Signed-off-by: Stefan Roese <sr at denx.de>

 drivers/spi/kirkwood_spi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/spi/kirkwood_spi.c b/drivers/spi/kirkwood_spi.c
index 063ed5f35a3a..bc5da0a1e6e9 100644
--- a/drivers/spi/kirkwood_spi.c
+++ b/drivers/spi/kirkwood_spi.c
@@ -115,7 +115,7 @@ static int mvebu_spi_set_speed(struct udevice *bus, uint hz)
 	u32 data, divider;
 	unsigned int spr, sppr;
-	if (hz > spi->max_hz) {
+	if (spi->max_hz && (hz > spi->max_hz)) {
 		debug("%s: limit speed to the max_hz of the bus %d\n",
 		      __func__, spi->max_hz);
 		hz = spi->max_hz;

More information about the U-Boot mailing list