linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ARM: Exynos4: read initial state of power domain from hw registers
@ 2012-04-06  8:00 Marek Szyprowski
  2012-04-06 12:32 ` Sergei Shtylyov
  0 siblings, 1 reply; 5+ messages in thread
From: Marek Szyprowski @ 2012-04-06  8:00 UTC (permalink / raw)
  To: linux-arm-kernel

Some bootloadered disable unused power domains, so kernel code should
read the actual state from the hardware registers instead of assuming
that their initial state is 'on'.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
---
 arch/arm/mach-exynos/pm_domains.c |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/arch/arm/mach-exynos/pm_domains.c b/arch/arm/mach-exynos/pm_domains.c
index 13b3068..b5b92e8 100644
--- a/arch/arm/mach-exynos/pm_domains.c
+++ b/arch/arm/mach-exynos/pm_domains.c
@@ -151,9 +151,11 @@ static __init int exynos4_pm_init_power_domain(void)
 	if (of_have_populated_dt())
 		return exynos_pm_dt_parse_domains();
 
-	for (idx = 0; idx < ARRAY_SIZE(exynos4_pm_domains); idx++)
-		pm_genpd_init(&exynos4_pm_domains[idx]->pd, NULL,
-				exynos4_pm_domains[idx]->is_off);
+	for (idx = 0; idx < ARRAY_SIZE(exynos4_pm_domains); idx++) {
+		struct exynos_pm_domain *pd = exynos4_pm_domains[idx];
+		int on = __raw_readl(pd->base + 0x4) & S5P_INT_LOCAL_PWR_EN;
+		pm_genpd_init(&pd->pd, NULL, !on);
+	}
 
 #ifdef CONFIG_S5P_DEV_FIMD0
 	exynos_pm_add_dev_to_genpd(&s5p_device_fimd0, &exynos4_pd_lcd0);
-- 
1.7.1.569.g6f426

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

* [PATCH] ARM: Exynos4: read initial state of power domain from hw registers
  2012-04-06  8:00 [PATCH] ARM: Exynos4: read initial state of power domain from hw registers Marek Szyprowski
@ 2012-04-06 12:32 ` Sergei Shtylyov
  2012-04-10 12:39   ` [PATCH v2] " Marek Szyprowski
  0 siblings, 1 reply; 5+ messages in thread
From: Sergei Shtylyov @ 2012-04-06 12:32 UTC (permalink / raw)
  To: linux-arm-kernel

Hello.

On 06-04-2012 12:00, Marek Szyprowski wrote:

> Some bootloadered

    Bootloaders?

> disable unused power domains, so kernel code should
> read the actual state from the hardware registers instead of assuming
> that their initial state is 'on'.

> Signed-off-by: Marek Szyprowski<m.szyprowski@samsung.com>
> Signed-off-by: Kyungmin Park<kyungmin.park@samsung.com>
> ---
>   arch/arm/mach-exynos/pm_domains.c |    8 +++++---
>   1 files changed, 5 insertions(+), 3 deletions(-)

> diff --git a/arch/arm/mach-exynos/pm_domains.c b/arch/arm/mach-exynos/pm_domains.c
> index 13b3068..b5b92e8 100644
> --- a/arch/arm/mach-exynos/pm_domains.c
> +++ b/arch/arm/mach-exynos/pm_domains.c
> @@ -151,9 +151,11 @@ static __init int exynos4_pm_init_power_domain(void)
>   	if (of_have_populated_dt())
>   		return exynos_pm_dt_parse_domains();
>
> -	for (idx = 0; idx<  ARRAY_SIZE(exynos4_pm_domains); idx++)
> -		pm_genpd_init(&exynos4_pm_domains[idx]->pd, NULL,
> -				exynos4_pm_domains[idx]->is_off);
> +	for (idx = 0; idx<  ARRAY_SIZE(exynos4_pm_domains); idx++) {
> +		struct exynos_pm_domain *pd = exynos4_pm_domains[idx];
> +		int on = __raw_readl(pd->base + 0x4)&  S5P_INT_LOCAL_PWR_EN;

    Empty line wouldn't hurt here.

> +		pm_genpd_init(&pd->pd, NULL, !on);
> +	}

WBR, Sergei

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

* [PATCH v2] ARM: Exynos4: read initial state of power domain from hw registers
  2012-04-06 12:32 ` Sergei Shtylyov
