[v3,1/2] soc: imx: gpc: Disable 6sl display power gating for ERR006287
diff mbox series

Message ID d694bc32feb1c9638485700ba53cd6e51bea495c.1531310547.git.leonard.crestez@nxp.com
State Accepted
Headers show
Series
  • Fix imx6sl display power domain
Related show

Commit Message

Leonard Crestez July 11, 2018, 12:11 p.m. UTC
The imx6sl chip errata document describes ERR006287 like this:

> Upon resuming from power gating, the modules in the display power domain
(eLCDIF, EPDC, PXP and SPDC) might fail to perform register reads
correctly.

> When the modules listed above are used, do not use power gating on the
display power domain.

Link: https://www.nxp.com/docs/en/errata/IMX6SLCE.pdf#page=62

Handle this in the safest possible way by keeping the DISP domain
always-on.

Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com>
---
 drivers/soc/imx/gpc.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

Comments

Lucas Stach July 11, 2018, 12:16 p.m. UTC | #1
Am Mittwoch, den 11.07.2018, 15:11 +0300 schrieb Leonard Crestez:
> The imx6sl chip errata document describes ERR006287 like this:
> 
> > Upon resuming from power gating, the modules in the display power domain
> 
> (eLCDIF, EPDC, PXP and SPDC) might fail to perform register reads
> correctly.
> 
> > When the modules listed above are used, do not use power gating on the
> 
> display power domain.
> 
> Link: https://www.nxp.com/docs/en/errata/IMX6SLCE.pdf#page=62
> 
> Handle this in the safest possible way by keeping the DISP domain
> always-on.
> 
> Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com>

Reviewed-by: Lucas Stach <l.stach@pengutronix.de>

Can you send a follow on patch to switch the i.MX6QP errata workaround
to use GENPD_FLAG_ALWAYS_ON and remove the -EBUSY stuff in the power
down path?

Regards,
Lucas

