[PATCH v1] spi: npcm_pspi: Fix the wrong clock divider calculation

Jim Liu jim.t90615 at gmail.com
Tue Dec 26 03:00:06 CET 2023


Fix the wrong clock divider calculation.

Signed-off-by: Jim Liu <JJLIU0 at nuvoton.com>
---
 drivers/spi/npcm_pspi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/spi/npcm_pspi.c b/drivers/spi/npcm_pspi.c
index 37bab70967..eb14185273 100644
--- a/drivers/spi/npcm_pspi.c
+++ b/drivers/spi/npcm_pspi.c
@@ -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;
 
-- 
2.25.1



More information about the U-Boot mailing list