From 75a11cc7714007691994630eaf4a8ba82a9e1a98 Mon Sep 17 00:00:00 2001 From: Lokesh Vutla Date: Fri, 7 Jun 2019 19:25:55 +0530 Subject: cmd: remoteproc: Add support for initializing devices individually 'rproc init' does the probe and initialization of all the available remoteproc devices in the system. This doesn't allow the flexibility to initialize the remote cores needed as per use case. In order to provide flexibility, update 'rproc init' command to accept one more parameter with rproc id which when passed initializes only that specific core. If no id is passed, command will initializes all the cores which is compatible with the existing behaviour. Signed-off-by: Lokesh Vutla --- cmd/remoteproc.c | 33 ++++++++++++++++++--------------- 1 file changed, 18 insertions(+), 15 deletions(-) (limited to 'cmd') diff --git a/cmd/remoteproc.c b/cmd/remoteproc.c index 81463f36b6..9702cf08f7 100644 --- a/cmd/remoteproc.c +++ b/cmd/remoteproc.c @@ -68,12 +68,22 @@ static int print_remoteproc_list(void) static int do_rproc_init(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[]) { + int id; + if (rproc_is_initialized()) { printf("\tRemote Processors are already initialized\n"); - } else { + return CMD_RET_FAILURE; + } + + if (argc == 1) { if (!rproc_init()) return 0; - printf("Few Remote Processors failed to be initalized\n"); + printf("Few Remote Processors failed to be initialized\n"); + } else if (argc == 2) { + id = (int)simple_strtoul(argv[1], NULL, 10); + if (!rproc_dev_init(id)) + return 0; + printf("Remote Processor %d failed to be initialized\n", id); } return CMD_RET_FAILURE; @@ -130,11 +140,6 @@ static int do_remoteproc_load(cmd_tbl_t *cmdtp, int flag, int argc, return CMD_RET_USAGE; } - if (!rproc_is_initialized()) { - printf("\tRemote Processors are not initialized\n"); - return CMD_RET_USAGE; - } - ret = rproc_load(id, addr, size); printf("Load Remote Processor %d with data@addr=0x%08lx %lu bytes:%s\n", id, addr, size, ret ? " Failed!" : " Success!"); @@ -165,11 +170,6 @@ static int do_remoteproc_wrapper(cmd_tbl_t *cmdtp, int flag, int argc, id = (int)simple_strtoul(argv[1], NULL, 10); - if (!rproc_is_initialized()) { - printf("\tRemote Processors are not initialized\n"); - return CMD_RET_USAGE; - } - if (!strcmp(argv[0], "start")) { ret = rproc_start(id); } else if (!strcmp(argv[0], "stop")) { @@ -203,8 +203,10 @@ static int do_remoteproc_wrapper(cmd_tbl_t *cmdtp, int flag, int argc, } static cmd_tbl_t cmd_remoteproc_sub[] = { - U_BOOT_CMD_MKENT(init, 0, 1, do_rproc_init, - "Enumerate and initialize all processors", ""), + U_BOOT_CMD_MKENT(init, 1, 1, do_rproc_init, + "Enumerate and initialize the remote processor(s)", + "id - ID of the remote processor\n" + "If id is not passed, initialize all the remote processors"), U_BOOT_CMD_MKENT(list, 0, 1, do_remoteproc_list, "list remote processors", ""), U_BOOT_CMD_MKENT(load, 5, 1, do_remoteproc_load, @@ -270,7 +272,8 @@ U_BOOT_CMD(rproc, 5, 1, do_remoteproc, "\t\tNote: Services are dependent on the driver capability\n" "\t\t 'list' command shows the capability of each device\n" "\n\tSubcommands:\n" - "\tinit - Enumerate and initalize the remote processors\n" + "\tinit - Enumerate and initalize the remote processor.\n" + "\t if id is not passed, initialize all the remote prcessors\n" "\tlist - list available remote processors\n" "\tload [addr] [size]- Load the remote processor with binary\n" "\t image stored at address [addr] in memory\n" -- cgit v1.2.1 From 96f41f9cde17373680a652e39c8521fcf0a9722f Mon Sep 17 00:00:00 2001 From: Lokesh Vutla Date: Fri, 7 Jun 2019 19:25:56 +0530 Subject: cmd: remoteproc: Allow list command to print the probed devices 'rproc list' is currently allowed only after probing all the available remoteproc devices. Given that 'rproc init' is updated to probe and initialize devices individually, allow the 'rproc list' command to print all probed devices at any point. Signed-off-by: Lokesh Vutla --- cmd/remoteproc.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'cmd') diff --git a/cmd/remoteproc.c b/cmd/remoteproc.c index 9702cf08f7..da6f3fc8cc 100644 --- a/cmd/remoteproc.c +++ b/cmd/remoteproc.c @@ -34,6 +34,10 @@ static int print_remoteproc_list(void) uc_pdata = dev_get_uclass_platdata(dev); + /* Do not print if rproc is not probed */ + if (!(dev->flags & DM_FLAG_ACTIVATED)) + continue; + switch (uc_pdata->mem_type) { case RPROC_INTERNAL_MEMORY_MAPPED: type = "internal memory mapped"; @@ -101,11 +105,6 @@ static int do_rproc_init(cmd_tbl_t *cmdtp, int flag, int argc, static int do_remoteproc_list(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[]) { - if (!rproc_is_initialized()) { - printf("\t Remote Processors is not initialized\n"); - return CMD_RET_USAGE; - } - if (print_remoteproc_list()) return CMD_RET_FAILURE; -- cgit v1.2.1