linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/2] Fix imx6sl display power domain
@ 2018-07-09 12:23 Leonard Crestez
  2018-07-09 12:23 ` [PATCH v2 1/2] soc: imx: gpc: Disable 6sl display power gating for ERR006287 Leonard Crestez
  2018-07-09 12:23 ` [PATCH v2 2/2] ARM: dts: imx6sl: Convert gpc to new bindings Leonard Crestez
  0 siblings, 2 replies; 5+ messages in thread
From: Leonard Crestez @ 2018-07-09 12:23 UTC (permalink / raw)
  To: Lucas Stach, Shawn Guo, Fabio Estevam
  Cc: Robin Gong, Anson Huang, Dong Aisheng, linux-pm,
	linux-arm-kernel, linux-kernel, linux-imx, kernel

Right now the imx6sl display power domain is automatically shut down
during boot so lcd doesn't work at all. This has been broken for a while
with old gpc bindings, since nobody noticed fix by converting to new
bindings.

Link to v1: https://lkml.org/lkml/2018/6/5/689

There is also a nasty errata here, treat it like on 6qp.

Previous version included a patch to improve lcdif power management, but
since ERR006287 effectively disables runtime PM for display it is no
longer strictly required.

This doesn't depend on other GPC patches I sent either, it's an
unrelated fix.

Leonard Crestez (2):
  soc: imx: gpc: Disable 6sl display power gating for ERR006287
  ARM: dts: imx6sl: Convert gpc to new bindings

 arch/arm/boot/dts/imx6sl.dtsi | 36 +++++++++++++++++++++++++++++++----
 drivers/soc/imx/gpc.c         | 10 ++++++++++
 2 files changed, 42 insertions(+), 4 deletions(-)

-- 
2.17.1


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH v2 1/2] soc: imx: gpc: Disable 6sl display power gating for ERR006287
  2018-07-09 12:23 [PATCH v2 0/2] Fix imx6sl display power domain Leonard Crestez
@ 2018-07-09 12:23 ` Leonard Crestez
  2018-07-09 22:33   ` Ulf Hansson
  2018-07-09 12:23 ` [PATCH v2 2/2] ARM: dts: imx6sl: Convert gpc to new bindings Leonard Crestez
  1 sibling, 1 reply; 5+ messages in thread
From: Leonard Crestez @ 2018-07-09 12:23 UTC (permalink / raw)
  To: Lucas Stach, Shawn Guo, Fabio Estevam
  Cc: Robin Gong, Anson Huang, Dong Aisheng, linux-pm,
	linux-arm-kernel, linux-kernel, linux-imx, kernel

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 linux in the same way as imx6qp ERR009619: make the DISP
domain return -EBUSY on power_off.

Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com>
---
 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..6b726dada560 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;
 
+	/* Disable DISP power down in normal operation if ERR006287 is present */
+	if (of_id_data->err006287_present)
+		imx_gpc_domains[GPC_PGC_DOMAIN_DISPLAY].flags |=
+				PGC_DOMAIN_FLAG_NO_PD;
+
 	if (!pgc_node) {
 		ret = imx_gpc_old_dt_init(&pdev->dev, regmap,
 					  of_id_data->num_domains);
 		if (ret)
 			return ret;
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH v2 2/2] ARM: dts: imx6sl: Convert gpc to new bindings
  2018-07-09 12:23 [PATCH v2 0/2] Fix imx6sl display power domain Leonard Crestez
  2018-07-09 12:23 ` [PATCH v2 1/2] soc: imx: gpc: Disable 6sl display power gating for ERR006287 Leonard Crestez
