From e3229bdfbbedeff548902c42bed31a23b99cc1d1 Mon Sep 17 00:00:00 2001 From: Thomas Schmid Date: Thu, 24 Oct 2013 09:32:35 -0600 Subject: [PATCH] sam4s flash: fix PLLA frequency calculation if diva > 1 MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit The code didn't address the case where diva is bigger than 1. Change-Id: I15d8c47aa7b5cf80df1f29e067f30575f5d60a90 Signed-off-by: Thomas Schmid Reviewed-on: http://openocd.zylin.com/1765 Tested-by: jenkins Reviewed-by: Mathias Küster Reviewed-by: Spencer Oliver --- src/flash/nor/at91sam4.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/flash/nor/at91sam4.c b/src/flash/nor/at91sam4.c index 2615c3d7..6c8b71e2 100644 --- a/src/flash/nor/at91sam4.c +++ b/src/flash/nor/at91sam4.c @@ -1246,8 +1246,8 @@ static void sam4_explain_ckgr_plla(struct sam4_chip *pChip) LOG_USER("\tPLLA Freq: (Disabled,mula = 0)"); else if (diva == 0) LOG_USER("\tPLLA Freq: (Disabled,diva = 0)"); - else if (diva == 1) { - pChip->cfg.plla_freq = (pChip->cfg.mainosc_freq * (mula + 1)); + else if (diva >= 1) { + pChip->cfg.plla_freq = (pChip->cfg.mainosc_freq * (mula + 1) / diva); LOG_USER("\tPLLA Freq: %3.03f MHz", _tomhz(pChip->cfg.plla_freq)); } -- 2.39.5