From: Thierry Reding <thierry.reding@gmail.com>
To: Svyatoslav Ryhel <clamor95@gmail.com>
Cc: Rayagonda Kokatanur <rayagonda.kokatanur@broadcom.com>,
Tom Warren <twarren@nvidia.com>, Marek Vasut <marex@denx.de>,
Maxim Schwalm <maxim.schwalm@gmail.com>,
Dmitry Osipenko <digetx@gmail.com>,
Heinrich Schuchardt <xypron.glpk@gmx.de>,
Michal Simek <michal.simek@amd.com>, Stefan Roese <sr@denx.de>,
Eugen Hristev <eugen.hristev@microchip.com>,
Michael Walle <michael@walle.cc>, Simon Glass <sjg@chromium.org>,
Jim Liu <jim.t90615@gmail.com>,
William Zhang <william.zhang@broadcom.com>,
Rick Chen <rick@andestech.com>,
Stefan Herbrechtsmeier <stefan.herbrechtsmeier@weidmueller.com>,
Andre Przywara <andre.przywara@arm.com>,
Jaehoon Chung <jh80.chung@samsung.com>,
u-boot@lists.denx.de
Subject: Re: [PATCH v6 0/3] Timer support for ARM Tegra
Date: Thu, 26 Jan 2023 11:34:59 +0100 [thread overview]
Message-ID: <Y9JXU9SFn+xI8/eT@orome> (raw)
In-Reply-To: <Y9FbpLKesEN/40FC@orome>
[-- Attachment #1: Type: text/plain, Size: 4059 bytes --]
On Wed, Jan 25, 2023 at 05:41:08PM +0100, Thierry Reding wrote:
> On Tue, Jan 24, 2023 at 08:57:48AM +0200, Svyatoslav Ryhel wrote:
> > - 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
>
> 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:
--- >8 ---
diff --git a/arch/arm/dts/tegra210.dtsi b/arch/arm/dts/tegra210.dtsi
index a521a43d6cfd..ccb5a927da89 100644
--- a/arch/arm/dts/tegra210.dtsi
+++ b/arch/arm/dts/tegra210.dtsi
@@ -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/Kconfig b/arch/arm/mach-tegra/Kconfig
index cc3f00e50128..b50eec5b8c9b 100644
--- a/arch/arm/mach-tegra/Kconfig
+++ b/arch/arm/mach-tegra/Kconfig
@@ -136,6 +136,7 @@ config TEGRA210
select TEGRA_PINCTRL
select TEGRA_PMC
select TEGRA_PMC_SECURE
+ select TEGRA_TIMER
config TEGRA186
bool "Tegra186 family"
diff --git a/drivers/timer/tegra-timer.c b/drivers/timer/tegra-timer.c
index d2d163cf3fef..235532ba8926 100644
--- a/drivers/timer/tegra-timer.c
+++ b/drivers/timer/tegra-timer.c
@@ -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:
Tested-by: Thierry Reding <treding@nvidia.com>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
next prev parent reply other threads:[~2023-01-26 10:35 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-24 6:57 [PATCH v6 0/3] Timer support for ARM Tegra Svyatoslav Ryhel
2023-01-24 6:57 ` [PATCH v6 1/3] ARM: tegra: remap clock_osc_freq for all Tegra family Svyatoslav Ryhel
2023-01-24 6:57 ` [PATCH v6 2/3] drivers: timer: add timer driver for ARMv7 based Tegra devices Svyatoslav Ryhel
2023-01-24 6:57 ` [PATCH v6 3/3] ARM: tegra: include timer as default option Svyatoslav Ryhel
2023-01-25 16:41 ` [PATCH v6 0/3] Timer support for ARM Tegra Thierry Reding
2023-01-26 10:34 ` Thierry Reding [this message]
2023-01-26 11:40 ` Thierry Reding
2023-01-26 16:49 ` Tom Warren
2023-01-26 17:12 ` Svyatoslav Ryhel
2023-01-26 17:58 ` Thierry Reding
2023-01-26 18:10 ` Svyatoslav Ryhel
2023-01-26 22:12 ` Tom Warren
2023-01-26 18:28 ` Svyatoslav Ryhel
2023-01-26 17:08 ` Svyatoslav Ryhel
2023-01-26 17:54 ` Thierry Reding
2023-01-26 22:00 ` Dmitry Osipenko
2023-01-26 22:12 ` Dmitry Osipenko
2023-01-27 4:51 ` Svyatoslav Ryhel
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Y9JXU9SFn+xI8/eT@orome \
--to=thierry.reding@gmail.com \
--cc=andre.przywara@arm.com \
--cc=clamor95@gmail.com \
--cc=digetx@gmail.com \
--cc=eugen.hristev@microchip.com \
--cc=jh80.chung@samsung.com \
--cc=jim.t90615@gmail.com \
--cc=marex@denx.de \
--cc=maxim.schwalm@gmail.com \
--cc=michael@walle.cc \
--cc=michal.simek@amd.com \
--cc=rayagonda.kokatanur@broadcom.com \
--cc=rick@andestech.com \
--cc=sjg@chromium.org \
--cc=sr@denx.de \
--cc=stefan.herbrechtsmeier@weidmueller.com \
--cc=twarren@nvidia.com \
--cc=u-boot@lists.denx.de \
--cc=william.zhang@broadcom.com \
--cc=xypron.glpk@gmx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox