From: Thomas Schmid Date: Thu, 24 Oct 2013 15:32:35 +0000 (-0600) Subject: sam4s flash: fix PLLA frequency calculation if diva > 1 X-Git-Tag: v0.8.0-rc1~201 X-Git-Url: https://review.openocd.org/gitweb?p=openocd.git;a=commitdiff_plain;h=e3229bdfbbedeff548902c42bed31a23b99cc1d1 sam4s flash: fix PLLA frequency calculation if diva > 1 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 --- diff --git a/src/flash/nor/at91sam4.c b/src/flash/nor/at91sam4.c index 2615c3d750..6c8b71e2fd 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)); }