Skip to content

Commit

Permalink
clk: qcom: gdsc: Add support to enable retention of GSDCR
Browse files Browse the repository at this point in the history
Add support for the RETAIN_FF_ENABLE feature which enables the
usage of retention registers. These registers maintain their
state after disabling and re-enabling a GDSC.

Signed-off-by: Taniya Das <tdas@codeaurora.org>
Link: https://lore.kernel.org/r/1595606878-2664-2-git-send-email-tdas@codeaurora.org
Signed-off-by: Stephen Boyd <sboyd@kernel.org>
  • Loading branch information
Taniya Das authored and Stephen Boyd committed Jul 24, 2020
1 parent 413d84b commit 1737229
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
12 changes: 12 additions & 0 deletions drivers/clk/qcom/gdsc.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
/* CFG_GDSCR */
#define GDSC_POWER_UP_COMPLETE BIT(16)
#define GDSC_POWER_DOWN_COMPLETE BIT(15)
#define GDSC_RETAIN_FF_ENABLE BIT(11)
#define CFG_GDSCR_OFFSET 0x4

/* Wait 2^n CXO cycles between all states. Here, n=2 (4 cycles). */
Expand Down Expand Up @@ -217,6 +218,14 @@ static inline void gdsc_assert_reset_aon(struct gdsc *sc)
regmap_update_bits(sc->regmap, sc->clamp_io_ctrl,
GMEM_RESET_MASK, 0);
}

static void gdsc_retain_ff_on(struct gdsc *sc)
{
u32 mask = GDSC_RETAIN_FF_ENABLE;

regmap_update_bits(sc->regmap, sc->gdscr, mask, mask);
}

static int gdsc_enable(struct generic_pm_domain *domain)
{
struct gdsc *sc = domain_to_gdsc(domain);
Expand Down Expand Up @@ -269,6 +278,9 @@ static int gdsc_enable(struct generic_pm_domain *domain)
udelay(1);
}

if (sc->flags & RETAIN_FF_ENABLE)
gdsc_retain_ff_on(sc);

return 0;
}

Expand Down
1 change: 1 addition & 0 deletions drivers/clk/qcom/gdsc.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ struct gdsc {
#define AON_RESET BIT(4)
#define POLL_CFG_GDSCR BIT(5)
#define ALWAYS_ON BIT(6)
#define RETAIN_FF_ENABLE BIT(7)
struct reset_controller_dev *rcdev;
unsigned int *resets;
unsigned int reset_count;
Expand Down

0 comments on commit 1737229

Please sign in to comment.