¿ªÔÆÌåÓý

ctrl + shift + ? for shortcuts
© 2025 Groups.io

Re: [PATCH] dts: meson-g12-common-u-boot: do not disable canvas

 

Hi,

On Tue, 08 Oct 2024 18:23:42 +0200, Neil Armstrong wrote:
We were disabling canvas, which causes meson vpu probe failure,
just stop and leave canvas alone.

Thanks, Applied to (u-boot-amlogic-next)

[1/1] dts: meson-g12-common-u-boot: do not disable canvas


--
Neil


Re: [PATCH v3 4/6] cmd: bcb: introduce 'ab_dump' command to print BCB block content

 

Hi Dmitry,

Thank you for the patch.

On mar., oct. 08, 2024 at 23:18, Dmitry Rokosov <ddrokosov@...> wrote:

It's really helpful to have the ability to dump BCB block for debugging
A/B logic on the board supported this partition schema.

Command 'bcb ab_dump' prints all fields of bootloader_control struct
including slot_metadata for all presented slots.

Output example:
=====
board# bcb ab_dump ubi 0#misc
Read 512 bytes from volume misc to 000000000bf07580
Read 512 bytes from volume misc to 000000000bf42f40
Bootloader Control: [misc]
Active Slot: _a
Magic Number: 0x42414342
Version: 1
Number of Slots: 2
Recovery Tries Remaining: 0
CRC: 0x2c8b50bc (Valid)

Slot[0] Metadata:
- Priority: 15
- Tries Remaining: 0
- Successful Boot: 1
- Verity Corrupted: 0

Slot[1] Metadata:
- Priority: 14
- Tries Remaining: 7
- Successful Boot: 0
- Verity Corrupted: 0
====

Signed-off-by: Dmitry Rokosov <ddrokosov@...>
Reviewed-by: Mattijs Korpershoek <mkorpershoek@...>

---
boot/android_ab.c | 68 ++++++++++++++++++++++++++++++++++++++++++++++++++++
cmd/bcb.c | 35 +++++++++++++++++++++++++++
include/android_ab.h | 10 ++++++++
3 files changed, 113 insertions(+)

diff --git a/boot/android_ab.c b/boot/android_ab.c
index 0045c8133a8e164f1fdd4c0f9b683de0f13f26e0..c93e51541019d0fe793303c4b3d5286df061906f 100644
--- a/boot/android_ab.c
+++ b/boot/android_ab.c
@@ -372,3 +372,71 @@ int ab_select_slot(struct blk_desc *dev_desc, struct disk_partition *part_info,

return slot;
}
+
+int ab_dump_abc(struct blk_desc *dev_desc, struct disk_partition *part_info)
+{
+ struct bootloader_control *abc;
+ u32 crc32_le;
+ int i, ret;
+ struct slot_metadata *slot;
+
+ if (!dev_desc || !part_info) {
+ log_err("ANDROID: Empty device descriptor or partition info\n");
+ return -EINVAL;
+ }
+
+ ret = ab_control_create_from_disk(dev_desc, part_info, &abc, 0);
+ if (ret < 0) {
+ log_err("ANDROID: Cannot create bcb from disk %d\n", ret);
+ return ret;
+ }
+
+ if (abc->magic != BOOT_CTRL_MAGIC) {
+ log_err("ANDROID: Unknown A/B metadata: %.8x\n", abc->magic);
+ ret = -ENODATA;
+ goto error;
+ }
+
+ if (abc->version > BOOT_CTRL_VERSION) {
+ log_err("ANDROID: Unsupported A/B metadata version: %.8x\n",
+ abc->version);
+ ret = -ENODATA;
+ goto error;
+ }
+
+ if (abc->nb_slot > ARRAY_SIZE(abc->slot_info)) {
+ log_err("ANDROID: Wrong number of slots %u, expected %zu\n",
+ abc->nb_slot, ARRAY_SIZE(abc->slot_info));
+ ret = -ENODATA;
+ goto error;
+ }
+
+ printf("Bootloader Control: [%s]\n", part_info->name);
+ printf("Active Slot: %s\n", abc->slot_suffix);
+ printf("Magic Number: 0x%x\n", abc->magic);
+ printf("Version: %u\n", abc->version);
+ printf("Number of Slots: %u\n", abc->nb_slot);
+ printf("Recovery Tries Remaining: %u\n", abc->recovery_tries_remaining);
+
+ printf("CRC: 0x%.8x", abc->crc32_le);
+
+ crc32_le = ab_control_compute_crc(abc);
+ if (abc->crc32_le != crc32_le)
+ printf(" (Invalid, Expected: 0x%.8x)\n", crc32_le);
+ else
+ printf(" (Valid)\n");
+
+ for (i = 0; i < abc->nb_slot; ++i) {
+ slot = &abc->slot_info[i];
+ printf("\nSlot[%d] Metadata:\n", i);
+ printf("\t- Priority: %u\n", slot->priority);
+ printf("\t- Tries Remaining: %u\n", slot->tries_remaining);
+ printf("\t- Successful Boot: %u\n", slot->successful_boot);
+ printf("\t- Verity Corrupted: %u\n", slot->verity_corrupted);
+ }
+
+error:
+ free(abc);
+
+ return ret;
+}
diff --git a/cmd/bcb.c b/cmd/bcb.c
index 970c58e56cba0e1bdff21b7cd099f69151f0c5b8..4fd32186ae654915b5a42c26d755e5727c211c63 100644
--- a/cmd/bcb.c
+++ b/cmd/bcb.c
@@ -25,6 +25,7 @@ enum bcb_cmd {
BCB_CMD_FIELD_DUMP,
BCB_CMD_STORE,
BCB_CMD_AB_SELECT,
+ BCB_CMD_AB_DUMP,
};

static const char * const fields[] = {
@@ -56,6 +57,8 @@ static int bcb_cmd_get(char *cmd)
return BCB_CMD_FIELD_DUMP;
if (!strcmp(cmd, "ab_select"))
return BCB_CMD_AB_SELECT;
+ if (!strcmp(cmd, "ab_dump"))
+ return BCB_CMD_AB_DUMP;
else
return -1;
}
@@ -93,6 +96,10 @@ static int bcb_is_misused(int argc, char *const argv[])
if (argc != 4 && argc != 5)
goto err;
return 0;
+ case BCB_CMD_AB_DUMP:
+ if (argc != 3)
+ goto err;
+ return 0;
default:
printf("Error: 'bcb %s' not supported\n", argv[0]);
return -1;
@@ -460,6 +467,28 @@ static int do_bcb_ab_select(struct cmd_tbl *cmdtp, int flag, int argc,
return CMD_RET_SUCCESS;
}

