summaryrefslogtreecommitdiff
path: root/cmd
diff options
context:
space:
mode:
Diffstat (limited to 'cmd')
-rw-r--r--cmd/Kconfig124
-rw-r--r--cmd/Makefile3
-rw-r--r--cmd/bdinfo.c19
-rw-r--r--cmd/bootefi.c13
-rw-r--r--cmd/bootmenu.c10
-rw-r--r--cmd/clone.c2
-rw-r--r--cmd/config.c26
-rw-r--r--cmd/conitrace.c4
-rw-r--r--cmd/cros_ec.c4
-rw-r--r--cmd/date.c11
-rw-r--r--cmd/eficonfig.c12
-rw-r--r--cmd/eficonfig_sbkey.c4
-rw-r--r--cmd/efidebug.c5
-rw-r--r--cmd/fastboot.c13
-rw-r--r--cmd/fdt.c14
-rw-r--r--cmd/fpga.c2
-rw-r--r--cmd/host.c5
-rw-r--r--cmd/ini.c15
-rw-r--r--cmd/lwip/ping.c19
-rw-r--r--cmd/lwip/sntp.c10
-rw-r--r--cmd/mmc.c21
-rw-r--r--cmd/nvedit_efi.c10
-rw-r--r--cmd/part.c12
-rw-r--r--cmd/pmbus.c814
-rw-r--r--cmd/read.c2
-rw-r--r--cmd/ti/Kconfig18
-rw-r--r--cmd/ti/ddr4.c8
-rw-r--r--cmd/ubi.c272
-rw-r--r--cmd/ubifs.c2
-rw-r--r--cmd/ufetch.c33
-rw-r--r--cmd/upl.c2
-rw-r--r--cmd/usb_mass_storage.c11
-rw-r--r--cmd/x86/zboot.c3
33 files changed, 1245 insertions, 278 deletions
diff --git a/cmd/Kconfig b/cmd/Kconfig
index 9b8a13c3446..35ce42f8397 100644
--- a/cmd/Kconfig
+++ b/cmd/Kconfig
@@ -47,6 +47,14 @@ config HUSH_SELECTABLE
default y if HUSH_OLD_PARSER && HUSH_MODERN_PARSER
endmenu
+config CMDLINE_FLUSH_STDIN
+ bool "Enable flushing input before starting cli"
+ help
+ When this option is enabled the stdin buffer will be flushed before
+ starting the CLI. This is useful when stdin is changed during boot
+ (e.g. from nulldev to serial) and junk characters may be pending
+ in the buffer.
+
config CMDLINE_EDITING
bool "Enable command line editing"
default y
@@ -873,12 +881,12 @@ config EEPROM_LAYOUT_VERSIONS
via the -l option.
config EEPROM_LAYOUT_HELP_STRING
- string "Tells user what layout names are supported"
- depends on EEPROM_LAYOUT_VERSIONS
- default "<not defined>"
- help
- Help printed with the LAYOUT VERSIONS part of the 'eeprom'
- command's help.
+ string "Tells user what layout names are supported"
+ depends on EEPROM_LAYOUT_VERSIONS
+ default "<not defined>"
+ help
+ Help printed with the LAYOUT VERSIONS part of the 'eeprom'
+ command's help.
config SYS_I2C_EEPROM_BUS
int "I2C bus of the EEPROM device."
@@ -959,14 +967,14 @@ config CMD_MEMORY
default y
help
Memory commands.
- md - memory display
- mm - memory modify (auto-incrementing address)
- nm - memory modify (constant address)
- mw - memory write (fill)
- cp - memory copy
- cmp - memory compare
- base - print or set address offset
- loop - initialize loop on address range
+ md - memory display
+ mm - memory modify (auto-incrementing address)
+ nm - memory modify (constant address)
+ mw - memory write (fill)
+ cp - memory copy
+ cmp - memory compare
+ base - print or set address offset
+ loop - initialize loop on address range
config CMD_MEM_SEARCH
bool "ms - Memory search"
@@ -1107,9 +1115,9 @@ config CMD_ARMFFA
help
Provides a test command for the FF-A support
supported options:
- - Listing the partition(s) info
- - Sending a data pattern to the specified partition
- - Displaying the arm_ffa device info
+ - Listing the partition(s) info
+ - Sending a data pattern to the specified partition
+ - Displaying the arm_ffa device info
config CMD_ARMFLASH
bool "armflash"
@@ -1200,15 +1208,22 @@ config CMD_FASTBOOT
See doc/android/fastboot.rst for more information.
+config CMD_FASTBOOT_ABORT_KEYED
+ bool "fastboot abort with any key"
+ depends on CMD_FASTBOOT && USB_FUNCTION_FASTBOOT
+ help
+ Allow interruption of USB fastboot mode by any key presses,
+ rather than just Ctrl-c.
+
config CMD_FLASH
bool "flinfo, erase, protect"
default y
depends on FLASH_CFI_DRIVER || MTD_NOR_FLASH
help
NOR flash support.
- flinfo - print FLASH memory information
- erase - FLASH memory
- protect - enable or disable FLASH write protection
+ flinfo - print FLASH memory information
+ erase - FLASH memory
+ protect - enable or disable FLASH write protection
config CMD_FPGA
bool "fpga"
@@ -1384,6 +1399,7 @@ config CMD_IOTRACE
config CMD_I2C
bool "i2c"
+ depends on DM_I2C || SYS_I2C_LEGACY
help
I2C support.
@@ -1540,7 +1556,7 @@ config CMD_OPTEE
bool "Enable OP-TEE commands"
depends on OPTEE
help
- OP-TEE commands support.
+ OP-TEE commands support.
config CMD_MTD
bool "mtd"
@@ -1598,7 +1614,7 @@ config CMD_MUX
bool "mux"
depends on MULTIPLEXER
help
- List, select, and deselect mux controllers on the fly.
+ List, select, and deselect mux controllers on the fly.
config CMD_NAND
bool "nand"
@@ -1806,7 +1822,7 @@ config CMD_UFS
depends on UFS
help
"This provides commands to initialise and configure universal flash
- subsystem devices"
+ subsystem devices"
config CMD_USB
bool "usb"
@@ -1863,8 +1879,8 @@ config CMD_PVBLOCK
config CMD_VIRTIO
bool "virtio"
- depends on VIRTIO
- default y if VIRTIO
+ depends on VIRTIO_BLK
+ default y if VIRTIO_BLK
help
VirtIO block device support
@@ -1928,7 +1944,7 @@ config CMD_SETEXPR
default y
help
Evaluate boolean and math expressions and store the result in an env
- variable.
+ variable.
Also supports loading the value at a memory location into a variable.
If CONFIG_REGEX is enabled, setexpr also supports a gsub function.
@@ -1946,7 +1962,7 @@ config CMD_XXD
endmenu
-if NET || NET_LWIP
+if NET
menuconfig CMD_NET
bool "Network commands"
@@ -1954,7 +1970,7 @@ menuconfig CMD_NET
if CMD_NET
-if NET
+if NET_LEGACY
config CMD_BOOTP
bool "bootp"
@@ -2198,12 +2214,12 @@ config CMD_WOL
help
Wait for wake-on-lan Magic Packet
-endif # if NET
+endif # if NET_LEGACY
config CMD_DHCP
bool "dhcp"
select PROT_DHCP_LWIP if NET_LWIP
- select CMD_BOOTP if NET
+ select CMD_BOOTP if NET_LEGACY
help
Boot image via network using DHCP/TFTP protocol
@@ -2259,7 +2275,7 @@ config CMD_PING
config CMD_SNTP
bool "sntp"
- select PROT_UDP if NET
+ select PROT_UDP if NET_LEGACY
select PROT_UDP_LWIP if NET_LWIP
help
Synchronize RTC via network
@@ -2329,7 +2345,7 @@ config CMD_PXE
endif # if CMD_NET
-endif # NET || NET_LWIP
+endif # NET
menu "Misc commands"
@@ -2634,9 +2650,9 @@ config CMD_PSTORE_ECC_SIZE
depends on CMD_PSTORE
default "0"
help
- if non-zero, the option enables ECC support and specifies ECC buffer
- size in bytes (1 is a special value, means 16 bytes ECC), should be
- identical to ramoops.ramoops_ecc parameter used by kernel
+ if non-zero, the option enables ECC support and specifies ECC buffer
+ size in bytes (1 is a special value, means 16 bytes ECC), should be
+ identical to ramoops.ramoops_ecc parameter used by kernel
endif
@@ -2707,6 +2723,20 @@ config CMD_PMIC
- pmic write address - write byte to register at address
The only one change for this command is 'dev' subcommand.
+config CMD_PMBUS
+ bool "pmbus device interrogation and control command"
+ depends on PMBUS
+ help
+ Enable the pmbus U-Boot CLI command. Provides identification,
+ decoded telemetry, STATUS_* decoding, raw register read/write,
+ CLEAR_FAULTS, and VOUT_COMMAND set/get against any PMBus 1.x
+ compliant device selectable via 'pmbus dev <bus>:<addr>'.
+
+ Per chip drivers and board files publish vendor extensions in
+ the 'pmbus <vendor> ...' namespace.
+
+ See doc/develop/pmbus.rst for the full usage reference.
+
config CMD_REGULATOR
bool "Enable Driver Model REGULATOR command"
depends on DM_REGULATOR
@@ -3148,15 +3178,15 @@ config CMD_AVB
help
Enables a "avb" command to perform verification of partitions using
Android Verified Boot 2.0 functionality. It includes such subcommands:
- avb init - initialize avb2 subsystem
- avb read_rb - read rollback index
- avb write_rb - write rollback index
- avb is_unlocked - check device lock state
- avb get_uuid - read and print uuid of a partition
- avb read_part - read data from partition
- avb read_part_hex - read data from partition and output to stdout
- avb write_part - write data to partition
- avb verify - run full verification chain
+ avb init - initialize avb2 subsystem
+ avb read_rb - read rollback index
+ avb write_rb - write rollback index
+ avb is_unlocked - check device lock state
+ avb get_uuid - read and print uuid of a partition
+ avb read_part - read data from partition
+ avb read_part_hex - read data from partition and output to stdout
+ avb write_part - write data to partition
+ avb verify - run full verification chain
config CMD_STACKPROTECTOR_TEST
bool "Test command for stack protector"
@@ -3169,7 +3199,7 @@ config CMD_STACKPROTECTOR_TEST
endmenu
config CMD_UBI
- tristate "Enable UBI - Unsorted block images commands"
+ bool "Enable UBI - Unsorted block images commands"
select MTD_UBI
help
UBI is a software layer above MTD layer which admits use of LVM-like
@@ -3186,10 +3216,10 @@ config CMD_UBI_RENAME
depends on CMD_UBI
help
Enable a "ubi" command to rename ubi volume:
- ubi rename <oldname> <newname>
+ ubi rename <oldname> <newname>
config CMD_UBIFS
- tristate "Enable UBIFS - Unsorted block images filesystem commands"
+ bool "Enable UBIFS - Unsorted block images filesystem commands"
depends on CMD_UBI
default y if CMD_UBI
select LZO
diff --git a/cmd/Makefile b/cmd/Makefile
index 6b69da1f2b0..ce772e5555b 100644
--- a/cmd/Makefile
+++ b/cmd/Makefile
@@ -131,7 +131,7 @@ obj-y += legacy-mtd-utils.o
endif
obj-$(CONFIG_CMD_MUX) += mux.o
obj-$(CONFIG_CMD_NAND) += nand.o
-ifdef CONFIG_NET
+ifdef CONFIG_NET_LEGACY
obj-$(CONFIG_CMD_NET) += net.o net-common.o
else ifdef CONFIG_NET_LWIP
obj-$(CONFIG_CMD_NET) += net-common.o
@@ -228,6 +228,7 @@ obj-$(CONFIG_CMD_AXI) += axi.o
obj-$(CONFIG_CMD_PVBLOCK) += pvblock.o
# Power
+obj-$(CONFIG_CMD_PMBUS) += pmbus.o
obj-$(CONFIG_CMD_PMIC) += pmic.o
obj-$(CONFIG_CMD_REGULATOR) += regulator.o
diff --git a/cmd/bdinfo.c b/cmd/bdinfo.c
index dc7c2c3c853..bf1eca75904 100644
--- a/cmd/bdinfo.c
+++ b/cmd/bdinfo.c
@@ -77,15 +77,15 @@ void bdinfo_print_mhz(const char *name, unsigned long hz)
printf("%-12s= %6s MHz\n", name, strmhz(buf, hz));
}
-static void print_bi_dram(const struct bd_info *bd)
+static void print_dram(const struct bd_info *bd)
{
int i;
for (i = 0; i < CONFIG_NR_DRAM_BANKS; ++i) {
- if (bd->bi_dram[i].size) {
+ if (gd->dram[i].size) {
bdinfo_print_num_l("DRAM bank", i);
- bdinfo_print_num_ll("-> start", bd->bi_dram[i].start);
- bdinfo_print_num_ll("-> size", bd->bi_dram[i].size);
+ bdinfo_print_num_ll("-> start", gd->dram[i].start);
+ bdinfo_print_num_ll("-> size", gd->dram[i].size);
}
}
}
@@ -144,7 +144,7 @@ static int bdinfo_print_all(struct bd_info *bd)
bdinfo_print_num_l("bd address", (ulong)bd);
#endif
bdinfo_print_num_l("boot_params", (ulong)bd->bi_boot_params);
- print_bi_dram(bd);
+ print_dram(bd);
bdinfo_print_num_l("flashstart", (ulong)bd->bi_flashstart);
bdinfo_print_num_l("flashsize", (ulong)bd->bi_flashsize);
bdinfo_print_num_l("flashoffset", (ulong)bd->bi_flashoffset);
@@ -152,7 +152,7 @@ static int bdinfo_print_all(struct bd_info *bd)
bdinfo_print_num_l("relocaddr", gd->relocaddr);
bdinfo_print_num_l("reloc off", gd->reloc_off);
printf("%-12s= %u-bit\n", "Build", (uint)sizeof(void *) * 8);
- if (IS_ENABLED(CONFIG_NET) || IS_ENABLED(CONFIG_NET_LWIP))
+ if (IS_ENABLED(CONFIG_NET))
print_eth();
bdinfo_print_num_l("fdt_blob", (ulong)map_to_sysmem(gd->fdt_blob));
if (IS_ENABLED(CONFIG_VIDEO))
@@ -194,13 +194,12 @@ int do_bdinfo(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
case 'a':
return bdinfo_print_all(bd);
case 'e':
- if (!IS_ENABLED(CONFIG_NET) &&
- !IS_ENABLED(CONFIG_NET_LWIP))
+ if (!IS_ENABLED(CONFIG_NET))
return CMD_RET_USAGE;
print_eth();
return CMD_RET_SUCCESS;
case 'm':
- print_bi_dram(bd);
+ print_dram(bd);
return CMD_RET_SUCCESS;
default:
return CMD_RET_USAGE;
@@ -221,7 +220,7 @@ U_BOOT_CMD(
" - print all Board Info structure"
#if CONFIG_IS_ENABLED(GETOPT)
"\n"
-#if IS_ENABLED(CONFIG_NET) || IS_ENABLED(CONFIG_NET_LWIP)
+#if IS_ENABLED(CONFIG_NET)
"bdinfo -e\n"
" - print Board Info related to network\n"
#endif
diff --git a/cmd/bootefi.c b/cmd/bootefi.c
index 85f41c3b0a0..37165f1a7fd 100644
--- a/cmd/bootefi.c
+++ b/cmd/bootefi.c
@@ -142,6 +142,11 @@ static int do_bootefi(struct cmd_tbl *cmdtp, int flag, int argc,
if (argc < 2)
return CMD_RET_USAGE;
+ /* Initialize EFI drivers */
+ ret = efi_init_obj_list();
+ if (ret != EFI_SUCCESS)
+ return CMD_RET_FAILURE;
+
if (argc > 2) {
ulong rd_addr = 0;
char *end = strchr(argv[2], ':');
@@ -179,14 +184,6 @@ static int do_bootefi(struct cmd_tbl *cmdtp, int flag, int argc,
if (IS_ENABLED(CONFIG_CMD_BOOTEFI_SELFTEST) &&
!strcmp(argv[1], "selftest")) {
- /* Initialize EFI drivers */
- ret = efi_init_obj_list();
- if (ret != EFI_SUCCESS) {
- log_err("Error: Cannot initialize UEFI sub-system, r = %lu\n",
- ret & ~EFI_ERROR_MASK);
- return CMD_RET_FAILURE;
- }
-
ret = efi_install_fdt(fdt);
if (ret != EFI_SUCCESS)
return CMD_RET_FAILURE;
diff --git a/cmd/bootmenu.c b/cmd/bootmenu.c
index d3108778c6f..b55f5579409 100644
--- a/cmd/bootmenu.c
+++ b/cmd/bootmenu.c
@@ -505,12 +505,8 @@ static void handle_uefi_bootnext(void)
/* Initialize EFI drivers */
ret = efi_init_obj_list();
- if (ret != EFI_SUCCESS) {
- log_err("Error: Cannot initialize UEFI sub-system, r = %lu\n",
- ret & ~EFI_ERROR_MASK);
-
+ if (ret != EFI_SUCCESS)
return;
- }
/* If UEFI BootNext variable is set, boot the BootNext load option */
size = sizeof(u16);
@@ -530,7 +526,7 @@ static void handle_uefi_bootnext(void)
*/
static enum bootmenu_ret bootmenu_show(int uefi, int delay)
{
- int cmd_ret;
+ int cmd_ret = CMD_RET_SUCCESS;
int init = 0;
void *choice = NULL;
char *title = NULL;
@@ -632,7 +628,7 @@ cleanup:
printf(ANSI_CURSOR_POSITION, 1, 1);
}
- if (title && command) {
+ if (title && command && *command) {
debug("Starting entry '%s'\n", title);
free(title);
if (efi_ret == EFI_SUCCESS)
diff --git a/cmd/clone.c b/cmd/clone.c
index 1f3cff1836d..371f06d917a 100644
--- a/cmd/clone.c
+++ b/cmd/clone.c
@@ -97,7 +97,7 @@ read:
write:
ret = blk_dwrite(destdesc, destblk, towrite, buf + offset);
if (ret < 0) {
- printf("Dest write error @blk %ld\n", srcblk);
+ printf("Dest write error @blk %ld\n", destblk);
goto exit;
}
wrcnt += ret * destbz;
diff --git a/cmd/config.c b/cmd/config.c
index f0d2033c61f..22115e9b1da 100644
--- a/cmd/config.c
+++ b/cmd/config.c
@@ -6,6 +6,7 @@
#include <command.h>
#include <gzip.h>
#include <malloc.h>
+#include <linux/string.h>
#include "config_data_gz.h"
#include "config_data_size.h"
@@ -29,7 +30,23 @@ static int do_config(struct cmd_tbl *cmdtp, int flag, int argc,
}
dst[data_size] = 0;
- puts(dst);
+ if (argc > 1) {
+ const char *s = argv[1];
+ char *b = dst, *e = dst + data_size, *n;
+
+ while (b < e) {
+ n = strchrnul(b, '\n');
+ *n = '\0';
+
+ if (strcasestr(b, s)) {
+ puts(b);
+ puts("\n");
+ }
+ b = n + 1;
+ }
+ } else {
+ puts(dst);
+ }
free:
free(dst);
@@ -38,7 +55,10 @@ free:
}
U_BOOT_CMD(
- config, 1, 1, do_config,
+ config, 2, 1, do_config,
"print .config",
- ""
+ "[str]\n"
+ "\n"
+ "When the optional argument is given, only lines containing\n"
+ "that string are printed. Matching is case-insensitive."
);
diff --git a/cmd/conitrace.c b/cmd/conitrace.c
index 6cc113328eb..aef094e03df 100644
--- a/cmd/conitrace.c
+++ b/cmd/conitrace.c
@@ -6,6 +6,7 @@
* Copyright (c) 2018, Heinrich Schuchardt <[email protected]>
*/
#include <command.h>
+#include <console.h>
#include <linux/delay.h>
static int do_conitrace(struct cmd_tbl *cmdtp, int flag, int argc,
@@ -17,8 +18,7 @@ static int do_conitrace(struct cmd_tbl *cmdtp, int flag, int argc,
printf("To terminate type 'x'\n");
/* Empty input buffer */
- while (tstc())
- getchar();
+ console_flush_stdin();
for (;;) {
int c = getchar();
diff --git a/cmd/cros_ec.c b/cmd/cros_ec.c
index 7b60e415b6c..66a5f6d5210 100644
--- a/cmd/cros_ec.c
+++ b/cmd/cros_ec.c
@@ -13,7 +13,7 @@
#include <dm/device-internal.h>
#include <dm/uclass-internal.h>
-/* Note: depends on enum ec_current_image */
+/* Note: depends on enum ec_image */
static const char * const ec_current_image_name[] = {"unknown", "RO", "RW"};
/**
@@ -312,7 +312,7 @@ static int do_cros_ec(struct cmd_tbl *cmdtp, int flag, int argc,
if (ret)
printf("Error: %d\n", ret);
} else if (0 == strcmp("curimage", cmd)) {
- enum ec_current_image image;
+ enum ec_image image;
if (cros_ec_read_current_image(dev, &image)) {
debug("%s: Could not read KBC image\n", __func__);
diff --git a/cmd/date.c b/cmd/date.c
index d047872289c..67cfaed0d48 100644
--- a/cmd/date.c
+++ b/cmd/date.c
@@ -16,7 +16,7 @@ static const char * const weekdays[] = {
"Sun", "Mon", "Tues", "Wednes", "Thurs", "Fri", "Satur",
};
-int mk_date (const char *, struct rtc_time *);
+static int mk_date(const char *, struct rtc_time *);
static struct rtc_time default_tm = { 0, 0, 0, 1, 1, 2000, 6, 0, 0 };
@@ -117,7 +117,7 @@ static int cnvrt2 (const char *str, int *valp)
* Some basic checking for valid values is done, but this will not catch
* all possible error conditions.
*/
-int mk_date (const char *datestr, struct rtc_time *tmp)
+static int mk_date(const char *datestr, struct rtc_time *tmp)
{
int len, val;
char *ptr;
@@ -167,12 +167,13 @@ int mk_date (const char *datestr, struct rtc_time *tmp)
/* fall thru */
case 12: /* MMDDhhmmCCYY */
if (cnvrt2 (datestr+0, &val) ||
- val > 12) {
+ val > 12 || val < 1) {
break;
}
tmp->tm_mon = val;
- if (cnvrt2 (datestr+2, &val) ||
- val > ((tmp->tm_mon==2) ? 29 : 31)) {
+ if (cnvrt2(datestr + 2, &val) ||
+ val < 1 ||
+ val > rtc_month_days(tmp->tm_mon - 1, tmp->tm_year)) {
break;
}
tmp->tm_mday = val;
diff --git a/cmd/eficonfig.c b/cmd/eficonfig.c
index d8d946c87ac..4d060e3007c 100644
--- a/cmd/eficonfig.c
+++ b/cmd/eficonfig.c
@@ -6,8 +6,9 @@
*/
#include <ansi.h>
-#include <cli.h>
#include <charset.h>
+#include <cli.h>
+#include <console.h>
#include <efi_device_path.h>
#include <efi_loader.h>
#include <efi_load_initrd.h>
@@ -167,8 +168,7 @@ static void eficonfig_menu_adjust(struct efimenu *efi_menu, bool add)
void eficonfig_print_msg(char *msg)
{
/* Flush input */
- while (tstc())
- getchar();
+ console_flush_stdin();
printf(ANSI_CURSOR_HIDE
ANSI_CLEAR_CONSOLE
@@ -2466,12 +2466,8 @@ static int do_eficonfig(struct cmd_tbl *cmdtp, int flag, int argc, char *const a
return CMD_RET_USAGE;
ret = efi_init_obj_list();
- if (ret != EFI_SUCCESS) {
- log_err("Error: Cannot initialize UEFI sub-system, r = %lu\n",
- ret & ~EFI_ERROR_MASK);
-
+ if (ret != EFI_SUCCESS)
return CMD_RET_FAILURE;
- }
ret = eficonfig_init();
if (ret != EFI_SUCCESS)
diff --git a/cmd/eficonfig_sbkey.c b/cmd/eficonfig_sbkey.c
index b3325a540f9..a6c5416d3a5 100644
--- a/cmd/eficonfig_sbkey.c
+++ b/cmd/eficonfig_sbkey.c
@@ -7,6 +7,7 @@
#include <ansi.h>
#include <charset.h>
+#include <console.h>
#include <hexdump.h>
#include <log.h>
#include <malloc.h>
@@ -288,8 +289,7 @@ static efi_status_t eficonfig_process_show_siglist(void *data)
}
}
- while (tstc())
- getchar();
+ console_flush_stdin();
printf("\n\n Press any key to continue");
getchar();
diff --git a/cmd/efidebug.c b/cmd/efidebug.c
index 7b733119c82..a6faa36b500 100644
--- a/cmd/efidebug.c
+++ b/cmd/efidebug.c
@@ -1669,11 +1669,8 @@ static int do_efidebug(struct cmd_tbl *cmdtp, int flag,
/* Initialize UEFI drivers */
r = efi_init_obj_list();
- if (r != EFI_SUCCESS) {
- printf("Error: Cannot initialize UEFI sub-system, r = %lu\n",
- r & ~EFI_ERROR_MASK);
+ if (r != EFI_SUCCESS)
return CMD_RET_FAILURE;
- }
cp = find_cmd_tbl(argv[0], cmd_efidebug_sub,
ARRAY_SIZE(cmd_efidebug_sub));
diff --git a/cmd/fastboot.c b/cmd/fastboot.c
index be84a482b81..f3929f88dfa 100644
--- a/cmd/fastboot.c
+++ b/cmd/fastboot.c
@@ -16,7 +16,7 @@
#include <linux/printk.h>
#include <linux/stringify.h>
-#if CONFIG_IS_ENABLED(NET)
+#if CONFIG_IS_ENABLED(NET_LEGACY)
static int do_fastboot_udp(int argc, char *const argv[],
uintptr_t buf_addr, size_t buf_size)
{
@@ -103,8 +103,15 @@ static int do_fastboot_usb(int argc, char *const argv[],
while (1) {
if (g_dnl_detach())
break;
- if (ctrlc())
+ if (IS_ENABLED(CONFIG_CMD_FASTBOOT_ABORT_KEYED)) {
+ if (tstc()) {
+ getchar();
+ puts("\rOperation aborted.\n");
+ break;
+ }
+ } else if (ctrlc()) {
break;
+ }
schedule();
dm_usb_gadget_handle_interrupts(udc);
}
@@ -162,7 +169,7 @@ NXTARG:
fastboot_init((void *)buf_addr, buf_size);
-#if CONFIG_IS_ENABLED(NET)
+#if CONFIG_IS_ENABLED(NET_LEGACY)
if (!strcmp(argv[1], "udp"))
return do_fastboot_udp(argc, argv, buf_addr, buf_size);
if (!strcmp(argv[1], "tcp"))
diff --git a/cmd/fdt.c b/cmd/fdt.c
index d6d5b9fdfd2..7e2abf96103 100644
--- a/cmd/fdt.c
+++ b/cmd/fdt.c
@@ -719,22 +719,19 @@ static int do_fdt(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
} else if (strncmp(argv[1], "che", 3) == 0) {
int cfg_noffset;
int ret;
- unsigned long addr;
- struct fdt_header *blob;
+ struct fdt_header *key_blob;
if (!working_fdt)
return CMD_RET_FAILURE;
if (argc > 2) {
- addr = hextoul(argv[2], NULL);
- blob = map_sysmem(addr, 0);
+ key_blob = map_sysmem(hextoul(argv[2], NULL), 0);
} else {
- blob = (struct fdt_header *)gd->fdt_blob;
+ key_blob = (struct fdt_header *)gd->fdt_blob;
}
- if (!fdt_valid(&blob))
+ if (!fdt_valid(&key_blob))
return 1;
- gd->fdt_blob = blob;
cfg_noffset = fit_conf_get_node(working_fdt, NULL);
if (cfg_noffset < 0) {
printf("Could not find configuration node: %s\n",
@@ -742,7 +739,8 @@ static int do_fdt(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
return CMD_RET_FAILURE;
}
- ret = fit_config_verify(working_fdt, cfg_noffset);
+ ret = fit_config_verify_with_key_blob(working_fdt, cfg_noffset,
+ key_blob);
if (ret == 0)
return CMD_RET_SUCCESS;
else
diff --git a/cmd/fpga.c b/cmd/fpga.c
index d51c380d7b3..d347a700290 100644
--- a/cmd/fpga.c
+++ b/cmd/fpga.c
@@ -417,7 +417,7 @@ U_BOOT_CMD(fpga, 6, 1, do_fpga_wrapper,
"info [dev] List known device information\n"
"fpga dump <dev> <address> <size> Load device to memory buffer\n"
"fpga load <dev> <address> <size> Load device from memory buffer\n"
-#if defined(CONFIG_CMD_FPGA_LOADP)
+#if defined(CONFIG_CMD_FPGA_LOADB)
"fpga loadb <dev> <address> <size> Load device from bitstream buffer\n"
#endif
#if defined(CONFIG_CMD_FPGA_LOADP)
diff --git a/cmd/host.c b/cmd/host.c
index e03576b4d2d..47a59f5ff20 100644
--- a/cmd/host.c
+++ b/cmd/host.c
@@ -132,10 +132,7 @@ static int do_host_unbind(struct cmd_tbl *cmdtp, int flag, int argc,
ret = device_unbind(dev);
if (ret) {
- printf("Cannot attach file\n");
- ret = device_unbind(dev);
- if (ret)
- printf("Cannot unbind device '%s'\n", dev->name);
+ printf("Cannot unbind device '%s'\n", dev->name);
return CMD_RET_FAILURE;
}
diff --git a/cmd/ini.c b/cmd/ini.c
index 96399017691..3fe86209c32 100644
--- a/cmd/ini.c
+++ b/cmd/ini.c
@@ -229,6 +229,7 @@ static int ini_handler(void *user, char *section, char *name, char *value)
static int do_ini(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
{
const char *section;
+ const char *addr_str, *size_str;
char *file_address;
size_t file_size;
@@ -236,10 +237,16 @@ static int do_ini(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
return CMD_RET_USAGE;
section = argv[1];
- file_address = (char *)hextoul(argc < 3 ? env_get("loadaddr") : argv[2],
- NULL);
- file_size = (size_t)hextoul(argc < 4 ? env_get("filesize") : argv[3],
- NULL);
+ addr_str = argc < 3 ? env_get("loadaddr") : argv[2];
+ size_str = argc < 4 ? env_get("filesize") : argv[3];
+
+ if (!addr_str || !size_str) {
+ printf("ini: loadaddr/filesize not set\n");
+ return CMD_RET_USAGE;
+ }
+
+ file_address = (char *)hextoul(addr_str, NULL);
+ file_size = (size_t)hextoul(size_str, NULL);
return ini_parse(file_address, file_size, ini_handler, (void *)section);
}
diff --git a/cmd/lwip/ping.c b/cmd/lwip/ping.c
index fc4cf7bde5f..98fa8e22bce 100644
--- a/cmd/lwip/ping.c
+++ b/cmd/lwip/ping.c
@@ -163,6 +163,7 @@ static int ping_loop(struct udevice *udev, const ip_addr_t *addr)
int do_ping(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
{
ip_addr_t addr;
+ int ret;
if (argc < 2)
return CMD_RET_USAGE;
@@ -171,13 +172,15 @@ int do_ping(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
return CMD_RET_USAGE;
net_try_count = 1;
-restart:
- if (net_lwip_eth_start() < 0 || ping_loop(eth_get_dev(), &addr) < 0) {
- if (net_start_again() == 0)
- goto restart;
- else
- return CMD_RET_FAILURE;
- }
- return CMD_RET_SUCCESS;
+ do {
+ if (net_lwip_eth_start() == 0) {
+ ret = ping_loop(eth_get_dev(), &addr);
+ net_lwip_eth_stop();
+ if (ret == 0)
+ return CMD_RET_SUCCESS;
+ }
+ } while (net_start_again() == 0);
+
+ return CMD_RET_FAILURE;
}
diff --git a/cmd/lwip/sntp.c b/cmd/lwip/sntp.c
index 608345c873b..5fa400b104a 100644
--- a/cmd/lwip/sntp.c
+++ b/cmd/lwip/sntp.c
@@ -101,6 +101,7 @@ int do_sntp(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
ip_addr_t *srvip;
char *server;
ip_addr_t ipaddr;
+ int ret = CMD_RET_FAILURE;
switch (argc) {
case 1:
@@ -127,7 +128,12 @@ int do_sntp(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
return CMD_RET_FAILURE;
if (sntp_loop(eth_get_dev(), srvip) < 0)
- return CMD_RET_FAILURE;
+ goto out;
+
+ ret = CMD_RET_SUCCESS;
+
+out:
+ net_lwip_eth_stop();
- return CMD_RET_SUCCESS;
+ return ret;
}
diff --git a/cmd/mmc.c b/cmd/mmc.c
index 81b1ca4ad84..54c799891e1 100644
--- a/cmd/mmc.c
+++ b/cmd/mmc.c
@@ -519,7 +519,7 @@ static int do_mmc_rescan(struct cmd_tbl *cmdtp, int flag,
if (argc == 1) {
mmc = init_mmc_device(curr_device, true);
- } else if (argc == 2) {
+ } else if ((argc == 2) && (CONFIG_IS_ENABLED(MMC_SPEED_MODE_SET))) {
enum bus_mode speed_mode;
speed_mode = (int)dectoul(argv[1], NULL);
@@ -564,11 +564,13 @@ static int do_mmc_dev(struct cmd_tbl *cmdtp, int flag,
switch (argc) {
case 4:
- speed_mode = (int)dectoul(argv[3], &endp);
- if (*endp) {
- printf("Invalid speed mode index '%s', did you specify a mode name?\n",
- argv[3]);
- return CMD_RET_USAGE;
+ if (CONFIG_IS_ENABLED(MMC_SPEED_MODE_SET)) {
+ speed_mode = (int)dectoul(argv[3], &endp);
+ if (*endp) {
+ printf("Invalid speed mode index '%s', did you specify a mode name?\n",
+ argv[3]);
+ return CMD_RET_USAGE;
+ }
}
fallthrough;
@@ -1312,12 +1314,17 @@ U_BOOT_CMD(
#endif
"mmc erase blk# cnt\n"
"mmc erase partname\n"
+#if CONFIG_IS_ENABLED(MMC_SPEED_MODE_SET)
"mmc rescan [mode]\n"
- "mmc part - lists available partition on current mmc device\n"
"mmc dev [dev] [part] [mode] - show or set current mmc device [partition] and set mode\n"
" - the required speed mode is passed as the index from the following list\n"
" [MMC_LEGACY, MMC_HS, SD_HS, MMC_HS_52, MMC_DDR_52, UHS_SDR12, UHS_SDR25,\n"
" UHS_SDR50, UHS_DDR50, UHS_SDR104, MMC_HS_200, MMC_HS_400, MMC_HS_400_ES]\n"
+#else
+ "mmc rescan\n"
+ "mmc dev [dev] [part] - show or set current mmc device [partition]\n"
+#endif
+ "mmc part - lists available partition on current mmc device\n"
"mmc list - lists available devices\n"
"mmc wp [PART] - power on write protect boot partitions\n"
" arguments:\n"
diff --git a/cmd/nvedit_efi.c b/cmd/nvedit_efi.c
index 351ae47e870..3a36f94775b 100644
--- a/cmd/nvedit_efi.c
+++ b/cmd/nvedit_efi.c
@@ -213,11 +213,8 @@ int do_env_print_efi(struct cmd_tbl *cmdtp, int flag, int argc,
/* Initialize EFI drivers */
ret = efi_init_obj_list();
- if (ret != EFI_SUCCESS) {
- printf("Error: Cannot initialize UEFI sub-system, r = %lu\n",
- ret & ~EFI_ERROR_MASK);
+ if (ret != EFI_SUCCESS)
return CMD_RET_FAILURE;
- }
for (argc--, argv++; argc > 0 && argv[0][0] == '-'; argc--, argv++) {
if (!strcmp(argv[0], "-guid")) {
@@ -389,11 +386,8 @@ int do_env_set_efi(struct cmd_tbl *cmdtp, int flag, int argc,
/* Initialize EFI drivers */
ret = efi_init_obj_list();
- if (ret != EFI_SUCCESS) {
- printf("Error: Cannot initialize UEFI sub-system, r = %lu\n",
- ret & ~EFI_ERROR_MASK);
+ if (ret != EFI_SUCCESS)
return CMD_RET_FAILURE;
- }
/*
* attributes = EFI_VARIABLE_BOOTSERVICE_ACCESS |
diff --git a/cmd/part.c b/cmd/part.c
index 5e520d707f3..3191d5861fd 100644
--- a/cmd/part.c
+++ b/cmd/part.c
@@ -144,6 +144,10 @@ static int do_part_info(int argc, char *const argv[], enum cmd_part_info param)
err = part_get_info(desc, part, &info);
if (err)
return 1;
+ } else if (uuid_str_valid(argv[2])) {
+ part = part_get_info_by_uuid(desc, argv[2], &info);
+ if (part < 0)
+ return 1;
} else {
part = part_get_info_by_name(desc, argv[2], &info);
if (part < 0)
@@ -517,13 +521,13 @@ U_BOOT_CMD(
" flags can be -bootable (list only bootable partitions)\n"
"part start <interface> <dev> <part> <varname>\n"
" - set environment variable to the start of the partition (in blocks)\n"
- " part can be either partition number or partition name\n"
+ " part can be either partition number, UUID or name\n"
"part size <interface> <dev> <part> <varname>\n"
" - set environment variable to the size of the partition (in blocks)\n"
- " part can be either partition number or partition name\n"
+ " part can be either partition number, UUID or name\n"
"part number <interface> <dev> <part> <varname>\n"
- " - set environment variable to the partition number using the partition name\n"
- " part must be specified as partition name\n"
+ " - set environment variable to the partition number using the partition UUID or name\n"
+ " part must be specified as partition UUID or name\n"
"part name <interface> <dev> <part> <varname>\n"
" - set environment variable to the partition name using the partition number\n"
" part must be specified as partition number\n"
diff --git a/cmd/pmbus.c b/cmd/pmbus.c
new file mode 100644
index 00000000000..7b1be897373
--- /dev/null
+++ b/cmd/pmbus.c
@@ -0,0 +1,814 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright 2026 Free Mobile, Vincent Jardin
+ *
+ * pmbus U-Boot CLI command.
+ *
+ * Generic command surface over the PMBus 1.x framework defined in
+ * <pmbus.h> + lib/pmbus.c.
+ *
+ * See doc/develop/pmbus.rst for the full usage reference.
+ */
+
+#include <command.h>
+#include <dm.h>
+#include <i2c.h>
+#include <log.h>
+#include <pmbus.h>
+#include <vsprintf.h>
+#include <linux/ctype.h>
+#include <power/regulator.h>
+
+static int parse_bus_addr(const char *s, int *bus_seq, u8 *addr)
+{
+ char busbuf[8];
+ const char *colon;
+ unsigned long b, a;
+ size_t buslen;
+
+ colon = strchr(s, ':');
+ if (!colon)
+ return -EINVAL;
+ buslen = colon - s;
+ if (buslen == 0 || buslen >= sizeof(busbuf))
+ return -EINVAL;
+ memcpy(busbuf, s, buslen);
+ busbuf[buslen] = '\0';
+ if (strict_strtoul(busbuf, 10, &b))
+ return -EINVAL;
+ if (strict_strtoul(colon + 1, 16, &a) || a > 0x7f)
+ return -EINVAL;
+ *bus_seq = (int)b;
+ *addr = (u8)a;
+ return 0;
+}
+
+static const struct {
+ const char *name;
+ u8 reg;
+} pmbus_reg_syms[] = {
+ { "PAGE", PMBUS_PAGE },
+ { "OPERATION", PMBUS_OPERATION },
+ { "ON_OFF_CONFIG", PMBUS_ON_OFF_CONFIG },
+ { "CLEAR_FAULTS", PMBUS_CLEAR_FAULTS },
+ { "WRITE_PROTECT", PMBUS_WRITE_PROTECT },
+ { "CAPABILITY", PMBUS_CAPABILITY },
+ { "VOUT_MODE", PMBUS_VOUT_MODE },
+ { "VOUT_COMMAND", PMBUS_VOUT_COMMAND },
+ { "VOUT_TRIM", PMBUS_VOUT_TRIM },
+ { "VOUT_MAX", PMBUS_VOUT_MAX },
+ { "VOUT_SCALE_LOOP", PMBUS_VOUT_SCALE_LOOP },
+ { "STATUS_BYTE", PMBUS_STATUS_BYTE },
+ { "STATUS_WORD", PMBUS_STATUS_WORD },
+ { "STATUS_VOUT", PMBUS_STATUS_VOUT },
+ { "STATUS_IOUT", PMBUS_STATUS_IOUT },
+ { "STATUS_INPUT", PMBUS_STATUS_INPUT },
+ { "STATUS_TEMP", PMBUS_STATUS_TEMPERATURE },
+ { "STATUS_CML", PMBUS_STATUS_CML },
+ { "READ_VIN", PMBUS_READ_VIN },
+ { "READ_IIN", PMBUS_READ_IIN },
+ { "READ_VOUT", PMBUS_READ_VOUT },
+ { "READ_IOUT", PMBUS_READ_IOUT },
+ { "READ_TEMP1", PMBUS_READ_TEMPERATURE_1 },
+ { "READ_TEMP2", PMBUS_READ_TEMPERATURE_2 },
+ { "READ_TEMP3", PMBUS_READ_TEMPERATURE_3 },
+ { "READ_DUTY", PMBUS_READ_DUTY_CYCLE },
+ { "READ_FREQ", PMBUS_READ_FREQUENCY },
+ { "READ_POUT", PMBUS_READ_POUT },
+ { "READ_PIN", PMBUS_READ_PIN },
+ { "REVISION", PMBUS_REVISION },
+ { "MFR_ID", PMBUS_MFR_ID },
+ { "MFR_MODEL", PMBUS_MFR_MODEL },
+ { "MFR_REVISION", PMBUS_MFR_REVISION },
+};
+
+static int parse_reg(const char *s, u8 *reg)
+{
+ unsigned long v;
+ unsigned int i;
+
+ for (i = 0; i < ARRAY_SIZE(pmbus_reg_syms); i++) {
+ if (!strcasecmp(s, pmbus_reg_syms[i].name)) {
+ *reg = pmbus_reg_syms[i].reg;
+ return 0;
+ }
+ }
+ if (strict_strtoul(s, 16, &v) || v > 0xff)
+ return -EINVAL;
+ *reg = (u8)v;
+ return 0;
+}
+
+static const char *pmbus_reg_name(u8 reg)
+{
+ unsigned int i;
+
+ for (i = 0; i < ARRAY_SIZE(pmbus_reg_syms); i++)
+ if (pmbus_reg_syms[i].reg == reg)
+ return pmbus_reg_syms[i].name;
+ return "?";
+}
+
+static int require_active(struct udevice **chip,
+ const struct pmbus_active_dev **act)
+{
+ *act = pmbus_active();
+ if (!*act) {
+ printf("pmbus: no active device. Use 'pmbus dev <bus>:<addr>' first.\n");
+ return CMD_RET_FAILURE;
+ }
+ if (pmbus_active_get_i2c(chip)) {
+ printf("pmbus: cannot reach i2c%d:0x%02x\n",
+ (*act)->bus_seq, (*act)->addr);
+ return CMD_RET_FAILURE;
+ }
+ return CMD_RET_SUCCESS;
+}
+
+static void print_micro(s64 micro, const char *unit)
+{
+ s64 abs_milli;
+
+ abs_milli = (micro < 0 ? -micro : micro) / 1000LL;
+ printf("%lld.%03lld%s",
+ (long long)(micro / 1000000LL),
+ (long long)(abs_milli % 1000LL), unit);
+}
+
+static void print_active(const struct pmbus_active_dev *act)
+{
+ printf("pmbus: active i2c%d:0x%02x", act->bus_seq, act->addr);
+ if (act->name[0])
+ printf(" rail=\"%s\"", act->name);
+ printf(" MFR_ID=\"%s\" MODEL=\"%s\" vendor=%s%s\n",
+ act->mfr_id[0] ? act->mfr_id : "?",
+ act->mfr_model[0] ? act->mfr_model : "?",
+ act->vendor[0] ? act->vendor : "(generic)",
+ act->info ? "" : " [no driver_info]");
+}
+
+static int do_dev(struct cmd_tbl *cmdtp, int flag, int argc,
+ char *const argv[])
+{
+ const struct pmbus_active_dev *act;
+ int bus_seq, ret;
+ u8 addr;
+
+ if (argc < 2) {
+ act = pmbus_active();
+ if (!act) {
+ printf("pmbus: no active device\n");
+ return CMD_RET_SUCCESS;
+ }
+ print_active(act);
+ return CMD_RET_SUCCESS;
+ }
+
+ if (parse_bus_addr(argv[1], &bus_seq, &addr) < 0) {
+ ret = pmbus_resolve_by_name(argv[1], &bus_seq, &addr);
+ if (ret) {
+ printf("pmbus: '%s' is neither <bus>:<addr> nor a known regulator-name (%d)\n",
+ argv[1], ret);
+ return CMD_RET_FAILURE;
+ }
+ }
+ ret = pmbus_set_active(bus_seq, addr);
+ if (ret) {
+ printf("pmbus: cannot select i2c%d:0x%02x (%d)\n",
+ bus_seq, addr, ret);
+ return CMD_RET_FAILURE;
+ }
+ act = pmbus_active();
+ if (act)
+ print_active(act);
+ return CMD_RET_SUCCESS;
+}
+
+static int do_list(struct cmd_tbl *cmdtp, int flag, int argc,
+ char *const argv[])
+{
+ struct udevice *dev;
+ struct uclass *uc;
+ int ret, n = 0;
+
+ if (!IS_ENABLED(CONFIG_DM_REGULATOR)) {
+ printf("pmbus: CONFIG_DM_REGULATOR not enabled in this build. Use 'pmbus dev <bus>:<addr>'.\n");
+ return CMD_RET_SUCCESS;
+ }
+
+ ret = uclass_get(UCLASS_REGULATOR, &uc);
+ if (ret) {
+ printf("pmbus: UCLASS_REGULATOR not available\n");
+ return CMD_RET_SUCCESS;
+ }
+ uclass_foreach_dev(dev, uc) {
+ struct dm_regulator_uclass_plat *up = dev_get_uclass_plat(dev);
+ struct udevice *parent = dev_get_parent(dev);
+ const char *rname = (up && up->name) ? up->name : "";
+ const char *drv = (dev->driver && dev->driver->name)
+ ? dev->driver->name : "?";
+ int bus_seq = -1;
+ int addr = -1;
+
+ if (parent && device_get_uclass_id(parent) == UCLASS_I2C) {
+ bus_seq = dev_seq(parent);
+ addr = dev_read_addr(dev);
+ }
+
+ if (n == 0)
+ printf("UCLASS_REGULATOR devices (no PMBus filter):\n");
+ if (bus_seq >= 0 && addr >= 0) {
+ printf(" i2c%d:0x%02x rail=\"%s\" node=%s driver=%s\n",
+ bus_seq, addr, rname, dev->name, drv);
+ } else {
+ printf(" (non-I2C) rail=\"%s\" node=%s driver=%s\n",
+ rname, dev->name, drv);
+ }
+ n++;
+ }
+ if (!n)
+ printf("pmbus: no UCLASS_REGULATOR devices bound. Use 'pmbus dev <bus>:<addr>' to select a chip directly.\n");
+ return CMD_RET_SUCCESS;
+}
+
+static int do_info(struct cmd_tbl *cmdtp, int flag, int argc,
+ char *const argv[])
+{
+ static const char * const cls_names[PSC_NUM_CLASSES] = {
+ "VOLTAGE_IN", "VOLTAGE_OUT", "CURRENT_IN", "CURRENT_OUT",
+ "POWER", "TEMPERATURE",
+ };
+ static const char * const fmt_names[] = {
+ "LINEAR", "IEEE754", "DIRECT", "VID",
+ };
+ const struct pmbus_active_dev *act;
+ struct udevice *chip;
+ int rc, c, rrev;
+ u8 rev = 0;
+
+ rc = require_active(&chip, &act);
+ if (rc)
+ return rc;
+
+ rrev = pmbus_read_byte(chip, PMBUS_REVISION, &rev);
+
+ printf("pmbus device i2c%d:0x%02x\n", act->bus_seq, act->addr);
+ if (act->name[0])
+ printf(" regulator-name: \"%s\"\n", act->name);
+ printf(" MFR_ID : \"%s\"\n", act->mfr_id[0] ? act->mfr_id : "?");
+ printf(" MFR_MODEL : \"%s\"\n", act->mfr_model[0] ? act->mfr_model : "?");
+
+ /*
+ * MFR_REVISION may encodes the revision as a non printable byte
+ * (BCD nibbles, packed major / minor, etc.). Show both the
+ * printable form and the raw bytes the chip returned.
+ */
+ {
+ u8 raw[PMBUS_MFR_STRING_MAX];
+ int len, i;
+
+ if (dm_i2c_read(chip, PMBUS_MFR_REVISION, raw, 1) ||
+ raw[0] < 1 || raw[0] > sizeof(raw) - 1 ||
+ dm_i2c_read(chip, PMBUS_MFR_REVISION, raw, raw[0] + 1)) {
+ printf(" MFR_REVISION : \"%s\"\n",
+ act->mfr_revision[0] ? act->mfr_revision : "?");
+ } else {
+ len = raw[0];
+ printf(" MFR_REVISION : \"%s\" raw=0x",
+ act->mfr_revision[0] ? act->mfr_revision : "?");
+ for (i = 1; i <= len; i++)
+ printf("%02x", raw[i]);
+ printf("\n");
+ }
+ }
+
+ if (rrev)
+ printf(" PMBUS_REVISION: <read failed (%d)>\n", rrev);
+ else
+ printf(" PMBUS_REVISION: 0x%02x (%s)\n", rev,
+ rev == PMBUS_REV_13 ? "PMBus 1.3" :
+ rev == PMBUS_REV_12 ? "PMBus 1.2" :
+ rev == PMBUS_REV_11 ? "PMBus 1.1" :
+ rev == PMBUS_REV_10 ? "PMBus 1.0" : "unknown");
+ printf(" vendor : %s\n", act->vendor[0] ? act->vendor : "(none)");
+
+ if (!act->info) {
+ printf(" driver_info : not registered (decoders fall back to LINEAR16 / LINEAR11)\n");
+ return CMD_RET_SUCCESS;
+ }
+ printf(" driver_info : pages=%d\n", act->info->pages);
+ for (c = 0; c < PSC_NUM_CLASSES; c++) {
+ printf(" [%-12s] format=%s",
+ cls_names[c], fmt_names[act->info->format[c]]);
+ if (act->info->format[c] == pmbus_fmt_direct)
+ printf(", m=%d, b=%d, R=%d",
+ act->info->m[c], act->info->b[c], act->info->R[c]);
+ printf("\n");
+ }
+ return CMD_RET_SUCCESS;
+}
+
+static int do_telemetry(struct cmd_tbl *cmdtp, int flag, int argc,
+ char *const argv[])
+{
+ const struct pmbus_active_dev *act;
+ struct udevice *chip;
+ int rc;
+
+ rc = require_active(&chip, &act);
+ if (rc)
+ return rc;
+
+ printf("pmbus telemetry @ i2c%d:0x%02x\n", act->bus_seq, act->addr);
+ pmbus_print_telemetry(chip);
+ return CMD_RET_SUCCESS;
+}
+
+static int do_status(struct cmd_tbl *cmdtp, int flag, int argc,
+ char *const argv[])
+{
+ const struct pmbus_active_dev *act;
+ struct udevice *chip;
+ u16 word = 0;
+ u8 b;
+ int rc;
+
+ rc = require_active(&chip, &act);
+ if (rc)
+ return rc;
+
+ if (pmbus_read_word(chip, PMBUS_STATUS_WORD, &word)) {
+ printf("pmbus: STATUS_WORD read failed\n");
+ return CMD_RET_FAILURE;
+ }
+
+ const struct pmbus_status_override *ovr =
+ act->info ? act->info->status_overrides : NULL;
+
+ printf("pmbus status @ i2c%d:0x%02x\n", act->bus_seq, act->addr);
+ printf(" STATUS_WORD (79h) = 0x%04x [", word);
+ pmbus_print_status_bits(PMBUS_STATUS_WORD, word,
+ pmbus_status_word_bits, ovr);
+ printf("]\n");
+
+ if (pmbus_read_byte(chip, PMBUS_STATUS_VOUT, &b) == 0) {
+ printf(" STATUS_VOUT (7Ah) = 0x%02x [", b);
+ pmbus_print_status_bits(PMBUS_STATUS_VOUT, b,
+ pmbus_status_vout_bits, ovr);
+ printf("]\n");
+ }
+ if (pmbus_read_byte(chip, PMBUS_STATUS_IOUT, &b) == 0) {
+ printf(" STATUS_IOUT (7Bh) = 0x%02x [", b);
+ pmbus_print_status_bits(PMBUS_STATUS_IOUT, b,
+ pmbus_status_iout_bits, ovr);
+ printf("]\n");
+ }
+ if (pmbus_read_byte(chip, PMBUS_STATUS_INPUT, &b) == 0) {
+ printf(" STATUS_INPUT (7Ch) = 0x%02x [", b);
+ pmbus_print_status_bits(PMBUS_STATUS_INPUT, b,
+ pmbus_status_input_bits, ovr);
+ printf("]\n");
+ }
+ if (pmbus_read_byte(chip, PMBUS_STATUS_TEMPERATURE, &b) == 0) {
+ printf(" STATUS_TEMP (7Dh) = 0x%02x [", b);
+ pmbus_print_status_bits(PMBUS_STATUS_TEMPERATURE, b,
+ pmbus_status_temp_bits, ovr);
+ printf("]\n");
+ }
+ if (pmbus_read_byte(chip, PMBUS_STATUS_CML, &b) == 0) {
+ printf(" STATUS_CML (7Eh) = 0x%02x [", b);
+ pmbus_print_status_bits(PMBUS_STATUS_CML, b,
+ pmbus_status_cml_bits, ovr);
+ printf("]\n");
+ }
+
+ return CMD_RET_SUCCESS;
+}
+
+static int do_dump(struct cmd_tbl *cmdtp, int flag, int argc,
+ char *const argv[])
+{
+ const struct pmbus_active_dev *act;
+ struct udevice *chip;
+ unsigned int i;
+ int rc;
+
+ rc = require_active(&chip, &act);
+ if (rc)
+ return rc;
+
+ printf("pmbus dump @ i2c%d:0x%02x (registers known to <pmbus.h>)\n",
+ act->bus_seq, act->addr);
+ for (i = 0; i < ARRAY_SIZE(pmbus_reg_syms); i++) {
+ u8 reg = pmbus_reg_syms[i].reg;
+ u8 b = 0;
+ u16 w = 0;
+
+ switch (reg) {
+ case PMBUS_PAGE:
+ case PMBUS_OPERATION:
+ case PMBUS_ON_OFF_CONFIG:
+ case PMBUS_WRITE_PROTECT:
+ case PMBUS_CAPABILITY:
+ case PMBUS_VOUT_MODE:
+ case PMBUS_STATUS_BYTE:
+ case PMBUS_STATUS_VOUT:
+ case PMBUS_STATUS_IOUT:
+ case PMBUS_STATUS_INPUT:
+ case PMBUS_STATUS_TEMPERATURE:
+ case PMBUS_STATUS_CML:
+ case PMBUS_REVISION:
+ if (pmbus_read_byte(chip, reg, &b) == 0)
+ printf(" %02xh %-15s b=0x%02x\n",
+ reg, pmbus_reg_syms[i].name, b);
+ break;
+ case PMBUS_MFR_ID:
+ case PMBUS_MFR_MODEL:
+ case PMBUS_MFR_REVISION: {
+ char s[PMBUS_MFR_STRING_MAX];
+
+ if (pmbus_read_string(chip, reg, s, sizeof(s),
+ act->mfr_reverse) >= 0)
+ printf(" %02xh %-15s s=\"%s\"\n",
+ reg, pmbus_reg_syms[i].name, s);
+ break;
+ }
+ default:
+ if (pmbus_read_word(chip, reg, &w) == 0)
+ printf(" %02xh %-15s w=0x%04x\n",
+ reg, pmbus_reg_syms[i].name, w);
+ break;
+ }
+ }
+ return CMD_RET_SUCCESS;
+}
+
+static int do_read(struct cmd_tbl *cmdtp, int flag, int argc,
+ char *const argv[])
+{
+ const struct pmbus_active_dev *act;
+ struct udevice *chip;
+ const char *fmt = "b";
+ u8 reg, b;
+ u16 w;
+ char s[PMBUS_MFR_STRING_MAX];
+ int rc, ret;
+
+ if (argc < 2)
+ return CMD_RET_USAGE;
+ rc = require_active(&chip, &act);
+ if (rc)
+ return rc;
+ if (parse_reg(argv[1], &reg) < 0) {
+ printf("pmbus: invalid register '%s'\n", argv[1]);
+ return CMD_RET_USAGE;
+ }
+ if (argc >= 3)
+ fmt = argv[2];
+
+ if (!strcmp(fmt, "b")) {
+ ret = pmbus_read_byte(chip, reg, &b);
+ if (ret) {
+ printf("pmbus: read byte 0x%02x failed (%d)\n", reg, ret);
+ return CMD_RET_FAILURE;
+ }
+ printf(" %02xh %-15s b=0x%02x\n", reg, pmbus_reg_name(reg), b);
+ } else if (!strcmp(fmt, "w")) {
+ ret = pmbus_read_word(chip, reg, &w);
+ if (ret) {
+ printf("pmbus: read word 0x%02x failed (%d)\n", reg, ret);
+ return CMD_RET_FAILURE;
+ }
+ printf(" %02xh %-15s w=0x%04x\n", reg, pmbus_reg_name(reg), w);
+ } else if (!strcmp(fmt, "s")) {
+ ret = pmbus_read_string(chip, reg, s, sizeof(s), false);
+ if (ret < 0) {
+ printf("pmbus: read string 0x%02x failed (%d)\n", reg, ret);
+ return CMD_RET_FAILURE;
+ }
+ printf(" %02xh %-15s s=\"%s\"\n", reg, pmbus_reg_name(reg), s);
+ } else {
+ printf("pmbus: unknown format '%s' (expected b, w, or s)\n", fmt);
+ return CMD_RET_USAGE;
+ }
+ return CMD_RET_SUCCESS;
+}
+
+static int do_write(struct cmd_tbl *cmdtp, int flag, int argc,
+ char *const argv[])
+{
+ const struct pmbus_active_dev *act;
+ struct udevice *chip;
+ const char *fmt = "b";
+ unsigned long val;
+ u8 reg, b;
+ u8 buf[2];
+ int rc, ret;
+
+ if (argc < 3)
+ return CMD_RET_USAGE;
+ rc = require_active(&chip, &act);
+ if (rc)
+ return rc;
+ if (parse_reg(argv[1], &reg) < 0) {
+ printf("pmbus: invalid register '%s'\n", argv[1]);
+ return CMD_RET_USAGE;
+ }
+ if (strict_strtoul(argv[2], 16, &val)) {
+ printf("pmbus: invalid value '%s'\n", argv[2]);
+ return CMD_RET_USAGE;
+ }
+ if (argc >= 4)
+ fmt = argv[3];
+
+ if (!strcmp(fmt, "b")) {
+ if (val > 0xff) {
+ printf("pmbus: byte value out of range\n");
+ return CMD_RET_USAGE;
+ }
+ b = (u8)val;
+ ret = dm_i2c_write(chip, reg, &b, 1);
+ } else if (!strcmp(fmt, "w")) {
+ if (val > 0xffff) {
+ printf("pmbus: word value out of range\n");
+ return CMD_RET_USAGE;
+ }
+ buf[0] = (u8)(val & 0xff);
+ buf[1] = (u8)((val >> 8) & 0xff);
+ ret = dm_i2c_write(chip, reg, buf, 2);
+ } else {
+ printf("pmbus: unknown format '%s' (expected b or w)\n", fmt);
+ return CMD_RET_USAGE;
+ }
+ if (ret) {
+ printf("pmbus: write 0x%02x failed (%d)\n", reg, ret);
+ return CMD_RET_FAILURE;
+ }
+ printf("pmbus: wrote 0x%lx to %02xh (%s)\n", val, reg, pmbus_reg_name(reg));
+ return CMD_RET_SUCCESS;
+}
+
+static int do_clear(struct cmd_tbl *cmdtp, int flag, int argc,
+ char *const argv[])
+{
+ const struct pmbus_active_dev *act;
+ struct udevice *chip;
+ int rc, ret;
+
+ if (argc >= 2 && strcmp(argv[1], "faults") != 0) {
+ printf("pmbus: unknown clear subcommand '%s' (expected 'faults')\n",
+ argv[1]);
+ return CMD_RET_USAGE;
+ }
+ rc = require_active(&chip, &act);
+ if (rc)
+ return rc;
+ ret = pmbus_clear_faults(chip);
+ if (ret) {
+ printf("pmbus: CLEAR_FAULTS (03h) failed (%d)\n", ret);
+ return CMD_RET_FAILURE;
+ }
+ printf("pmbus: CLEAR_FAULTS (03h) issued (RAM sticky STATUS_* cleared)\n");
+ return CMD_RET_SUCCESS;
+}
+
+static int do_vout(struct cmd_tbl *cmdtp, int flag, int argc,
+ char *const argv[])
+{
+ const struct pmbus_active_dev *act;
+ struct udevice *chip;
+ u8 vout_mode = 0;
+ u16 raw;
+ s64 uv;
+ int rc, ret;
+
+ rc = require_active(&chip, &act);
+ if (rc)
+ return rc;
+
+ if (pmbus_read_byte(chip, PMBUS_VOUT_MODE, &vout_mode)) {
+ printf("pmbus: VOUT_MODE read failed\n");
+ return CMD_RET_FAILURE;
+ }
+
+ if (argc < 2) {
+ if (pmbus_read_word(chip, PMBUS_READ_VOUT, &raw)) {
+ printf("pmbus: READ_VOUT failed\n");
+ return CMD_RET_FAILURE;
+ }
+ if (act->info)
+ uv = pmbus_reg2data(act->info, PSC_VOLTAGE_OUT, raw, vout_mode);
+ else
+ uv = pmbus_reg2data_linear16(raw, vout_mode);
+ printf("pmbus VOUT @ i2c%d:0x%02x raw=0x%04x ",
+ act->bus_seq, act->addr, raw);
+ print_micro(uv, "V");
+ printf("\n");
+ return CMD_RET_SUCCESS;
+ }
+
+ {
+ unsigned long target_uv;
+ const char *fmt_name;
+ u8 buf[2];
+
+ if (strict_strtoul(argv[1], 10, &target_uv)) {
+ printf("pmbus: invalid microvolt value '%s'\n", argv[1]);
+ return CMD_RET_USAGE;
+ }
+
+ switch (vout_mode & PB_VOUT_MODE_MODE_MASK) {
+ case PB_VOUT_MODE_LINEAR:
+ raw = pmbus_data2reg_linear16((s64)target_uv, vout_mode);
+ fmt_name = "LINEAR16";
+ break;
+ case PB_VOUT_MODE_DIRECT:
+ if (!act->info ||
+ act->info->format[PSC_VOLTAGE_OUT] != pmbus_fmt_direct) {
+ printf("pmbus: VOUT_MODE selects DIRECT but the active driver_info has no DIRECT coefficients for VOLTAGE_OUT\n");
+ return CMD_RET_FAILURE;
+ }
+ raw = pmbus_data2reg_direct((s64)target_uv,
+ act->info->m[PSC_VOLTAGE_OUT],
+ act->info->b[PSC_VOLTAGE_OUT],
+ act->info->R[PSC_VOLTAGE_OUT]);
+ fmt_name = "DIRECT";
+ break;
+ default:
+ printf("pmbus: VOUT_MODE 0x%02x selects an encoder not yet implemented (VID / IEEE754)\n",
+ vout_mode);
+ return CMD_RET_FAILURE;
+ }
+
+ buf[0] = raw & 0xff;
+ buf[1] = (raw >> 8) & 0xff;
+ ret = dm_i2c_write(chip, PMBUS_VOUT_COMMAND, buf, 2);
+ if (ret) {
+ printf("pmbus: VOUT_COMMAND write failed (%d)\n", ret);
+ return CMD_RET_FAILURE;
+ }
+ printf("pmbus: VOUT_COMMAND <- 0x%04x (%s, target %lu uV)\n",
+ raw, fmt_name, target_uv);
+ }
+ return CMD_RET_SUCCESS;
+}
+
+static int pmbus_scan_one_bus(struct udevice *bus, int bus_seq)
+{
+ int hits = 0;
+ int addr;
+
+ for (addr = 0x08; addr <= 0x77; addr++) {
+ struct udevice *chip;
+ u8 b;
+
+ if (i2c_get_chip(bus, addr, 1, &chip))
+ continue;
+ /* MFR_ID block read: 1st byte is the length of the string. */
+ if (dm_i2c_read(chip, PMBUS_MFR_ID, &b, 1))
+ continue;
+ if (b >= 1 && b <= PMBUS_MFR_STRING_MAX - 1) {
+ char s[PMBUS_MFR_STRING_MAX] = "";
+
+ pmbus_read_string(chip, PMBUS_MFR_ID, s, sizeof(s), false);
+ if (!s[0])
+ pmbus_read_string(chip, PMBUS_MFR_ID, s, sizeof(s), true);
+ printf(" i2c%d:0x%02x MFR_ID=\"%s\"\n",
+ bus_seq, addr, s[0] ? s : "(unprintable)");
+ hits++;
+ }
+ }
+ return hits;
+}
+
+static int do_scan(struct cmd_tbl *cmdtp, int flag, int argc,
+ char *const argv[])
+{
+ int total = 0;
+
+ if (argc >= 2) {
+ struct udevice *bus;
+ unsigned long val;
+ int bus_seq;
+
+ if (strict_strtoul(argv[1], 10, &val)) {
+ printf("pmbus: invalid bus seq '%s'\n", argv[1]);
+ return CMD_RET_USAGE;
+ }
+ bus_seq = (int)val;
+ if (uclass_get_device_by_seq(UCLASS_I2C, bus_seq, &bus)) {
+ printf("pmbus: i2c%d not available\n", bus_seq);
+ return CMD_RET_FAILURE;
+ }
+ printf("pmbus scan i2c%d:\n", bus_seq);
+ total = pmbus_scan_one_bus(bus, bus_seq);
+ } else {
+ struct uclass *uc;
+ struct udevice *bus;
+
+ if (uclass_get(UCLASS_I2C, &uc))
+ return CMD_RET_FAILURE;
+ uclass_foreach_dev(bus, uc) {
+ int seq = dev_seq(bus);
+
+ if (seq < 0)
+ continue;
+ printf("pmbus scan i2c%d:\n", seq);
+ total += pmbus_scan_one_bus(bus, seq);
+ }
+ }
+ if (!total)
+ printf("pmbus: no PMBus responders found\n");
+ return CMD_RET_SUCCESS;
+}
+
+static int do_help(struct cmd_tbl *cmdtp, int flag, int argc,
+ char *const argv[])
+{
+ unsigned int i, n = pmbus_vendor_count();
+
+ if (n == 0) {
+ printf("pmbus: no vendor extensions registered.\n");
+ printf(" Vendor handlers are registered by per chip drivers at\n");
+ printf(" probe time; trigger a probe via 'pmbus dev <name>' or a\n");
+ printf(" board hook (boot snapshot) and re run 'pmbus help'.\n");
+ return CMD_RET_SUCCESS;
+ }
+
+ printf("Registered pmbus vendor extensions (%u):\n\n", n);
+ for (i = 0; i < n; i++) {
+ const struct pmbus_vendor_op *op = pmbus_vendor_at(i);
+
+ if (!op)
+ continue;
+ printf("[vendor: %s]\n", op->vendor);
+ if (op->help)
+ printf("%s", op->help);
+ printf("\n");
+ }
+ return CMD_RET_SUCCESS;
+}
+
+static struct cmd_tbl pmbus_subcmd[] = {
+ U_BOOT_CMD_MKENT(dev, 2, 1, do_dev, "", ""),
+ U_BOOT_CMD_MKENT(list, 1, 1, do_list, "", ""),
+ U_BOOT_CMD_MKENT(info, 1, 1, do_info, "", ""),
+ U_BOOT_CMD_MKENT(telemetry, 1, 1, do_telemetry, "", ""),
+ U_BOOT_CMD_MKENT(status, 1, 1, do_status, "", ""),
+ U_BOOT_CMD_MKENT(dump, 1, 1, do_dump, "", ""),
+ U_BOOT_CMD_MKENT(read, 3, 1, do_read, "", ""),
+ U_BOOT_CMD_MKENT(write, 4, 1, do_write, "", ""),
+ U_BOOT_CMD_MKENT(clear, 2, 1, do_clear, "", ""),
+ U_BOOT_CMD_MKENT(vout, 2, 1, do_vout, "", ""),
+ U_BOOT_CMD_MKENT(scan, 2, 1, do_scan, "", ""),
+ U_BOOT_CMD_MKENT(help, 1, 1, do_help, "", ""),
+};
+
+static int do_pmbus(struct cmd_tbl *cmdtp, int flag, int argc,
+ char *const argv[])
+{
+ const struct pmbus_vendor_op *vop;
+ struct cmd_tbl *cmd;
+
+ if (argc < 2)
+ return CMD_RET_USAGE;
+
+ argc--;
+ argv++;
+
+ cmd = find_cmd_tbl(argv[0], pmbus_subcmd, ARRAY_SIZE(pmbus_subcmd));
+ if (cmd) {
+ if (argc > cmd->maxargs)
+ return CMD_RET_USAGE;
+ return cmd->cmd(cmdtp, flag, argc, argv);
+ }
+
+ /* Vendor namespace dispatch */
+ vop = pmbus_lookup_vendor(argv[0]);
+ if (vop)
+ return vop->handler(cmdtp, flag, argc, argv);
+
+ printf("pmbus: unknown subcommand '%s'\n", argv[0]);
+ return CMD_RET_USAGE;
+}
+
+U_BOOT_CMD(pmbus, CONFIG_SYS_MAXARGS, 1, do_pmbus,
+ "PMBus 1.x device interrogation and control",
+ "list - list UCLASS_REGULATOR devices (DM bound)\n"
+ "pmbus dev [<bus>:<addr>|<name>] - show / select active PMBus device\n"
+ " (<bus> decimal, <addr>/<reg>/<val> hex)\n"
+ "pmbus info - identification banner + driver_info\n"
+ "pmbus telemetry - decoded VIN, VOUT, IIN, IOUT, TEMP\n"
+ "pmbus status - decode every STATUS_* register\n"
+ "pmbus dump - hex dump of every standard register\n"
+ "pmbus read <reg> [b|w|s] - raw read (b=byte, w=word, s=string)\n"
+ "pmbus write <reg> <val> [b|w] - raw write\n"
+ "pmbus clear [faults] - issue CLEAR_FAULTS (03h)\n"
+ "pmbus vout [<uV>] - read / set VOUT_COMMAND (microvolts)\n"
+ "pmbus scan [<bus>] - PMBus aware probe of one or all I2C buses\n"
+ "pmbus help - list registered vendor extensions\n"
+ "\n"
+ "Vendor extensions (pmbus <vendor> ...) are registered by per chip\n"
+ "drivers at probe time. Run 'pmbus help' after a chip is probed to\n"
+ "see the available subcommands.\n"
+);
diff --git a/cmd/read.c b/cmd/read.c
index 8e21f004423..efc255ce85d 100644
--- a/cmd/read.c
+++ b/cmd/read.c
@@ -46,7 +46,7 @@ do_rw(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
limit = ~0;
}
- if (cnt + blk > limit) {
+ if (blk > limit || cnt > limit - blk) {
printf("%s out of range\n", cmdtp->name);
unmap_sysmem(ptr);
return 1;
diff --git a/cmd/ti/Kconfig b/cmd/ti/Kconfig
index 43fe9ef2f08..17cf867dd91 100644
--- a/cmd/ti/Kconfig
+++ b/cmd/ti/Kconfig
@@ -4,24 +4,24 @@ config CMD_DDR3
bool "command for verifying DDR features"
depends on ARCH_KEYSTONE || DRA7XX
help
- Support for testing ddr3 on TI platforms. This command
- supports memory verification, memory comapre and ecc
- verification if supported.
+ Support for testing ddr3 on TI platforms. This command
+ supports memory verification, memory comapre and ecc
+ verification if supported.
config CMD_DDR4
bool "command for verifying DDRSS Inline ECC features"
depends on ARCH_K3
help
- Support for testing DDRSS on TI platforms. This command supports
- memory verification, memory compare and inline ECC verification
- if supported.
+ Support for testing DDRSS on TI platforms. This command supports
+ memory verification, memory compare and inline ECC verification
+ if supported.
config CMD_PD
bool "command for verifying power domains"
depends on TI_POWER_DOMAIN
help
- Debug command for K3 power domains. For this to work, the
- K3 power domain driver must be enabled for the u-boot; by
- default it is only enabled for SPL.
+ Debug command for K3 power domains. For this to work, the
+ K3 power domain driver must be enabled for the u-boot; by
+ default it is only enabled for SPL.
endmenu
diff --git a/cmd/ti/ddr4.c b/cmd/ti/ddr4.c
index a8d71d11a91..36277cc154c 100644
--- a/cmd/ti/ddr4.c
+++ b/cmd/ti/ddr4.c
@@ -227,10 +227,10 @@ static int do_ddr4_ecc_inject(struct cmd_tbl *cmdtp, int flag, int argc,
return CMD_RET_FAILURE;
}
- if (!((start_addr >= gd->bd->bi_dram[0].start &&
- (start_addr <= (gd->bd->bi_dram[0].start + gd->bd->bi_dram[0].size - 1))) ||
- (start_addr >= gd->bd->bi_dram[1].start &&
- (start_addr <= (gd->bd->bi_dram[1].start + gd->bd->bi_dram[1].size - 1))))) {
+ if (!((start_addr >= gd->dram[0].start &&
+ (start_addr <= (gd->dram[0].start + gd->dram[0].size - 1))) ||
+ (start_addr >= gd->dram[1].start &&
+ (start_addr <= (gd->dram[1].start + gd->dram[1].size - 1))))) {
puts("Address is not in the DDR range\n");
return CMD_RET_FAILURE;
}
diff --git a/cmd/ubi.c b/cmd/ubi.c
index 93de6f3aea2..2b206141a21 100644
--- a/cmd/ubi.c
+++ b/cmd/ubi.c
@@ -39,7 +39,7 @@ static struct ubi_device *ubi;
#include <ubifs_uboot.h>
#endif
-static void display_volume_info(struct ubi_device *ubi)
+static void display_volume_info(const struct ubi_device *ubi)
{
int i;
@@ -50,7 +50,7 @@ static void display_volume_info(struct ubi_device *ubi)
}
}
-static void display_ubi_info(struct ubi_device *ubi)
+static void display_ubi_info(const struct ubi_device *ubi)
{
ubi_msg("MTD device name: \"%s\"", ubi->mtd->name);
ubi_msg("MTD device size: %llu MiB", ubi->flash_size >> 20);
@@ -149,12 +149,12 @@ static int ubi_list(const char *var, int numeric)
return 0;
}
-static int ubi_check_volumename(const struct ubi_volume *vol, char *name)
+static int ubi_check_volumename(const struct ubi_volume *vol, const char *name)
{
return strcmp(vol->name, name);
}
-static int ubi_check(char *name)
+static int ubi_check(const char *name)
{
int i;
@@ -172,7 +172,7 @@ static int ubi_check(char *name)
static int verify_mkvol_req(const struct ubi_device *ubi,
const struct ubi_mkvol_req *req)
{
- int n, err = EINVAL;
+ int n, err = -EINVAL;
if (req->bytes < 0 || req->alignment < 0 || req->vol_type < 0 ||
req->name_len < 0)
@@ -187,7 +187,7 @@ static int verify_mkvol_req(const struct ubi_device *ubi,
if (req->bytes == 0) {
printf("No space left in UBI device!\n");
- err = ENOMEM;
+ err = -ENOMEM;
goto bad;
}
@@ -204,7 +204,7 @@ static int verify_mkvol_req(const struct ubi_device *ubi,
if (req->name_len > UBI_VOL_NAME_MAX) {
printf("Name too long!\n");
- err = ENAMETOOLONG;
+ err = -ENAMETOOLONG;
goto bad;
}
@@ -213,8 +213,8 @@ bad:
return err;
}
-static int ubi_create_vol(char *volume, int64_t size, int dynamic, int vol_id,
- bool skipcheck)
+int ubi_create_vol(const char *volume, int64_t size, bool dynamic, int vol_id,
+ bool skipcheck)
{
struct ubi_mkvol_req req;
int err;
@@ -226,7 +226,11 @@ static int ubi_create_vol(char *volume, int64_t size, int dynamic, int vol_id,
req.vol_id = vol_id;
req.alignment = 1;
- req.bytes = size;
+
+ if (size < 0)
+ req.bytes = ubi->avail_pebs * ubi->leb_size;
+ else
+ req.bytes = size;
strcpy(req.name, volume);
req.name_len = strlen(volume);
@@ -241,13 +245,12 @@ static int ubi_create_vol(char *volume, int64_t size, int dynamic, int vol_id,
printf("verify_mkvol_req failed %d\n", err);
return err;
}
- printf("Creating %s volume %s of size %lld\n",
- dynamic ? "dynamic" : "static", volume, size);
+
/* Call real ubi create volume */
return ubi_create_volume(ubi, &req);
}
-static struct ubi_volume *ubi_find_volume(char *volume)
+struct ubi_volume *ubi_find_volume(const char *volume)
{
struct ubi_volume *vol;
int i;
@@ -258,24 +261,26 @@ static struct ubi_volume *ubi_find_volume(char *volume)
return vol;
}
- printf("Volume %s not found!\n", volume);
return NULL;
}
-static int ubi_remove_vol(char *volume)
+static struct ubi_volume *ubi_require_volume(const char *volume)
{
- int err, reserved_pebs, i;
- struct ubi_volume *vol;
+ struct ubi_volume *vol = ubi_find_volume(volume);
- vol = ubi_find_volume(volume);
- if (vol == NULL)
- return ENODEV;
+ if (!vol)
+ printf("Volume %s not found!\n", volume);
+
+ return vol;
+}
- printf("Remove UBI volume %s (id %d)\n", vol->name, vol->vol_id);
+static int __ubi_remove_vol(struct ubi_volume *vol)
+{
+ int err, reserved_pebs, i;
if (ubi->ro_mode) {
printf("It's read-only mode\n");
- err = EROFS;
+ err = -EROFS;
goto out_err;
}
@@ -310,35 +315,40 @@ static int ubi_remove_vol(char *volume)
return 0;
out_err:
- ubi_err(ubi, "cannot remove volume %s, error %d", volume, err);
- if (err < 0)
- err = -err;
+ ubi_err(ubi, "cannot remove volume %s, error %d", vol->name, err);
return err;
}
-static int ubi_rename_vol(char *oldname, char *newname)
+int ubi_remove_vol(const char *volume)
+{
+ struct ubi_volume *vol;
+
+ vol = ubi_require_volume(volume);
+ if (!vol)
+ return -ENODEV;
+
+ return __ubi_remove_vol(vol);
+}
+
+static int ubi_rename_vol(const char *oldname, const char *newname)
{
struct ubi_volume *vol;
struct ubi_rename_entry rename;
struct ubi_volume_desc desc;
struct list_head list;
- vol = ubi_find_volume(oldname);
- if (!vol) {
- printf("%s: volume %s doesn't exist\n", __func__, oldname);
- return ENODEV;
- }
+ vol = ubi_require_volume(oldname);
+ if (!vol)
+ return -ENODEV;
if (!ubi_check(newname)) {
printf("%s: volume %s already exist\n", __func__, newname);
- return EINVAL;
+ return -EINVAL;
}
- printf("Rename UBI volume %s to %s\n", oldname, newname);
-
if (ubi->ro_mode) {
printf("%s: ubi device is in read-only mode\n", __func__);
- return EROFS;
+ return -EROFS;
}
rename.new_name_len = strlen(newname);
@@ -354,24 +364,25 @@ static int ubi_rename_vol(char *oldname, char *newname)
return ubi_rename_volumes(ubi, &list);
}
-static int ubi_volume_continue_write(char *volume, void *buf, size_t size)
+static int ubi_volume_continue_write(const char *volume, const void *buf,
+ size_t size)
{
int err;
struct ubi_volume *vol;
- vol = ubi_find_volume(volume);
+ vol = ubi_require_volume(volume);
if (vol == NULL)
- return ENODEV;
+ return -ENODEV;
if (!vol->updating) {
printf("UBI volume update was not initiated\n");
- return EINVAL;
+ return -EINVAL;
}
err = ubi_more_update_data(ubi, vol, buf, size);
if (err < 0) {
printf("Couldnt or partially wrote data\n");
- return -err;
+ return err;
}
if (err) {
@@ -379,7 +390,7 @@ static int ubi_volume_continue_write(char *volume, void *buf, size_t size)
err = ubi_check_volume(ubi, vol->vol_id);
if (err < 0)
- return -err;
+ return err;
if (err) {
ubi_warn(ubi, "volume %d on UBI device %d is corrupt",
@@ -394,27 +405,27 @@ static int ubi_volume_continue_write(char *volume, void *buf, size_t size)
return 0;
}
-int ubi_volume_begin_write(char *volume, void *buf, size_t size,
- size_t full_size)
+int ubi_volume_begin_write(const char *volume, const void *buf, size_t size,
+ size_t full_size)
{
int err;
int rsvd_bytes;
struct ubi_volume *vol;
- vol = ubi_find_volume(volume);
+ vol = ubi_require_volume(volume);
if (vol == NULL)
- return ENODEV;
+ return -ENODEV;
rsvd_bytes = vol->reserved_pebs * (ubi->leb_size - vol->data_pad);
if (size > rsvd_bytes) {
printf("size > volume size! Aborting!\n");
- return EINVAL;
+ return -EINVAL;
}
err = ubi_start_update(ubi, vol, full_size);
if (err < 0) {
printf("Cannot start volume update\n");
- return -err;
+ return err;
}
/* The volume is just wiped out */
@@ -424,8 +435,8 @@ int ubi_volume_begin_write(char *volume, void *buf, size_t size,
return ubi_volume_continue_write(volume, buf, size);
}
-static int ubi_volume_offset_write(char *volume, void *buf, loff_t offset,
- size_t size)
+static int ubi_volume_offset_write(const char *volume, const void *buf,
+ loff_t offset, size_t size)
{
int len, tbuf_size, ret;
u64 lnum;
@@ -433,7 +444,7 @@ static int ubi_volume_offset_write(char *volume, void *buf, loff_t offset,
loff_t off = offset;
void *tbuf;
- vol = ubi_find_volume(volume);
+ vol = ubi_require_volume(volume);
if (!vol)
return -ENODEV;
@@ -487,7 +498,8 @@ exit:
return ret;
}
-int ubi_volume_write(char *volume, void *buf, loff_t offset, size_t size)
+int ubi_volume_write(const char *volume, const void *buf, loff_t offset,
+ size_t size)
{
int ret;
@@ -503,36 +515,28 @@ int ubi_volume_write(char *volume, void *buf, loff_t offset, size_t size)
return ret;
}
-int ubi_volume_read(char *volume, char *buf, loff_t offset, size_t size)
+static int __ubi_volume_read(struct ubi_volume *vol, void *buf, loff_t offset,
+ size_t size)
{
int err, lnum, off, len, tbuf_size;
void *tbuf;
unsigned long long tmp;
- struct ubi_volume *vol;
loff_t offp = offset;
size_t len_read;
- vol = ubi_find_volume(volume);
- if (vol == NULL)
- return ENODEV;
-
if (vol->updating) {
printf("updating");
- return EBUSY;
+ return -EBUSY;
}
if (vol->upd_marker) {
printf("damaged volume, update marker is set");
- return EBADF;
+ return -EBADF;
}
if (offp == vol->used_bytes)
return 0;
- if (size == 0) {
- printf("No size specified -> Using max size (%lld)\n", vol->used_bytes);
+ if (size == 0)
size = vol->used_bytes;
- }
-
- printf("Read %zu bytes from volume %s to %p\n", size, volume, buf);
if (vol->corrupted)
printf("read from corrupted volume %d", vol->vol_id);
@@ -545,7 +549,7 @@ int ubi_volume_read(char *volume, char *buf, loff_t offset, size_t size)
tbuf = malloc_cache_aligned(tbuf_size);
if (!tbuf) {
printf("NO MEM\n");
- return ENOMEM;
+ return -ENOMEM;
}
len = size > tbuf_size ? tbuf_size : size;
@@ -561,7 +565,6 @@ int ubi_volume_read(char *volume, char *buf, loff_t offset, size_t size)
err = ubi_eba_read_leb(ubi, vol, lnum, tbuf, off, len, 0);
if (err) {
printf("read err %x\n", err);
- err = -err;
break;
}
off += len;
@@ -587,7 +590,19 @@ int ubi_volume_read(char *volume, char *buf, loff_t offset, size_t size)
return err;
}
-static int ubi_dev_scan(struct mtd_info *info, const char *vid_header_offset)
+int ubi_volume_read(const char *volume, void *buf, loff_t offset, size_t size)
+{
+ struct ubi_volume *vol;
+
+ vol = ubi_require_volume(volume);
+ if (!vol)
+ return -ENODEV;
+
+ return __ubi_volume_read(vol, buf, offset, size);
+}
+
+static int ubi_dev_scan(const struct mtd_info *info,
+ const char *vid_header_offset)
{
char ubi_mtd_param_buffer[80];
int err;
@@ -600,28 +615,25 @@ static int ubi_dev_scan(struct mtd_info *info, const char *vid_header_offset)
err = ubi_mtd_param_parse(ubi_mtd_param_buffer, NULL);
if (err)
- return -err;
+ return err;
led_activity_blink();
err = ubi_init();
led_activity_off();
if (err)
- return -err;
+ return err;
return 0;
}
-static int ubi_set_skip_check(char *volume, bool skip_check)
+static int ubi_set_skip_check(const char *volume, bool skip_check)
{
struct ubi_vtbl_record vtbl_rec;
struct ubi_volume *vol;
- vol = ubi_find_volume(volume);
+ vol = ubi_require_volume(volume);
if (!vol)
- return ENODEV;
-
- printf("%sing skip_check on volume %s\n",
- skip_check ? "Sett" : "Clear", volume);
+ return -ENODEV;
vtbl_rec = ubi->vtbl[vol->vol_id];
if (skip_check) {
@@ -635,7 +647,7 @@ static int ubi_set_skip_check(char *volume, bool skip_check)
return ubi_change_vtbl_record(ubi, vol->vol_id, &vtbl_rec);
}
-static int ubi_detach(void)
+int ubi_detach(void)
{
#ifdef CONFIG_CMD_UBIFS
/*
@@ -658,7 +670,7 @@ static int ubi_detach(void)
return 0;
}
-int ubi_part(char *part_name, const char *vid_header_offset)
+int ubi_part(const char *part_name, const char *vid_header_offset)
{
struct mtd_info *mtd;
int err;
@@ -674,7 +686,7 @@ int ubi_part(char *part_name, const char *vid_header_offset)
mtd = get_mtd_device_nm(part_name);
if (IS_ERR(mtd)) {
printf("Partition %s not found!\n", part_name);
- return 1;
+ return -ENODEV;
}
put_mtd_device(mtd);
@@ -695,6 +707,8 @@ static int do_ubi(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
int64_t size;
ulong addr = 0;
bool skipcheck = false;
+ struct ubi_volume *vol;
+ int ret;
if (argc < 2)
return CMD_RET_USAGE;
@@ -709,7 +723,7 @@ static int do_ubi(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
if (argc == 2) {
if (!ubi) {
printf("Error, no UBI device selected!\n");
- return 1;
+ return CMD_RET_FAILURE;
}
printf("Device %d: %s, MTD partition %s\n",
@@ -723,12 +737,13 @@ static int do_ubi(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
if (argc > 3)
vid_header_offset = argv[3];
- return ubi_part(argv[2], vid_header_offset);
+ ret = ubi_part(argv[2], vid_header_offset);
+ return ret ? CMD_RET_FAILURE : 0;
}
if ((strcmp(argv[1], "part") != 0) && !ubi) {
printf("Error, no UBI device selected!\n");
- return 1;
+ return CMD_RET_FAILURE;
}
if (strcmp(argv[1], "info") == 0) {
@@ -758,11 +773,11 @@ static int do_ubi(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
return ubi_check(argv[2]);
printf("Error, no volume name passed\n");
- return 1;
+ return CMD_RET_USAGE;
}
if (strncmp(argv[1], "create", 6) == 0) {
- int dynamic = 1; /* default: dynamic volume */
+ bool dynamic = true; /* default: dynamic volume */
int id = UBI_VOL_NUM_AUTO;
/* Use maximum available size */
@@ -783,10 +798,10 @@ static int do_ubi(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
/* E.g., create volume size type */
if (argc == 5) {
if (strncmp(argv[4], "s", 1) == 0)
- dynamic = 0;
+ dynamic = false;
else if (strncmp(argv[4], "d", 1) != 0) {
printf("Incorrect type\n");
- return 1;
+ return CMD_RET_USAGE;
}
argc--;
}
@@ -799,38 +814,80 @@ static int do_ubi(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
/* Use maximum available size */
if (!size) {
size = (int64_t)ubi->avail_pebs * ubi->leb_size;
- printf("No size specified -> Using max size (%lld)\n", size);
+ if (size)
+ printf("No size specified -> Using max size (%lld)\n",
+ size);
}
/* E.g., create volume */
if (argc == 3) {
- return ubi_create_vol(argv[2], size, dynamic, id,
- skipcheck);
+ ret = ubi_create_vol(argv[2], size, dynamic, id,
+ skipcheck);
+ if (ret)
+ return CMD_RET_FAILURE;
+
+ printf("Created %s volume %s of size %lld\n",
+ dynamic ? "dynamic" : "static", argv[2], size);
+
+ return 0;
}
}
if (strncmp(argv[1], "remove", 6) == 0) {
/* E.g., remove volume */
- if (argc == 3)
- return ubi_remove_vol(argv[2]);
+ if (argc == 3) {
+ int vol_id;
+
+ vol = ubi_require_volume(argv[2]);
+ if (!vol)
+ return CMD_RET_FAILURE;
+
+ vol_id = vol->vol_id;
+
+ ret = __ubi_remove_vol(vol);
+ if (ret)
+ return CMD_RET_FAILURE;
+
+ printf("Removed UBI volume %s (id %d)\n", argv[2],
+ vol_id);
+
+ return 0;
+ }
}
- if (IS_ENABLED(CONFIG_CMD_UBI_RENAME) && !strncmp(argv[1], "rename", 6))
- return ubi_rename_vol(argv[2], argv[3]);
+ if (IS_ENABLED(CONFIG_CMD_UBI_RENAME) && !strncmp(argv[1], "rename", 6)) {
+ if (argc < 4) {
+ printf("Please see usage\n");
+ return CMD_RET_USAGE;
+ }
+
+ ret = ubi_rename_vol(argv[2], argv[3]);
+ if (ret)
+ return CMD_RET_FAILURE;
+
+ printf("UBI volume %s renamed to %s\n", argv[2], argv[3]);
+
+ return 0;
+ }
if (strncmp(argv[1], "skipcheck", 9) == 0) {
/* E.g., change skip_check flag */
if (argc == 4) {
skipcheck = strncmp(argv[3], "on", 2) == 0;
- return ubi_set_skip_check(argv[2], skipcheck);
+ ret = ubi_set_skip_check(argv[2], skipcheck);
+ if (ret)
+ return CMD_RET_FAILURE;
+
+ printf("%s skip_check on volume %s\n",
+ skipcheck ? "Set" : "Cleared", argv[2]);
+
+ return 0;
}
}
if (strncmp(argv[1], "write", 5) == 0) {
- int ret;
-
if (argc < 5) {
printf("Please see usage\n");
- return 1;
+ return CMD_RET_USAGE;
}
addr = hextoul(argv[2], NULL);
@@ -855,7 +912,7 @@ static int do_ubi(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
argv[3]);
}
- return ret;
+ return ret ? CMD_RET_FAILURE : 0;
}
if (strncmp(argv[1], "read", 4) == 0) {
@@ -874,12 +931,29 @@ static int do_ubi(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
}
if (argc == 3) {
- return ubi_volume_read(argv[3], (char *)addr, 0, size);
+ vol = ubi_require_volume(argv[3]);
+ if (!vol)
+ return CMD_RET_FAILURE;
+
+ if (!size) {
+ printf("No size specified -> Using max size (%lld)\n",
+ vol->used_bytes);
+ size = vol->used_bytes;
+ }
+
+ ret = __ubi_volume_read(vol, (void *)addr, 0, size);
+ if (ret)
+ return CMD_RET_FAILURE;
+
+ printf("%lld bytes read from volume %s to 0x%lx\n",
+ size, argv[3], addr);
+
+ return 0;
}
}
printf("Please see usage\n");
- return 1;
+ return CMD_RET_USAGE;
}
U_BOOT_CMD(
diff --git a/cmd/ubifs.c b/cmd/ubifs.c
index 22e95db8ca5..81f2d37fc7b 100644
--- a/cmd/ubifs.c
+++ b/cmd/ubifs.c
@@ -19,7 +19,7 @@
static int ubifs_initialized;
static int ubifs_mounted;
-int cmd_ubifs_mount(char *vol_name)
+int cmd_ubifs_mount(const char *vol_name)
{
int ret;
diff --git a/cmd/ufetch.c b/cmd/ufetch.c
index bc5db08eee1..763ab42c48a 100644
--- a/cmd/ufetch.c
+++ b/cmd/ufetch.c
@@ -157,26 +157,37 @@ static int do_ufetch(struct cmd_tbl *cmdtp, int flag, int argc,
printf(" (%d baud)", gd->baudrate);
putc('\n');
break;
- case FEATURES:
+ case FEATURES: {
+ const char *sep = "";
+
printf("Features:" RESET " ");
- if (IS_ENABLED(CONFIG_NET))
- printf("Net");
- if (IS_ENABLED(CONFIG_EFI_LOADER))
- printf(", EFI");
- if (IS_ENABLED(CONFIG_CMD_CAT))
- printf(", cat :3");
+ if (IS_ENABLED(CONFIG_NET)) {
+ printf("%sNet", sep);
+ sep = ", ";
+ }
+ if (IS_ENABLED(CONFIG_EFI_LOADER)) {
+ printf("%sEFI", sep);
+ sep = ", ";
+ }
+ if (IS_ENABLED(CONFIG_CMD_CAT)) {
+ printf("%scat :3", sep);
+ sep = ", ";
+ }
#ifdef CONFIG_ARM64
switch (current_el()) {
case 2:
- printf(", VMs");
+ printf("%sVMs", sep);
+ sep = ", ";
break;
case 3:
- printf(", full control!");
+ printf("%sfull control!", sep);
+ sep = ", ";
break;
}
#endif
printf("\n");
break;
+ }
case RELOCATION:
if (gd->flags & GD_FLG_SKIP_RELOC)
printf("Relocated:" RESET " no\n");
@@ -191,8 +202,8 @@ static int do_ufetch(struct cmd_tbl *cmdtp, int flag, int argc,
printf("CPU: " RESET CONFIG_SYS_ARCH " (%d cores, 1 in use)\n", n_cpus);
break;
case MEMORY:
- for (int j = 0; j < CONFIG_NR_DRAM_BANKS && gd->bd->bi_dram[j].size; j++)
- size += gd->bd->bi_dram[j].size;
+ for (int j = 0; j < CONFIG_NR_DRAM_BANKS && gd->dram[j].size; j++)
+ size += gd->dram[j].size;
printf("Memory:" RESET " ");
print_size(size, "\n");
break;
diff --git a/cmd/upl.c b/cmd/upl.c
index ef2183d8528..be21ec258cb 100644
--- a/cmd/upl.c
+++ b/cmd/upl.c
@@ -93,7 +93,7 @@ static int do_upl_read(struct cmd_tbl *cmdtp, int flag, int argc,
ulong addr;
int ret;
- if (argc < 1)
+ if (argc < 2)
return CMD_RET_USAGE;
addr = hextoul(argv[1], NULL);
diff --git a/cmd/usb_mass_storage.c b/cmd/usb_mass_storage.c
index 47e8b70cd10..e8b87045bdc 100644
--- a/cmd/usb_mass_storage.c
+++ b/cmd/usb_mass_storage.c
@@ -24,6 +24,11 @@ static int ums_read_sector(struct ums *ums_dev,
{
struct blk_desc *block_dev = &ums_dev->block_dev;
lbaint_t blkstart = start + ums_dev->start_sector;
+ int ret;
+
+ ret = blk_dselect_hwpart(block_dev, ums_dev->hwpart);
+ if (ret && ret != -ENOSYS)
+ return ret;
return blk_dread(block_dev, blkstart, blkcnt, buf);
}
@@ -33,6 +38,11 @@ static int ums_write_sector(struct ums *ums_dev,
{
struct blk_desc *block_dev = &ums_dev->block_dev;
lbaint_t blkstart = start + ums_dev->start_sector;
+ int ret;
+
+ ret = blk_dselect_hwpart(block_dev, ums_dev->hwpart);
+ if (ret && ret != -ENOSYS)
+ return ret;
return blk_dwrite(block_dev, blkstart, blkcnt, buf);
}
@@ -110,6 +120,7 @@ static int ums_init(const char *devtype, const char *devnums_part_str)
snprintf(name, UMS_NAME_LEN, "UMS disk %d", ums_count);
ums[ums_count].name = name;
ums[ums_count].block_dev = *block_dev;
+ ums[ums_count].hwpart = block_dev->hwpart;
printf("UMS: LUN %d, dev %s %d, hwpart %d, sector %#x, count %#x\n",
ums_count, devtype, ums[ums_count].block_dev.devnum,
diff --git a/cmd/x86/zboot.c b/cmd/x86/zboot.c
index 3876d163236..cc7292e10b7 100644
--- a/cmd/x86/zboot.c
+++ b/cmd/x86/zboot.c
@@ -66,9 +66,6 @@ static int do_zboot_setup(struct cmd_tbl *cmdtp, int flag, int argc,
return CMD_RET_FAILURE;
}
- if (zboot_setup())
- return CMD_RET_FAILURE;
-
return 0;
}