mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 0/2] Fix NVDEC boot on Tegra210
@ 2026-10-15  9:58 Mikko Perttunen
  2026-10-15  9:58 ` [PATCH 1/2] soc/tegra: pmc: Support nested PMC power domains Mikko Perttunen
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Mikko Perttunen @ 2026-10-15  9:58 UTC (permalink / raw)
  To: Thierry Reding, Jonathan Hunter, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Aaron Kling
  Cc: linux-tegra, linux-kernel, devicetree, Mikko Perttunen, stable

On Tegra210, parts of the NVDEC hardware unit are in the NVJPG power 
domain. According to the TRM, the NVJPG power domains must always be 
ungated while the NVDEC power domain is ungated. Model the dependency in 
device tree.

The first PMC patch updates the PMC driver to handle cases where a PMC 
power domain depends on another PMC power domain (other than the core 
domain). The second device tree patch adds the dependency in the device 
tree.

The PMC patch must be applied before the device tree patch or PMC probe 
can break.

Cheers
Mikko

Signed-off-by: Mikko Perttunen <mperttunen@nvidia.com>
---
Mikko Perttunen (2):
      soc/tegra: pmc: Support nested PMC power domains
      arm64: tegra: Make the NVDEC power domain a subdomain of NVJPG on Tegra210

 arch/arm64/boot/dts/nvidia/tegra210.dtsi |  1 +
 drivers/soc/tegra/pmc.c                  | 21 ++++++++++++++++++++-
 2 files changed, 21 insertions(+), 1 deletion(-)
---
base-commit: d419d682257d813f6cb7a28e42b35d0edf4ad038
change-id: 20261015-b4-t210-pd_nvdec-nesting-f7a7b7bc8568


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

* [PATCH 1/2] soc/tegra: pmc: Support nested PMC power domains
  2026-10-15  9:58 [PATCH 0/2] Fix NVDEC boot on Tegra210 Mikko Perttunen
@ 2026-10-15  9:58 ` Mikko Perttunen
  2026-10-15  9:58 ` [PATCH 2/2] arm64: tegra: Make the NVDEC power domain a subdomain of NVJPG on Tegra210 Mikko Perttunen
  2026-10-27  6:54 ` [PATCH 0/2] Fix NVDEC boot " Karl Mehltretter
  2 siblings, 0 replies; 4+ messages in thread
From: Mikko Perttunen @ 2026-10-15  9:58 UTC (permalink / raw)
  To: Thierry Reding, Jonathan Hunter, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Aaron Kling
  Cc: linux-tegra, linux-kernel, devicetree, Mikko Perttunen, stable

The PMC power domain provider implementation currently supports having
parent domains for its domains, but only if the parent domain is
registered before any of the PMC power partitions. In practice, this is
the core power domain.

On Tegra210, the TRM documents that part of the NVDEC hardware unit is
in the NVJPG power domain, and that the NVJPG power domain must be kept
powered while the NVDEC domain is powered on. Hence, we should model the
NVDEC power domain as a subdomain of NVJPG.

To enable this, support one level of self-referential subdomains in the
driver, by registering all power domains first before adding subdomain
links, and correspondingly removing all subdomain links before removing
power domains. Without this, a non-topological ordering of power domains
in the device tree would cause a probe deferral that would never be
resolved.

Cc: stable@vger.kernel.org # 6.19.x
Signed-off-by: Mikko Perttunen <mperttunen@nvidia.com>
---
 drivers/soc/tegra/pmc.c | 21 ++++++++++++++++++++-
 1 file changed, 20 insertions(+), 1 deletion(-)

