diff options
author | Jon Hunter <jonathanh@nvidia.com> | 2016-10-22 20:23:53 +0100 |
---|---|---|
committer | Thierry Reding <treding@nvidia.com> | 2016-11-15 15:51:53 +0100 |
commit | 27b12b4e58525f7e8a612af5a3999126d0ea76fb (patch) | |
tree | fc4c5d3d8bf59e81e6786829fd108ee2d1c304c3 /drivers/soc/tegra/pmc.c | |
parent | f4392d6da5f52727a53298321f4dfeac6df1a093 (diff) |
soc/tegra: pmc: Simplify IO rail bit handling
The function tegra_io_rail_prepare() converts the IO rail ID into a
bit position that is used to check the status and control the IO rail
in the PMC registers. However, rather than converting to a bit position
it is more useful to convert to a bit-mask because this is what is
actually used. By doing so the BIT() marco only needs to be used once
and we can use the IO_DPD_REQ_CODE_MASK when checking for erroneous rail
IDs.
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
[treding@nvidia.com: rebase and rename bit -> mask]
Signed-off-by: Thierry Reding <treding@nvidia.com>
Diffstat (limited to 'drivers/soc/tegra/pmc.c')
-rw-r--r-- | drivers/soc/tegra/pmc.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/drivers/soc/tegra/pmc.c b/drivers/soc/tegra/pmc.c index c8b54b9dc093..c21d48db058e 100644 --- a/drivers/soc/tegra/pmc.c +++ b/drivers/soc/tegra/pmc.c @@ -934,7 +934,7 @@ tegra_io_pad_find(struct tegra_pmc *pmc, enum tegra_io_pad id) } static int tegra_io_pad_prepare(enum tegra_io_pad id, unsigned long *request, - unsigned long *status, unsigned int *bit) + unsigned long *status, u32 *mask) { const struct tegra_io_pad_soc *pad; unsigned long rate, value; @@ -946,7 +946,7 @@ static int tegra_io_pad_prepare(enum tegra_io_pad id, unsigned long *request, if (pad->dpd == UINT_MAX) return -ENOTSUPP; - *bit = pad->dpd % 32; + *mask = BIT(pad->dpd % 32); if (pad->dpd < 32) { *status = IO_DPD_STATUS; @@ -1002,20 +1002,20 @@ static void tegra_io_pad_unprepare(void) int tegra_io_pad_power_enable(enum tegra_io_pad id) { unsigned long request, status; - unsigned int bit; + u32 mask; int err; mutex_lock(&pmc->powergates_lock); - err = tegra_io_pad_prepare(id, &request, &status, &bit); + err = tegra_io_pad_prepare(id, &request, &status, &mask); if (err < 0) { dev_err(pmc->dev, "tegra_io_pad_prepare() failed: %d\n", err); goto unlock; } - tegra_pmc_writel(IO_DPD_REQ_CODE_OFF | BIT(bit), request); + tegra_pmc_writel(IO_DPD_REQ_CODE_OFF | mask, request); - err = tegra_io_pad_poll(status, BIT(bit), 0, 250); + err = tegra_io_pad_poll(status, mask, 0, 250); if (err < 0) { dev_err(pmc->dev, "tegra_io_pad_poll() failed: %d\n", err); goto unlock; @@ -1038,20 +1038,20 @@ EXPORT_SYMBOL(tegra_io_pad_power_enable); int tegra_io_pad_power_disable(enum tegra_io_pad id) { unsigned long request, status; - unsigned int bit; + u32 mask; int err; mutex_lock(&pmc->powergates_lock); - err = tegra_io_pad_prepare(id, &request, &status, &bit); + err = tegra_io_pad_prepare(id, &request, &status, &mask); if (err < 0) { dev_err(pmc->dev, "tegra_io_pad_prepare() failed: %d\n", err); goto unlock; } - tegra_pmc_writel(IO_DPD_REQ_CODE_ON | BIT(bit), request); + tegra_pmc_writel(IO_DPD_REQ_CODE_ON | mask, request); - err = tegra_io_pad_poll(status, BIT(bit), BIT(bit), 250); + err = tegra_io_pad_poll(status, mask, mask, 250); if (err < 0) { dev_err(pmc->dev, "tegra_io_pad_poll() failed: %d\n", err); goto unlock; |