Skip to content

Commit

Permalink
soc: imx: gpc: fix imx6sl gpc power domain regression
Browse files Browse the repository at this point in the history
Commit 721cabf ("soc: imx: move PGC handling to a new GPC driver")
broke the MX6SL GPC power domain support.
It always got the following error:
[    1.248364] imx-gpc 20dc000.gpc: could not find pgc DT node
This patch adds back the legecy support.

Fixes: 721cabf ("soc: imx: move PGC handling to a new GPC driver")
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
Reviewed-by: Lucas Stach <l.stach@pengutronix.de>
Signed-off-by: Shawn Guo <shawnguo@kernel.org>
  • Loading branch information
Dong Aisheng authored and Shawn Guo committed Mar 24, 2017
1 parent 15c3de4 commit 5a42d11
Showing 1 changed file with 7 additions and 11 deletions.
18 changes: 7 additions & 11 deletions drivers/soc/imx/gpc.c
Original file line number Diff line number Diff line change
Expand Up @@ -309,12 +309,13 @@ static struct genpd_onecell_data imx_gpc_onecell_data = {
.num_domains = 2,
};

static int imx_gpc_old_dt_init(struct device *dev, struct regmap *regmap)
static int imx_gpc_old_dt_init(struct device *dev, struct regmap *regmap,
unsigned int num_domains)
{
struct imx_pm_domain *domain;
int i, ret;

for (i = 0; i < 2; i++) {
for (i = 0; i < num_domains; i++) {
domain = &imx_gpc_domains[i];
domain->regmap = regmap;
domain->ipg_rate_mhz = 66;
Expand All @@ -332,7 +333,7 @@ static int imx_gpc_old_dt_init(struct device *dev, struct regmap *regmap)
}
}

for (i = 0; i < 2; i++)
for (i = 0; i < num_domains; i++)
pm_genpd_init(&imx_gpc_domains[i].base, NULL, false);

if (IS_ENABLED(CONFIG_PM_GENERIC_DOMAINS)) {
Expand All @@ -345,7 +346,7 @@ static int imx_gpc_old_dt_init(struct device *dev, struct regmap *regmap)
return 0;

genpd_err:
for (i = 0; i < 2; i++)
for (i = 0; i < num_domains; i++)
pm_genpd_remove(&imx_gpc_domains[i].base);
imx_pgc_put_clocks(&imx_gpc_domains[1]);
clk_err:
Expand Down Expand Up @@ -385,13 +386,8 @@ static int imx_gpc_probe(struct platform_device *pdev)
}

if (!pgc_node) {
/* old DT layout is only supported for mx6q aka 2 domains */
if (of_id_data->num_domains != 2) {
dev_err(&pdev->dev, "could not find pgc DT node\n");
return -ENODEV;
}

ret = imx_gpc_old_dt_init(&pdev->dev, regmap);
ret = imx_gpc_old_dt_init(&pdev->dev, regmap,
of_id_data->num_domains);
if (ret)
return ret;
} else {
Expand Down

0 comments on commit 5a42d11

Please sign in to comment.