All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] xilinx: zynqmp: Enable pmufw config reloading
@ 2020-06-15 10:19 Michal Simek
  2020-06-25  8:08 ` Michal Simek
  0 siblings, 1 reply; 2+ messages in thread
From: Michal Simek @ 2020-06-15 10:19 UTC (permalink / raw)
  To: u-boot

PMU FW has functionality to accept and reload configuration object at run
time. The patch is adding support for doing it via u-boot prompt.

For example:
tftpboot 100000 pmu_obj.bin
zynqmp pmufw 100000 $filesize

The most of pmufw configurations don't allow config reloading.
Also official Xilinx PMUFW doens't support this feature properly but the
patch should open a way to call PMUFW with this request.

Here is example of PMUFW config fragment which enables config reloading.

/* SET CONFIG SECTION */
PM_CONFIG_SET_CONFIG_SECTION_ID,        /* Section ID */
PM_CONFIG_IPI_PSU_CORTEXA53_0_MASK | PM_CONFIG_IPI_PSU_CORTEXR5_0_MASK |
PM_CONFIG_IPI_PSU_CORTEXR5_1_MASK, /* Permissions to set config */

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
---

 board/xilinx/zynqmp/cmds.c | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/board/xilinx/zynqmp/cmds.c b/board/xilinx/zynqmp/cmds.c
index 0f1f26986f21..c0d28a73e45d 100644
--- a/board/xilinx/zynqmp/cmds.c
+++ b/board/xilinx/zynqmp/cmds.c
@@ -130,8 +130,27 @@ static int do_zynqmp_tcm_init(struct cmd_tbl *cmdtp, int flag, int argc,
 }
 #endif
 
+static int do_zynqmp_pmufw(struct cmd_tbl *cmdtp, int flag, int argc,
+			   char * const argv[])
+{
+	u32 addr, size;
+
+	if (argc != cmdtp->maxargs)
+		return CMD_RET_USAGE;
+
+	addr = simple_strtoul(argv[2], NULL, 16);
+	size = simple_strtoul(argv[3], NULL, 16);
+	flush_dcache_range((ulong)addr, (ulong)(addr + size));
+
+	zynqmp_pmufw_load_config_object((const void *)(uintptr_t)addr,
+					(size_t)size);
+
+	return 0;
+}
+
 static struct cmd_tbl cmd_zynqmp_sub[] = {
 	U_BOOT_CMD_MKENT(secure, 5, 0, do_zynqmp_verify_secure, "", ""),
+	U_BOOT_CMD_MKENT(pmufw, 4, 0, do_zynqmp_pmufw, "", ""),
 	U_BOOT_CMD_MKENT(mmio_read, 3, 0, do_zynqmp_mmio_read, "", ""),
 	U_BOOT_CMD_MKENT(mmio_write, 5, 0, do_zynqmp_mmio_write, "", ""),
 #ifdef CONFIG_DEFINE_TCM_OCM_MMAP
@@ -184,6 +203,7 @@ static char zynqmp_help_text[] =
 	"		       to be initialized. Supported modes will be\n"
 	"		       lock(0)/split(1)\n"
 #endif
+	"zynqmp pmufw address size - load PMU FW configuration object\n"
 	;
 #endif
 
-- 
2.27.0

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

* [PATCH] xilinx: zynqmp: Enable pmufw config reloading
  2020-06-15 10:19 [PATCH] xilinx: zynqmp: Enable pmufw config reloading Michal Simek
@ 2020-06-25  8:08 ` Michal Simek
  0 siblings, 0 replies; 2+ messages in thread
From: Michal Simek @ 2020-06-25  8:08 UTC (permalink / raw)
  To: u-boot

po 15. 6. 2020 v 12:19 odes?latel Michal Simek <michal.simek@xilinx.com> napsal:
>
> PMU FW has functionality to accept and reload configuration object at run
> time. The patch is adding support for doing it via u-boot prompt.
>
> For example:
> tftpboot 100000 pmu_obj.bin
> zynqmp pmufw 100000 $filesize
>
> The most of pmufw configurations don't allow config reloading.
> Also official Xilinx PMUFW doens't support this feature properly but the
> patch should open a way to call PMUFW with this request.
>
> Here is example of PMUFW config fragment which enables config reloading.
>
> /* SET CONFIG SECTION */
> PM_CONFIG_SET_CONFIG_SECTION_ID,        /* Section ID */
> PM_CONFIG_IPI_PSU_CORTEXA53_0_MASK | PM_CONFIG_IPI_PSU_CORTEXR5_0_MASK |
> PM_CONFIG_IPI_PSU_CORTEXR5_1_MASK, /* Permissions to set config */
>
> Signed-off-by: Michal Simek <michal.simek@xilinx.com>
> ---
>
>  board/xilinx/zynqmp/cmds.c | 20 ++++++++++++++++++++
>  1 file changed, 20 insertions(+)
>
> diff --git a/board/xilinx/zynqmp/cmds.c b/board/xilinx/zynqmp/cmds.c
> index 0f1f26986f21..c0d28a73e45d 100644
> --- a/board/xilinx/zynqmp/cmds.c
> +++ b/board/xilinx/zynqmp/cmds.c
> @@ -130,8 +130,27 @@ static int do_zynqmp_tcm_init(struct cmd_tbl *cmdtp, int flag, int argc,
>  }
>  #endif
>
> +static int do_zynqmp_pmufw(struct cmd_tbl *cmdtp, int flag, int argc,
> +                          char * const argv[])
> +{
> +       u32 addr, size;
> +
> +       if (argc != cmdtp->maxargs)
> +               return CMD_RET_USAGE;
> +
> +       addr = simple_strtoul(argv[2], NULL, 16);
> +       size = simple_strtoul(argv[3], NULL, 16);
> +       flush_dcache_range((ulong)addr, (ulong)(addr + size));
> +
> +       zynqmp_pmufw_load_config_object((const void *)(uintptr_t)addr,
> +                                       (size_t)size);
> +
> +       return 0;
> +}
> +
>  static struct cmd_tbl cmd_zynqmp_sub[] = {
>         U_BOOT_CMD_MKENT(secure, 5, 0, do_zynqmp_verify_secure, "", ""),
> +       U_BOOT_CMD_MKENT(pmufw, 4, 0, do_zynqmp_pmufw, "", ""),
>         U_BOOT_CMD_MKENT(mmio_read, 3, 0, do_zynqmp_mmio_read, "", ""),
>         U_BOOT_CMD_MKENT(mmio_write, 5, 0, do_zynqmp_mmio_write, "", ""),
>  #ifdef CONFIG_DEFINE_TCM_OCM_MMAP
> @@ -184,6 +203,7 @@ static char zynqmp_help_text[] =
>         "                      to be initialized. Supported modes will be\n"
>         "                      lock(0)/split(1)\n"
>  #endif
> +       "zynqmp pmufw address size - load PMU FW configuration object\n"
>         ;
>  #endif
>
> --
> 2.27.0
>

Applied.
M

-- 
Michal Simek, Ing. (M.Eng), OpenPGP -> KeyID: FE3D1F91
w: www.monstr.eu p: +42-0-721842854
Maintainer of Linux kernel - Xilinx Microblaze
Maintainer of Linux kernel - Xilinx Zynq ARM and ZynqMP ARM64 SoCs
U-Boot custodian - Xilinx Microblaze/Zynq/ZynqMP/Versal SoCs

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

end of thread, other threads:[~2020-06-25  8:08 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-15 10:19 [PATCH] xilinx: zynqmp: Enable pmufw config reloading Michal Simek
2020-06-25  8:08 ` Michal Simek

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.