devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 RESEND 0/4] arm64: Hi6220: enable CPU idle states
@ 2016-01-21 10:53 Leo Yan
  2016-01-21 10:53 ` [PATCH v2 RESEND 1/4] arm64: dts: Reserve memory regions for hi6220 Leo Yan
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Leo Yan @ 2016-01-21 10:53 UTC (permalink / raw)
  To: Catalin Marinas, Will Deacon, Rob Herring, Pawel Moll,
	Mark Rutland, Ian Campbell, Kumar Gala, Greg Kroah-Hartman,
	Leo Yan, Yiping Xu, Yu Dongbin, Haojian Zhuang, Chen Feng,
	Tyler Baker, Bintian Wang, Sudeep Holla, Wei Xu, linux-arm-kernel,
	linux-kernel, devicetree

This patch series is to enable CPU idle states for Hi6220.

Hi6220 uses PSCIv0.2 compliance interface, so directly use ARM's generic
CPUIdle driver. Patch 1 is to reserve memory regions so make sure MCU can
work well to handle power controlling; Patch 2/3 enable sp804 timer as
broadcast timer during idle states; Patch 4 registers CPU power down state
and cluster power down state.

Patch 1 "arm64: dts: Reserve memory regions for hi6220" reserves memory
regions by carve out from memory node; This follows up Mark Rutland's
suggestion to avoid risks, such like kernel's linear mapping for reserved
secure memory region may introduce speculative accesses triggering aborts
from trustzone controller (TZC) and potential cache alias problem.

Rob Herring expressed reservations for this method and says "regions should
be marked as reserved, it's not really worth holding up this platform
further", so appreciate Rob helped to make progress for this series.

The resend patch series have been rebased on mainline kernel, and tested on
Hikey board. During testing I found CPUIdle menu governor is broken, this
bug has been reported by Sudeep; Rafael J. Wysocki already has committed
patch [1] to fix this issue. Testing pass after applied Rafael's patch.

Changes from v1:
* According to Sudeep's review, fix binding for idle-states
* According to Rob's review, due timers share same clock source with apb
  clock, so just only pass one clock phandle

[1] http://article.gmane.org/gmane.linux.kernel.commits.head/573361


Leo Yan (4):
  arm64: dts: Reserve memory regions for hi6220
  arm64: Kconfig: select sp804 timer for ARCH_HISI
  arm64: dts: add sp804 timer node for Hi6220
  arm64: dts: enable idle states for Hi6220

 arch/arm64/Kconfig.platforms                   |  1 +
 arch/arm64/boot/dts/hisilicon/hi6220-hikey.dts | 16 ++++++++---
 arch/arm64/boot/dts/hisilicon/hi6220.dtsi      | 40 ++++++++++++++++++++++++++
 3 files changed, 53 insertions(+), 4 deletions(-)

-- 
1.9.1

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

* [PATCH v2 RESEND 1/4] arm64: dts: Reserve memory regions for hi6220
  2016-01-21 10:53 [PATCH v2 RESEND 0/4] arm64: Hi6220: enable CPU idle states Leo Yan
@ 2016-01-21 10:53 ` Leo Yan
       [not found] ` <1453373630-4693-1-git-send-email-leo.yan-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 6+ messages in thread
From: Leo Yan @ 2016-01-21 10:53 UTC (permalink / raw)
  To: Catalin Marinas, Will Deacon, Rob Herring, Pawel Moll,
	Mark Rutland, Ian Campbell, Kumar Gala, Greg Kroah-Hartman,
	Leo Yan, Yiping Xu, Yu Dongbin, Haojian Zhuang, Chen Feng,
	Tyler Baker, Bintian Wang, Sudeep Holla, Wei Xu, linux-arm-kernel,
	linux-kernel, devicetree

On Hi6220, below memory regions in DDR have specific purpose:

  0x05e0,0000 - 0x05ef,ffff: For MCU firmware using at runtime;
  0x06df,f000 - 0x06df,ffff: For mailbox message data;
  0x0740,f000 - 0x0740,ffff: For MCU firmware's section;
  0x3e00,0000 - 0x3fff,ffff: For OP-TEE.

This patch reserves these memory regions in DT.

Signed-off-by: Leo Yan <leo.yan@linaro.org>
---
 arch/arm64/boot/dts/hisilicon/hi6220-hikey.dts | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/arch/arm64/boot/dts/hisilicon/hi6220-hikey.dts b/arch/arm64/boot/dts/hisilicon/hi6220-hikey.dts
index 8d43a0f..1997e4d 100644
--- a/arch/arm64/boot/dts/hisilicon/hi6220-hikey.dts
+++ b/arch/arm64/boot/dts/hisilicon/hi6220-hikey.dts
@@ -7,9 +7,6 @@
 
 /dts-v1/;
 
-/*Reserved 1MB memory for MCU*/
-/memreserve/ 0x05e00000 0x00100000;
-
 #include "hi6220.dtsi"
 
 / {
@@ -27,8 +24,19 @@
 		stdout-path = "serial3:115200n8";
 	};
 
+	/*
+	 * Reserve below regions from memory node:
+	 *
+	 *  0x05e0,0000 - 0x05ef,ffff: MCU firmware runtime using
+	 *  0x06df,f000 - 0x06df,ffff: Mailbox message data
+	 *  0x0740,f000 - 0x0740,ffff: MCU firmware section
+	 *  0x3e00,0000 - 0x3fff,ffff: OP-TEE
+	 */
 	memory@0 {
 		device_type = "memory";
-		reg = <0x0 0x0 0x0 0x40000000>;
+		reg = <0x00000000 0x00000000 0x00000000 0x05e00000>,
+		      <0x00000000 0x05f00000 0x00000000 0x00eff000>,
+		      <0x00000000 0x06e00000 0x00000000 0x0060f000>,
+		      <0x00000000 0x07410000 0x00000000 0x36bf0000>;
 	};
 };
-- 
1.9.1

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

* [PATCH v2 RESEND 2/4] arm64: Kconfig: select sp804 timer for ARCH_HISI
       [not found] ` <1453373630-4693-1-git-send-email-leo.yan-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
