Skip to content

Commit

Permalink
soc/tegra: pmc: Configure deep sleep control settings
Browse files Browse the repository at this point in the history
Tegra210 and prior Tegra chips have deep sleep entry and wakeup related
timings which are platform specific that should be configured before
entering into deep sleep.

Below are the timing specific configurations for deep sleep entry and
wakeup.
- Core rail power-on stabilization timer
- OSC clock stabilization timer after SOC rail power is stabilized.
- Core power off time is the minimum wake delay to keep the system
  in deep sleep state irrespective of any quick wake event.

These values depends on the discharge time of regulators and turn OFF
time of the PMIC to allow the complete system to finish entering into
deep sleep state.

These values vary based on the platform design and are specified
through the device tree.

This patch has implementation to configure these timings which are must
to have for proper deep sleep and wakeup operations.

Signed-off-by: Sowjanya Komatineni <skomatineni@nvidia.com>
Reviewed-by: Dmitry Osipenko <digetx@gmail.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
  • Loading branch information
Sowjanya Komatineni authored and Thierry Reding committed Oct 29, 2019
1 parent 455271d commit c7ccfcc
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion drivers/soc/tegra/pmc.c
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,8 @@

#define PMC_CPUPWRGOOD_TIMER 0xc8
#define PMC_CPUPWROFF_TIMER 0xcc
#define PMC_COREPWRGOOD_TIMER 0x3c
#define PMC_COREPWROFF_TIMER 0xe0

#define PMC_PWR_DET_VALUE 0xe4

Expand Down Expand Up @@ -2303,7 +2305,7 @@ static const struct tegra_pmc_regs tegra20_pmc_regs = {

static void tegra20_pmc_init(struct tegra_pmc *pmc)
{
u32 value;
u32 value, osc, pmu, off;

/* Always enable CPU power request */
value = tegra_pmc_readl(pmc, PMC_CNTRL);
Expand All @@ -2329,6 +2331,16 @@ static void tegra20_pmc_init(struct tegra_pmc *pmc)
value = tegra_pmc_readl(pmc, PMC_CNTRL);
value |= PMC_CNTRL_SYSCLK_OE;
tegra_pmc_writel(pmc, value, PMC_CNTRL);

/* program core timings which are applicable only for suspend state */
if (pmc->suspend_mode != TEGRA_SUSPEND_NONE) {
osc = DIV_ROUND_UP(pmc->core_osc_time * 8192, 1000000);
pmu = DIV_ROUND_UP(pmc->core_pmu_time * 32768, 1000000);
off = DIV_ROUND_UP(pmc->core_off_time * 32768, 1000000);
tegra_pmc_writel(pmc, ((osc << 8) & 0xff00) | (pmu & 0xff),
PMC_COREPWRGOOD_TIMER);
tegra_pmc_writel(pmc, off, PMC_COREPWROFF_TIMER);
}
}

static void tegra20_pmc_setup_irq_polarity(struct tegra_pmc *pmc,
Expand Down

0 comments on commit c7ccfcc

Please sign in to comment.