Skip to contentSkip to conversation

i.MX31: Fix PRCS bit test

PATCH Applied Stefan Weil 3 participants 3 messages Jun 9, 2013 – Jun 25, 2013 Arm i.MX and Layerscape

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 i.MX31: Fix PRCS bit test

cppcheck detected a condition which was always false.

According to the MCIMX31 Reference Manual, the PRCS bits have to be 01 to select the Frequency Pre-Multiplier (FPM). PRCS uses bits 1 and 2, so we have to test for 2.

---
 hw/misc/imx_ccm.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/misc/imx_ccm.c +1 -1
index c153a24..427ce5c 100644
@@ -153,7 +153,7 @@ static void update_clocks(IMXCCMState *s)
      * approach
      */
 
-    if ((s->ccmr & CCMR_PRCS) == 1) {
+    if ((s->ccmr & CCMR_PRCS) == 2) {
         s->pll_refclk_freq = CKIL_FREQ * 1024;
     } else {
         s->pll_refclk_freq = CKIH_FREQ;
Signature · 1 line
1.7.10.4
#1 lore raw
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Stefan" == Stefan Weil <[email protected]> writes:

Stefan> cppcheck detected a condition which was always false. Stefan> According to the MCIMX31 Reference Manual, the PRCS bits have Stefan> to be 01 to select the Frequency Pre-Multiplier (FPM). PRCS Stefan> uses bits 1 and 2, so we have to test for 2.

Good catch. I hate hard coded constants, they're so easy to get wrong!

Stefan> Signed-off-by: Stefan Weil <[email protected]>

--
Dr Peter Chubb peter.chubb AT nicta.com.au
http://www.ssrg.nicta.com.au Software Systems Research Group/NICTA

#2 lore raw
In reply to Stefan Weil
Quoted 7 lines · Stefan Weil

cppcheck detected a condition which was always false.

According to the MCIMX31 Reference Manual, the PRCS bits have to be 01 to select the Frequency Pre-Multiplier (FPM). PRCS uses bits 1 and 2, so we have to test for 2.

Thanks, applied to arm-devs.next.

-- PMM