@ 2016-01-21 10:53   ` Leo Yan
  2016-04-18 15:14     ` Xu Wei
  0 siblings, 1 reply; 6+ messages in thread
From: Leo Yan @ 2016-01-21 10:53 UTC (permalink / raw)
  To: Catalin Marinas, Will Deacon, Rob Herring, Pawel Moll,
	Mark Rutland, Ian Campbell, Kumar Gala, Greg Kroah-Hartman,
	Leo Yan, Yiping Xu, Yu Dongbin, Haojian Zhuang, Chen Feng,
	Tyler Baker, Bintian Wang, Sudeep Holla, Wei Xu,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	devicetree-u79uwXL29TY76Z2rM5mHXA

Select sp804 timer for ARCH_HISI, which is used as broadcast timer.

Signed-off-by: Leo Yan <leo.yan-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
---
 arch/arm64/Kconfig.platforms | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arm64/Kconfig.platforms b/arch/arm64/Kconfig.platforms
index 4043c35..94c410d 100644
--- a/arch/arm64/Kconfig.platforms
+++ b/arch/arm64/Kconfig.platforms
@@ -36,6 +36,7 @@ config ARCH_LAYERSCAPE
 
 config ARCH_HISI
 	bool "Hisilicon SoC Family"
+	select ARM_TIMER_SP804
 	help
 	  This enables support for Hisilicon ARMv8 SoC family
 
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* [PATCH v2 RESEND 3/4] arm64: dts: add sp804 timer node for Hi6220
  2016-01-21 10:53 [PATCH v2 RESEND 0/4] arm64: Hi6220: enable CPU idle states Leo Yan
  2016-01-21 10:53 ` [PATCH v2 RESEND 1/4] arm64: dts: Reserve memory regions for hi6220 Leo Yan
       [not found] ` <1453373630-4693-1-git-send-email-leo.yan-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
@ 2016-01-21 10:53 ` Leo Yan
  2016-01-21 10:53 ` [PATCH v2 RESEND 4/4] arm64: dts: enable idle states " Leo Yan
  3 siblings, 0 replies; 6+ messages in thread
From: Leo Yan @ 2016-01-21 10:53 UTC (permalink / raw)
  To: Catalin Marinas, Will Deacon, Rob Herring, Pawel Moll,
	Mark Rutland, Ian Campbell, Kumar Gala, Greg Kroah-Hartman,
	Leo Yan, Yiping Xu, Yu Dongbin, Haojian Zhuang, Chen Feng,
	Tyler Baker, Bintian Wang, Sudeep Holla, Wei Xu, linux-arm-kernel,
	linux-kernel, devicetree

Add sp804 timer for hi6220, so it can be used as broadcast timer.

