Skip to content

Commit 550bae2

Browse files
mairacanalUlf Hansson
authored andcommitted
pmdomain: bcm: bcm2835-power: Fix broken reset status read
bcm2835_reset_status() has a misplaced parenthesis on every PM_READ() call. Since PM_READ(reg) expands to readl(power->base + (reg)), the expression: PM_READ(PM_GRAFX & PM_V3DRSTN) computes the bitwise AND of the register offset PM_GRAFX with the bitmask PM_V3DRSTN before using the result as a register offset, reading from the wrong MMIO address instead of the intended PM_GRAFX register. The same issue affects the PM_IMAGE cases. Fix by moving the closing parenthesis so PM_READ() receives only the register offset, and the bitmask is applied to the value returned by the read. Fixes: 670c672 ("soc: bcm: bcm2835-pm: Add support for power domains under a new binding.") Signed-off-by: Maíra Canal <mcanal@igalia.com> Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com> Reviewed-by: Stefan Wahren <wahrenst@gmx.net> Cc: stable@vger.kernel.org Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
1 parent 6de23f8 commit 550bae2

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

drivers/pmdomain/bcm/bcm2835-power.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -580,11 +580,11 @@ static int bcm2835_reset_status(struct reset_controller_dev *rcdev,
580580

581581
switch (id) {
582582
case BCM2835_RESET_V3D:
583-
return !PM_READ(PM_GRAFX & PM_V3DRSTN);
583+
return !(PM_READ(PM_GRAFX) & PM_V3DRSTN);
584584
case BCM2835_RESET_H264:
585-
return !PM_READ(PM_IMAGE & PM_H264RSTN);
585+
return !(PM_READ(PM_IMAGE) & PM_H264RSTN);
586586
case BCM2835_RESET_ISP:
587-
return !PM_READ(PM_IMAGE & PM_ISPRSTN);
587+
return !(PM_READ(PM_IMAGE) & PM_ISPRSTN);
588588
default:
589589
return -EINVAL;
590590
}

0 commit comments

Comments
 (0)