public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH 1/2] arm: k3: Fix getting ti_sci handle
@ 2019-09-09  7:17 Lokesh Vutla
  2019-09-09  7:17 ` [U-Boot] [PATCH 2/2] arm: k3: Use get_ti_sci_handle() where ever possible Lokesh Vutla
  2019-09-14 23:55 ` [U-Boot] [PATCH 1/2] arm: k3: Fix getting ti_sci handle Tom Rini
  0 siblings, 2 replies; 4+ messages in thread
From: Lokesh Vutla @ 2019-09-09  7:17 UTC (permalink / raw)
  To: u-boot

API get_ti_sci_handle() is relying on the device-tree node name
to be "dmsc" for probing the ti_sci device. But with the introduction
of debug messages for dmsc, the node name changed to dmsc at 44083000.
Because of this ti_sci is never probed cause a boot failure. Instead
of relying on device-tree node name, use the first available firmware
node for probing ti_sci.

Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
---
 arch/arm/mach-k3/common.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/mach-k3/common.c b/arch/arm/mach-k3/common.c
index bab5ffdf40..3e36d90ace 100644
--- a/arch/arm/mach-k3/common.c
+++ b/arch/arm/mach-k3/common.c
@@ -20,7 +20,7 @@ struct ti_sci_handle *get_ti_sci_handle(void)
 	struct udevice *dev;
 	int ret;
 
-	ret = uclass_get_device_by_name(UCLASS_FIRMWARE, "dmsc", &dev);
+	ret = uclass_get_device(UCLASS_FIRMWARE, 0, &dev);
 	if (ret)
 		panic("Failed to get SYSFW (%d)\n", ret);
 
-- 
2.22.0

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

* [U-Boot] [PATCH 2/2] arm: k3: Use get_ti_sci_handle() where ever possible
  2019-09-09  7:17 [U-Boot] [PATCH 1/2] arm: k3: Fix getting ti_sci handle Lokesh Vutla
@ 2019-09-09  7:17 ` Lokesh Vutla
  2019-09-14 23:55   ` Tom Rini
  2019-09-14 23:55 ` [U-Boot] [PATCH 1/2] arm: k3: Fix getting ti_sci handle Tom Rini
  1 sibling, 1 reply; 4+ messages in thread
From: Lokesh Vutla @ 2019-09-09  7:17 UTC (permalink / raw)
  To: u-boot

Instead of calling uclass apis everywhere, use get_ti_sci_handle()
when ever ti_sci is needed.

Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
---
 arch/arm/mach-k3/am6_init.c | 16 +++-------------
 arch/arm/mach-k3/security.c | 15 +++------------
 2 files changed, 6 insertions(+), 25 deletions(-)

diff --git a/arch/arm/mach-k3/am6_init.c b/arch/arm/mach-k3/am6_init.c
index 6558fe0ef4..0b564f7bd1 100644
--- a/arch/arm/mach-k3/am6_init.c
+++ b/arch/arm/mach-k3/am6_init.c
@@ -219,10 +219,9 @@ u32 spl_boot_device(void)
 
 void release_resources_for_core_shutdown(void)
 {
-	struct udevice *dev;
-	struct ti_sci_handle *ti_sci;
-	struct ti_sci_dev_ops *dev_ops;
-	struct ti_sci_proc_ops *proc_ops;
+	struct ti_sci_handle *ti_sci = get_ti_sci_handle();
+	struct ti_sci_dev_ops *dev_ops = &ti_sci->ops.dev_ops;
+	struct ti_sci_proc_ops *proc_ops = &ti_sci->ops.proc_ops;
 	int ret;
 	u32 i;
 
@@ -231,15 +230,6 @@ void release_resources_for_core_shutdown(void)
 		AM6_DEV_MCU_RTI1,
 	};
 
-	/* Get handle to Device Management and Security Controller (SYSFW) */
-	ret = uclass_get_device_by_name(UCLASS_FIRMWARE, "dmsc", &dev);
-	if (ret)
-		panic("Failed to get handle to SYSFW (%d)\n", ret);
-
-	ti_sci = (struct ti_sci_handle *)(ti_sci_get_handle_from_sysfw(dev));
-	dev_ops = &ti_sci->ops.dev_ops;
-	proc_ops = &ti_sci->ops.proc_ops;
-
 	/* Iterate through list of devices to put (shutdown) */
 	for (i = 0; i < ARRAY_SIZE(put_device_ids); i++) {
 		u32 id = put_device_ids[i];
diff --git a/arch/arm/mach-k3/security.c b/arch/arm/mach-k3/security.c
index 52f49bf01f..4e011ee10e 100644
--- a/arch/arm/mach-k3/security.c
+++ b/arch/arm/mach-k3/security.c
@@ -11,25 +11,16 @@
 #include <linux/soc/ti/ti_sci_protocol.h>
 #include <mach/spl.h>
 #include <spl.h>
+#include <asm/arch/sys_proto.h>
 
 void board_fit_image_post_process(void **p_image, size_t *p_size)
 {
-	struct udevice *dev;
-	struct ti_sci_handle *ti_sci;
-	struct ti_sci_proc_ops *proc_ops;
+	struct ti_sci_handle *ti_sci = get_ti_sci_handle();
+	struct ti_sci_proc_ops *proc_ops = &ti_sci->ops.proc_ops;
 	u64 image_addr;
 	u32 image_size;
 	int ret;
 
-	/* Get handle to Device Management and Security Controller (SYSFW) */
-	ret = uclass_get_device_by_name(UCLASS_FIRMWARE, "dmsc", &dev);
-	if (ret) {
-		printf("Failed to get handle to SYSFW (%d)\n", ret);
-		hang();
-	}
-	ti_sci = (struct ti_sci_handle *)(ti_sci_get_handle_from_sysfw(dev));
-	proc_ops = &ti_sci->ops.proc_ops;
-
 	image_addr = (uintptr_t)*p_image;
 
 	debug("Authenticating image at address 0x%016llx\n", image_addr);
-- 
2.22.0

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

* [U-Boot] [PATCH 1/2] arm: k3: Fix getting ti_sci handle
  2019-09-09  7:17 [U-Boot] [PATCH 1/2] arm: k3: Fix getting ti_sci handle Lokesh Vutla
  2019-09-09  7:17 ` [U-Boot] [PATCH 2/2] arm: k3: Use get_ti_sci_handle() where ever possible Lokesh Vutla
