]> git.baikalelectronics.ru Git - kernel.git/commit
soc/tegra: pmc: Fix testing of powergate state
authorJon Hunter <jonathanh@nvidia.com>
Thu, 11 Feb 2016 18:03:23 +0000 (18:03 +0000)
committerThierry Reding <treding@nvidia.com>
Tue, 5 Apr 2016 13:22:48 +0000 (15:22 +0200)
commitc89b7a5ec0208a029ab296892dc9188f8c3478fe
tree75571f01a830109081ffaa00880e8193a227bca9
parentfa17dd3b24e6449c9aee4c1cf4e6ece91b039f8e
soc/tegra: pmc: Fix testing of powergate state

In tegra_powergate_set() the state of the powergates is read and OR'ed
with the bit for the powergate of interest. This unsigned 32-bit value
is then compared with a boolean value to test if the powergate is
already in the desired state. When turning on a powergate, apart from
the powergate that is represented by bit 0, this test will always
return false and so we may attempt to turn on the powergate when it is
already on.

After OR'ing the bit for the powergate, check if the result is not equal
to zero before comparing with the boolean value. Add a helper function
to return the current state of a powergate and use this in both
tegra_powergate_set() and tegra_powergate_is_powered() where we check
the powergate status.

Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Signed-off-by: Thierry Reding <treding@nvidia.com>
drivers/soc/tegra/pmc.c