diff --git a/drivers/soc/tegra/pmc.c b/drivers/soc/tegra/pmc.c
index 2c70eedf514e..3d820c462829 100644
--- a/drivers/soc/tegra/pmc.c
+++ b/drivers/soc/tegra/pmc.c
@@ -1525,8 +1525,11 @@ static int tegra_powergate_init(struct tegra_pmc *pmc,
 	for_each_child_of_node_scoped(np, child) {
 		err = tegra_powergate_add(pmc, child);
 		if (err < 0)
-			break;
+			goto put;
+	}
 
+	/* A parent powergate may come after its subdomains in DT order. */
+	for_each_child_of_node_scoped(np, child) {
 		if (of_parse_phandle_with_args(child, "power-domains",
 					       "#power-domain-cells",
 					       0, &parent_args))
@@ -1541,6 +1544,7 @@ static int tegra_powergate_init(struct tegra_pmc *pmc,
 			break;
 	}
 
+put:
 	of_node_put(np);
 
 	return err;
@@ -1564,6 +1568,7 @@ static void tegra_powergate_remove(struct generic_pm_domain *genpd)
 
 static void tegra_powergate_remove_all(struct device_node *parent)
 {
+	struct of_phandle_args child_args, parent_args;
 	struct generic_pm_domain *genpd;
 	struct device_node *np, *child;
 
@@ -1571,6 +1576,20 @@ static void tegra_powergate_remove_all(struct device_node *parent)
 	if (!np)
 		return;
 
+	/* A parent powergate cannot be removed while it has subdomains. */
+	for_each_child_of_node(np, child) {
+		if (of_parse_phandle_with_args(child, "power-domains",
+					       "#power-domain-cells",
+					       0, &parent_args))
+			continue;
+
+		child_args.np = child;
+		child_args.args_count = 0;
+
+		of_genpd_remove_subdomain(&parent_args, &child_args);
+		of_node_put(parent_args.np);
+	}
+
 	for_each_child_of_node(np, child) {
 		of_genpd_del_provider(child);
 

-- 
2.55.0


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

* [PATCH 2/2] arm64: tegra: Make the NVDEC power domain a subdomain of NVJPG on Tegra210
  2026-10-15  9:58 [PATCH 0/2] Fix NVDEC boot on Tegra210 Mikko Perttunen
  2026-10-15  9:58 ` [PATCH 1/2] soc/tegra: pmc: Support nested PMC power domains Mikko Perttunen
@ 2026-10-15  9:58 ` Mikko Perttunen
  2026-10-27  6:54 ` [PATCH 0/2] Fix NVDEC boot " Karl Mehltretter
  2 siblings, 0 replies; 4+ messages in thread
From: Mikko Perttunen @ 2026-10-15  9:58 UTC (permalink / raw)
  To: Thierry Reding, Jonathan Hunter, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Aaron Kling
  Cc: linux-tegra, linux-kernel, devicetree, Mikko Perttunen, stable

According to the TRM, on Tegra210 the NVDEC unit is split into the NVJPG
and NVDEC power domains, and the NVJPG domain has to be powered on
whenever the NVDEC domain is powered on.

Fix this by modeling the NVDEC domain as a subdomain of NVJPG. This
fixes the system resetting when attempting to boot NVDEC.

This commit also requires a change to the PMC driver:

  "soc/tegra: pmc: Support nested PMC power domains".

Without it, the PMC driver fails to find the parent while still
registering powergates and defers its probe indefinitely.

Fixes: 961e69a5dc78 ("arm64: tegra: Enable NVDEC and NVENC on Tegra210")
Cc: stable@vger.kernel.org
Signed-off-by: Mikko Perttunen <mperttunen@nvidia.com>
---
 arch/arm64/boot/dts/nvidia/tegra210.dtsi | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arm64/boot/dts/nvidia/tegra210.dtsi b/arch/arm64/boot/dts/nvidia/tegra210.dtsi
index 49d22506b7b7..08e14bcc9367 100644
--- a/arch/arm64/boot/dts/nvidia/tegra210.dtsi
+++ b/arch/arm64/boot/dts/nvidia/tegra210.dtsi
@@ -935,6 +935,7 @@ pd_nvenc: mpe {
 			pd_nvdec: nvdec {
 				clocks = <&tegra_car TEGRA210_CLK_NVDEC>;
 				resets = <&tegra_car 194>;
+				power-domains = <&pd_nvjpg>;
 				#power-domain-cells = <0>;
 			};
 

-- 
2.55.0


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

* Re: [PATCH 0/2] Fix NVDEC boot on Tegra210
  2026-10-15  9:58 [PATCH 0/2] Fix NVDEC boot on Tegra210 Mikko Perttunen
  2026-10-15  9:58 ` [PATCH 1/2] soc/tegra: pmc: Support nested PMC power domains Mikko Perttunen
  2026-10-15  9:58 ` [PATCH 2/2] arm64: tegra: Make the NVDEC power domain a subdomain of NVJPG on Tegra210 Mikko Perttunen
@ 2026-10-27  6:54 ` Karl Mehltretter
  2 siblings, 0 replies; 4+ messages in thread
From: Karl Mehltretter @ 2026-10-27  6:54 UTC (permalink / raw)
  To: Mikko Perttunen
  Cc: Karl Mehltretter, Thierry Reding, Jonathan Hunter, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Aaron Kling, linux-tegra,
	devicetree, linux-kernel, stable

On Thu, Oct 15, 2026 at 06:58:01PM +0900, Mikko Perttunen wrote:
> On Tegra210, parts of the NVDEC hardware unit are in the NVJPG power
> domain. According to the TRM, the NVJPG power domains must always be
> ungated while the NVDEC power domain is ungated. Model the dependency in
> device tree.
>
> The first PMC patch updates the PMC driver to handle cases where a PMC
> power domain depends on another PMC power domain (other than the core
> domain). The second device tree patch adds the dependency in the device
> tree.

Tested on Jetson Nano (Tegra210, 7000e400.pmc and 54480000.nvdec with
nvidia/tegra210/nvdec.bin) on v7.3-rc2 (5b0764a53235):

- Unpatched: pm_genpd_summary lists nvdec as a top-level domain while
  nvjpg stays off-0. Writing "on" to
  /sys/bus/platform/devices/54480000.nvdec/power/control immediately
  resets the board into TegraBoot.
- With both patches applied: pm_genpd_summary registers nvdec as a child
  subdomain of nvjpg. Writing "on" to 54480000.nvdec/power/control
  powers on both nvjpg and nvdec, boots the Falcon firmware, and puts
  54480000.nvdec into runtime_status=active. Writing "auto" powers both
  nvdec and nvjpg back to off-0.

Tested-by: Karl Mehltretter <kmehltretter@gmail.com>

Thanks,
Karl

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

end of thread, other threads:[~2026-10-27  6:54 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-15  9:58 [PATCH 0/2] Fix NVDEC boot on Tegra210 Mikko Perttunen
2026-10-15  9:58 ` [PATCH 1/2] soc/tegra: pmc: Support nested PMC power domains Mikko Perttunen
2026-10-15  9:58 ` [PATCH 2/2] arm64: tegra: Make the NVDEC power domain a subdomain of NVJPG on Tegra210 Mikko Perttunen
2026-10-27  6:54 ` [PATCH 0/2] Fix NVDEC boot " Karl Mehltretter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®