aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNishanth Menon <[email protected]>2012-02-29 23:33:41 +0100
committerKevin Hilman <[email protected]>2012-03-05 11:29:26 -0800
commitade6ec056fd4acdf4826178eeb305ed263844532 (patch)
treec8394aa8f035e720ab1b790c95717cfe1b971993
parent1f55bc1852e42f0d06d9eb66b3d3c15b01b62abe (diff)
ARM: OMAP3+: SmartReflex: Fix status masking in ERRCONFIG register
ERRCONFIG register has status bits that were intended not to be destroyed by bad modification. We cleanup and simplify the handling the status in the modify path. Reported-by: Vincent Bour <[email protected]> Signed-off-by: Nishanth Menon <[email protected]> Signed-off-by: Jean Pihet <[email protected]> Reviewed-by: Kevin Hilman <[email protected]> Signed-off-by: Kevin Hilman <[email protected]>
-rw-r--r--arch/arm/mach-omap2/smartreflex.c21
1 files changed, 8 insertions, 13 deletions
diff --git a/arch/arm/mach-omap2/smartreflex.c b/arch/arm/mach-omap2/smartreflex.c
index 24ba80b70bd3..f2f2f2af7ba2 100644
--- a/arch/arm/mach-omap2/smartreflex.c
+++ b/arch/arm/mach-omap2/smartreflex.c
@@ -74,10 +74,6 @@ static inline void sr_modify_reg(struct omap_sr *sr, unsigned offset, u32 mask,
u32 value)
{
u32 reg_val;
- u32 errconfig_offs = 0, errconfig_mask = 0;
-
- reg_val = __raw_readl(sr->base + offset);
- reg_val &= ~mask;
/*
* Smartreflex error config register is special as it contains
@@ -88,16 +84,15 @@ static inline void sr_modify_reg(struct omap_sr *sr, unsigned offset, u32 mask,
* if they are currently set, but does allow the caller to write
* those bits.
*/
- if (sr->ip_type == SR_TYPE_V1) {
- errconfig_offs = ERRCONFIG_V1;
- errconfig_mask = ERRCONFIG_STATUS_V1_MASK;
- } else if (sr->ip_type == SR_TYPE_V2) {
- errconfig_offs = ERRCONFIG_V2;
- errconfig_mask = ERRCONFIG_VPBOUNDINTST_V2;
- }
+ if (sr->ip_type == SR_TYPE_V1 && offset == ERRCONFIG_V1)
+ mask |= ERRCONFIG_STATUS_V1_MASK;
+ else if (sr->ip_type == SR_TYPE_V2 && offset == ERRCONFIG_V2)
+ mask |= ERRCONFIG_VPBOUNDINTST_V2;
+
+ reg_val = __raw_readl(sr->base + offset);
+ reg_val &= ~mask;
- if (offset == errconfig_offs)
- reg_val &= ~errconfig_mask;
+ value &= mask;
reg_val |= value;