diff mbox

i.MX31: Fix PRCS bit test

Message ID 1370810662-32320-1-git-send-email-sw@weilnetz.de
State Accepted
Headers show

Commit Message

Stefan Weil June 9, 2013, 8:44 p.m. UTC
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.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
---
 hw/misc/imx_ccm.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Peter Chubb June 9, 2013, 11:20 p.m. UTC | #1
>>>>> "Stefan" == Stefan Weil <sw@weilnetz.de> 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 <sw@weilnetz.de> 

Signed-off-by: Peter Chubb <peter.chubb@nicta.com.au>

--
Dr Peter Chubb				        peter.chubb AT nicta.com.au
http://www.ssrg.nicta.com.au          Software Systems Research Group/NICTA
Peter Maydell June 25, 2013, 5:43 p.m. UTC | #2
On 9 June 2013 21:44, Stefan Weil <sw@weilnetz.de> wrote:
> 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.
>
> Signed-off-by: Stefan Weil <sw@weilnetz.de>

Thanks, applied to arm-devs.next.

-- PMM
diff mbox

Patch

diff --git a/hw/misc/imx_ccm.c b/hw/misc/imx_ccm.c
index c153a24..427ce5c 100644
--- a/hw/misc/imx_ccm.c
+++ b/hw/misc/imx_ccm.c
@@ -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;