The powergate status register has PCIE and VDEC bits swapped. Using decicated tegra_powergate_get_status function instead of reading the PWRGATE_STATUS register allows to workaround this problem. Signed-off-by: Mike Rapoport <mike@xxxxxxxxxxxxxx> --- arch/arm/mach-tegra/powergate.c | 28 +++++++++++++++++++++++++--- 1 files changed, 25 insertions(+), 3 deletions(-) diff --git a/arch/arm/mach-tegra/powergate.c b/arch/arm/mach-tegra/powergate.c index c286dad..719566e 100644 --- a/arch/arm/mach-tegra/powergate.c +++ b/arch/arm/mach-tegra/powergate.c @@ -52,6 +52,29 @@ static void pmc_write(u32 val, unsigned long reg) writel(val, pmc + reg); } +static bool tegra_powergate_get_status(int id) +{ + u32 mask; + u32 val; + + /* + * PCIE and VDE clamping masks are swapped relatively to + * partition Ids (bug 602975) + */ + if (id == TEGRA_POWERGATE_VDEC) + mask = (1 << TEGRA_POWERGATE_PCIE); + else if (id == TEGRA_POWERGATE_PCIE) + mask = (1 << TEGRA_POWERGATE_VDEC); + else + mask = (1 << id); + + val = pmc_read(PWRGATE_STATUS); + + pr_info("%s: id=%d, mask=%08x, val=%08x\n", __func__, id, mask, val); + + return !!(val & mask); +} + static int tegra_powergate_set(int id, bool new_state) { bool status; @@ -59,7 +82,7 @@ static int tegra_powergate_set(int id, bool new_state) spin_lock_irqsave(&tegra_powergate_lock, flags); - status = pmc_read(PWRGATE_STATUS) & (1 << id); + status = tegra_powergate_get_status(id); if (status == new_state) { spin_unlock_irqrestore(&tegra_powergate_lock, flags); @@ -96,8 +119,7 @@ bool tegra_powergate_is_powered(int id) if (id < 0 || id >= TEGRA_NUM_POWERGATE) return -EINVAL; - status = pmc_read(PWRGATE_STATUS) & (1 << id); - return !!status; + return tegra_powergate_get_status(id); } int tegra_powergate_remove_clamping(int id) -- 1.6.6.2 -- To unsubscribe from this list: send the line "unsubscribe linux-tegra" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html