@ 2012-04-10 12:39   ` Marek Szyprowski
  2012-05-10  9:09     ` Kukjin Kim
  0 siblings, 1 reply; 5+ messages in thread
From: Marek Szyprowski @ 2012-04-10 12:39 UTC (permalink / raw)
  To: linux-arm-kernel

Some bootloaders disable unused power domains, so kernel code should
read the actual state from the hardware registers instead of assuming
that their initial state is 'on'.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
---
 arch/arm/mach-exynos/pm_domains.c |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/arch/arm/mach-exynos/pm_domains.c b/arch/arm/mach-exynos/pm_domains.c
index 13b3068..26fc47d 100644
--- a/arch/arm/mach-exynos/pm_domains.c
+++ b/arch/arm/mach-exynos/pm_domains.c
@@ -151,9 +151,12 @@ static __init int exynos4_pm_init_power_domain(void)
 	if (of_have_populated_dt())
 		return exynos_pm_dt_parse_domains();
 
-	for (idx = 0; idx < ARRAY_SIZE(exynos4_pm_domains); idx++)
-		pm_genpd_init(&exynos4_pm_domains[idx]->pd, NULL,
-				exynos4_pm_domains[idx]->is_off);
+	for (idx = 0; idx < ARRAY_SIZE(exynos4_pm_domains); idx++) {
+		struct exynos_pm_domain *pd = exynos4_pm_domains[idx];
+		int on = __raw_readl(pd->base + 0x4) & S5P_INT_LOCAL_PWR_EN;
+
+		pm_genpd_init(&pd->pd, NULL, !on);
+	}
 
 #ifdef CONFIG_S5P_DEV_FIMD0
 	exynos_pm_add_dev_to_genpd(&s5p_device_fimd0, &exynos4_pd_lcd0);
-- 
1.7.1.569.g6f426

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

* [PATCH v2] ARM: Exynos4: read initial state of power domain from hw registers
  2012-04-10 12:39   ` [PATCH v2] " Marek Szyprowski
@ 2012-05-10  9:09     ` Kukjin Kim
  2012-05-10 12:06       ` Marek Szyprowski
  0 siblings, 1 reply; 5+ messages in thread
From: Kukjin Kim @ 2012-05-10  9:09 UTC (permalink / raw)
  To: linux-arm-kernel

Marek Szyprowski wrote:
> 
> Some bootloaders disable unused power domains, so kernel code should
> read the actual state from the hardware registers instead of assuming
> that their initial state is 'on'.
> 
> Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
> ---
>  arch/arm/mach-exynos/pm_domains.c |    9 ++++++---
>  1 files changed, 6 insertions(+), 3 deletions(-)
> 
> diff --git a/arch/arm/mach-exynos/pm_domains.c b/arch/arm/mach-
> exynos/pm_domains.c
> index 13b3068..26fc47d 100644
> --- a/arch/arm/mach-exynos/pm_domains.c
> +++ b/arch/arm/mach-exynos/pm_domains.c
> @@ -151,9 +151,12 @@ static __init int exynos4_pm_init_power_domain(void)
>  	if (of_have_populated_dt())
>  		return exynos_pm_dt_parse_domains();
> 
> -	for (idx = 0; idx < ARRAY_SIZE(exynos4_pm_domains); idx++)
> -		pm_genpd_init(&exynos4_pm_domains[idx]->pd, NULL,
> -				exynos4_pm_domains[idx]->is_off);
> +	for (idx = 0; idx < ARRAY_SIZE(exynos4_pm_domains); idx++) {
> +		struct exynos_pm_domain *pd = exynos4_pm_domains[idx];
> +		int on = __raw_readl(pd->base + 0x4) & S5P_INT_LOCAL_PWR_EN;
> +
> +		pm_genpd_init(&pd->pd, NULL, !on);
> +	}
> 
>  #ifdef CONFIG_S5P_DEV_FIMD0
>  	exynos_pm_add_dev_to_genpd(&s5p_device_fimd0, &exynos4_pd_lcd0);
> --
> 1.7.1.569.g6f426

As you said, if bootloader changed some hardware setting which is not
expected value in kernel, it should be notified to kernel. But for
pm_domaine->is_off, it should be via DT on EXYNOS now. As you know, the
functionality has been already implemented on dt.

Thanks.

Best regards,
Kgene.
--
Kukjin Kim <kgene.kim@samsung.com>, Senior Engineer,
SW Solution Development Team, Samsung Electronics Co., Ltd.

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

* [PATCH v2] ARM: Exynos4: read initial state of power domain from hw registers
  2012-05-10  9:09     ` Kukjin Kim
