Merge tag 'u-boot-imx-master-20241025a' of https://gitlab.denx.de/u-boot/custodians/u-boot-imx
CI: https://source.denx.de/u-boot/custodians/u-boot-imx/-/pipelines/22989
- Remove unneeded USB board code and fix reset on mx6ul_14x14_evk.
- Update fastboot buffer size/address for verdin-imx8m{m|p}.
- Fix imxrt1050-evk boot and convert it to standard boot.
- Fix imx8qxp-mek and imx8qm-mek boot.
- Add support for the i.MX93 9X9 QSB board.
- Make livetree API to work on i.MX.
- Set sane default value for i.MX8M SPL_LOAD_FIT_ADDRESS.
- Deduplicate DH i.MX8MP/i.MX6 DHSOM defconfigs.
- Select default TEXT_BASE for i.MX6/i.MX7.
- Several updates for DH i.MX8MP DRC02.
diff --git a/.mailmap b/.mailmap
index 4d48349..005e965 100644
--- a/.mailmap
+++ b/.mailmap
@@ -89,6 +89,7 @@
Nicolas Saenz Julienne <nsaenz@kernel.org> <nsaenzjulienne@suse.de>
This contributor prefers not to receive mails <noreply@example.com> <pali@kernel.org>
This contributor prefers not to receive mails <noreply@example.com> <pali.rohar@gmail.com>
+Padmarao Begari <padmarao.begari@amd.com> <padmarao.begari@microchip.com>
Patrice Chotard <patrice.chotard@foss.st.com> <patrice.chotard@st.com>
Patrick Delaunay <patrick.delaunay@foss.st.com> <patrick.delaunay@st.com>
Paul Burton <paul.burton@mips.com> <paul.burton@imgtec.com>
diff --git a/MAINTAINERS b/MAINTAINERS
index 240cf86..8e375e7 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -65,7 +65,6 @@
S: Maintained
T: git https://source.denx.de/u-boot/custodians/u-boot-dfu.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/arch/arm/dts/Makefile b/arch/arm/dts/Makefile
index 8b9ced1..03ed3cb 100644
--- a/arch/arm/dts/Makefile
+++ b/arch/arm/dts/Makefile
@@ -327,6 +327,7 @@
zynqmp-sc-vpk180-revA-dtbs := zynqmp-sc-revB.dtb zynqmp-sc-vpk180-revA.dtbo
zynqmp-sc-vpk180-revB-dtbs := zynqmp-sc-revB.dtb zynqmp-sc-vpk180-revB.dtbo
zynqmp-sc-vn-p-b2197-00-revA-dtbs := zynqmp-sc-revB.dtb zynqmp-sc-vn-p-b2197-00-revA.dtbo
+zynqmp-sc-vm-p-b1369-00-revA-dtbs := zynqmp-sc-revB.dtb zynqmp-sc-vm-p-m1369-00-revA.dtbo
dtb-$(CONFIG_ARCH_ZYNQMP) += zynqmp-sc-vek280-revA.dtb
dtb-$(CONFIG_ARCH_ZYNQMP) += zynqmp-sc-vek280-revB.dtb
@@ -335,6 +336,7 @@
dtb-$(CONFIG_ARCH_ZYNQMP) += zynqmp-sc-vpk180-revA.dtb
dtb-$(CONFIG_ARCH_ZYNQMP) += zynqmp-sc-vpk180-revB.dtb
dtb-$(CONFIG_ARCH_ZYNQMP) += zynqmp-sc-vn-p-b2197-00-revA.dtb
+dtb-$(CONFIG_ARCH_ZYNQMP) += zynqmp-sc-vm-p-b1369-00-revA.dtb
zynqmp-sm-k26-revA-sck-kv-g-revA-dtbs := zynqmp-sm-k26-revA.dtb zynqmp-sck-kv-g-revA.dtbo
zynqmp-sm-k26-revA-sck-kv-g-revB-dtbs := zynqmp-sm-k26-revA.dtb zynqmp-sck-kv-g-revB.dtbo
diff --git a/arch/arm/dts/versal-mini-emmc0.dts b/arch/arm/dts/versal-mini-emmc0.dts
index b98ed16..179060c 100644
--- a/arch/arm/dts/versal-mini-emmc0.dts
+++ b/arch/arm/dts/versal-mini-emmc0.dts
@@ -40,6 +40,9 @@
status = "okay";
non-removable;
disable-wp;
+ no-sd;
+ no-sdio;
+ cap-mmc-hw-reset;
bus-width = <8>;
reg = <0x0 0xf1040000 0x0 0x10000>;
clock-names = "clk_xin", "clk_ahb";
diff --git a/arch/arm/dts/versal-mini-emmc1.dts b/arch/arm/dts/versal-mini-emmc1.dts
index e6a5c2b..ffcc333 100644
--- a/arch/arm/dts/versal-mini-emmc1.dts
+++ b/arch/arm/dts/versal-mini-emmc1.dts
@@ -40,6 +40,9 @@
status = "okay";
non-removable;
disable-wp;
+ no-sd;
+ no-sdio;
+ cap-mmc-hw-reset;
bus-width = <8>;
reg = <0x0 0xf1050000 0x0 0x10000>;
clock-names = "clk_xin", "clk_ahb";
diff --git a/arch/arm/dts/versal-net-mini-emmc.dts b/arch/arm/dts/versal-net-mini-emmc.dts
index e200fb6..20e4e29 100644
--- a/arch/arm/dts/versal-net-mini-emmc.dts
+++ b/arch/arm/dts/versal-net-mini-emmc.dts
@@ -54,6 +54,9 @@
status = "okay";
non-removable;
disable-wp;
+ no-sd;
+ no-sdio;
+ cap-mmc-hw-reset;
bus-width = <8>;
reg = <0 0xf1050000 0 0x10000>;
clock-names = "clk_xin", "clk_ahb";
diff --git a/arch/arm/dts/versal-net-mini.dts b/arch/arm/dts/versal-net-mini.dts
index 9365efb..f98f95a 100644
--- a/arch/arm/dts/versal-net-mini.dts
+++ b/arch/arm/dts/versal-net-mini.dts
@@ -60,7 +60,6 @@
clock-names = "uartclk", "apb_pclk";
clocks = <&clk1>, <&clk1>;
clock = <1000000>;
- current-speed = <115200>;
skip-init;
};
};
diff --git a/arch/arm/dts/zynq-dlc20-rev1.0.dts b/arch/arm/dts/zynq-dlc20-rev1.0.dts
index 8d00737..8031488 100644
--- a/arch/arm/dts/zynq-dlc20-rev1.0.dts
+++ b/arch/arm/dts/zynq-dlc20-rev1.0.dts
@@ -83,6 +83,9 @@
bootph-all;
status = "okay"; /* EMMC MTFC4GACAJCN - MIO40-MIO45 */
non-removable;
+ no-sd;
+ no-sdio;
+ cap-mmc-hw-reset;
bus-width = <4>;
};
diff --git a/arch/arm/dts/zynq-minized.dts b/arch/arm/dts/zynq-minized.dts
index 96d2937..a8f3450 100644
--- a/arch/arm/dts/zynq-minized.dts
+++ b/arch/arm/dts/zynq-minized.dts
@@ -92,6 +92,9 @@
&sdhci1 {
status = "okay";
non-removable;
+ no-sd;
+ no-sdio;
+ cap-mmc-hw-reset;
bus-width = <4>;
max-frequency = <12000000>;
diff --git a/arch/arm/dts/zynqmp-dlc21-revA.dts b/arch/arm/dts/zynqmp-dlc21-revA.dts
index 293d8e9..d540f33 100644
--- a/arch/arm/dts/zynqmp-dlc21-revA.dts
+++ b/arch/arm/dts/zynqmp-dlc21-revA.dts
@@ -60,6 +60,9 @@
status = "okay";
non-removable;
disable-wp;
+ no-sd;
+ no-sdio;
+ cap-mmc-hw-reset;
bus-width = <8>;
xlnx,mio-bank = <0>;
};
diff --git a/arch/arm/dts/zynqmp-g-a2197-00-revA.dts b/arch/arm/dts/zynqmp-g-a2197-00-revA.dts
index c439f77..6ef8b14 100644
--- a/arch/arm/dts/zynqmp-g-a2197-00-revA.dts
+++ b/arch/arm/dts/zynqmp-g-a2197-00-revA.dts
@@ -68,6 +68,9 @@
status = "okay";
non-removable;
disable-wp;
+ no-sd;
+ no-sdio;
+ cap-mmc-hw-reset;
bus-width = <8>;
xlnx,mio-bank = <0>;
};
diff --git a/arch/arm/dts/zynqmp-m-a2197-01-revA.dts b/arch/arm/dts/zynqmp-m-a2197-01-revA.dts
index d6cd193..c597adb 100644
--- a/arch/arm/dts/zynqmp-m-a2197-01-revA.dts
+++ b/arch/arm/dts/zynqmp-m-a2197-01-revA.dts
@@ -88,6 +88,9 @@
status = "okay";
non-removable;
disable-wp;
+ no-sd;
+ no-sdio;
+ cap-mmc-hw-reset;
bus-width = <8>;
xlnx,mio-bank = <0>; /* FIXME tap delay */
};
diff --git a/arch/arm/dts/zynqmp-m-a2197-02-revA.dts b/arch/arm/dts/zynqmp-m-a2197-02-revA.dts
index 902fdd4..eefe5ab 100644
--- a/arch/arm/dts/zynqmp-m-a2197-02-revA.dts
+++ b/arch/arm/dts/zynqmp-m-a2197-02-revA.dts
@@ -84,6 +84,9 @@
status = "okay";
non-removable;
disable-wp;
+ no-sd;
+ no-sdio;
+ cap-mmc-hw-reset;
bus-width = <8>;
xlnx,mio-bank = <0>; /* FIXME tap delay */
};
diff --git a/arch/arm/dts/zynqmp-m-a2197-03-revA.dts b/arch/arm/dts/zynqmp-m-a2197-03-revA.dts
index f3994bc..7ea4eab 100644
--- a/arch/arm/dts/zynqmp-m-a2197-03-revA.dts
+++ b/arch/arm/dts/zynqmp-m-a2197-03-revA.dts
@@ -84,6 +84,9 @@
status = "okay";
non-removable;
disable-wp;
+ no-sd;
+ no-sdio;
+ cap-mmc-hw-reset;
bus-width = <8>;
xlnx,mio-bank = <0>; /* FIXME tap delay */
};
diff --git a/arch/arm/dts/zynqmp-mini-emmc0.dts b/arch/arm/dts/zynqmp-mini-emmc0.dts
index cf22197..ad4b3c5 100644
--- a/arch/arm/dts/zynqmp-mini-emmc0.dts
+++ b/arch/arm/dts/zynqmp-mini-emmc0.dts
@@ -52,6 +52,9 @@
compatible = "xlnx,zynqmp-8.9a", "arasan,sdhci-8.9a";
status = "disabled";
non-removable;
+ no-sd;
+ no-sdio;
+ cap-mmc-hw-reset;
bus-width = <8>;
reg = <0x0 0xff160000 0x0 0x1000>;
clock-names = "clk_xin", "clk_ahb";
diff --git a/arch/arm/dts/zynqmp-mini-emmc1.dts b/arch/arm/dts/zynqmp-mini-emmc1.dts
index 4c9f56a..fd421b4 100644
--- a/arch/arm/dts/zynqmp-mini-emmc1.dts
+++ b/arch/arm/dts/zynqmp-mini-emmc1.dts
@@ -52,6 +52,9 @@
compatible = "xlnx,zynqmp-8.9a", "arasan,sdhci-8.9a";
status = "disabled";
non-removable;
+ no-sd;
+ no-sdio;
+ cap-mmc-hw-reset;
bus-width = <8>;
reg = <0x0 0xff170000 0x0 0x1000>;
clock-names = "clk_xin", "clk_ahb";
diff --git a/arch/arm/dts/zynqmp-p-a2197-00-revA.dts b/arch/arm/dts/zynqmp-p-a2197-00-revA.dts
index ae52e8e..fce0d8d 100644
--- a/arch/arm/dts/zynqmp-p-a2197-00-revA.dts
+++ b/arch/arm/dts/zynqmp-p-a2197-00-revA.dts
@@ -60,6 +60,9 @@
status = "okay";
non-removable;
disable-wp;
+ no-sd;
+ no-sdio;
+ cap-mmc-hw-reset;
bus-width = <8>;
xlnx,mio-bank = <0>;
};
@@ -155,7 +158,7 @@
reg = <0>;
/* On connector J98 */
reg_vcc_fmc: tps544@7 { /* u80 - FIXME name - don't know what it does */
- compatible = "ti,tps544b25"; /* Documentation/hwmon/pmbus - wiring is missing */
+ compatible = "ti,tps544b25"; /* Documentation/hwmon/pmbus.rst - wiring is missing */
reg = <0x7>;
regulator-name = "reg_vcc_fmc";
regulator-min-microvolt = <1800000>;
@@ -163,15 +166,15 @@
/* enable-gpio = <&gpio0 23 0x4>; optional */
};
reg_vcc_ram: tps544@8 { /* u83 - FIXME name - don't know what it does */
- compatible = "ti,tps544b25"; /* Documentation/hwmon/pmbus - wiring is missing */
+ compatible = "ti,tps544b25"; /* Documentation/hwmon/pmbus.rst - wiring is missing */
reg = <0x8>;
};
reg_vcc_pslp: tps544@9 { /* u85 - FIXME name - don't know what it does */
- compatible = "ti,tps544b25"; /* Documentation/hwmon/pmbus - wiring is missing */
+ compatible = "ti,tps544b25"; /* Documentation/hwmon/pmbus.rst - wiring is missing */
reg = <0x9>;
};
reg_vcc_psfp: tps544@a { /* u86 - FIXME name - don't know what it does */
- compatible = "ti,tps544b25"; /* Documentation/hwmon/pmbus - wiring is missing */
+ compatible = "ti,tps544b25"; /* Documentation/hwmon/pmbus.rst - wiring is missing */
reg = <0xa>;
};
reg_vccint: tps53681@60 { /* u70 - FIXME name - don't know what it does - also vcc_io_soc */
@@ -212,75 +215,75 @@
reg = <2>;
/* On connector J104 */
reg_vccaus: tps544@d { /* u88 - FIXME name - don't know what it does */
- compatible = "ti,tps544b25"; /* Documentation/hwmon/pmbus - wiring is missing */
+ compatible = "ti,tps544b25"; /* Documentation/hwmon/pmbus.rst - wiring is missing */
reg = <0xd>;
};
reg_vccaux_fmc: tps544@e { /* u90 - FIXME name - don't know what it does */
- compatible = "ti,tps544b25"; /* Documentation/hwmon/pmbus - wiring is missing */
+ compatible = "ti,tps544b25"; /* Documentation/hwmon/pmbus.rst - wiring is missing */
reg = <0xe>;
};
reg_vcco_500: tps544@f { /* u93 - FIXME name - don't know what it does */
- compatible = "ti,tps544b25"; /* Documentation/hwmon/pmbus - wiring is missing */
+ compatible = "ti,tps544b25"; /* Documentation/hwmon/pmbus.rst - wiring is missing */
reg = <0xf>;
};
reg_vcco_501: tps544@10 { /* u95 - FIXME name - don't know what it does */
- compatible = "ti,tps544b25"; /* Documentation/hwmon/pmbus - wiring is missing */
+ compatible = "ti,tps544b25"; /* Documentation/hwmon/pmbus.rst - wiring is missing */
reg = <0x10>;
};
reg_vcco_502: tps544@11 { /* u97 - FIXME name - don't know what it does */
- compatible = "ti,tps544b25"; /* Documentation/hwmon/pmbus - wiring is missing */
+ compatible = "ti,tps544b25"; /* Documentation/hwmon/pmbus.rst - wiring is missing */
reg = <0x11>;
};
reg_vcco_503: tps544@12 { /* u99 - FIXME name - don't know what it does */
- compatible = "ti,tps544b25"; /* Documentation/hwmon/pmbus - wiring is missing */
+ compatible = "ti,tps544b25"; /* Documentation/hwmon/pmbus.rst - wiring is missing */
reg = <0x12>;
};
reg_vcc1v8: tps544@13 { /* u101 - FIXME name - don't know what it does */
- compatible = "ti,tps544b25"; /* Documentation/hwmon/pmbus - wiring is missing */
+ compatible = "ti,tps544b25"; /* Documentation/hwmon/pmbus.rst - wiring is missing */
reg = <0x13>;
};
reg_vcc3v3: tps544@14 { /* u102 - FIXME name - don't know what it does */
- compatible = "ti,tps544b25"; /* Documentation/hwmon/pmbus - wiring is missing */
+ compatible = "ti,tps544b25"; /* Documentation/hwmon/pmbus.rst - wiring is missing */
reg = <0x14>;
};
reg_vcc1v2_ddr4: tps544@15 { /* u104 - FIXME name - don't know what it does */
- compatible = "ti,tps544b25"; /* Documentation/hwmon/pmbus - wiring is missing */
+ compatible = "ti,tps544b25"; /* Documentation/hwmon/pmbus.rst - wiring is missing */
reg = <0x15>;
};
reg_vcc1v1_lp4: tps544@16 { /* u106 - FIXME name - don't know what it does */
- compatible = "ti,tps544b25"; /* Documentation/hwmon/pmbus - wiring is missing */
+ compatible = "ti,tps544b25"; /* Documentation/hwmon/pmbus.rst - wiring is missing */
reg = <0x16>;
};
reg_vcc1_1V8_lp4: tps544@17 { /* u108 - FIXME name - don't know what it does */
- compatible = "ti,tps544b25"; /* Documentation/hwmon/pmbus - wiring is missing */
+ compatible = "ti,tps544b25"; /* Documentation/hwmon/pmbus.rst - wiring is missing */
reg = <0x17>;
};
reg_vadj_fmc: tps544@19 { /* u109 - FIXME name - don't know what it does */
- compatible = "ti,tps544b25"; /* Documentation/hwmon/pmbus - wiring is missing */
+ compatible = "ti,tps544b25"; /* Documentation/hwmon/pmbus.rst - wiring is missing */
reg = <0x19>;
};
reg_mgtyavcc: tps544@1a { /* u111 - FIXME name - don't know what it does */
- compatible = "ti,tps544b25"; /* Documentation/hwmon/pmbus - wiring is missing */
+ compatible = "ti,tps544b25"; /* Documentation/hwmon/pmbus.rst - wiring is missing */
reg = <0x1a>;
};
reg_mgtyavtt: tps544@1b { /* u114 - FIXME name - don't know what it does */
- compatible = "ti,tps544b25"; /* Documentation/hwmon/pmbus - wiring is missing */
+ compatible = "ti,tps544b25"; /* Documentation/hwmon/pmbus.rst - wiring is missing */
reg = <0x1b>;
};
reg_mgtyvccaux: tps544@1c { /* u115 - FIXME name - don't know what it does */
- compatible = "ti,tps544b25"; /* Documentation/hwmon/pmbus - wiring is missing */
+ compatible = "ti,tps544b25"; /* Documentation/hwmon/pmbus.rst - wiring is missing */
reg = <0x1c>;
};
reg_util_1v13: tps544@1d { /* u117 - FIXME name - don't know what it does */
- compatible = "ti,tps544b25"; /* Documentation/hwmon/pmbus - wiring is missing */
+ compatible = "ti,tps544b25"; /* Documentation/hwmon/pmbus.rst - wiring is missing */
reg = <0x1d>;
};
reg_util_1v8: tps544@1e { /* u118 - FIXME name - don't know what it does */
- compatible = "ti,tps544b25"; /* Documentation/hwmon/pmbus - wiring is missing */
+ compatible = "ti,tps544b25"; /* Documentation/hwmon/pmbus.rst - wiring is missing */
reg = <0x1e>;
};
reg_util_2v5: tps544@1f { /* u119 - FIXME name - don't know what it does */
- compatible = "ti,tps544b25"; /* Documentation/hwmon/pmbus - wiring is missing */
+ compatible = "ti,tps544b25"; /* Documentation/hwmon/pmbus.rst - wiring is missing */
reg = <0x1f>;
};
};
diff --git a/arch/arm/dts/zynqmp-sc-revB.dts b/arch/arm/dts/zynqmp-sc-revB.dts
index 1fcb5bf..1af3f64 100644
--- a/arch/arm/dts/zynqmp-sc-revB.dts
+++ b/arch/arm/dts/zynqmp-sc-revB.dts
@@ -288,6 +288,9 @@
status = "okay";
non-removable;
disable-wp;
+ no-sd;
+ no-sdio;
+ cap-mmc-hw-reset;
bus-width = <8>;
xlnx,mio-bank = <0>;
};
diff --git a/arch/arm/dts/zynqmp-sc-vm-p-m1369-00-revA.dtso b/arch/arm/dts/zynqmp-sc-vm-p-m1369-00-revA.dtso
new file mode 100644
index 0000000..8412aec
--- /dev/null
+++ b/arch/arm/dts/zynqmp-sc-vm-p-m1369-00-revA.dtso
@@ -0,0 +1,400 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * dts file for Xilinx ZynqMP VM-P-M1369-00
+ *
+ * Copyright (C) 2024, Advanced Micro Devices, Inc.
+ *
+ * Michal Simek <michal.simek@amd.com>
+ */
+
+#include <dt-bindings/gpio/gpio.h>
+
+/dts-v1/;
+/plugin/;
+
+&{/} {
+ compatible = "xlnx,zynqmp-sc-vm-p-m1369-revA",
+ "xlnx,zynqmp-sc-vm-p-m1369", "xlnx,zynqmp";
+
+ ina226-u19 {
+ compatible = "iio-hwmon";
+ io-channels = <&vcc_soc_ina 0>, <&vcc_soc_ina 1>, <&vcc_soc_ina 2>;
+ };
+ ina226-u287 {
+ compatible = "iio-hwmon";
+ io-channels = <&vcc_ram_ina 0>, <&vcc_ram_ina 1>, <&vcc_ram_ina 2>;
+ };
+ ina226-u288 {
+ compatible = "iio-hwmon";
+ io-channels = <&vcc_pslp_ina 0>, <&vcc_pslp_ina 1>, <&vcc_pslp_ina 2>;
+ };
+ ina226-u289 {
+ compatible = "iio-hwmon";
+ io-channels = <&vccaux_ina 0>, <&vccaux_ina 1>, <&vccaux_ina 2>;
+ };
+ ina226-u290 {
+ compatible = "iio-hwmon";
+ io-channels = <&vccaux_pmc_ina 0>, <&vccaux_pmc_ina 1>, <&vccaux_pmc_ina 2>;
+ };
+ ina226-u291 {
+ compatible = "iio-hwmon";
+ io-channels = <&vcco_500_ina 0>, <&vcco_500_ina 1>, <&vcco_500_ina 2>;
+ };
+ ina226-u292 {
+ compatible = "iio-hwmon";
+ io-channels = <&vcco_501_ina 0>, <&vcco_501_ina 1>, <&vcco_501_ina 2>;
+ };
+ ina226-u293 {
+ compatible = "iio-hwmon";
+ io-channels = <&vcco_502_ina 0>, <&vcco_502_ina 1>, <&vcco_502_ina 2>;
+ };
+ ina226-u294 {
+ compatible = "iio-hwmon";
+ io-channels = <&vcco_503_ina 0>, <&vcco_503_ina 1>, <&vcco_503_ina 2>;
+ };
+ ina226-u295 {
+ compatible = "iio-hwmon";
+ io-channels = <&vcc_ddr5_rdimm_ina 0>, <&vcc_ddr5_rdimm_ina 1>, <&vcc_ddr5_rdimm_ina 2>;
+ };
+ ina226-u298 {
+ compatible = "iio-hwmon";
+ io-channels = <&lp5_1v0_ina 0>, <&lp5_1v0_ina 1>, <&lp5_1v0_ina 2>;
+ };
+ ina226-u296 {
+ compatible = "iio-hwmon";
+ io-channels = <&vcc_fmc_ina 0>, <&vcc_fmc_ina 1>, <&vcc_fmc_ina 2>;
+ };
+ ina226-u299 {
+ compatible = "iio-hwmon";
+ io-channels = <>m_avcc_ina 0>, <>m_avcc_ina 1>, <>m_avcc_ina 2>;
+ };
+ ina226-u300 {
+ compatible = "iio-hwmon";
+ io-channels = <>m_avtt_ina 0>, <>m_avtt_ina 1>, <>m_avtt_ina 2>;
+ };
+ ina226-u301 {
+ compatible = "iio-hwmon";
+ io-channels = <>m_avccaux_ina 0>, <>m_avccaux_ina 1>, <>m_avccaux_ina 2>;
+ };
+ ina226-u297 {
+ compatible = "iio-hwmon";
+ io-channels = <&vcc_mipi_ina 0>, <&vcc_mipi_ina 1>, <&vcc_mipi_ina 2>;
+ };
+};
+
+&i2c1 { /* i2c_main bus */
+ #address-cells = <1>;
+ #size-cells = <0>;
+
+ /* u97 eeprom at 0x54 described in sc-revB - WP protection via BOARD_EEPROM_WP - J1801 */
+
+ /* i2c_main_1 - u72 - j108 - disable translation, add 8 */
+ /* J133 - OE for u91@55 + 8 - 161,132813MHz - QSFP56G_0 */
+ qsfp56g_0_clk: clock-controller@5d {
+ compatible = "renesas,proxo-xp";
+ reg = <0x5d>;
+ #clock-cells = <0>;
+ clock-output-names = "qsfp56g_0_clk";
+ };
+
+ /* J134 - OE for u92@57 + 8 - 322,265625MHz - QSFP56G_1 */
+ qsfp56g_1_clk: clock-controller@5f {
+ compatible = "renesas,proxo-xp";
+ reg = <0x5f>;
+ #clock-cells = <0>;
+ clock-output-names = "qsfp56g_1_clk";
+ };
+
+ /* i2c_main_2 - u74 - j110 - disable translation, add 9 */
+ /* J210 - OE for u164@50 + 9 - 320MHz - CH2_LP5 */
+ ch2_lpddr5_refclk: clock-controller@59 {
+ compatible = "renesas,proxo-xp";
+ reg = <0x59>;
+ #clock-cells = <0>;
+ clock-output-names = "ch2_lpddr5_refclk";
+ };
+
+ /* i2c_main_3 - u76 - j112 - disable translation, add 6 */
+ /* J231 - OE for u165@50 + 6 - 320MHz - _RDIMM */
+ ddr5_dimm1_refclk: clock-controller@56 {
+ compatible = "renesas,proxo-xp";
+ reg = <0x56>;
+ #clock-cells = <0>;
+ clock-output-names = "ddr5_udimm_refclk";
+ };
+
+ /* i2c_main_4 - u73 - j109 - disable translation, add 5 */
+ /* J117 - OE for u82@50 + 5 - 33,3333MHz - PS_REFCLK */
+ ps_refclk: clock-controller@55 {
+ compatible = "renesas,proxo-xp";
+ reg = <0x55>;
+ #clock-cells = <0>;
+ clock-output-names = "ps_refclk";
+ };
+
+ /* J71 - selection to LP_I2C_SCL_J or LP_I2C_PMC_SCL_J */
+ /* J70 - selection to LP_I2C_SDA_J or LP_I2C_PMC_SDA_J */
+ /* this should be SW controlable too */
+};
+
+&i2c0 {
+ #address-cells = <1>;
+ #size-cells = <0>;
+
+ /* u134 tps544b25 but connected to J178 connector */
+ /* u48/IMx3112/0x77 - 1:2 multiplexer - also accessed from Versal NET */
+ /* Connection DDR5_UDIMM - SPD can be from 0x50-0x57 */
+ /* FIXME gpio should handle SYSCTLR_PMBUS_ALERT and also INA226_PMBUS_ALERT */
+ /* Access to i2c_pmc bus via u49 with OE j100 or via SYSCTLR_I2C_PMC_EN */
+
+ /* ina226_pmbus - J103 - disable INA226_PMBUS */
+ vcc_soc_ina: power-monitor@40 { /* u19 */
+ compatible = "ti,ina226";
+ #io-channel-cells = <1>;
+ reg = <0x40>;
+ shunt-resistor = <1000>; /* R222 */
+ };
+
+ vcc_ram_ina: power-monitor@41 { /* u287 */
+ compatible = "ti,ina226";
+ #io-channel-cells = <1>;
+ reg = <0x41>;
+ shunt-resistor = <1000>; /* R32981 */
+ };
+
+ vcc_pslp_ina: power-monitor@42 { /* u288 */
+ compatible = "ti,ina226";
+ #io-channel-cells = <1>;
+ reg = <0x42>;
+ shunt-resistor = <1000>; /* R32984 */
+ };
+
+ vccaux_ina: power-monitor@43 { /* u289 */
+ compatible = "ti,ina226";
+ #io-channel-cells = <1>;
+ reg = <0x43>;
+ shunt-resistor = <1000>; /* R32987 */
+ };
+
+ vccaux_pmc_ina: power-monitor@44 { /* u290 */
+ compatible = "ti,ina226";
+ #io-channel-cells = <1>;
+ reg = <0x44>;
+ shunt-resistor = <1000>; /* R32990 */
+ };
+
+ vcco_500_ina: power-monitor@45 { /* u291 */
+ compatible = "ti,ina226";
+ #io-channel-cells = <1>;
+ reg = <0x45>;
+ shunt-resistor = <1000>; /* R32993 */
+ };
+
+ vcco_501_ina: power-monitor@46 { /* u292 */
+ compatible = "ti,ina226";
+ #io-channel-cells = <1>;
+ reg = <0x46>;
+ shunt-resistor = <1000>; /* R32996 */
+ };
+
+ vcco_502_ina: power-monitor@47 { /* u293 */
+ compatible = "ti,ina226";
+ #io-channel-cells = <1>;
+ reg = <0x47>;
+ shunt-resistor = <1000>; /* R32999 */
+ };
+
+ vcco_503_ina: power-monitor@48 { /* u294 */
+ compatible = "ti,ina226";
+ #io-channel-cells = <1>;
+ reg = <0x48>;
+ shunt-resistor = <1000>; /* R33002 */
+ };
+
+ vcc_ddr5_rdimm_ina: power-monitor@49 { /* u295 */
+ compatible = "ti,ina226";
+ #io-channel-cells = <1>;
+ reg = <0x49>;
+ shunt-resistor = <1000>; /* R33005 */
+ };
+
+ lp5_1v0_ina: power-monitor@4a { /* u298 */
+ compatible = "ti,ina226";
+ #io-channel-cells = <1>;
+ reg = <0x4a>;
+ shunt-resistor = <1000>; /* R33014 */
+ };
+
+ vcc_fmc_ina: power-monitor@4b { /* u296 */
+ compatible = "ti,ina226";
+ #io-channel-cells = <1>;
+ reg = <0x4b>;
+ shunt-resistor = <1000>; /* R33008 */
+ };
+
+ gtm_avcc_ina: power-monitor@4c { /* u299 */
+ compatible = "ti,ina226";
+ #io-channel-cells = <1>;
+ reg = <0x4c>;
+ shunt-resistor = <1000>; /* R33017 */
+ };
+
+ gtm_avtt_ina: power-monitor@4d { /* u300 */
+ compatible = "ti,ina226";
+ #io-channel-cells = <1>;
+ reg = <0x4d>;
+ shunt-resistor = <1000>; /* R33020 */
+ };
+
+ gtm_avccaux_ina: power-monitor@4e { /* u301 */
+ compatible = "ti,ina226";
+ #io-channel-cells = <1>;
+ reg = <0x4e>;
+ shunt-resistor = <1000>; /* R33023 */
+ };
+
+ vcc_mipi_ina: power-monitor@4f { /* u297 */
+ compatible = "ti,ina226";
+ #io-channel-cells = <1>;
+ reg = <0x4f>;
+ shunt-resistor = <1000>; /* R33011 */
+ };
+
+ /* pmbus - j105 - disable main PMBUS - also going to j102 connector */
+ vcc_pslp: regulator@15 { /* u24 */
+ compatible = "ti,tps546b24a";
+ reg = <0x15>;
+ };
+
+ vccaux_pmc: regulator@17 { /* u26 */
+ compatible = "ti,tps546b24a";
+ reg = <0x17>;
+ };
+
+ vcco_500: regulator@18 { /* u27 */
+ compatible = "ti,tps546b24a";
+ reg = <0x18>;
+ };
+
+ vcco_501: regulator@19 { /* u28 */
+ compatible = "ti,tps546b24a";
+ reg = <0x19>;
+ };
+
+ vcco_502: regulator@1a { /* u29 */
+ compatible = "ti,tps546b24a";
+ reg = <0x1a>;
+ };
+
+ vcco_503: regulator@1b { /* u30 */
+ compatible = "ti,tps546b24a";
+ reg = <0x1b>;
+ };
+
+ vcc_ddr5_rdimm: regulator@1c { /* u31 */
+ compatible = "ti,tps546b24a";
+ reg = <0x1c>;
+ };
+
+ gtm_avcc: regulator@22 { /* u37 */
+ compatible = "ti,tps546b24a";
+ reg = <0x22>;
+ };
+
+ gtm_avtt: regulator@20 { /* u38 */
+ compatible = "ti,tps546b24a";
+ reg = <0x20>;
+ };
+
+ gtm_avccaux: regulator@21 { /* u39 */
+ compatible = "ti,tps546b24a";
+ reg = <0x21>;
+ };
+
+ vccint_gt: regulator@2a { /* u44 */
+ compatible = "ti,tps546b24a";
+ reg = <0x2a>;
+ };
+
+ util_1v8: regulator@2b { /* u1839 */
+ compatible = "ti,tps546b24a";
+ reg = <0x2b>;
+ };
+
+ vcc_pmc: regulator@2c { /* u46 */
+ compatible = "ti,tps546b24a";
+ reg = <0x2c>;
+ };
+
+ /* pmbus via U62 as ext_pmbus - disable via j104 */
+ vccint: regulator@10 { /* u18 */
+ compatible = "ti,tps546b24";
+ reg = <0x10>;
+ };
+
+ vccsoc: regulator@11 { /* u20 */
+ compatible = "ti,tps546b24";
+ reg = <0x11>;
+ };
+
+ vcc_io: regulator@12 { /* u21 */
+ compatible = "ti,tps546b24";
+ reg = <0x12>;
+ };
+
+ vcc_psfp: regulator@13 { /* u22 */
+ compatible = "ti,tps546b24";
+ reg = <0x13>;
+ };
+
+ vcc_ram: regulator@14 { /* u23 */
+ compatible = "ti,tps546b24";
+ reg = <0x14>;
+ };
+
+ vccaux: regulator@16 { /* u25 */
+ compatible = "ti,tps546b24";
+ reg = <0x16>;
+ };
+
+ lp5_1v0: regulator@1d { /* u32 */
+ compatible = "ti,tps546b24";
+ reg = <0x1d>;
+ };
+
+ vcc_fmc: regulator@1e { /* u33 */
+ compatible = "ti,tps546b24";
+ reg = <0x1e>;
+ };
+
+ lp5_vdd1: regulator@25 { /* u40 */
+ compatible = "ti,tps546b24";
+ reg = <0x25>;
+ };
+
+ lp5_vdd2: regulator@26 { /* u41 */
+ compatible = "ti,tps546b24";
+ reg = <0x26>;
+ };
+
+ lp5_vddq: regulator@27 { /* u42 */
+ compatible = "ti,tps546b24";
+ reg = <0x27>;
+ };
+
+ vcco_hdio: regulator@29 { /* u43 */
+ compatible = "ti,tps546b24";
+ reg = <0x29>;
+ };
+
+ vcc_mipi: regulator@1f { /* u47 */
+ compatible = "ti,tps546b24";
+ reg = <0x1f>;
+ };
+
+ /* connected via J425 connector
+ ucd90320: power-sequencer@73 { // u16
+ compatible = "ti,ucd90320";
+ reg = <0x73>;
+ };*/
+};
diff --git a/arch/arm/dts/zynqmp-sm-k26-revA.dts b/arch/arm/dts/zynqmp-sm-k26-revA.dts
index d95a05e..8056f6b 100644
--- a/arch/arm/dts/zynqmp-sm-k26-revA.dts
+++ b/arch/arm/dts/zynqmp-sm-k26-revA.dts
@@ -247,6 +247,9 @@
pinctrl-0 = <&pinctrl_sdhci0_default>;
non-removable;
disable-wp;
+ no-sd;
+ no-sdio;
+ cap-mmc-hw-reset;
bus-width = <8>;
xlnx,mio-bank = <0>;
assigned-clock-rates = <187498123>;
diff --git a/arch/arm/dts/zynqmp-topic-miamimp-xilinx-xdp-v1r1.dts b/arch/arm/dts/zynqmp-topic-miamimp-xilinx-xdp-v1r1.dts
index 0d96c6f..2037686 100644
--- a/arch/arm/dts/zynqmp-topic-miamimp-xilinx-xdp-v1r1.dts
+++ b/arch/arm/dts/zynqmp-topic-miamimp-xilinx-xdp-v1r1.dts
@@ -93,6 +93,9 @@
status = "okay";
non-removable;
disable-wp; /* We don't have a write-protect detection */
+ no-sd;
+ no-sdio;
+ cap-mmc-hw-reset;
bus-width = <8>;
xlnx,mio-bank = <0>;
};
diff --git a/arch/arm/dts/zynqmp-vpk120-revA.dts b/arch/arm/dts/zynqmp-vpk120-revA.dts
index 4768fac..f281c7f 100644
--- a/arch/arm/dts/zynqmp-vpk120-revA.dts
+++ b/arch/arm/dts/zynqmp-vpk120-revA.dts
@@ -105,6 +105,9 @@
status = "okay";
non-removable;
disable-wp;
+ no-sd;
+ no-sdio;
+ cap-mmc-hw-reset;
bus-width = <8>;
xlnx,mio-bank = <0>;
};
diff --git a/arch/arm/dts/zynqmp-zcu100-revC.dts b/arch/arm/dts/zynqmp-zcu100-revC.dts
index c594506..c905136 100644
--- a/arch/arm/dts/zynqmp-zcu100-revC.dts
+++ b/arch/arm/dts/zynqmp-zcu100-revC.dts
@@ -509,6 +509,9 @@
xlnx,mio-bank = <0>;
non-removable;
disable-wp;
+ no-sd;
+ no-sdio;
+ cap-mmc-hw-reset;
cap-power-off-card;
mmc-pwrseq = <&sdio_pwrseq>;
vqmmc-supply = <&wmmcsdio_fixed>;
diff --git a/arch/arm/mach-zynqmp/cpu.c b/arch/arm/mach-zynqmp/cpu.c
index 24fd575..960ffac 100644
--- a/arch/arm/mach-zynqmp/cpu.c
+++ b/arch/arm/mach-zynqmp/cpu.c
@@ -112,19 +112,32 @@
return 0x14000;
}
-#if defined(CONFIG_SYS_MEM_RSVD_FOR_MMU) || defined(CONFIG_DEFINE_TCM_OCM_MMAP)
+#if defined(CONFIG_DEFINE_TCM_OCM_MMAP)
void tcm_init(u8 mode)
{
- puts("WARNING: Initializing TCM overwrites TCM content\n");
- initialize_tcm(mode);
- memset((void *)ZYNQMP_TCM_BASE_ADDR, 0, ZYNQMP_TCM_SIZE);
+ int ret;
+
+ ret = check_tcm_mode(mode);
+ if (!ret) {
+ puts("WARNING: Initializing TCM overwrites TCM content\n");
+ initialize_tcm(mode);
+ memset((void *)ZYNQMP_TCM_BASE_ADDR, 0, ZYNQMP_TCM_SIZE);
+ }
+
+ if (ret == -EACCES)
+ printf("ERROR: Split to lockstep mode required reset/disable cpu\n");
+
+ /* Ignore if ret is -EAGAIN, trying to initialize same mode again */
}
#endif
#ifdef CONFIG_SYS_MEM_RSVD_FOR_MMU
int arm_reserve_mmu(void)
{
- tcm_init(TCM_LOCK);
+ puts("WARNING: Initializing TCM overwrites TCM content\n");
+ initialize_tcm(TCM_LOCK);
+ memset((void *)ZYNQMP_TCM_BASE_ADDR, 0, ZYNQMP_TCM_SIZE);
+
gd->arch.tlb_size = PGTABLE_SIZE;
gd->arch.tlb_addr = ZYNQMP_TCM_BASE_ADDR;
diff --git a/arch/arm/mach-zynqmp/include/mach/sys_proto.h b/arch/arm/mach-zynqmp/include/mach/sys_proto.h
index 15b69e7..9af3ab5 100644
--- a/arch/arm/mach-zynqmp/include/mach/sys_proto.h
+++ b/arch/arm/mach-zynqmp/include/mach/sys_proto.h
@@ -48,9 +48,10 @@
unsigned int zynqmp_get_silicon_version(void);
+int check_tcm_mode(bool mode);
void initialize_tcm(bool mode);
void mem_map_fill(void);
-#if defined(CONFIG_SYS_MEM_RSVD_FOR_MMU) || defined(CONFIG_DEFINE_TCM_OCM_MMAP)
+#if defined(CONFIG_DEFINE_TCM_OCM_MMAP)
void tcm_init(u8 mode);
#endif
diff --git a/arch/arm/mach-zynqmp/mp.c b/arch/arm/mach-zynqmp/mp.c
index 9b46a25..6e6da80 100644
--- a/arch/arm/mach-zynqmp/mp.c
+++ b/arch/arm/mach-zynqmp/mp.c
@@ -12,7 +12,9 @@
#include <asm/arch/hardware.h>
#include <asm/arch/sys_proto.h>
#include <asm/io.h>
+#include <linux/bitfield.h>
#include <linux/delay.h>
+#include <linux/errno.h>
#include <linux/string.h>
#define LOCK 0
@@ -264,6 +266,28 @@
}
}
+int check_tcm_mode(bool mode)
+{
+ u32 tmp, cpu_state;
+ bool mode_prev;
+
+ tmp = readl(&rpu_base->rpu_glbl_ctrl);
+ mode_prev = FIELD_GET(ZYNQMP_RPU_GLBL_CTRL_SPLIT_LOCK_MASK, tmp);
+
+ tmp = readl(&crlapb_base->rst_lpd_top);
+ cpu_state = FIELD_GET(ZYNQMP_CRLAPB_RST_LPD_R50_RST_MASK |
+ ZYNQMP_CRLAPB_RST_LPD_R51_RST_MASK, tmp);
+ cpu_state = cpu_state ? false : true;
+
+ if ((mode_prev == SPLIT && mode == LOCK) && cpu_state)
+ return -EACCES;
+
+ if (mode_prev == mode)
+ return -EAGAIN;
+
+ return 0;
+}
+
static void mark_r5_used(u32 nr, u8 mode)
{
u32 mask = 0;
diff --git a/arch/arm/mach-zynqmp/zynqmp.c b/arch/arm/mach-zynqmp/zynqmp.c
index 3b4d9c6..8ee25e4 100644
--- a/arch/arm/mach-zynqmp/zynqmp.c
+++ b/arch/arm/mach-zynqmp/zynqmp.c
@@ -151,14 +151,12 @@
if (argc != cmdtp->maxargs)
return CMD_RET_USAGE;
- if (strcmp(argv[2], "lockstep") && strcmp(argv[2], "split")) {
- printf("mode param should be lockstep or split\n");
- return CMD_RET_FAILURE;
- }
-
- mode = hextoul(argv[2], NULL);
- if (mode != TCM_LOCK && mode != TCM_SPLIT) {
- printf("Mode should be either 0(lock)/1(split)\n");
+ if (!strcmp(argv[2], "lockstep") || !strcmp(argv[2], "0")) {
+ mode = TCM_LOCK;
+ } else if (!strcmp(argv[2], "split") || !strcmp(argv[2], "1")) {
+ mode = TCM_SPLIT;
+ } else {
+ printf("Mode should be either lockstep/split\n");
return CMD_RET_FAILURE;
}
@@ -429,7 +427,7 @@
" initialized before accessing to avoid ECC\n"
" errors. mode specifies in which mode TCM has\n"
" to be initialized. Supported modes will be\n"
- " lock(0)/split(1)\n"
+ " lockstep(0)/split(1)\n"
#endif
"zynqmp pmufw address size - load PMU FW configuration object\n"
"zynqmp pmufw node <id> - load PMU FW configuration object, <id> in dec\n"
diff --git a/board/xilinx/microblaze-generic/microblaze-generic.c b/board/xilinx/microblaze-generic/microblaze-generic.c
index dc45238..6fc0512 100644
--- a/board/xilinx/microblaze-generic/microblaze-generic.c
+++ b/board/xilinx/microblaze-generic/microblaze-generic.c
@@ -57,7 +57,7 @@
max_size = gd->start_addr_sp - CONFIG_STACK_SIZE;
max_size = round_down(max_size, SZ_16M);
- status |= env_set_hex("scriptaddr", max_size + SZ_2M);
+ status |= env_set_hex("scriptaddr", (max_size - gd->ram_base) + SZ_2M);
status |= env_set_hex("pxefile_addr_r", max_size + SZ_1M);
diff --git a/board/xilinx/zynqmp/zynqmp_kria.env b/board/xilinx/zynqmp/zynqmp_kria.env
index d0e431e..927f398 100644
--- a/board/xilinx/zynqmp/zynqmp_kria.env
+++ b/board/xilinx/zynqmp/zynqmp_kria.env
@@ -51,8 +51,7 @@
# To disable bootmenu set enable_bootmenu=0
enable_bootmenu=1
-check_cc_for_default_boot=if test ${card1_name} = SCK-KV-G || test ${card1_name} = SCK-KR-G || test ${card1_name} = SCK-KD-G; then setenv bootmenu_default 1; else setenv bootmenu_default 0; fi
-som_bootmenu=if test ${enable_bootmenu} = 1; then run check_cc_for_default_boot; bootmenu; else run som_mmc_boot; fi
+som_bootmenu=if test ${enable_bootmenu} = 1; then bootmenu; else run som_mmc_boot; fi
k26_starter=SMK-K26-XCL2G
k24_starter=SMK-K24-XCL2G
diff --git a/boot/android_ab.c b/boot/android_ab.c
index 1196a18..a287eac 100644
--- a/boot/android_ab.c
+++ b/boot/android_ab.c
@@ -13,13 +13,13 @@
#include <u-boot/crc.h>
/**
- * Compute the CRC-32 of the bootloader control struct.
+ * ab_control_compute_crc() - Compute the CRC32 of the bootloader control.
+ *
+ * @abc: Bootloader control block
*
* Only the bytes up to the crc32_le field are considered for the CRC-32
* calculation.
*
- * @param[in] abc bootloader control block
- *
* Return: crc32 sum
*/
static uint32_t ab_control_compute_crc(struct bootloader_control *abc)
@@ -28,14 +28,14 @@
}
/**
- * Initialize bootloader_control to the default value.
+ * ab_control_default() - Initialize bootloader_control to the default value.
+ *
+ * @abc: Bootloader control block
*
* It allows us to boot all slots in order from the first one. This value
* should be used when the bootloader message is corrupted, but not when
* a valid message indicates that all slots are unbootable.
*
- * @param[in] abc bootloader control block
- *
* Return: 0 on success and a negative on error
*/
static int ab_control_default(struct bootloader_control *abc)
@@ -52,7 +52,7 @@
if (!abc)
return -EFAULT;
- memcpy(abc->slot_suffix, "a\0\0\0", 4);
+ memcpy(abc->slot_suffix, "_a\0\0", 4);
abc->magic = BOOT_CTRL_MAGIC;
abc->version = BOOT_CTRL_VERSION;
abc->nb_slot = NUM_SLOTS;
@@ -67,7 +67,13 @@
}
/**
- * Load the boot_control struct from disk into newly allocated memory.
+ * ab_control_create_from_disk() - Load the boot_control from disk into memory.
+ *
+ * @dev_desc: Device where to read the boot_control struct from
+ * @part_info: Partition in 'dev_desc' where to read from, normally
+ * the "misc" partition should be used
+ * @abc: pointer to pointer to bootloader_control data
+ * @offset: boot_control struct offset
*
* This function allocates and returns an integer number of disk blocks,
* based on the block size of the passed device to help performing a
@@ -75,10 +81,6 @@
* The boot_control struct offset (2 KiB) must be a multiple of the device
* block size, for simplicity.
*
- * @param[in] dev_desc Device where to read the boot_control struct from
- * @param[in] part_info Partition in 'dev_desc' where to read from, normally
- * the "misc" partition should be used
- * @param[out] pointer to pointer to bootloader_control data
* Return: 0 on success and a negative on error
*/
static int ab_control_create_from_disk(struct blk_desc *dev_desc,
@@ -122,15 +124,17 @@
}
/**
- * Store the loaded boot_control block.
+ * ab_control_store() - Store the loaded boot_control block.
+ *
+ * @dev_desc: Device where we should write the boot_control struct
+ * @part_info: Partition on the 'dev_desc' where to write
+ * @abc Pointer to the boot control struct and the extra bytes after
+ * it up to the nearest block boundary
+ * @offset: boot_control struct offset
*
* Store back to the same location it was read from with
* ab_control_create_from_misc().
*
- * @param[in] dev_desc Device where we should write the boot_control struct
- * @param[in] part_info Partition on the 'dev_desc' where to write
- * @param[in] abc Pointer to the boot control struct and the extra bytes after
- * it up to the nearest block boundary
* Return: 0 on success and a negative on error
*/
static int ab_control_store(struct blk_desc *dev_desc,
@@ -160,12 +164,13 @@
}
/**
- * Compare two slots.
+ * ab_compare_slots() - Compare two slots.
+ *
+ * @a: The first bootable slot metadata
+ * @b: The second bootable slot metadata
*
* The function determines slot which is should we boot from among the two.
*
- * @param[in] a The first bootable slot metadata
- * @param[in] b The second bootable slot metadata
* Return: Negative if the slot "a" is better, positive of the slot "b" is
* better or 0 if they are equally good.
*/
@@ -323,7 +328,8 @@
* or the device tree.
*/
memset(slot_suffix, 0, sizeof(slot_suffix));
- slot_suffix[0] = BOOT_SLOT_NAME(slot);
+ slot_suffix[0] = '_';
+ slot_suffix[1] = BOOT_SLOT_NAME(slot);
if (memcmp(abc->slot_suffix, slot_suffix,
sizeof(slot_suffix))) {
memcpy(abc->slot_suffix, slot_suffix,
@@ -367,3 +373,71 @@
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/boot/image-android.c b/boot/image-android.c
index e74dd49..cd01278 100644
--- a/boot/image-android.c
+++ b/boot/image-android.c
@@ -14,6 +14,7 @@
#include <linux/libfdt.h>
#define ANDROID_IMAGE_DEFAULT_KERNEL_ADDR 0x10008000
+#define ANDROID_IMAGE_DEFAULT_RAMDISK_ADDR 0x11000000
static char andr_tmp_str[ANDR_BOOT_ARGS_SIZE + 1];
@@ -208,7 +209,8 @@
return true;
}
-static ulong android_image_get_kernel_addr(struct andr_image_data *img_data)
+static ulong android_image_get_kernel_addr(struct andr_image_data *img_data,
+ ulong comp)
{
/*
* All the Android tools that generate a boot.img use this
@@ -221,8 +223,11 @@
*
* Otherwise, we will return the actual value set by the user.
*/
- if (img_data->kernel_addr == ANDROID_IMAGE_DEFAULT_KERNEL_ADDR)
- return img_data->kernel_ptr;
+ if (img_data->kernel_addr == ANDROID_IMAGE_DEFAULT_KERNEL_ADDR) {
+ if (comp == IH_COMP_NONE)
+ return img_data->kernel_ptr;
+ return env_get_ulong("kernel_addr_r", 16, 0);
+ }
/*
* abootimg creates images where all load addresses are 0
@@ -256,13 +261,16 @@
ulong *os_data, ulong *os_len)
{
struct andr_image_data img_data = {0};
- u32 kernel_addr;
+ ulong kernel_addr;
const struct legacy_img_hdr *ihdr;
+ ulong comp;
if (!android_image_get_data(hdr, vendor_boot_img, &img_data))
return -EINVAL;
- kernel_addr = android_image_get_kernel_addr(&img_data);
+ comp = android_image_get_kcomp(hdr, vendor_boot_img);
+
+ kernel_addr = android_image_get_kernel_addr(&img_data, comp);
ihdr = (const struct legacy_img_hdr *)img_data.kernel_ptr;
/*
@@ -275,7 +283,7 @@
if (strlen(andr_tmp_str))
printf("Android's image name: %s\n", andr_tmp_str);
- printf("Kernel load addr 0x%08x size %u KiB\n",
+ printf("Kernel load addr 0x%08lx size %u KiB\n",
kernel_addr, DIV_ROUND_UP(img_data.kernel_size, 1024));
int len = 0;
@@ -359,11 +367,14 @@
const void *vendor_boot_img)
{
struct andr_image_data img_data;
+ ulong comp;
if (!android_image_get_data(hdr, vendor_boot_img, &img_data))
return -EINVAL;
- return android_image_get_kernel_addr(&img_data);
+ comp = android_image_get_kcomp(hdr, vendor_boot_img);
+
+ return android_image_get_kernel_addr(&img_data, comp);
}
ulong android_image_get_kcomp(const void *hdr,
@@ -395,9 +406,25 @@
if (!img_data.ramdisk_size)
return -ENOENT;
-
+ /*
+ * Android tools can generate a boot.img with default load address
+ * or 0, even though it doesn't really make a lot of sense, and it
+ * might be valid on some platforms, we treat that address as
+ * the default value for this field, and try to pass ramdisk
+ * in place if possible.
+ */
if (img_data.header_version > 2) {
- ramdisk_ptr = img_data.ramdisk_addr;
+ /* Ramdisk can't be used in-place, copy it to ramdisk_addr_r */
+ if (img_data.ramdisk_addr == ANDROID_IMAGE_DEFAULT_RAMDISK_ADDR) {
+ ramdisk_ptr = env_get_ulong("ramdisk_addr_r", 16, 0);
+ if (!ramdisk_ptr) {
+ printf("Invalid ramdisk_addr_r to copy ramdisk into\n");
+ return -EINVAL;
+ }
+ } else {
+ ramdisk_ptr = img_data.ramdisk_addr;
+ }
+ *rd_data = ramdisk_ptr;
memcpy((void *)(ramdisk_ptr), (void *)img_data.vendor_ramdisk_ptr,
img_data.vendor_ramdisk_size);
ramdisk_ptr += img_data.vendor_ramdisk_size;
@@ -410,15 +437,20 @@
img_data.bootconfig_size);
}
} else {
- ramdisk_ptr = img_data.ramdisk_addr;
- memcpy((void *)(ramdisk_ptr), (void *)img_data.ramdisk_ptr,
- img_data.ramdisk_size);
+ /* Ramdisk can be used in-place, use current ptr */
+ if (img_data.ramdisk_addr == 0 ||
+ img_data.ramdisk_addr == ANDROID_IMAGE_DEFAULT_RAMDISK_ADDR) {
+ *rd_data = img_data.ramdisk_ptr;
+ } else {
+ ramdisk_ptr = img_data.ramdisk_addr;
+ *rd_data = ramdisk_ptr;
+ memcpy((void *)(ramdisk_ptr), (void *)img_data.ramdisk_ptr,
+ img_data.ramdisk_size);
+ }
}
printf("RAM disk load addr 0x%08lx size %u KiB\n",
- img_data.ramdisk_addr, DIV_ROUND_UP(img_data.ramdisk_size, 1024));
-
- *rd_data = img_data.ramdisk_addr;
+ *rd_data, DIV_ROUND_UP(img_data.ramdisk_size, 1024));
*rd_len = img_data.ramdisk_size;
return 0;
diff --git a/cmd/Kconfig b/cmd/Kconfig
index 3ee70f3..4fba9fe 100644
--- a/cmd/Kconfig
+++ b/cmd/Kconfig
@@ -885,9 +885,21 @@
config CMD_MEMINFO
bool "meminfo"
+ default y if SANDBOX
help
Display memory information.
+config CMD_MEMINFO_MAP
+ bool "- with memory map"
+ depends on CMD_MEMINFO
+ default y if SANDBOX
+ help
+ Shows a memory map, in addition to just the DRAM size. This allows
+ seeing where U-Boot's memory area is, at the top of DRAM, as well as
+ detail about each piece of it.
+
+ See doc/usage/cmd/meminfo.rst for more information.
+
config CMD_MEMORY
bool "md, mm, nm, mw, cp, cmp, base, loop"
default y
@@ -1782,20 +1794,6 @@
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 || NET_LWIP
menuconfig CMD_NET
diff --git a/cmd/Makefile b/cmd/Makefile
index 3c5bd56..b4668eb 100644
--- a/cmd/Makefile
+++ b/cmd/Makefile
@@ -17,7 +17,6 @@
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
@@ -110,6 +109,7 @@
obj-$(CONFIG_CMD_LSBLK) += lsblk.o
obj-$(CONFIG_CMD_MD5SUM) += md5sum.o
obj-$(CONFIG_CMD_MEMORY) += mem.o
+obj-$(CONFIG_CMD_MEMINFO) += meminfo.o
obj-$(CONFIG_CMD_IO) += io.o
obj-$(CONFIG_CMD_MII) += mii.o
obj-$(CONFIG_CMD_MISC) += misc.o
diff --git a/cmd/ab_select.c b/cmd/ab_select.c
deleted file mode 100644
index 7c178c7..0000000
--- 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 97a96c0..16eabfe 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>
@@ -16,15 +17,6 @@
#include <vsprintf.h>
#include <linux/err.h>
-enum bcb_cmd {
- BCB_CMD_LOAD,
- BCB_CMD_FIELD_SET,
- BCB_CMD_FIELD_CLEAR,
- BCB_CMD_FIELD_TEST,
- BCB_CMD_FIELD_DUMP,
- BCB_CMD_STORE,
-};
-
static const char * const fields[] = {
"command",
"status",
@@ -38,67 +30,9 @@
static struct blk_desc *block;
static struct disk_partition *partition = &partition_data;
-static int bcb_cmd_get(char *cmd)
-{
- if (!strcmp(cmd, "load"))
- return BCB_CMD_LOAD;
- if (!strcmp(cmd, "set"))
- return BCB_CMD_FIELD_SET;
- if (!strcmp(cmd, "clear"))
- return BCB_CMD_FIELD_CLEAR;
- if (!strcmp(cmd, "test"))
- return BCB_CMD_FIELD_TEST;
- if (!strcmp(cmd, "store"))
- return BCB_CMD_STORE;
- if (!strcmp(cmd, "dump"))
- return BCB_CMD_FIELD_DUMP;
- else
- return -1;
-}
-
-static int bcb_is_misused(int argc, char *const argv[])
+static int bcb_not_loaded(void)
{
- int cmd = bcb_cmd_get(argv[0]);
-
- switch (cmd) {
- case BCB_CMD_LOAD:
- if (argc != 3 && argc != 4)
- goto err;
- break;
- case BCB_CMD_FIELD_SET:
- if (argc != 3)
- goto err;
- break;
- case BCB_CMD_FIELD_TEST:
- if (argc != 4)
- goto err;
- break;
- case BCB_CMD_FIELD_CLEAR:
- if (argc != 1 && argc != 2)
- goto err;
- break;
- case BCB_CMD_STORE:
- if (argc != 1)
- goto err;
- break;
- case BCB_CMD_FIELD_DUMP:
- if (argc != 2)
- goto err;
- break;
- default:
- printf("Error: 'bcb %s' not supported\n", argv[0]);
- return -1;
- }
-
- if (cmd != BCB_CMD_LOAD && !block) {
- printf("Error: Please, load BCB first!\n");
- return -1;
- }
-
- return 0;
-err:
- printf("Error: Bad usage of 'bcb %s'\n", argv[0]);
-
+ printf("Error: Please, load BCB first!\n");
return -1;
}
@@ -216,6 +150,9 @@
char *endp;
char *iface = "mmc";
+ if (argc < 3)
+ return CMD_RET_USAGE;
+
if (argc == 4) {
iface = argv[1];
argc--;
@@ -270,6 +207,12 @@
static int do_bcb_set(struct cmd_tbl *cmdtp, int flag, int argc,
char * const argv[])
{
+ if (argc < 3)
+ return CMD_RET_USAGE;
+
+ if (!block)
+ return bcb_not_loaded();
+
return __bcb_set(argv[1], argv[2]);
}
@@ -279,6 +222,9 @@
int size;
char *field;
+ if (!block)
+ return bcb_not_loaded();
+
if (argc == 1) {
memset(&bcb, 0, sizeof(bcb));
return CMD_RET_SUCCESS;
@@ -297,7 +243,15 @@
{
int size;
char *field;
- char *op = argv[2];
+ char *op;
+
+ if (argc < 4)
+ return CMD_RET_USAGE;
+
+ if (!block)
+ return bcb_not_loaded();
+
+ op = argv[2];
if (bcb_field_get(argv[1], &field, &size))
return CMD_RET_FAILURE;
@@ -325,6 +279,12 @@
int size;
char *field;
+ if (argc < 2)
+ return CMD_RET_USAGE;
+
+ if (!block)
+ return bcb_not_loaded();
+
if (bcb_field_get(argv[1], &field, &size))
return CMD_RET_FAILURE;
@@ -356,6 +316,9 @@
static int do_bcb_store(struct cmd_tbl *cmdtp, int flag, int argc,
char * const argv[])
{
+ if (!block)
+ return bcb_not_loaded();
+
return __bcb_store();
}
@@ -414,44 +377,75 @@
__bcb_reset();
}
-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, "", ""),
- U_BOOT_CMD_MKENT(clear, CONFIG_SYS_MAXARGS, 1, do_bcb_clear, "", ""),
- 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, "", ""),
-};
-
-static int do_bcb(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
+__maybe_unused static int do_bcb_ab_select(struct cmd_tbl *cmdtp,
+ int flag, int argc,
+ char * const argv[])
{
- struct cmd_tbl *c;
+ int ret;
+ struct blk_desc *dev_desc;
+ struct disk_partition part_info;
+ char slot[2];
+ bool dec_tries = true;
- if (argc < 2)
+ if (argc < 4)
return CMD_RET_USAGE;
+ for (int i = 4; i < argc; i++) {
+ if (!strcmp(argv[i], "--no-dec"))
+ 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);
+
- argc--;
- argv++;
+ return CMD_RET_SUCCESS;
+}
+
+__maybe_unused 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;
- c = find_cmd_tbl(argv[0], cmd_bcb_sub, ARRAY_SIZE(cmd_bcb_sub));
- if (!c)
+ if (argc < 3)
return CMD_RET_USAGE;
- if (bcb_is_misused(argc, argv)) {
- /*
- * We try to improve the user experience by reporting the
- * root-cause of misusage, so don't return CMD_RET_USAGE,
- * since the latter prints out the full-blown help text
- */
+ if (part_get_info_by_dev_and_name_or_num(argv[1], argv[2],
+ &dev_desc, &part_info,
+ false) < 0) {
return CMD_RET_FAILURE;
}
- return c->cmd(cmdtp, flag, argc, argv);
+ 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;
}
-U_BOOT_CMD(
- bcb, CONFIG_SYS_MAXARGS, 1, do_bcb,
- "Load/set/clear/test/dump/store Android BCB fields",
+U_BOOT_LONGHELP(bcb,
"load <interface> <dev> <part> - load BCB from <interface> <dev>:<part>\n"
"load <dev> <part> - load BCB from mmc <dev>:<part>\n"
"bcb set <field> <val> - set BCB <field> to <val>\n"
@@ -460,6 +454,27 @@
"bcb dump <field> - dump BCB <field>\n"
"bcb store - store BCB back to <interface>\n"
"\n"
+#if IS_ENABLED(CONFIG_ANDROID_AB)
+ "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"
+ "bcb ab_dump -\n"
+ " Dump boot_control information from specific partition.\n"
+ " <interface> <dev[:part|#part_name]>\n"
+ "\n"
+#endif
"Legend:\n"
"<interface> - storage device interface (virtio, mmc, etc)\n"
"<dev> - storage device index containing the BCB partition\n"
@@ -472,3 +487,17 @@
" NOTE: any ':' character in <val> will be replaced by line feed\n"
" during 'bcb set' and used as separator by upper layers\n"
);
+
+U_BOOT_CMD_WITH_SUBCMDS(bcb,
+ "Load/set/clear/test/dump/store Android BCB fields", bcb_help_text,
+ U_BOOT_SUBCMD_MKENT(load, 4, 1, do_bcb_load),
+ U_BOOT_SUBCMD_MKENT(set, 3, 1, do_bcb_set),
+ U_BOOT_SUBCMD_MKENT(clear, 2, 1, do_bcb_clear),
+ U_BOOT_SUBCMD_MKENT(test, 4, 1, do_bcb_test),
+ U_BOOT_SUBCMD_MKENT(dump, 2, 1, do_bcb_dump),
+ U_BOOT_SUBCMD_MKENT(store, 1, 1, do_bcb_store),
+#if IS_ENABLED(CONFIG_ANDROID_AB)
+ U_BOOT_SUBCMD_MKENT(ab_select, 5, 1, do_bcb_ab_select),
+ U_BOOT_SUBCMD_MKENT(ab_dump, 3, 1, do_bcb_ab_dump),
+#endif
+);
diff --git a/cmd/mem.c b/cmd/mem.c
index 4d6fde2..9e71677 100644
--- a/cmd/mem.c
+++ b/cmd/mem.c
@@ -1379,17 +1379,6 @@
#endif
-#ifdef CONFIG_CMD_MEMINFO
-static int do_mem_info(struct cmd_tbl *cmdtp, int flag, int argc,
- char *const argv[])
-{
- puts("DRAM: ");
- print_size(gd->ram_size, "\n");
-
- return 0;
-}
-#endif
-
U_BOOT_CMD(
base, 2, 1, do_mem_base,
"print or set address offset",
@@ -1433,14 +1422,6 @@
);
#endif /* CONFIG_CMD_MX_CYCLIC */
-#ifdef CONFIG_CMD_MEMINFO
-U_BOOT_CMD(
- meminfo, 3, 1, do_mem_info,
- "display memory information",
- ""
-);
-#endif
-
#ifdef CONFIG_CMD_RANDOM
U_BOOT_CMD(
random, 4, 0, do_random,
diff --git a/cmd/meminfo.c b/cmd/meminfo.c
new file mode 100644
index 0000000..5e83d61
--- /dev/null
+++ b/cmd/meminfo.c
@@ -0,0 +1,99 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright 2024 Google LLC
+ * Written by Simon Glass <sjg@chromium.org>
+ */
+
+#include <bloblist.h>
+#include <bootstage.h>
+#include <command.h>
+#include <display_options.h>
+#include <lmb.h>
+#include <malloc.h>
+#include <mapmem.h>
+#include <asm/global_data.h>
+
+DECLARE_GLOBAL_DATA_PTR;
+
+static void print_region(const char *name, ulong base, ulong size, ulong *uptop)
+{
+ ulong end = base + size;
+
+ printf("%-12s %8lx %8lx %8lx", name, base, size, end);
+ if (*uptop)
+ printf(" %8lx", *uptop - end);
+ putc('\n');
+ *uptop = base;
+}
+
+static void show_lmb(const struct lmb *lmb, ulong *uptop)
+{
+ int i;
+
+ for (i = lmb->used_mem.count - 1; i >= 0; i--) {
+ const struct lmb_region *rgn = alist_get(&lmb->used_mem, i,
+ struct lmb_region);
+
+ /*
+ * Assume that the top lmb region is the U-Boot region, so just
+ * take account of the memory not already reported
+ */
+ if (lmb->used_mem.count - 1)
+ print_region("lmb", rgn->base, *uptop - rgn->base,
+ uptop);
+ else
+ print_region("lmb", rgn->base, rgn->size, uptop);
+ *uptop = rgn->base;
+ }
+}
+
+static int do_meminfo(struct cmd_tbl *cmdtp, int flag, int argc,
+ char *const argv[])
+{
+ ulong upto, stk_bot;
+
+ puts("DRAM: ");
+ print_size(gd->ram_size, "\n");
+
+ if (!IS_ENABLED(CONFIG_CMD_MEMINFO_MAP))
+ return 0;
+
+ printf("\n%-12s %8s %8s %8s %8s\n", "Region", "Base", "Size", "End",
+ "Gap");
+ printf("------------------------------------------------\n");
+ upto = 0;
+ if (IS_ENABLED(CONFIG_VIDEO))
+ print_region("video", gd_video_bottom(),
+ gd_video_size(), &upto);
+ if (IS_ENABLED(CONFIG_TRACE))
+ print_region("trace", map_to_sysmem(gd_trace_buff()),
+ gd_trace_size(), &upto);
+ print_region("code", gd->relocaddr, gd->mon_len, &upto);
+ print_region("malloc", map_to_sysmem((void *)mem_malloc_start),
+ mem_malloc_end - mem_malloc_start, &upto);
+ print_region("board_info", map_to_sysmem(gd->bd),
+ sizeof(struct bd_info), &upto);
+ print_region("global_data", map_to_sysmem((void *)gd),
+ sizeof(struct global_data), &upto);
+ print_region("devicetree", map_to_sysmem(gd->fdt_blob),
+ fdt_totalsize(gd->fdt_blob), &upto);
+ if (IS_ENABLED(CONFIG_BOOTSTAGE))
+ print_region("bootstage", map_to_sysmem(gd_bootstage()),
+ bootstage_get_size(false), &upto);
+ if (IS_ENABLED(CONFIG_BLOBLIST))
+ print_region("bloblist", map_to_sysmem(gd_bloblist()),
+ bloblist_get_total_size(), &upto);
+ stk_bot = gd->start_addr_sp - CONFIG_STACK_SIZE;
+ print_region("stack", stk_bot, CONFIG_STACK_SIZE, &upto);
+ if (IS_ENABLED(CONFIG_LMB))
+ show_lmb(lmb_get(), &upto);
+ print_region("free", gd->ram_base, upto, &upto);
+
+ return 0;
+}
+
+U_BOOT_CMD(
+ meminfo, 1, 1, do_meminfo,
+ "display memory information",
+ ""
+);
diff --git a/common/board_f.c b/common/board_f.c
index f1bd70f..98dc259 100644
--- a/common/board_f.c
+++ b/common/board_f.c
@@ -501,9 +501,9 @@
static int reserve_noncached(void)
{
/*
- * The value of gd->start_addr_sp must match the value of malloc_start
- * calculated in board_r.c:initr_malloc(), which is passed to
- * dlmalloc.c:mem_malloc_init() and then used by
+ * The value of gd->start_addr_sp must match the value of
+ * mem_malloc_start calculated in board_r.c:initr_malloc(), which is
+ * passed to dlmalloc.c:mem_malloc_init() and then used by
* cache.c:noncached_init()
*
* These calculations must match the code in cache.c:noncached_init()
@@ -582,7 +582,7 @@
static int reserve_bootstage(void)
{
#ifdef CONFIG_BOOTSTAGE
- int size = bootstage_get_size();
+ int size = bootstage_get_size(true);
gd->start_addr_sp = reserve_stack_aligned(size);
gd->boardf->new_bootstage = map_sysmem(gd->start_addr_sp, size);
diff --git a/common/board_r.c b/common/board_r.c
index e5f33f4..8a19817 100644
--- a/common/board_r.c
+++ b/common/board_r.c
@@ -204,8 +204,7 @@
*/
start = gd->relocaddr - TOTAL_MALLOC_LEN;
gd_set_malloc_start(start);
- mem_malloc_init((ulong)map_sysmem(start, TOTAL_MALLOC_LEN),
- TOTAL_MALLOC_LEN);
+ mem_malloc_init(start, TOTAL_MALLOC_LEN);
return 0;
}
diff --git a/common/bootstage.c b/common/bootstage.c
index dd6aed7..c7bb204 100644
--- a/common/bootstage.c
+++ b/common/bootstage.c
@@ -520,17 +520,19 @@
}
#endif
-int bootstage_get_size(void)
+int bootstage_get_size(bool add_strings)
{
- struct bootstage_data *data = gd->bootstage;
- struct bootstage_record *rec;
int size;
- int i;
size = sizeof(struct bootstage_data);
- for (rec = data->record, i = 0; i < data->rec_count;
- i++, rec++)
- size += strlen(rec->name) + 1;
+ if (add_strings) {
+ struct bootstage_data *data = gd->bootstage;
+ struct bootstage_record *rec;
+ int i;
+
+ for (rec = data->record, i = 0; i < data->rec_count; i++, rec++)
+ size += strlen(rec->name) + 1;
+ }
return size;
}
diff --git a/common/dlmalloc.c b/common/dlmalloc.c
index 1ac7ce3..cc4d3a0 100644
--- a/common/dlmalloc.c
+++ b/common/dlmalloc.c
@@ -16,6 +16,8 @@
#include <asm/global_data.h>
#include <malloc.h>
+#include <mapmem.h>
+#include <string.h>
#include <asm/io.h>
#include <valgrind/memcheck.h>
@@ -598,9 +600,9 @@
void mem_malloc_init(ulong start, ulong size)
{
- mem_malloc_start = start;
- mem_malloc_end = start + size;
- mem_malloc_brk = start;
+ mem_malloc_start = (ulong)map_sysmem(start, size);
+ mem_malloc_end = mem_malloc_start + size;
+ mem_malloc_brk = mem_malloc_start;
#ifdef CONFIG_SYS_MALLOC_DEFAULT_TO_INIT
malloc_init();
diff --git a/common/spl/spl.c b/common/spl/spl.c
index 94657d0..1ceb63d 100644
--- a/common/spl/spl.c
+++ b/common/spl/spl.c
@@ -678,9 +678,7 @@
spl_set_bd();
if (IS_ENABLED(CONFIG_SPL_SYS_MALLOC)) {
- mem_malloc_init((ulong)map_sysmem(SPL_SYS_MALLOC_START,
- SPL_SYS_MALLOC_SIZE),
- SPL_SYS_MALLOC_SIZE);
+ mem_malloc_init(SPL_SYS_MALLOC_START, SPL_SYS_MALLOC_SIZE);
gd->flags |= GD_FLG_FULL_MALLOC_INIT;
}
if (!(gd->flags & GD_FLG_SPL_INIT)) {
diff --git a/configs/am57xx_evm_defconfig b/configs/am57xx_evm_defconfig
index efc154e..b793f00 100644
--- a/configs/am57xx_evm_defconfig
+++ b/configs/am57xx_evm_defconfig
@@ -48,7 +48,6 @@
CONFIG_SYS_I2C_EEPROM_ADDR_LEN=2
CONFIG_CMD_BCB=y
# CONFIG_CMD_SETEXPR is not set
-CONFIG_CMD_AB_SELECT=y
CONFIG_BOOTP_DNS2=y
# CONFIG_CMD_PMIC is not set
CONFIG_CMD_AVB=y
diff --git a/configs/am57xx_hs_evm_defconfig b/configs/am57xx_hs_evm_defconfig
index 0f8533e..5cacd7f 100644
--- a/configs/am57xx_hs_evm_defconfig
+++ b/configs/am57xx_hs_evm_defconfig
@@ -44,7 +44,6 @@
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/am57xx_hs_evm_usb_defconfig b/configs/am57xx_hs_evm_usb_defconfig
index 81a9383..2d8068e 100644
--- a/configs/am57xx_hs_evm_usb_defconfig
+++ b/configs/am57xx_hs_evm_usb_defconfig
@@ -46,7 +46,6 @@
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/amd_versal2_mini_defconfig b/configs/amd_versal2_mini_defconfig
index ec1921a..ea22541 100644
--- a/configs/amd_versal2_mini_defconfig
+++ b/configs/amd_versal2_mini_defconfig
@@ -22,6 +22,7 @@
CONFIG_SYS_MEMTEST_END=0x00001000
# CONFIG_EXPERT is not set
CONFIG_REMAKE_ELF=y
+# CONFIG_EFI_LOADER is not set
# CONFIG_LEGACY_IMAGE_FORMAT is not set
# CONFIG_AUTOBOOT is not set
# CONFIG_ARCH_FIXUP_FDT_MEMORY is not set
@@ -35,6 +36,7 @@
CONFIG_SYS_PROMPT="versal2> "
# CONFIG_CMD_CONSOLE is not set
# CONFIG_CMD_BOOTD is not set
+# CONFIG_CMD_BOOTM is not set
# CONFIG_CMD_BOOTI is not set
# CONFIG_CMD_ELF is not set
# CONFIG_CMD_FDT is not set
@@ -75,3 +77,4 @@
CONFIG_ARM_DCC=y
CONFIG_PL01X_SERIAL=y
# CONFIG_GZIP is not set
+# CONFIG_LMB is not set
diff --git a/configs/amd_versal2_mini_ospi_defconfig b/configs/amd_versal2_mini_ospi_defconfig
index 6c39443..71bd667 100644
--- a/configs/amd_versal2_mini_ospi_defconfig
+++ b/configs/amd_versal2_mini_ospi_defconfig
@@ -20,6 +20,7 @@
CONFIG_DEBUG_UART=y
# CONFIG_EXPERT is not set
CONFIG_REMAKE_ELF=y
+# CONFIG_EFI_LOADER is not set
# CONFIG_LEGACY_IMAGE_FORMAT is not set
# CONFIG_AUTOBOOT is not set
# CONFIG_ARCH_FIXUP_FDT_MEMORY is not set
@@ -33,6 +34,7 @@
CONFIG_SYS_PROMPT="versal2> "
# CONFIG_CMD_CONSOLE is not set
# CONFIG_CMD_BOOTD is not set
+# CONFIG_CMD_BOOTM is not set
# CONFIG_CMD_BOOTI is not set
# CONFIG_CMD_ELF is not set
# CONFIG_CMD_FDT is not set
@@ -82,3 +84,4 @@
CONFIG_CQSPI_REF_CLK=200000000
CONFIG_CADENCE_OSPI_VERSAL=y
# CONFIG_GZIP is not set
+# CONFIG_LMB is not set
diff --git a/configs/amd_versal2_mini_qspi_defconfig b/configs/amd_versal2_mini_qspi_defconfig
index 5c770a7..ee87d45 100644
--- a/configs/amd_versal2_mini_qspi_defconfig
+++ b/configs/amd_versal2_mini_qspi_defconfig
@@ -20,6 +20,7 @@
CONFIG_DEBUG_UART=y
# CONFIG_EXPERT is not set
CONFIG_REMAKE_ELF=y
+# CONFIG_EFI_LOADER is not set
# CONFIG_LEGACY_IMAGE_FORMAT is not set
# CONFIG_AUTOBOOT is not set
# CONFIG_ARCH_FIXUP_FDT_MEMORY is not set
@@ -33,6 +34,7 @@
CONFIG_SYS_PROMPT="versal2> "
# CONFIG_CMD_CONSOLE is not set
# CONFIG_CMD_BOOTD is not set
+# CONFIG_CMD_BOOTM is not set
# CONFIG_CMD_BOOTI is not set
# CONFIG_CMD_ELF is not set
# CONFIG_CMD_FDT is not set
@@ -62,7 +64,6 @@
# CONFIG_I2C is not set
# CONFIG_INPUT is not set
# CONFIG_MMC is not set
-CONFIG_MTD=y
CONFIG_DM_SPI_FLASH=y
# CONFIG_SPI_FLASH_LOCK is not set
CONFIG_SPI_FLASH_STMICRO=y
@@ -77,3 +78,4 @@
CONFIG_DM_SPI=y
CONFIG_ZYNQMP_GQSPI=y
# CONFIG_GZIP is not set
+# CONFIG_LMB is not set
diff --git a/configs/khadas-vim3_android_ab_defconfig b/configs/khadas-vim3_android_ab_defconfig
index 510fe4f..de5357c 100644
--- a/configs/khadas-vim3_android_ab_defconfig
+++ b/configs/khadas-vim3_android_ab_defconfig
@@ -47,7 +47,6 @@
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 d2da8ff..4d7b90f 100644
--- a/configs/khadas-vim3l_android_ab_defconfig
+++ b/configs/khadas-vim3l_android_ab_defconfig
@@ -47,7 +47,6 @@
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 1b3b8c6..b5f80b8 100644
--- a/configs/sandbox64_defconfig
+++ b/configs/sandbox64_defconfig
@@ -27,6 +27,7 @@
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_MEMINFO=y
CONFIG_CMD_MX_CYCLIC=y
CONFIG_CMD_MEMTEST=y
+CONFIG_CMD_BCB=y
CONFIG_CMD_CLK=y
CONFIG_CMD_DEMO=y
CONFIG_CMD_GPIO=y
diff --git a/configs/sandbox_defconfig b/configs/sandbox_defconfig
index f596f1c..d111858 100644
--- a/configs/sandbox_defconfig
+++ b/configs/sandbox_defconfig
@@ -103,7 +103,6 @@
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
diff --git a/doc/android/ab.rst b/doc/android/ab.rst
index 2adf887..7fd4aeb 100644
--- a/doc/android/ab.rst
+++ b/doc/android/ab.rst
@@ -18,7 +18,7 @@
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 @@
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 @@
.. 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/doc/usage/cmd/meminfo.rst b/doc/usage/cmd/meminfo.rst
new file mode 100644
index 0000000..6c94493
--- /dev/null
+++ b/doc/usage/cmd/meminfo.rst
@@ -0,0 +1,128 @@
+.. SPDX-License-Identifier: GPL-2.0+:
+
+.. index::
+ single: meminfo (command)
+
+meminfo command
+===============
+
+Synopsis
+--------
+
+::
+
+ meminfo
+
+Description
+-----------
+
+The meminfo command shows the amount of memory. If ``CONFIG_CMD_MEMINFO_MAP`` is
+enabled, then it also shows the layout of memory used by U-Boot and the region
+which is free for use by images.
+
+The layout of memory is set up before relocation, within the init sequence in
+``board_init_f()``, specifically the various ``reserve_...()`` functions. This
+'reservation' of memory starts from the top of RAM and proceeds downwards,
+ending with the stack. This results in the maximum possible amount of memory
+being left free for image-loading.
+
+The meminfo command writes the DRAM size, then the rest of its outputs in 5
+columns:
+
+Region
+ Name of the region
+
+Base
+ Base address of the region, i.e. where it starts in memory
+
+Size
+ Size of the region, which may be a little smaller than the actual size
+ reserved, e.g. due to alignment
+
+End
+ End of the region. The last byte of the region is one lower than the address
+ shown here
+
+Gap
+ Gap between the end of this region and the base of the one above
+
+Regions shown are:
+
+video
+ Memory reserved for video framebuffers. This reservation happens in the
+ bind() methods of all video drivers which are present before relocation,
+ so the size depends on that maximum amount of memory which all such drivers
+ want to reserve. This may be significantly greater than the amount actually
+ needed, if the display is ultimately set to a smaller resolution or colour
+ depth than the maximum supported.
+
+code
+ U-Boot's code and Block-Starting Symbol (BSS) region. Before relocation,
+ U-Boot copies its code to a high region and sets up a BSS immediately after
+ that. The size of this region is generally therefore ``__bss_end`` -
+ ``__image_copy_start``
+
+malloc
+ Contains the malloc() heap. The size of this is set by
+ ``CONFIG_SYS_MALLOC_LEN``.
+
+board_info
+ Contains the ``bd_info`` structure, with some information about the current
+ board.
+
+global_data
+ Contains the global-data structure, pointed to by ``gd``. This includes
+ various pointers, values and flags which control U-Boot.
+
+devicetree
+ Contains the flatted devicetree blob (FDT) being used by U-Boot to configure
+ itself and its devices.
+
+bootstage
+ Contains the bootstage records, which keep track of boot time as U-Boot
+ executes. The size of this is determined by
+ ``CONFIG_BOOTSTAGE_RECORD_COUNT``, with each record taking approximately
+ 32 bytes.
+
+bloblist
+ Contains the bloblist, which is a list of tables and other data created by
+ U-Boot while executed. The size of this is determined by
+ ``CONFIG_BLOBLIST_SIZE``.
+
+stack
+ Contains U-Boot's stack, growing downwards from the top. The nominal size of
+ this region is set by ``CONFIG_STACK_SIZE`` but there is no actual limit
+ enforced, so the stack can grow behind that. Images should be loaded lower
+ in memory to avoid any conflict.
+
+free
+ Free memory, which is available for loading images. The base address of
+ this is ``gd->ram_base`` which is generally set by ``CFG_SYS_SDRAM_BASE``.
+
+Example
+-------
+
+This example shows output with both ``CONFIG_CMD_MEMINFO`` and
+``CONFIG_CMD_MEMINFO_MAP`` enabled::
+
+ => meminfo
+ DRAM: 256 MiB
+
+ Region Base Size End Gap
+ ------------------------------------------------
+ video f000000 1000000 10000000
+ code ec3a000 3c5d28 efffd28 2d8
+ malloc 8c38000 6002000 ec3a000 0
+ board_info 8c37f90 68 8c37ff8 8
+ global_data 8c37d80 208 8c37f88 8
+ devicetree 8c33000 4d7d 8c37d7d 3
+ bootstage 8c32c20 3c8 8c32fe8 18
+ bloblist 8c32000 400 8c32400 820
+ stack 7c31ff0 1000000 8c31ff0 10
+ free 0 7c31ff0 7c31ff0 0
+
+
+Return value
+------------
+
+The return value $? is always 0 (true).
diff --git a/doc/usage/index.rst b/doc/usage/index.rst
index b84d8ee..db71711 100644
--- a/doc/usage/index.rst
+++ b/doc/usage/index.rst
@@ -84,6 +84,7 @@
cmd/loads
cmd/loadx
cmd/loady
+ cmd/meminfo
cmd/mbr
cmd/md
cmd/mmc
diff --git a/drivers/dfu/dfu_sf.c b/drivers/dfu/dfu_sf.c
index 7c1c0f9..8f7296a 100644
--- a/drivers/dfu/dfu_sf.c
+++ b/drivers/dfu/dfu_sf.c
@@ -123,6 +123,7 @@
unsigned int mode = CONFIG_SF_DEFAULT_MODE;
char *s, *endp;
struct spi_flash *dev;
+ bool use_dt = true;
s = strsep(&devstr, ":");
if (!s || !*s || (bus = simple_strtoul(s, &endp, 0), *endp)) {
@@ -143,6 +144,8 @@
printf("Invalid SPI speed %s\n", s);
return NULL;
}
+ if (IS_ENABLED(CONFIG_DM_SPI_FLASH))
+ use_dt = false;
}
s = strsep(&devstr, ":");
@@ -152,9 +155,20 @@
printf("Invalid SPI mode %s\n", s);
return NULL;
}
+ if (IS_ENABLED(CONFIG_DM_SPI_FLASH))
+ use_dt = false;
}
- dev = spi_flash_probe(bus, cs, speed, mode);
+ if (IS_ENABLED(CONFIG_DM_SPI_FLASH) && use_dt) {
+ struct udevice *new;
+
+ if (!spi_flash_probe_bus_cs(bus, cs, &new))
+ dev = dev_get_uclass_priv(new);
+ else
+ dev = NULL;
+ } else {
+ dev = spi_flash_probe(bus, cs, speed, mode);
+ }
if (!dev) {
printf("Failed to create SPI flash at %u:%u:%u:%u\n",
bus, cs, speed, mode);
diff --git a/drivers/spi/zynq_qspi.c b/drivers/spi/zynq_qspi.c
index f5b3fb5..4aad324 100644
--- a/drivers/spi/zynq_qspi.c
+++ b/drivers/spi/zynq_qspi.c
@@ -734,7 +734,7 @@
return 0;
}
-bool update_stripe(const struct spi_mem_op *op)
+static bool update_stripe(const struct spi_mem_op *op)
{
if (op->cmd.opcode == SPINOR_OP_BE_4K ||
op->cmd.opcode == SPINOR_OP_CHIP_ERASE ||
diff --git a/include/android_ab.h b/include/android_ab.h
index dbf2034..838230e 100644
--- a/include/android_ab.h
+++ b/include/android_ab.h
@@ -18,7 +18,10 @@
#define NUM_SLOTS 2
/**
- * Select the slot where to boot from.
+ * ab_select_slot() - Select the slot where to boot from.
+ *
+ * @dev_desc: Place to store the device description pointer
+ * @part_info: Place to store the partition information
*
* On Android devices with more than one boot slot (multiple copies of the
* kernel and system images) selects which slot should be used to boot from and
@@ -28,11 +31,19 @@
* registered before returning from this function so it isn't selected
* indefinitely.
*
- * @param[in] dev_desc Place to store the device description pointer
- * @param[in] part_info Place to store the partition information
* Return: The slot number (>= 0) on success, or a negative on error
*/
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 */
diff --git a/include/android_image.h b/include/android_image.h
index d503c98..9682070 100644
--- a/include/android_image.h
+++ b/include/android_image.h
@@ -348,7 +348,7 @@
ulong bootconfig_addr; /* bootconfig image address */
ulong bootconfig_size; /* bootconfig image size */
- u32 kernel_addr; /* physical load addr */
+ ulong kernel_addr; /* physical load addr */
ulong ramdisk_addr; /* physical load addr */
ulong ramdisk_ptr; /* ramdisk address */
ulong dtb_load_addr; /* physical load address for DTB image */
diff --git a/include/asm-generic/global_data.h b/include/asm-generic/global_data.h
index b84cc5b..bf593d9 100644
--- a/include/asm-generic/global_data.h
+++ b/include/asm-generic/global_data.h
@@ -543,6 +543,36 @@
#define gd_set_upl(val)
#endif
+#if CONFIG_IS_ENABLED(BLOBLIST)
+#define gd_bloblist() gd->bloblist
+#else
+#define gd_bloblist() NULL
+#endif
+
+#if CONFIG_IS_ENABLED(BOOTSTAGE)
+#define gd_bootstage() gd->bootstage
+#else
+#define gd_bootstage() NULL
+#endif
+
+#if CONFIG_IS_ENABLED(TRACE)
+#define gd_trace_buff() gd->trace_buff
+#define gd_trace_size() CONFIG_TRACE_BUFFER_SIZE
+#else
+#define gd_trace_buff() NULL
+#define gd_trace_size() 0
+#endif
+
+#if CONFIG_IS_ENABLED(VIDEO)
+#define gd_video_top() gd->video_top
+#define gd_video_bottom() gd->video_bottom
+#define gd_video_size() (gd->video_top - gd->video_bottom)
+#else
+#define gd_video_top() 0
+#define gd_video_bottom() 0
+#define gd_video_size() 0
+#endif
+
/**
* enum gd_flags - global data flags
*
diff --git a/include/bootstage.h b/include/bootstage.h
index 5779264..3300ca0 100644
--- a/include/bootstage.h
+++ b/include/bootstage.h
@@ -371,9 +371,10 @@
/**
* bootstage_get_size() - Get the size of the bootstage data
*
+ * @add_strings: true to add the size of attached strings (for stashing)
* Return: size of boostage data in bytes
*/
-int bootstage_get_size(void);
+int bootstage_get_size(bool add_strings);
/**
* bootstage_init() - Prepare bootstage for use
@@ -444,7 +445,7 @@
return 0; /* Pretend to succeed */
}
-static inline int bootstage_get_size(void)
+static inline int bootstage_get_size(bool add_strings)
{
return 0;
}
diff --git a/include/configs/khadas-vim3_android.h b/include/configs/khadas-vim3_android.h
index b76e049..fc89efb 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 0ab8ffd..5b2aed1 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 fa52026..77364bb 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 26494ae..26b6c1c 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/include/configs/xilinx_versal.h b/include/configs/xilinx_versal.h
index dc3f41b..64f1234 100644
--- a/include/configs/xilinx_versal.h
+++ b/include/configs/xilinx_versal.h
@@ -48,6 +48,12 @@
# define BOOT_TARGET_DEVICES_MMC(func)
#endif
+#if defined(CONFIG_USB_STORAGE)
+# define BOOT_TARGET_DEVICES_USB(func) func(USB, usb, 0)
+#else
+# define BOOT_TARGET_DEVICES_USB(func)
+#endif
+
#if defined(CONFIG_CMD_PXE) && defined(CONFIG_CMD_DHCP)
# define BOOT_TARGET_DEVICES_PXE(func) func(PXE, pxe, na)
#else
@@ -85,7 +91,7 @@
"jtag "
#define BOOT_TARGET_DEVICES_USB_DFU(func) \
- func(USB_DFU, usb_dfu, 0) func(USB_DFU, usb_dfu, 1)
+ func(USB_DFU, usb_dfu, 0)
#define BOOTENV_DEV_USB_DFU(devtypeu, devtypel, instance) \
"bootcmd_" #devtypel #instance "=setenv dfu_alt_info boot.scr ram " \
@@ -99,7 +105,7 @@
""
#define BOOT_TARGET_DEVICES_USB_THOR(func) \
- func(USB_THOR, usb_thor, 0) func(USB_THOR, usb_thor, 1)
+ func(USB_THOR, usb_thor, 0)
#define BOOTENV_DEV_USB_THOR(devtypeu, devtypel, instance) \
"bootcmd_" #devtypel #instance "=setenv dfu_alt_info boot.scr ram " \
@@ -118,6 +124,7 @@
BOOT_TARGET_DEVICES_XSPI(func) \
BOOT_TARGET_DEVICES_USB_DFU(func) \
BOOT_TARGET_DEVICES_USB_THOR(func) \
+ BOOT_TARGET_DEVICES_USB(func) \
BOOT_TARGET_DEVICES_PXE(func) \
BOOT_TARGET_DEVICES_DHCP(func)
diff --git a/include/malloc.h b/include/malloc.h
index 07d3e90..9e0be48 100644
--- a/include/malloc.h
+++ b/include/malloc.h
@@ -981,6 +981,14 @@
extern ulong mem_malloc_end;
extern ulong mem_malloc_brk;
+/**
+ * mem_malloc_init() - Set up the malloc() pool
+ *
+ * Sets the region of memory to be used for all future calls to malloc(), etc.
+ *
+ * @start: Start address
+ * @size: Size in bytes
+ */
void mem_malloc_init(ulong start, ulong size);
#ifdef __cplusplus
diff --git a/include/spi_flash.h b/include/spi_flash.h
index 10d19fd..2e703e8 100644
--- a/include/spi_flash.h
+++ b/include/spi_flash.h
@@ -139,6 +139,40 @@
void sandbox_sf_unbind_emul(struct sandbox_state *state, int busnum, int cs);
#else
+/* Compatibility functions for when DM_SPI_FLASH is disabled */
+static inline int spi_flash_probe_bus_cs(unsigned int busnum, unsigned int cs,
+ struct udevice **devp)
+{
+ return -ENODEV;
+}
+
+static inline int spi_flash_read_dm(struct udevice *dev, u32 offset, size_t len,
+ void *buf)
+{
+ return -ENODEV;
+}
+
+static inline int spi_flash_write_dm(struct udevice *dev, u32 offset, size_t len,
+ const void *buf)
+{
+ return -ENODEV;
+}
+
+static inline int spi_flash_erase_dm(struct udevice *dev, u32 offset, size_t len)
+{
+ return -ENODEV;
+}
+
+static inline int spl_flash_get_sw_write_prot(struct udevice *dev)
+{
+ return -ENODEV;
+}
+
+static inline int spi_flash_std_probe(struct udevice *dev)
+{
+ return -ENODEV;
+}
+
struct spi_flash *spi_flash_probe(unsigned int bus, unsigned int cs,
unsigned int max_hz, unsigned int spi_mode);
diff --git a/lib/lmb.c b/lib/lmb.c
index 7e90f17..eec99c1 100644
--- a/lib/lmb.c
+++ b/lib/lmb.c
@@ -887,12 +887,12 @@
return 0;
}
-#if CONFIG_IS_ENABLED(UNIT_TEST)
struct lmb *lmb_get(void)
{
return &lmb;
}
+#if CONFIG_IS_ENABLED(UNIT_TEST)
int lmb_push(struct lmb *store)
{
int ret;
diff --git a/test/cmd/Makefile b/test/cmd/Makefile
index 4080835..4b487c1 100644
--- a/test/cmd/Makefile
+++ b/test/cmd/Makefile
@@ -19,8 +19,9 @@
obj-$(CONFIG_CONSOLE_TRUETYPE) += font.o
obj-$(CONFIG_CMD_HISTORY) += history.o
obj-$(CONFIG_CMD_LOADM) += loadm.o
-obj-$(CONFIG_CMD_MEM_SEARCH) += mem_search.o
+obj-$(CONFIG_CMD_MEMINFO) += meminfo.o
obj-$(CONFIG_CMD_MEMORY) += mem_copy.o
+obj-$(CONFIG_CMD_MEM_SEARCH) += mem_search.o
ifdef CONFIG_CMD_PCI
obj-$(CONFIG_CMD_PCI_MPS) += pci_mps.o
endif
diff --git a/test/cmd/meminfo.c b/test/cmd/meminfo.c
new file mode 100644
index 0000000..53b41e3
--- /dev/null
+++ b/test/cmd/meminfo.c
@@ -0,0 +1,42 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Test for 'meminfo' command
+ *
+ * Copyright 2024 Google LLC
+ * Written by Simon Glass <sjg@chromium.org>
+ */
+
+#include <dm/test.h>
+#include <test/cmd.h>
+#include <test/ut.h>
+
+/* Test 'meminfo' command */
+static int cmd_test_meminfo(struct unit_test_state *uts)
+{
+ ut_assertok(run_command("meminfo", 0));
+ ut_assert_nextline("DRAM: 256 MiB");
+ ut_assert_nextline_empty();
+
+ ut_assert_nextline("Region Base Size End Gap");
+ ut_assert_nextlinen("-");
+
+ /* For now we don't worry about checking the values */
+ ut_assert_nextlinen("video");
+ ut_assert_nextlinen("code");
+ ut_assert_nextlinen("malloc");
+ ut_assert_nextlinen("board_info");
+ ut_assert_nextlinen("global_data");
+ ut_assert_nextlinen("devicetree");
+ ut_assert_nextlinen("bootstage");
+ ut_assert_nextlinen("bloblist");
+ ut_assert_nextlinen("stack");
+
+ /* we expect at least one lmb line, but don't know how many */
+ ut_assert_nextlinen("lmb");
+ ut_assert_skip_to_linen("free");
+
+ ut_assert_console_end();
+
+ return 0;
+}
+CMD_TEST(cmd_test_meminfo, UTF_CONSOLE);
diff --git a/test/py/tests/test_android/test_ab.py b/test/py/tests/test_android/test_ab.py
index c79cb07..9bf1a0e 100644
--- a/test/py/tests/test_android/test_ab.py
+++ b/test/py/tests/test_android/test_ab.py
@@ -54,22 +54,45 @@
di = ABTestDiskImage(u_boot_console)
return di
+def ab_dump(u_boot_console, slot_num, crc):
+ output = u_boot_console.run_command('bcb ab_dump host 0#misc')
+ header, slot0, slot1 = output.split('\r\r\n\r\r\n')
+ slots = [slot0, slot1]
+ slot_suffixes = ['_a', '_b']
+
+ header = dict(map(lambda x: map(str.strip, x.split(':')), header.split('\r\r\n')))
+ assert header['Bootloader Control'] == '[misc]'
+ assert header['Active Slot'] == slot_suffixes[slot_num]
+ assert header['Magic Number'] == '0x42414342'
+ assert header['Version'] == '1'
+ assert header['Number of Slots'] == '2'
+ assert header['Recovery Tries Remaining'] == '0'
+ assert header['CRC'] == '{} (Valid)'.format(crc)
+
+ slot = dict(map(lambda x: map(str.strip, x.split(':')), slots[slot_num].split('\r\r\n\t- ')[1:]))
+ assert slot['Priority'] == '15'
+ assert slot['Tries Remaining'] == '6'
+ assert slot['Successful Boot'] == '0'
+ assert slot['Verity Corrupted'] == '0'
+
@pytest.mark.boardspec('sandbox')
@pytest.mark.buildconfigspec('android_ab')
-@pytest.mark.buildconfigspec('cmd_ab_select')
+@pytest.mark.buildconfigspec('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
+ ab_dump(u_boot_console, 0, '0xd438d1b9')
- 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
+ ab_dump(u_boot_console, 1, '0x011ec016')