@ 2018-07-09 12:23 ` Leonard Crestez
  1 sibling, 0 replies; 5+ messages in thread
From: Leonard Crestez @ 2018-07-09 12:23 UTC (permalink / raw)
  To: Lucas Stach, Shawn Guo, Fabio Estevam
  Cc: Robin Gong, Anson Huang, Dong Aisheng, linux-pm,
	linux-arm-kernel, linux-kernel, linux-imx, kernel

With old bindings imx_gpc_onecell_data always sets num_domains to 2 so
the DISPMIX domain can't actually be referenced. The pd is still defined
and pm core shuts it down as "unused" so display can't work.

Fix this by converting to new gpc bindings by adding pgc nodes and
referencing the newly-defined &pu_disp domain from &lcdif.

Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com>
---
 arch/arm/boot/dts/imx6sl.dtsi | 36 +++++++++++++++++++++++++++++++----
 1 file changed, 32 insertions(+), 4 deletions(-)

diff --git a/arch/arm/boot/dts/imx6sl.dtsi b/arch/arm/boot/dts/imx6sl.dtsi
index 994e48dc1df0..3aaa8d5d4804 100644
--- a/arch/arm/boot/dts/imx6sl.dtsi
+++ b/arch/arm/boot/dts/imx6sl.dtsi
@@ -678,14 +678,41 @@
 				reg = <0x020dc000 0x4000>;
 				interrupt-controller;
 				#interrupt-cells = <3>;
 				interrupts = <0 89 IRQ_TYPE_LEVEL_HIGH>;
 				interrupt-parent = <&intc>;
-				pu-supply = <&reg_pu>;
-				clocks = <&clks IMX6SL_CLK_GPU2D_OVG>,
-					 <&clks IMX6SL_CLK_GPU2D_PODF>;
-				#power-domain-cells = <1>;
+				clocks = <&clks IMX6SL_CLK_IPG>;
+				clock-names = "ipg";
+
+				pgc {
+					#address-cells = <1>;
+					#size-cells = <0>;
+
+					power-domain@0 {
+						reg = <0>;
+						#power-domain-cells = <0>;
+					};
+
+					pd_pu: power-domain@1 {
+						reg = <1>;
+						#power-domain-cells = <0>;
+						power-supply = <&reg_pu>;
+						clocks = <&clks IMX6SL_CLK_GPU2D_OVG>,
+						         <&clks IMX6SL_CLK_GPU2D_PODF>;
+					};
+
+					pd_disp: power-domain@2 {
+						reg = <2>;
+						#power-domain-cells = <0>;
+						clocks = <&clks IMX6SL_CLK_IPG>,
+							 <&clks IMX6SL_CLK_LCDIF_AXI>,
+							 <&clks IMX6SL_CLK_LCDIF_PIX>,
+							 <&clks IMX6SL_CLK_EPDC_AXI>,
+							 <&clks IMX6SL_CLK_EPDC_PIX>,
+							 <&clks IMX6SL_CLK_PXP_AXI>;
+					};
+				};
 			};
 
 			gpr: iomuxc-gpr@20e0000 {
 				compatible = "fsl,imx6sl-iomuxc-gpr",
 					     "fsl,imx6q-iomuxc-gpr", "syscon";
@@ -736,10 +763,11 @@
 				clocks = <&clks IMX6SL_CLK_LCDIF_PIX>,
 					 <&clks IMX6SL_CLK_LCDIF_AXI>,
 					 <&clks IMX6SL_CLK_DUMMY>;
 				clock-names = "pix", "axi", "disp_axi";
 				status = "disabled";
+				power-domains = <&pd_disp>;
 			};
 
 			dcp: dcp@20fc000 {
 				compatible = "fsl,imx6sl-dcp", "fsl,imx28-dcp";
 				reg = <0x020fc000 0x4000>;
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH v2 1/2] soc: imx: gpc: Disable 6sl display power gating for ERR006287
  2018-07-09 12:23 ` [PATCH v2 1/2] soc: imx: gpc: Disable 6sl display power gating for ERR006287 Leonard Crestez
@ 2018-07-09 22:33   ` Ulf Hansson
  2018-07-10 13:18     ` Leonard Crestez
  0 siblings, 1 reply; 5+ messages in thread
From: Ulf Hansson @ 2018-07-09 22:33 UTC (permalink / raw)
  To: Leonard Crestez
  Cc: Lucas Stach, Shawn Guo, Fabio Estevam, Robin Gong, Anson Huang,
	Dong Aisheng, Linux PM, Linux ARM, Linux Kernel Mailing List,
	dl-linux-imx, Sascha Hauer

