Timer support for ARM Tegra
Subsystems (5)
v6 cover Timer support for ARM Tegra
- ARM: tegra: remap clock_osc_freq for all Tegra family Enum clock_osc_freq was designed to use only with T20. This patch remaps it to use additional frequencies, added in T30+ SoC while maintaining backwards compatibility with T20.
- drivers: timer: add timer driver for ARMv7 based Tegra devices Add timer support for T20/T30/T114 and T124 based devices. Driver is based on DM, has device tree support and can be used on SPL and early boot stage.
- ARM: tegra: include timer as default option Enable TIMER as default option for all Tegra devices and enable TEGRA_TIMER for TEGRA_ARMV7_COMMON. Additionally enable SPL_TIMER if build as SPL part and drop deprecated configs from common header.
P. S. I have no arm64 Tegra and according to comment in tegra-common.h
Use the Tegra US timer on ARMv7, but the architected timer on ARMv8.
Svyatoslav Ryhel (3):
ARM: tegra: remap clock_osc_freq for all Tegra family
drivers: timer: add timer driver for ARMv7 based Tegra devices
ARM: tegra: include timer as default option
arch/arm/Kconfig | 1 + arch/arm/include/asm/arch-tegra/clock.h | 9 +- arch/arm/mach-tegra/Kconfig | 2 + arch/arm/mach-tegra/clock.c | 17 +++- arch/arm/mach-tegra/cpu.c | 70 ++++++++++--- arch/arm/mach-tegra/tegra114/clock.c | 13 +-- arch/arm/mach-tegra/tegra124/clock.c | 13 +-- arch/arm/mach-tegra/tegra20/clock.c | 4 +- arch/arm/mach-tegra/tegra210/clock.c | 22 +---- arch/arm/mach-tegra/tegra30/clock.c | 10 +- drivers/timer/Kconfig | 8 ++ drivers/timer/Makefile | 1 + drivers/timer/tegra-timer.c | 126 ++++++++++++++++++++++++ drivers/usb/host/ehci-tegra.c | 46 +++++++-- include/configs/tegra-common.h | 6 -- 15 files changed, 269 insertions(+), 79 deletions(-) create mode 100644 drivers/timer/tegra-timer.c
Signature · 1 line
2.37.2
PATCH v6 1/3 ARM: tegra: remap clock_osc_freq for all Tegra family
Enum clock_osc_freq was designed to use only with T20. This patch remaps it to use additional frequencies, added in T30+ SoC while maintaining backwards compatibility with T20.
--- arch/arm/include/asm/arch-tegra/clock.h | 9 ++-- arch/arm/mach-tegra/clock.c | 17 ++++-- arch/arm/mach-tegra/cpu.c | 70 ++++++++++++++++++++----- arch/arm/mach-tegra/tegra114/clock.c | 13 ++--- arch/arm/mach-tegra/tegra124/clock.c | 13 ++--- arch/arm/mach-tegra/tegra20/clock.c | 4 +- arch/arm/mach-tegra/tegra210/clock.c | 22 ++------ arch/arm/mach-tegra/tegra30/clock.c | 10 +--- drivers/usb/host/ehci-tegra.c | 46 ++++++++++++---- 9 files changed, 131 insertions(+), 73 deletions(-)
arch/arm/include/asm/arch-tegra/clock.h +5 -4
@@ -13,12 +13,13 @@ struct udevice;/* Set of oscillator frequencies supported in the internal API. */ enum clock_osc_freq {/* All in MHz, so 13_0 is 13.0MHz */ -CLOCK_OSC_FREQ_13_0 , -CLOCK_OSC_FREQ_19_2 , -CLOCK_OSC_FREQ_12_0 , -CLOCK_OSC_FREQ_26_0 , +CLOCK_OSC_FREQ_13_0 =0 , +CLOCK_OSC_FREQ_16_8 , +CLOCK_OSC_FREQ_19_2 =4 ,CLOCK_OSC_FREQ_38_4 , +CLOCK_OSC_FREQ_12_0 =8 ,CLOCK_OSC_FREQ_48_0 , +CLOCK_OSC_FREQ_26_0 =12 ,CLOCK_OSC_FREQ_COUNT , };
arch/arm/mach-tegra/clock.c +14 -3
@@ -28,16 +28,23 @@static unsigned pll_rate[CLOCK_ID_COUNT ];/* -* The oscillator frequency is fixed to one of four set values. Based on this +* The oscillator frequency is fixed to one of seven set values. Based on this * the other clocks are set up appropriately. */ static unsigned osc_freq[CLOCK_OSC_FREQ_COUNT ] = {13000000 , +16800000 , +0 , +0 ,19200000 , -12000000 , -26000000 ,38400000 , +0 , +0 , +12000000 ,48000000 , +0 , +0 , +26000000 , };/* return 1 if a peripheral ID is in range */
@@ -766,6 +773,7 @@ void tegra30_set_up_pllp(void)*/ switch (clock_get_osc_freq ()) {case CLOCK_OSC_FREQ_12_0 :/* OSC is 12Mhz */ +case CLOCK_OSC_FREQ_48_0 :/* OSC is 48Mhz */ clock_set_rate (CLOCK_ID_PERIPH ,408 ,12 ,0 ,8 );clock_set_rate (CLOCK_ID_CGENERAL ,456 ,12 ,1 ,8 );break ;
@@ -776,10 +784,13 @@ void tegra30_set_up_pllp(void)break ;case CLOCK_OSC_FREQ_13_0 :/* OSC is 13Mhz */ +case CLOCK_OSC_FREQ_16_8 :/* OSC is 16.8Mhz */ clock_set_rate (CLOCK_ID_PERIPH ,408 ,13 ,0 ,8 );clock_set_rate (CLOCK_ID_CGENERAL ,600 ,13 ,0 ,8 );break ; +case CLOCK_OSC_FREQ_19_2 : +case CLOCK_OSC_FREQ_38_4 :default :/* * These are not supported. It is too early to print a
arch/arm/mach-tegra/cpu.c +56 -14
123 lines not on this page · raw message
arch/arm/mach-tegra/tegra114/clock.c +5 -8
@@ -459,8 +459,7 @@ struct clk_pll_info tegra_pll_info_table[CLOCK_ID_PLL_COUNT] = {/* * Get the oscillator frequency, from the corresponding hardware configuration -* field. Note that T30/T114 support 3 new higher freqs, but we map back -* to the old T20 freqs. Support for the higher oscillators is TBD. +* field. Note that T30+ supports 3 new higher freqs. */ enum clock_osc_freq clock_get_osc_freq (void ) {
@@ -469,12 +468,7 @@ enum clock_osc_freq clock_get_osc_freq(void)u32 reg; reg =readl (&clkrst->crc_osc_ctrl); - reg = (reg &OSC_FREQ_MASK ) >>OSC_FREQ_SHIFT ; - -if (reg &1 )/* one of the newer freqs */ -printf ("Warning: OSC_FREQ is unsupported! (%d)\n" , reg); - -return reg >>2 ;/* Map to most common (T20) freqs */ +return (reg &OSC_FREQ_MASK ) >>OSC_FREQ_SHIFT ; }/* Returns a pointer to the clock source register for a peripheral */
@@ -674,6 +668,7 @@ void clock_early_init(void)*/ switch (clock_get_osc_freq ()) {case CLOCK_OSC_FREQ_12_0 :/* OSC is 12Mhz */ +case CLOCK_OSC_FREQ_48_0 :/* OSC is 48Mhz */ clock_set_rate (CLOCK_ID_CGENERAL ,600 ,12 ,0 ,8 );clock_set_rate (CLOCK_ID_DISPLAY ,925 ,12 ,0 ,12 );break ;
@@ -684,10 +679,12 @@ void clock_early_init(void)break ;case CLOCK_OSC_FREQ_13_0 :/* OSC is 13Mhz */ +case CLOCK_OSC_FREQ_16_8 :/* OSC is 16.8Mhz */ clock_set_rate (CLOCK_ID_CGENERAL ,600 ,13 ,0 ,8 );clock_set_rate (CLOCK_ID_DISPLAY ,925 ,13 ,0 ,12 );break ;case CLOCK_OSC_FREQ_19_2 : +case CLOCK_OSC_FREQ_38_4 :default :/* * These are not supported. It is too early to print a
arch/arm/mach-tegra/tegra124/clock.c +5 -8
@@ -601,8 +601,7 @@ struct clk_pll_info tegra_pll_info_table[CLOCK_ID_PLL_COUNT] = {/* * Get the oscillator frequency, from the corresponding hardware configuration -* field. Note that Tegra30+ support 3 new higher freqs, but we map back -* to the old T20 freqs. Support for the higher oscillators is TBD. +* field. Note that T30+ supports 3 new higher freqs. */ enum clock_osc_freq clock_get_osc_freq (void ) {
@@ -611,12 +610,7 @@ enum clock_osc_freq clock_get_osc_freq(void)u32 reg; reg =readl (&clkrst->crc_osc_ctrl); - reg = (reg &OSC_FREQ_MASK ) >>OSC_FREQ_SHIFT ; - -if (reg &1 )/* one of the newer freqs */ -printf ("Warning: OSC_FREQ is unsupported! (%d)\n" , reg); - -return reg >>2 ;/* Map to most common (T20) freqs */ +return (reg &OSC_FREQ_MASK ) >>OSC_FREQ_SHIFT ; }/* Returns a pointer to the clock source register for a peripheral */
@@ -854,6 +848,7 @@ void clock_early_init(void)*/ switch (clock_get_osc_freq ()) {case CLOCK_OSC_FREQ_12_0 :/* OSC is 12Mhz */ +case CLOCK_OSC_FREQ_48_0 :/* OSC is 48Mhz */ clock_set_rate (CLOCK_ID_CGENERAL ,600 ,12 ,0 ,8 );clock_set_rate (CLOCK_ID_DISPLAY ,925 ,12 ,0 ,12 );break ;
@@ -864,10 +859,12 @@ void clock_early_init(void)break ;case CLOCK_OSC_FREQ_13_0 :/* OSC is 13Mhz */ +case CLOCK_OSC_FREQ_16_8 :/* OSC is 16.8Mhz */ clock_set_rate (CLOCK_ID_CGENERAL ,600 ,13 ,0 ,8 );clock_set_rate (CLOCK_ID_DISPLAY ,925 ,13 ,0 ,12 );break ;case CLOCK_OSC_FREQ_19_2 : +case CLOCK_OSC_FREQ_38_4 :default :/* * These are not supported. It is too early to print a
arch/arm/mach-tegra/tegra20/clock.c +3 -1
@@ -399,7 +399,9 @@ enum clock_osc_freq clock_get_osc_freq(void)u32 reg; reg =readl (&clkrst->crc_osc_ctrl); -return (reg &OSC_FREQ_MASK ) >>OSC_FREQ_SHIFT ; + reg = (reg &OSC_FREQ_MASK ) >>OSC_FREQ_SHIFT ; + +return reg <<2 ; }/* Returns a pointer to the clock source register for a peripheral */
arch/arm/mach-tegra/tegra210/clock.c +4 -18
@@ -672,8 +672,7 @@ struct clk_pll_info tegra_pll_info_table[CLOCK_ID_PLL_COUNT] = {/* * Get the oscillator frequency, from the corresponding hardware configuration -* field. Note that Tegra30+ support 3 new higher freqs, but we map back -* to the old T20 freqs. Support for the higher oscillators is TBD. +* field. Note that T30+ supports 3 new higher freqs. */ enum clock_osc_freq clock_get_osc_freq (void ) {
@@ -682,22 +681,7 @@ enum clock_osc_freq clock_get_osc_freq(void)u32 reg; reg =readl (&clkrst->crc_osc_ctrl); - reg = (reg &OSC_FREQ_MASK ) >>OSC_FREQ_SHIFT ; -/* -* 0 = 13MHz, 1 = 16.8MHz, 4 = 19.2MHz, 5 = 38.4MHz, -* 8 = 12MHz, 9 = 48MHz, 12 = 26MHz -*/ -if (reg ==5 ) { -debug ("OSC_FREQ is 38.4MHz (%d) ...\n" , reg); -/* Map it to the 5th CLOCK_OSC_ enum, i.e. 4 */ -return 4 ; - } - -/* -* Map to most common (T20) freqs (except 38.4, handled above): -* 13/16.8 = 0, 19.2 = 1, 12/48 = 2, 26 = 3 -*/ -return reg >>2 ; +return (reg &OSC_FREQ_MASK ) >>OSC_FREQ_SHIFT ; }/* Returns a pointer to the clock source register for a peripheral */
@@ -986,6 +970,7 @@ void clock_early_init(void)*/ switch (clock_get_osc_freq ()) {case CLOCK_OSC_FREQ_12_0 :/* OSC is 12Mhz */ +case CLOCK_OSC_FREQ_48_0 :/* OSC is 48Mhz */ clock_set_rate (CLOCK_ID_CGENERAL ,600 ,12 ,0 ,8 );clock_set_rate (CLOCK_ID_DISPLAY ,925 ,12 ,0 ,12 );break ;
@@ -996,6 +981,7 @@ void clock_early_init(void)break ;case CLOCK_OSC_FREQ_13_0 :/* OSC is 13Mhz */ +case CLOCK_OSC_FREQ_16_8 :/* OSC is 16.8Mhz */ clock_set_rate (CLOCK_ID_CGENERAL ,600 ,13 ,0 ,8 );clock_set_rate (CLOCK_ID_DISPLAY ,925 ,13 ,0 ,12 );break ;
arch/arm/mach-tegra/tegra30/clock.c +2 -8
@@ -439,8 +439,7 @@ struct clk_pll_info tegra_pll_info_table[CLOCK_ID_PLL_COUNT] = {/* * Get the oscillator frequency, from the corresponding hardware configuration -* field. Note that T30 supports 3 new higher freqs, but we map back -* to the old T20 freqs. Support for the higher oscillators is TBD. +* field. Note that T30+ supports 3 new higher freqs. */ enum clock_osc_freq clock_get_osc_freq (void ) {
@@ -449,12 +448,7 @@ enum clock_osc_freq clock_get_osc_freq(void)u32 reg; reg =readl (&clkrst->crc_osc_ctrl); - reg = (reg &OSC_FREQ_MASK ) >>OSC_FREQ_SHIFT ; - -if (reg &1 )/* one of the newer freqs */ -printf ("Warning: OSC_FREQ is unsupported! (%d)\n" , reg); - -return reg >>2 ;/* Map to most common (T20) freqs */ +return (reg &OSC_FREQ_MASK ) >>OSC_FREQ_SHIFT ; }/* Returns a pointer to the clock source register for a peripheral */
drivers/usb/host/ehci-tegra.c +37 -9
79 lines not on this page · raw message
Signature · 1 line
2.37.2
PATCH v6 2/3 drivers: timer: add timer driver for ARMv7 based Tegra devices
In reply to Svyatoslav RyhelAdd timer support for T20/T30/T114 and T124 based devices. Driver is based on DM, has device tree support and can be used on SPL and early boot stage.
Arm64 Tegra according to comment in tegra-common.h uses architected timer.
---
Changed in v6:
- added paz00 tester
Changed in v5:
- added comments
Changed in v4:
- removed BOOTSTAGE ifdefs
- use early timer on boot stage unconditionally
--- drivers/timer/Kconfig | 8 +++ drivers/timer/Makefile | 1 + drivers/timer/tegra-timer.c | 126 ++++++++++++++++++++++++++++++++++++ 3 files changed, 135 insertions(+) create mode 100644 drivers/timer/tegra-timer.c
drivers/timer/Kconfig +8 -0
@@ -252,6 +252,14 @@ config STM32_TIMER Select this to enable support for the timer found on STM32 devices. +config TEGRA_TIMER + bool "Tegra timer support" + depends on TIMER + select TIMER_EARLY + help + Select this to enable support for the timer found on + Tegra devices. + config X86_TSC_TIMER bool "x86 Time-Stamp Counter (TSC) timer support" depends on TIMER && X86
drivers/timer/Makefile +1 -0
@@ -27,6 +27,7 @@ obj-$(CONFIG_SP804_TIMER) += sp804_timer.o obj-$(CONFIG_$(SPL_)SIFIVE_CLINT) += sifive_clint_timer.o obj-$(CONFIG_ARM_GLOBAL_TIMER) += arm_global_timer.o obj-$(CONFIG_STM32_TIMER) += stm32_timer.o +obj-$(CONFIG_TEGRA_TIMER) += tegra-timer.o obj-$(CONFIG_X86_TSC_TIMER) += tsc_timer.o obj-$(CONFIG_MTK_TIMER) += mtk_timer.o obj-$(CONFIG_MCHP_PIT64B_TIMER) += mchp-pit64b-timer.o
drivers/timer/tegra-timer.c new file +126 -0
126 lines not on this page · raw message
Signature · 1 line
2.37.2
PATCH v6 3/3 ARM: tegra: include timer as default option
In reply to Svyatoslav RyhelEnable TIMER as default option for all Tegra devices and enable TEGRA_TIMER for TEGRA_ARMV7_COMMON. Additionally enable SPL_TIMER if build as SPL part and drop deprecated configs from common header.
--- arch/arm/Kconfig | 1 + arch/arm/mach-tegra/Kconfig | 2 ++ include/configs/tegra-common.h | 6 ------ 3 files changed, 3 insertions(+), 6 deletions(-)
arch/arm/Kconfig +1 -0
@@ -1284,6 +1284,7 @@ config ARCH_TEGRA select GPIO_EXTRA_HEADER imply DISTRO_DEFAULTS imply FAT_WRITE + imply SPL_TIMER if SPL config ARCH_VEXPRESS64 bool "Support ARMv8 Arm Ltd. VExpress based boards and models"
arch/arm/mach-tegra/Kconfig +2 -0
@@ -56,6 +56,7 @@ config TEGRA_COMMON select MISC select OF_CONTROL select SPI + select TIMER imply CMD_DM imply CRC32_VERIFY
@@ -81,6 +82,7 @@ config TEGRA_ARMV7_COMMON select TEGRA_NO_BPMP select TEGRA_PINCTRL select TEGRA_PMC + select TEGRA_TIMER config TEGRA_ARMV8_COMMON bool "Tegra 64-bit common options"
include/configs/tegra-common.h +0 -6
@@ -15,12 +15,6 @@#include <asm/arch/tegra.h> /* get chip and board defs */ -/* Use the Tegra US timer on ARMv7, but the architected timer on ARMv8. */ -#ifndef CONFIG_ARM64 -#define CFG_SYS_TIMER_RATE 1000000 -#define CFG_SYS_TIMER_COUNTER NV_PA_TMRUS_BASE -#endif -/* Environment */ /*
Signature · 1 line
2.37.2
Quoted 16 lines · Svyatoslav Ryhel
- ARM: tegra: remap
clock_osc_freqfor all Tegra family Enumclock_osc_freqwas designed to use only with T20. This patch remaps it to use additional frequencies, added in T30+ SoC while maintaining backwards compatibility with T20.- drivers: timer: add timer driver for ARMv7 based Tegra devices Add timer support for T20/T30/T114 and T124 based devices. Driver is based on DM, has device tree support and can be used on SPL and early boot stage.
- ARM: tegra: include timer as default option Enable TIMER as default option for all Tegra devices and enable
TEGRA_TIMERforTEGRA_ARMV7_COMMON. Additionally enableSPL_TIMERif build as SPL part and drop deprecated configs from common header.
Quoted 8 lines
P. S. I have no arm64 Tegra and according to comment in
tegra-common.h
Use the Tegra US timer on ARMv7, but the architected timer on ARMv8.Svyatoslav Ryhel (3):
ARM: tegra: remapclock_osc_freqfor all Tegra family
drivers: timer: add timer driver for ARMv7 based Tegra devices
ARM: tegra: include timer as default option
This causes a regression on Tegra210 (Jetson TX1). I'm trying to investigate, but it's complicated by the fact that I'm not getting out any debug prints, so I suspect the issue is happening quite early.
Thierry
Quoted 22 lines
arch/arm/Kconfig | 1 + arch/arm/include/asm/arch-tegra/clock.h | 9 +- arch/arm/mach-tegra/Kconfig | 2 + arch/arm/mach-tegra/clock.c | 17 +++- arch/arm/mach-tegra/cpu.c | 70 ++++++++++--- arch/arm/mach-tegra/tegra114/clock.c | 13 +-- arch/arm/mach-tegra/tegra124/clock.c | 13 +-- arch/arm/mach-tegra/tegra20/clock.c | 4 +- arch/arm/mach-tegra/tegra210/clock.c | 22 +---- arch/arm/mach-tegra/tegra30/clock.c | 10 +- drivers/timer/Kconfig | 8 ++ drivers/timer/Makefile | 1 + drivers/timer/tegra-timer.c | 126 ++++++++++++++++++++++++ drivers/usb/host/ehci-tegra.c | 46 +++++++-- include/configs/tegra-common.h | 6 -- 15 files changed, 269 insertions(+), 79 deletions(-) create mode 100644 drivers/timer/tegra-timer.cSignature · 1 line
2.37.2
Thierry Reding
Tested-byQuoted 21 lines · Thierry Reding
Quoted 20 lines · Svyatoslav Ryhel
- ARM: tegra: remap
clock_osc_freqfor all Tegra family Enumclock_osc_freqwas designed to use only with T20. This patch remaps it to use additional frequencies, added in T30+ SoC while maintaining backwards compatibility with T20.- drivers: timer: add timer driver for ARMv7 based Tegra devices Add timer support for T20/T30/T114 and T124 based devices. Driver is based on DM, has device tree support and can be used on SPL and early boot stage.
- ARM: tegra: include timer as default option Enable TIMER as default option for all Tegra devices and enable
TEGRA_TIMERforTEGRA_ARMV7_COMMON. Additionally enableSPL_TIMERif build as SPL part and drop deprecated configs from common header.P. S. I have no arm64 Tegra and according to comment in
tegra-common.h
Use the Tegra US timer on ARMv7, but the architected timer on ARMv8.
Quoted 8 lines
Quoted 4 lines
Svyatoslav Ryhel (3):
ARM: tegra: remapclock_osc_freqfor all Tegra family
drivers: timer: add timer driver for ARMv7 based Tegra devices
ARM: tegra: include timer as default optionThis causes a regression on Tegra210 (Jetson TX1). I'm trying to investigate, but it's complicated by the fact that I'm not getting out any debug prints, so I suspect the issue is happening quite early.
Alright, I managed to make this work on Tegra210 using the following patch on top of this series:
--- >8 ---
arch/arm/dts/tegra210.dtsi +1 -1
@@ -318,7 +318,7 @@ }; timer@60005000 { - compatible = "nvidia,tegra210-timer", "nvidia,tegra20-timer"; + compatible = "nvidia,tegra210-timer", "nvidia,tegra30-timer", "nvidia,tegra20-timer"; reg = <0x0 0x60005000 0x0 0x400>; interrupts = <GIC_SPI 0 IRQ_TYPE_LEVEL_HIGH>, <GIC_SPI 1 IRQ_TYPE_LEVEL_HIGH>,
arch/arm/mach-tegra/Kconfig +1 -0
@@ -136,6 +136,7 @@ config TEGRA210 select TEGRA_PINCTRL select TEGRA_PMC select TEGRA_PMC_SECURE + select TEGRA_TIMER config TEGRA186 bool "Tegra186 family"
drivers/timer/tegra-timer.c +11 -2
@@ -58,17 +58,26 @@ static notrace u64 tegra_timer_get_count(struct udevice *dev)static int tegra_timer_probe (struct udevice *dev) {struct timer_dev_priv *uc_priv =dev_get_uclass_priv (dev); +enum clock_osc_freq freq;u32 usec_config, value;/* Timer rate has to be set unconditionally */ uc_priv->clock_rate =TEGRA_TIMER_RATE ; +/* +* The microsecond timer runs off of clk_m on Tegra210, and clk_m +* runs at half the OSC, so fake this up. +*/ + freq =clock_get_osc_freq (); +if (freq ==CLOCK_OSC_FREQ_38_4 ) + freq =CLOCK_OSC_FREQ_19_2 ; +/* * Configure microsecond timers to have 1MHz clock * Config register is 0xqqww, where qq is "dividend", ww is "divisor" * Uses n+1 scheme */ -switch (clock_get_osc_freq ()) { +switch (freq) {case CLOCK_OSC_FREQ_13_0 : usec_config =0x000c ;/* (12+1)/(0+1) */ break ;
@@ -113,6 +122,7 @@ static const struct udevice_id tegra_timer_ids[] = { { .compatible = "nvidia,tegra30-timer" }, { .compatible = "nvidia,tegra114-timer" }, { .compatible = "nvidia,tegra124-timer" }, + { .compatible = "nvidia,tegra210-timer" }, { } }; --- >8 ---
I've also tested this on Tegra186, though no additional changes were needed since Tegra186 doesn't use the Tegra timer.
With the above folded in, the series is:
Quoted 101 lines · Thierry Reding
Quoted 21 lines · Thierry Reding
Quoted 20 lines · Svyatoslav Ryhel
- ARM: tegra: remap
clock_osc_freqfor all Tegra family Enumclock_osc_freqwas designed to use only with T20. This patch remaps it to use additional frequencies, added in T30+ SoC while maintaining backwards compatibility with T20.- drivers: timer: add timer driver for ARMv7 based Tegra devices Add timer support for T20/T30/T114 and T124 based devices. Driver is based on DM, has device tree support and can be used on SPL and early boot stage.
- ARM: tegra: include timer as default option Enable TIMER as default option for all Tegra devices and enable
TEGRA_TIMERforTEGRA_ARMV7_COMMON. Additionally enableSPL_TIMERif build as SPL part and drop deprecated configs from common header.P. S. I have no arm64 Tegra and according to comment in
tegra-common.h
Use the Tegra US timer on ARMv7, but the architected timer on ARMv8.Quoted 8 lines
Quoted 4 lines
Svyatoslav Ryhel (3):
ARM: tegra: remapclock_osc_freqfor all Tegra family
drivers: timer: add timer driver for ARMv7 based Tegra devices
ARM: tegra: include timer as default optionThis causes a regression on Tegra210 (Jetson TX1). I'm trying to investigate, but it's complicated by the fact that I'm not getting out any debug prints, so I suspect the issue is happening quite early.
Alright, I managed to make this work on Tegra210 using the following patch on top of this series:
--- >8 ---
arch/arm/dts/tegra210.dtsi +1
-1@@ -318,7 +318,7 @@ }; timer@60005000 { - compatible = "nvidia,tegra210-timer", "nvidia,tegra20-timer"; + compatible = "nvidia,tegra210-timer", "nvidia,tegra30-timer", "nvidia,tegra20-timer"; reg = <0x0 0x60005000 0x0 0x400>; interrupts = <GIC_SPI 0 IRQ_TYPE_LEVEL_HIGH>, <GIC_SPI 1 IRQ_TYPE_LEVEL_HIGH>,arch/arm/mach-tegra/Kconfig +1
-0@@ -136,6 +136,7 @@ config TEGRA210 select TEGRA_PINCTRL select TEGRA_PMC select TEGRA_PMC_SECURE + select TEGRA_TIMER config TEGRA186 bool "Tegra186 family"drivers/timer/tegra-timer.c +11
-2@@ -58,17 +58,26 @@ static notrace u64 tegra_timer_get_count(struct udevice *dev)static int tegra_timer_probe (struct udevice *dev) {struct timer_dev_priv *uc_priv =dev_get_uclass_priv (dev); +enum clock_osc_freq freq;u32 usec_config, value;/* Timer rate has to be set unconditionally */ uc_priv->clock_rate =TEGRA_TIMER_RATE ; +/* +* The microsecond timer runs off of clk_m on Tegra210, and clk_m +* runs at half the OSC, so fake this up. +*/ + freq =clock_get_osc_freq (); +if (freq ==CLOCK_OSC_FREQ_38_4 ) + freq =CLOCK_OSC_FREQ_19_2 ; +/* * Configure microsecond timers to have 1MHz clock * Config register is 0xqqww, where qq is "dividend", ww is "divisor" * Uses n+1 scheme */ -switch (clock_get_osc_freq ()) { +switch (freq) {case CLOCK_OSC_FREQ_13_0 : usec_config =0x000c ;/* (12+1)/(0+1) */ break ;@@ -113,6 +122,7 @@ static const struct udevice_id tegra_timer_ids[] = { { .compatible = "nvidia,tegra30-timer" }, { .compatible = "nvidia,tegra114-timer" }, { .compatible = "nvidia,tegra124-timer" }, + { .compatible = "nvidia,tegra210-timer" }, { } }; --- >8 ---
Quoted 6 lines
I've also tested this on Tegra186, though no additional changes were needed since Tegra186 doesn't use the Tegra timer.
With the above folded in, the series is:
Tested-by Thierry Reding <[email protected]>
I've also tested your series with the above on Tegra30 (Beaver) and Tegra124 (Jetson TK1), both seem to work fine.
Thierry
Thanks for testing T210/T186, Thierry.
I had Svyatoslav's patches ready to go for a PR yesterday, so I'll need either a patch from you for the T210 changes that I can apply on top of his, or I'll need Svyatoslav to adopt your changes as a 4th patch in his series. Once I have that and can pass buildman OK, I'll be ready to send a PR to TomR.
Tom
-----Original Message-----
From: Thierry Reding <[email protected]>
Sent: Thursday, January 26, 2023 4:41 AM
To: Svyatoslav Ryhel <[email protected]>
Cc: Rayagonda Kokatanur <[email protected]>; Tom Warren <[email protected]>; Marek Vasut <[email protected]>; Maxim Schwalm <[email protected]>; Dmitry Osipenko <[email protected]>; Heinrich Schuchardt <[email protected]>; Michal Simek <[email protected]>; Stefan Roese <[email protected]>; Eugen Hristev <[email protected]>; Michael Walle <[email protected]>; Simon Glass <[email protected]>; Jim Liu <[email protected]>; William Zhang <[email protected]>; Rick Chen <[email protected]>; Stefan Herbrechtsmeier <[email protected]>; Andre Przywara <[email protected]>; Jaehoon Chung <[email protected]>; [email protected]
Subject: Re: [PATCH v6 0/3] Timer support for ARM Tegra
Quoted 100 lines · Thierry Reding
Quoted 20 lines · Thierry Reding
Quoted 19 lines · Svyatoslav Ryhel
- ARM: tegra: remap
clock_osc_freqfor all Tegra family Enumclock_osc_freqwas designed to use only with T20. This patch remaps it to use additional frequencies, added in T30+ SoC while maintaining backwards compatibility with T20.- drivers: timer: add timer driver for ARMv7 based Tegra devices Add timer support for T20/T30/T114 and T124 based devices. Driver is based on DM, has device tree support and can be used on SPL and early boot stage.
- ARM: tegra: include timer as default option Enable TIMER as default option for all Tegra devices and enable
TEGRA_TIMERforTEGRA_ARMV7_COMMON. Additionally enableSPL_TIMERif build as SPL part and drop deprecated configs from common header.P. S. I have no arm64 Tegra and according to comment in
tegra-common.hUse the Tegra US timer on ARMv7, but the architected timer on ARMv8.Quoted 8 lines
Quoted 4 lines
Svyatoslav Ryhel (3):
ARM: tegra: remapclock_osc_freqfor all Tegra family
drivers: timer: add timer driver for ARMv7 based Tegra devices
ARM: tegra: include timer as default optionThis causes a regression on Tegra210 (Jetson TX1). I'm trying to investigate, but it's complicated by the fact that I'm not getting out any debug prints, so I suspect the issue is happening quite early.
Alright, I managed to make this work on Tegra210 using the following patch on top of this series:
--- >8 ---
arch/arm/dts/tegra210.dtsi +2
-1@@ -318,7 +318,7 @@ }; timer@60005000 { - compatible = "nvidia,tegra210-timer", "nvidia,tegra20-timer"; + compatible = "nvidia,tegra210-timer", "nvidia,tegra30-timer", +"nvidia,tegra20-timer"; reg = <0x0 0x60005000 0x0 0x400>; interrupts = <GIC_SPI 0 IRQ_TYPE_LEVEL_HIGH>, <GIC_SPI 1 IRQ_TYPE_LEVEL_HIGH>, diff --gita/arch/arm/mach-tegra/Kconfig b/arch/arm/mach-tegra/Kconfig index
cc3f00e50128..b50eec5b8c9b100644arch/arm/mach-tegra/Kconfig +1
-0@@ -136,6 +136,7 @@ config TEGRA210 select TEGRA_PINCTRL select TEGRA_PMC select TEGRA_PMC_SECURE + select TEGRA_TIMER config TEGRA186 bool "Tegra186 family"drivers/timer/tegra-timer.c +11
-2@@ -58,17 +58,26 @@ static notrace u64 tegra_timer_get_count(struct udevice *dev) static int tegra_timer_probe(struct udevice *dev) {struct timer_dev_priv *uc_priv =dev_get_uclass_priv (dev); +enum clock_osc_freq freq;u32 usec_config, value;/* Timer rate has to be set unconditionally */ uc_priv->clock_rate =TEGRA_TIMER_RATE ; +/* +* The microsecond timer runs off of clk_m on Tegra210, and clk_m +* runs at half the OSC, so fake this up. +*/ + freq =clock_get_osc_freq (); +if (freq ==CLOCK_OSC_FREQ_38_4 ) + freq =CLOCK_OSC_FREQ_19_2 ; +/* * Configure microsecond timers to have 1MHz clock * Config register is 0xqqww, where qq is "dividend", ww is "divisor" * Uses n+1 scheme */ -switch (clock_get_osc_freq ()) { +switch (freq) {case CLOCK_OSC_FREQ_13_0 : usec_config =0x000c ;/* (12+1)/(0+1) */ break ;@@ -113,6 +122,7 @@ static const struct udevice_id tegra_timer_ids[] = { { .compatible = "nvidia,tegra30-timer" }, { .compatible = "nvidia,tegra114-timer" }, { .compatible = "nvidia,tegra124-timer" }, + { .compatible = "nvidia,tegra210-timer" }, { } }; --- >8 ---
Quoted 6 lines
I've also tested this on Tegra186, though no additional changes were needed since Tegra186 doesn't use the Tegra timer.
With the above folded in, the series is:
Tested-by Thierry Reding <[email protected]>
I've also tested your series with the above on Tegra30 (Beaver) and Tegra124 (Jetson TK1), both seem to work fine.
Thierry
I may implement changes of Thierry Reding in a proper form as a separate patch or include in existing (depends on his choice). The only thing I need to know is if ALL known T210 devices use 19.2MHz as calibration clock for timer?
Best regards.
Svyatoslav R.
чт, 26 січ. 2023 р. о 18:50 Tom Warren <[email protected]> пише:
Quoted 126 lines
Thanks for testing T210/T186, Thierry.
I had Svyatoslav's patches ready to go for a PR yesterday, so I'll need either a patch from you for the T210 changes that I can apply on top of his, or I'll need Svyatoslav to adopt your changes as a 4th patch in his series. Once I have that and can pass buildman OK, I'll be ready to send a PR to TomR.
Tom
-----Original Message-----
From: Thierry Reding <[email protected]>
Sent: Thursday, January 26, 2023 4:41 AM
To: Svyatoslav Ryhel <[email protected]>
Cc: Rayagonda Kokatanur <[email protected]>; Tom Warren <[email protected]>; Marek Vasut <[email protected]>; Maxim Schwalm <[email protected]>; Dmitry Osipenko <[email protected]>; Heinrich Schuchardt <[email protected]>; Michal Simek <[email protected]>; Stefan Roese <[email protected]>; Eugen Hristev <[email protected]>; Michael Walle <[email protected]>; Simon Glass <[email protected]>; Jim Liu <[email protected]>; William Zhang <[email protected]>; Rick Chen <[email protected]>; Stefan Herbrechtsmeier <[email protected]>; Andre Przywara <[email protected]>; Jaehoon Chung <[email protected]>; [email protected]
Subject: Re: [PATCH v6 0/3] Timer support for ARM TegraQuoted 100 lines · Thierry Reding
Quoted 20 lines · Thierry Reding
Quoted 19 lines · Svyatoslav Ryhel
- ARM: tegra: remap
clock_osc_freqfor all Tegra family Enumclock_osc_freqwas designed to use only with T20. This patch remaps it to use additional frequencies, added in T30+ SoC while maintaining backwards compatibility with T20.- drivers: timer: add timer driver for ARMv7 based Tegra devices Add timer support for T20/T30/T114 and T124 based devices. Driver is based on DM, has device tree support and can be used on SPL and early boot stage.
- ARM: tegra: include timer as default option Enable TIMER as default option for all Tegra devices and enable
TEGRA_TIMERforTEGRA_ARMV7_COMMON. Additionally enableSPL_TIMERif build as SPL part and drop deprecated configs from common header.P. S. I have no arm64 Tegra and according to comment in
tegra-common.hUse the Tegra US timer on ARMv7, but the architected timer on ARMv8.Quoted 8 lines
Quoted 4 lines
Svyatoslav Ryhel (3):
ARM: tegra: remapclock_osc_freqfor all Tegra family
drivers: timer: add timer driver for ARMv7 based Tegra devices
ARM: tegra: include timer as default optionThis causes a regression on Tegra210 (Jetson TX1). I'm trying to investigate, but it's complicated by the fact that I'm not getting out any debug prints, so I suspect the issue is happening quite early.
Alright, I managed to make this work on Tegra210 using the following patch on top of this series:
--- >8 ---
arch/arm/dts/tegra210.dtsi +2
-1@@ -318,7 +318,7 @@ }; timer@60005000 { - compatible = "nvidia,tegra210-timer", "nvidia,tegra20-timer"; + compatible = "nvidia,tegra210-timer", "nvidia,tegra30-timer", +"nvidia,tegra20-timer"; reg = <0x0 0x60005000 0x0 0x400>; interrupts = <GIC_SPI 0 IRQ_TYPE_LEVEL_HIGH>, <GIC_SPI 1 IRQ_TYPE_LEVEL_HIGH>, diff --gita/arch/arm/mach-tegra/Kconfig b/arch/arm/mach-tegra/Kconfig index
cc3f00e50128..b50eec5b8c9b100644arch/arm/mach-tegra/Kconfig +1
-0@@ -136,6 +136,7 @@ config TEGRA210 select TEGRA_PINCTRL select TEGRA_PMC select TEGRA_PMC_SECURE + select TEGRA_TIMER config TEGRA186 bool "Tegra186 family"drivers/timer/tegra-timer.c +11
-2@@ -58,17 +58,26 @@ static notrace u64 tegra_timer_get_count(struct udevice *dev) static int tegra_timer_probe(struct udevice *dev) {struct timer_dev_priv *uc_priv =dev_get_uclass_priv (dev); +enum clock_osc_freq freq;u32 usec_config, value;/* Timer rate has to be set unconditionally */ uc_priv->clock_rate =TEGRA_TIMER_RATE ; +/* +* The microsecond timer runs off of clk_m on Tegra210, and clk_m +* runs at half the OSC, so fake this up. +*/ + freq =clock_get_osc_freq (); +if (freq ==CLOCK_OSC_FREQ_38_4 ) + freq =CLOCK_OSC_FREQ_19_2 ; +/* * Configure microsecond timers to have 1MHz clock * Config register is 0xqqww, where qq is "dividend", ww is "divisor" * Uses n+1 scheme */ -switch (clock_get_osc_freq ()) { +switch (freq) {case CLOCK_OSC_FREQ_13_0 : usec_config =0x000c ;/* (12+1)/(0+1) */ break ;@@ -113,6 +122,7 @@ static const struct udevice_id tegra_timer_ids[] = { { .compatible = "nvidia,tegra30-timer" }, { .compatible = "nvidia,tegra114-timer" }, { .compatible = "nvidia,tegra124-timer" }, + { .compatible = "nvidia,tegra210-timer" }, { } }; --- >8 ---Quoted 6 lines
I've also tested this on Tegra186, though no additional changes were needed since Tegra186 doesn't use the Tegra timer.
With the above folded in, the series is:
Tested-by Thierry Reding <[email protected]>I've also tested your series with the above on Tegra30 (Beaver) and Tegra124 (Jetson TK1), both seem to work fine.
Thierry
Quoted 2 lines · Svyatoslav Ryhel
I may implement changes of Thierry Reding in a proper form as a separate patch or include in existing (depends on his choice).
I think it's ultimately better if this is properly integrated into the series because the series would remain bisectible.
If the existing series is applied as-is, we have a few patches in the middle during which Tegra210 is unusable. So if we ever have to track down a regression that might be problematic.
It's not a big deal since we've rarely had regressions in U-Boot. It's ultimately up to Tom to decide how he wants to handle this.
If you send out another series, can you please add me on Cc so I don't miss it?
Thanks,
Thierry
Quoted 133 lines
The only thing I need to know is if ALL known T210 devices use 19.2MHz as calibration clock for timer?
Best regards.
Svyatoslav R.чт, 26 січ. 2023 р. о 18:50 Tom Warren <[email protected]> пише:
Quoted 126 lines
Thanks for testing T210/T186, Thierry.
I had Svyatoslav's patches ready to go for a PR yesterday, so I'll need either a patch from you for the T210 changes that I can apply on top of his, or I'll need Svyatoslav to adopt your changes as a 4th patch in his series. Once I have that and can pass buildman OK, I'll be ready to send a PR to TomR.
Tom
-----Original Message-----
From: Thierry Reding <[email protected]>
Sent: Thursday, January 26, 2023 4:41 AM
To: Svyatoslav Ryhel <[email protected]>
Cc: Rayagonda Kokatanur <[email protected]>; Tom Warren <[email protected]>; Marek Vasut <[email protected]>; Maxim Schwalm <[email protected]>; Dmitry Osipenko <[email protected]>; Heinrich Schuchardt <[email protected]>; Michal Simek <[email protected]>; Stefan Roese <[email protected]>; Eugen Hristev <[email protected]>; Michael Walle <[email protected]>; Simon Glass <[email protected]>; Jim Liu <[email protected]>; William Zhang <[email protected]>; Rick Chen <[email protected]>; Stefan Herbrechtsmeier <[email protected]>; Andre Przywara <[email protected]>; Jaehoon Chung <[email protected]>; [email protected]
Subject: Re: [PATCH v6 0/3] Timer support for ARM TegraQuoted 100 lines · Thierry Reding
Quoted 20 lines · Thierry Reding
Quoted 19 lines · Svyatoslav Ryhel
- ARM: tegra: remap
clock_osc_freqfor all Tegra family Enumclock_osc_freqwas designed to use only with T20. This patch remaps it to use additional frequencies, added in T30+ SoC while maintaining backwards compatibility with T20.- drivers: timer: add timer driver for ARMv7 based Tegra devices Add timer support for T20/T30/T114 and T124 based devices. Driver is based on DM, has device tree support and can be used on SPL and early boot stage.
- ARM: tegra: include timer as default option Enable TIMER as default option for all Tegra devices and enable
TEGRA_TIMERforTEGRA_ARMV7_COMMON. Additionally enableSPL_TIMERif build as SPL part and drop deprecated configs from common header.P. S. I have no arm64 Tegra and according to comment in
tegra-common.hUse the Tegra US timer on ARMv7, but the architected timer on ARMv8.Quoted 8 lines
Quoted 4 lines
Svyatoslav Ryhel (3):
ARM: tegra: remapclock_osc_freqfor all Tegra family
drivers: timer: add timer driver for ARMv7 based Tegra devices
ARM: tegra: include timer as default optionThis causes a regression on Tegra210 (Jetson TX1). I'm trying to investigate, but it's complicated by the fact that I'm not getting out any debug prints, so I suspect the issue is happening quite early.
Alright, I managed to make this work on Tegra210 using the following patch on top of this series:
--- >8 ---
arch/arm/dts/tegra210.dtsi +2
-1@@ -318,7 +318,7 @@ }; timer@60005000 { - compatible = "nvidia,tegra210-timer", "nvidia,tegra20-timer"; + compatible = "nvidia,tegra210-timer", "nvidia,tegra30-timer", +"nvidia,tegra20-timer"; reg = <0x0 0x60005000 0x0 0x400>; interrupts = <GIC_SPI 0 IRQ_TYPE_LEVEL_HIGH>, <GIC_SPI 1 IRQ_TYPE_LEVEL_HIGH>, diff --gita/arch/arm/mach-tegra/Kconfig b/arch/arm/mach-tegra/Kconfig index
cc3f00e50128..b50eec5b8c9b100644arch/arm/mach-tegra/Kconfig +1
-0@@ -136,6 +136,7 @@ config TEGRA210 select TEGRA_PINCTRL select TEGRA_PMC select TEGRA_PMC_SECURE + select TEGRA_TIMER config TEGRA186 bool "Tegra186 family"drivers/timer/tegra-timer.c +11
-2@@ -58,17 +58,26 @@ static notrace u64 tegra_timer_get_count(struct udevice *dev) static int tegra_timer_probe(struct udevice *dev) {struct timer_dev_priv *uc_priv =dev_get_uclass_priv (dev); +enum clock_osc_freq freq;u32 usec_config, value;/* Timer rate has to be set unconditionally */ uc_priv->clock_rate =TEGRA_TIMER_RATE ; +/* +* The microsecond timer runs off of clk_m on Tegra210, and clk_m +* runs at half the OSC, so fake this up. +*/ + freq =clock_get_osc_freq (); +if (freq ==CLOCK_OSC_FREQ_38_4 ) + freq =CLOCK_OSC_FREQ_19_2 ; +/* * Configure microsecond timers to have 1MHz clock * Config register is 0xqqww, where qq is "dividend", ww is "divisor" * Uses n+1 scheme */ -switch (clock_get_osc_freq ()) { +switch (freq) {case CLOCK_OSC_FREQ_13_0 : usec_config =0x000c ;/* (12+1)/(0+1) */ break ;@@ -113,6 +122,7 @@ static const struct udevice_id tegra_timer_ids[] = { { .compatible = "nvidia,tegra30-timer" }, { .compatible = "nvidia,tegra114-timer" }, { .compatible = "nvidia,tegra124-timer" }, + { .compatible = "nvidia,tegra210-timer" }, { } }; --- >8 ---Quoted 6 lines
I've also tested this on Tegra186, though no additional changes were needed since Tegra186 doesn't use the Tegra timer.
With the above folded in, the series is:
Tested-by Thierry Reding <[email protected]>I've also tested your series with the above on Tegra30 (Beaver) and Tegra124 (Jetson TK1), both seem to work fine.
Thierry
чт, 26 січ. 2023 р. о 19:58 Thierry Reding <[email protected]> пише:
Quoted 12 lines · Svyatoslav Ryhel
Quoted 2 lines
I may implement changes of Thierry Reding in a proper form as a separate patch or include in existing (depends on his choice).
I think it's ultimately better if this is properly integrated into the series because the series would remain bisectible.
If the existing series is applied as-is, we have a few patches in the middle during which Tegra210 is unusable. So if we ever have to track down a regression that might be problematic.
Quoted 8 lines
It's not a big deal since we've rarely had regressions in U-Boot. It's ultimately up to Tom to decide how he wants to handle this.
If you send out another series, can you please add me on Cc so I don't miss it?
Thanks,
Thierry
Thierry Reding thanks for your clarification. If you and Tom Warren are ok, I will modify existing patches and send them as v7 in final form. Then you can check if T210 works as intended and if everything is correct. We can apply it.
P. S. You may be sure that I will include you in all my patches for u-boot since it is explicitly hard to find a person with boards you own.
Best Regards.
Svyatoslav R.
Quoted 133 lines
Quoted 133 lines
The only thing I need to know is if ALL known T210 devices use 19.2MHz as calibration clock for timer?
Best regards.
Svyatoslav R.чт, 26 січ. 2023 р. о 18:50 Tom Warren <[email protected]> пише:
Quoted 126 lines
Thanks for testing T210/T186, Thierry.
I had Svyatoslav's patches ready to go for a PR yesterday, so I'll need either a patch from you for the T210 changes that I can apply on top of his, or I'll need Svyatoslav to adopt your changes as a 4th patch in his series. Once I have that and can pass buildman OK, I'll be ready to send a PR to TomR.
Tom
-----Original Message-----
From: Thierry Reding <[email protected]>
Sent: Thursday, January 26, 2023 4:41 AM
To: Svyatoslav Ryhel <[email protected]>
Cc: Rayagonda Kokatanur <[email protected]>; Tom Warren <[email protected]>; Marek Vasut <[email protected]>; Maxim Schwalm <[email protected]>; Dmitry Osipenko <[email protected]>; Heinrich Schuchardt <[email protected]>; Michal Simek <[email protected]>; Stefan Roese <[email protected]>; Eugen Hristev <[email protected]>; Michael Walle <[email protected]>; Simon Glass <[email protected]>; Jim Liu <[email protected]>; William Zhang <[email protected]>; Rick Chen <[email protected]>; Stefan Herbrechtsmeier <[email protected]>; Andre Przywara <[email protected]>; Jaehoon Chung <[email protected]>; [email protected]
Subject: Re: [PATCH v6 0/3] Timer support for ARM TegraQuoted 100 lines · Thierry Reding
Quoted 20 lines · Thierry Reding
Quoted 19 lines · Svyatoslav Ryhel
- ARM: tegra: remap
clock_osc_freqfor all Tegra family Enumclock_osc_freqwas designed to use only with T20. This patch remaps it to use additional frequencies, added in T30+ SoC while maintaining backwards compatibility with T20.- drivers: timer: add timer driver for ARMv7 based Tegra devices Add timer support for T20/T30/T114 and T124 based devices. Driver is based on DM, has device tree support and can be used on SPL and early boot stage.
- ARM: tegra: include timer as default option Enable TIMER as default option for all Tegra devices and enable
TEGRA_TIMERforTEGRA_ARMV7_COMMON. Additionally enableSPL_TIMERif build as SPL part and drop deprecated configs from common header.P. S. I have no arm64 Tegra and according to comment in
tegra-common.hUse the Tegra US timer on ARMv7, but the architected timer on ARMv8.Quoted 8 lines
Quoted 4 lines
Svyatoslav Ryhel (3):
ARM: tegra: remapclock_osc_freqfor all Tegra family
drivers: timer: add timer driver for ARMv7 based Tegra devices
ARM: tegra: include timer as default optionThis causes a regression on Tegra210 (Jetson TX1). I'm trying to investigate, but it's complicated by the fact that I'm not getting out any debug prints, so I suspect the issue is happening quite early.
Alright, I managed to make this work on Tegra210 using the following patch on top of this series:
--- >8 ---
arch/arm/dts/tegra210.dtsi +2
-1@@ -318,7 +318,7 @@ }; timer@60005000 { - compatible = "nvidia,tegra210-timer", "nvidia,tegra20-timer"; + compatible = "nvidia,tegra210-timer", "nvidia,tegra30-timer", +"nvidia,tegra20-timer"; reg = <0x0 0x60005000 0x0 0x400>; interrupts = <GIC_SPI 0 IRQ_TYPE_LEVEL_HIGH>, <GIC_SPI 1 IRQ_TYPE_LEVEL_HIGH>, diff --gita/arch/arm/mach-tegra/Kconfig b/arch/arm/mach-tegra/Kconfig index
cc3f00e50128..b50eec5b8c9b100644arch/arm/mach-tegra/Kconfig +1
-0@@ -136,6 +136,7 @@ config TEGRA210 select TEGRA_PINCTRL select TEGRA_PMC select TEGRA_PMC_SECURE + select TEGRA_TIMER config TEGRA186 bool "Tegra186 family"drivers/timer/tegra-timer.c +11
-2@@ -58,17 +58,26 @@ static notrace u64 tegra_timer_get_count(struct udevice *dev) static int tegra_timer_probe(struct udevice *dev) {struct timer_dev_priv *uc_priv =dev_get_uclass_priv (dev); +enum clock_osc_freq freq;u32 usec_config, value;/* Timer rate has to be set unconditionally */ uc_priv->clock_rate =TEGRA_TIMER_RATE ; +/* +* The microsecond timer runs off of clk_m on Tegra210, and clk_m +* runs at half the OSC, so fake this up. +*/ + freq =clock_get_osc_freq (); +if (freq ==CLOCK_OSC_FREQ_38_4 ) + freq =CLOCK_OSC_FREQ_19_2 ; +/* * Configure microsecond timers to have 1MHz clock * Config register is 0xqqww, where qq is "dividend", ww is "divisor" * Uses n+1 scheme */ -switch (clock_get_osc_freq ()) { +switch (freq) {case CLOCK_OSC_FREQ_13_0 : usec_config =0x000c ;/* (12+1)/(0+1) */ break ;@@ -113,6 +122,7 @@ static const struct udevice_id tegra_timer_ids[] = { { .compatible = "nvidia,tegra30-timer" }, { .compatible = "nvidia,tegra114-timer" }, { .compatible = "nvidia,tegra124-timer" }, + { .compatible = "nvidia,tegra210-timer" }, { } }; --- >8 ---Quoted 6 lines
I've also tested this on Tegra186, though no additional changes were needed since Tegra186 doesn't use the Tegra timer.
With the above folded in, the series is:
Tested-by Thierry Reding <[email protected]>I've also tested your series with the above on Tegra30 (Beaver) and Tegra124 (Jetson TK1), both seem to work fine.
Thierry
Using your existing patches and generating a v7 to fix the T210 boards sounds like the right approach to me.
Tom
-----Original Message-----
From: Svyatoslav Ryhel <[email protected]>
Sent: Thursday, January 26, 2023 11:11 AM
To: Thierry Reding <[email protected]>
Cc: Tom Warren <[email protected]>; Rayagonda Kokatanur <[email protected]>; Marek Vasut <[email protected]>; Maxim Schwalm <[email protected]>; Dmitry Osipenko <[email protected]>; Heinrich Schuchardt <[email protected]>; Michal Simek <[email protected]>; Stefan Roese <[email protected]>; Eugen Hristev <[email protected]>; Michael Walle <[email protected]>; Simon Glass <[email protected]>; Jim Liu <[email protected]>; William Zhang <[email protected]>; Rick Chen <[email protected]>; Stefan Herbrechtsmeier <[email protected]>; Andre Przywara <[email protected]>; Jaehoon Chung <[email protected]>; [email protected]
Subject: Re: [PATCH v6 0/3] Timer support for ARM Tegra
External email: Use caution opening links or attachments
чт, 26 січ. 2023 р. о 19:58 Thierry Reding <[email protected]> пише:
Quoted 12 lines · Svyatoslav Ryhel
Quoted 2 lines
I may implement changes of Thierry Reding in a proper form as a separate patch or include in existing (depends on his choice).
I think it's ultimately better if this is properly integrated into the series because the series would remain bisectible.
If the existing series is applied as-is, we have a few patches in the middle during which Tegra210 is unusable. So if we ever have to track down a regression that might be problematic.
Quoted 8 lines
It's not a big deal since we've rarely had regressions in U-Boot. It's ultimately up to Tom to decide how he wants to handle this.
If you send out another series, can you please add me on Cc so I don't miss it?
Thanks,
Thierry
Thierry Reding thanks for your clarification. If you and Tom Warren are ok, I will modify existing patches and send them as v7 in final form. Then you can check if T210 works as intended and if everything is correct. We can apply it.
P. S. You may be sure that I will include you in all my patches for u-boot since it is explicitly hard to find a person with boards you own.
Best Regards.
Svyatoslav R.
Quoted 148 lines
Quoted 148 lines
The only thing I need to know is if ALL known T210 devices use 19.2MHz as calibration clock for timer?
Best regards.
Svyatoslav R.чт, 26 січ. 2023 р. о 18:50 Tom Warren <[email protected]> пише:
Quoted 141 lines
Thanks for testing T210/T186, Thierry.
I had Svyatoslav's patches ready to go for a PR yesterday, so I'll need either a patch from you for the T210 changes that I can apply on top of his, or I'll need Svyatoslav to adopt your changes as a 4th patch in his series. Once I have that and can pass buildman OK, I'll be ready to send a PR to TomR.
Tom
-----Original Message-----
From: Thierry Reding <[email protected]>
Sent: Thursday, January 26, 2023 4:41 AM
To: Svyatoslav Ryhel <[email protected]>
Cc: Rayagonda Kokatanur <[email protected]>; Tom Warren <[email protected]>; Marek Vasut <[email protected]>; Maxim Schwalm <[email protected]>; Dmitry Osipenko <[email protected]>; Heinrich Schuchardt <[email protected]>; Michal Simek <[email protected]>; Stefan Roese <[email protected]>; Eugen Hristev <[email protected]>; Michael Walle <[email protected]>; Simon Glass <[email protected]>; Jim Liu <[email protected]>; William Zhang <[email protected]>; Rick Chen <[email protected]>; Stefan Herbrechtsmeier <[email protected]>; Andre Przywara <[email protected]>; Jaehoon Chung <[email protected]>; [email protected]
Subject: Re: [PATCH v6 0/3] Timer support for ARM TegraQuoted 103 lines · Thierry Reding
Quoted 20 lines · Thierry Reding
Quoted 19 lines · Svyatoslav Ryhel
- ARM: tegra: remap
clock_osc_freqfor all Tegra family Enumclock_osc_freqwas designed to use only with T20. This patch remaps it to use additional frequencies, added in T30+ SoC while maintaining backwards compatibility with T20.- drivers: timer: add timer driver for ARMv7 based Tegra devices Add timer support for T20/T30/T114 and T124 based devices. Driver is based on DM, has device tree support and can be used on SPL and early boot stage.
- ARM: tegra: include timer as default option Enable TIMER
as default option for all Tegra devices and enableTEGRA_TIMERforTEGRA_ARMV7_COMMON. Additionally enableSPL_TIMERif build as SPL part and drop deprecated configs from common header.P. S. I have no arm64 Tegra and according to comment in
tegra-common.hUse the Tegra US timer on ARMv7, but the architected timer on ARMv8.Quoted 8 lines
Quoted 4 lines
Svyatoslav Ryhel (3):
ARM: tegra: remapclock_osc_freqfor all Tegra family
drivers: timer: add timer driver for ARMv7 based Tegra devices
ARM: tegra: include timer as default optionThis causes a regression on Tegra210 (Jetson TX1). I'm trying
to investigate, but it's complicated by the fact that I'm not getting out any debug prints, so I suspect the issue is happening quite early.Alright, I managed to make this work on Tegra210 using the following patch on top of this series:
--- >8 ---
(quoted diff) +0
-0
b/arch/arm/dts/tegra210.dtsiindexa521a43d6cfd..ccb5a927da89100644arch/arm/dts/tegra210.dtsi +2
-2@@ -318,7 +318,7 @@ }; timer@60005000 { - compatible = "nvidia,tegra210-timer", "nvidia,tegra20-timer"; + compatible = "nvidia,tegra210-timer", +"nvidia,tegra30-timer", "nvidia,tegra20-timer"; reg = <0x0 0x60005000 0x0 0x400>; interrupts = <GIC_SPI 0 IRQ_TYPE_LEVEL_HIGH>, <GIC_SPI 1 IRQ_TYPE_LEVEL_HIGH>, diff --git a/arch/arm/mach-tegra/Kconfigb/arch/arm/mach-tegra/Kconfig index
cc3f00e50128..b50eec5b8c9b100644arch/arm/mach-tegra/Kconfig +1
-0@@ -136,6 +136,7 @@ config TEGRA210 select TEGRA_PINCTRL select TEGRA_PMC select TEGRA_PMC_SECURE + select TEGRA_TIMER config TEGRA186 bool "Tegra186 family"(quoted diff) +0
-0
b/drivers/timer/tegra-timer.cindexd2d163cf3fef..235532ba8926100644drivers/timer/tegra-timer.c +11
-2@@ -58,17 +58,26 @@ static notrace u64 tegra_timer_get_count(struct udevice *dev) static int tegra_timer_probe(struct udevice *dev) {struct timer_dev_priv *uc_priv =dev_get_uclass_priv (dev); +enum clock_osc_freq freq;u32 usec_config, value;/* Timer rate has to be set unconditionally */ uc_priv->clock_rate =TEGRA_TIMER_RATE ; +/* +* The microsecond timer runs off of clk_m on Tegra210, and clk_m +* runs at half the OSC, so fake this up. +*/ + freq =clock_get_osc_freq (); +if (freq ==CLOCK_OSC_FREQ_38_4 ) + freq =CLOCK_OSC_FREQ_19_2 ; +/* * Configure microsecond timers to have 1MHz clock * Config register is 0xqqww, where qq is "dividend", ww is "divisor" * Uses n+1 scheme */ -switch (clock_get_osc_freq ()) { +switch (freq) {case CLOCK_OSC_FREQ_13_0 : usec_config =0x000c ;/* (12+1)/(0+1) */ break ;@@ -113,6 +122,7 @@ static const struct udevice_id tegra_timer_ids[] = { { .compatible = "nvidia,tegra30-timer" }, { .compatible = "nvidia,tegra114-timer" }, { .compatible = "nvidia,tegra124-timer" }, + { .compatible = "nvidia,tegra210-timer" }, { } }; --- >8 ---Quoted 6 lines
I've also tested this on Tegra186, though no additional changes were needed since Tegra186 doesn't use the Tegra timer.
With the above folded in, the series is:
Tested-by Thierry Reding <[email protected]>I've also tested your series with the above on Tegra30 (Beaver) and
Tegra124 (Jetson TK1), both seem to work fine.Thierry
I propose this solution, based on Thierry idea.
drivers/timer/tegra-timer.c +10 -0
@@ -94,6 +94,15 @@ static int tegra_timer_probe(struct udevice *dev)return -EINVAL ; } +/* +* T210 TIMERUS is calibrated using clk_m which is +* div2 of osc clock. All known T210 boards use +* 38.4 MHz osc clock which means clk_m should be +* 19.2 MHz, hence correct usec_config is applied. +*/ +if (IS_ENABLED (CONFIG_TEGRA210 )) + usec_config =0x045f ;/* (95+1)/(4+1) */ +/* Enable clock to timer hardware */ value =readl_relaxed (TEGRA_OSC_CLK_ENB_L_SET ); writel_relaxed(value | TEGRA_OSC_SET_CLK_ENB_TMR,
@@ -113,6 +122,7 @@ static const struct udevice_id tegra_timer_ids[] = { { .compatible = "nvidia,tegra30-timer" }, { .compatible = "nvidia,tegra114-timer" }, { .compatible = "nvidia,tegra124-timer" }, + { .compatible = "nvidia,tegra210-timer" }, { } };
In case if T210 board with non 38.4MHz exists we can get back to this for proper and exact fix.
Best Regards.
Svyatoslav R.
чт, 26 січ. 2023 р. о 19:58 Thierry Reding <[email protected]> пише:
Quoted 154 lines · Svyatoslav Ryhel
Quoted 2 lines
I may implement changes of Thierry Reding in a proper form as a separate patch or include in existing (depends on his choice).
I think it's ultimately better if this is properly integrated into the series because the series would remain bisectible.
If the existing series is applied as-is, we have a few patches in the middle during which Tegra210 is unusable. So if we ever have to track down a regression that might be problematic.
It's not a big deal since we've rarely had regressions in U-Boot. It's ultimately up to Tom to decide how he wants to handle this.
If you send out another series, can you please add me on Cc so I don't miss it?
Thanks,
ThierryQuoted 133 lines
The only thing I need to know is if ALL known T210 devices use 19.2MHz as calibration clock for timer?
Best regards.
Svyatoslav R.чт, 26 січ. 2023 р. о 18:50 Tom Warren <[email protected]> пише:
Quoted 126 lines
Thanks for testing T210/T186, Thierry.
I had Svyatoslav's patches ready to go for a PR yesterday, so I'll need either a patch from you for the T210 changes that I can apply on top of his, or I'll need Svyatoslav to adopt your changes as a 4th patch in his series. Once I have that and can pass buildman OK, I'll be ready to send a PR to TomR.
Tom
-----Original Message-----
From: Thierry Reding <[email protected]>
Sent: Thursday, January 26, 2023 4:41 AM
To: Svyatoslav Ryhel <[email protected]>
Cc: Rayagonda Kokatanur <[email protected]>; Tom Warren <[email protected]>; Marek Vasut <[email protected]>; Maxim Schwalm <[email protected]>; Dmitry Osipenko <[email protected]>; Heinrich Schuchardt <[email protected]>; Michal Simek <[email protected]>; Stefan Roese <[email protected]>; Eugen Hristev <[email protected]>; Michael Walle <[email protected]>; Simon Glass <[email protected]>; Jim Liu <[email protected]>; William Zhang <[email protected]>; Rick Chen <[email protected]>; Stefan Herbrechtsmeier <[email protected]>; Andre Przywara <[email protected]>; Jaehoon Chung <[email protected]>; [email protected]
Subject: Re: [PATCH v6 0/3] Timer support for ARM TegraQuoted 100 lines · Thierry Reding
Quoted 20 lines · Thierry Reding
Quoted 19 lines · Svyatoslav Ryhel
- ARM: tegra: remap
clock_osc_freqfor all Tegra family Enumclock_osc_freqwas designed to use only with T20. This patch remaps it to use additional frequencies, added in T30+ SoC while maintaining backwards compatibility with T20.- drivers: timer: add timer driver for ARMv7 based Tegra devices Add timer support for T20/T30/T114 and T124 based devices. Driver is based on DM, has device tree support and can be used on SPL and early boot stage.
- ARM: tegra: include timer as default option Enable TIMER as default option for all Tegra devices and enable
TEGRA_TIMERforTEGRA_ARMV7_COMMON. Additionally enableSPL_TIMERif build as SPL part and drop deprecated configs from common header.P. S. I have no arm64 Tegra and according to comment in
tegra-common.hUse the Tegra US timer on ARMv7, but the architected timer on ARMv8.Quoted 8 lines
Quoted 4 lines
Svyatoslav Ryhel (3):
ARM: tegra: remapclock_osc_freqfor all Tegra family
drivers: timer: add timer driver for ARMv7 based Tegra devices
ARM: tegra: include timer as default optionThis causes a regression on Tegra210 (Jetson TX1). I'm trying to investigate, but it's complicated by the fact that I'm not getting out any debug prints, so I suspect the issue is happening quite early.
Alright, I managed to make this work on Tegra210 using the following patch on top of this series:
--- >8 ---
arch/arm/dts/tegra210.dtsi +2
-1@@ -318,7 +318,7 @@ }; timer@60005000 { - compatible = "nvidia,tegra210-timer", "nvidia,tegra20-timer"; + compatible = "nvidia,tegra210-timer", "nvidia,tegra30-timer", +"nvidia,tegra20-timer"; reg = <0x0 0x60005000 0x0 0x400>; interrupts = <GIC_SPI 0 IRQ_TYPE_LEVEL_HIGH>, <GIC_SPI 1 IRQ_TYPE_LEVEL_HIGH>, diff --gita/arch/arm/mach-tegra/Kconfig b/arch/arm/mach-tegra/Kconfig index
cc3f00e50128..b50eec5b8c9b100644arch/arm/mach-tegra/Kconfig +1
-0@@ -136,6 +136,7 @@ config TEGRA210 select TEGRA_PINCTRL select TEGRA_PMC select TEGRA_PMC_SECURE + select TEGRA_TIMER config TEGRA186 bool "Tegra186 family"drivers/timer/tegra-timer.c +11
-2@@ -58,17 +58,26 @@ static notrace u64 tegra_timer_get_count(struct udevice *dev) static int tegra_timer_probe(struct udevice *dev) {struct timer_dev_priv *uc_priv =dev_get_uclass_priv (dev); +enum clock_osc_freq freq;u32 usec_config, value;/* Timer rate has to be set unconditionally */ uc_priv->clock_rate =TEGRA_TIMER_RATE ; +/* +* The microsecond timer runs off of clk_m on Tegra210, and clk_m +* runs at half the OSC, so fake this up. +*/ + freq =clock_get_osc_freq (); +if (freq ==CLOCK_OSC_FREQ_38_4 ) + freq =CLOCK_OSC_FREQ_19_2 ; +/* * Configure microsecond timers to have 1MHz clock * Config register is 0xqqww, where qq is "dividend", ww is "divisor" * Uses n+1 scheme */ -switch (clock_get_osc_freq ()) { +switch (freq) {case CLOCK_OSC_FREQ_13_0 : usec_config =0x000c ;/* (12+1)/(0+1) */ break ;@@ -113,6 +122,7 @@ static const struct udevice_id tegra_timer_ids[] = { { .compatible = "nvidia,tegra30-timer" }, { .compatible = "nvidia,tegra114-timer" }, { .compatible = "nvidia,tegra124-timer" }, + { .compatible = "nvidia,tegra210-timer" }, { } }; --- >8 ---Quoted 6 lines
I've also tested this on Tegra186, though no additional changes were needed since Tegra186 doesn't use the Tegra timer.
With the above folded in, the series is:
Tested-by Thierry Reding <[email protected]>I've also tested your series with the above on Tegra30 (Beaver) and Tegra124 (Jetson TK1), both seem to work fine.
Thierry
чт, 26 січ. 2023 р. о 12:35 Thierry Reding <[email protected]> пише:
Quoted 28 lines · Thierry Reding
Quoted 26 lines · Svyatoslav Ryhel
Quoted 24 lines
- ARM: tegra: remap
clock_osc_freqfor all Tegra family Enumclock_osc_freqwas designed to use only with T20. This patch remaps it to use additional frequencies, added in T30+ SoC while maintaining backwards compatibility with T20.- drivers: timer: add timer driver for ARMv7 based Tegra devices Add timer support for T20/T30/T114 and T124 based devices. Driver is based on DM, has device tree support and can be used on SPL and early boot stage.
- ARM: tegra: include timer as default option Enable TIMER as default option for all Tegra devices and enable
TEGRA_TIMERforTEGRA_ARMV7_COMMON. Additionally enableSPL_TIMERif build as SPL part and drop deprecated configs from common header.P. S. I have no arm64 Tegra and according to comment in
tegra-common.h
Use the Tegra US timer on ARMv7, but the architected timer on ARMv8.Svyatoslav Ryhel (3):
ARM: tegra: remapclock_osc_freqfor all Tegra family
drivers: timer: add timer driver for ARMv7 based Tegra devices
ARM: tegra: include timer as default option
Quoted 7 lines
Quoted 3 lines
This causes a regression on Tegra210 (Jetson TX1). I'm trying to investigate, but it's complicated by the fact that I'm not getting out any debug prints, so I suspect the issue is happening quite early.
Alright, I managed to make this work on Tegra210 using the following patch on top of this series:
Hello! Thanks for testing this on T210 SoC.
arch/arm/dts/tegra210.dtsi line 321
Quoted 11 lines
--- >8 ---
arch/arm/dts/tegra210.dtsi +1
-1@@ -318,7 +318,7 @@ }; timer@60005000 { - compatible = "nvidia,tegra210-timer", "nvidia,tegra20-timer"; + compatible = "nvidia,tegra210-timer", "nvidia,tegra30-timer", "nvidia,tegra20-timer";
This compatibe should not be needed since the driver will have t210 compatible included.
Quoted 27 lines
arch/arm/dts/tegra210.dtsi +0
-0reg = <0x0 0x60005000 0x0 0x400>; interrupts = <GIC_SPI 0 IRQ_TYPE_LEVEL_HIGH>, <GIC_SPI 1 IRQ_TYPE_LEVEL_HIGH>,arch/arm/mach-tegra/Kconfig +1
-0@@ -136,6 +136,7 @@ config TEGRA210 select TEGRA_PINCTRL select TEGRA_PMC select TEGRA_PMC_SECURE + select TEGRA_TIMER config TEGRA186 bool "Tegra186 family"drivers/timer/tegra-timer.c +1
-0@@ -58,17 +58,26 @@ static notrace u64 tegra_timer_get_count(struct udevice *dev)static int tegra_timer_probe (struct udevice *dev) {struct timer_dev_priv *uc_priv =dev_get_uclass_priv (dev); +enum clock_osc_freq freq;u32 usec_config, value;/* Timer rate has to be set unconditionally */
drivers/timer/tegra-timer.c static notrace u64 tegra_timer_get_count(struct udevice *dev) · line 74
Quoted 10 lines
drivers/timer/tegra-timer.c +8
-0uc_priv->clock_rate =TEGRA_TIMER_RATE ; +/* +* The microsecond timer runs off of clk_m on Tegra210, and clk_m +* runs at half the OSC, so fake this up. +*/ + freq =clock_get_osc_freq (); +if (freq ==CLOCK_OSC_FREQ_38_4 ) + freq =CLOCK_OSC_FREQ_19_2 ; +
May you confirm that ALL known T210 devices use 19.2MHz as calibration clock for timer?
If yes I can set this change in simpler as a separate commit or including into existing patches.
Quoted 25 lines
drivers/timer/tegra-timer.c +2
-2/* * Configure microsecond timers to have 1MHz clock * Config register is 0xqqww, where qq is "dividend", ww is "divisor" * Uses n+1 scheme */ -switch (clock_get_osc_freq ()) { +switch (freq) {case CLOCK_OSC_FREQ_13_0 : usec_config =0x000c ;/* (12+1)/(0+1) */ break ;@@ -113,6 +122,7 @@ static const struct udevice_id tegra_timer_ids[] = { { .compatible = "nvidia,tegra30-timer" }, { .compatible = "nvidia,tegra114-timer" }, { .compatible = "nvidia,tegra124-timer" }, + { .compatible = "nvidia,tegra210-timer" }, { } }; --- >8 ---I've also tested this on Tegra186, though no additional changes were needed since Tegra186 doesn't use the Tegra timer.
With the above folded in, the series is:
Tested-by Thierry Reding <[email protected]>
Quoted 47 lines · Svyatoslav Ryhel
чт, 26 січ. 2023 р. о 12:35 Thierry Reding <[email protected]> пише:
Quoted 28 lines · Thierry Reding
Quoted 26 lines · Svyatoslav Ryhel
Quoted 24 lines
- ARM: tegra: remap
clock_osc_freqfor all Tegra family Enumclock_osc_freqwas designed to use only with T20. This patch remaps it to use additional frequencies, added in T30+ SoC while maintaining backwards compatibility with T20.- drivers: timer: add timer driver for ARMv7 based Tegra devices Add timer support for T20/T30/T114 and T124 based devices. Driver is based on DM, has device tree support and can be used on SPL and early boot stage.
- ARM: tegra: include timer as default option Enable TIMER as default option for all Tegra devices and enable
TEGRA_TIMERforTEGRA_ARMV7_COMMON. Additionally enableSPL_TIMERif build as SPL part and drop deprecated configs from common header.P. S. I have no arm64 Tegra and according to comment in
tegra-common.h
Use the Tegra US timer on ARMv7, but the architected timer on ARMv8.Svyatoslav Ryhel (3):
ARM: tegra: remapclock_osc_freqfor all Tegra family
drivers: timer: add timer driver for ARMv7 based Tegra devices
ARM: tegra: include timer as default optionQuoted 7 lines
Quoted 3 lines
This causes a regression on Tegra210 (Jetson TX1). I'm trying to investigate, but it's complicated by the fact that I'm not getting out any debug prints, so I suspect the issue is happening quite early.
Alright, I managed to make this work on Tegra210 using the following patch on top of this series:
Hello! Thanks for testing this on T210 SoC.
Quoted 8 lines
--- >8 ---
arch/arm/dts/tegra210.dtsi +0
-0@@ -318,7 +318,7 @@ };
Quoted 6 lines
arch/arm/dts/tegra210.dtsi line 321
Quoted 3 lines
arch/arm/dts/tegra210.dtsi +1
-1timer@60005000 { - compatible = "nvidia,tegra210-timer", "nvidia,tegra20-timer"; + compatible = "nvidia,tegra210-timer", "nvidia,tegra30-timer", "nvidia,tegra20-timer";This compatibe should not be needed since the driver will have t210 compatible included.
Yes, it should be fine to leave this as-is. I had included this before updating the driver, to get the driver to bind to this. Upstream Linux doesn't include "nvidia,tegra20-timer", so it only has the compatible string for Tegra210. I think that's slightly better because the register interface isn't quite compatible. That's a separate issue and we can do that in a follow-up patch.
Quoted 30 lines
Quoted 30 lines
arch/arm/dts/tegra210.dtsi +0
-0reg = <0x0 0x60005000 0x0 0x400>; interrupts = <GIC_SPI 0 IRQ_TYPE_LEVEL_HIGH>, <GIC_SPI 1 IRQ_TYPE_LEVEL_HIGH>,arch/arm/mach-tegra/Kconfig +1
-0@@ -136,6 +136,7 @@ config TEGRA210 select TEGRA_PINCTRL select TEGRA_PMC select TEGRA_PMC_SECURE + select TEGRA_TIMER config TEGRA186 bool "Tegra186 family"drivers/timer/tegra-timer.c +1
-0@@ -58,17 +58,26 @@ static notrace u64 tegra_timer_get_count(struct udevice *dev)static int tegra_timer_probe (struct udevice *dev) {struct timer_dev_priv *uc_priv =dev_get_uclass_priv (dev); +enum clock_osc_freq freq;u32 usec_config, value;/* Timer rate has to be set unconditionally */ uc_priv->clock_rate =TEGRA_TIMER_RATE ;
Quoted 11 lines
drivers/timer/tegra-timer.c static notrace u64 tegra_timer_get_count(struct udevice *dev) · line 74
Quoted 8 lines
drivers/timer/tegra-timer.c +8
-0+/* +* The microsecond timer runs off of clk_m on Tegra210, and clk_m +* runs at half the OSC, so fake this up. +*/ + freq =clock_get_osc_freq (); +if (freq ==CLOCK_OSC_FREQ_38_4 ) + freq =CLOCK_OSC_FREQ_19_2 ; +May you confirm that ALL known T210 devices use 19.2MHz as calibration clock for timer?
According to the Tegra210 TRM, the TIMERUS depends on the rate of clk_m and clk_m is derived from OSC and either divided by 1, 2, 3 or 4. The TRM goes on to say that:
The expectation is that this CLK_M_DIVISOR will only be changed once after powering VDD_SOC on in cold boot/LP0 exit path. So these sequences are verified with an oscillator clock of 38.4 MHz; div2 setting of the CLK_M divisor must be used. The result is 19.2 MHz clk_m.
And then it says:
Note: Div2 is the recommended clk_m divisor value. Do not use any other value.
This is from Section 5.1.2 "Clk_m Divisor" of the Tegra210 TRM.
Quoted 2 lines
If yes I can set this change in simpler as a separate commit or including into existing patches.
Anything you have in mind? I tried a couple of variations to the above and they all failed because in other places it's important that OSC is recognized as running at 38.4 MHz. If not, then other PLLs will not work properly and even basic things like the debug UART won't work.
Technically the right thing to do would be to base the USEC config off the clk_m rate. We didn't do that back at the time, IIRC, because most of the clock infrastructure didn't exist, but it might be possible to achieve this today. I kept the above because it is still a bit simpler and as the TRM suggests nobody should be using anything other than the div2 setting for clk_m. I'm certainly not aware of any devices that do something different. And U-Boot has always had this assumption as well, so I think it's safe to use.
Thierry
Quoted 25 lines
Quoted 25 lines
drivers/timer/tegra-timer.c +2
-2/* * Configure microsecond timers to have 1MHz clock * Config register is 0xqqww, where qq is "dividend", ww is "divisor" * Uses n+1 scheme */ -switch (clock_get_osc_freq ()) { +switch (freq) {case CLOCK_OSC_FREQ_13_0 : usec_config =0x000c ;/* (12+1)/(0+1) */ break ;@@ -113,6 +122,7 @@ static const struct udevice_id tegra_timer_ids[] = { { .compatible = "nvidia,tegra30-timer" }, { .compatible = "nvidia,tegra114-timer" }, { .compatible = "nvidia,tegra124-timer" }, + { .compatible = "nvidia,tegra210-timer" }, { } }; --- >8 ---I've also tested this on Tegra186, though no additional changes were needed since Tegra186 doesn't use the Tegra timer.
With the above folded in, the series is:
Tested-by Thierry Reding <[email protected]>
26.01.2023 20:54, Thierry Reding пишет:
Quoted 129 lines · Svyatoslav Ryhel
Quoted 47 lines
чт, 26 січ. 2023 р. о 12:35 Thierry Reding <[email protected]> пише:
Quoted 28 lines · Thierry Reding
Quoted 26 lines · Svyatoslav Ryhel
Quoted 24 lines
- ARM: tegra: remap
clock_osc_freqfor all Tegra family Enumclock_osc_freqwas designed to use only with T20. This patch remaps it to use additional frequencies, added in T30+ SoC while maintaining backwards compatibility with T20.- drivers: timer: add timer driver for ARMv7 based Tegra devices Add timer support for T20/T30/T114 and T124 based devices. Driver is based on DM, has device tree support and can be used on SPL and early boot stage.
- ARM: tegra: include timer as default option Enable TIMER as default option for all Tegra devices and enable
TEGRA_TIMERforTEGRA_ARMV7_COMMON. Additionally enableSPL_TIMERif build as SPL part and drop deprecated configs from common header.P. S. I have no arm64 Tegra and according to comment in
tegra-common.h
Use the Tegra US timer on ARMv7, but the architected timer on ARMv8.Svyatoslav Ryhel (3):
ARM: tegra: remapclock_osc_freqfor all Tegra family
drivers: timer: add timer driver for ARMv7 based Tegra devices
ARM: tegra: include timer as default optionQuoted 7 lines
Quoted 3 lines
This causes a regression on Tegra210 (Jetson TX1). I'm trying to investigate, but it's complicated by the fact that I'm not getting out any debug prints, so I suspect the issue is happening quite early.
Alright, I managed to make this work on Tegra210 using the following patch on top of this series:
Hello! Thanks for testing this on T210 SoC.
Quoted 8 lines
--- >8 ---
arch/arm/dts/tegra210.dtsi +0
-0@@ -318,7 +318,7 @@ };Quoted 6 lines
arch/arm/dts/tegra210.dtsi line 321
Quoted 3 lines
arch/arm/dts/tegra210.dtsi +1
-1timer@60005000 { - compatible = "nvidia,tegra210-timer", "nvidia,tegra20-timer"; + compatible = "nvidia,tegra210-timer", "nvidia,tegra30-timer", "nvidia,tegra20-timer";This compatibe should not be needed since the driver will have t210 compatible included.
Yes, it should be fine to leave this as-is. I had included this before updating the driver, to get the driver to bind to this. Upstream Linux doesn't include "nvidia,tegra20-timer", so it only has the compatible string for Tegra210. I think that's slightly better because the register interface isn't quite compatible. That's a separate issue and we can do that in a follow-up patch.
Quoted 30 lines
Quoted 30 lines
arch/arm/dts/tegra210.dtsi +0
-0reg = <0x0 0x60005000 0x0 0x400>; interrupts = <GIC_SPI 0 IRQ_TYPE_LEVEL_HIGH>, <GIC_SPI 1 IRQ_TYPE_LEVEL_HIGH>,arch/arm/mach-tegra/Kconfig +1
-0@@ -136,6 +136,7 @@ config TEGRA210 select TEGRA_PINCTRL select TEGRA_PMC select TEGRA_PMC_SECURE + select TEGRA_TIMER config TEGRA186 bool "Tegra186 family"drivers/timer/tegra-timer.c +1
-0@@ -58,17 +58,26 @@ static notrace u64 tegra_timer_get_count(struct udevice *dev)static int tegra_timer_probe (struct udevice *dev) {struct timer_dev_priv *uc_priv =dev_get_uclass_priv (dev); +enum clock_osc_freq freq;u32 usec_config, value;/* Timer rate has to be set unconditionally */ uc_priv->clock_rate =TEGRA_TIMER_RATE ;Quoted 11 lines
drivers/timer/tegra-timer.c static notrace u64 tegra_timer_get_count(struct udevice *dev) · line 74
Quoted 8 lines
drivers/timer/tegra-timer.c +8
-0+/* +* The microsecond timer runs off of clk_m on Tegra210, and clk_m +* runs at half the OSC, so fake this up. +*/ + freq =clock_get_osc_freq (); +if (freq ==CLOCK_OSC_FREQ_38_4 ) + freq =CLOCK_OSC_FREQ_19_2 ; +May you confirm that ALL known T210 devices use 19.2MHz as calibration clock for timer?
According to the Tegra210 TRM, the TIMERUS depends on the rate of
clk_mandclk_mis derived from OSC and either divided by 1, 2, 3 or 4. The TRM goes on to say that:The expectation is that this
CLK_M_DIVISORwill only be changed once after poweringVDD_SOCon in cold boot/LP0 exit path. So these sequences are verified with an oscillator clock of 38.4 MHz; div2 setting of theCLK_Mdivisor must be used. The result is 19.2 MHzclk_m.And then it says:
Note: Div2 is the recommended
clk_mdivisor value. Do not use any other value.This is from Section 5.1.2 "
Clk_mDivisor" of the Tegra210 TRM.Quoted 2 lines
If yes I can set this change in simpler as a separate commit or including into existing patches.
Anything you have in mind? I tried a couple of variations to the above and they all failed because in other places it's important that OSC is recognized as running at 38.4 MHz. If not, then other PLLs will not work properly and even basic things like the debug UART won't work.
Quoted 8 lines
Technically the right thing to do would be to base the USEC config off the
clk_mrate. We didn't do that back at the time, IIRC, because most of the clock infrastructure didn't exist, but it might be possible to achieve this today. I kept the above because it is still a bit simpler and as the TRM suggests nobody should be using anything other than the div2 setting forclk_m. I'm certainly not aware of any devices that do something different. And U-Boot has always had this assumption as well, so I think it's safe to use.
Am I understanding correctly that for T210 we can/should use clk_m_get_rate() instead of clock_get_osc_freq() in tegra_timer_probe()? Have you tested this option?
27.01.2023 01:00, Dmitry Osipenko пишет:
Quoted 139 lines
26.01.2023 20:54, Thierry Reding пишет:
Quoted 129 lines · Svyatoslav Ryhel
Quoted 47 lines
чт, 26 січ. 2023 р. о 12:35 Thierry Reding <[email protected]> пише:
Quoted 28 lines · Thierry Reding
Quoted 26 lines · Svyatoslav Ryhel
Quoted 24 lines
- ARM: tegra: remap
clock_osc_freqfor all Tegra family Enumclock_osc_freqwas designed to use only with T20. This patch remaps it to use additional frequencies, added in T30+ SoC while maintaining backwards compatibility with T20.- drivers: timer: add timer driver for ARMv7 based Tegra devices Add timer support for T20/T30/T114 and T124 based devices. Driver is based on DM, has device tree support and can be used on SPL and early boot stage.
- ARM: tegra: include timer as default option Enable TIMER as default option for all Tegra devices and enable
TEGRA_TIMERforTEGRA_ARMV7_COMMON. Additionally enableSPL_TIMERif build as SPL part and drop deprecated configs from common header.P. S. I have no arm64 Tegra and according to comment in
tegra-common.h
Use the Tegra US timer on ARMv7, but the architected timer on ARMv8.Svyatoslav Ryhel (3):
ARM: tegra: remapclock_osc_freqfor all Tegra family
drivers: timer: add timer driver for ARMv7 based Tegra devices
ARM: tegra: include timer as default optionQuoted 7 lines
Quoted 3 lines
This causes a regression on Tegra210 (Jetson TX1). I'm trying to investigate, but it's complicated by the fact that I'm not getting out any debug prints, so I suspect the issue is happening quite early.
Alright, I managed to make this work on Tegra210 using the following patch on top of this series:
Hello! Thanks for testing this on T210 SoC.
Quoted 8 lines
--- >8 ---
arch/arm/dts/tegra210.dtsi +0
-0@@ -318,7 +318,7 @@ };Quoted 6 lines
arch/arm/dts/tegra210.dtsi line 321
Quoted 3 lines
arch/arm/dts/tegra210.dtsi +1
-1timer@60005000 { - compatible = "nvidia,tegra210-timer", "nvidia,tegra20-timer"; + compatible = "nvidia,tegra210-timer", "nvidia,tegra30-timer", "nvidia,tegra20-timer";This compatibe should not be needed since the driver will have t210 compatible included.
Yes, it should be fine to leave this as-is. I had included this before updating the driver, to get the driver to bind to this. Upstream Linux doesn't include "nvidia,tegra20-timer", so it only has the compatible string for Tegra210. I think that's slightly better because the register interface isn't quite compatible. That's a separate issue and we can do that in a follow-up patch.
Quoted 30 lines
Quoted 30 lines
arch/arm/dts/tegra210.dtsi +0
-0reg = <0x0 0x60005000 0x0 0x400>; interrupts = <GIC_SPI 0 IRQ_TYPE_LEVEL_HIGH>, <GIC_SPI 1 IRQ_TYPE_LEVEL_HIGH>,arch/arm/mach-tegra/Kconfig +1
-0@@ -136,6 +136,7 @@ config TEGRA210 select TEGRA_PINCTRL select TEGRA_PMC select TEGRA_PMC_SECURE + select TEGRA_TIMER config TEGRA186 bool "Tegra186 family"drivers/timer/tegra-timer.c +1
-0@@ -58,17 +58,26 @@ static notrace u64 tegra_timer_get_count(struct udevice *dev)static int tegra_timer_probe (struct udevice *dev) {struct timer_dev_priv *uc_priv =dev_get_uclass_priv (dev); +enum clock_osc_freq freq;u32 usec_config, value;/* Timer rate has to be set unconditionally */ uc_priv->clock_rate =TEGRA_TIMER_RATE ;Quoted 11 lines
drivers/timer/tegra-timer.c static notrace u64 tegra_timer_get_count(struct udevice *dev) · line 74
Quoted 8 lines
drivers/timer/tegra-timer.c +8
-0+/* +* The microsecond timer runs off of clk_m on Tegra210, and clk_m +* runs at half the OSC, so fake this up. +*/ + freq =clock_get_osc_freq (); +if (freq ==CLOCK_OSC_FREQ_38_4 ) + freq =CLOCK_OSC_FREQ_19_2 ; +May you confirm that ALL known T210 devices use 19.2MHz as calibration clock for timer?
According to the Tegra210 TRM, the TIMERUS depends on the rate of
clk_mandclk_mis derived from OSC and either divided by 1, 2, 3 or 4. The TRM goes on to say that:The expectation is that this
CLK_M_DIVISORwill only be changed once after poweringVDD_SOCon in cold boot/LP0 exit path. So these sequences are verified with an oscillator clock of 38.4 MHz; div2 setting of theCLK_Mdivisor must be used. The result is 19.2 MHzclk_m.And then it says:
Note: Div2 is the recommended
clk_mdivisor value. Do not use any other value.This is from Section 5.1.2 "
Clk_mDivisor" of the Tegra210 TRM.Quoted 2 lines
If yes I can set this change in simpler as a separate commit or including into existing patches.
Anything you have in mind? I tried a couple of variations to the above and they all failed because in other places it's important that OSC is recognized as running at 38.4 MHz. If not, then other PLLs will not work properly and even basic things like the debug UART won't work.
Quoted 8 lines
Technically the right thing to do would be to base the USEC config off the
clk_mrate. We didn't do that back at the time, IIRC, because most of the clock infrastructure didn't exist, but it might be possible to achieve this today. I kept the above because it is still a bit simpler and as the TRM suggests nobody should be using anything other than the div2 setting forclk_m. I'm certainly not aware of any devices that do something different. And U-Boot has always had this assumption as well, so I think it's safe to use.
Quoted 3 lines
Am I understanding correctly that for T210 we can/should use
clk_m_get_rate()instead ofclock_get_osc_freq()integra_timer_probe()? Have you tested this option?
Although, looking at the kernel code, I see that clk_m is the parent clock for timer on all SoCs. Hence replacing clock_get_osc_freq() with clk_m_get_rate() should be the proper solution and then no T210-specific workarounds are needed.
Good point. U-Boot has instruments to get clk_m rate on time of timer probe. I need some time to prepare this modification for testing.
пт, 27 січ. 2023 р. о 00:12 Dmitry Osipenko <[email protected]> пише:
Quoted 150 lines
27.01.2023 01:00, Dmitry Osipenko пишет:
Quoted 139 lines
26.01.2023 20:54, Thierry Reding пишет:
Quoted 129 lines · Svyatoslav Ryhel
Quoted 47 lines
чт, 26 січ. 2023 р. о 12:35 Thierry Reding <[email protected]> пише:
Quoted 28 lines · Thierry Reding
Quoted 26 lines · Svyatoslav Ryhel
Quoted 24 lines
- ARM: tegra: remap
clock_osc_freqfor all Tegra family Enumclock_osc_freqwas designed to use only with T20. This patch remaps it to use additional frequencies, added in T30+ SoC while maintaining backwards compatibility with T20.- drivers: timer: add timer driver for ARMv7 based Tegra devices Add timer support for T20/T30/T114 and T124 based devices. Driver is based on DM, has device tree support and can be used on SPL and early boot stage.
- ARM: tegra: include timer as default option Enable TIMER as default option for all Tegra devices and enable
TEGRA_TIMERforTEGRA_ARMV7_COMMON. Additionally enableSPL_TIMERif build as SPL part and drop deprecated configs from common header.P. S. I have no arm64 Tegra and according to comment in
tegra-common.h
Use the Tegra US timer on ARMv7, but the architected timer on ARMv8.Svyatoslav Ryhel (3):
ARM: tegra: remapclock_osc_freqfor all Tegra family
drivers: timer: add timer driver for ARMv7 based Tegra devices
ARM: tegra: include timer as default optionQuoted 7 lines
Quoted 3 lines
This causes a regression on Tegra210 (Jetson TX1). I'm trying to investigate, but it's complicated by the fact that I'm not getting out any debug prints, so I suspect the issue is happening quite early.
Alright, I managed to make this work on Tegra210 using the following patch on top of this series:
Hello! Thanks for testing this on T210 SoC.
Quoted 8 lines
--- >8 ---
arch/arm/dts/tegra210.dtsi +0
-0@@ -318,7 +318,7 @@ };Quoted 6 lines
arch/arm/dts/tegra210.dtsi line 321
Quoted 3 lines
arch/arm/dts/tegra210.dtsi +1
-1timer@60005000 { - compatible = "nvidia,tegra210-timer", "nvidia,tegra20-timer"; + compatible = "nvidia,tegra210-timer", "nvidia,tegra30-timer", "nvidia,tegra20-timer";This compatibe should not be needed since the driver will have t210 compatible included.
Yes, it should be fine to leave this as-is. I had included this before updating the driver, to get the driver to bind to this. Upstream Linux doesn't include "nvidia,tegra20-timer", so it only has the compatible string for Tegra210. I think that's slightly better because the register interface isn't quite compatible. That's a separate issue and we can do that in a follow-up patch.
Quoted 30 lines
Quoted 30 lines
arch/arm/dts/tegra210.dtsi +0
-0reg = <0x0 0x60005000 0x0 0x400>; interrupts = <GIC_SPI 0 IRQ_TYPE_LEVEL_HIGH>, <GIC_SPI 1 IRQ_TYPE_LEVEL_HIGH>,arch/arm/mach-tegra/Kconfig +1
-0@@ -136,6 +136,7 @@ config TEGRA210 select TEGRA_PINCTRL select TEGRA_PMC select TEGRA_PMC_SECURE + select TEGRA_TIMER config TEGRA186 bool "Tegra186 family"drivers/timer/tegra-timer.c +1
-0@@ -58,17 +58,26 @@ static notrace u64 tegra_timer_get_count(struct udevice *dev)static int tegra_timer_probe (struct udevice *dev) {struct timer_dev_priv *uc_priv =dev_get_uclass_priv (dev); +enum clock_osc_freq freq;u32 usec_config, value;/* Timer rate has to be set unconditionally */ uc_priv->clock_rate =TEGRA_TIMER_RATE ;Quoted 11 lines
drivers/timer/tegra-timer.c static notrace u64 tegra_timer_get_count(struct udevice *dev) · line 74
Quoted 8 lines
drivers/timer/tegra-timer.c +8
-0+/* +* The microsecond timer runs off of clk_m on Tegra210, and clk_m +* runs at half the OSC, so fake this up. +*/ + freq =clock_get_osc_freq (); +if (freq ==CLOCK_OSC_FREQ_38_4 ) + freq =CLOCK_OSC_FREQ_19_2 ; +May you confirm that ALL known T210 devices use 19.2MHz as calibration clock for timer?
According to the Tegra210 TRM, the TIMERUS depends on the rate of
clk_mandclk_mis derived from OSC and either divided by 1, 2, 3 or 4. The TRM goes on to say that:The expectation is that this
CLK_M_DIVISORwill only be changed once after poweringVDD_SOCon in cold boot/LP0 exit path. So these sequences are verified with an oscillator clock of 38.4 MHz; div2 setting of theCLK_Mdivisor must be used. The result is 19.2 MHzclk_m.And then it says:
Note: Div2 is the recommended
clk_mdivisor value. Do not use any other value.This is from Section 5.1.2 "
Clk_mDivisor" of the Tegra210 TRM.Quoted 2 lines
If yes I can set this change in simpler as a separate commit or including into existing patches.
Anything you have in mind? I tried a couple of variations to the above and they all failed because in other places it's important that OSC is recognized as running at 38.4 MHz. If not, then other PLLs will not work properly and even basic things like the debug UART won't work.
Quoted 8 lines
Technically the right thing to do would be to base the USEC config off the
clk_mrate. We didn't do that back at the time, IIRC, because most of the clock infrastructure didn't exist, but it might be possible to achieve this today. I kept the above because it is still a bit simpler and as the TRM suggests nobody should be using anything other than the div2 setting forclk_m. I'm certainly not aware of any devices that do something different. And U-Boot has always had this assumption as well, so I think it's safe to use.Quoted 3 lines
Am I understanding correctly that for T210 we can/should use
clk_m_get_rate()instead ofclock_get_osc_freq()integra_timer_probe()? Have you tested this option?Although, looking at the kernel code, I see that
clk_mis the parent clock for timer on all SoCs. Hence replacingclock_get_osc_freq()withclk_m_get_rate()should be the proper solution and then no T210-specific workarounds are needed.