Signed-off-by: Leo Yan <leo.yan@linaro.org>
---
 arch/arm64/boot/dts/hisilicon/hi6220.dtsi | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/arch/arm64/boot/dts/hisilicon/hi6220.dtsi b/arch/arm64/boot/dts/hisilicon/hi6220.dtsi
index 82d2488..781681a 100644
--- a/arch/arm64/boot/dts/hisilicon/hi6220.dtsi
+++ b/arch/arm64/boot/dts/hisilicon/hi6220.dtsi
@@ -208,5 +208,14 @@
 			clock-names = "uartclk", "apb_pclk";
 			status = "disabled";
 		};
+
+		dual_timer0: dual_timer@f8008000 {
+			compatible = "arm,sp804", "arm,primecell";
+			reg = <0x0 0xf8008000 0x0 0x1000>;
+			interrupts = <GIC_SPI 14 IRQ_TYPE_LEVEL_HIGH>,
+				     <GIC_SPI 15 IRQ_TYPE_LEVEL_HIGH>;
+			clocks = <&ao_ctrl 27>;
+			clock-names = "apb_pclk";
+		};
 	};
 };
-- 
1.9.1

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

* [PATCH v2 RESEND 4/4] arm64: dts: enable idle states for Hi6220
  2016-01-21 10:53 [PATCH v2 RESEND 0/4] arm64: Hi6220: enable CPU idle states Leo Yan
                   ` (2 preceding siblings ...)
  2016-01-21 10:53 ` [PATCH v2 RESEND 3/4] arm64: dts: add sp804 timer node for Hi6220 Leo Yan
@ 2016-01-21 10:53 ` Leo Yan
  3 siblings, 0 replies; 6+ messages in thread
From: Leo Yan @ 2016-01-21 10:53 UTC (permalink / raw)
  To: Catalin Marinas, Will Deacon, Rob Herring, Pawel Moll,
	Mark Rutland, Ian Campbell, Kumar Gala, Greg Kroah-Hartman,
	Leo Yan, Yiping Xu, Yu Dongbin, Haojian Zhuang, Chen Feng,
	Tyler Baker, Bintian Wang, Sudeep Holla, Wei Xu, linux-arm-kernel,
	linux-kernel, devicetree

Add cpu and cluster level's low power state for Hi6220.

Acked-by: Sudeep Holla <sudeep.holla@arm.com>
Signed-off-by: Leo Yan <leo.yan@linaro.org>
---
 arch/arm64/boot/dts/hisilicon/hi6220.dtsi | 31 +++++++++++++++++++++++++++++++
 1 file changed, 31 insertions(+)

diff --git a/arch/arm64/boot/dts/hisilicon/hi6220.dtsi b/arch/arm64/boot/dts/hisilicon/hi6220.dtsi
index 781681a..6fb1697 100644
--- a/arch/arm64/boot/dts/hisilicon/hi6220.dtsi
+++ b/arch/arm64/boot/dts/hisilicon/hi6220.dtsi
@@ -53,11 +53,35 @@
 			};
 		};
 
+		idle-states {
+			entry-method = "psci";
+
+			CPU_SLEEP: cpu-sleep {
+				compatible = "arm,idle-state";
+				local-timer-stop;
+				arm,psci-suspend-param = <0x0010000>;
+				entry-latency-us = <700>;
+				exit-latency-us = <250>;
+				min-residency-us = <1000>;
+			};
+
+			CLUSTER_SLEEP: cluster-sleep {
+				compatible = "arm,idle-state";
+				local-timer-stop;
+				arm,psci-suspend-param = <0x1010000>;
+				entry-latency-us = <1000>;
+				exit-latency-us = <700>;
+				min-residency-us = <2700>;
+				wakeup-latency-us = <1500>;
+			};
+		};
+
 		cpu0: cpu@0 {
 			compatible = "arm,cortex-a53", "arm,armv8";
 			device_type = "cpu";
 			reg = <0x0 0x0>;
 			enable-method = "psci";
+			cpu-idle-states = <&CPU_SLEEP &CLUSTER_SLEEP>;
 		};
 
 		cpu1: cpu@1 {
@@ -65,6 +89,7 @@
 			device_type = "cpu";
 			reg = <0x0 0x1>;
 			enable-method = "psci";
+			cpu-idle-states = <&CPU_SLEEP &CLUSTER_SLEEP>;
 		};
 
 		cpu2: cpu@2 {
@@ -72,6 +97,7 @@
 			device_type = "cpu";
 			reg = <0x0 0x2>;
 			enable-method = "psci";
+			cpu-idle-states = <&CPU_SLEEP &CLUSTER_SLEEP>;
 		};
 
 		cpu3: cpu@3 {
@@ -79,6 +105,7 @@
 			device_type = "cpu";
 			reg = <0x0 0x3>;
 			enable-method = "psci";
+			cpu-idle-states = <&CPU_SLEEP &CLUSTER_SLEEP>;
 		};
 
 		cpu4: cpu@100 {
@@ -86,6 +113,7 @@
 			device_type = "cpu";
 			reg = <0x0 0x100>;
 			enable-method = "psci";
+			cpu-idle-states = <&CPU_SLEEP &CLUSTER_SLEEP>;
 		};
 
 		cpu5: cpu@101 {
@@ -93,6 +121,7 @@
 			device_type = "cpu";
 			reg = <0x0 0x101>;
 			enable-method = "psci";
+			cpu-idle-states = <&CPU_SLEEP &CLUSTER_SLEEP>;
 		};
 
 		cpu6: cpu@102 {
@@ -100,6 +129,7 @@
 			device_type = "cpu";
 			reg = <0x0 0x102>;
 			enable-method = "psci";
+			cpu-idle-states = <&CPU_SLEEP &CLUSTER_SLEEP>;
 		};
 
 		cpu7: cpu@103 {
@@ -107,6 +137,7 @@
 			device_type = "cpu";
 			reg = <0x0 0x103>;
 			enable-method = "psci";
+			cpu-idle-states = <&CPU_SLEEP &CLUSTER_SLEEP>;
 		};
 	};
 
-- 
1.9.1

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

* Re: [PATCH v2 RESEND 2/4] arm64: Kconfig: select sp804 timer for ARCH_HISI
  2016-01-21 10:53   ` [PATCH v2 RESEND 2/4] arm64: Kconfig: select sp804 timer for ARCH_HISI Leo Yan