+static int do_bcb_ab_dump(struct cmd_tbl *cmdtp, int flag, int argc,
+ char *const argv[])
+{
+ int ret;
+ struct blk_desc *dev_desc;
+ struct disk_partition part_info;
+
+ if (part_get_info_by_dev_and_name_or_num(argv[1], argv[2],
+ &dev_desc, &part_info,
+ false) < 0) {
+ return CMD_RET_FAILURE;
+ }
+
+ ret = ab_dump_abc(dev_desc, &part_info);
+ if (ret < 0) {
+ printf("Cannot dump ABC data, error %d.\n", ret);
+ return CMD_RET_FAILURE;
+ }
+
+ return CMD_RET_SUCCESS;
+}
+
static struct cmd_tbl cmd_bcb_sub[] = {
U_BOOT_CMD_MKENT(load, CONFIG_SYS_MAXARGS, 1, do_bcb_load, "", ""),
U_BOOT_CMD_MKENT(set, CONFIG_SYS_MAXARGS, 1, do_bcb_set, "", ""),
@@ -469,6 +498,8 @@ static struct cmd_tbl cmd_bcb_sub[] = {
U_BOOT_CMD_MKENT(store, CONFIG_SYS_MAXARGS, 1, do_bcb_store, "", ""),
U_BOOT_CMD_MKENT(ab_select, CONFIG_SYS_MAXARGS, 1,
do_bcb_ab_select, "", ""),
+ U_BOOT_CMD_MKENT(ab_dump, CONFIG_SYS_MAXARGS, 1,
+ do_bcb_ab_dump, "", ""),
};

static int do_bcb(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
@@ -523,6 +554,10 @@ U_BOOT_CMD(
" - If '--no-dec' is set, the number of tries remaining will not\n"
" decremented for the selected boot slot\n"
"\n"
+ "bcb ab_dump -\n"
+ " Dump boot_control information from specific partition.\n"
+ " <interface> <dev[:part|#part_name]>\n"
+ "\n"
"Legend:\n"
"<interface> - storage device interface (virtio, mmc, etc)\n"
"<dev> - storage device index containing the BCB partition\n"
diff --git a/include/android_ab.h b/include/android_ab.h
index 1e53879a25f145a9d18ac0a6553d8c217123aa6f..838230e06f8cbf7a5d79d9d84d9ebe9f96aca10d 100644
--- a/include/android_ab.h
+++ b/include/android_ab.h
@@ -36,4 +36,14 @@ struct disk_partition;
int ab_select_slot(struct blk_desc *dev_desc, struct disk_partition *part_info,
bool dec_tries);

+/**
+ * ab_dump_abc() - Dump ABC information for specific partition.
+ *
+ * @dev_desc: Device description pointer
+ * @part_info: Partition information
+ *
+ * Return: 0 on success, or a negative on error
+ */
+int ab_dump_abc(struct blk_desc *dev_desc, struct disk_partition *part_info);
+
#endif /* __ANDROID_AB_H */

--
2.43.0


Re: [PATCH v3 4/6] cmd: bcb: introduce 'ab_dump' command to print BCB block content

 

Hi Dmitry,

On jeu., oct. 10, 2024 at 14:17, "Mattijs Korpershoek via groups.io" <mkorpershoek@...> wrote:

[...]


Reviewed-by: Simon Glass <sjg@...>

Can you also update the test?
I apologize, but I didn't quite understand your point. Could you please
clarify? This patch series includes additional tests for the 'ab_dump'
subcommand. For more details, please refer to:

OK, thank you. Sometimes it is easier (for reviewers) if you update
the test in the same commit.
Should I resend the patch series with ab_dump implementation and tests
in the same commit?

I can prepare new version, if needed, no problem.
No need to resend a new version just for this, since it's already
been reviewed.

Keep the suggestion in mind for future series!
If you do need to re-spin this as v4, you can squash the test commit
with this one if you wish.



--
Thank you,
Dmitry


Re: [PATCH v3 2/6] treewide: bcb: move ab_select command to bcb subcommands

 

On ven., oct. 11, 2024 at 15:30, "Mattijs Korpershoek via groups.io" <mkorpershoek@...> wrote:

Hi Dmitry,

Thank you for the patch.

On mar., oct. 08, 2024 at 23:18, Dmitry Rokosov <ddrokosov@...> wrote:

To enhance code organization, it is beneficial to consolidate all A/B
BCB management routines into a single super-command.
The 'bcb' command is an excellent candidate for this purpose.

This patch integrates the separate 'ab_select' command into the 'bcb'
group as the 'ab_select' subcommand, maintaining the same parameter list
for consistency.

Signed-off-by: Dmitry Rokosov <ddrokosov@...>
---
MAINTAINERS | 1 -
cmd/Kconfig | 15 +------
cmd/Makefile | 1 -
cmd/ab_select.c | 66 -------------------------------
cmd/bcb.c | 63 +++++++++++++++++++++++++++++
configs/am57xx_hs_evm_usb_defconfig | 1 -
configs/khadas-vim3_android_ab_defconfig | 1 -
configs/khadas-vim3l_android_ab_defconfig | 1 -
configs/sandbox64_defconfig | 4 +-
configs/sandbox_defconfig | 4 +-
doc/android/ab.rst | 12 +++---
include/configs/khadas-vim3_android.h | 2 +-
include/configs/khadas-vim3l_android.h | 2 +-
include/configs/meson64_android.h | 4 +-
include/configs/ti_omap5_common.h | 4 +-
test/py/tests/test_android/test_ab.py | 8 ++--
16 files changed, 85 insertions(+), 104 deletions(-)

diff --git a/MAINTAINERS b/MAINTAINERS
index 7aefda93d017f07d616f0f6d191129914fbeb484..668ccec9ae6df47192b1af668e3fdbeb1dfa15ea 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -65,7 +65,6 @@ R: Sam Protsenko <semen.protsenko@...>
S: Maintained
T: git
F: boot/android_ab.c
-F: cmd/ab_select.c
F: doc/android/ab.rst
F: include/android_ab.h
F: test/py/tests/test_android/test_ab.py
diff --git a/cmd/Kconfig b/cmd/Kconfig
index dd33266cec70a2b134b7244acae1b7f098b921e8..11e8d363dc9b137723a86a240412d82dd0dbccc5 100644
--- a/cmd/Kconfig
+++ b/cmd/Kconfig
@@ -1067,6 +1067,7 @@ config CMD_ADC
config CMD_BCB
bool "bcb"
depends on PARTITIONS
+ depends on ANDROID_AB
When building with khadas-vim3_android_defconfig, we can see that CMD_BCB is no
longer part of that build:

$ grep CMD_BCB .config
<empty>

However, if we look at include/configs/meson64_android.h, we can see
that the "bcb" command is not only used for checking the _slot suffix.

It's also used for checking the bootloader reason. For example, in
BOOTENV_DEV_FASTBOOT, we call:

"if bcb test command = bootonce-bootloader; then " \

Since CMD_BCB is no longer part of the .config (due to this dependency),
the boot script now shows errors:

"""
U-Boot 2024.10-00796-g969325278805 (Oct 11 2024 - 14:46:00 +0200) khadas-vim3

Model: Khadas VIM3
SoC: Amlogic Meson G12B (A311D) Revision 29:b (10:2)
DRAM: 2 GiB (effective 3.8 GiB)
Core: 411 devices, 36 uclasses, devicetree: separate
MMC: mmc@ffe03000: 0, mmc@ffe05000: 1, mmc@ffe07000: 2
Loading Environment from MMC... fs uses incompatible features: 00020000, ignoring
Reading from MMC(2)... *** Warning - bad CRC, using default environment

In: usbkbd,serial
Out: vidconsole,serial
Err: vidconsole,serial
Net: eth0: ethernet@ff3f0000

Hit any key to stop autoboot: 0
Verify GPT: success!
Unknown command 'bcb' - try 'help'
Warning: BCB is corrupted or does not exist
dev: pinctrl@14
dev: pinctrl@40
gpio: pin 88 (gpio 88) value is 1
Unknown command 'bcb' - try 'help'
Warning: BCB is corrupted or does not exist
Loading Android boot partition...
switch to partitions #0, OK
mmc2(part 0) is current device
"""

I know we should not be using a boot script, nor non A/B configs but
it's a bummer that this series breaks an upstream
defconfig (khadas-vim3_android_defconfig)

My recommendation:

Make BCB_CMD_AB_SELECT implementation dependant on ANDROID_AB.
This way, users can use CMD_BCB with and without ANDROID_AB being enabled.

We could do:
When ANDROID_AB=y, implement bcb ab_select subcommand
When ANDROID_AB=n, command is not accessible.

I'll send you a diff shortly for this.
Here is an illustration on how that would work:

diff --git a/cmd/Kconfig b/cmd/Kconfig
index 861c31e26408..e1a4a97b042d 100644
--- a/cmd/Kconfig
+++ b/cmd/Kconfig
@@ -1055,7 +1055,6 @@ config CMD_ADC
config CMD_BCB
bool "bcb"
depends on PARTITIONS
- depends on ANDROID_AB
help
Read/modify/write the fields of Bootloader Control Block, usually
stored on the flash "misc" partition with its structure defined in:
diff --git a/cmd/bcb.c b/cmd/bcb.c
index 4fd32186ae65..4fe634f14cc5 100644
--- a/cmd/bcb.c
+++ b/cmd/bcb.c
@@ -438,6 +438,9 @@ static int do_bcb_ab_select(struct cmd_tbl *cmdtp, int flag, int argc,
char slot[2];
bool dec_tries = true;

+ if (!CONFIG_IS_ENABLED(AB_SELECT))
+ return CMD_RET_SUCCESS;
+
for (int i = 4; i < argc; i++) {
if (!strcmp(argv[i], "--no-dec"))
dec_tries = false;
@@ -474,6 +477,9 @@ static int do_bcb_ab_dump(struct cmd_tbl *cmdtp, int flag, int argc,
struct blk_desc *dev_desc;
struct disk_partition part_info;

+ if (!CONFIG_IS_ENABLED(AB_SELECT))
+ return CMD_RET_SUCCESS;
+
if (part_get_info_by_dev_and_name_or_num(argv[1], argv[2],
&dev_desc, &part_info,
false) < 0) {


help
Read/modify/write the fields of Bootloader Control Block, usually
stored on the flash "misc" partition with its structure defined in:
@@ -1789,20 +1790,6 @@ config CMD_XXD

endmenu

-menu "Android support commands"
-
-config CMD_AB_SELECT
- bool "ab_select"
- depends on ANDROID_AB
- help
- On Android devices with more than one boot slot (multiple copies of
- the kernel and system images) this provides a command to select which
- slot should be used to boot from and register the boot attempt. This
- is used by the new A/B update model where one slot is updated in the
- background while running from the other slot.
-
-endmenu
-
if NET

menuconfig CMD_NET
diff --git a/cmd/Makefile b/cmd/Makefile
index 91227f1249cbda5f7b383e8865c8cc23f3ad5f44..0fd7da3c0de91822c4299cc7034193c497d622b1 100644
--- a/cmd/Makefile
+++ b/cmd/Makefile
@@ -17,7 +17,6 @@ obj-$(CONFIG_CMD_2048) += 2048.o
obj-$(CONFIG_CMD_ACPI) += acpi.o
obj-$(CONFIG_CMD_ADDRMAP) += addrmap.o
obj-$(CONFIG_CMD_AES) += aes.o
-obj-$(CONFIG_CMD_AB_SELECT) += ab_select.o
obj-$(CONFIG_CMD_ADC) += adc.o
obj-$(CONFIG_CMD_ARMFLASH) += armflash.o
obj-$(CONFIG_BLK) += blk_common.o
diff --git a/cmd/ab_select.c b/cmd/ab_select.c
deleted file mode 100644
index 7c178c728ca4c8b5bcba02a04eef2d6a7c86afb6..0000000000000000000000000000000000000000
--- a/cmd/ab_select.c
+++ /dev/null
@@ -1,66 +0,0 @@
-// SPDX-License-Identifier: BSD-2-Clause
-/*
- * Copyright (C) 2017 The Android Open Source Project
- */
-
-#include <android_ab.h>
-#include <command.h>
-#include <env.h>
-#include <part.h>
-
-static int do_ab_select(struct cmd_tbl *cmdtp, int flag, int argc,
- char *const argv[])
-{
- int ret;
- struct blk_desc *dev_desc;
- struct disk_partition part_info;
- char slot[2];
- bool dec_tries = true;
-
- if (argc < 4)
- return CMD_RET_USAGE;
-
- for (int i = 4; i < argc; i++) {
- if (strcmp(argv[i], "--no-dec") == 0) {
- dec_tries = false;
- } else {
- return CMD_RET_USAGE;
- }
- }
-
- /* Lookup the "misc" partition from argv[2] and argv[3] */
- if (part_get_info_by_dev_and_name_or_num(argv[2], argv[3],
- &dev_desc, &part_info,
- false) < 0) {
- return CMD_RET_FAILURE;
- }
-
- ret = ab_select_slot(dev_desc, &part_info, dec_tries);
- if (ret < 0) {
- printf("Android boot failed, error %d.\n", ret);
- return CMD_RET_FAILURE;
- }
-
- /* Android standard slot names are 'a', 'b', ... */
- slot[0] = BOOT_SLOT_NAME(ret);
- slot[1] = '\0';
- env_set(argv[1], slot);
- printf("ANDROID: Booting slot: %s\n", slot);
- return CMD_RET_SUCCESS;
-}
-
-U_BOOT_CMD(ab_select, 5, 0, do_ab_select,
- "Select the slot used to boot from and register the boot attempt.",
- "<slot_var_name> <interface> <dev[:part|#part_name]> [--no-dec]\n"
- " - Load the slot metadata from the partition 'part' on\n"
- " device type 'interface' instance 'dev' and store the active\n"
- " slot in the 'slot_var_name' variable. This also updates the\n"
- " Android slot metadata with a boot attempt, which can cause\n"
- " successive calls to this function to return a different result\n"
- " if the returned slot runs out of boot attempts.\n"
- " - If 'part_name' is passed, preceded with a # instead of :, the\n"
- " partition name whose label is 'part_name' will be looked up in\n"
- " the partition table. This is commonly the \"misc\" partition.\n"
- " - If '--no-dec' is set, the number of tries remaining will not\n"
- " decremented for the selected boot slot\n"
-);
diff --git a/cmd/bcb.c b/cmd/bcb.c
index 97a96c009641cc094645607ef833575f3c03fe4b..4f3b8a1538a1f05b8b4a1a51c8962c422981166a 100644
--- a/cmd/bcb.c
+++ b/cmd/bcb.c
@@ -8,6 +8,7 @@
#include <android_bootloader_message.h>
#include <bcb.h>
#include <command.h>
+#include <android_ab.h>
#include <display_options.h>
#include <log.h>
#include <part.h>
@@ -23,6 +24,7 @@ enum bcb_cmd {
BCB_CMD_FIELD_TEST,
BCB_CMD_FIELD_DUMP,
BCB_CMD_STORE,
+ BCB_CMD_AB_SELECT,
};

static const char * const fields[] = {
@@ -52,6 +54,8 @@ static int bcb_cmd_get(char *cmd)
return BCB_CMD_STORE;
if (!strcmp(cmd, "dump"))
return BCB_CMD_FIELD_DUMP;
+ if (!strcmp(cmd, "ab_select"))
+ return BCB_CMD_AB_SELECT;
else
return -1;
}
@@ -85,6 +89,10 @@ static int bcb_is_misused(int argc, char *const argv[])
if (argc != 2)
goto err;
break;
+ case BCB_CMD_AB_SELECT:
+ if (argc != 4 && argc != 5)
+ goto err;
+ return 0;
default:
printf("Error: 'bcb %s' not supported\n", argv[0]);
return -1;
@@ -414,6 +422,44 @@ void bcb_reset(void)
__bcb_reset();
}

+static int do_bcb_ab_select(struct cmd_tbl *cmdtp, int flag, int argc,
+ char * const argv[])
+{
+ int ret;
+ struct blk_desc *dev_desc;
+ struct disk_partition part_info;
+ char slot[2];
+ bool dec_tries = true;
+
+ for (int i = 4; i < argc; i++) {
+ if (strcmp(argv[i], "--no-dec") == 0)
+ dec_tries = false;
+ else
+ return CMD_RET_USAGE;
+ }
+
+ /* Lookup the "misc" partition from argv[2] and argv[3] */
+ if (part_get_info_by_dev_and_name_or_num(argv[2], argv[3],
+ &dev_desc, &part_info,
+ false) < 0) {
+ return CMD_RET_FAILURE;
+ }
+
+ ret = ab_select_slot(dev_desc, &part_info, dec_tries);
+ if (ret < 0) {
+ printf("Android boot failed, error %d.\n", ret);
+ return CMD_RET_FAILURE;
+ }
+
+ /* Android standard slot names are 'a', 'b', ... */
+ slot[0] = BOOT_SLOT_NAME(ret);
+ slot[1] = '\0';
+ env_set(argv[1], slot);
+ printf("ANDROID: Booting slot: %s\n", slot);
+
+ return CMD_RET_SUCCESS;
+}
+
static struct cmd_tbl cmd_bcb_sub[] = {
U_BOOT_CMD_MKENT(load, CONFIG_SYS_MAXARGS, 1, do_bcb_load, "", ""),
U_BOOT_CMD_MKENT(set, CONFIG_SYS_MAXARGS, 1, do_bcb_set, "", ""),
@@ -421,6 +467,8 @@ static struct cmd_tbl cmd_bcb_sub[] = {
U_BOOT_CMD_MKENT(test, CONFIG_SYS_MAXARGS, 1, do_bcb_test, "", ""),
U_BOOT_CMD_MKENT(dump, CONFIG_SYS_MAXARGS, 1, do_bcb_dump, "", ""),
U_BOOT_CMD_MKENT(store, CONFIG_SYS_MAXARGS, 1, do_bcb_store, "", ""),
+ U_BOOT_CMD_MKENT(ab_select, CONFIG_SYS_MAXARGS, 1,
+ do_bcb_ab_select, "", ""),
};

static int do_bcb(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
@@ -460,6 +508,21 @@ U_BOOT_CMD(
"bcb dump <field> - dump BCB <field>\n"
"bcb store - store BCB back to <interface>\n"
"\n"
+ "bcb ab_select -\n"
+ " Select the slot used to boot from and register the boot attempt.\n"
+ " <slot_var_name> <interface> <dev[:part|#part_name]> [--no-dec]\n"
+ " - Load the slot metadata from the partition 'part' on\n"
+ " device type 'interface' instance 'dev' and store the active\n"
+ " slot in the 'slot_var_name' variable. This also updates the\n"
+ " Android slot metadata with a boot attempt, which can cause\n"
+ " successive calls to this function to return a different result\n"
+ " if the returned slot runs out of boot attempts.\n"
+ " - If 'part_name' is passed, preceded with a # instead of :, the\n"
+ " partition name whose label is 'part_name' will be looked up in\n"
+ " the partition table. This is commonly the \"misc\" partition.\n"
+ " - If '--no-dec' is set, the number of tries remaining will not\n"
+ " decremented for the selected boot slot\n"
+ "\n"
"Legend:\n"
"<interface> - storage device interface (virtio, mmc, etc)\n"
"<dev> - storage device index containing the BCB partition\n"
diff --git a/configs/am57xx_hs_evm_usb_defconfig b/configs/am57xx_hs_evm_usb_defconfig
index 81a938339d5934605cb7defa04ea92f76468b21a..2d8068ecdc79c01c1281ab3873fc892aa4c96be7 100644
--- a/configs/am57xx_hs_evm_usb_defconfig
+++ b/configs/am57xx_hs_evm_usb_defconfig
@@ -46,7 +46,6 @@ CONFIG_CMD_ADTIMG=y
CONFIG_CMD_ABOOTIMG=y
CONFIG_SYS_I2C_EEPROM_ADDR_LEN=2
CONFIG_CMD_BCB=y
-CONFIG_CMD_AB_SELECT=y
CONFIG_BOOTP_DNS2=y
# CONFIG_CMD_PMIC is not set
CONFIG_CMD_AVB=y
diff --git a/configs/khadas-vim3_android_ab_defconfig b/configs/khadas-vim3_android_ab_defconfig
index 510fe4f8928fe39a040a615636fa550b3e0dc5db..de5357c45cbfe4742d9491a29386850570acc235 100644
--- a/configs/khadas-vim3_android_ab_defconfig
+++ b/configs/khadas-vim3_android_ab_defconfig
@@ -47,7 +47,6 @@ CONFIG_CMD_SPI=y
CONFIG_CMD_USB=y
CONFIG_CMD_USB_MASS_STORAGE=y
# CONFIG_CMD_SETEXPR is not set
-CONFIG_CMD_AB_SELECT=y
CONFIG_CMD_REGULATOR=y
CONFIG_CMD_AVB=y
CONFIG_OF_CONTROL=y
diff --git a/configs/khadas-vim3l_android_ab_defconfig b/configs/khadas-vim3l_android_ab_defconfig
index d2da8ff2a69b209b8fb22a48be537bd4dd17a3bb..4d7b90f23002e464d7dc40516bcd3161b0f59439 100644
--- a/configs/khadas-vim3l_android_ab_defconfig
+++ b/configs/khadas-vim3l_android_ab_defconfig
@@ -47,7 +47,6 @@ CONFIG_CMD_SPI=y
CONFIG_CMD_USB=y
CONFIG_CMD_USB_MASS_STORAGE=y
# CONFIG_CMD_SETEXPR is not set
-CONFIG_CMD_AB_SELECT=y
CONFIG_CMD_REGULATOR=y
CONFIG_CMD_AVB=y
CONFIG_OF_CONTROL=y
diff --git a/configs/sandbox64_defconfig b/configs/sandbox64_defconfig
index e2f57c11f0e110917928695936d1066bfc4e8902..e598d44359fff493f31d2a2f25697a3bc78cf0a8 100644
--- a/configs/sandbox64_defconfig
+++ b/configs/sandbox64_defconfig
@@ -27,6 +27,7 @@ CONFIG_CONSOLE_RECORD=y
CONFIG_CONSOLE_RECORD_OUT_SIZE=0x6000
CONFIG_PRE_CONSOLE_BUFFER=y
CONFIG_DISPLAY_BOARDINFO_LATE=y
+CONFIG_ANDROID_AB=y
CONFIG_CMD_CPU=y
CONFIG_CMD_LICENSE=y
CONFIG_CMD_BOOTZ=y
@@ -46,6 +47,7 @@ CONFIG_CMD_MD5SUM=y
CONFIG_CMD_MEMINFO=y
CONFIG_CMD_MX_CYCLIC=y
CONFIG_CMD_MEMTEST=y
+CONFIG_CMD_BCB=y
CONFIG_CMD_DEMO=y
CONFIG_CMD_GPIO=y
CONFIG_CMD_GPT=y
@@ -169,8 +171,8 @@ CONFIG_PWRSEQ=y
CONFIG_I2C_EEPROM=y
CONFIG_MMC_SANDBOX=y
CONFIG_DM_MTD=y
-CONFIG_MTD_RAW_NAND=y
CONFIG_SYS_MAX_NAND_DEVICE=8
+CONFIG_MTD_RAW_NAND=y
CONFIG_SYS_NAND_USE_FLASH_BBT=y
CONFIG_NAND_SANDBOX=y
CONFIG_SYS_NAND_ONFI_DETECTION=y
diff --git a/configs/sandbox_defconfig b/configs/sandbox_defconfig
index 540ccef895059a57632d565d210bb449245e644d..6211c0f9ac916448d6730cee6144034966d0d1f6 100644
--- a/configs/sandbox_defconfig
+++ b/configs/sandbox_defconfig
@@ -75,6 +75,7 @@ CONFIG_CMD_MEMINFO=y
CONFIG_CMD_MEM_SEARCH=y
CONFIG_CMD_MX_CYCLIC=y
CONFIG_CMD_MEMTEST=y
+CONFIG_CMD_BCB=y
CONFIG_CMD_DEMO=y
CONFIG_CMD_GPIO=y
CONFIG_CMD_GPIO_READ=y
@@ -102,7 +103,6 @@ CONFIG_CMD_AXI=y
CONFIG_CMD_CAT=y
CONFIG_CMD_SETEXPR_FMT=y
CONFIG_CMD_XXD=y
-CONFIG_CMD_AB_SELECT=y
CONFIG_CMD_DHCP6=y
CONFIG_BOOTP_DNS2=y
CONFIG_CMD_PCAP=y
@@ -228,8 +228,8 @@ CONFIG_MMC_PCI=y
CONFIG_MMC_SANDBOX=y
CONFIG_MMC_SDHCI=y
CONFIG_DM_MTD=y
-CONFIG_MTD_RAW_NAND=y
CONFIG_SYS_MAX_NAND_DEVICE=8
+CONFIG_MTD_RAW_NAND=y
CONFIG_SYS_NAND_USE_FLASH_BBT=y
CONFIG_NAND_SANDBOX=y
CONFIG_SYS_NAND_ONFI_DETECTION=y
diff --git a/doc/android/ab.rst b/doc/android/ab.rst
index 2adf88781d60b61d1b3c74efe976a684b590c813..7fd4aeb6a724b839de9be5e9a8843ade2ad3667e 100644
--- a/doc/android/ab.rst
+++ b/doc/android/ab.rst
@@ -18,7 +18,7 @@ The A/B updates support can be activated by specifying next options in
your board configuration file::

CONFIG_ANDROID_AB=y
- CONFIG_CMD_AB_SELECT=y
+ CONFIG_CMD_BCB=y

The disk space on target device must be partitioned in a way so that each
partition which needs to be updated has two or more instances. The name of
@@ -26,8 +26,8 @@ each instance must be formed by adding suffixes: ``_a``, ``_b``, ``_c``, etc.
For example: ``boot_a``, ``boot_b``, ``system_a``, ``system_b``, ``vendor_a``,
``vendor_b``.

-As a result you can use ``ab_select`` command to ensure A/B boot process in your
-boot script. This command analyzes and processes A/B metadata stored on a
+As a result you can use ``bcb ab_select`` command to ensure A/B boot process in
+your boot script. This command analyzes and processes A/B metadata stored on a
special partition (e.g. ``misc``) and determines which slot should be used for
booting up.

@@ -42,15 +42,15 @@ Command usage

.. code-block:: none

- ab_select <slot_var_name> <interface> <dev[:part_number|#part_name]>
+ bcb ab_select <slot_var_name> <interface> <dev[:part_number|#part_name]>

for example::

- => ab_select slot_name mmc 1:4
+ => bcb ab_select slot_name mmc 1:4

or::

- => ab_select slot_name mmc 1#misc
+ => bcb ab_select slot_name mmc 1#misc

Result::

diff --git a/include/configs/khadas-vim3_android.h b/include/configs/khadas-vim3_android.h
index da6adf6c413add03413f40987959a24ad0d41e62..5468ac5878b34b82a70db84c209bab9f3a9dd79f 100644
--- a/include/configs/khadas-vim3_android.h
+++ b/include/configs/khadas-vim3_android.h
@@ -12,7 +12,7 @@
#define LOGO_UUID "43a3305d-150f-4cc9-bd3b-38fca8693846;"
#define ROOT_UUID "ddb8c3f6-d94d-4394-b633-3134139cc2e0;"

-#if defined(CONFIG_CMD_AB_SELECT)
+#if defined(CONFIG_CMD_BCB) && defined(CONFIG_ANDROID_AB)
#define PARTS_DEFAULT \
"uuid_disk=${uuid_gpt_disk};" \
"name=logo,start=512K,size=2M,uuid=" LOGO_UUID \
diff --git a/include/configs/khadas-vim3l_android.h b/include/configs/khadas-vim3l_android.h
index b1768e2d821176452254fb07f2e3747402b9b4fd..32821b942109feae5ade9f7fd02924bca34cf58b 100644
--- a/include/configs/khadas-vim3l_android.h
+++ b/include/configs/khadas-vim3l_android.h
@@ -12,7 +12,7 @@
#define LOGO_UUID "43a3305d-150f-4cc9-bd3b-38fca8693846;"
#define ROOT_UUID "ddb8c3f6-d94d-4394-b633-3134139cc2e0;"

-#if defined(CONFIG_CMD_AB_SELECT)
+#if defined(CONFIG_CMD_BCB) && defined(CONFIG_ANDROID_AB)
#define PARTS_DEFAULT \
"uuid_disk=${uuid_gpt_disk};" \
"name=logo,start=512K,size=2M,uuid=" LOGO_UUID \
diff --git a/include/configs/meson64_android.h b/include/configs/meson64_android.h
index c0e977abb01fb9efb7a462906a0073c84c800897..cc626dbf02418a49b367c8386797ce6ffc28c85b 100644
--- a/include/configs/meson64_android.h
+++ b/include/configs/meson64_android.h
@@ -47,13 +47,13 @@
#define AVB_VERIFY_CMD ""
#endif

-#if defined(CONFIG_CMD_AB_SELECT)
+#if defined(CONFIG_CMD_BCB) && defined(CONFIG_ANDROID_AB)
#define ANDROIDBOOT_GET_CURRENT_SLOT_CMD "get_current_slot=" \
"if part number mmc ${mmcdev} " CONTROL_PARTITION " control_part_number; " \
"then " \
"echo " CONTROL_PARTITION \
" partition number:${control_part_number};" \
- "ab_select current_slot mmc ${mmcdev}:${control_part_number};" \
+ "bcb ab_select current_slot mmc ${mmcdev}:${control_part_number};" \
"else " \
"echo " CONTROL_PARTITION " partition not found;" \
"fi;\0"
diff --git a/include/configs/ti_omap5_common.h b/include/configs/ti_omap5_common.h
index 26494ae980108ad84eb173a0deaa7b701a5309d4..26b6c1cd188c05371c6455cd6247f07a1773d885 100644
--- a/include/configs/ti_omap5_common.h
+++ b/include/configs/ti_omap5_common.h
@@ -93,13 +93,13 @@

#define CONTROL_PARTITION "misc"

-#if defined(CONFIG_CMD_AB_SELECT)
+#if defined(CONFIG_CMD_BCB) && defined(CONFIG_ANDROID_AB)
#define AB_SELECT_SLOT \
"if part number mmc 1 " CONTROL_PARTITION " control_part_number; " \
"then " \
"echo " CONTROL_PARTITION \
" partition number:${control_part_number};" \
- "ab_select slot_name mmc ${mmcdev}:${control_part_number};" \
+ "bcb ab_select slot_name mmc ${mmcdev}:${control_part_number};" \
"else " \
"echo " CONTROL_PARTITION " partition not found;" \
"exit;" \
diff --git a/test/py/tests/test_android/test_ab.py b/test/py/tests/test_android/test_ab.py
index c79cb07fda35dfeb608ac7345cd3f22744e2e491..0d7b7995a9fab6e3daad748721818b9e4cfac452 100644
--- a/test/py/tests/test_android/test_ab.py
+++ b/test/py/tests/test_android/test_ab.py
@@ -56,20 +56,20 @@ def ab_disk_image(u_boot_console):

@pytest.mark.boardspec('sandbox')
@pytest.mark.buildconfigspec('android_ab')
-@...('cmd_ab_select')
+@...('cmd_bcb')
@pytest.mark.requiredtool('sgdisk')
def test_ab(ab_disk_image, u_boot_console):
- """Test the 'ab_select' command."""
+ """Test the 'bcb ab_select' command."""

u_boot_console.run_command('host bind 0 ' + ab_disk_image.path)

- output = u_boot_console.run_command('ab_select slot_name host 0#misc')
+ output = u_boot_console.run_command('bcb ab_select slot_name host 0#misc')
assert 're-initializing A/B metadata' in output
assert 'Attempting slot a, tries remaining 7' in output
output = u_boot_console.run_command('printenv slot_name')
assert 'slot_name=a' in output

- output = u_boot_console.run_command('ab_select slot_name host 0:1')
+ output = u_boot_console.run_command('bcb ab_select slot_name host 0:1')
assert 'Attempting slot b, tries remaining 7' in output
output = u_boot_console.run_command('printenv slot_name')
assert 'slot_name=b' in output

--
2.43.0


Re: [PATCH v3 2/6] treewide: bcb: move ab_select command to bcb subcommands

 

Hi Dmitry,

Thank you for the patch.

On mar., oct. 08, 2024 at 23:18, Dmitry Rokosov <ddrokosov@...> wrote:

To enhance code organization, it is beneficial to consolidate all A/B
BCB management routines into a single super-command.
The 'bcb' command is an excellent candidate for this purpose.

This patch integrates the separate 'ab_select' command into the 'bcb'
group as the 'ab_select' subcommand, maintaining the same parameter list
for consistency.

Signed-off-by: Dmitry Rokosov <ddrokosov@...>
---
MAINTAINERS | 1 -
cmd/Kconfig | 15 +------
cmd/Makefile | 1 -
cmd/ab_select.c | 66 -------------------------------
cmd/bcb.c | 63 +++++++++++++++++++++++++++++
configs/am57xx_hs_evm_usb_defconfig | 1 -
configs/khadas-vim3_android_ab_defconfig | 1 -
configs/khadas-vim3l_android_ab_defconfig | 1 -
configs/sandbox64_defconfig | 4 +-
configs/sandbox_defconfig | 4 +-
doc/android/ab.rst | 12 +++---
include/configs/khadas-vim3_android.h | 2 +-
include/configs/khadas-vim3l_android.h | 2 +-
include/configs/meson64_android.h | 4 +-
include/configs/ti_omap5_common.h | 4 +-
test/py/tests/test_android/test_ab.py | 8 ++--
16 files changed, 85 insertions(+), 104 deletions(-)

diff --git a/MAINTAINERS b/MAINTAINERS
index 7aefda93d017f07d616f0f6d191129914fbeb484..668ccec9ae6df47192b1af668e3fdbeb1dfa15ea 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -65,7 +65,6 @@ R: Sam Protsenko <semen.protsenko@...>
S: Maintained
T: git
F: boot/android_ab.c
-F: cmd/ab_select.c
F: doc/android/ab.rst
F: include/android_ab.h
F: test/py/tests/test_android/test_ab.py
diff --git a/cmd/Kconfig b/cmd/Kconfig
index dd33266cec70a2b134b7244acae1b7f098b921e8..11e8d363dc9b137723a86a240412d82dd0dbccc5 100644
--- a/cmd/Kconfig
+++ b/cmd/Kconfig
@@ -1067,6 +1067,7 @@ config CMD_ADC
config CMD_BCB
bool "bcb"
depends on PARTITIONS
+ depends on ANDROID_AB
When building with khadas-vim3_android_defconfig, we can see that CMD_BCB is no
longer part of that build:

$ grep CMD_BCB .config
<empty>

However, if we look at include/configs/meson64_android.h, we can see
that the "bcb" command is not only used for checking the _slot suffix.

It's also used for checking the bootloader reason. For example, in
BOOTENV_DEV_FASTBOOT, we call:

"if bcb test command = bootonce-bootloader; then " \

Since CMD_BCB is no longer part of the .config (due to this dependency),
the boot script now shows errors:

"""
U-Boot 2024.10-00796-g969325278805 (Oct 11 2024 - 14:46:00 +0200) khadas-vim3

Model: Khadas VIM3
SoC: Amlogic Meson G12B (A311D) Revision 29:b (10:2)
DRAM: 2 GiB (effective 3.8 GiB)
Core: 411 devices, 36 uclasses, devicetree: separate
MMC: mmc@ffe03000: 0, mmc@ffe05000: 1, mmc@ffe07000: 2
Loading Environment from MMC... fs uses incompatible features: 00020000, ignoring
Reading from MMC(2)... *** Warning - bad CRC, using default environment

In: usbkbd,serial
Out: vidconsole,serial
Err: vidconsole,serial
Net: eth0: ethernet@ff3f0000

Hit any key to stop autoboot: 0
Verify GPT: success!
Unknown command 'bcb' - try 'help'
Warning: BCB is corrupted or does not exist
dev: pinctrl@14
dev: pinctrl@40
gpio: pin 88 (gpio 88) value is 1
Unknown command 'bcb' - try 'help'
Warning: BCB is corrupted or does not exist
Loading Android boot partition...
switch to partitions #0, OK
mmc2(part 0) is current device
"""

I know we should not be using a boot script, nor non A/B configs but
it's a bummer that this series breaks an upstream
defconfig (khadas-vim3_android_defconfig)

My recommendation:

Make BCB_CMD_AB_SELECT implementation dependant on ANDROID_AB.
This way, users can use CMD_BCB with and without ANDROID_AB being enabled.

We could do:
When ANDROID_AB=y, implement bcb ab_select subcommand
When ANDROID_AB=n, command is not accessible.

I'll send you a diff shortly for this.

help
Read/modify/write the fields of Bootloader Control Block, usually
stored on the flash "misc" partition with its structure defined in:
@@ -1789,20 +1790,6 @@ config CMD_XXD

endmenu

-menu "Android support commands"
-
-config CMD_AB_SELECT
- bool "ab_select"
- depends on ANDROID_AB
- help
- On Android devices with more than one boot slot (multiple copies of
- the kernel and system images) this provides a command to select which
- slot should be used to boot from and register the boot attempt. This
- is used by the new A/B update model where one slot is updated in the
- background while running from the other slot.
-
-endmenu
-
if NET

menuconfig CMD_NET
diff --git a/cmd/Makefile b/cmd/Makefile
index 91227f1249cbda5f7b383e8865c8cc23f3ad5f44..0fd7da3c0de91822c4299cc7034193c497d622b1 100644
--- a/cmd/Makefile
+++ b/cmd/Makefile
@@ -17,7 +17,6 @@ obj-$(CONFIG_CMD_2048) += 2048.o
obj-$(CONFIG_CMD_ACPI) += acpi.o
obj-$(CONFIG_CMD_ADDRMAP) += addrmap.o
obj-$(CONFIG_CMD_AES) += aes.o
-obj-$(CONFIG_CMD_AB_SELECT) += ab_select.o
obj-$(CONFIG_CMD_ADC) += adc.o
obj-$(CONFIG_CMD_ARMFLASH) += armflash.o
obj-$(CONFIG_BLK) += blk_common.o
diff --git a/cmd/ab_select.c b/cmd/ab_select.c
deleted file mode 100644
index 7c178c728ca4c8b5bcba02a04eef2d6a7c86afb6..0000000000000000000000000000000000000000
--- a/cmd/ab_select.c
+++ /dev/null
@@ -1,66 +0,0 @@
-// SPDX-License-Identifier: BSD-2-Clause
-/*
- * Copyright (C) 2017 The Android Open Source Project
- */
-
-#include <android_ab.h>
-#include <command.h>
-#include <env.h>
-#include <part.h>
-
-static int do_ab_select(struct cmd_tbl *cmdtp, int flag, int argc,
- char *const argv[])
-{
- int ret;
- struct blk_desc *dev_desc;
- struct disk_partition part_info;
- char slot[2];
- bool dec_tries = true;
-
- if (argc < 4)
- return CMD_RET_USAGE;
-
- for (int i = 4; i < argc; i++) {
- if (strcmp(argv[i], "--no-dec") == 0) {
- dec_tries = false;
- } else {
- return CMD_RET_USAGE;
- }
- }
-
- /* Lookup the "misc" partition from argv[2] and argv[3] */
- if (part_get_info_by_dev_and_name_or_num(argv[2], argv[3],
- &dev_desc, &part_info,
- false) < 0) {
- return CMD_RET_FAILURE;
- }
-
- ret = ab_select_slot(dev_desc, &part_info, dec_tries);
- if (ret < 0) {
- printf("Android boot failed, error %d.\n", ret);
- return CMD_RET_FAILURE;
- }
-
- /* Android standard slot names are 'a', 'b', ... */
- slot[0] = BOOT_SLOT_NAME(ret);
- slot[1] = '\0';
- env_set(argv[1], slot);
- printf("ANDROID: Booting slot: %s\n", slot);
- return CMD_RET_SUCCESS;
-}
-
-U_BOOT_CMD(ab_select, 5, 0, do_ab_select,
- "Select the slot used to boot from and register the boot attempt.",
- "<slot_var_name> <interface> <dev[:part|#part_name]> [--no-dec]\n"
- " - Load the slot metadata from the partition 'part' on\n"
- " device type 'interface' instance 'dev' and store the active\n"
- " slot in the 'slot_var_name' variable. This also updates the\n"
- " Android slot metadata with a boot attempt, which can cause\n"
- " successive calls to this function to return a different result\n"
- " if the returned slot runs out of boot attempts.\n"
- " - If 'part_name' is passed, preceded with a # instead of :, the\n"
- " partition name whose label is 'part_name' will be looked up in\n"
- " the partition table. This is commonly the \"misc\" partition.\n"
- " - If '--no-dec' is set, the number of tries remaining will not\n"
- " decremented for the selected boot slot\n"
-);
diff --git a/cmd/bcb.c b/cmd/bcb.c
index 97a96c009641cc094645607ef833575f3c03fe4b..4f3b8a1538a1f05b8b4a1a51c8962c422981166a 100644
--- a/cmd/bcb.c
+++ b/cmd/bcb.c
@@ -8,6 +8,7 @@
#include <android_bootloader_message.h>
#include <bcb.h>
#include <command.h>
+#include <android_ab.h>
#include <display_options.h>
#include <log.h>
#include <part.h>
@@ -23,6 +24,7 @@ enum bcb_cmd {
BCB_CMD_FIELD_TEST,
BCB_CMD_FIELD_DUMP,
BCB_CMD_STORE,
+ BCB_CMD_AB_SELECT,
};

static const char * const fields[] = {
@@ -52,6 +54,8 @@ static int bcb_cmd_get(char *cmd)
return BCB_CMD_STORE;
if (!strcmp(cmd, "dump"))
return BCB_CMD_FIELD_DUMP;
+ if (!strcmp(cmd, "ab_select"))
+ return BCB_CMD_AB_SELECT;
else
return -1;
}
@@ -85,6 +89,10 @@ static int bcb_is_misused(int argc, char *const argv[])
if (argc != 2)
goto err;
break;
+ case BCB_CMD_AB_SELECT:
+ if (argc != 4 && argc != 5)
+ goto err;
+ return 0;
default:
printf("Error: 'bcb %s' not supported\n", argv[0]);
return -1;
@@ -414,6 +422,44 @@ void bcb_reset(void)
__bcb_reset();
}

+static int do_bcb_ab_select(struct cmd_tbl *cmdtp, int flag, int argc,
+ char * const argv[])
+{
+ int ret;
+ struct blk_desc *dev_desc;
+ struct disk_partition part_info;
+ char slot[2];
+ bool dec_tries = true;
+
+ for (int i = 4; i < argc; i++) {
+ if (strcmp(argv[i], "--no-dec") == 0)
+ dec_tries = false;
+ else
+ return CMD_RET_USAGE;
+ }
+
+ /* Lookup the "misc" partition from argv[2] and argv[3] */
+ if (part_get_info_by_dev_and_name_or_num(argv[2], argv[3],
+ &dev_desc, &part_info,
+ false) < 0) {
+ return CMD_RET_FAILURE;
+ }
+
+ ret = ab_select_slot(dev_desc, &part_info, dec_tries);
+ if (ret < 0) {
+ printf("Android boot failed, error %d.\n", ret);
+ return CMD_RET_FAILURE;
+ }
+
+ /* Android standard slot names are 'a', 'b', ... */
+ slot[0] = BOOT_SLOT_NAME(ret);
+ slot[1] = '\0';
+ env_set(argv[1], slot);
+ printf("ANDROID: Booting slot: %s\n", slot);
+
+ return CMD_RET_SUCCESS;
+}
+
static struct cmd_tbl cmd_bcb_sub[] = {
U_BOOT_CMD_MKENT(load, CONFIG_SYS_MAXARGS, 1, do_bcb_load, "", ""),
U_BOOT_CMD_MKENT(set, CONFIG_SYS_MAXARGS, 1, do_bcb_set, "", ""),
@@ -421,6 +467,8 @@ static struct cmd_tbl cmd_bcb_sub[] = {
U_BOOT_CMD_MKENT(test, CONFIG_SYS_MAXARGS, 1, do_bcb_test, "", ""),
U_BOOT_CMD_MKENT(dump, CONFIG_SYS_MAXARGS, 1, do_bcb_dump, "", ""),
U_BOOT_CMD_MKENT(store, CONFIG_SYS_MAXARGS, 1, do_bcb_store, "", ""),
+ U_BOOT_CMD_MKENT(ab_select, CONFIG_SYS_MAXARGS, 1,
+ do_bcb_ab_select, "", ""),
};

static int do_bcb(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
@@ -460,6 +508,21 @@ U_BOOT_CMD(
"bcb dump <field> - dump BCB <field>\n"
"bcb store - store BCB back to <interface>\n"
"\n"
+ "bcb ab_select -\n"
+ " Select the slot used to boot from and register the boot attempt.\n"
+ " <slot_var_name> <interface> <dev[:part|#part_name]> [--no-dec]\n"
+ " - Load the slot metadata from the partition 'part' on\n"
+ " device type 'interface' instance 'dev' and store the active\n"
+ " slot in the 'slot_var_name' variable. This also updates the\n"
+ " Android slot metadata with a boot attempt, which can cause\n"
+ " successive calls to this function to return a different result\n"
+ " if the returned slot runs out of boot attempts.\n"
+ " - If 'part_name' is passed, preceded with a # instead of :, the\n"
+ " partition name whose label is 'part_name' will be looked up in\n"
+ " the partition table. This is commonly the \"misc\" partition.\n"
+ " - If '--no-dec' is set, the number of tries remaining will not\n"
+ " decremented for the selected boot slot\n"
+ "\n"
"Legend:\n"
"<interface> - storage device interface (virtio, mmc, etc)\n"
"<dev> - storage device index containing the BCB partition\n"
diff --git a/configs/am57xx_hs_evm_usb_defconfig b/configs/am57xx_hs_evm_usb_defconfig
index 81a938339d5934605cb7defa04ea92f76468b21a..2d8068ecdc79c01c1281ab3873fc892aa4c96be7 100644
--- a/configs/am57xx_hs_evm_usb_defconfig
+++ b/configs/am57xx_hs_evm_usb_defconfig
@@ -46,7 +46,6 @@ CONFIG_CMD_ADTIMG=y
CONFIG_CMD_ABOOTIMG=y
CONFIG_SYS_I2C_EEPROM_ADDR_LEN=2
CONFIG_CMD_BCB=y
-CONFIG_CMD_AB_SELECT=y
CONFIG_BOOTP_DNS2=y
# CONFIG_CMD_PMIC is not set
CONFIG_CMD_AVB=y
diff --git a/configs/khadas-vim3_android_ab_defconfig b/configs/khadas-vim3_android_ab_defconfig
index 510fe4f8928fe39a040a615636fa550b3e0dc5db..de5357c45cbfe4742d9491a29386850570acc235 100644
--- a/configs/khadas-vim3_android_ab_defconfig
+++ b/configs/khadas-vim3_android_ab_defconfig
@@ -47,7 +47,6 @@ CONFIG_CMD_SPI=y
CONFIG_CMD_USB=y
CONFIG_CMD_USB_MASS_STORAGE=y
# CONFIG_CMD_SETEXPR is not set
-CONFIG_CMD_AB_SELECT=y
CONFIG_CMD_REGULATOR=y
CONFIG_CMD_AVB=y
CONFIG_OF_CONTROL=y
diff --git a/configs/khadas-vim3l_android_ab_defconfig b/configs/khadas-vim3l_android_ab_defconfig
index d2da8ff2a69b209b8fb22a48be537bd4dd17a3bb..4d7b90f23002e464d7dc40516bcd3161b0f59439 100644
--- a/configs/khadas-vim3l_android_ab_defconfig
+++ b/configs/khadas-vim3l_android_ab_defconfig
@@ -47,7 +47,6 @@ CONFIG_CMD_SPI=y
CONFIG_CMD_USB=y
CONFIG_CMD_USB_MASS_STORAGE=y
# CONFIG_CMD_SETEXPR is not set
-CONFIG_CMD_AB_SELECT=y
CONFIG_CMD_REGULATOR=y
CONFIG_CMD_AVB=y
CONFIG_OF_CONTROL=y
diff --git a/configs/sandbox64_defconfig b/configs/sandbox64_defconfig
index e2f57c11f0e110917928695936d1066bfc4e8902..e598d44359fff493f31d2a2f25697a3bc78cf0a8 100644
--- a/configs/sandbox64_defconfig
+++ b/configs/sandbox64_defconfig
@@ -27,6 +27,7 @@ CONFIG_CONSOLE_RECORD=y
CONFIG_CONSOLE_RECORD_OUT_SIZE=0x6000
CONFIG_PRE_CONSOLE_BUFFER=y
CONFIG_DISPLAY_BOARDINFO_LATE=y
+CONFIG_ANDROID_AB=y
CONFIG_CMD_CPU=y
CONFIG_CMD_LICENSE=y
CONFIG_CMD_BOOTZ=y
@@ -46,6 +47,7 @@ CONFIG_CMD_MD5SUM=y
CONFIG_CMD_MEMINFO=y
CONFIG_CMD_MX_CYCLIC=y
CONFIG_CMD_MEMTEST=y
+CONFIG_CMD_BCB=y
CONFIG_CMD_DEMO=y
CONFIG_CMD_GPIO=y
CONFIG_CMD_GPT=y
@@ -169,8 +171,8 @@ CONFIG_PWRSEQ=y
CONFIG_I2C_EEPROM=y
CONFIG_MMC_SANDBOX=y
CONFIG_DM_MTD=y
-CONFIG_MTD_RAW_NAND=y
CONFIG_SYS_MAX_NAND_DEVICE=8
+CONFIG_MTD_RAW_NAND=y
CONFIG_SYS_NAND_USE_FLASH_BBT=y
CONFIG_NAND_SANDBOX=y
CONFIG_SYS_NAND_ONFI_DETECTION=y
diff --git a/configs/sandbox_defconfig b/configs/sandbox_defconfig
index 540ccef895059a57632d565d210bb449245e644d..6211c0f9ac916448d6730cee6144034966d0d1f6 100644
--- a/configs/sandbox_defconfig
+++ b/configs/sandbox_defconfig
@@ -75,6 +75,7 @@ CONFIG_CMD_MEMINFO=y
CONFIG_CMD_MEM_SEARCH=y
CONFIG_CMD_MX_CYCLIC=y
CONFIG_CMD_MEMTEST=y
+CONFIG_CMD_BCB=y
CONFIG_CMD_DEMO=y
CONFIG_CMD_GPIO=y
CONFIG_CMD_GPIO_READ=y
@@ -102,7 +103,6 @@ CONFIG_CMD_AXI=y
CONFIG_CMD_CAT=y
CONFIG_CMD_SETEXPR_FMT=y
CONFIG_CMD_XXD=y
-CONFIG_CMD_AB_SELECT=y
CONFIG_CMD_DHCP6=y
CONFIG_BOOTP_DNS2=y
CONFIG_CMD_PCAP=y
@@ -228,8 +228,8 @@ CONFIG_MMC_PCI=y
CONFIG_MMC_SANDBOX=y
CONFIG_MMC_SDHCI=y
CONFIG_DM_MTD=y
-CONFIG_MTD_RAW_NAND=y
CONFIG_SYS_MAX_NAND_DEVICE=8
+CONFIG_MTD_RAW_NAND=y
CONFIG_SYS_NAND_USE_FLASH_BBT=y
CONFIG_NAND_SANDBOX=y
CONFIG_SYS_NAND_ONFI_DETECTION=y
diff --git a/doc/android/ab.rst b/doc/android/ab.rst
index 2adf88781d60b61d1b3c74efe976a684b590c813..7fd4aeb6a724b839de9be5e9a8843ade2ad3667e 100644
--- a/doc/android/ab.rst
+++ b/doc/android/ab.rst
@@ -18,7 +18,7 @@ The A/B updates support can be activated by specifying next options in
your board configuration file::

CONFIG_ANDROID_AB=y
- CONFIG_CMD_AB_SELECT=y
+ CONFIG_CMD_BCB=y

The disk space on target device must be partitioned in a way so that each
partition which needs to be updated has two or more instances. The name of
@@ -26,8 +26,8 @@ each instance must be formed by adding suffixes: ``_a``, ``_b``, ``_c``, etc.
For example: ``boot_a``, ``boot_b``, ``system_a``, ``system_b``, ``vendor_a``,
``vendor_b``.

-As a result you can use ``ab_select`` command to ensure A/B boot process in your
-boot script. This command analyzes and processes A/B metadata stored on a
+As a result you can use ``bcb ab_select`` command to ensure A/B boot process in
+your boot script. This command analyzes and processes A/B metadata stored on a
special partition (e.g. ``misc``) and determines which slot should be used for
booting up.

@@ -42,15 +42,15 @@ Command usage

.. code-block:: none

- ab_select <slot_var_name> <interface> <dev[:part_number|#part_name]>
+ bcb ab_select <slot_var_name> <interface> <dev[:part_number|#part_name]>

for example::

- => ab_select slot_name mmc 1:4
+ => bcb ab_select slot_name mmc 1:4

or::

- => ab_select slot_name mmc 1#misc
+ => bcb ab_select slot_name mmc 1#misc

Result::

diff --git a/include/configs/khadas-vim3_android.h b/include/configs/khadas-vim3_android.h
index da6adf6c413add03413f40987959a24ad0d41e62..5468ac5878b34b82a70db84c209bab9f3a9dd79f 100644
--- a/include/configs/khadas-vim3_android.h
+++ b/include/configs/khadas-vim3_android.h
@@ -12,7 +12,7 @@
#define LOGO_UUID "43a3305d-150f-4cc9-bd3b-38fca8693846;"
#define ROOT_UUID "ddb8c3f6-d94d-4394-b633-3134139cc2e0;"

-#if defined(CONFIG_CMD_AB_SELECT)
+#if defined(CONFIG_CMD_BCB) && defined(CONFIG_ANDROID_AB)
#define PARTS_DEFAULT \
"uuid_disk=${uuid_gpt_disk};" \
"name=logo,start=512K,size=2M,uuid=" LOGO_UUID \
diff --git a/include/configs/khadas-vim3l_android.h b/include/configs/khadas-vim3l_android.h
index b1768e2d821176452254fb07f2e3747402b9b4fd..32821b942109feae5ade9f7fd02924bca34cf58b 100644
--- a/include/configs/khadas-vim3l_android.h
+++ b/include/configs/khadas-vim3l_android.h
@@ -12,7 +12,7 @@
#define LOGO_UUID "43a3305d-150f-4cc9-bd3b-38fca8693846;"
#define ROOT_UUID "ddb8c3f6-d94d-4394-b633-3134139cc2e0;"

-#if defined(CONFIG_CMD_AB_SELECT)
+#if defined(CONFIG_CMD_BCB) && defined(CONFIG_ANDROID_AB)
#define PARTS_DEFAULT \
"uuid_disk=${uuid_gpt_disk};" \
"name=logo,start=512K,size=2M,uuid=" LOGO_UUID \
diff --git a/include/configs/meson64_android.h b/include/configs/meson64_android.h
index c0e977abb01fb9efb7a462906a0073c84c800897..cc626dbf02418a49b367c8386797ce6ffc28c85b 100644
--- a/include/configs/meson64_android.h
+++ b/include/configs/meson64_android.h
@@ -47,13 +47,13 @@
#define AVB_VERIFY_CMD ""
#endif

-#if defined(CONFIG_CMD_AB_SELECT)
+#if defined(CONFIG_CMD_BCB) && defined(CONFIG_ANDROID_AB)
#define ANDROIDBOOT_GET_CURRENT_SLOT_CMD "get_current_slot=" \
"if part number mmc ${mmcdev} " CONTROL_PARTITION " control_part_number; " \
"then " \
"echo " CONTROL_PARTITION \
" partition number:${control_part_number};" \
- "ab_select current_slot mmc ${mmcdev}:${control_part_number};" \
+ "bcb ab_select current_slot mmc ${mmcdev}:${control_part_number};" \
"else " \
"echo " CONTROL_PARTITION " partition not found;" \
"fi;\0"
diff --git a/include/configs/ti_omap5_common.h b/include/configs/ti_omap5_common.h
index 26494ae980108ad84eb173a0deaa7b701a5309d4..26b6c1cd188c05371c6455cd6247f07a1773d885 100644
--- a/include/configs/ti_omap5_common.h
+++ b/include/configs/ti_omap5_common.h
@@ -93,13 +93,13 @@

#define CONTROL_PARTITION "misc"

-#if defined(CONFIG_CMD_AB_SELECT)
+#if defined(CONFIG_CMD_BCB) && defined(CONFIG_ANDROID_AB)
#define AB_SELECT_SLOT \
"if part number mmc 1 " CONTROL_PARTITION " control_part_number; " \
"then " \
"echo " CONTROL_PARTITION \
" partition number:${control_part_number};" \
- "ab_select slot_name mmc ${mmcdev}:${control_part_number};" \
+ "bcb ab_select slot_name mmc ${mmcdev}:${control_part_number};" \
"else " \
"echo " CONTROL_PARTITION " partition not found;" \
"exit;" \
diff --git a/test/py/tests/test_android/test_ab.py b/test/py/tests/test_android/test_ab.py
index c79cb07fda35dfeb608ac7345cd3f22744e2e491..0d7b7995a9fab6e3daad748721818b9e4cfac452 100644
--- a/test/py/tests/test_android/test_ab.py
+++ b/test/py/tests/test_android/test_ab.py
@@ -56,20 +56,20 @@ def ab_disk_image(u_boot_console):

@pytest.mark.boardspec('sandbox')
@pytest.mark.buildconfigspec('android_ab')
-@...('cmd_ab_select')
+@...('cmd_bcb')
@pytest.mark.requiredtool('sgdisk')
def test_ab(ab_disk_image, u_boot_console):
- """Test the 'ab_select' command."""
+ """Test the 'bcb ab_select' command."""

u_boot_console.run_command('host bind 0 ' + ab_disk_image.path)

- output = u_boot_console.run_command('ab_select slot_name host 0#misc')
+ output = u_boot_console.run_command('bcb ab_select slot_name host 0#misc')
assert 're-initializing A/B metadata' in output
assert 'Attempting slot a, tries remaining 7' in output
output = u_boot_console.run_command('printenv slot_name')
assert 'slot_name=a' in output

- output = u_boot_console.run_command('ab_select slot_name host 0:1')
+ output = u_boot_console.run_command('bcb ab_select slot_name host 0:1')
assert 'Attempting slot b, tries remaining 7' in output
output = u_boot_console.run_command('printenv slot_name')
assert 'slot_name=b' in output

--
2.43.0


Re: [PATCH v3 4/6] cmd: bcb: introduce 'ab_dump' command to print BCB block content

 

Hi Dmitry,

On jeu., oct. 10, 2024 at 13:20, Dmitry Rokosov <ddrokosov@...> wrote:

On Wed, Oct 09, 2024 at 03:13:57PM -0600, Simon Glass wrote:
Hi Dmitry,

On Wed, 9 Oct 2024 at 07:26, Dmitry Rokosov <ddrokosov@...> wrote:

Hello Simon,

On Tue, Oct 08, 2024 at 07:57:15PM -0600, Simon Glass wrote:
On Tue, 8 Oct 2024 at 14:18, Dmitry Rokosov <ddrokosov@...> wrote:

It's really helpful to have the ability to dump BCB block for debugging
A/B logic on the board supported this partition schema.

Command 'bcb ab_dump' prints all fields of bootloader_control struct
including slot_metadata for all presented slots.

Output example:
=====
board# bcb ab_dump ubi 0#misc
Read 512 bytes from volume misc to 000000000bf07580
Read 512 bytes from volume misc to 000000000bf42f40
Bootloader Control: [misc]
Active Slot: _a
Magic Number: 0x42414342
Version: 1
Number of Slots: 2
Recovery Tries Remaining: 0
CRC: 0x2c8b50bc (Valid)

Slot[0] Metadata:
- Priority: 15
- Tries Remaining: 0
- Successful Boot: 1
- Verity Corrupted: 0

Slot[1] Metadata:
- Priority: 14
- Tries Remaining: 7
- Successful Boot: 0
- Verity Corrupted: 0
====

Signed-off-by: Dmitry Rokosov <ddrokosov@...>
---
boot/android_ab.c | 68 ++++++++++++++++++++++++++++++++++++++++++++++++++++
cmd/bcb.c | 35 +++++++++++++++++++++++++++
include/android_ab.h | 10 ++++++++
3 files changed, 113 insertions(+)
Reviewed-by: Simon Glass <sjg@...>

Can you also update the test?
I apologize, but I didn't quite understand your point. Could you please
clarify? This patch series includes additional tests for the 'ab_dump'
subcommand. For more details, please refer to:

OK, thank you. Sometimes it is easier (for reviewers) if you update
the test in the same commit.
Should I resend the patch series with ab_dump implementation and tests
in the same commit?

I can prepare new version, if needed, no problem.
No need to resend a new version just for this, since it's already
been reviewed.

Keep the suggestion in mind for future series!


--
Thank you,
Dmitry


Re: [PATCH v3 0/6] android_ab: introduce bcb ab_dump command and provide several bcb fixes

 

Hi,

just test this series on Khadas vim3 board and it's working fine

bcb ab_dump mmc 2#misc
Bootloader Control:?????? [misc]
Active Slot:????????????? _a
Magic Number:???????????? 0x42414342
Version:????????????????? 1
Number of Slots:????????? 2
Recovery Tries Remaining: 0
CRC:????????????????????? 0xd438d1b9 (Valid)

Slot[0] Metadata:
??????? - Priority:???????? 15
??????? - Tries Remaining:? 6
??????? - Successful Boot:? 0
??????? - Verity Corrupted: 0

Slot[1] Metadata:
??????? - Priority:???????? 15
??????? - Tries Remaining:? 7
??????? - Successful Boot:? 0
??????? - Verity Corrupted: 0


Thanks for your patches.

Tested-by: Guillaume La Roque <glaroque@...>

Le 08/10/2024 ¨¤ 22:18, Dmitry Rokosov a ¨¦crit?:
The patch series include changes:
- move ab_select_slot() documentation to @ notation
- move ab_select command to bcb subcommands
- introduce the ab_dump command to print the content of the BCB
block; it's useful for debugging A/B logic on supported boards
- fix the slot suffix format in the ABC block to align with official
Android BCB specifications
- add a test for the ab_dump command to verify the accuracy of each
field within the ABC data displayed, it's also useful for testing
slot_suffix problem code paths

Changes v3 since v2 at [2]:
- return "Legend" block for bcb command
- additionally, verify the CONFIG_ANDROID_AB configuration alongside
CONFIG_CMD_BCB to ensure that the A/B scheme is used for the
designated board.

Changes v2 since v1 at [1]:
- move ab_select_slot() documentation to @ notation
- move ab_select command to bcb subcommands per Simon and Mattijs
suggestions
- redesign ab_dump as bcb subcommand
- use spaces instead of tabs in the ab_dump command output
- print hex values in the lowercase
- add RvB tags

Links:
[1]
[2]

Signed-off-by: Dmitry Rokosov <ddrokosov@...>
---
Dmitry Rokosov (6):
include/android_ab: move ab_select_slot() documentation to @ notation
treewide: bcb: move ab_select command to bcb subcommands
cmd: bcb: change strcmp() usage style in the do_bcb_ab_select()
cmd: bcb: introduce 'ab_dump' command to print BCB block content
common: android_ab: fix slot suffix for abc block
test/py: introduce test for ab_dump command

MAINTAINERS | 1 -
boot/android_ab.c | 116 ++++++++++++++++++++++++------
cmd/Kconfig | 15 +---
cmd/Makefile | 1 -
cmd/ab_select.c | 66 -----------------
cmd/bcb.c | 98 +++++++++++++++++++++++++
configs/am57xx_hs_evm_usb_defconfig | 1 -
configs/khadas-vim3_android_ab_defconfig | 1 -
configs/khadas-vim3l_android_ab_defconfig | 1 -
configs/sandbox64_defconfig | 4 +-
configs/sandbox_defconfig | 4 +-
doc/android/ab.rst | 12 ++--
include/android_ab.h | 17 ++++-
include/configs/khadas-vim3_android.h | 2 +-
include/configs/khadas-vim3l_android.h | 2 +-
include/configs/meson64_android.h | 4 +-
include/configs/ti_omap5_common.h | 4 +-
test/py/tests/test_android/test_ab.py | 31 ++++++--
18 files changed, 252 insertions(+), 128 deletions(-)
---
base-commit: fbe16bc28014dc1ed957f5fee7e53d6eee781aa9
change-id: 20241008-android_ab_master-d86d71c839ae

Best regards,


[PATCH 2/2] power/domain: meson-ee-pwrc: make sure to not enable a domain twice

 

The upstream Device Tree for GXBB/GXL/G12A was updated with VPU domain
shared between the VPU and HDMI node, causing a double enable.

Simply store the enable state and avoid enabling twice, fixing
HDMI output on all platforms.

Signed-off-by: Neil Armstrong <neil.armstrong@...>
---
drivers/power/domain/meson-ee-pwrc.c | 15 +++++++++++++--
1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/drivers/power/domain/meson-ee-pwrc.c b/drivers/power/domain/meson-ee-pwrc.c
index 20e9f32b381..4d9f3bba644 100644
--- a/drivers/power/domain/meson-ee-pwrc.c
+++ b/drivers/power/domain/meson-ee-pwrc.c
@@ -60,6 +60,7 @@ struct meson_ee_pwrc_domain_desc {
unsigned int mem_pd_count;
struct meson_ee_pwrc_mem_domain *mem_pd;
bool (*get_power)(struct power_domain *power_domain);
+ bool enabled;
};

struct meson_ee_pwrc_domain_data {
@@ -306,6 +307,8 @@ static int meson_ee_pwrc_off(struct power_domain *power_domain)
clk_disable_bulk(&priv->clks);
}

+ pwrc_domain->enabled = false;
+
return 0;
}

@@ -317,6 +320,9 @@ static int meson_ee_pwrc_on(struct power_domain *power_domain)

pwrc_domain = &priv->data->domains[power_domain->id];

+ if (pwrc_domain->enabled)
+ return 0;
+
if (pwrc_domain->top_pd)
regmap_update_bits(priv->regmap_ao,
pwrc_domain->top_pd->sleep_reg,
@@ -347,8 +353,13 @@ static int meson_ee_pwrc_on(struct power_domain *power_domain)
return ret;
}

- if (pwrc_domain->clk_names_count)
- return clk_enable_bulk(&priv->clks);
+ if (pwrc_domain->clk_names_count) {
+ ret = clk_enable_bulk(&priv->clks);
+ if (ret)
+ return ret;
+ }
+
+ pwrc_domain->enabled = true;

return 0;
}

--
2.34.1


[PATCH 1/2] clk: meson: gxbb: add HDMI clocks

 

Align with g12a driver to handle the CLKID_HDMI, CLKID_HDMI_SEL
and CLKID_HDMI_DIV clocks since they were added to the upstream
GXBB/GXL Devicetree on v6.11 with [1]

[1]

Signed-off-by: Neil Armstrong <neil.armstrong@...>
---
drivers/clk/meson/gxbb.c | 50 +++++++++++++++++++++++++++++++++++++++++++++++-
1 file changed, 49 insertions(+), 1 deletion(-)

diff --git a/drivers/clk/meson/gxbb.c b/drivers/clk/meson/gxbb.c
index 72ad4fd0e85..51f124869c9 100644
--- a/drivers/clk/meson/gxbb.c
+++ b/drivers/clk/meson/gxbb.c
@@ -66,6 +66,8 @@
#define CLKID_VDEC_HEVC_SEL 154
#define CLKID_VDEC_HEVC_DIV 155

+#define CLKID_XTAL 0x10000000
+
#define XTAL_RATE 24000000

struct meson_clk {
@@ -192,6 +194,7 @@ static struct meson_gate gates[] = {
MESON_GATE(CLKID_VAPB_0, HHI_VAPBCLK_CNTL, 8),
MESON_GATE(CLKID_VAPB_1, HHI_VAPBCLK_CNTL, 24),
MESON_GATE(CLKID_VAPB, HHI_VAPBCLK_CNTL, 30),
+ MESON_GATE(CLKID_HDMI, HHI_HDMI_CLK_CNTL, 8),
};

static int meson_set_gate_by_id(struct clk *clk, unsigned long id, bool on)
@@ -267,6 +270,12 @@ static struct parm meson_vapb_1_div_parm = {

int meson_vapb_1_div_parent = CLKID_VAPB_1_SEL;

+static struct parm meson_hdmi_div_parm = {
+ HHI_HDMI_CLK_CNTL, 0, 7,
+};
+
+int meson_hdmi_div_parent = CLKID_HDMI_SEL;
+
static ulong meson_div_get_rate(struct clk *clk, unsigned long id)
{
struct meson_clk *priv = dev_get_priv(clk->dev);
@@ -292,6 +301,10 @@ static ulong meson_div_get_rate(struct clk *clk, unsigned long id)
parm = &meson_vapb_1_div_parm;
parent = meson_vapb_1_div_parent;
break;
+ case CLKID_HDMI_DIV:
+ parm = &meson_hdmi_div_parm;
+ parent = meson_hdmi_div_parent;
+ break;
default:
return -ENOENT;
}
@@ -347,6 +360,10 @@ static ulong meson_div_set_rate(struct clk *clk, unsigned long id, ulong rate,
parm = &meson_vapb_1_div_parm;
parent = meson_vapb_1_div_parent;
break;
+ case CLKID_HDMI_DIV:
+ parm = &meson_hdmi_div_parm;
+ parent = meson_hdmi_div_parent;
+ break;
default:
return -ENOENT;
}
@@ -443,6 +460,17 @@ static int meson_vapb_0_1_mux_parents[] = {
CLKID_FCLK_DIV7,
};

+static struct parm meson_hdmi_mux_parm = {
+ HHI_HDMI_CLK_CNTL, 9, 2,
+};
+
+static int meson_hdmi_mux_parents[] = {
+ CLKID_XTAL,
+ CLKID_FCLK_DIV4,
+ CLKID_FCLK_DIV3,
+ CLKID_FCLK_DIV5,
+};
+
static ulong meson_mux_get_parent(struct clk *clk, unsigned long id)
{
struct meson_clk *priv = dev_get_priv(clk->dev);
@@ -475,6 +503,10 @@ static ulong meson_mux_get_parent(struct clk *clk, unsigned long id)
parm = &meson_vapb_1_mux_parm;
parents = meson_vapb_0_1_mux_parents;
break;
+ case CLKID_HDMI_SEL:
+ parm = &meson_hdmi_mux_parm;
+ parents = meson_hdmi_mux_parents;
+ break;
default:
return -ENOENT;
}
@@ -532,6 +564,10 @@ static ulong meson_mux_set_parent(struct clk *clk, unsigned long id,
parm = &meson_vapb_1_mux_parm;
parents = meson_vapb_0_1_mux_parents;
break;
+ case CLKID_HDMI_SEL:
+ parm = &meson_hdmi_mux_parm;
+ parents = meson_hdmi_mux_parents;
+ break;
default:
/* Not a mux */
return -ENOENT;
@@ -572,7 +608,7 @@ static unsigned long meson_clk81_get_rate(struct clk *clk)
unsigned long parent_rate;
uint reg;
int parents[] = {
- -1,
+ CLKID_XTAL,
-1,
CLKID_FCLK_DIV7,
CLKID_MPLL1,
@@ -727,6 +763,9 @@ static ulong meson_clk_get_rate_by_id(struct clk *clk, unsigned long id)
ulong rate;

switch (id) {
+ case CLKID_XTAL:
+ rate = XTAL_RATE;
+ break;
case CLKID_FIXED_PLL:
case CLKID_SYS_PLL:
rate = meson_pll_get_rate(clk, id);
@@ -769,10 +808,14 @@ static ulong meson_clk_get_rate_by_id(struct clk *clk, unsigned long id)
case CLKID_VAPB_1:
rate = meson_div_get_rate(clk, CLKID_VAPB_1_DIV);
break;
+ case CLKID_HDMI:
+ rate = meson_div_get_rate(clk, CLKID_HDMI_DIV);
+ break;
case CLKID_VPU_0_DIV:
case CLKID_VPU_1_DIV:
case CLKID_VAPB_0_DIV:
case CLKID_VAPB_1_DIV:
+ case CLKID_HDMI_DIV:
rate = meson_div_get_rate(clk, id);
break;
case CLKID_VPU:
@@ -781,6 +824,7 @@ static ulong meson_clk_get_rate_by_id(struct clk *clk, unsigned long id)
case CLKID_VAPB_SEL:
case CLKID_VAPB_0_SEL:
case CLKID_VAPB_1_SEL:
+ case CLKID_HDMI_SEL:
rate = meson_mux_get_rate(clk, id);
break;
default:
@@ -851,7 +895,11 @@ static ulong meson_clk_set_rate_by_id(struct clk *clk, unsigned long id,
case CLKID_VPU_1_DIV:
case CLKID_VAPB_0_DIV:
case CLKID_VAPB_1_DIV:
+ case CLKID_HDMI_DIV:
return meson_div_set_rate(clk, id, rate, current_rate);
+ case CLKID_HDMI:
+ return meson_clk_set_rate_by_id(clk, CLKID_HDMI_DIV,
+ rate, current_rate);
default:
return -ENOENT;
}

--
2.34.1


[PATCH 0/2] ARM: mach-meson: fix HDMI since DT update to v6.11

 

The DT was updated with unhandled clocks and a shared
power domain, causing a probe failure and a green output.

Add the missing clocks and avoid enabling a power domain twice.

Signed-off-by: Neil Armstrong <neil.armstrong@...>
---
Neil Armstrong (2):
clk: meson: gxbb: add HDMI clocks
power/domain: meson-ee-pwrc: make sure to not enable a domain twice

drivers/clk/meson/gxbb.c | 50 +++++++++++++++++++++++++++++++++++-
drivers/power/domain/meson-ee-pwrc.c | 15 +++++++++--
2 files changed, 62 insertions(+), 3 deletions(-)
---
base-commit: 28dc47038edc4e93f32d75a357131bcf01a18d85
change-id: 20241009-u-boot-topic-fix-hdmi-bb39cd876446

Best regards,
--
Neil Armstrong <neil.armstrong@...>


[PATCH v2] video: meson: dw-hdmi: do not fail probe if HDMI regulator is already enabled

 

If the regulator is already enabled, this happens if the regulator
is set in regulator-always-on, regulator_set_enable() return -EALREADY.

Ignore the -EALREADY return since it's not an error.

Suggested-by: Jonas Karlman <jonas@...>
Signed-off-by: Neil Armstrong <neil.armstrong@...>
---
Changes in v2:
- Switch to regulator_set_enable_if_allowed thanks to Jonas's suggestion
- Link to v1:
---
drivers/video/meson/meson_dw_hdmi.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/video/meson/meson_dw_hdmi.c b/drivers/video/meson/meson_dw_hdmi.c
index 587df7beb9b..1631dc38416 100644
--- a/drivers/video/meson/meson_dw_hdmi.c
+++ b/drivers/video/meson/meson_dw_hdmi.c
@@ -418,8 +418,8 @@ static int meson_dw_hdmi_probe(struct udevice *dev)
}

if (!ret) {
- ret = regulator_set_enable(supply, true);
- if (ret)
+ ret = regulator_set_enable_if_allowed(supply, true);
+ if (ret && ret != -ENOSYS)
return ret;
}
#endif

---
base-commit: 28dc47038edc4e93f32d75a357131bcf01a18d85
change-id: 20241008-u-boot-video-fix-hdmi-supply-already-on-e6a9af27b1eb

Best regards,
--
Neil Armstrong <neil.armstrong@...>


[PATCH] dts: meson-g12-common-u-boot: do not disable canvas

 

We were disabling canvas, which causes meson vpu probe failure,
just stop and leave canvas alone.

Fixes: ce9fa7bffc5 ("ARM: dts: meson-g12a: add U-Boot specific DT for graphics")
Signed-off-by: Neil Armstrong <neil.armstrong@...>
---
arch/arm/dts/meson-g12-common-u-boot.dtsi | 4 ----
1 file changed, 4 deletions(-)

diff --git a/arch/arm/dts/meson-g12-common-u-boot.dtsi b/arch/arm/dts/meson-g12-common-u-boot.dtsi
index 8070b62af5b..6629f3256a8 100644
--- a/arch/arm/dts/meson-g12-common-u-boot.dtsi
+++ b/arch/arm/dts/meson-g12-common-u-boot.dtsi
@@ -17,10 +17,6 @@
};
};

-&canvas {
- status = "disabled";
-};
-
&vpu {
reg = <0x0 0xff900000 0x0 0x100000>,
<0x0 0xff63c000 0x0 0x1000>,

---
base-commit: 28dc47038edc4e93f32d75a357131bcf01a18d85
change-id: 20241008-u-boot-topic-g12-do-not-disable-canvas-ece09f18ebaf

Best regards,
--
Neil Armstrong <neil.armstrong@...>


Re: [PATCH] video: meson: dw-hdmi: do not fail probe if HDMI regulator is already enabled

 

On 08/10/2024 16:36, Jonas Karlman wrote:
Hi Neil,
On 2024-10-08 14:58, Neil Armstrong wrote:
If the regulator is already enabled, this happens if the regulator
is set in regulator-always-on, regulator_set_enable() return -EALREADY.

Ignore the -EALREADY return since it's not an error.

Signed-off-by: Neil Armstrong <neil.armstrong@...>
---
drivers/video/meson/meson_dw_hdmi.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/video/meson/meson_dw_hdmi.c b/drivers/video/meson/meson_dw_hdmi.c
index 587df7beb9b..ee219ce6ec4 100644
--- a/drivers/video/meson/meson_dw_hdmi.c
+++ b/drivers/video/meson/meson_dw_hdmi.c
@@ -419,7 +419,7 @@ static int meson_dw_hdmi_probe(struct udevice *dev)
if (!ret) {
ret = regulator_set_enable(supply, true);
- if (ret)
+ if (ret && ret != -EALREADY)
You could possible relax this further using something like:
ret = regulator_set_enable_if_allowed(supply, true);
if (ret && ret != -ENOSYS)
That way you only reach the error state when there is an error with
supply, for other states e.g. when supply is not found, DM_REGULATOR=n
or the regulator is already enabled will be treated as success (ret=0).
Nice, thanks for the suggestion :-)

Neil

Regards,
Jonas

return ret;
}
#endif

---
base-commit: 28dc47038edc4e93f32d75a357131bcf01a18d85
change-id: 20241008-u-boot-video-fix-hdmi-supply-already-on-e6a9af27b1eb

Best regards,


[PATCH] video: meson: dw-hdmi: do not fail probe if HDMI regulator is already enabled

 

If the regulator is already enabled, this happens if the regulator
is set in regulator-always-on, regulator_set_enable() return -EALREADY.

Ignore the -EALREADY return since it's not an error.

Signed-off-by: Neil Armstrong <neil.armstrong@...>
---
drivers/video/meson/meson_dw_hdmi.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/video/meson/meson_dw_hdmi.c b/drivers/video/meson/meson_dw_hdmi.c
index 587df7beb9b..ee219ce6ec4 100644
--- a/drivers/video/meson/meson_dw_hdmi.c
+++ b/drivers/video/meson/meson_dw_hdmi.c
@@ -419,7 +419,7 @@ static int meson_dw_hdmi_probe(struct udevice *dev)

if (!ret) {
ret = regulator_set_enable(supply, true);
- if (ret)
+ if (ret && ret != -EALREADY)
return ret;
}
#endif

---
base-commit: 28dc47038edc4e93f32d75a357131bcf01a18d85
change-id: 20241008-u-boot-video-fix-hdmi-supply-already-on-e6a9af27b1eb

Best regards,
--
Neil Armstrong <neil.armstrong@...>


Re: [PATCH v3 1/4] power: regulator: Trigger probe of regulators which are always-on or boot-on

Tom Rini
 

On Fri, 27 Sep 2024 01:14:12 +0200, Marek Vasut wrote:

In case a regulator DT node contains regulator-always-on or regulator-boot-on
property, make sure the regulator gets correctly configured by U-Boot on start
up. Unconditionally probe such regulator drivers. This is a preparatory patch
for introduction of .regulator_post_probe() which would trigger the regulator
configuration.

Parsing of regulator-always-on and regulator-boot-on DT property has been
moved to regulator_post_bind() as the information is required early, the
rest of the DT parsing has been kept in regulator_pre_probe() to avoid
slowing down the boot process.

[...]
Applied to u-boot/next, thanks!

--
Tom


Re: [PATCH 00/26] Support display (and even more) on the BSH SMM S2/PRO boards

Dario Binacchi
 

Hi Miquel,

On Mon, Sep 30, 2024 at 11:43?AM Miquel Raynal
<miquel.raynal@...> wrote:

Hi Dario,

dario.binacchi@... wrote on Fri, 13 Sep 2024 11:55:42
+0200:

This series was created out of the need to supportsimple-framebuffer for
BSH boards SMM_S2 and SMM_S2PRO. To achieve this goal, it was necessary
to develop additional code and/or drivers for all the required components
(i. e. clock, power domain, video, etc.). This series has a Linux
counterpart that will also be submitted upstream as soon as possible.
Furthermore, given the overlap in topics with the recent series [1], we
are open to collaborate on the common parts to ensure proper development.

[1]
I received a bit of feedback on this U-Boot series, I can take the
feedback into account and send a v2. Then, if you are still okay, you
can stack your patches on top of mine and do the required adaptations
(on both sides).
Sure, go ahead with version 2.

Thanks and regards,
Dario

Thanks,
²Ñ¾±±ç³Ü¨¨±ô


--

Dario Binacchi

Senior Embedded Linux Developer

dario.binacchi@...

__________________________________


Amarula Solutions SRL

Via Le Canevare 30, 31100 Treviso, Veneto, IT

T. +39 042 243 5310
info@...

www.amarulasolutions.com


Re: [PATCH 0/2] board: libre-computer: Add support for Libre Computer aml-a311d-cc & aml-s905d3-cc boards

 

Hi,

On Fri, 20 Sep 2024 15:33:32 +0200, Neil Armstrong wrote:
Add support for the Libre Computer aml-a311d-cc "Alta" & aml-s905d3-cc
"Solitude" boards:



The Alta & Solitude boards have a Credit Card form factor, similar to the
the previous "Le Potato" card, but with the Amlogic A311D or S903D3 SoCS,
MIPI DSI and CSI connectors. PoE header and a single USB2 Type-C
connector replacing the microUSB one for power and USB 2.0.

[...]
Thanks, Applied to (u-boot-amlogic-next)

[1/2] ARM: meson: add support for Libre Computer aml-a311d-cc

[2/2] ARM: meson: add support for Libre Computer aml-s905d3-cc


--
Neil


Re: [PATCH v2 0/2] ARM: meson: libretech-ac: add support for EFI Capsules Update

 

Hi,

On Tue, 17 Sep 2024 14:34:44 +0200, Neil Armstrong wrote:
The necessary changes were made in U-Boot to easily support
EFI Capsules Update and be compliant with Arm SystemReady IR.

Let's add support for the libretech-ac/AML-S805X-CC since
it's an easy well-supported target having a dedicated SPI
Flash to store U-Boot.

[...]
Thanks, Applied to (u-boot-amlogic-next)

[1/2] board: libretech-ac: move board support into dedicated directory

[2/2] board: libre-computer: aml-s805x-cc: Enable capsule updates


--
Neil


Re: [PATCH 00/26] Support display (and even more) on the BSH SMM S2/PRO boards

Miquel Raynal
 

Hi Dario,

dario.binacchi@... wrote on Fri, 13 Sep 2024 11:55:42
+0200:

This series was created out of the need to supportsimple-framebuffer for
BSH boards SMM_S2 and SMM_S2PRO. To achieve this goal, it was necessary
to develop additional code and/or drivers for all the required components
(i. e. clock, power domain, video, etc.). This series has a Linux
counterpart that will also be submitted upstream as soon as possible.
Furthermore, given the overlap in topics with the recent series [1], we
are open to collaborate on the common parts to ensure proper development.

[1]
I received a bit of feedback on this U-Boot series, I can take the
feedback into account and send a v2. Then, if you are still okay, you
can stack your patches on top of mine and do the required adaptations
(on both sides).

Thanks,
²Ñ¾±±ç³Ü¨¨±ô


[PATCH v3 4/4] power: regulator: Drop regulators_enable_boot_on/off()

Marek Vasut
 

Both regulators_enable_boot_on/off() are unused and superseded by
regulator uclass regulator_post_probe(). Remove both functions.

Signed-off-by: Marek Vasut <marex@...>
---
Cc: Ben Wolsieffer <benwolsieffer@...>
Cc: Caleb Connolly <caleb.connolly@...>
Cc: Chris Morgan <macromorgan@...>
Cc: Dragan Simic <dsimic@...>
Cc: Eugen Hristev <eugen.hristev@...>
Cc: Francesco Dolcini <francesco.dolcini@...>
Cc: Heinrich Schuchardt <xypron.glpk@...>
Cc: Jaehoon Chung <jh80.chung@...>
Cc: Jagan Teki <jagan@...>
Cc: Jonas Karlman <jonas@...>
Cc: Kever Yang <kever.yang@...>
Cc: Matteo Lisi <matteo.lisi@...>
Cc: Mattijs Korpershoek <mkorpershoek@...>
Cc: Max Krummenacher <max.krummenacher@...>
Cc: Neil Armstrong <neil.armstrong@...>
Cc: Patrice Chotard <patrice.chotard@...>
Cc: Patrick Delaunay <patrick.delaunay@...>
Cc: Philipp Tomsich <philipp.tomsich@...>
Cc: Quentin Schulz <quentin.schulz@...>
Cc: Sam Day <me@...>
Cc: Simon Glass <sjg@...>
Cc: Sumit Garg <sumit.garg@...>
Cc: Svyatoslav Ryhel <clamor95@...>
Cc: Thierry Reding <treding@...>
Cc: Tom Rini <trini@...>
Cc: Volodymyr Babchuk <Volodymyr_Babchuk@...>
Cc: [email protected]
Cc: [email protected]
Cc: u-boot@...
Cc: u-boot@...
Cc: uboot-stm32@...
---
V2: Rebase on current u-boot/next
V3: No change
---
arch/arm/mach-rockchip/board.c | 8 ------
arch/arm/mach-snapdragon/board.c | 1 -
arch/arm/mach-tegra/board2.c | 3 ---
board/Marvell/octeontx2_cn913x/board.c | 5 ----
.../amlogic/odroid-go-ultra/odroid-go-ultra.c | 2 --
board/dhelectronics/dh_imx6/dh_imx6.c | 2 --
.../dh_imx8mp/imx8mp_dhcom_pdk2.c | 2 --
board/dhelectronics/dh_stm32mp1/board.c | 2 --
board/engicam/stm32mp1/stm32mp1.c | 3 ---
board/google/veyron/veyron.c | 4 ---
board/samsung/common/exynos5-dt.c | 4 ---
board/st/stm32mp1/stm32mp1.c | 2 --
drivers/power/regulator/regulator-uclass.c | 10 --------
include/power/regulator.h | 25 -------------------
14 files changed, 73 deletions(-)

diff --git a/arch/arm/mach-rockchip/board.c b/arch/arm/mach-rockchip/boar=
d.c
index 0fdf9365b41..3fadf7e4122 100644
--- a/arch/arm/mach-rockchip/board.c
+++ b/arch/arm/mach-rockchip/board.c
@@ -202,14 +202,6 @@ int board_late_init(void)
=20
int board_init(void)
{
- int ret;
-
-#ifdef CONFIG_DM_REGULATOR
- ret =3D regulators_enable_boot_on(false);
- if (ret)
- debug("%s: Cannot enable boot on regulator\n", __func__);
-#endif
-
return 0;
}
=20
diff --git a/arch/arm/mach-snapdragon/board.c b/arch/arm/mach-snapdragon/=
board.c
index 0af297470a6..2ab2ceb5138 100644
--- a/arch/arm/mach-snapdragon/board.c
+++ b/arch/arm/mach-snapdragon/board.c
@@ -237,7 +237,6 @@ void __weak qcom_board_init(void)
=20
int board_init(void)
{
- regulators_enable_boot_on(false);
show_psci_version();
qcom_of_fixup_nodes();
qcom_board_init();
diff --git a/arch/arm/mach-tegra/board2.c b/arch/arm/mach-tegra/board2.c
index 7971e3b68d5..5c5838629b2 100644
--- a/arch/arm/mach-tegra/board2.c
+++ b/arch/arm/mach-tegra/board2.c
@@ -187,9 +187,6 @@ int board_init(void)
warmboot_prepare_code(TEGRA_LP0_ADDR, TEGRA_LP0_SIZE);
#endif
=20
- /* Set up boot-on regulators */
- regulators_enable_boot_on(_DEBUG);
-
return nvidia_board_init();
}
=20
diff --git a/board/Marvell/octeontx2_cn913x/board.c b/board/Marvell/octeo=
ntx2_cn913x/board.c
index 3d20cfb2fab..3ffe15d42b8 100644
--- a/board/Marvell/octeontx2_cn913x/board.c
+++ b/board/Marvell/octeontx2_cn913x/board.c
@@ -23,11 +23,6 @@ int board_early_init_f(void)
=20
int board_early_init_r(void)
{
- if (CONFIG_IS_ENABLED(DM_REGULATOR)) {
- /* Check if any existing regulator should be turned down */
- regulators_enable_boot_off(false);
- }
-
return 0;
}
=20
diff --git a/board/amlogic/odroid-go-ultra/odroid-go-ultra.c b/board/amlo=
gic/odroid-go-ultra/odroid-go-ultra.c
index 8f3f2045d74..f9412071737 100644
--- a/board/amlogic/odroid-go-ultra/odroid-go-ultra.c
+++ b/board/amlogic/odroid-go-ultra/odroid-go-ultra.c
@@ -16,7 +16,5 @@ int mmc_get_env_dev(void)
=20
int board_init(void)
{
- regulators_enable_boot_on(_DEBUG);
-
return 0;
}
diff --git a/board/dhelectronics/dh_imx6/dh_imx6.c b/board/dhelectronics/=
dh_imx6/dh_imx6.c
index ada44e01424..f2b14bf701a 100644
--- a/board/dhelectronics/dh_imx6/dh_imx6.c
+++ b/board/dhelectronics/dh_imx6/dh_imx6.c
@@ -128,8 +128,6 @@ int board_init(void)
=20
setup_fec_clock();
=20
- regulators_enable_boot_on(_DEBUG);
-
return 0;
}
=20
diff --git a/board/dhelectronics/dh_imx8mp/imx8mp_dhcom_pdk2.c b/board/dh=
electronics/dh_imx8mp/imx8mp_dhcom_pdk2.c
index a389ab3c2d9..78aae412350 100644
--- a/board/dhelectronics/dh_imx8mp/imx8mp_dhcom_pdk2.c
+++ b/board/dhelectronics/dh_imx8mp/imx8mp_dhcom_pdk2.c
@@ -112,8 +112,6 @@ int dh_setup_mac_address(void)
=20
int board_init(void)
{
- regulators_enable_boot_on(_DEBUG);
-
return 0;
}
=20
diff --git a/board/dhelectronics/dh_stm32mp1/board.c b/board/dhelectronic=
s/dh_stm32mp1/board.c
index 4f4f537fee5..24c5f37c12f 100644
--- a/board/dhelectronics/dh_stm32mp1/board.c
+++ b/board/dhelectronics/dh_stm32mp1/board.c
@@ -622,8 +622,6 @@ static void board_init_regulator_av96(void)
static void board_init_regulator(void)
{
board_init_regulator_av96();
-
- regulators_enable_boot_on(_DEBUG);
}
#else
static inline int board_get_regulator_buck3_nvm_uv_av96(int *uv)
diff --git a/board/engicam/stm32mp1/stm32mp1.c b/board/engicam/stm32mp1/s=
tm32mp1.c
index bc2af66d8e9..56557d56429 100644
--- a/board/engicam/stm32mp1/stm32mp1.c
+++ b/board/engicam/stm32mp1/stm32mp1.c
@@ -37,9 +37,6 @@ int checkboard(void)
/* board dependent setup after realloc */
int board_init(void)
{
- if (IS_ENABLED(CONFIG_DM_REGULATOR))
- regulators_enable_boot_on(_DEBUG);
-
return 0;
}
=20
diff --git a/board/google/veyron/veyron.c b/board/google/veyron/veyron.c
index bd8ce633772..674f19ba03c 100644
--- a/board/google/veyron/veyron.c
+++ b/board/google/veyron/veyron.c
@@ -57,10 +57,6 @@ static int veyron_init(void)
if (ret)
return log_msg_ret("s33", ret);
=20
- ret =3D regulators_enable_boot_on(false);
- if (ret)
- return log_msg_ret("boo", ret);
-
return 0;
}
#endif
diff --git a/board/samsung/common/exynos5-dt.c b/board/samsung/common/exy=
nos5-dt.c
index 56862bcb34d..68edd1ec282 100644
--- a/board/samsung/common/exynos5-dt.c
+++ b/board/samsung/common/exynos5-dt.c
@@ -88,10 +88,6 @@ int exynos_power_init(void)
if (ret =3D=3D -ENODEV)
return 0;
=20
- ret =3D regulators_enable_boot_on(false);
- if (ret)
- return ret;
-
ret =3D exynos_set_regulator("vdd_mif", 1100000);
if (ret)
return ret;
diff --git a/board/st/stm32mp1/stm32mp1.c b/board/st/stm32mp1/stm32mp1.c
index 97532a8156f..d5e5e776d2a 100644
--- a/board/st/stm32mp1/stm32mp1.c
+++ b/board/st/stm32mp1/stm32mp1.c
@@ -665,8 +665,6 @@ int board_init(void)
if (board_is_stm32mp15x_dk2())
board_stm32mp15x_dk2_init();
=20
- regulators_enable_boot_on(_DEBUG);
-
/*
* sysconf initialisation done only when U-Boot is running in secure
* done in TF-A for TFABOOT.
diff --git a/drivers/power/regulator/regulator-uclass.c b/drivers/power/r=
egulator/regulator-uclass.c
index 4e83819ff73..decd0802c84 100644
--- a/drivers/power/regulator/regulator-uclass.c
+++ b/drivers/power/regulator/regulator-uclass.c
@@ -526,16 +526,6 @@ static int regulator_post_probe(struct udevice *dev)
return 0;
}
=20
-int regulators_enable_boot_on(bool verbose)
-{
- return 0;
-}
-
-int regulators_enable_boot_off(bool verbose)
-{
- return 0;
-}
-
UCLASS_DRIVER(regulator) =3D {
.id =3D UCLASS_REGULATOR,
.name =3D "regulator",
diff --git a/include/power/regulator.h b/include/power/regulator.h
index 5363483d02a..8a914dfc74f 100644
--- a/include/power/regulator.h
+++ b/include/power/regulator.h
@@ -414,26 +414,6 @@ int regulator_get_mode(struct udevice *dev);
*/
int regulator_set_mode(struct udevice *dev, int mode_id);
=20
-/**
- * regulators_enable_boot_on() - enable regulators needed for boot
- *
- * This enables all regulators which are marked to be on at boot time. T=
his
- * only works for regulators which don't have a range for voltage/curren=
t,
- * since in that case it is not possible to know which value to use.
- *
- * This effectively calls regulator_autoset() for every regulator.
- */
-int regulators_enable_boot_on(bool verbose);
-
-/**
- * regulators_enable_boot_off() - disable regulators needed for boot
- *
- * This disables all regulators which are marked to be off at boot time.
- *
- * This effectively does nothing.
- */
-int regulators_enable_boot_off(bool verbose);
-
/**
* regulator_autoset: setup the voltage/current on a regulator
*
@@ -617,11 +597,6 @@ static inline int regulator_set_mode(struct udevice =
*dev, int mode_id)
return -ENOSYS;
}
=20
-static inline int regulators_enable_boot_on(bool verbose)
-{
- return -ENOSYS;
-}
-
static inline int regulator_autoset(struct udevice *dev)
{
return -ENOSYS;
--=20
2.45.2