@ 2012-05-10 12:06       ` Marek Szyprowski
  0 siblings, 0 replies; 5+ messages in thread
From: Marek Szyprowski @ 2012-05-10 12:06 UTC (permalink / raw)
  To: linux-arm-kernel

Hello,

On Thursday, May 10, 2012 11:09 AM Kukjin Kim wrote:

> Marek Szyprowski wrote:
> >
> > Some bootloaders disable unused power domains, so kernel code should
> > read the actual state from the hardware registers instead of assuming
> > that their initial state is 'on'.
> >
> > Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
> > Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
> > ---
> >  arch/arm/mach-exynos/pm_domains.c |    9 ++++++---
> >  1 files changed, 6 insertions(+), 3 deletions(-)
> >
> > diff --git a/arch/arm/mach-exynos/pm_domains.c b/arch/arm/mach-
> > exynos/pm_domains.c
> > index 13b3068..26fc47d 100644
> > --- a/arch/arm/mach-exynos/pm_domains.c
> > +++ b/arch/arm/mach-exynos/pm_domains.c
> > @@ -151,9 +151,12 @@ static __init int exynos4_pm_init_power_domain(void)
> >  	if (of_have_populated_dt())
> >  		return exynos_pm_dt_parse_domains();
> >
> > -	for (idx = 0; idx < ARRAY_SIZE(exynos4_pm_domains); idx++)
> > -		pm_genpd_init(&exynos4_pm_domains[idx]->pd, NULL,
> > -				exynos4_pm_domains[idx]->is_off);
> > +	for (idx = 0; idx < ARRAY_SIZE(exynos4_pm_domains); idx++) {
> > +		struct exynos_pm_domain *pd = exynos4_pm_domains[idx];
> > +		int on = __raw_readl(pd->base + 0x4) & S5P_INT_LOCAL_PWR_EN;
> > +
> > +		pm_genpd_init(&pd->pd, NULL, !on);
> > +	}
> >
> >  #ifdef CONFIG_S5P_DEV_FIMD0
> >  	exynos_pm_add_dev_to_genpd(&s5p_device_fimd0, &exynos4_pd_lcd0);
> > --
> > 1.7.1.569.g6f426
> 
> As you said, if bootloader changed some hardware setting which is not
> expected value in kernel, it should be notified to kernel. But for
> pm_domaine->is_off, it should be via DT on EXYNOS now. As you know, the
> functionality has been already implemented on dt.

I really doubt that we need such complex interface to pass the information 
which the driver can simply read from the register...

Best regards
-- 
Marek Szyprowski
Samsung Poland R&D Center

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

end of thread, other threads:[~2012-05-10 12:06 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-04-06  8:00 [PATCH] ARM: Exynos4: read initial state of power domain from hw registers Marek Szyprowski
2012-04-06 12:32 ` Sergei Shtylyov
2012-04-10 12:39   ` [PATCH v2] " Marek Szyprowski
2012-05-10  9:09     ` Kukjin Kim
2012-05-10 12:06       ` Marek Szyprowski

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