@ 2016-04-18 15:14     ` Xu Wei
  0 siblings, 0 replies; 6+ messages in thread
From: Xu Wei @ 2016-04-18 15:14 UTC (permalink / raw)
  To: Leo Yan, Catalin Marinas, Will Deacon, Rob Herring, Pawel Moll,
	Mark Rutland, Ian Campbell, Kumar Gala, Greg Kroah-Hartman,
	Yiping Xu, Yu Dongbin, Haojian Zhuang, Chen Feng, Tyler Baker,
	Bintian Wang, Sudeep Holla, Wei Xu, linux-arm-kernel,
	linux-kernel, devicetree

Hi Leo,

On 21/01/16 10:53, Leo Yan wrote:
> Select sp804 timer for ARCH_HISI, which is used as broadcast timer.
>
> Signed-off-by: Leo Yan <leo.yan@linaro.org>
> ---
>   arch/arm64/Kconfig.platforms | 1 +
>   1 file changed, 1 insertion(+)
>
> diff --git a/arch/arm64/Kconfig.platforms b/arch/arm64/Kconfig.platforms
> index 4043c35..94c410d 100644
> --- a/arch/arm64/Kconfig.platforms
> +++ b/arch/arm64/Kconfig.platforms
> @@ -36,6 +36,7 @@ config ARCH_LAYERSCAPE
>   
>   config ARCH_HISI
>   	bool "Hisilicon SoC Family"
> +	select ARM_TIMER_SP804
>   	help
>   	  This enables support for Hisilicon ARMv8 SoC family
>   
Just applied this to the hisilicon soc tree.
The others have been picked up from Guodong's patch set.
Thanks!

Best Regards,
Wei

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

end of thread, other threads:[~2016-04-18 15:14 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-01-21 10:53 [PATCH v2 RESEND 0/4] arm64: Hi6220: enable CPU idle states Leo Yan
2016-01-21 10:53 ` [PATCH v2 RESEND 1/4] arm64: dts: Reserve memory regions for hi6220 Leo Yan
     [not found] ` <1453373630-4693-1-git-send-email-leo.yan-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2016-01-21 10:53   ` [PATCH v2 RESEND 2/4] arm64: Kconfig: select sp804 timer for ARCH_HISI Leo Yan
2016-04-18 15:14     ` Xu Wei
2016-01-21 10:53 ` [PATCH v2 RESEND 3/4] arm64: dts: add sp804 timer node for Hi6220 Leo Yan
2016-01-21 10:53 ` [PATCH v2 RESEND 4/4] arm64: dts: enable idle states " Leo Yan

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