Add CPUidle support for Tegra210
Subsystems (4)
v4 cover Add CPUidle support for Tegra210
This patch series adds CPUidle support for Tegra210, which supports power-down state (C7) for CPU cores. And due to arch timer cannot work across CPU core power-down and power on reset signal event. We introduce Tegra210 timer driver to work as clock event device. So it can be the wake-up source of CPU cores when they idled in the power-down state.
Fixed in V4:
* merge timer-tegra210.c into timer-tegra20.c
* add a new patch to select TEGRA_TIMER by default for Tegra210
Fixed in V3:
* use timer-of API for Tegra210 timer driver
Fixed in V2:
* list all the timer IRQs in the binding doc and dts file
* add error clean-up code in timer driver
* add entry-latency-us and exit-latency-us properties for idle-states DT node
Joseph Lo (7):
dt-bindings: timer: add Tegra210 timer
clocksource: tegra: add Tegra210 timer support soc/tegra: default select TEGRA_TIMER for Tegra210
arm64: dts: tegra210: fix timer node
arm64: dts: tegra210: add CPU idle states properties
arm64: dts: tegra210-p2180: Enable CPU idle support
arm64: dts: tegra210-smaug: Enable CPU idle support
.../bindings/timer/nvidia,tegra210-timer.txt | 36 ++ .../arm64/boot/dts/nvidia/tegra210-p2180.dtsi | 6 + arch/arm64/boot/dts/nvidia/tegra210-smaug.dts | 7 + arch/arm64/boot/dts/nvidia/tegra210.dtsi | 33 +- drivers/clocksource/Kconfig | 2 +- drivers/clocksource/timer-tegra20.c | 369 +++++++++++++----- drivers/soc/tegra/Kconfig | 1 + include/linux/cpuhotplug.h | 1 + 8 files changed, 352 insertions(+), 103 deletions(-) create mode 100644 Documentation/devicetree/bindings/timer/nvidia,tegra210-timer.txt
Signature · 1 line
2.20.1
PATCH v4 1/7 dt-bindings: timer: add Tegra210 timer
The Tegra210 timer provides fourteen 29-bit timer counters and one 32-bit timestamp counter. The TMRs run at either a fixed 1 MHz clock rate derived from the oscillator clock (TMR0-TMR9) or directly at the oscillator clock (TMR10-TMR13). Each TMR can be programmed to generate one-shot periodic, or watchdog interrupts.
---
V4:
* no change
v3:
* no change
v2:
* list all the interrupts that are supported by tegra210 timers block
* add RB tag from Rob.
--- .../bindings/timer/nvidia,tegra210-timer.txt | 36 +++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 Documentation/devicetree/bindings/timer/nvidia,tegra210-timer.txt
Documentation/devicetree/bindings/timer/nvidia,tegra210-timer.txt new file +36 -0
@@ -0,0 +1,36 @@ +NVIDIA Tegra210 timer + +The Tegra210 timer provides fourteen 29-bit timer counters and one 32-bit +timestamp counter. The TMRs run at either a fixed 1 MHz clock rate derived +from the oscillator clock (TMR0-TMR9) or directly at the oscillator clock +(TMR10-TMR13). Each TMR can be programmed to generate one-shot, periodic, +or watchdog interrupts. + +Required properties: +- compatible : "nvidia,tegra210-timer". +- reg : Specifies base physical address and size of the registers. +- interrupts : A list of 14 interrupts; one per each timer channels 0 through + 13. +- clocks : Must contain one entry, for the module clock. + See ../clocks/clock-bindings.txt for details. + +timer@60005000 { + compatible = "nvidia,tegra210-timer"; + reg = <0x0 0x60005000 0x0 0x400>; + interrupts = <GIC_SPI 156 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 0 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 1 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 41 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 42 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 121 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 152 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 153 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 154 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 155 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 176 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 177 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 178 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 179 IRQ_TYPE_LEVEL_HIGH>; + clocks = <&tegra_car TEGRA210_CLK_TIMER>; + clock-names = "timer"; +};
Signature · 1 line
2.20.1
PATCH v4 2/7 clocksource: tegra: add Tegra210 timer support
In reply to Joseph LoAdd support for the Tegra210 timer that runs at oscillator clock (TMR10-TMR13). We need these timers to work as clock event device and to replace the ARMv8 architected timer due to it can't survive across the power cycle of the CPU core or CPUPORESET signal. So it can't be a wake-up source when CPU suspends in power down state.
Also convert the original driver to use timer-of API.
---
v4:
* merge timer-tegra210.c in previous version into timer-tegra20.c
v3:
* use timer-of API
v2:
* add error clean-up code
--- drivers/clocksource/Kconfig | 2 +- drivers/clocksource/timer-tegra20.c | 369 ++++++++++++++++++++-------- include/linux/cpuhotplug.h | 1 + 3 files changed, 272 insertions(+), 100 deletions(-)
drivers/clocksource/Kconfig +1 -1
@@ -131,7 +131,7 @@ config SUN5I_HSTIMER config TEGRA_TIMER bool "Tegra timer driver" if COMPILE_TEST select CLKSRC_MMIO - depends on ARM + select TIMER_OF help Enables support for the Tegra driver.
drivers/clocksource/timer-tegra20.c +270 -99
462 lines not on this page · raw message
include/linux/cpuhotplug.h +1 -0
@@ -121,6 +121,7 @@ enum cpuhp_state {CPUHP_AP_EXYNOS4_MCT_TIMER_STARTING ,CPUHP_AP_ARM_TWD_STARTING ,CPUHP_AP_QCOM_TIMER_STARTING , +CPUHP_AP_TEGRA_TIMER_STARTING ,CPUHP_AP_ARMADA_TIMER_STARTING ,CPUHP_AP_MARCO_TIMER_STARTING , CPUHP_AP_MIPS_GIC_TIMER_STARTING,
Signature · 1 line
2.20.1
Re: [PATCH V4 2/7] clocksource: tegra: add Tegra210 timer support
Quoted 19 lines · Joseph Lo
Add support for the Tegra210 timer that runs at oscillator clock (TMR10-TMR13). We need these timers to work as clock event device and to replace the ARMv8 architected timer due to it can't survive across the power cycle of the CPU core or CPUPORESET signal. So it can't be a wake-up source when CPU suspends in power down state.
Also convert the original driver to use timer-of API.
Cc Daniel Lezcano <[email protected]>Cc Thomas Gleixner <[email protected]>Signed-off-by Joseph Lo <[email protected]>---
v4:
* mergetimer-tegra210.cin previous version intotimer-tegra20.c
v3:
* use timer-of API
v2:
* add error clean-up code
Quoted 5 lines
--- drivers/clocksource/Kconfig | 2 +- drivers/clocksource/timer-tegra20.c | 369 ++++++++++++++++++++-------- include/linux/cpuhotplug.h | 1 + 3 files changed, 272 insertions(+), 100 deletions(-)
Looks good to me:
Thierry
PATCH v4 3/7 soc/tegra: default select TEGRA_TIMER for Tegra210
In reply to Joseph LoThe tegra timer is necessary for Tegra210 to support CPU idle power-down state. So select it by default.
---
v4:
* new added in this version
--- drivers/soc/tegra/Kconfig | 1 + 1 file changed, 1 insertion(+)
drivers/soc/tegra/Kconfig +1 -0
@@ -76,6 +76,7 @@ config ARCH_TEGRA_210_SOC select PINCTRL_TEGRA210 select SOC_TEGRA_FLOWCTRL select SOC_TEGRA_PMC + select TEGRA_TIMER help Enable support for the NVIDIA Tegra210 SoC. Also known as Tegra X1, the Tegra210 has four Cortex-A57 cores paired with four Cortex-A53
Signature · 1 line
2.20.1
Re: [PATCH V4 3/7] soc/tegra: default select TEGRA_TIMER for Tegra210
Quoted 10 lines · Joseph Lo
The tegra timer is necessary for Tegra210 to support CPU idle power-down state. So select it by default.
Signed-off-by Joseph Lo <[email protected]>---
v4:
* new added in this version--- drivers/soc/tegra/Kconfig | 1 + 1 file changed, 1 insertion(+)
So this technically depends on patch 2/7, so it would make sense for Daniel or Thomas to pick this up along with 2/7, but you didn't Cc them, so they're not aware of this.
I think you need to either resend the series and Cc both Daniel and Thomas on all the patches in the series, or we have to make sure that this patch is not applied before patch 2/7, otherwise Kconfig will complain. If you decide to resend, this patch is:
Thierry
_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Re: [PATCH V4 3/7] soc/tegra: default select TEGRA_TIMER for Tegra210
Quoted 12 lines · Thierry Reding
Quoted 10 lines · Joseph Lo
The tegra timer is necessary for Tegra210 to support CPU idle power-down state. So select it by default.
Signed-off-by Joseph Lo <[email protected]>---
v4:
* new added in this version--- drivers/soc/tegra/Kconfig | 1 + 1 file changed, 1 insertion(+)
Quoted 8 lines
So this technically depends on patch 2/7, so it would make sense for Daniel or Thomas to pick this up along with 2/7, but you didn't Cc them, so they're not aware of this.
I think you need to either resend the series and Cc both Daniel and Thomas on all the patches in the series, or we have to make sure that this patch is not applied before patch 2/7, otherwise
Kconfigwill complain. If you decide to resend, this patch is:
Okay, will resend this series.
Thanks for your review,
Joseph
Quoted 5 lines
Acked-by Thierry Reding <[email protected]>Thierry
PATCH v4 4/7 arm64: dts: tegra210: fix timer node
In reply to Joseph LoFix timer node to make it work with Tegra210 timer driver.
---
v4:
* no change
v3:
* no change
v2:
* list all the IRQs per each timer channels 0 through 13
* remove compatible string of "nvidia,tegra30-timer"
--- arch/arm64/boot/dts/nvidia/tegra210.dtsi | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-)
arch/arm64/boot/dts/nvidia/tegra210.dtsi +11 -3
@@ -384,14 +384,22 @@ }; timer@60005000 { - compatible = "nvidia,tegra210-timer", "nvidia,tegra20-timer"; + compatible = "nvidia,tegra210-timer"; reg = <0x0 0x60005000 0x0 0x400>; - interrupts = <GIC_SPI 0 IRQ_TYPE_LEVEL_HIGH>, + interrupts = <GIC_SPI 156 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 0 IRQ_TYPE_LEVEL_HIGH>, <GIC_SPI 1 IRQ_TYPE_LEVEL_HIGH>, <GIC_SPI 41 IRQ_TYPE_LEVEL_HIGH>, <GIC_SPI 42 IRQ_TYPE_LEVEL_HIGH>, <GIC_SPI 121 IRQ_TYPE_LEVEL_HIGH>, - <GIC_SPI 122 IRQ_TYPE_LEVEL_HIGH>; + <GIC_SPI 152 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 153 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 154 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 155 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 176 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 177 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 178 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 179 IRQ_TYPE_LEVEL_HIGH>; clocks = <&tegra_car TEGRA210_CLK_TIMER>; clock-names = "timer"; };
Signature · 1 line
2.20.1
PATCH v4 5/7 arm64: dts: tegra210: add CPU idle states properties
In reply to Joseph LoAdd idle states properties for generic ARM CPU idle driver. This includes a C7 state which is the power down state of CPU cores.
---
v4:
* no change
v3:
* no change
v2:
* add entry-latency-us and exit-latency-us properties
Note:
This dt patch depends on the DT changes in below series.
http://patchwork.ozlabs.org/project/linux-tegra/list/?series=84380
--- arch/arm64/boot/dts/nvidia/tegra210.dtsi | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+)
arch/arm64/boot/dts/nvidia/tegra210.dtsi +19 -0
@@ -1318,24 +1318,43 @@ <&dfll>; clock-names = "cpu_g", "pll_x", "pll_p", "dfll"; clock-latency = <300000>; + cpu-idle-states = <&C7>; }; cpu@1 { device_type = "cpu"; compatible = "arm,cortex-a57"; reg = <1>; + cpu-idle-states = <&C7>; }; cpu@2 { device_type = "cpu"; compatible = "arm,cortex-a57"; reg = <2>; + cpu-idle-states = <&C7>; }; cpu@3 { device_type = "cpu"; compatible = "arm,cortex-a57"; reg = <3>; + cpu-idle-states = <&C7>; + }; + + idle-states { + entry-method = "psci"; + + C7: c7 { + compatible = "arm,idle-state"; + arm,psci-suspend-param = <0x40000007>; + entry-latency-us = <250>; + exit-latency-us = <100>; + min-residency-us = <1000>; + wakeup-latency-us = <130>; + idle-state-name = "c7-cpu-powergated"; + status = "disabled"; + }; }; };
Signature · 1 line
2.20.1
PATCH v4 6/7 arm64: dts: tegra210-p2180: Enable CPU idle support
In reply to Joseph LoEnable CPU idle support for Jetson TX1 platform.
---
v4:
* no change
v3:
* no change
v2:
* no change
--- arch/arm64/boot/dts/nvidia/tegra210-p2180.dtsi | 6 ++++++ 1 file changed, 6 insertions(+)
arch/arm64/boot/dts/nvidia/tegra210-p2180.dtsi +6 -0
@@ -305,6 +305,12 @@ cpu@3 { enable-method = "psci"; }; + + idle-states { + c7 { + status = "okay"; + }; + }; }; psci {
Signature · 1 line
2.20.1
Re: [PATCH V4 6/7] arm64: dts: tegra210-p2180: Enable CPU idle support
Quoted 19 lines · Joseph Lo
Enable CPU idle support for Jetson TX1 platform.
Signed-off-by Joseph Lo <[email protected]>---
v4:
* no change
v3:
* no change
v2:
* no change--- arch/arm64/boot/dts/nvidia/tegra210-p2180.dtsi | 6 ++++++ 1 file changed, 6 insertions(+)arch/arm64/boot/dts/nvidia/tegra210-p2180.dtsi +0
-0
arch/arm64/boot/dts/nvidia/tegra210-p2180.dtsi line 311
Quoted 7 lines
arch/arm64/boot/dts/nvidia/tegra210-p2180.dtsi +4
-0@@ -305,6 +305,12 @@ cpu@3 { enable-method = "psci"; }; + + idle-states { + c7 { + status = "okay";
Doesn't seem like the code currently cares, but the bindings are specific, so this looks good to me.
Given that we need the timer in order to get out of this state, I'm assuming that I should hold back on these patches until the driver changes have been merged to make sure we don't regress. Is that correct?
Thierry
_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Re: [PATCH V4 6/7] arm64: dts: tegra210-p2180: Enable CPU idle support
Quoted 31 lines · Thierry Reding
Quoted 19 lines · Joseph Lo
Enable CPU idle support for Jetson TX1 platform.
Signed-off-by Joseph Lo <[email protected]>---
v4:
* no change
v3:
* no change
v2:
* no change--- arch/arm64/boot/dts/nvidia/tegra210-p2180.dtsi | 6 ++++++ 1 file changed, 6 insertions(+)arch/arm64/boot/dts/nvidia/tegra210-p2180.dtsi +0
-0arch/arm64/boot/dts/nvidia/tegra210-p2180.dtsi line 311
Quoted 7 lines
arch/arm64/boot/dts/nvidia/tegra210-p2180.dtsi +4
-0@@ -305,6 +305,12 @@ cpu@3 { enable-method = "psci"; }; + + idle-states { + c7 { + status = "okay";Doesn't seem like the code currently cares, but the bindings are specific, so this looks good to me.
Quoted 5 lines
Given that we need the timer in order to get out of this state, I'm assuming that I should hold back on these patches until the driver changes have been merged to make sure we don't regress. Is that correct?
Yes, correct. Need to make sure all the timer related stuff landed first.
Thanks,
Joseph
PATCH v4 7/7 arm64: dts: tegra210-smaug: Enable CPU idle support
In reply to Joseph LoEnable CPU idle support for Smaug platform.
---
v4:
* no change
v3:
* no change
v2:
* no change
--- arch/arm64/boot/dts/nvidia/tegra210-smaug.dts | 7 +++++++ 1 file changed, 7 insertions(+)
arch/arm64/boot/dts/nvidia/tegra210-smaug.dts +7 -0
@@ -1751,6 +1751,13 @@ cpu@3 { enable-method = "psci"; }; + + idle-states { + c7 { + arm,psci-suspend-param = <0x00010007>; + status = "okay"; + }; + }; }; gpio-keys {
Signature · 1 line
2.20.1