> ---
>  drivers/soc/imx/gpc.c | 10 ++++++++++
>  1 file changed, 10 insertions(+)
> 
> diff --git a/drivers/soc/imx/gpc.c b/drivers/soc/imx/gpc.c
> index 526f2d02dc78..f7960f773019 100644
> --- a/drivers/soc/imx/gpc.c
> +++ b/drivers/soc/imx/gpc.c
> @@ -339,30 +339,35 @@ static struct imx_pm_domain imx_gpc_domains[] = {
>  };
>  
>  struct imx_gpc_dt_data {
> >  	int num_domains;
> >  	bool err009619_present;
> > +	bool err006287_present;
>  };
>  
>  static const struct imx_gpc_dt_data imx6q_dt_data = {
> >  	.num_domains = 2,
> >  	.err009619_present = false,
> > +	.err006287_present = false,
>  };
>  
>  static const struct imx_gpc_dt_data imx6qp_dt_data = {
> >  	.num_domains = 2,
> >  	.err009619_present = true,
> > +	.err006287_present = false,
>  };
>  
>  static const struct imx_gpc_dt_data imx6sl_dt_data = {
> >  	.num_domains = 3,
> >  	.err009619_present = false,
> > +	.err006287_present = true,
>  };
>  
>  static const struct imx_gpc_dt_data imx6sx_dt_data = {
> >  	.num_domains = 4,
> >  	.err009619_present = false,
> > +	.err006287_present = false,
>  };
>  
>  static const struct of_device_id imx_gpc_dt_ids[] = {
> >  	{ .compatible = "fsl,imx6q-gpc", .data = &imx6q_dt_data },
> >  	{ .compatible = "fsl,imx6qp-gpc", .data = &imx6qp_dt_data },
> @@ -467,10 +472,15 @@ static int imx_gpc_probe(struct platform_device *pdev)
> >  	/* Disable PU power down in normal operation if ERR009619 is present */
> >  	if (of_id_data->err009619_present)
> >  		imx_gpc_domains[GPC_PGC_DOMAIN_PU].flags |=
> >  				PGC_DOMAIN_FLAG_NO_PD;
>  
> > +	/* Keep DISP always on if ERR006287 is present */
> > +	if (of_id_data->err006287_present)
> > +		imx_gpc_domains[GPC_PGC_DOMAIN_DISPLAY].base.flags |=
> > +				GENPD_FLAG_ALWAYS_ON;
> +
> >  	if (!pgc_node) {
> >  		ret = imx_gpc_old_dt_init(&pdev->dev, regmap,
> >  					  of_id_data->num_domains);
> >  		if (ret)
> >  			return ret;
Ulf Hansson July 11, 2018, 12:19 p.m. UTC | #2
On 11 July 2018 at 14:11, Leonard Crestez <leonard.crestez@nxp.com> wrote:
> The imx6sl chip errata document describes ERR006287 like this:
>
>> Upon resuming from power gating, the modules in the display power domain
> (eLCDIF, EPDC, PXP and SPDC) might fail to perform register reads
> correctly.
>
>> When the modules listed above are used, do not use power gating on the
> display power domain.
>
> Link: https://www.nxp.com/docs/en/errata/IMX6SLCE.pdf#page=62
>
> Handle this in the safest possible way by keeping the DISP domain
> always-on.
>
> Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com>

Reviewed-by: Ulf Hansson <ulf.hansson@linaro.org>

Kind regards
Uffe

> ---
>  drivers/soc/imx/gpc.c | 10 ++++++++++
>  1 file changed, 10 insertions(+)
>
> diff --git a/drivers/soc/imx/gpc.c b/drivers/soc/imx/gpc.c
> index 526f2d02dc78..f7960f773019 100644
> --- a/drivers/soc/imx/gpc.c
> +++ b/drivers/soc/imx/gpc.c
> @@ -339,30 +339,35 @@ static struct imx_pm_domain imx_gpc_domains[] = {
>  };
>
>  struct imx_gpc_dt_data {
>         int num_domains;
>         bool err009619_present;
> +       bool err006287_present;
>  };
>
>  static const struct imx_gpc_dt_data imx6q_dt_data = {
>         .num_domains = 2,
>         .err009619_present = false,
> +       .err006287_present = false,
>  };
>
>  static const struct imx_gpc_dt_data imx6qp_dt_data = {
>         .num_domains = 2,
>         .err009619_present = true,
> +       .err006287_present = false,
>  };
>
>  static const struct imx_gpc_dt_data imx6sl_dt_data = {
>         .num_domains = 3,
>         .err009619_present = false,
> +       .err006287_present = true,
>  };
>
>  static const struct imx_gpc_dt_data imx6sx_dt_data = {
>         .num_domains = 4,
>         .err009619_present = false,
> +       .err006287_present = false,
>  };
>
>  static const struct of_device_id imx_gpc_dt_ids[] = {
>         { .compatible = "fsl,imx6q-gpc", .data = &imx6q_dt_data },
>         { .compatible = "fsl,imx6qp-gpc", .data = &imx6qp_dt_data },
> @@ -467,10 +472,15 @@ static int imx_gpc_probe(struct platform_device *pdev)
>         /* Disable PU power down in normal operation if ERR009619 is present */
>         if (of_id_data->err009619_present)
>                 imx_gpc_domains[GPC_PGC_DOMAIN_PU].flags |=
>                                 PGC_DOMAIN_FLAG_NO_PD;
>
> +       /* Keep DISP always on if ERR006287 is present */
> +       if (of_id_data->err006287_present)
> +               imx_gpc_domains[GPC_PGC_DOMAIN_DISPLAY].base.flags |=
> +                               GENPD_FLAG_ALWAYS_ON;
> +
>         if (!pgc_node) {
>                 ret = imx_gpc_old_dt_init(&pdev->dev, regmap,
>                                           of_id_data->num_domains);
>                 if (ret)
>                         return ret;
> --
> 2.17.1
>
Leonard Crestez July 11, 2018, 12:21 p.m. UTC | #3
On Wed, 2018-07-11 at 14:16 +0200, Lucas Stach wrote:
> Am Mittwoch, den 11.07.2018, 15:11 +0300 schrieb Leonard Crestez:
> > Handle this in the safest possible way by keeping the DISP domain
> > always-on.
> > 
> > Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com>
> 
> Reviewed-by: Lucas Stach <l.stach@pengutronix.de>
> 
> Can you send a follow on patch to switch the i.MX6QP errata workaround
> to use GENPD_FLAG_ALWAYS_ON and remove the -EBUSY stuff in the power
> down path?

Sure.

I was thinking of converting it to a new GENPD_FLAG which allows
power_off in suspend (as suggested by Ulf) but switching to
GENPD_FLAG_ALWAYS_ON in order to simplify the code could be done first.

The -EBUSY stuff is not very harmful.

--
Regards,
Leonard
Lucas Stach July 11, 2018, 12:29 p.m. UTC | #4
Am Mittwoch, den 11.07.2018, 15:21 +0300 schrieb Leonard Crestez:
> On Wed, 2018-07-11 at 14:16 +0200, Lucas Stach wrote:
> > Am Mittwoch, den 11.07.2018, 15:11 +0300 schrieb Leonard Crestez:
> > > Handle this in the safest possible way by keeping the DISP domain
> > > always-on.
> > > 
> > > Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com>
> > 
> > Reviewed-by: Lucas Stach <l.stach@pengutronix.de>
> > 
> > Can you send a follow on patch to switch the i.MX6QP errata
> > workaround
> > to use GENPD_FLAG_ALWAYS_ON and remove the -EBUSY stuff in the
> > power
> > down path?
> 
> Sure.
> 
> I was thinking of converting it to a new GENPD_FLAG which allows
> power_off in suspend (as suggested by Ulf) but switching to
> GENPD_FLAG_ALWAYS_ON in order to simplify the code could be done
> first.

Sure, if you are going to work on this I'm fine with converting it over
to this without first going for GENPD_FLAG_ALWAYS_ON. Just wanted to
make sure that things are consistent.

> The -EBUSY stuff is not very harmful.

It's dead code once the appropriate flags have been added to the
domain, so should be removed.

Regards,
Lucas

Patch
diff mbox series

diff --git a/drivers/soc/imx/gpc.c b/drivers/soc/imx/gpc.c
index 526f2d02dc78..f7960f773019 100644
--- a/drivers/soc/imx/gpc.c
+++ b/drivers/soc/imx/gpc.c
@@ -339,30 +339,35 @@  static struct imx_pm_domain imx_gpc_domains[] = {
 };
 
 struct imx_gpc_dt_data {
 	int num_domains;
 	bool err009619_present;
+	bool err006287_present;
 };
 
 static const struct imx_gpc_dt_data imx6q_dt_data = {
 	.num_domains = 2,
 	.err009619_present = false,
+	.err006287_present = false,
 };
 
 static const struct imx_gpc_dt_data imx6qp_dt_data = {
 	.num_domains = 2,
 	.err009619_present = true,
+	.err006287_present = false,
 };
 
 static const struct imx_gpc_dt_data imx6sl_dt_data = {
 	.num_domains = 3,
 	.err009619_present = false,
+	.err006287_present = true,
 };
 
 static const struct imx_gpc_dt_data imx6sx_dt_data = {
 	.num_domains = 4,
 	.err009619_present = false,
+	.err006287_present = false,
 };
 
 static const struct of_device_id imx_gpc_dt_ids[] = {
 	{ .compatible = "fsl,imx6q-gpc", .data = &imx6q_dt_data },
 	{ .compatible = "fsl,imx6qp-gpc", .data = &imx6qp_dt_data },
@@ -467,10 +472,15 @@  static int imx_gpc_probe(struct platform_device *pdev)
 	/* Disable PU power down in normal operation if ERR009619 is present */
 	if (of_id_data->err009619_present)
 		imx_gpc_domains[GPC_PGC_DOMAIN_PU].flags |=
 				PGC_DOMAIN_FLAG_NO_PD;
 
+	/* Keep DISP always on if ERR006287 is present */
+	if (of_id_data->err006287_present)
+		imx_gpc_domains[GPC_PGC_DOMAIN_DISPLAY].base.flags |=
+				GENPD_FLAG_ALWAYS_ON;
+
 	if (!pgc_node) {
 		ret = imx_gpc_old_dt_init(&pdev->dev, regmap,
 					  of_id_data->num_domains);
 		if (ret)
 			return ret;