Re: [PATCH] [ARM] tegra: workaround bit swap in powergate status register

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Sep 13, 2010 at 1:14 AM, Mike Rapoport <mike@xxxxxxxxxxxxxx> wrote:

snip

> +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)
> +        */

Bug IDs are not particularly useful here.  Maybe say something like:

"Tegra 2 has a bug where PCIE and VDE clamping masks are swapped"

that way if it's fixed in tegra 3, anyone debugging the code will know
why it was put there and for which chip.

> +       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);

Does this really need to be here?  If so it should be a pr_debug not a
pr_info.  On a mobile systems power gating happens quite frequently.

> +
> +       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);

status is now unused in this function and should be removed.

-Erik
--
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


[Index of Archives]     [ARM Kernel]     [Linux ARM]     [Linux ARM MSM]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux