public inbox for linux-arm-kernel@lists.infradead.org
 help / color / mirror / Atom feed
From: dongas86@gmail.com (Dong Aisheng)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 4/8] soc: imx: gpc: fix imx6sl gpc power domain regression
Date: Thu, 23 Mar 2017 03:23:56 +0800	[thread overview]
Message-ID: <20170322192356.GC16264@b29396-OptiPlex-7040> (raw)
In-Reply-To: <1490001974.2895.11.camel@pengutronix.de>

On Mon, Mar 20, 2017 at 10:26:14AM +0100, Lucas Stach wrote:
> Am Montag, den 20.03.2017, 14:15 +0800 schrieb Dong Aisheng:
> > Commit 721cabf6c660 ("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.
> 
> This patch removes a safeguard against abusing the old binding for new
> SoCs. Please leave this check in place and instead loosen the check to
> also allow the old i.MX6SL binding.
> 

Thanks for the reminder.
I found beside the checking, we probably also need some extra fix that
the current imx_gpc_old_dt_init() only supports two domains while the
driver formerly supports three for MX6SL.

And because the num_domains is defined by driver itself, no need check
in imx_gpc_old_dt_init() anymore.

The patch would be as follows:
diff --git a/drivers/soc/imx/gpc.c b/drivers/soc/imx/gpc.c
index 4885ec2..6a806a1 100644
--- a/drivers/soc/imx/gpc.c
+++ b/drivers/soc/imx/gpc.c
@@ -303,10 +303,13 @@ static struct genpd_onecell_data imx_gpc_onecell_data = {
 
 static int imx_gpc_old_dt_init(struct device *dev, struct regmap *regmap)
 {
+       const struct of_device_id *of_id =
+                       of_match_device(imx_gpc_dt_ids, dev);
+       const struct imx_gpc_dt_data *of_id_data = of_id->data;
        struct imx_pm_domain *domain;
        int i, ret;
 
-       for (i = 0; i < 2; i++) {
+       for (i = 0; i < of_id_data->num_domains; i++) {
                domain = &imx_gpc_domains[i];
                domain->regmap = regmap;
                domain->ipg_rate_mhz = 66;
@@ -324,7 +327,7 @@ static int imx_gpc_old_dt_init(struct device *dev, struct regmap *regmap)
                }
        }
 
-       for (i = 0; i < 2; i++)
+       for (i = 0; i < of_id_data->num_domains; i++)
                pm_genpd_init(&imx_gpc_domains[i].base, NULL, false);
 
        if (IS_ENABLED(CONFIG_PM_GENERIC_DOMAINS)) {
@@ -337,7 +340,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 < of_id_data->num_domains; i++)
                pm_genpd_remove(&imx_gpc_domains[i].base);
        imx_pgc_put_clocks(&imx_gpc_domains[1]);
 clk_err:

Do you think it's ok?

Regards
Dong Aisheng

> > 
> > Cc: Lucas Stach <l.stach@pengutronix.de>
> > Cc: Shawn Guo <shawnguo@kernel.org>
> > Fixes: 721cabf6c660 ("soc: imx: move PGC handling to a new GPC driver")
> > Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
> > ---
> >  drivers/soc/imx/gpc.c | 6 ------
> >  1 file changed, 6 deletions(-)
> > 
> > diff --git a/drivers/soc/imx/gpc.c b/drivers/soc/imx/gpc.c
> > index ba6e7ab..c1d0e67 100644
> > --- a/drivers/soc/imx/gpc.c
> > +++ b/drivers/soc/imx/gpc.c
> > @@ -385,12 +385,6 @@ 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);
> >  		if (ret)
> >  			return ret;
> 
> 

  reply	other threads:[~2017-03-22 19:23 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-20  6:15 [PATCH 0/8] soc: imx: gpc: fixes and clean up Dong Aisheng
2017-03-20  6:15 ` [PATCH 1/8] soc: imx: gpc: fix gpc clk get error handling Dong Aisheng
2017-03-20  8:05   ` Shawn Guo
2017-03-22 18:33     ` Dong Aisheng
2017-03-22  6:38       ` Shawn Guo
2017-03-20  6:15 ` [PATCH 2/8] soc: imx: gpc: fix the wrong using of regmap cache Dong Aisheng
2017-03-20  9:38   ` Lucas Stach
2017-03-22 18:53     ` Dong Aisheng
2017-03-22  8:43       ` Lucas Stach
2017-03-20  6:15 ` [PATCH 3/8] soc: imx: gpc: fix domain_index sanity check issue Dong Aisheng
2017-03-20  9:40   ` Lucas Stach
2017-03-20  6:15 ` [PATCH 4/8] soc: imx: gpc: fix imx6sl gpc power domain regression Dong Aisheng
2017-03-20  9:26   ` Lucas Stach
2017-03-22 19:23     ` Dong Aisheng [this message]
2017-03-22  8:46       ` Lucas Stach
2017-03-23  0:47         ` Dong Aisheng
2017-03-20  6:15 ` [PATCH 5/8] soc: imx: gpc: fix comment when power up domain Dong Aisheng
2017-03-20  9:41   ` Lucas Stach
2017-03-20  6:15 ` [PATCH 6/8] soc: imx: gpc: keep PGC_X_CTRL name align with reference manual Dong Aisheng
2017-03-20  9:42   ` Lucas Stach
2017-03-20  6:15 ` [PATCH 7/8] dt-bindings: imx-gpc: correct the DOMAIN_INDEX using Dong Aisheng
2017-03-20  9:43   ` Lucas Stach
2017-03-20  6:15 ` [PATCH 8/8] soc: imx: gpc: remove unnecessary readable_reg callback Dong Aisheng
2017-03-20  9:43   ` Lucas Stach
2017-03-22 19:25     ` Dong Aisheng

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170322192356.GC16264@b29396-OptiPlex-7040 \
    --to=dongas86@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox