soc: imx: gpc: fix PDN delay & improve readability
PATCH 1/1 soc: imx: gpc: fix PDN delay & improve readability
- imx6_pm_domain_power_off(): reads iso and iso2sw from GPC_PGC_PUPSCR_OFFS which stores the power up delays => use GPC_PGC_PDNSCR_OFFS for the correct delays
- remove unused #defines
- struct imx_pm_domain: introduce cntr_pup_bit
to replace usage of cntr_pdn_bit+1 in imx6_pm_domain_power_on()
- GPC_PGC_DOMAIN_*: made consistent use of index defines
--- drivers/soc/imx/gpc.c | 41 ++++++++++++++++++++--------------------- 1 file changed, 20 insertions(+), 21 deletions(-)
drivers/soc/imx/gpc.c +20 -21
@@ -24,15 +24,6 @@#define GPC_PGC_CTRL_OFFS 0x0#define GPC_PGC_PUPSCR_OFFS 0x4#define GPC_PGC_PDNSCR_OFFS 0x8 -#define GPC_PGC_SW2ISO_SHIFT 0x8 -#define GPC_PGC_SW_SHIFT 0x0 - -#define GPC_PGC_GPU_PDN 0x260 -#define GPC_PGC_GPU_PUPSCR 0x264 -#define GPC_PGC_GPU_PDNSCR 0x268 - -#define GPU_VPU_PUP_REQ BIT(1) -#define GPU_VPU_PDN_REQ BIT(0)#define GPC_CLK_MAX 6
@@ -46,6 +37,7 @@ struct imx_pm_domain {int num_clks;unsigned int reg_offs;signed char cntr_pdn_bit; +signed char cntr_pup_bit;unsigned int ipg_rate_mhz;unsigned int flags; };
@@ -66,7 +58,7 @@ static int imx6_pm_domain_power_off(struct generic_pm_domain *genpd)return -EBUSY ;/* Read ISO and ISO2SW power down delays */ -regmap_read (pd->regmap, pd->reg_offs +GPC_PGC_PUPSCR_OFFS , &val); +regmap_read (pd->regmap, pd->reg_offs +GPC_PGC_PDNSCR_OFFS , &val); iso = val &0x3f ; iso2sw = (val >>8 ) &0x3f ;
@@ -116,7 +108,7 @@ static int imx6_pm_domain_power_on(struct generic_pm_domain *genpd) sw2iso = (val >>8 ) &0x3f ;/* Request GPC to power up domain */ - val =BIT (pd->cntr_pdn_bit +1 ); + val =BIT (pd->cntr_pup_bit);regmap_update_bits (pd->regmap,GPC_CNTR , val, val);/* Wait ISO + ISO2SW IPG clock cycles */
@@ -241,22 +233,24 @@ static struct platform_driver imx_pgc_power_domain_driver = { };builtin_platform_driver (imx_pgc_power_domain_driver) -#define GPC_PGC_DOMAIN_ARM 0 -#define GPC_PGC_DOMAIN_PU 1 -#define GPC_PGC_DOMAIN_DISPLAY 2 - static struct genpd_power_state imx6_pm_domain_pu_state = { .power_off_latency_ns =25000 , .power_on_latency_ns =2000000 , }; +#define GPC_PGC_DOMAIN_ARM 0 +#define GPC_PGC_DOMAIN_PU 1 +#define GPC_PGC_DOMAIN_DISPLAY 2 +#define GPC_PGC_DOMAIN_PCI 3 + static struct imx_pm_domain imx_gpc_domains[] = { - { + [GPC_PGC_DOMAIN_ARM] { .base = { .name = "ARM", .flags = GENPD_FLAG_ALWAYS_ON, }, - }, { + }, + [GPC_PGC_DOMAIN_PU] { .base = { .name = "PU", .power_off = imx6_pm_domain_power_off,
@@ -266,7 +260,9 @@ static struct imx_pm_domain imx_gpc_domains[] = { }, .reg_offs = 0x260, .cntr_pdn_bit = 0, - }, { + .cntr_pup_bit = 1, + }, + [GPC_PGC_DOMAIN_DISPLAY] { .base = { .name = "DISPLAY", .power_off = imx6_pm_domain_power_off,
@@ -274,7 +270,9 @@ static struct imx_pm_domain imx_gpc_domains[] = { }, .reg_offs = 0x240, .cntr_pdn_bit = 4, - }, { + .cntr_pup_bit = 5, + }, + [GPC_PGC_DOMAIN_PCI] { .base = { .name = "PCI", .power_off = imx6_pm_domain_power_off,
@@ -282,6 +280,7 @@ static struct imx_pm_domain imx_gpc_domains[] = { }, .reg_offs = 0x200, .cntr_pdn_bit = 6, + .cntr_pup_bit = 7, }, };
@@ -326,8 +325,8 @@ static const struct regmap_config imx_gpc_regmap_config = { };static struct generic_pm_domain *imx_gpc_onecell_domains[] = { - &imx_gpc_domains[0 ].base, - &imx_gpc_domains[1 ].base, + &imx_gpc_domains[GPC_PGC_DOMAIN_ARM ].base, + &imx_gpc_domains[GPC_PGC_DOMAIN_PU ].base, };static struct genpd_onecell_data imx_gpc_onecell_data = {
Signature · 1 line
2.17.1
PATCH 1/1 soc: imx: gpc: fix PDN delay & improve readability
Am Montag, den 18.06.2018, 09:01 +0000 schrieb Sven Schmitt:
Quoted 8 lines
-
imx6_pm_domain_power_off(): reads iso and iso2sw ? fromGPC_PGC_PUPSCR_OFFSwhich stores the power up delays ? => useGPC_PGC_PDNSCR_OFFSfor the correct delays- remove unused #defines
- struct
imx_pm_domain: introducecntr_pup_bit
? to replace usage of cntr_pdn_bit+1 inimx6_pm_domain_power_on()
I'm not sure I see the value in that one.
Otherwise this change looks fine.
Regards,
Lucas
Quoted 132 lines
- GPC_PGC_DOMAIN_*: made consistent use of index defines
Signed-off-by Sven Schmitt <[email protected]>---
?drivers/soc/imx/gpc.c | 41 ++++++++++++++++++++--------------------- ?1 file changed, 20 insertions(+), 21 deletions(-)drivers/soc/imx/gpc.c +0
-0@@ -24,15 +24,6 @@?#define
GPC_PGC_CTRL_OFFS0x0
?#defineGPC_PGC_PUPSCR_OFFS0x4
?#defineGPC_PGC_PDNSCR_OFFS0x8drivers/soc/imx/gpc.c +0
-9-#define GPC_PGC_SW2ISO_SHIFT 0x8 -#define GPC_PGC_SW_SHIFT 0x0 - -#define GPC_PGC_GPU_PDN 0x260 -#define GPC_PGC_GPU_PUPSCR 0x264 -#define GPC_PGC_GPU_PDNSCR 0x268 - -#define GPU_VPU_PUP_REQ BIT(1) -#define GPU_VPU_PDN_REQ BIT(0)?
?#defineGPC_CLK_MAX6
?drivers/soc/imx/gpc.c +1
-0@@ -46,6 +37,7 @@ struct imx_pm_domain { ? int num_clks; ? unsigned int reg_offs; ? signed char cntr_pdn_bit; +signed char cntr_pup_bit; ? unsigned int ipg_rate_mhz; ? unsigned int flags; ?};@@ -66,7 +58,7 @@ static int imx6_pm_domain_power_off(struct generic_pm_domain *genpd) ? return -EBUSY;?
? /* Read ISO and ISO2SW power down delays */drivers/soc/imx/gpc.c +0
-1- regmap_read(pd->regmap, pd->reg_offs + GPC_PGC_PUPSCR_OFFS,&val);
drivers/soc/imx/gpc.c +1
-0+ regmap_read(pd->regmap, pd->reg_offs + GPC_PGC_PDNSCR_OFFS,&val);
? iso = val &0x3f;
? iso2sw = (val >> 8) &0x3f;
?drivers/soc/imx/gpc.c +0
-0@@ -116,7 +108,7 @@ static int imx6_pm_domain_power_on(struct generic_pm_domain *genpd) ? sw2iso = (val >> 8) & 0x3f;?
? /* Request GPC to power up domain */drivers/soc/imx/gpc.c +1
-1- val =BIT (pd->cntr_pdn_bit +1 ); + val =BIT (pd->cntr_pup_bit);?
regmap_update_bits(pd->regmap, GPC_CNTR, val, val);
?
? /* Wait ISO + ISO2SW IPG clock cycles */drivers/soc/imx/gpc.c +0
-0@@ -241,22 +233,24 @@ static struct platform_driver imx_pgc_power_domain_driver = { ?}; ?builtin_platform_driver(imx_pgc_power_domain_driver)?
drivers/soc/imx/gpc.c +0
-4-#define GPC_PGC_DOMAIN_ARM 0 -#define GPC_PGC_DOMAIN_PU 1 -#define GPC_PGC_DOMAIN_DISPLAY 2 -?static struct
genpd_power_stateimx6_pm_domain_pu_state= {
? .power_off_latency_ns = 25000,
? .power_on_latency_ns = 2000000,
?};
?drivers/soc/imx/gpc.c +5
-0+#define GPC_PGC_DOMAIN_ARM 0 +#define GPC_PGC_DOMAIN_PU 1 +#define GPC_PGC_DOMAIN_DISPLAY 2 +#define GPC_PGC_DOMAIN_PCI 3 +?static struct
imx_pm_domainimx_gpc_domains[] = {drivers/soc/imx/gpc.c +1
-1- { + [GPC_PGC_DOMAIN_ARM ] {? .base = {
? .name = "ARM",
? .flags =GENPD_FLAG_ALWAYS_ON,
? },drivers/soc/imx/gpc.c +2
-1- }, { + }, + [GPC_PGC_DOMAIN_PU ] {? .base = {
? .name = "PU",
? .power_off =imx6_pm_domain_power_off,drivers/soc/imx/gpc.c +7
-2@@ -266,7 +260,9 @@ static struct imx_pm_domain imx_gpc_domains[] = { ? }, ? .reg_offs = 0x260, ? .cntr_pdn_bit = 0, - }, { + .cntr_pup_bit = 1, + }, + [GPC_PGC_DOMAIN_DISPLAY] { ? .base = { ? .name = "DISPLAY", ? .power_off = imx6_pm_domain_power_off,@@ -274,7 +270,9 @@ static struct imx_pm_domain imx_gpc_domains[] = { ? }, ? .reg_offs = 0x240, ? .cntr_pdn_bit = 4, - }, { + .cntr_pup_bit = 5, + }, + [GPC_PGC_DOMAIN_PCI] { ? .base = { ? .name = "PCI", ? .power_off = imx6_pm_domain_power_off,@@ -282,6 +280,7 @@ static struct imx_pm_domain imx_gpc_domains[] = { ? }, ? .reg_offs = 0x200, ? .cntr_pdn_bit = 6, + .cntr_pup_bit = 7, ? }, ?};?
drivers/soc/imx/gpc.c +0
-0@@ -326,8 +325,8 @@ static const struct regmap_config imx_gpc_regmap_config = { ?};?
?static structgeneric_pm_domain*imx_gpc_onecell_domains[] = {drivers/soc/imx/gpc.c +2
-2- &imx_gpc_domains[0 ].base, - &imx_gpc_domains[1].base, + &imx_gpc_domains[GPC_PGC_DOMAIN_ARM ].base, + &imx_gpc_domains[GPC_PGC_DOMAIN_PU].base,?};
?
?static structgenpd_onecell_dataimx_gpc_onecell_data= {
PATCH v2 1/1 soc: imx: gpc: fix PDN delay & improve readability
- imx6_pm_domain_power_off(): reads iso and iso2sw from GPC_PGC_PUPSCR_OFFS which stores the power up delays => use GPC_PGC_PDNSCR_OFFS for the correct delays
- remove unused #defines
- GPC_PGC_DOMAIN_*: made consistent use of index defines
---
Changes in v2:
* dropped cntr_pup_bit
drivers/soc/imx/gpc.c | 35 +++++++++++++++-------------------- 1 file changed, 15 insertions(+), 20 deletions(-)
drivers/soc/imx/gpc.c +15 -20
@@ -24,15 +24,6 @@#define GPC_PGC_CTRL_OFFS 0x0#define GPC_PGC_PUPSCR_OFFS 0x4#define GPC_PGC_PDNSCR_OFFS 0x8 -#define GPC_PGC_SW2ISO_SHIFT 0x8 -#define GPC_PGC_SW_SHIFT 0x0 - -#define GPC_PGC_GPU_PDN 0x260 -#define GPC_PGC_GPU_PUPSCR 0x264 -#define GPC_PGC_GPU_PDNSCR 0x268 - -#define GPU_VPU_PUP_REQ BIT(1) -#define GPU_VPU_PDN_REQ BIT(0)#define GPC_CLK_MAX 6
@@ -66,7 +57,7 @@ static int imx6_pm_domain_power_off(struct generic_pm_domain *genpd)return -EBUSY ;/* Read ISO and ISO2SW power down delays */ -regmap_read (pd->regmap, pd->reg_offs +GPC_PGC_PUPSCR_OFFS , &val); +regmap_read (pd->regmap, pd->reg_offs +GPC_PGC_PDNSCR_OFFS , &val); iso = val &0x3f ; iso2sw = (val >>8 ) &0x3f ;
@@ -241,22 +232,24 @@ static struct platform_driver imx_pgc_power_domain_driver = { };builtin_platform_driver (imx_pgc_power_domain_driver) -#define GPC_PGC_DOMAIN_ARM 0 -#define GPC_PGC_DOMAIN_PU 1 -#define GPC_PGC_DOMAIN_DISPLAY 2 - static struct genpd_power_state imx6_pm_domain_pu_state = { .power_off_latency_ns =25000 , .power_on_latency_ns =2000000 , }; +#define GPC_PGC_DOMAIN_ARM 0 +#define GPC_PGC_DOMAIN_PU 1 +#define GPC_PGC_DOMAIN_DISPLAY 2 +#define GPC_PGC_DOMAIN_PCI 3 + static struct imx_pm_domain imx_gpc_domains[] = { - { + [GPC_PGC_DOMAIN_ARM] { .base = { .name = "ARM", .flags = GENPD_FLAG_ALWAYS_ON, }, - }, { + }, + [GPC_PGC_DOMAIN_PU] { .base = { .name = "PU", .power_off = imx6_pm_domain_power_off,
@@ -266,7 +259,8 @@ static struct imx_pm_domain imx_gpc_domains[] = { }, .reg_offs = 0x260, .cntr_pdn_bit = 0, - }, { + }, + [GPC_PGC_DOMAIN_DISPLAY] { .base = { .name = "DISPLAY", .power_off = imx6_pm_domain_power_off,
@@ -274,7 +268,8 @@ static struct imx_pm_domain imx_gpc_domains[] = { }, .reg_offs = 0x240, .cntr_pdn_bit = 4, - }, { + }, + [GPC_PGC_DOMAIN_PCI] { .base = { .name = "PCI", .power_off = imx6_pm_domain_power_off,
@@ -326,8 +321,8 @@ static const struct regmap_config imx_gpc_regmap_config = { };static struct generic_pm_domain *imx_gpc_onecell_domains[] = { - &imx_gpc_domains[0 ].base, - &imx_gpc_domains[1 ].base, + &imx_gpc_domains[GPC_PGC_DOMAIN_ARM ].base, + &imx_gpc_domains[GPC_PGC_DOMAIN_PU ].base, };static struct genpd_onecell_data imx_gpc_onecell_data = {
Signature · 1 line
2.17.1
PATCH v2 1/1 soc: imx: gpc: fix PDN delay & improve readability
Am Montag, den 18.06.2018, 10:11 +0000 schrieb Sven Schmitt:
Quoted 9 lines
-
imx6_pm_domain_power_off(): reads iso and iso2sw ? fromGPC_PGC_PUPSCR_OFFSwhich stores the power up delays ? => useGPC_PGC_PDNSCR_OFFSfor the correct delays- remove unused #defines
- GPC_PGC_DOMAIN_*: made consistent use of index defines
Signed-off-by Sven Schmitt <[email protected]>
Quoted 98 lines
---
Changes in v2:
* droppedcntr_pup_bit?drivers/soc/imx/gpc.c | 35 +++++++++++++++-------------------- ?1 file changed, 15 insertions(+), 20 deletions(-)
drivers/soc/imx/gpc.c +0
-0@@ -24,15 +24,6 @@drivers/soc/imx/gpc.c line 28
Quoted 5 lines
?#define
GPC_PGC_CTRL_OFFS0x0
?#defineGPC_PGC_PUPSCR_OFFS0x4
?#defineGPC_PGC_PDNSCR_OFFS0x8drivers/soc/imx/gpc.c +0
-2-#define GPC_PGC_SW2ISO_SHIFT 0x8 -#define GPC_PGC_SW_SHIFT 0x0-
drivers/soc/imx/gpc.c line 32
Quoted 3 lines
drivers/soc/imx/gpc.c +0
-3-#define GPC_PGC_GPU_PDN 0x260 -#define GPC_PGC_GPU_PUPSCR 0x264 -#define GPC_PGC_GPU_PDNSCR 0x268-
drivers/soc/imx/gpc.c line 35
Quoted 2 lines
drivers/soc/imx/gpc.c +0
-2-#define GPU_VPU_PUP_REQ BIT(1) -#define GPU_VPU_PDN_REQ BIT(0)?
Quoted 1 line
?#define
GPC_CLK_MAX6?
drivers/soc/imx/gpc.c +0
-0@@ -66,7 +57,7 @@ static int imx6_pm_domain_power_off(struct generic_pm_domain *genpd) > ? return -EBUSY;?
Quoted 5 lines
? /* Read ISO and ISO2SW power down delays */
drivers/soc/imx/gpc.c +1
-1-regmap_read (pd->regmap, pd->reg_offs +GPC_PGC_PUPSCR_OFFS , &val); +regmap_read (pd->regmap, pd->reg_offs +GPC_PGC_PDNSCR_OFFS , &val);? iso = val &
0x3f;
? iso2sw = (val >> 8) &0x3f;?
drivers/soc/imx/gpc.c +0
-0@@ -241,22 +232,24 @@ static struct platform_driver imx_pgc_power_domain_driver = { ?}; ?builtin_platform_driver(imx_pgc_power_domain_driver)?
drivers/soc/imx/gpc.c static struct platform_driver imx_pgc_power_domain_driver = { · line 246
Quoted 3 lines
drivers/soc/imx/gpc.c +0
-3-#define GPC_PGC_DOMAIN_ARM 0 -#define GPC_PGC_DOMAIN_PU 1 -#define GPC_PGC_DOMAIN_DISPLAY 2-
?static structgenpd_power_stateimx6_pm_domain_pu_state= {Quoted 2 lines
? .power_off_latency_ns = 25000,
? .power_on_latency_ns = 2000000,?};
?drivers/soc/imx/gpc.c +5
-0+#define GPC_PGC_DOMAIN_ARM 0 +#define GPC_PGC_DOMAIN_PU 1 +#define GPC_PGC_DOMAIN_DISPLAY 2 +#define GPC_PGC_DOMAIN_PCI 3 +?static struct
imx_pm_domainimx_gpc_domains[] = {Quoted 12 lines
drivers/soc/imx/gpc.c +1
-1- { + [GPC_PGC_DOMAIN_ARM ] {? .base = {
? .name = "ARM",
? .flags =GENPD_FLAG_ALWAYS_ON,
? },drivers/soc/imx/gpc.c +2
-1- }, { + }, + [GPC_PGC_DOMAIN_PU ] {? .base = {
? .name = "PU",
? .power_off =imx6_pm_domain_power_off,drivers/soc/imx/gpc.c +0
-0@@ -266,7 +259,8 @@ static struct imx_pm_domain imx_gpc_domains[] = { > ? }, > ? .reg_offs = 0x260, > ? .cntr_pdn_bit = 0, > - }, { > + }, > + [GPC_PGC_DOMAIN_DISPLAY] { > ? .base = {Quoted 2 lines
? .name = "DISPLAY",
? .power_off =imx6_pm_domain_power_off,drivers/soc/imx/gpc.c +0
-0@@ -274,7 +268,8 @@ static struct imx_pm_domain imx_gpc_domains[] = { > ? }, > ? .reg_offs = 0x240, > ? .cntr_pdn_bit = 4, > - }, { > + }, > + [GPC_PGC_DOMAIN_PCI] { > ? .base = {Quoted 2 lines
? .name = "PCI",
? .power_off =imx6_pm_domain_power_off,drivers/soc/imx/gpc.c +0
-0@@ -326,8 +321,8 @@ static const struct regmap_config imx_gpc_regmap_config = { ?};?
?static structgeneric_pm_domain*imx_gpc_onecell_domains[] = {drivers/soc/imx/gpc.c static const struct regmap_config imx_gpc_regmap_config = { · line 325
Quoted 4 lines
drivers/soc/imx/gpc.c +2
-2- &imx_gpc_domains[0 ].base, - &imx_gpc_domains[1].base, + &imx_gpc_domains[GPC_PGC_DOMAIN_ARM ].base, + &imx_gpc_domains[GPC_PGC_DOMAIN_PU].base,?};
?
?static structgenpd_onecell_dataimx_gpc_onecell_data= {
Fabio Estevam
reviewerPATCH v2 1/1 soc: imx: gpc: fix PDN delay & improve readability
In reply to Sven SchmittHi Sven,
Quoted 9 lines · Sven Schmitt
-
imx6_pm_domain_power_off(): reads iso and iso2sw fromGPC_PGC_PUPSCR_OFFSwhich stores the power up delays => useGPC_PGC_PDNSCR_OFFSfor the correct delays- remove unused #defines
- GPC_PGC_DOMAIN_*: made consistent use of index defines
Signed-off-by Sven Schmitt <[email protected]>
It seems you missed to send it to Shawn Guo, who is the imx maintainer.
Please run ./scripts/get_maintainer.pl 0001-your.patch and resend it to these folks.
Thanks
Hi Fabio,
Quoted 10 lines
Hi Sven,
Quoted 6 lines · Sven Schmitt
-
imx6_pm_domain_power_off(): reads iso and iso2sw fromGPC_PGC_PUPSCR_OFFSwhich stores the power up delays => useGPC_PGC_PDNSCR_OFFSfor the correct delays- remove unused #defines
Quoted 8 lines
Quoted 3 lines
- GPC_PGC_DOMAIN_*: made consistent use of index defines
Signed-off-by Sven Schmitt <[email protected]>It seems you missed to send it to Shawn Guo, who is the imx maintainer.
Please run
./scripts/get_maintainer.pl0001-your.patch and resend it to these folks.
Thanks for the hint. I will resend the patch.
Best regards
Sven