Re: [PATCH v3 27/36] dts: msm8916: replace with upstream DTS

2024-02-09 Thread Caleb Connolly



On 02/02/2024 08:38, Sumit Garg wrote:
> On Tue, 30 Jan 2024 at 19:35, Caleb Connolly  
> wrote:
>>
>> Drop the U-Boot specific dragonboard410c.dts in favour of the upstream
>> msm8916-sbc.dts. No additional changes are needed to this DTS for U-Boot
>> support.
>>
>> Taken from kernel tag v6.7
>>
>> Reviewed-by: Neil Armstrong 
>> Signed-off-by: Caleb Connolly 
>> ---
>>  arch/arm/dts/Makefile   |2 +-
>>  arch/arm/dts/apq8016-sbc-u-boot.dtsi|   11 +
>>  arch/arm/dts/apq8016-sbc.dts|  729 +
>>  arch/arm/dts/dragonboard410c-uboot.dtsi |   44 -
>>  arch/arm/dts/dragonboard410c.dts|  221 ---
>>  arch/arm/dts/msm8916.dtsi   | 2702 
>> +++
>>  configs/dragonboard410c_defconfig   |2 +-
>>  7 files changed, 3444 insertions(+), 267 deletions(-)
>>
>> diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile
>> index 92a4465f5f41..4c8b29b983a4 100644
>> --- a/arch/arm/dts/Makefile
>> +++ b/arch/arm/dts/Makefile
>> @@ -628,7 +628,7 @@ dtb-$(CONFIG_TARGET_SL28) += 
>> fsl-ls1028a-kontron-sl28.dtb \
>>
>>  dtb-$(CONFIG_TARGET_TEN64) += fsl-ls1088a-ten64.dtb
>>
>> -dtb-$(CONFIG_ARCH_SNAPDRAGON) += dragonboard410c.dtb \
>> +dtb-$(CONFIG_ARCH_SNAPDRAGON) += apq8016-sbc.dtb \
>> dragonboard820c.dtb \
>> sdm845-db845c.dtb \
>> sdm845-samsung-starqltechn.dtb \
>> diff --git a/arch/arm/dts/apq8016-sbc-u-boot.dtsi 
>> b/arch/arm/dts/apq8016-sbc-u-boot.dtsi
>> new file mode 100644
>> index ..838e629a8ade
>> --- /dev/null
>> +++ b/arch/arm/dts/apq8016-sbc-u-boot.dtsi
>> @@ -0,0 +1,11 @@
>> +// SPDX-License-Identifier: GPL-2.0
>> +/*
>> + * Copyright (c) 2024, Linaro Ltd.
>> + */
>> +
>> +/ {
>> +   /* When running as a first-stage bootloader this isn't filled in 
>> automatically */
>> +   memory@8000 {
>> +   reg = <0 0x8000 0 0x3da0>;
>> +   };
>> +};
> 
> With U-Boot booting as the first stage bootloader, we have to enable
> the serial driver prior to relocation. Although we have
> DM_FLAG_PRE_RELOC for clock and the serial driver, what about the
> pinctrl driver required to configure UART specific pins prior to
> relocation? Without following change we get broken U-Boot log without
> header prints:

Ohhh nice! This makes a whole lot of sense. Thanks for figuring this out.

I finally got my hands on some db410c's (thanks Neil!) and can confirm
this fixes the issue. I tried using DM_FLAG_PRE_RELOC on the pinctrl
driver but it doesn't seem like that's enough to get pinctrl going. I'll
pick your patch below.
> 
> diff --git a/arch/arm/dts/apq8016-sbc-u-boot.dtsi
> b/arch/arm/dts/apq8016-sbc-u-boot.dtsi
> index 838e629a8ade..0a21732be6cb 100644
> --- a/arch/arm/dts/apq8016-sbc-u-boot.dtsi
> +++ b/arch/arm/dts/apq8016-sbc-u-boot.dtsi
> @@ -9,3 +9,11 @@
> reg = <0 0x8000 0 0x3da0>;
> };
>  };
> +
> + {
> +   bootph-all;
> +
> +   blsp-uart2-default-state {
> +   bootph-all;
> +   };
> +};
> 
> Fixes broken U-Boot log:
> 
> S - Flash Throughput, 82000 KB/s  (1503304 Bytes,  18330 us)
> S - DDR Frequency, 400 MHz
> Core:  135 devices, 20 uclasses, devicetree: board
> MMC:   mmc@7824900: 0, mmc@7864900: 1
> Loading Environment from MMC... OK
> In:serial@78b
> Out:   serial@78b
> Err:   serial@78b
> ## Error: Can't overwrite "serial#"
> ## Error inserting "serial#" variable, errno=1
> Net:   No ethernet found.
> Hit any key to stop autoboot:  0
> dragonboard410c =>
> 
> -Sumit

-- 
// Caleb (they/them)


