diff options
author | Tom Rini <trini@konsulko.com> | 2022-04-23 08:06:28 -0400 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2022-04-23 08:06:28 -0400 |
commit | 9bb99fa95826d1a608737ca821977b4136a1a278 (patch) | |
tree | 264c39d01f071f308b3b7f8bc88b20cb09681653 /cmd | |
parent | faeb5641131ba0bfafa5ed61dd03b98b1f2a5edb (diff) | |
parent | a609353e82fd757b7635d18ed6a0828fff657d59 (diff) | |
download | u-boot-9bb99fa95826d1a608737ca821977b4136a1a278.tar.gz u-boot-9bb99fa95826d1a608737ca821977b4136a1a278.tar.bz2 u-boot-9bb99fa95826d1a608737ca821977b4136a1a278.zip |
Merge branch '2022-04-22-assorted-updates'
- Add "-q" to fdt addr and use it in distro_bootcmd to make the user
experience less scary reading in normal try/fail cases.
- Let the adc update an environment variable like many other commands do
- Fix TPL SEPARATE_BSS check when locating DTB
- Allow ":" in PXE file names again
- Two Apple M1 fixes
Diffstat (limited to 'cmd')
-rw-r--r-- | cmd/adc.c | 18 | ||||
-rw-r--r-- | cmd/fdt.c | 30 |
2 files changed, 37 insertions, 11 deletions
@@ -71,13 +71,17 @@ static int do_adc_info(struct cmd_tbl *cmdtp, int flag, int argc, static int do_adc_single(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) { + char *varname = NULL; struct udevice *dev; unsigned int data; - int ret, uV; + int ret, uV, val; if (argc < 3) return CMD_RET_USAGE; + if (argc >= 3) + varname = argv[2]; + ret = adc_channel_single_shot(argv[1], simple_strtol(argv[2], NULL, 0), &data); if (ret) { @@ -87,10 +91,16 @@ static int do_adc_single(struct cmd_tbl *cmdtp, int flag, int argc, } ret = uclass_get_device_by_name(UCLASS_ADC, argv[1], &dev); - if (!ret && !adc_raw_to_uV(dev, data, &uV)) + if (!ret && !adc_raw_to_uV(dev, data, &uV)) { + val = uV; printf("%u, %d uV\n", data, uV); - else + } else { + val = data; printf("%u\n", data); + } + + if (varname) + env_set_ulong(varname, val); return CMD_RET_SUCCESS; } @@ -149,7 +159,7 @@ static int do_adc_scan(struct cmd_tbl *cmdtp, int flag, int argc, static char adc_help_text[] = "list - list ADC devices\n" "adc info <name> - Get ADC device info\n" - "adc single <name> <channel> - Get Single data of ADC device channel\n" + "adc single <name> <channel> [varname] - Get Single data of ADC device channel\n" "adc scan <name> [channel mask] - Scan all [or masked] ADC channels"; U_BOOT_CMD_WITH_SUBCMDS(adc, "ADC sub-system", adc_help_text, @@ -119,13 +119,27 @@ static int do_fdt(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) if (strncmp(argv[1], "ad", 2) == 0) { unsigned long addr; int control = 0; + int quiet = 0; struct fdt_header *blob; /* Set the address [and length] of the fdt */ argc -= 2; argv += 2; - if (argc && !strcmp(*argv, "-c")) { - control = 1; + while (argc > 0 && **argv == '-') { + char *arg = *argv; + + while (*++arg) { + switch (*arg) { + case 'c': + control = 1; + break; + case 'q': + quiet = 1; + break; + default: + return CMD_RET_USAGE; + } + } argc--; argv++; } @@ -145,7 +159,8 @@ static int do_fdt(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) addr = hextoul(argv[0], NULL); blob = map_sysmem(addr, 0); - if (!fdt_valid(&blob)) + if ((quiet && fdt_check_header(blob)) || + (!quiet && !fdt_valid(&blob))) return 1; if (control) gd->fdt_blob = blob; @@ -159,12 +174,13 @@ static int do_fdt(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) /* Optional new length */ len = hextoul(argv[1], NULL); if (len < fdt_totalsize(blob)) { - printf("New length %d < existing length %d, ignoring\n", - len, fdt_totalsize(blob)); + if (!quiet) + printf("New length %d < existing length %d, ignoring\n", + len, fdt_totalsize(blob)); } else { /* Open in place with a new length */ err = fdt_open_into(blob, blob, len); - if (err != 0) { + if (!quiet && err != 0) { printf("libfdt fdt_open_into(): %s\n", fdt_strerror(err)); } @@ -1055,7 +1071,7 @@ static int fdt_print(const char *pathp, char *prop, int depth) /********************************************************************/ #ifdef CONFIG_SYS_LONGHELP static char fdt_help_text[] = - "addr [-c] <addr> [<length>] - Set the [control] fdt location to <addr>\n" + "addr [-cq] <addr> [<length>] - Set the [control] fdt location to <addr>\n" #ifdef CONFIG_OF_LIBFDT_OVERLAY "fdt apply <addr> - Apply overlay to the DT\n" #endif |