linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] soc: imx6qp: Use GENPD_FLAG_ALWAYS_ON for PU errata
@ 2018-07-13 10:01 Leonard Crestez
  2018-07-13 10:29 ` Lucas Stach
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Leonard Crestez @ 2018-07-13 10:01 UTC (permalink / raw)
  To: Shawn Guo, Lucas Stach, Ulf Hansson
  Cc: Rafael J. Wysocki, Fabio Estevam, Robin Gong, Anson Huang,
	Dong Aisheng, linux-pm, linux-arm-kernel, linux-kernel,
	linux-imx, kernel

This is functionally identical but simpler and slightly faster.

The PU domain is turned on at boot time and never turned off. In the
current implementation the pm core will repeatedly call power_off when
the domain is unused and get -EBUSY back. If the domain is marked as
"always on" instead the pm core won't even attempt to turn it off.

In theory on 6qp it is safe to turn PU off in suspend, however that is
best accomplished with a new core flag.

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

Previous discussion:
* https://lkml.org/lkml/2018/7/11/431
* https://lkml.org/lkml/2018/7/10/103

Attempt at turning PU off in suspend:
* https://lkml.org/lkml/2018/7/6/698

diff --git a/drivers/soc/imx/gpc.c b/drivers/soc/imx/gpc.c
index faf13a0b85d6..f31978e5af20 100644
--- a/drivers/soc/imx/gpc.c
+++ b/drivers/soc/imx/gpc.c
@@ -45,11 +45,10 @@ struct imx_pm_domain {
 	struct clk *clk[GPC_CLK_MAX];
 	int num_clks;
 	unsigned int reg_offs;
 	signed char cntr_pdn_bit;
 	unsigned int ipg_rate_mhz;
-	unsigned int flags;
 };
 
 static inline struct imx_pm_domain *
 to_imx_pm_domain(struct generic_pm_domain *genpd)
 {
@@ -60,13 +59,10 @@ static int imx6_pm_domain_power_off(struct generic_pm_domain *genpd)
 {
 	struct imx_pm_domain *pd = to_imx_pm_domain(genpd);
 	int iso, iso2sw;
 	u32 val;
 
-	if (pd->flags & PGC_DOMAIN_FLAG_NO_PD)
-		return -EBUSY;
-
 	/* Read ISO and ISO2SW power down delays */
 	regmap_read(pd->regmap, pd->reg_offs + GPC_PGC_PUPSCR_OFFS, &val);
 	iso = val & 0x3f;
 	iso2sw = (val >> 8) & 0x3f;
 
@@ -419,12 +415,12 @@ static int imx_gpc_probe(struct platform_device *pdev)
 		return ret;
 	}
 
 	/* 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;
+		imx_gpc_domains[GPC_PGC_DOMAIN_PU].base.flags |=
+				GENPD_FLAG_ALWAYS_ON;
 
 	/* 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;
-- 
2.17.1


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

* Re: [PATCH] soc: imx6qp: Use GENPD_FLAG_ALWAYS_ON for PU errata
  2018-07-13 10:01 [PATCH] soc: imx6qp: Use GENPD_FLAG_ALWAYS_ON for PU errata Leonard Crestez
@ 2018-07-13 10:29 ` Lucas Stach
  2018-07-13 11:21 ` Ulf Hansson
  2018-07-17  6:14 ` Shawn Guo
  2 siblings, 0 replies; 4+ messages in thread
From: Lucas Stach @ 2018-07-13 10:29 UTC (permalink / raw)
  To: Leonard Crestez, Shawn Guo, Ulf Hansson
  Cc: Rafael J. Wysocki, Fabio Estevam, Robin Gong, Anson Huang,
	Dong Aisheng, linux-pm, linux-arm-kernel, linux-kernel,
	linux-imx, kernel

