spi: kirkwood: prevent limiting speed to 0
authorGrzegorz Jaszczyk <jaz@semihalf.com>
Fri, 30 Apr 2021 13:26:31 +0000 (15:26 +0200)
committerStefan Roese <sr@denx.de>
Sun, 16 May 2021 04:48:45 +0000 (06:48 +0200)
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@semihalf.com>
Tested-by: Kostya Porotchkin <kostap@marvell.com>
Reviewed-by: Marcin Wojtas <marcin@marvell.com>
Reviewed-by: Kostya Porotchkin <kostap@marvell.com>
Signed-off-by: Stefan Roese <sr@denx.de>
drivers/spi/kirkwood_spi.c

index 063ed5f..bc5da0a 100644 (file)
@@ -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;