[PATCH v2 0/9] Qualcomm cleanups / preparations

This series brings a couple of (hopefully) "nice" cleanups in preparation for a couple of new boards as well as using upstream Linux device trees with U-Boot.
Changes since v1: - Account for all driver changes in all board device trees (man, are they hard to track without a common prefix or directory..) - Update the GENI serial bindings after compatible change - Bind GENI before relocation (new patch) - Drop pre-reloc from /soc (new patch) - Switch to b4 for sending, hopefully nothing goes south (sorry, but I can't stand this patman thing of yours..)
Compile-tested with:
declare -a boards=("dragonboard410c" "dragonboard820c" "dragonboard845c" "qcs404evb" "starqltechn") # no IPQ4019 boards in uboot dts??
do_make() { make ARCH=arm CROSS_COMPILE=aarch64-linux-gnu- -j$(nproc) $1 }
compile () { do_make mrproper do_make $1_defconfig do_make }
set -e
for board in "${boards[@]}"; do compile $board done
Signed-off-by: Konrad Dybcio konrad.dybcio@linaro.org --- Konrad Dybcio (9): mmc: msm_sdhci: Match clocks through "clocks" property serial: msm: Match clocks through "clocks" property serial: msm_geni: Use upstream Linux bindings serial: msm: Always bind before relocation arch: snapdragon: clock: Always bind before relocation arm: snapdragon: pinctrl: Always bind before relocation serial: msm_geni: Always bind before relocation arm: dts: qcom*: Don't specify u-boot,dm-pre-reloc redundantly arm: Migrate Apple M1 to save_prev_bl_data
arch/arm/dts/dragonboard410c-uboot.dtsi | 20 -------------------- arch/arm/dts/dragonboard410c.dts | 6 +++--- arch/arm/dts/dragonboard820c-uboot.dtsi | 20 -------------------- arch/arm/dts/dragonboard820c.dts | 4 ++-- arch/arm/dts/dragonboard845c-uboot.dtsi | 19 ------------------- arch/arm/dts/qcom-ipq4019.dtsi | 5 +---- arch/arm/dts/qcs404-evb-uboot.dtsi | 18 ------------------ arch/arm/dts/qcs404-evb.dts | 8 ++++---- arch/arm/dts/sdm845.dtsi | 4 ++-- arch/arm/dts/starqltechn-uboot.dtsi | 15 --------------- arch/arm/lib/save_prev_bl_data.c | 14 +++++++------- arch/arm/mach-apple/Makefile | 1 - arch/arm/mach-apple/lowlevel_init.S | 17 ----------------- arch/arm/mach-snapdragon/clock-snapdragon.c | 1 + arch/arm/mach-snapdragon/pinctrl-snapdragon.c | 1 + configs/apple_m1_defconfig | 1 + doc/device-tree-bindings/serial/msm-geni-serial.txt | 2 +- drivers/mmc/msm_sdhci.c | 2 +- drivers/serial/serial_msm.c | 4 ++-- drivers/serial/serial_msm_geni.c | 7 +++++-- 20 files changed, 31 insertions(+), 138 deletions(-) --- base-commit: 8be7b4629e87ff8db08dd087c81d58129d029bad change-id: 20230327-qc_cleanups-f120edceab84
Best regards,

"clocks" is the standard property used in Linux, "clock" seems to be an U-Boot invention. Use the one that's more standardized.
Signed-off-by: Konrad Dybcio konrad.dybcio@linaro.org --- arch/arm/dts/dragonboard410c.dts | 4 ++-- arch/arm/dts/dragonboard820c.dts | 2 +- arch/arm/dts/qcs404-evb.dts | 4 ++-- drivers/mmc/msm_sdhci.c | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/arch/arm/dts/dragonboard410c.dts b/arch/arm/dts/dragonboard410c.dts index 9230dd3fd96c..99391df13080 100644 --- a/arch/arm/dts/dragonboard410c.dts +++ b/arch/arm/dts/dragonboard410c.dts @@ -107,7 +107,7 @@ bus-width = <0x8>; index = <0x0>; non-removable; - clock = <&clkc 0>; + clocks = <&clkc 0>; clock-frequency = <100000000>; };
@@ -116,7 +116,7 @@ reg = <0x7864900 0x11c 0x7864000 0x800>; index = <0x1>; bus-width = <0x4>; - clock = <&clkc 1>; + clocks = <&clkc 1>; clock-frequency = <200000000>; cd-gpios = <&soc_gpios 38 GPIO_ACTIVE_LOW>; }; diff --git a/arch/arm/dts/dragonboard820c.dts b/arch/arm/dts/dragonboard820c.dts index ad201d48749c..9c234d81c1ee 100644 --- a/arch/arm/dts/dragonboard820c.dts +++ b/arch/arm/dts/dragonboard820c.dts @@ -88,7 +88,7 @@ reg = <0x74a4900 0x314>, <0x74a4000 0x800>; index = <0x0>; bus-width = <4>; - clock = <&gcc 0>; + clocks = <&gcc 0>; clock-frequency = <200000000>; };
diff --git a/arch/arm/dts/qcs404-evb.dts b/arch/arm/dts/qcs404-evb.dts index 8d7893c11695..d973aa13169c 100644 --- a/arch/arm/dts/qcs404-evb.dts +++ b/arch/arm/dts/qcs404-evb.dts @@ -229,8 +229,8 @@ sdhci@7804000 { compatible = "qcom,sdhci-msm-v5"; reg = <0x7804000 0x1000 0x7805000 0x1000>; - clock = <&gcc GCC_SDCC1_APPS_CLK>, - <&gcc GCC_SDCC1_AHB_CLK>; + clocks = <&gcc GCC_SDCC1_APPS_CLK>, + <&gcc GCC_SDCC1_AHB_CLK>; bus-width = <0x8>; index = <0x0>; non-removable; diff --git a/drivers/mmc/msm_sdhci.c b/drivers/mmc/msm_sdhci.c index 604f9c3ff99c..174435f01f68 100644 --- a/drivers/mmc/msm_sdhci.c +++ b/drivers/mmc/msm_sdhci.c @@ -63,7 +63,7 @@ static int msm_sdc_clk_init(struct udevice *dev) struct clk clk; int ret;
- ret = fdtdec_get_int_array(gd->fdt_blob, node, "clock", clkd, 2); + ret = fdtdec_get_int_array(gd->fdt_blob, node, "clocks", clkd, 2); if (ret) return ret;

"clocks" is the standard property used in Linux, "clock" seems to be an U-Boot invention. Use the one that's more standardized.
Signed-off-by: Konrad Dybcio konrad.dybcio@linaro.org --- arch/arm/dts/dragonboard410c.dts | 2 +- arch/arm/dts/dragonboard820c.dts | 2 +- arch/arm/dts/qcom-ipq4019.dtsi | 2 +- arch/arm/dts/qcs404-evb.dts | 4 ++-- drivers/serial/serial_msm.c | 3 +-- 5 files changed, 6 insertions(+), 7 deletions(-)
diff --git a/arch/arm/dts/dragonboard410c.dts b/arch/arm/dts/dragonboard410c.dts index 99391df13080..7ef2e779661a 100644 --- a/arch/arm/dts/dragonboard410c.dts +++ b/arch/arm/dts/dragonboard410c.dts @@ -84,7 +84,7 @@ serial@78b0000 { compatible = "qcom,msm-uartdm-v1.4"; reg = <0x78b0000 0x200>; - clock = <&clkc 4>; + clocks = <&clkc 4>; pinctrl-names = "uart"; pinctrl-0 = <&blsp1_uart>; }; diff --git a/arch/arm/dts/dragonboard820c.dts b/arch/arm/dts/dragonboard820c.dts index 9c234d81c1ee..d381d7fb9fdf 100644 --- a/arch/arm/dts/dragonboard820c.dts +++ b/arch/arm/dts/dragonboard820c.dts @@ -78,7 +78,7 @@ blsp2_uart2: serial@75b0000 { compatible = "qcom,msm-uartdm-v1.4", "qcom,msm-uartdm"; reg = <0x75b0000 0x1000>; - clock = <&gcc 4>; + clocks = <&gcc 4>; pinctrl-names = "uart"; pinctrl-0 = <&blsp8_uart>; }; diff --git a/arch/arm/dts/qcom-ipq4019.dtsi b/arch/arm/dts/qcom-ipq4019.dtsi index 6edc69da6747..dee3159e5893 100644 --- a/arch/arm/dts/qcom-ipq4019.dtsi +++ b/arch/arm/dts/qcom-ipq4019.dtsi @@ -87,7 +87,7 @@ blsp1_uart1: serial@78af000 { compatible = "qcom,msm-uartdm-v1.4", "qcom,msm-uartdm"; reg = <0x78af000 0x200>; - clock = <&gcc GCC_BLSP1_UART1_APPS_CLK>; + clocks = <&gcc GCC_BLSP1_UART1_APPS_CLK>; bit-rate = <0xFF>; status = "disabled"; u-boot,dm-pre-reloc; diff --git a/arch/arm/dts/qcs404-evb.dts b/arch/arm/dts/qcs404-evb.dts index d973aa13169c..5ed147415661 100644 --- a/arch/arm/dts/qcs404-evb.dts +++ b/arch/arm/dts/qcs404-evb.dts @@ -219,8 +219,8 @@ debug_uart: serial@78b1000 { compatible = "qcom,msm-uartdm-v1.4"; reg = <0x78b1000 0x200>; - clock = <&gcc GCC_BLSP1_UART2_APPS_CLK>, - <&gcc GCC_BLSP1_AHB_CLK>; + clocks = <&gcc GCC_BLSP1_UART2_APPS_CLK>, + <&gcc GCC_BLSP1_AHB_CLK>; bit-rate = <0xFF>; pinctrl-names = "uart"; pinctrl-0 = <&blsp1_uart2>; diff --git a/drivers/serial/serial_msm.c b/drivers/serial/serial_msm.c index a22623c316ed..9c370cac323f 100644 --- a/drivers/serial/serial_msm.c +++ b/drivers/serial/serial_msm.c @@ -166,8 +166,7 @@ static int msm_uart_clk_init(struct udevice *dev) struct clk clk; int ret;
- ret = fdtdec_get_int_array(gd->fdt_blob, dev_of_offset(dev), "clock", - clkd, 2); + ret = fdtdec_get_int_array(gd->fdt_blob, dev_of_offset(dev), "clocks", clkd, 2); if (ret) return ret;

The name "se" is used in upstream Linux device trees and has been for ages, long before this U-Boot-ism was introduced. Same goes for the existing compatible. Get rid of that.
Signed-off-by: Konrad Dybcio konrad.dybcio@linaro.org --- arch/arm/dts/sdm845.dtsi | 4 ++-- doc/device-tree-bindings/serial/msm-geni-serial.txt | 2 +- drivers/serial/serial_msm_geni.c | 6 ++++-- 3 files changed, 7 insertions(+), 5 deletions(-)
diff --git a/arch/arm/dts/sdm845.dtsi b/arch/arm/dts/sdm845.dtsi index 607af277f8be..92bdc82177d6 100644 --- a/arch/arm/dts/sdm845.dtsi +++ b/arch/arm/dts/sdm845.dtsi @@ -52,10 +52,10 @@ };
debug_uart: serial@a84000 { - compatible = "qcom,msm-geni-uart"; + compatible = "qcom,geni-debug-uart"; reg = <0xa84000 0x4000>; reg-names = "se_phys"; - clock-names = "se-clk"; + clock-names = "se"; clocks = <&gcc GCC_QUPV3_WRAP1_S1_CLK>; pinctrl-names = "default"; pinctrl-0 = <&qup_uart9>; diff --git a/doc/device-tree-bindings/serial/msm-geni-serial.txt b/doc/device-tree-bindings/serial/msm-geni-serial.txt index 9eadc2561b4b..eaa39c949b10 100644 --- a/doc/device-tree-bindings/serial/msm-geni-serial.txt +++ b/doc/device-tree-bindings/serial/msm-geni-serial.txt @@ -1,6 +1,6 @@ Qualcomm GENI UART
Required properties: -- compatible: must be "qcom,msm-geni-uart" +- compatible: must be "qcom,geni-debug-uart" - reg: start address and size of the registers - clock: interface clock (must accept baudrate as a frequency) diff --git a/drivers/serial/serial_msm_geni.c b/drivers/serial/serial_msm_geni.c index 3943ca43e49e..6c9371c4e69d 100644 --- a/drivers/serial/serial_msm_geni.c +++ b/drivers/serial/serial_msm_geni.c @@ -189,7 +189,7 @@ static int geni_serial_set_clock_rate(struct udevice *dev, u64 rate) struct clk *clk; int ret;
- clk = devm_clk_get(dev, "se-clk"); + clk = devm_clk_get(dev, "se"); if (!clk) return -EINVAL;
@@ -554,7 +554,9 @@ static int msm_serial_ofdata_to_platdata(struct udevice *dev) }
static const struct udevice_id msm_serial_ids[] = { - {.compatible = "qcom,msm-geni-uart"}, {}}; + { .compatible = "qcom,geni-debug-uart" }, + { } +};
U_BOOT_DRIVER(serial_msm_geni) = { .name = "serial_msm_geni",

In preparation for supporting upstream Linux device trees on Qualcomm platforms, make this the default behavior.
Signed-off-by: Konrad Dybcio konrad.dybcio@linaro.org --- arch/arm/dts/dragonboard410c-uboot.dtsi | 4 ---- arch/arm/dts/dragonboard820c-uboot.dtsi | 4 ---- arch/arm/dts/qcom-ipq4019.dtsi | 1 - arch/arm/dts/qcs404-evb-uboot.dtsi | 4 ---- drivers/serial/serial_msm.c | 1 + 5 files changed, 1 insertion(+), 13 deletions(-)
diff --git a/arch/arm/dts/dragonboard410c-uboot.dtsi b/arch/arm/dts/dragonboard410c-uboot.dtsi index e4fecaa19e64..1d7b31d7e267 100644 --- a/arch/arm/dts/dragonboard410c-uboot.dtsi +++ b/arch/arm/dts/dragonboard410c-uboot.dtsi @@ -25,10 +25,6 @@ qcom,gcc@1800000 { u-boot,dm-pre-reloc; }; - - serial@78b0000 { - u-boot,dm-pre-reloc; - }; }; };
diff --git a/arch/arm/dts/dragonboard820c-uboot.dtsi b/arch/arm/dts/dragonboard820c-uboot.dtsi index 2270ac73bfca..5db30b5fb076 100644 --- a/arch/arm/dts/dragonboard820c-uboot.dtsi +++ b/arch/arm/dts/dragonboard820c-uboot.dtsi @@ -24,10 +24,6 @@ clock-controller@300000 { u-boot,dm-pre-reloc; }; - - serial@75b0000 { - u-boot,dm-pre-reloc; - }; }; };
diff --git a/arch/arm/dts/qcom-ipq4019.dtsi b/arch/arm/dts/qcom-ipq4019.dtsi index dee3159e5893..22a4e059f057 100644 --- a/arch/arm/dts/qcom-ipq4019.dtsi +++ b/arch/arm/dts/qcom-ipq4019.dtsi @@ -90,7 +90,6 @@ clocks = <&gcc GCC_BLSP1_UART1_APPS_CLK>; bit-rate = <0xFF>; status = "disabled"; - u-boot,dm-pre-reloc; };
blsp1_spi1: spi@78b5000 { diff --git a/arch/arm/dts/qcs404-evb-uboot.dtsi b/arch/arm/dts/qcs404-evb-uboot.dtsi index c73d71e8c7c1..d77ae0fa930e 100644 --- a/arch/arm/dts/qcs404-evb-uboot.dtsi +++ b/arch/arm/dts/qcs404-evb-uboot.dtsi @@ -16,10 +16,6 @@ clock-controller@1800000 { u-boot,dm-pre-reloc; }; - - serial@78b1000 { - u-boot,dm-pre-reloc; - }; }; };
diff --git a/drivers/serial/serial_msm.c b/drivers/serial/serial_msm.c index 9c370cac323f..59a2cf27aaf1 100644 --- a/drivers/serial/serial_msm.c +++ b/drivers/serial/serial_msm.c @@ -251,4 +251,5 @@ U_BOOT_DRIVER(serial_msm) = { .priv_auto = sizeof(struct msm_serial_data), .probe = msm_serial_probe, .ops = &msm_serial_ops, + .flags = DM_FLAG_PRE_RELOC, };

