summaryrefslogtreecommitdiffstats
path: root/drivers/clk/ingenic/cgu.c
diff options
context:
space:
mode:
authorPaul Cercueil <paul@crapouillou.net>2018-05-20 18:31:12 +0200
committerStephen Boyd <sboyd@kernel.org>2018-06-02 08:21:09 +0200
commit7ef3844fc5198065dbe8776798206c10859d209e (patch)
tree21599bf7a694a874677ca24f174c4b7ca1f758bc /drivers/clk/ingenic/cgu.c
parentLinux 4.17-rc1 (diff)
downloadlinux-7ef3844fc5198065dbe8776798206c10859d209e.tar.xz
linux-7ef3844fc5198065dbe8776798206c10859d209e.zip
clk: ingenic: Add support for clocks whose gate bit is inverted
Support the clocks which are gated when their gate bit is cleared instead of set. Signed-off-by: Paul Cercueil <paul@crapouillou.net> Signed-off-by: Stephen Boyd <sboyd@kernel.org>
Diffstat (limited to 'drivers/clk/ingenic/cgu.c')
-rw-r--r--drivers/clk/ingenic/cgu.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/clk/ingenic/cgu.c b/drivers/clk/ingenic/cgu.c
index 56a712c9075f..4b31145eb8aa 100644
--- a/drivers/clk/ingenic/cgu.c
+++ b/drivers/clk/ingenic/cgu.c
@@ -43,7 +43,8 @@ static inline bool
ingenic_cgu_gate_get(struct ingenic_cgu *cgu,
const struct ingenic_cgu_gate_info *info)
{
- return readl(cgu->base + info->reg) & BIT(info->bit);
+ return !!(readl(cgu->base + info->reg) & BIT(info->bit))
+ ^ info->clear_to_gate;
}
/**
@@ -62,7 +63,7 @@ ingenic_cgu_gate_set(struct ingenic_cgu *cgu,
{
u32 clkgr = readl(cgu->base + info->reg);
- if (val)
+ if (val ^ info->clear_to_gate)
clkgr |= BIT(info->bit);
else
clkgr &= ~BIT(info->bit);