Add CPUidle support for Tegra210
Subsystems (4)
v3 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 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 (6):
dt-bindings: timer: add Tegra210 timer
clocksource: tegra: add Tegra210 timer driver
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 | 8 + drivers/clocksource/Makefile | 1 + drivers/clocksource/timer-tegra210.c | 246 ++++++++++++++++++ include/linux/cpuhotplug.h | 1 + 8 files changed, 335 insertions(+), 3 deletions(-) create mode 100644 Documentation/devicetree/bindings/timer/nvidia,tegra210-timer.txt create mode 100644 drivers/clocksource/timer-tegra210.c
Signature · 1 line
2.20.1
PATCH v3 1/6 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.
---
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 v3 2/6 clocksource: tegra: add Tegra210 timer driver
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.
Based on the work of Antti P Miettinen <[email protected]>
---
v3:
* use timer-of API
v2:
* add error clean-up code
--- drivers/clocksource/Kconfig | 8 + drivers/clocksource/Makefile | 1 + drivers/clocksource/timer-tegra210.c | 246 +++++++++++++++++++++++++++ include/linux/cpuhotplug.h | 1 + 4 files changed, 256 insertions(+) create mode 100644 drivers/clocksource/timer-tegra210.c
drivers/clocksource/Kconfig +8 -0
@@ -135,6 +135,14 @@ config TEGRA_TIMER help Enables support for the Tegra driver. +config TEGRA210_TIMER + bool "Tegra210 timer driver" + default y if ARCH_TEGRA_210_SOC + depends on ARCH_TEGRA_210_SOC + select TIMER_OF + help + Enable support for the Tegra210 driver. + config VT8500_TIMER bool "VT8500 timer driver" if COMPILE_TEST depends on HAS_IOMEM
drivers/clocksource/Makefile +1 -0
@@ -36,6 +36,7 @@ obj-$(CONFIG_SUN4I_TIMER) += timer-sun4i.o obj-$(CONFIG_SUN5I_HSTIMER) += timer-sun5i.o obj-$(CONFIG_MESON6_TIMER) += timer-meson6.o obj-$(CONFIG_TEGRA_TIMER) += timer-tegra20.o +obj-$(CONFIG_TEGRA210_TIMER) += timer-tegra210.o obj-$(CONFIG_VT8500_TIMER) += timer-vt8500.o obj-$(CONFIG_NSPIRE_TIMER) += timer-zevio.o obj-$(CONFIG_BCM_KONA_TIMER) += bcm_kona_timer.o
drivers/clocksource/timer-tegra210.c new file +246 -0
246 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
PATCH v3 3/6 arm64: dts: tegra210: fix timer node
In reply to Joseph LoFix timer node to make it work with Tegra210 timer driver.
---
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 v3 4/6 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.
---
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 v3 5/6 arm64: dts: tegra210-p2180: Enable CPU idle support
In reply to Joseph LoEnable CPU idle support for Jetson TX1 platform.
---
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
PATCH v3 6/6 arm64: dts: tegra210-smaug: Enable CPU idle support
In reply to Joseph LoEnable CPU idle support for Smaug platform.
---
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