In preparation for supporting upstream Linux device trees on Qualcomm platforms, make this the default behavior.
Signed-off-by: Konrad Dybcio konrad.dybcio@linaro.org --- arch/arm/dts/dragonboard410c-uboot.dtsi | 4 ---- arch/arm/dts/dragonboard820c-uboot.dtsi | 4 ---- arch/arm/dts/dragonboard845c-uboot.dtsi | 4 ---- arch/arm/dts/qcom-ipq4019.dtsi | 1 - arch/arm/dts/qcs404-evb-uboot.dtsi | 4 ---- arch/arm/dts/starqltechn-uboot.dtsi | 3 --- arch/arm/mach-snapdragon/clock-snapdragon.c | 1 + 7 files changed, 1 insertion(+), 20 deletions(-)
diff --git a/arch/arm/dts/dragonboard410c-uboot.dtsi b/arch/arm/dts/dragonboard410c-uboot.dtsi index 1d7b31d7e267..1a7c25c704d4 100644 --- a/arch/arm/dts/dragonboard410c-uboot.dtsi +++ b/arch/arm/dts/dragonboard410c-uboot.dtsi @@ -21,10 +21,6 @@ u-boot,dm-pre-reloc; }; }; - - qcom,gcc@1800000 { - u-boot,dm-pre-reloc; - }; }; };
diff --git a/arch/arm/dts/dragonboard820c-uboot.dtsi b/arch/arm/dts/dragonboard820c-uboot.dtsi index 5db30b5fb076..7daee3789f96 100644 --- a/arch/arm/dts/dragonboard820c-uboot.dtsi +++ b/arch/arm/dts/dragonboard820c-uboot.dtsi @@ -20,10 +20,6 @@ u-boot,dm-pre-reloc; }; }; - - clock-controller@300000 { - u-boot,dm-pre-reloc; - }; }; };
diff --git a/arch/arm/dts/dragonboard845c-uboot.dtsi b/arch/arm/dts/dragonboard845c-uboot.dtsi index 8b5a7ee573b3..60adcca00b5c 100644 --- a/arch/arm/dts/dragonboard845c-uboot.dtsi +++ b/arch/arm/dts/dragonboard845c-uboot.dtsi @@ -15,10 +15,6 @@ u-boot,dm-pre-reloc; };
- clock-controller@100000 { - u-boot,dm-pre-reloc; - }; - pinctrl_north@3900000 { u-boot,dm-pre-reloc; }; diff --git a/arch/arm/dts/qcom-ipq4019.dtsi b/arch/arm/dts/qcom-ipq4019.dtsi index 22a4e059f057..2fcab5412147 100644 --- a/arch/arm/dts/qcom-ipq4019.dtsi +++ b/arch/arm/dts/qcom-ipq4019.dtsi @@ -56,7 +56,6 @@ reg = <0x1800000 0x60000>; #clock-cells = <1>; #reset-cells = <1>; - u-boot,dm-pre-reloc; };
rng: rng@22000 { diff --git a/arch/arm/dts/qcs404-evb-uboot.dtsi b/arch/arm/dts/qcs404-evb-uboot.dtsi index d77ae0fa930e..afa711ad979c 100644 --- a/arch/arm/dts/qcs404-evb-uboot.dtsi +++ b/arch/arm/dts/qcs404-evb-uboot.dtsi @@ -12,10 +12,6 @@ pinctrl_north@1300000 { u-boot,dm-pre-reloc; }; - - clock-controller@1800000 { - u-boot,dm-pre-reloc; - }; }; };
diff --git a/arch/arm/dts/starqltechn-uboot.dtsi b/arch/arm/dts/starqltechn-uboot.dtsi index 8d5d09c3a509..8e3cf3829421 100644 --- a/arch/arm/dts/starqltechn-uboot.dtsi +++ b/arch/arm/dts/starqltechn-uboot.dtsi @@ -16,9 +16,6 @@ serial@a84000 { u-boot,dm-pre-reloc; }; - clock-controller@100000 { - u-boot,dm-pre-reloc; - }; gpio_north@3900000 { u-boot,dm-pre-reloc; }; diff --git a/arch/arm/mach-snapdragon/clock-snapdragon.c b/arch/arm/mach-snapdragon/clock-snapdragon.c index 0ac45dce9a92..d1af5d1fec7d 100644 --- a/arch/arm/mach-snapdragon/clock-snapdragon.c +++ b/arch/arm/mach-snapdragon/clock-snapdragon.c @@ -178,4 +178,5 @@ U_BOOT_DRIVER(clk_msm) = { .ops = &msm_clk_ops, .priv_auto = sizeof(struct msm_clk_priv), .probe = msm_clk_probe, + .flags = DM_FLAG_PRE_RELOC, };

