All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] firmware: PSCI: Fix PSCI support for OF live trees
@ 2020-06-18 11:54 Jon Hunter
  2020-06-18 11:54 ` [PATCH 2/2] ARM: tegra: Enable PSCI support for Tegra210 and Tegra186 Jon Hunter
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Jon Hunter @ 2020-06-18 11:54 UTC (permalink / raw)
  To: u-boot

When CONFIG_OF_LIVE is enabled, dev_of_offset() cannot be used and
if used returns an invalid offset. This causes the call to
fdt_stringlist_get() in the psci_probe() to fail to read the 'method'
property from the PSCI node for the device and hence prevents PSCI
from working. Fix this by using the ofnode_read_string() API instead
of the fdt_stringlist_get() because this will handle reading the
property both when CONFIG_OF_LIVE is enabled or disabled.

Due to the above problem and since commit 81ea00838c68 ("efi_loader:
PSCI reset and shutdown") was added, the EFI system reset has been
broken for Tegra210 and Tegra196 platforms. This also fixes the EFI
system reset for these Tegra platforms.

Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
---
 drivers/firmware/psci.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/firmware/psci.c b/drivers/firmware/psci.c
index e0d66d74f54d..23cf807591c4 100644
--- a/drivers/firmware/psci.c
+++ b/drivers/firmware/psci.c
@@ -67,11 +67,9 @@ static int psci_bind(struct udevice *dev)
 
 static int psci_probe(struct udevice *dev)
 {
-	DECLARE_GLOBAL_DATA_PTR;
 	const char *method;
 
-	method = fdt_stringlist_get(gd->fdt_blob, dev_of_offset(dev), "method",
-				    0, NULL);
+	method = ofnode_read_string(dev_ofnode(dev), "method");
 	if (!method) {
 		pr_warn("missing \"method\" property\n");
 		return -ENXIO;
-- 
2.17.1

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

* [PATCH 2/2] ARM: tegra: Enable PSCI support for Tegra210 and Tegra186
  2020-06-18 11:54 [PATCH 1/2] firmware: PSCI: Fix PSCI support for OF live trees Jon Hunter
@ 2020-06-18 11:54 ` Jon Hunter
  2020-06-18 15:44   ` Peter Robinson
  2020-06-22 19:04   ` Stephen Warren
  2020-06-18 15:44 ` [PATCH 1/2] firmware: PSCI: Fix PSCI support for OF live trees Peter Robinson
  2020-06-18 15:47 ` Jon Hunter
  2 siblings, 2 replies; 8+ messages in thread
From: Jon Hunter @ 2020-06-18 11:54 UTC (permalink / raw)
  To: u-boot

The PSCI nodes are currently not populated for the Tegra210 and Tegra186
devices. This prevents the PSCI driver from being able to identify the
PSCI method used by these devices and causes the probe of the PSCI
driver to fail.

Since commit 81ea00838c68 ("efi_loader: PSCI reset and shutdown") was
added, which moves the PSCI EFI system reset handler into the PSCI
driver, this has prevented the EFI system reset from working for
Tegra210 and Tegra186. Therefore, populating these nodes is necessary
to fix the EFI system reset for Tegra210 and Tegra186.

Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
---
 arch/arm/dts/tegra186.dtsi | 5 +++++
 arch/arm/dts/tegra210.dtsi | 5 +++++
 2 files changed, 10 insertions(+)

diff --git a/arch/arm/dts/tegra186.dtsi b/arch/arm/dts/tegra186.dtsi
index 0a9db9825b85..edcb7aacb8ee 100644
--- a/arch/arm/dts/tegra186.dtsi
+++ b/arch/arm/dts/tegra186.dtsi
@@ -335,4 +335,9 @@
 			status = "disabled";
 		};
 	};
+
+	psci {
+		compatible = "arm,psci-1.0";
+		method = "smc";
+	};
 };
diff --git a/arch/arm/dts/tegra210.dtsi b/arch/arm/dts/tegra210.dtsi
index 3ec54b11c43f..a521a43d6cfd 100644
--- a/arch/arm/dts/tegra210.dtsi
+++ b/arch/arm/dts/tegra210.dtsi
@@ -867,6 +867,11 @@
 		};
 	};
 
