Skip to contentSkip to conversation

ARM: Exynos4: read initial state of power domain from hw registers

PATCH Superseded Marek Szyprowski 3 participants 5 messages Apr 6, 2012 – May 10, 2012

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ARM: Exynos4: read initial state of power domain from hw registers

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

---
 arch/arm/mach-exynos/pm_domains.c |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)
arch/arm/mach-exynos/pm_domains.c +5 -3
index 13b3068..b5b92e8 100644
@@ -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);
Signature · 1 line
1.7.1.569.g6f426
#1 lore raw

PATCH 1/1 ARM: Exynos4: read initial state of power domain from hw registers

Hello.

Quoted 1 line · Marek Szyprowski

Some bootloadered

Bootloaders?

Quoted 15 lines

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

---
  arch/arm/mach-exynos/pm_domains.c |    8 +++++---
  1 files changed, 5 insertions(+), 3 deletions(-)
arch/arm/mach-exynos/pm_domains.c +0 -0
index 13b3068..b5b92e8 100644

arch/arm/mach-exynos/pm_domains.c static __init int exynos4_pm_init_power_domain(void) · line 156

Quoted 9 lines
arch/arm/mach-exynos/pm_domains.c +3 -3
@@ -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.

arch/arm/mach-exynos/pm_domains.c static __init int exynos4_pm_init_power_domain(void) · line 158

Quoted 2 lines
arch/arm/mach-exynos/pm_domains.c +2 -0
+		pm_genpd_init(&pd->pd, NULL, !on);
+	}

WBR, Sergei

#2 lore raw

PATCH v2 1/1 ARM: Exynos4: read initial state of power domain from hw registers

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

---
 arch/arm/mach-exynos/pm_domains.c |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)
arch/arm/mach-exynos/pm_domains.c +6 -3
index 13b3068..26fc47d 100644
@@ -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);
Signature · 1 line
1.7.1.569.g6f426
#3 lore raw

PATCH v2 1/1 ARM: Exynos4: read initial state of power domain from hw registers

Quoted 33 lines · Marek Szyprowski

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

---
 arch/arm/mach-exynos/pm_domains.c |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)
arch/arm/mach- renamed from arch/arm/mach-exynos/pm_domains.c +0 -0

exynos/pm_domains.c
index 13b3068..26fc47d 100644

arch/arm/mach-exynos/pm_domains.c +6 -4
@@ -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);
--
Quoted 1 line

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 <[email protected]>, Senior Engineer, SW Solution Development Team, Samsung Electronics Co., Ltd.

#4 lore raw

PATCH v2 1/1 ARM: Exynos4: read initial state of power domain from hw registers

Hello,

Quoted 31 lines · Kukjin Kim
Quoted 30 lines · Marek Szyprowski

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

---
 arch/arm/mach-exynos/pm_domains.c |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)
arch/arm/mach- renamed from arch/arm/mach-exynos/pm_domains.c +0 -0

exynos/pm_domains.c
index 13b3068..26fc47d 100644

arch/arm/mach-exynos/pm_domains.c +6 -3
@@ -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);
+	}
 
Quoted 9 lines
Quoted 4 lines
arch/arm/mach-exynos/pm_domains.c +0 -1
 #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

Signature · 2 lines
Marek Szyprowski
Samsung Poland R&D Center