In preparation for supporting upstream Linux device trees on Qualcomm platforms, make this the default behavior.
Signed-off-by: Konrad Dybcio konrad.dybcio@linaro.org --- arch/arm/dts/dragonboard410c-uboot.dtsi | 8 -------- arch/arm/dts/dragonboard820c-uboot.dtsi | 8 -------- arch/arm/dts/dragonboard845c-uboot.dtsi | 4 ---- arch/arm/dts/qcom-ipq4019.dtsi | 1 - arch/arm/dts/qcs404-evb-uboot.dtsi | 4 ---- arch/arm/dts/starqltechn-uboot.dtsi | 6 ------ arch/arm/mach-snapdragon/pinctrl-snapdragon.c | 1 + 7 files changed, 1 insertion(+), 31 deletions(-)
diff --git a/arch/arm/dts/dragonboard410c-uboot.dtsi b/arch/arm/dts/dragonboard410c-uboot.dtsi index 1a7c25c704d4..ca00b49bc844 100644 --- a/arch/arm/dts/dragonboard410c-uboot.dtsi +++ b/arch/arm/dts/dragonboard410c-uboot.dtsi @@ -13,14 +13,6 @@
soc { u-boot,dm-pre-reloc; - - pinctrl@1000000 { - u-boot,dm-pre-reloc; - - uart { - u-boot,dm-pre-reloc; - }; - }; }; };
diff --git a/arch/arm/dts/dragonboard820c-uboot.dtsi b/arch/arm/dts/dragonboard820c-uboot.dtsi index 7daee3789f96..0670a9478290 100644 --- a/arch/arm/dts/dragonboard820c-uboot.dtsi +++ b/arch/arm/dts/dragonboard820c-uboot.dtsi @@ -12,14 +12,6 @@
soc { u-boot,dm-pre-reloc; - - pinctrl@1010000 { - u-boot,dm-pre-reloc; - - uart { - u-boot,dm-pre-reloc; - }; - }; }; };
diff --git a/arch/arm/dts/dragonboard845c-uboot.dtsi b/arch/arm/dts/dragonboard845c-uboot.dtsi index 60adcca00b5c..9071eb9d8d55 100644 --- a/arch/arm/dts/dragonboard845c-uboot.dtsi +++ b/arch/arm/dts/dragonboard845c-uboot.dtsi @@ -14,10 +14,6 @@ serial@a84000 { u-boot,dm-pre-reloc; }; - - pinctrl_north@3900000 { - u-boot,dm-pre-reloc; - }; }; };
diff --git a/arch/arm/dts/qcom-ipq4019.dtsi b/arch/arm/dts/qcom-ipq4019.dtsi index 2fcab5412147..a92090057b37 100644 --- a/arch/arm/dts/qcom-ipq4019.dtsi +++ b/arch/arm/dts/qcom-ipq4019.dtsi @@ -80,7 +80,6 @@ gpio-count = <100>; gpio-bank-name="soc"; #gpio-cells = <2>; - u-boot,dm-pre-reloc; };
blsp1_uart1: serial@78af000 { diff --git a/arch/arm/dts/qcs404-evb-uboot.dtsi b/arch/arm/dts/qcs404-evb-uboot.dtsi index afa711ad979c..80d7d4c25856 100644 --- a/arch/arm/dts/qcs404-evb-uboot.dtsi +++ b/arch/arm/dts/qcs404-evb-uboot.dtsi @@ -8,10 +8,6 @@ / { soc { u-boot,dm-pre-reloc; - - pinctrl_north@1300000 { - u-boot,dm-pre-reloc; - }; }; };
diff --git a/arch/arm/dts/starqltechn-uboot.dtsi b/arch/arm/dts/starqltechn-uboot.dtsi index 8e3cf3829421..0e82fe45ff0f 100644 --- a/arch/arm/dts/starqltechn-uboot.dtsi +++ b/arch/arm/dts/starqltechn-uboot.dtsi @@ -16,12 +16,6 @@ serial@a84000 { u-boot,dm-pre-reloc; }; - gpio_north@3900000 { - u-boot,dm-pre-reloc; - }; - pinctrl_north@3900000 { - u-boot,dm-pre-reloc; - }; }; };
diff --git a/arch/arm/mach-snapdragon/pinctrl-snapdragon.c b/arch/arm/mach-snapdragon/pinctrl-snapdragon.c index 826dc5148661..9f261d70e4d3 100644 --- a/arch/arm/mach-snapdragon/pinctrl-snapdragon.c +++ b/arch/arm/mach-snapdragon/pinctrl-snapdragon.c @@ -163,4 +163,5 @@ U_BOOT_DRIVER(pinctrl_snapdraon) = { .ops = &msm_pinctrl_ops, .probe = msm_pinctrl_probe, .bind = msm_pinctrl_bind, + .flags = DM_FLAG_PRE_RELOC, };

