]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
spi: npcm_pspi: Fix the wrong clock divider calculation
authorJim Liu <jim.t90615@gmail.com>
Tue, 26 Dec 2023 02:00:06 +0000 (10:00 +0800)
committerTom Rini <trini@konsulko.com>
Tue, 26 Dec 2023 19:41:46 +0000 (14:41 -0500)
Fix the wrong clock divider calculation.

Signed-off-by: Jim Liu <JJLIU0@nuvoton.com>
drivers/spi/npcm_pspi.c

index 37bab709672dce3ed2bbf937b72af8801e8ba98e..eb14185273e9484b3f4e3259e11a9c57d7005666 100644 (file)
@@ -144,7 +144,7 @@ static int npcm_pspi_set_speed(struct udevice *bus, uint speed)
        if (speed > priv->max_hz)
                speed = priv->max_hz;
 
-       divisor = DIV_ROUND_CLOSEST(apb_clock, (2 * speed) - 1);
+       divisor = DIV_ROUND_CLOSEST(apb_clock, (2 * speed)) - 1;
        if (divisor > MAX_DIV)
                divisor = MAX_DIV;