ARM: davinci: psc: fix incorrect mask
authorMurali Karicheri <m-karicheri2@ti.com>
Mon, 14 Nov 2011 20:12:06 +0000 (01:42 +0530)
committerSekhar Nori <nsekhar@ti.com>
Mon, 5 Dec 2011 11:17:14 +0000 (16:47 +0530)
There are 5 LSB bits defined in PDSTAT and the code
currently uses a mask of 1 bit to check the status.

Use a proper mask per the hardware specification.
While at it, use a #define for the mask to improve
readability.

Reviewed-by: Sergei Shtylyov <sshtylyov@mvista.com>
Signed-off-by: Murali Karicheri <m-karicheri2@ti.com>
Signed-off-by: Sekhar Nori <nsekhar@ti.com>
arch/arm/mach-davinci/include/mach/psc.h
arch/arm/mach-davinci/psc.c

index fa59c097223dc85ec965224e9ebfc0ac8dccf2c2..8bf279a88b4b509b11d3169b11a1fb1bf80f3565 100644 (file)
 #define PSC_STATE_ENABLE       3
 
 #define MDSTAT_STATE_MASK      0x3f
+#define PDSTAT_STATE_MASK      0x1f
 #define MDCTL_FORCE            BIT(31)
 
 #ifndef __ASSEMBLER__
index 1fb6bdff38c1f5e9ff796e72c4c57be824919209..a0e17707c981a472f527274e34b79c347ef40174 100644 (file)
@@ -80,7 +80,7 @@ void davinci_psc_config(unsigned int domain, unsigned int ctlr,
        __raw_writel(mdctl, psc_base + MDCTL + 4 * id);
 
        pdstat = __raw_readl(psc_base + PDSTAT);
-       if ((pdstat & 0x00000001) == 0) {
+       if ((pdstat & PDSTAT_STATE_MASK) == 0) {
                pdctl1 = __raw_readl(psc_base + PDCTL1);
                pdctl1 |= 0x1;
                __raw_writel(pdctl1, psc_base + PDCTL1);