In preparation for supporting upstream Linux device trees on Qualcomm platforms, make this the default behavior.
Signed-off-by: Konrad Dybcio konrad.dybcio@linaro.org --- arch/arm/dts/dragonboard845c-uboot.dtsi | 4 ---- arch/arm/dts/starqltechn-uboot.dtsi | 3 --- drivers/serial/serial_msm_geni.c | 1 + 3 files changed, 1 insertion(+), 7 deletions(-)
diff --git a/arch/arm/dts/dragonboard845c-uboot.dtsi b/arch/arm/dts/dragonboard845c-uboot.dtsi index 9071eb9d8d55..d48df2b90b4a 100644 --- a/arch/arm/dts/dragonboard845c-uboot.dtsi +++ b/arch/arm/dts/dragonboard845c-uboot.dtsi @@ -10,10 +10,6 @@ { soc { u-boot,dm-pre-reloc; - - serial@a84000 { - u-boot,dm-pre-reloc; - }; }; };
diff --git a/arch/arm/dts/starqltechn-uboot.dtsi b/arch/arm/dts/starqltechn-uboot.dtsi index 0e82fe45ff0f..ee726e0283bf 100644 --- a/arch/arm/dts/starqltechn-uboot.dtsi +++ b/arch/arm/dts/starqltechn-uboot.dtsi @@ -13,9 +13,6 @@ }; soc { u-boot,dm-pre-reloc; - serial@a84000 { - u-boot,dm-pre-reloc; - }; }; };
diff --git a/drivers/serial/serial_msm_geni.c b/drivers/serial/serial_msm_geni.c index 6c9371c4e69d..08906ad56918 100644 --- a/drivers/serial/serial_msm_geni.c +++ b/drivers/serial/serial_msm_geni.c @@ -566,6 +566,7 @@ U_BOOT_DRIVER(serial_msm_geni) = { .priv_auto = sizeof(struct msm_serial_data), .probe = msm_serial_probe, .ops = &msm_serial_ops, + .flags = DM_FLAG_PRE_RELOC, };
#ifdef CONFIG_DEBUG_UART_MSM_GENI

