Skip to content

Commit

Permalink
soc: imx: gpcv2: add domain option to keep domain clocks enabled
Browse files Browse the repository at this point in the history
Some of the MIX domains are using clocks to drive the bus bridges. Those
must be enabled at all times, as long as the domain is powered up and
they don't have any other consumer than the power domain. Add an option
to keep the clocks attached to a domain enabled as long as the domain
is power up and only disable them after the domain is powered down.

Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
Signed-off-by: Shawn Guo <shawnguo@kernel.org>
  • Loading branch information
lynxeye-dev authored and Shawn Guo committed Oct 6, 2021
1 parent fadf79a commit 18c9857
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions drivers/soc/imx/gpcv2.c
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,7 @@ struct imx_pgc_domain {
} bits;

const int voltage;
const bool keep_clocks;
struct device *dev;
};

Expand Down Expand Up @@ -295,7 +296,8 @@ static int imx_pgc_power_up(struct generic_pm_domain *genpd)
}

/* Disable reset clocks for all devices in the domain */
clk_bulk_disable_unprepare(domain->num_clks, domain->clks);
if (!domain->keep_clocks)
clk_bulk_disable_unprepare(domain->num_clks, domain->clks);

return 0;

Expand All @@ -317,10 +319,12 @@ static int imx_pgc_power_down(struct generic_pm_domain *genpd)
int ret;

/* Enable reset clocks for all devices in the domain */
ret = clk_bulk_prepare_enable(domain->num_clks, domain->clks);
if (ret) {
dev_err(domain->dev, "failed to enable reset clocks\n");
return ret;
if (!domain->keep_clocks) {
ret = clk_bulk_prepare_enable(domain->num_clks, domain->clks);
if (ret) {
dev_err(domain->dev, "failed to enable reset clocks\n");
return ret;
}
}

/* request the ADB400 to power down */
Expand Down

0 comments on commit 18c9857

Please sign in to comment.