On 9 July 2018 at 14:23, 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 linux in the same way as imx6qp ERR009619: make the DISP
> domain return -EBUSY on power_off.
>
> Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com>
> ---
>  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..6b726dada560 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;
>
> +       /* Disable DISP power down in normal operation if ERR006287 is present */
> +       if (of_id_data->err006287_present)
> +               imx_gpc_domains[GPC_PGC_DOMAIN_DISPLAY].flags |=
> +                               PGC_DOMAIN_FLAG_NO_PD;
> +

This looks like a use-case for an always powered on PM domain?

If that's the case, GENPD_FLAG_ALWAYS_ON does the trick, but more
efficient as it enables genpd to take a few shortcuts when trying to
power of a PM domain.

>         if (!pgc_node) {
>                 ret = imx_gpc_old_dt_init(&pdev->dev, regmap,
>                                           of_id_data->num_domains);
>                 if (ret)
>                         return ret;
> --
> 2.17.1
>

Kind regards
Uffe

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v2 1/2] soc: imx: gpc: Disable 6sl display power gating for ERR006287
  2018-07-09 22:33   ` Ulf Hansson
@ 2018-07-10 13:18     ` Leonard Crestez
  0 siblings, 0 replies; 5+ messages in thread
From: Leonard Crestez @ 2018-07-10 13:18 UTC (permalink / raw)
  To: ulf.hansson, l.stach, Anson Huang
  Cc: A.s. Dong, linux-kernel, dl-linux-imx, linux-pm, Fabio Estevam,
	shawnguo, linux-arm-kernel, Robin Gong, kernel

On Tue, 2018-07-10 at 00:33 +0200, Ulf Hansson wrote:
> On 9 July 2018 at 14:23, 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://emea01.safelinks.protection.outlook.com/?url=https%3A
> > %2F%2Fwww.nxp.com%2Fdocs%2Fen%2Ferrata%2FIMX6SLCE.pdf%23page%3D62&a
> > mp;data=02%7C01%7Cleonard.crestez%40nxp.com%7Cdbc5b00a97c548c470320
> > 8d5e5ebfb24%7C686ea1d3bc2b4c6fa92cd99c5c301635%7C0%7C1%7C6366677240
> > 50833256&amp;sdata=VgYIGGTYQ0ChR%2FCEBSZJ1D1JyfJRDi96YHa%2Byt4Qr5s%
> > 3D&amp;reserved=0
> > 
> > Handle this in linux in the same way as imx6qp ERR009619: make the
> > DISP
> > domain return -EBUSY on power_off.
> > 
> > Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com>
> > ---
> >  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..6b726dada560 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;
> > 
> > +       /* Disable DISP power down in normal operation if ERR006287
> > is present */
> > +       if (of_id_data->err006287_present)
> > +               imx_gpc_domains[GPC_PGC_DOMAIN_DISPLAY].flags |=
> > +                               PGC_DOMAIN_FLAG_NO_PD;
> > +
> 
> This looks like a use-case for an always powered on PM domain?
> 
> If that's the case, GENPD_FLAG_ALWAYS_ON does the trick, but more
> efficient as it enables genpd to take a few shortcuts when trying to
> power of a PM domain.

GENPD_FLAG_ALWAYS_ON would be a reasonable here.

I searched but I've been unable to find a good reference for scenarios
where power gating DISP on 6sl is still supported. I think it should be
safe to turn off in suspend but this is only based based on old commits
from the imx internal tree.

Right now displays on imx6sl don't work at all because nothing is
inside the DISP and it gets powered off. Fixing this in the safest and
most uncontroversial way would be worthwhile, yes?

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2018-07-10 13:18 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-09 12:23 [PATCH v2 0/2] Fix imx6sl display power domain Leonard Crestez
2018-07-09 12:23 ` [PATCH v2 1/2] soc: imx: gpc: Disable 6sl display power gating for ERR006287 Leonard Crestez
2018-07-09 22:33   ` Ulf Hansson
2018-07-10 13:18     ` Leonard Crestez
2018-07-09 12:23 ` [PATCH v2 2/2] ARM: dts: imx6sl: Convert gpc to new bindings Leonard Crestez

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).