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 <thomas.schmid@gmail.com>
Reviewed-on: http://openocd.zylin.com/1765
Tested-by: jenkins
Reviewed-by: Mathias Küster <kesmtp@freenet.de>
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
This commit is contained in:
Thomas Schmid 2013-10-24 09:32:35 -06:00 committed by Spencer Oliver
parent b16a7f9f6e
commit e3229bdfbb
1 changed files with 2 additions and 2 deletions

View File

@ -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));
}