Re: [PATCH v3 27/36] dts: msm8916: replace with upstream DTS

2024-02-02 Thread Sumit Garg
On Tue, 30 Jan 2024 at 19:35, Caleb Connolly  wrote:
>
> Drop the U-Boot specific dragonboard410c.dts in favour of the upstream
> msm8916-sbc.dts. No additional changes are needed to this DTS for U-Boot
> support.
>
> Taken from kernel tag v6.7
>
> Reviewed-by: Neil Armstrong 
> Signed-off-by: Caleb Connolly 
> ---
>  arch/arm/dts/Makefile   |2 +-
>  arch/arm/dts/apq8016-sbc-u-boot.dtsi|   11 +
>  arch/arm/dts/apq8016-sbc.dts|  729 +
>  arch/arm/dts/dragonboard410c-uboot.dtsi |   44 -
>  arch/arm/dts/dragonboard410c.dts|  221 ---
>  arch/arm/dts/msm8916.dtsi   | 2702 
> +++
>  configs/dragonboard410c_defconfig   |2 +-
>  7 files changed, 3444 insertions(+), 267 deletions(-)
>
> diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile
> index 92a4465f5f41..4c8b29b983a4 100644
> --- a/arch/arm/dts/Makefile
> +++ b/arch/arm/dts/Makefile
> @@ -628,7 +628,7 @@ dtb-$(CONFIG_TARGET_SL28) += fsl-ls1028a-kontron-sl28.dtb 
> \
>
>  dtb-$(CONFIG_TARGET_TEN64) += fsl-ls1088a-ten64.dtb
>
> -dtb-$(CONFIG_ARCH_SNAPDRAGON) += dragonboard410c.dtb \
> +dtb-$(CONFIG_ARCH_SNAPDRAGON) += apq8016-sbc.dtb \
> dragonboard820c.dtb \
> sdm845-db845c.dtb \
> sdm845-samsung-starqltechn.dtb \
> diff --git a/arch/arm/dts/apq8016-sbc-u-boot.dtsi 
> b/arch/arm/dts/apq8016-sbc-u-boot.dtsi
> new file mode 100644
> index ..838e629a8ade
> --- /dev/null
> +++ b/arch/arm/dts/apq8016-sbc-u-boot.dtsi
> @@ -0,0 +1,11 @@
> +// SPDX-License-Identifier: GPL-2.0
> +/*
> + * Copyright (c) 2024, Linaro Ltd.
> + */
> +
> +/ {
> +   /* When running as a first-stage bootloader this isn't filled in 
> automatically */
> +   memory@8000 {
> +   reg = <0 0x8000 0 0x3da0>;
> +   };
> +};

With U-Boot booting as the first stage bootloader, we have to enable
the serial driver prior to relocation. Although we have
DM_FLAG_PRE_RELOC for clock and the serial driver, what about the
pinctrl driver required to configure UART specific pins prior to
relocation? Without following change we get broken U-Boot log without
header prints:

diff --git a/arch/arm/dts/apq8016-sbc-u-boot.dtsi
b/arch/arm/dts/apq8016-sbc-u-boot.dtsi
index 838e629a8ade..0a21732be6cb 100644
--- a/arch/arm/dts/apq8016-sbc-u-boot.dtsi
+++ b/arch/arm/dts/apq8016-sbc-u-boot.dtsi
@@ -9,3 +9,11 @@
reg = <0 0x8000 0 0x3da0>;
};
 };
+
+ {
+   bootph-all;
+
+   blsp-uart2-default-state {
+   bootph-all;
+   };
+};

Fixes broken U-Boot log:

S - Flash Throughput, 82000 KB/s  (1503304 Bytes,  18330 us)
S - DDR Frequency, 400 MHz
Core:  135 devices, 20 uclasses, devicetree: board
MMC:   mmc@7824900: 0, mmc@7864900: 1
Loading Environment from MMC... OK
In:serial@78b
Out:   serial@78b
Err:   serial@78b
## Error: Can't overwrite "serial#"
## Error inserting "serial#" variable, errno=1
Net:   No ethernet found.
Hit any key to stop autoboot:  0
dragonboard410c =>

-Sumit


[PATCH v3 27/36] dts: msm8916: replace with upstream DTS

2024-01-30 Thread Caleb Connolly
Drop the U-Boot specific dragonboard410c.dts in favour of the upstream
msm8916-sbc.dts. No additional changes are needed to this DTS for U-Boot
support.

Taken from kernel tag v6.7

Reviewed-by: Neil Armstrong 
Signed-off-by: Caleb Connolly 
---
 arch/arm/dts/Makefile   |2 +-
 arch/arm/dts/apq8016-sbc-u-boot.dtsi|   11 +
 arch/arm/dts/apq8016-sbc.dts|  729 +
 arch/arm/dts/dragonboard410c-uboot.dtsi |   44 -
 arch/arm/dts/dragonboard410c.dts|  221 ---
 arch/arm/dts/msm8916.dtsi   | 2702 +++
 configs/dragonboard410c_defconfig   |2 +-
 7 files changed, 3444 insertions(+), 267 deletions(-)

diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile
index 92a4465f5f41..4c8b29b983a4 100644
--- a/arch/arm/dts/Makefile
+++ b/arch/arm/dts/Makefile
@@ -628,7 +628,7 @@ dtb-$(CONFIG_TARGET_SL28) += fsl-ls1028a-kontron-sl28.dtb \
 
 dtb-$(CONFIG_TARGET_TEN64) += fsl-ls1088a-ten64.dtb
 
-dtb-$(CONFIG_ARCH_SNAPDRAGON) += dragonboard410c.dtb \
+dtb-$(CONFIG_ARCH_SNAPDRAGON) += apq8016-sbc.dtb \
dragonboard820c.dtb \
sdm845-db845c.dtb \
sdm845-samsung-starqltechn.dtb \
diff --git a/arch/arm/dts/apq8016-sbc-u-boot.dtsi 
b/arch/arm/dts/apq8016-sbc-u-boot.dtsi
new file mode 100644
index ..838e629a8ade
--- /dev/null
+++ b/arch/arm/dts/apq8016-sbc-u-boot.dtsi
@@ -0,0 +1,11 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (c) 2024, Linaro Ltd.
+ */
+
+/ {
+   /* When running as a first-stage bootloader this isn't filled in 
automatically */
+   memory@8000 {
+   reg = <0 0x8000 0 0x3da0>;
+   };
+};
diff --git a/arch/arm/dts/apq8016-sbc.dts b/arch/arm/dts/apq8016-sbc.dts
new file mode 100644
index ..9ffad7d1f2b6
--- /dev/null
+++ b/arch/arm/dts/apq8016-sbc.dts
@@ -0,0 +1,729 @@
+// SPDX-License-Identifier: GPL-2.0-only
+/*
+ * Copyright (c) 2015, The Linux Foundation. All rights reserved.
+ */
+
+/dts-v1/;
+
+#include "msm8916-pm8916.dtsi"
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+/ {
+   model = "Qualcomm Technologies, Inc. APQ 8016 SBC";
+   compatible = "qcom,apq8016-sbc", "qcom,apq8016";
+
+   aliases {
+   mmc0 = _1; /* eMMC */
+   mmc1 = _2; /* SD card */
+   serial0 = _uart2;
+   serial1 = _uart1;
+   usid0 = _0;
+   i2c0 = _i2c2;
+   i2c1 = _i2c6;
+   i2c3 = _i2c4;
+   spi0 = _spi5;
+   spi1 = _spi3;
+   };
+
+   chosen {
+   stdout-path = "serial0";
+   };
+
+   reserved-memory {
+   ramoops@bff0 {
+   compatible = "ramoops";
+   reg = <0x0 0xbff0 0x0 0x10>;
+
+   record-size = <0x2>;
+   console-size = <0x2>;
+   ftrace-size = <0x2>;
+   };
+   };
+
+   usb2513 {
+   compatible = "smsc,usb3503";
+   reset-gpios = <_gpios 3 GPIO_ACTIVE_LOW>;
+   initial-mode = <1>;
+   };
+
+   usb_id: usb-id {
+   compatible = "linux,extcon-usb-gpio";
+   id-gpios = < 121 GPIO_ACTIVE_HIGH>;
+   pinctrl-names = "default";
+   pinctrl-0 = <_id_default>;
+   };
+
+   hdmi-out {
+   compatible = "hdmi-connector";
+   type = "a";
+
+   port {
+   hdmi_con: endpoint {
+   remote-endpoint = <_out>;
+   };
+   };
+   };
+
+   gpio-keys {
+   compatible = "gpio-keys";
+   autorepeat;
+
+   pinctrl-names = "default";
+   pinctrl-0 = <_key_volp_n_default>;
+
+   button {
+   label = "Volume Up";
+   linux,code = ;
+   gpios = < 107 GPIO_ACTIVE_LOW>;
+   };
+   };
+
+   leds {
+   pinctrl-names = "default";
+   pinctrl-0 = <_leds>,
+   <_gpios_leds>,
+   <_mpps_leds>;
+
+   compatible = "gpio-leds";
+
+   led@1 {
+   label = "apq8016-sbc:green:user1";
+   function = LED_FUNCTION_HEARTBEAT;
+   color = ;
+   gpios = < 21 GPIO_ACTIVE_HIGH>;
+   linux,default-trigger = "heartbeat";
+   default-state = "off";
+   };
+
+   led@2 {
+   label = "apq8016-sbc:green:user2";
+   function = LED_FUNCTION_DISK_ACTIVITY;
+   color = ;
+   gpios = < 120 GPIO_ACTIVE_HIGH>;
+   linux,default-trigger = "mmc0";
+   default-state =