@ 2019-09-14 23:55 ` Tom Rini
  1 sibling, 0 replies; 4+ messages in thread
From: Tom Rini @ 2019-09-14 23:55 UTC (permalink / raw)
  To: u-boot

On Mon, Sep 09, 2019 at 12:47:37PM +0530, Lokesh Vutla wrote:

> API get_ti_sci_handle() is relying on the device-tree node name
> to be "dmsc" for probing the ti_sci device. But with the introduction
> of debug messages for dmsc, the node name changed to dmsc at 44083000.
> Because of this ti_sci is never probed cause a boot failure. Instead
> of relying on device-tree node name, use the first available firmware
> node for probing ti_sci.
> 
> Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>

Applied to u-boot/master, thanks!

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190914/95e7f493/attachment.sig>

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

* [U-Boot] [PATCH 2/2] arm: k3: Use get_ti_sci_handle() where ever possible
  2019-09-09  7:17 ` [U-Boot] [PATCH 2/2] arm: k3: Use get_ti_sci_handle() where ever possible Lokesh Vutla
@ 2019-09-14 23:55   ` Tom Rini
  0 siblings, 0 replies; 4+ messages in thread
From: Tom Rini @ 2019-09-14 23:55 UTC (permalink / raw)
  To: u-boot

On Mon, Sep 09, 2019 at 12:47:38PM +0530, Lokesh Vutla wrote:

> Instead of calling uclass apis everywhere, use get_ti_sci_handle()
> when ever ti_sci is needed.
> 
> Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>

Applied to u-boot/master, thanks!

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190914/fcc33625/attachment.sig>

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

end of thread, other threads:[~2019-09-14 23:55 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-09-09  7:17 [U-Boot] [PATCH 1/2] arm: k3: Fix getting ti_sci handle Lokesh Vutla
2019-09-09  7:17 ` [U-Boot] [PATCH 2/2] arm: k3: Use get_ti_sci_handle() where ever possible Lokesh Vutla
2019-09-14 23:55   ` Tom Rini
2019-09-14 23:55 ` [U-Boot] [PATCH 1/2] arm: k3: Fix getting ti_sci handle Tom Rini

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