The simple-bus driver assigns the pre-reloc flag, which means it's not necessary to do it again in the device tree. Clean it up.
Signed-off-by: Konrad Dybcio konrad.dybcio@linaro.org --- arch/arm/dts/dragonboard410c-uboot.dtsi | 4 ---- arch/arm/dts/dragonboard820c-uboot.dtsi | 4 ---- arch/arm/dts/dragonboard845c-uboot.dtsi | 7 ------- arch/arm/dts/qcs404-evb-uboot.dtsi | 6 ------ arch/arm/dts/starqltechn-uboot.dtsi | 3 --- 5 files changed, 24 deletions(-)
diff --git a/arch/arm/dts/dragonboard410c-uboot.dtsi b/arch/arm/dts/dragonboard410c-uboot.dtsi index ca00b49bc844..d4dd0d29c7f8 100644 --- a/arch/arm/dts/dragonboard410c-uboot.dtsi +++ b/arch/arm/dts/dragonboard410c-uboot.dtsi @@ -10,10 +10,6 @@ smem { u-boot,dm-pre-reloc; }; - - soc { - u-boot,dm-pre-reloc; - }; };
diff --git a/arch/arm/dts/dragonboard820c-uboot.dtsi b/arch/arm/dts/dragonboard820c-uboot.dtsi index 0670a9478290..dcdb63ea6e01 100644 --- a/arch/arm/dts/dragonboard820c-uboot.dtsi +++ b/arch/arm/dts/dragonboard820c-uboot.dtsi @@ -9,10 +9,6 @@ smem { u-boot,dm-pre-reloc; }; - - soc { - u-boot,dm-pre-reloc; - }; };
&pm8994_pon { diff --git a/arch/arm/dts/dragonboard845c-uboot.dtsi b/arch/arm/dts/dragonboard845c-uboot.dtsi index d48df2b90b4a..b7e570351587 100644 --- a/arch/arm/dts/dragonboard845c-uboot.dtsi +++ b/arch/arm/dts/dragonboard845c-uboot.dtsi @@ -6,13 +6,6 @@ * (C) Copyright 2022 Sumit Garg sumit.garg@linaro.org */
-/ -{ - soc { - u-boot,dm-pre-reloc; - }; -}; - &pm8998_pon { key_vol_down { gpios = <&pm8998_pon 1 0>; diff --git a/arch/arm/dts/qcs404-evb-uboot.dtsi b/arch/arm/dts/qcs404-evb-uboot.dtsi index 80d7d4c25856..b27a18e03e84 100644 --- a/arch/arm/dts/qcs404-evb-uboot.dtsi +++ b/arch/arm/dts/qcs404-evb-uboot.dtsi @@ -5,12 +5,6 @@ * (C) Copyright 2022 Sumit Garg sumit.garg@linaro.org */
-/ { - soc { - u-boot,dm-pre-reloc; - }; -}; - &pms405_gpios { usb_vbus_boost_pin { gpios = <&pms405_gpios 2 0>; diff --git a/arch/arm/dts/starqltechn-uboot.dtsi b/arch/arm/dts/starqltechn-uboot.dtsi index ee726e0283bf..128eb19d7047 100644 --- a/arch/arm/dts/starqltechn-uboot.dtsi +++ b/arch/arm/dts/starqltechn-uboot.dtsi @@ -11,9 +11,6 @@ framebuffer@9D400000 { u-boot,dm-pre-reloc; }; - soc { - u-boot,dm-pre-reloc; - }; };
&pm8998_pon {

Mark's and Dzmitry's approaches come down to the same thing.. Let's unify them by first removing the static keyword from the common file to allow the variable to be reused, then renaming "reg0" to the more sensible fw_dtb_pointer coming from the Apple file and finally remove the mach-apple implementation of this very thing and enable the common approach in the respective defconfig.
Only build-tested.
Signed-off-by: Konrad Dybcio konrad.dybcio@linaro.org --- arch/arm/lib/save_prev_bl_data.c | 14 +++++++------- arch/arm/mach-apple/Makefile | 1 - arch/arm/mach-apple/lowlevel_init.S | 17 ----------------- configs/apple_m1_defconfig | 1 + 4 files changed, 8 insertions(+), 25 deletions(-)
diff --git a/arch/arm/lib/save_prev_bl_data.c b/arch/arm/lib/save_prev_bl_data.c index f7b23faf0d66..a127fec1f149 100644 --- a/arch/arm/lib/save_prev_bl_data.c +++ b/arch/arm/lib/save_prev_bl_data.c @@ -15,7 +15,7 @@ #include <asm/system.h> #include <asm/armv8/mmu.h>
-static ulong reg0 __section(".data"); +ulong fw_dtb_pointer __section(".data");
/** * Save x0 register value, assuming previous bootloader set it to @@ -23,7 +23,7 @@ static ulong reg0 __section(".data"); */ void save_boot_params(ulong r0) { - reg0 = r0; + fw_dtb_pointer = r0; save_boot_params_ret(); }
@@ -51,24 +51,24 @@ int save_prev_bl_data(void) int node; u64 initrd_start_prop;
- if (!is_addr_accessible((phys_addr_t)reg0)) + if (!is_addr_accessible((phys_addr_t)fw_dtb_pointer)) return -ENODATA;
- fdt_blob = (struct fdt_header *)reg0; + fdt_blob = (struct fdt_header *)fw_dtb_pointer; if (!fdt_valid(&fdt_blob)) { - pr_warn("%s: address 0x%lx is not a valid fdt\n", __func__, reg0); + pr_warn("%s: address 0x%lx is not a valid fdt\n", __func__, fw_dtb_pointer); return -ENODATA; }
if (IS_ENABLED(CONFIG_SAVE_PREV_BL_FDT_ADDR)) - env_set_addr("prevbl_fdt_addr", (void *)reg0); + env_set_addr("prevbl_fdt_addr", (void *)fw_dtb_pointer); if (!IS_ENABLED(CONFIG_SAVE_PREV_BL_INITRAMFS_START_ADDR)) return 0;
node = fdt_path_offset(fdt_blob, "/chosen"); if (!node) { pr_warn("%s: chosen node not found in device tree at addr: 0x%lx\n", - __func__, reg0); + __func__, fw_dtb_pointer); return -ENODATA; } /* diff --git a/arch/arm/mach-apple/Makefile b/arch/arm/mach-apple/Makefile index 50b465b9473f..a775d8866ad4 100644 --- a/arch/arm/mach-apple/Makefile +++ b/arch/arm/mach-apple/Makefile @@ -1,6 +1,5 @@ # SPDX-License-Identifier: GPL-2.0+
obj-y += board.o -obj-y += lowlevel_init.o obj-y += rtkit.o obj-$(CONFIG_NVME_APPLE) += sart.o diff --git a/arch/arm/mach-apple/lowlevel_init.S b/arch/arm/mach-apple/lowlevel_init.S deleted file mode 100644 index e1c0d91cef2c..000000000000 --- a/arch/arm/mach-apple/lowlevel_init.S +++ /dev/null @@ -1,17 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0+ */ -/* - * (C) Copyright 2021 Mark Kettenis kettenis@openbsd.org - */ - -.align 8 -.global fw_dtb_pointer -fw_dtb_pointer: - .quad 0 - -.global save_boot_params -save_boot_params: - /* Stash DTB pointer passed by m1n1 */ - adr x1, fw_dtb_pointer - str x0, [x1] - - b save_boot_params_ret diff --git a/configs/apple_m1_defconfig b/configs/apple_m1_defconfig index b4ecf73cbc78..eb0addb741c5 100644 --- a/configs/apple_m1_defconfig +++ b/configs/apple_m1_defconfig @@ -3,6 +3,7 @@ CONFIG_ARCH_APPLE=y CONFIG_DEFAULT_DEVICE_TREE="t8103-j274" CONFIG_SYS_LOAD_ADDR=0x0 CONFIG_USE_PREBOOT=y +CONFIG_SAVE_PREV_BL_FDT_ADDR=y # CONFIG_DISPLAY_CPUINFO is not set CONFIG_DISPLAY_BOARDINFO_LATE=y CONFIG_BOARD_LATE_INIT=y

Hi,
On Mon, 27 Mar 2023 at 23:47, Konrad Dybcio konrad.dybcio@linaro.org wrote:
Mark's and Dzmitry's approaches come down to the same thing.. Let's unify them by first removing the static keyword from the common file to allow the variable to be reused, then renaming "reg0" to the more sensible fw_dtb_pointer coming from the Apple file and finally remove the mach-apple implementation of this very thing and enable the common approach in the respective defconfig.
Only build-tested.
Signed-off-by: Konrad Dybcio konrad.dybcio@linaro.org
arch/arm/lib/save_prev_bl_data.c | 14 +++++++------- arch/arm/mach-apple/Makefile | 1 - arch/arm/mach-apple/lowlevel_init.S | 17 ----------------- configs/apple_m1_defconfig | 1 + 4 files changed, 8 insertions(+), 25 deletions(-)
Perhaps we could start using a bloblist (in preparation for the coming Firmware Handoff [1] [2]) to pass information between stages?
Regards, Simon
[1] https://github.com/FirmwareHandoff/firmware_handoff [2] https://developer.arm.com/documentation/den0135/a

From: Simon Glass sjg@chromium.org Date: Tue, 28 Mar 2023 08:02:24 +1300
Hi,
On Mon, 27 Mar 2023 at 23:47, Konrad Dybcio konrad.dybcio@linaro.org wrote:
Mark's and Dzmitry's approaches come down to the same thing.. Let's unify them by first removing the static keyword from the common file to allow the variable to be reused, then renaming "reg0" to the more sensible fw_dtb_pointer coming from the Apple file and finally remove the mach-apple implementation of this very thing and enable the common approach in the respective defconfig.
Only build-tested.
Signed-off-by: Konrad Dybcio konrad.dybcio@linaro.org
arch/arm/lib/save_prev_bl_data.c | 14 +++++++------- arch/arm/mach-apple/Makefile | 1 - arch/arm/mach-apple/lowlevel_init.S | 17 ----------------- configs/apple_m1_defconfig | 1 + 4 files changed, 8 insertions(+), 25 deletions(-)
Perhaps we could start using a bloblist (in preparation for the coming Firmware Handoff [1] [2]) to pass information between stages?
We don't have TPL or SPL on these machines, only U-Boot proper. And the handoff protocol between m1n1 and U-Boot is defined by [3]. I have zero interest in changing that and my guess is that Hector Martin feels the same.
Cheers,
Mark

Hi Mark,
On Tue, 28 Mar 2023 at 08:19, Mark Kettenis mark.kettenis@xs4all.nl wrote:
From: Simon Glass sjg@chromium.org Date: Tue, 28 Mar 2023 08:02:24 +1300
Hi,
On Mon, 27 Mar 2023 at 23:47, Konrad Dybcio konrad.dybcio@linaro.org wrote:
Mark's and Dzmitry's approaches come down to the same thing.. Let's unify them by first removing the static keyword from the common file to allow the variable to be reused, then renaming "reg0" to the more sensible fw_dtb_pointer coming from the Apple file and finally remove the mach-apple implementation of this very thing and enable the common approach in the respective defconfig.
Only build-tested.
Signed-off-by: Konrad Dybcio konrad.dybcio@linaro.org
arch/arm/lib/save_prev_bl_data.c | 14 +++++++------- arch/arm/mach-apple/Makefile | 1 - arch/arm/mach-apple/lowlevel_init.S | 17 ----------------- configs/apple_m1_defconfig | 1 + 4 files changed, 8 insertions(+), 25 deletions(-)
Perhaps we could start using a bloblist (in preparation for the coming Firmware Handoff [1] [2]) to pass information between stages?
We don't have TPL or SPL on these machines, only U-Boot proper. And the handoff protocol between m1n1 and U-Boot is defined by [3]. I have zero interest in changing that and my guess is that Hector Martin feels the same.
This has nothing to do with TPL, nor SPL. It is a way of communicating between projects.
I hope you can both find the time and inclination to support firmware standardisation as it evolves.
Projects need to work together.
Regards, Simon
Cheers,
Mark

From: Simon Glass sjg@chromium.org Date: Tue, 28 Mar 2023 08:32:45 +1300
Hi Mark,
On Tue, 28 Mar 2023 at 08:19, Mark Kettenis mark.kettenis@xs4all.nl wrote:
From: Simon Glass sjg@chromium.org Date: Tue, 28 Mar 2023 08:02:24 +1300
Hi,
On Mon, 27 Mar 2023 at 23:47, Konrad Dybcio konrad.dybcio@linaro.org wrote:
Mark's and Dzmitry's approaches come down to the same thing.. Let's unify them by first removing the static keyword from the common file to allow the variable to be reused, then renaming "reg0" to the more sensible fw_dtb_pointer coming from the Apple file and finally remove the mach-apple implementation of this very thing and enable the common approach in the respective defconfig.
Only build-tested.
Signed-off-by: Konrad Dybcio konrad.dybcio@linaro.org
arch/arm/lib/save_prev_bl_data.c | 14 +++++++------- arch/arm/mach-apple/Makefile | 1 - arch/arm/mach-apple/lowlevel_init.S | 17 ----------------- configs/apple_m1_defconfig | 1 + 4 files changed, 8 insertions(+), 25 deletions(-)
Perhaps we could start using a bloblist (in preparation for the coming Firmware Handoff [1] [2]) to pass information between stages?
We don't have TPL or SPL on these machines, only U-Boot proper. And the handoff protocol between m1n1 and U-Boot is defined by [3]. I have zero interest in changing that and my guess is that Hector Martin feels the same.
This has nothing to do with TPL, nor SPL. It is a way of communicating between projects.
I hope you can both find the time and inclination to support firmware standardisation as it evolves.
Projects need to work together.

On Tue, 28 Mar 2023 at 08:42, Mark Kettenis mark.kettenis@xs4all.nl wrote:
From: Simon Glass sjg@chromium.org Date: Tue, 28 Mar 2023 08:32:45 +1300
Hi Mark,
On Tue, 28 Mar 2023 at 08:19, Mark Kettenis mark.kettenis@xs4all.nl wrote:
From: Simon Glass sjg@chromium.org Date: Tue, 28 Mar 2023 08:02:24 +1300
Hi,
On Mon, 27 Mar 2023 at 23:47, Konrad Dybcio konrad.dybcio@linaro.org wrote:
Mark's and Dzmitry's approaches come down to the same thing.. Let's unify them by first removing the static keyword from the common file to allow the variable to be reused, then renaming "reg0" to the more sensible fw_dtb_pointer coming from the Apple file and finally remove the mach-apple implementation of this very thing and enable the common approach in the respective defconfig.
Only build-tested.
Signed-off-by: Konrad Dybcio konrad.dybcio@linaro.org
arch/arm/lib/save_prev_bl_data.c | 14 +++++++------- arch/arm/mach-apple/Makefile | 1 - arch/arm/mach-apple/lowlevel_init.S | 17 ----------------- configs/apple_m1_defconfig | 1 + 4 files changed, 8 insertions(+), 25 deletions(-)
Perhaps we could start using a bloblist (in preparation for the coming Firmware Handoff [1] [2]) to pass information between stages?
We don't have TPL or SPL on these machines, only U-Boot proper. And the handoff protocol between m1n1 and U-Boot is defined by [3]. I have zero interest in changing that and my guess is that Hector Martin feels the same.
This has nothing to do with TPL, nor SPL. It is a way of communicating between projects.
I hope you can both find the time and inclination to support firmware standardisation as it evolves.
Projects need to work together.
https://media.licdn.com/dms/image/C4D12AQH3JLVFSpPm8A/article-cover_image-sh...
participants (3)
-
Konrad Dybcio
-
Mark Kettenis
-
Simon Glass