+	psci {
+		compatible = "arm,psci-1.0";
+		method = "smc";
+	};
+
 	timer {
 		compatible = "arm,armv8-timer";
 		interrupts = <GIC_PPI 13
-- 
2.17.1

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

* [PATCH 1/2] firmware: PSCI: Fix PSCI support for OF live trees
  2020-06-18 11:54 [PATCH 1/2] firmware: PSCI: Fix PSCI support for OF live trees Jon Hunter
  2020-06-18 11:54 ` [PATCH 2/2] ARM: tegra: Enable PSCI support for Tegra210 and Tegra186 Jon Hunter
@ 2020-06-18 15:44 ` Peter Robinson
  2020-06-18 15:47 ` Jon Hunter
  2 siblings, 0 replies; 8+ messages in thread
From: Peter Robinson @ 2020-06-18 15:44 UTC (permalink / raw)
  To: u-boot

On Thu, Jun 18, 2020 at 12:55 PM Jon Hunter <jonathanh@nvidia.com> wrote:
>
> When CONFIG_OF_LIVE is enabled, dev_of_offset() cannot be used and
> if used returns an invalid offset. This causes the call to
> fdt_stringlist_get() in the psci_probe() to fail to read the 'method'
> property from the PSCI node for the device and hence prevents PSCI
> from working. Fix this by using the ofnode_read_string() API instead
> of the fdt_stringlist_get() because this will handle reading the
> property both when CONFIG_OF_LIVE is enabled or disabled.
>
> Due to the above problem and since commit 81ea00838c68 ("efi_loader:
> PSCI reset and shutdown") was added, the EFI system reset has been
> broken for Tegra210 and Tegra196 platforms. This also fixes the EFI
> system reset for these Tegra platforms.
>
> Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Tested-by: Peter Robinson <pbrobinson@gmail.com>

Tested on the Jetson Nano and it now reboots as expected.

> ---
>  drivers/firmware/psci.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/drivers/firmware/psci.c b/drivers/firmware/psci.c
> index e0d66d74f54d..23cf807591c4 100644
> --- a/drivers/firmware/psci.c
> +++ b/drivers/firmware/psci.c
> @@ -67,11 +67,9 @@ static int psci_bind(struct udevice *dev)
>
>  static int psci_probe(struct udevice *dev)
>  {
> -       DECLARE_GLOBAL_DATA_PTR;
>         const char *method;
>
> -       method = fdt_stringlist_get(gd->fdt_blob, dev_of_offset(dev), "method",
> -                                   0, NULL);
> +       method = ofnode_read_string(dev_ofnode(dev), "method");
>         if (!method) {
>                 pr_warn("missing \"method\" property\n");
>                 return -ENXIO;
> --
> 2.17.1
>

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

* [PATCH 2/2] ARM: tegra: Enable PSCI support for Tegra210 and Tegra186
  2020-06-18 11:54 ` [PATCH 2/2] ARM: tegra: Enable PSCI support for Tegra210 and Tegra186 Jon Hunter
@ 2020-06-18 15:44   ` Peter Robinson
  2020-06-22 19:04   ` Stephen Warren
  1 sibling, 0 replies; 8+ messages in thread
From: Peter Robinson @ 2020-06-18 15:44 UTC (permalink / raw)
  To: u-boot

On Thu, Jun 18, 2020 at 12:56 PM Jon Hunter <jonathanh@nvidia.com> wrote:
>
> The PSCI nodes are currently not populated for the Tegra210 and Tegra186
> devices. This prevents the PSCI driver from being able to identify the
> PSCI method used by these devices and causes the probe of the PSCI
> driver to fail.
>
> Since commit 81ea00838c68 ("efi_loader: PSCI reset and shutdown") was
> added, which moves the PSCI EFI system reset handler into the PSCI
> driver, this has prevented the EFI system reset from working for
> Tegra210 and Tegra186. Therefore, populating these nodes is necessary
> to fix the EFI system reset for Tegra210 and Tegra186.
>
> Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Tested-by: Peter Robinson <pbrobinson@gmail.com>

Tested on the Jetson Nano and it now reboots as expected.
> ---
>  arch/arm/dts/tegra186.dtsi | 5 +++++
>  arch/arm/dts/tegra210.dtsi | 5 +++++
>  2 files changed, 10 insertions(+)
>
> diff --git a/arch/arm/dts/tegra186.dtsi b/arch/arm/dts/tegra186.dtsi
> index 0a9db9825b85..edcb7aacb8ee 100644
> --- a/arch/arm/dts/tegra186.dtsi
> +++ b/arch/arm/dts/tegra186.dtsi
> @@ -335,4 +335,9 @@
>                         status = "disabled";
>                 };
>         };
> +
> +       psci {
> +               compatible = "arm,psci-1.0";
> +               method = "smc";
> +       };
>  };
> diff --git a/arch/arm/dts/tegra210.dtsi b/arch/arm/dts/tegra210.dtsi
> index 3ec54b11c43f..a521a43d6cfd 100644
> --- a/arch/arm/dts/tegra210.dtsi
> +++ b/arch/arm/dts/tegra210.dtsi
> @@ -867,6 +867,11 @@
>                 };
>         };
>
> +       psci {
> +               compatible = "arm,psci-1.0";
> +               method = "smc";
> +       };
> +
>         timer {
>                 compatible = "arm,armv8-timer";
>                 interrupts = <GIC_PPI 13
> --
> 2.17.1
>

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

* [PATCH 1/2] firmware: PSCI: Fix PSCI support for OF live trees
  2020-06-18 11:54 [PATCH 1/2] firmware: PSCI: Fix PSCI support for OF live trees Jon Hunter
  2020-06-18 11:54 ` [PATCH 2/2] ARM: tegra: Enable PSCI support for Tegra210 and Tegra186 Jon Hunter
  2020-06-18 15:44 ` [PATCH 1/2] firmware: PSCI: Fix PSCI support for OF live trees Peter Robinson
@ 2020-06-18 15:47 ` Jon Hunter
  2020-06-18 16:19   ` Tom Warren
  2 siblings, 1 reply; 8+ messages in thread
From: Jon Hunter @ 2020-06-18 15:47 UTC (permalink / raw)
  To: u-boot


On 18/06/2020 12:54, Jon Hunter wrote:
> When CONFIG_OF_LIVE is enabled, dev_of_offset() cannot be used and
> if used returns an invalid offset. This causes the call to
> fdt_stringlist_get() in the psci_probe() to fail to read the 'method'
> property from the PSCI node for the device and hence prevents PSCI
> from working. Fix this by using the ofnode_read_string() API instead
> of the fdt_stringlist_get() because this will handle reading the
> property both when CONFIG_OF_LIVE is enabled or disabled.
> 
> Due to the above problem and since commit 81ea00838c68 ("efi_loader:
> PSCI reset and shutdown") was added, the EFI system reset has been
> broken for Tegra210 and Tegra196 platforms. This also fixes the EFI
> system reset for these Tegra platforms.

Oops, just spotted the above typo. Should be Tegra186 and not Tegra196
(which does not exist!). I can correct that.

Jon

-- 
nvpublic

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

* [PATCH 1/2] firmware: PSCI: Fix PSCI support for OF live trees
  2020-06-18 15:47 ` Jon Hunter
@ 2020-06-18 16:19   ` Tom Warren
  2020-06-18 16:27     ` Tom Rini
  0 siblings, 1 reply; 8+ messages in thread
From: Tom Warren @ 2020-06-18 16:19 UTC (permalink / raw)
  To: u-boot

No worries, I can fix it when I add them to u-boot-tegra. I have some other patches to add & generate a PR, I'll get it out by EOW.  TomR - do you want me to take this patch as well as the ARM: tegra: patch in my PR, or do you want Jon's first patch to go thru a different repo?

Tom
--
nvpublic

-----Original Message-----
From: Jonathan Hunter <jonathanh@nvidia.com> 
Sent: Thursday, June 18, 2020 8:47 AM
To: Tom Rini <trini@konsulko.com>; Tom Warren <TWarren@nvidia.com>
Cc: Stephen Warren <swarren@nvidia.com>; Thierry Reding <treding@nvidia.com>; Peter Robinson <pbrobinson@redhat.com>; Heinrich Schuchardt <xypron.glpk@gmx.de>; u-boot at lists.denx.de
Subject: Re: [PATCH 1/2] firmware: PSCI: Fix PSCI support for OF live trees


On 18/06/2020 12:54, Jon Hunter wrote:
> When CONFIG_OF_LIVE is enabled, dev_of_offset() cannot be used and if 
> used returns an invalid offset. This causes the call to
> fdt_stringlist_get() in the psci_probe() to fail to read the 'method'
> property from the PSCI node for the device and hence prevents PSCI 
> from working. Fix this by using the ofnode_read_string() API instead 
> of the fdt_stringlist_get() because this will handle reading the 
> property both when CONFIG_OF_LIVE is enabled or disabled.
> 
> Due to the above problem and since commit 81ea00838c68 ("efi_loader:
> PSCI reset and shutdown") was added, the EFI system reset has been 
> broken for Tegra210 and Tegra196 platforms. This also fixes the EFI 
> system reset for these Tegra platforms.

Oops, just spotted the above typo. Should be Tegra186 and not Tegra196 (which does not exist!). I can correct that.

Jon

--
nvpublic

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

* [PATCH 1/2] firmware: PSCI: Fix PSCI support for OF live trees
  2020-06-18 16:19   ` Tom Warren
@ 2020-06-18 16:27     ` Tom Rini
  0 siblings, 0 replies; 8+ messages in thread
From: Tom Rini @ 2020-06-18 16:27 UTC (permalink / raw)
  To: u-boot

On Thu, Jun 18, 2020 at 04:19:51PM +0000, Tom Warren wrote:

> No worries, I can fix it when I add them to u-boot-tegra. I have some other patches to add & generate a PR, I'll get it out by EOW.  TomR - do you want me to take this patch as well as the ARM: tegra: patch in my PR, or do you want Jon's first patch to go thru a different repo?

You can take them all, thanks!

> 
> Tom
> --
> nvpublic
> 
> -----Original Message-----
> From: Jonathan Hunter <jonathanh@nvidia.com> 
> Sent: Thursday, June 18, 2020 8:47 AM
> To: Tom Rini <trini@konsulko.com>; Tom Warren <TWarren@nvidia.com>
> Cc: Stephen Warren <swarren@nvidia.com>; Thierry Reding <treding@nvidia.com>; Peter Robinson <pbrobinson@redhat.com>; Heinrich Schuchardt <xypron.glpk@gmx.de>; u-boot at lists.denx.de
> Subject: Re: [PATCH 1/2] firmware: PSCI: Fix PSCI support for OF live trees
> 
> 
> On 18/06/2020 12:54, Jon Hunter wrote:
> > When CONFIG_OF_LIVE is enabled, dev_of_offset() cannot be used and if 
> > used returns an invalid offset. This causes the call to
> > fdt_stringlist_get() in the psci_probe() to fail to read the 'method'
> > property from the PSCI node for the device and hence prevents PSCI 
> > from working. Fix this by using the ofnode_read_string() API instead 
> > of the fdt_stringlist_get() because this will handle reading the 
> > property both when CONFIG_OF_LIVE is enabled or disabled.
> > 
> > Due to the above problem and since commit 81ea00838c68 ("efi_loader:
> > PSCI reset and shutdown") was added, the EFI system reset has been 
> > broken for Tegra210 and Tegra196 platforms. This also fixes the EFI 
> > system reset for these Tegra platforms.
> 
> Oops, just spotted the above typo. Should be Tegra186 and not Tegra196 (which does not exist!). I can correct that.
> 
> Jon
> 
> --
> nvpublic

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20200618/9b3fbea6/attachment.sig>

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

* [PATCH 2/2] ARM: tegra: Enable PSCI support for Tegra210 and Tegra186
  2020-06-18 11:54 ` [PATCH 2/2] ARM: tegra: Enable PSCI support for Tegra210 and Tegra186 Jon Hunter
  2020-06-18 15:44   ` Peter Robinson
@ 2020-06-22 19:04   ` Stephen Warren
  1 sibling, 0 replies; 8+ messages in thread
From: Stephen Warren @ 2020-06-22 19:04 UTC (permalink / raw)
  To: u-boot

On 6/18/20 5:54 AM, Jon Hunter wrote:
> The PSCI nodes are currently not populated for the Tegra210 and Tegra186
> devices. This prevents the PSCI driver from being able to identify the
> PSCI method used by these devices and causes the probe of the PSCI
> driver to fail.
> 
> Since commit 81ea00838c68 ("efi_loader: PSCI reset and shutdown") was
> added, which moves the PSCI EFI system reset handler into the PSCI
> driver, this has prevented the EFI system reset from working for
> Tegra210 and Tegra186. Therefore, populating these nodes is necessary
> to fix the EFI system reset for Tegra210 and Tegra186.

I'm not sure that these platforms have *always* had a PSCI
implementation, so this is a slight assumption. Ideally, the FW should
add this to the DT and pass it to U-Boot... However, since all recentish
FW builds do implement PSCI, and the DT is hard-coded into U-Boot rather
than provided by the earlier FW, this change is probably just fine.

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

end of thread, other threads:[~2020-06-22 19:04 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-18 11:54 [PATCH 1/2] firmware: PSCI: Fix PSCI support for OF live trees Jon Hunter
2020-06-18 11:54 ` [PATCH 2/2] ARM: tegra: Enable PSCI support for Tegra210 and Tegra186 Jon Hunter
2020-06-18 15:44   ` Peter Robinson
2020-06-22 19:04   ` Stephen Warren
2020-06-18 15:44 ` [PATCH 1/2] firmware: PSCI: Fix PSCI support for OF live trees Peter Robinson
2020-06-18 15:47 ` Jon Hunter
2020-06-18 16:19   ` Tom Warren
2020-06-18 16:27     ` Tom Rini

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.