Am Freitag, den 13.07.2018, 13:01 +0300 schrieb Leonard Crestez:
> This is functionally identical but simpler and slightly faster.
> 
> The PU domain is turned on at boot time and never turned off. In the
> current implementation the pm core will repeatedly call power_off when
> the domain is unused and get -EBUSY back. If the domain is marked as
> "always on" instead the pm core won't even attempt to turn it off.
> 
> In theory on 6qp it is safe to turn PU off in suspend, however that is
> best accomplished with a new core flag.
> 
> Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com>

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

> ---
>  drivers/soc/imx/gpc.c | 8 ++------
>  1 file changed, 2 insertions(+), 6 deletions(-)
> 
> Previous discussion:
> * https://lkml.org/lkml/2018/7/11/431
> * https://lkml.org/lkml/2018/7/10/103
> 
> Attempt at turning PU off in suspend:
> * https://lkml.org/lkml/2018/7/6/698
> 
> diff --git a/drivers/soc/imx/gpc.c b/drivers/soc/imx/gpc.c
> index faf13a0b85d6..f31978e5af20 100644
> --- a/drivers/soc/imx/gpc.c
> +++ b/drivers/soc/imx/gpc.c
> @@ -45,11 +45,10 @@ struct imx_pm_domain {
> >  	struct clk *clk[GPC_CLK_MAX];
> >  	int num_clks;
> >  	unsigned int reg_offs;
> >  	signed char cntr_pdn_bit;
> >  	unsigned int ipg_rate_mhz;
> > -	unsigned int flags;
>  };
>  
>  static inline struct imx_pm_domain *
>  to_imx_pm_domain(struct generic_pm_domain *genpd)
>  {
> @@ -60,13 +59,10 @@ static int imx6_pm_domain_power_off(struct generic_pm_domain *genpd)
>  {
> >  	struct imx_pm_domain *pd = to_imx_pm_domain(genpd);
> >  	int iso, iso2sw;
> >  	u32 val;
>  
> > -	if (pd->flags & PGC_DOMAIN_FLAG_NO_PD)
> > -		return -EBUSY;
> -
> >  	/* Read ISO and ISO2SW power down delays */
> >  	regmap_read(pd->regmap, pd->reg_offs + GPC_PGC_PUPSCR_OFFS, &val);
> >  	iso = val & 0x3f;
> >  	iso2sw = (val >> 8) & 0x3f;
>  
> @@ -419,12 +415,12 @@ static int imx_gpc_probe(struct platform_device *pdev)
> >  		return ret;
> >  	}
>  
> >  	/* 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;
> > +		imx_gpc_domains[GPC_PGC_DOMAIN_PU].base.flags |=
> > +				GENPD_FLAG_ALWAYS_ON;
>  
> >  	/* 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;

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

* Re: [PATCH] soc: imx6qp: Use GENPD_FLAG_ALWAYS_ON for PU errata
  2018-07-13 10:01 [PATCH] soc: imx6qp: Use GENPD_FLAG_ALWAYS_ON for PU errata Leonard Crestez
  2018-07-13 10:29 ` Lucas Stach
@ 2018-07-13 11:21 ` Ulf Hansson
  2018-07-17  6:14 ` Shawn Guo
  2 siblings, 0 replies; 4+ messages in thread
From: Ulf Hansson @ 2018-07-13 11:21 UTC (permalink / raw)
  To: Leonard Crestez
  Cc: Shawn Guo, Lucas Stach, Rafael J. Wysocki, Fabio Estevam,
	Robin Gong, Anson Huang, Dong Aisheng, Linux PM, Linux ARM,
	Linux Kernel Mailing List, dl-linux-imx, Sascha Hauer

On 13 July 2018 at 12:01, Leonard Crestez <leonard.crestez@nxp.com> wrote:
> This is functionally identical but simpler and slightly faster.
>
> The PU domain is turned on at boot time and never turned off. In the
> current implementation the pm core will repeatedly call power_off when
> the domain is unused and get -EBUSY back. If the domain is marked as
> "always on" instead the pm core won't even attempt to turn it off.
>
> In theory on 6qp it is safe to turn PU off in suspend, however that is
> best accomplished with a new core flag.
>
> 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 | 8 ++------
>  1 file changed, 2 insertions(+), 6 deletions(-)
>
> Previous discussion:
> * https://lkml.org/lkml/2018/7/11/431
> * https://lkml.org/lkml/2018/7/10/103
>
> Attempt at turning PU off in suspend:
> * https://lkml.org/lkml/2018/7/6/698
>
> diff --git a/drivers/soc/imx/gpc.c b/drivers/soc/imx/gpc.c
> index faf13a0b85d6..f31978e5af20 100644
> --- a/drivers/soc/imx/gpc.c
> +++ b/drivers/soc/imx/gpc.c
> @@ -45,11 +45,10 @@ struct imx_pm_domain {
>         struct clk *clk[GPC_CLK_MAX];
>         int num_clks;
>         unsigned int reg_offs;
>         signed char cntr_pdn_bit;
>         unsigned int ipg_rate_mhz;
> -       unsigned int flags;
>  };
>
>  static inline struct imx_pm_domain *
>  to_imx_pm_domain(struct generic_pm_domain *genpd)
>  {
> @@ -60,13 +59,10 @@ static int imx6_pm_domain_power_off(struct generic_pm_domain *genpd)
>  {
>         struct imx_pm_domain *pd = to_imx_pm_domain(genpd);
>         int iso, iso2sw;
>         u32 val;
>
> -       if (pd->flags & PGC_DOMAIN_FLAG_NO_PD)
> -               return -EBUSY;
> -
>         /* Read ISO and ISO2SW power down delays */
>         regmap_read(pd->regmap, pd->reg_offs + GPC_PGC_PUPSCR_OFFS, &val);
>         iso = val & 0x3f;
>         iso2sw = (val >> 8) & 0x3f;
>
> @@ -419,12 +415,12 @@ static int imx_gpc_probe(struct platform_device *pdev)
>                 return ret;
>         }
>
>         /* 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;
> +               imx_gpc_domains[GPC_PGC_DOMAIN_PU].base.flags |=
> +                               GENPD_FLAG_ALWAYS_ON;
>
>         /* 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;
> --
> 2.17.1
>

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

* Re: [PATCH] soc: imx6qp: Use GENPD_FLAG_ALWAYS_ON for PU errata
  2018-07-13 10:01 [PATCH] soc: imx6qp: Use GENPD_FLAG_ALWAYS_ON for PU errata Leonard Crestez
  2018-07-13 10:29 ` Lucas Stach
  2018-07-13 11:21 ` Ulf Hansson
@ 2018-07-17  6:14 ` Shawn Guo
  2 siblings, 0 replies; 4+ messages in thread
From: Shawn Guo @ 2018-07-17  6:14 UTC (permalink / raw)
  To: Leonard Crestez
  Cc: Lucas Stach, Ulf Hansson, Dong Aisheng, Anson Huang, linux-pm,
	Rafael J. Wysocki, linux-kernel, linux-imx, kernel,
	Fabio Estevam, Robin Gong, linux-arm-kernel

On Fri, Jul 13, 2018 at 01:01:15PM +0300, Leonard Crestez wrote:
> This is functionally identical but simpler and slightly faster.
> 
> The PU domain is turned on at boot time and never turned off. In the
> current implementation the pm core will repeatedly call power_off when
> the domain is unused and get -EBUSY back. If the domain is marked as
> "always on" instead the pm core won't even attempt to turn it off.
> 
> In theory on 6qp it is safe to turn PU off in suspend, however that is
> best accomplished with a new core flag.
> 
> Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com>

Applied all, thanks.

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

end of thread, other threads:[~2018-07-17  6:14 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-13 10:01 [PATCH] soc: imx6qp: Use GENPD_FLAG_ALWAYS_ON for PU errata Leonard Crestez
2018-07-13 10:29 ` Lucas Stach
2018-07-13 11:21 ` Ulf Hansson
2018-07-17  6:14 ` Shawn Guo

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).