U-Boot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* Dragonboard 820c - fix board support
@ 2025-04-07  8:19 Jorge Ramirez-Ortiz
  2025-04-07  8:19 ` [PATCH 1/7] board: qualcomm: dragonboard820c: udpate readme Jorge Ramirez-Ortiz
                   ` (6 more replies)
  0 siblings, 7 replies; 21+ messages in thread
From: Jorge Ramirez-Ortiz @ 2025-04-07  8:19 UTC (permalink / raw)
  To: jorge.ramirez, caleb.connolly, neil.armstrong, sumit.garg
  Cc: u-boot-qcom, u-boot

This series addresses the existing issues with U-Boot support for the
DragonBoard 820c.

[PATCH 1/7] board: qualcomm: dragonboard820c: udpate readme
[PATCH 2/7] clk/qcom: apq8096: fix set rate for the uart clock
[PATCH 3/7] mmc: msm_sdhci: handle bulk clock initialization error
[PATCH 4/7] clk/qcom: apq8096: fix the sdhci clock
[PATCH 5/7] configs: dragonboard820: enable GPIO
[PATCH 6/7] mach-snapdragon: board interface to enforce fdt
[PATCH 7/7] board: qualcommm: dragonboard820c: external fdt


^ permalink raw reply	[flat|nested] 21+ messages in thread

* [PATCH 1/7] board: qualcomm: dragonboard820c: udpate readme
  2025-04-07  8:19 Dragonboard 820c - fix board support Jorge Ramirez-Ortiz
@ 2025-04-07  8:19 ` Jorge Ramirez-Ortiz
  2025-04-07  9:01   ` neil.armstrong
  2025-04-07  8:19 ` [PATCH 2/7] clk/qcom: apq8096: fix set rate for the uart clock Jorge Ramirez-Ortiz
                   ` (5 subsequent siblings)
  6 siblings, 1 reply; 21+ messages in thread
From: Jorge Ramirez-Ortiz @ 2025-04-07  8:19 UTC (permalink / raw)
  To: jorge.ramirez, caleb.connolly, neil.armstrong, sumit.garg
  Cc: u-boot-qcom, u-boot

Update build instructions.

Signed-off-by: Jorge Ramirez-Ortiz <jorge.ramirez@oss.qualcomm.com>
---
 board/qualcomm/dragonboard820c/readme.txt | 47 ++++++++++-------------
 1 file changed, 21 insertions(+), 26 deletions(-)

diff --git a/board/qualcomm/dragonboard820c/readme.txt b/board/qualcomm/dragonboard820c/readme.txt
index 966e9520e85..5817c837fdf 100644
--- a/board/qualcomm/dragonboard820c/readme.txt
+++ b/board/qualcomm/dragonboard820c/readme.txt
@@ -16,10 +16,7 @@
                      Build & Run instructions
 ================================================================================
 
-1) Install mkbootimg and dtbTool from Codeaurora:
-
-   git://codeaurora.org/quic/kernel/skales
-   commit 8492547e404e969262d9070dee9bdd15668bb70f worked for me.
+1) Install mkbootimg
 
 2) Setup CROSS_COMPILE to aarch64 compiler or if you use ccache just do
    CROSS_COMPILE="ccache aarch64-linux-gnu-"
@@ -33,15 +30,15 @@
 
    $ touch rd
 
-5) Generate qualcomm device tree table with dtbTool
+5) Append the dtb to the u-boot binary
 
-   $ dtbTool -o dt.img arch/arm/dts
+   $ gzip u-boot-dtb.bin
+   $ cat u-boot.dtb >> u-boot-dtb.bin.gz
 
 6) Generate Android boot image with mkbootimg:
 
-   $ mkbootimg --kernel=u-boot-dtb.bin             \
+   $ mkbootimg --kernel=u-boot-dtb.bin.gz          \
                --output=u-boot.img                 \
-               --dt=dt.img                         \
                --pagesize 4096                     \
                --base 0x80000000                   \
                --ramdisk=rd                        \
@@ -251,44 +248,42 @@ Wait for 5 seconds before proceeding
 [5300] booting linux @ 0x80080000, ramdisk @ 0x82200000 (0), tags/device tree @ 0x82000000
 [5310] Jumping to kernel via monitor
 
-U-Boot 2017.11-00145-ge895117 (Nov 29 2017 - 10:04:06 +0100)
+U-Boot 2025.04-rc5-00020-g40a61ca0e7eb-dirty (Apr 07 2025 - 09:37:03 +0200)
 Qualcomm-DragonBoard 820C
 
-DRAM:  3 GiB
-PSCI:  v1.0
-MMC:   sdhci@74a4900: 0
+DRAM:  3.5 GiB (effective 3 GiB)
+Core:  136 devices, 18 uclasses, devicetree: board
+MMC:   Bulk clocks not available (-19), trying core clock
+mmc@74a4900: 0
+Loading Environment from EXT4... OK
 In:    serial@75b0000
 Out:   serial@75b0000
 Err:   serial@75b0000
-Net:   Net Initialization Skipped
-No ethernet found.
+Net:   No ethernet found.
 Hit any key to stop autoboot:  0
 switch to partitions #0, OK
 mmc0 is current device
 Scanning mmc 0:1...
 Found /extlinux/extlinux.conf
 Retrieving file: /extlinux/extlinux.conf
-433 bytes read in 71 ms (5.9 KiB/s)
 1:      nfs root
-
+Enter choice: 1:        nfs root
 Retrieving file: /uImage
-19397184 bytes read in 2024 ms (9.1 MiB/s)
-append: root=/dev/nfs rw nfsroot=192.168.1.2:/db820c/rootfs,v3,tcp rootwait ip=dhcp consoleblank=0 console=tty0 console=ttyMSM0,115200n8 earlyprintk earlycon=msm_serial_dm,0x75b0000 androidboot.bootdevice=624000.ufshc androidboot.verifiedbootstate=orange androidboot.ver0
-
+append: root=/dev/nfs rw nfsroot=192.168.1.6:/home/jramirez/Src/qualcomm-lt/db820c/rootfs,v3,tcp rootwait ip=dhcp consoleblank=0 console=tty0 console=ttyMSM0,115200n8 earlyprintk earlyco0
 Retrieving file: /apq8096-db820c.dtb
-38134 bytes read in 37 ms (1005.9 KiB/s)
-
-## Booting kernel from Legacy Image at 95000000 ...
+## Booting kernel from Legacy Image at 155000000 ...
    Image Name:   Dragonboard820c
    Image Type:   AArch64 Linux Kernel Image (uncompressed)
    Data Size:    19397120 Bytes = 18.5 MiB
    Load Address: 80080000
    Entry Point:  80080000
    Verifying Checksum ... OK
-## Flattened Device Tree blob at 93000000
-   Booting using the fdt blob at 0x93000000
-   Loading Kernel Image ... OK
-   Using Device Tree in place at 0000000093000000, end 000000009300c4f5
+## Flattened Device Tree blob at 148600000
+   Booting using the fdt blob at 0x148600000
+Working FDT set to 148600000
+   Loading Kernel Image to 80080000
+   Using Device Tree in place at 0000000148600000, end 000000014860c4f5
+Working FDT set to 148600000
 
 Starting kernel ...
 
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH 2/7] clk/qcom: apq8096: fix set rate for the uart clock
  2025-04-07  8:19 Dragonboard 820c - fix board support Jorge Ramirez-Ortiz
  2025-04-07  8:19 ` [PATCH 1/7] board: qualcomm: dragonboard820c: udpate readme Jorge Ramirez-Ortiz
@ 2025-04-07  8:19 ` Jorge Ramirez-Ortiz
  2025-04-07  9:01   ` neil.armstrong
  2025-04-07  8:19 ` [PATCH 3/7] mmc: msm_sdhci: handle bulk clock initialization error Jorge Ramirez-Ortiz
                   ` (4 subsequent siblings)
  6 siblings, 1 reply; 21+ messages in thread
From: Jorge Ramirez-Ortiz @ 2025-04-07  8:19 UTC (permalink / raw)
  To: jorge.ramirez, caleb.connolly, neil.armstrong, sumit.garg
  Cc: u-boot-qcom, u-boot

The function should return a valid rate.

Signed-off-by: Jorge Ramirez-Ortiz <jorge.ramirez@oss.qualcomm.com>
---
 drivers/clk/qcom/clock-apq8096.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/clk/qcom/clock-apq8096.c b/drivers/clk/qcom/clock-apq8096.c
index c77d69128b0..bc00826a5e8 100644
--- a/drivers/clk/qcom/clock-apq8096.c
+++ b/drivers/clk/qcom/clock-apq8096.c
@@ -87,7 +87,8 @@ static ulong apq8096_clk_set_rate(struct clk *clk, ulong rate)
 		return clk_init_sdc(priv, rate);
 		break;
 	case GCC_BLSP2_UART2_APPS_CLK: /*UART2*/
-		return clk_init_uart(priv);
+		clk_init_uart(priv);
+		return 7372800;
 	default:
 		return 0;
 	}
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH 3/7] mmc: msm_sdhci: handle bulk clock initialization error
  2025-04-07  8:19 Dragonboard 820c - fix board support Jorge Ramirez-Ortiz
  2025-04-07  8:19 ` [PATCH 1/7] board: qualcomm: dragonboard820c: udpate readme Jorge Ramirez-Ortiz
  2025-04-07  8:19 ` [PATCH 2/7] clk/qcom: apq8096: fix set rate for the uart clock Jorge Ramirez-Ortiz
@ 2025-04-07  8:19 ` Jorge Ramirez-Ortiz
  2025-04-07  9:02   ` neil.armstrong
  2025-04-07  8:19 ` [PATCH 4/7] clk/qcom: apq8096: fix the sdhci clock Jorge Ramirez-Ortiz
                   ` (3 subsequent siblings)
  6 siblings, 1 reply; 21+ messages in thread
From: Jorge Ramirez-Ortiz @ 2025-04-07  8:19 UTC (permalink / raw)
  To: jorge.ramirez, caleb.connolly, neil.armstrong, sumit.garg
  Cc: u-boot-qcom, u-boot

Some boards do not require all clocks to be available (i.e:
dragonboard820c).

This change provides a fallback to the core clock when the bulk cant be
retrived.

Signed-off-by: Jorge Ramirez-Ortiz <jorge.ramirez@oss.qualcomm.com>
---
 drivers/mmc/msm_sdhci.c | 27 +++++++++++++++++++++++++--
 1 file changed, 25 insertions(+), 2 deletions(-)

diff --git a/drivers/mmc/msm_sdhci.c b/drivers/mmc/msm_sdhci.c
index 27bb7052fca..8081330bd25 100644
--- a/drivers/mmc/msm_sdhci.c
+++ b/drivers/mmc/msm_sdhci.c
@@ -9,6 +9,7 @@
 
 #include <clk.h>
 #include <dm.h>
+#include <dm/devres.h>
 #include <malloc.h>
 #include <sdhci.h>
 #include <wait_bit.h>
@@ -56,6 +57,17 @@ struct msm_sdhc_variant_info {
 
 DECLARE_GLOBAL_DATA_PTR;
 
+static int get_core_clock(struct udevice *dev, struct clk_bulk *bulk)
+{
+	bulk->count = 1;
+
+	bulk->clks = devm_kcalloc(dev, 1, sizeof(struct clk), GFP_KERNEL);
+	if (!bulk->clks)
+		return -ENOMEM;
+
+	return clk_get_by_name(dev, "core", &bulk->clks[0]);
+}
+
 static int msm_sdc_clk_init(struct udevice *dev)
 {
 	struct msm_sdhc *prv = dev_get_priv(dev);
@@ -73,8 +85,15 @@ static int msm_sdc_clk_init(struct udevice *dev)
 
 	ret = clk_get_bulk(dev, &prv->clks);
 	if (ret) {
-		log_warning("Couldn't get mmc clocks: %d\n", ret);
-		return ret;
+		log_warning("Bulk clocks not available (%d), trying core clock\n", ret);
+
+		/* Sometimes not all clocks are needed - chainloading uboot */
+		ret = get_core_clock(dev, &prv->clks);
+		if (ret) {
+			log_warning("Core clock not available:(%d)\n", ret);
+			return ret;
+		}
+		n_clks = 1;
 	}
 
 	ret = clk_enable_bulk(&prv->clks);
@@ -83,6 +102,9 @@ static int msm_sdc_clk_init(struct udevice *dev)
 		return ret;
 	}
 
+	if (n_clks == 1)
+		goto set_rate;
+
 	/* If clock-names is unspecified, then the first clock is the core clock */
 	if (!ofnode_get_property(node, "clock-names", &n_clks)) {
 		if (!clk_set_rate(&prv->clks.clks[0], clk_rate)) {
@@ -105,6 +127,7 @@ static int msm_sdc_clk_init(struct udevice *dev)
 		return -EINVAL;
 	}
 
+set_rate:
 	/* The clock is already enabled by the clk_bulk above */
 	clk_rate = clk_set_rate(&prv->clks.clks[i], clk_rate);
 	/* If we get a rate of 0 then something has probably gone wrong. */
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH 4/7] clk/qcom: apq8096: fix the sdhci clock
  2025-04-07  8:19 Dragonboard 820c - fix board support Jorge Ramirez-Ortiz
                   ` (2 preceding siblings ...)
  2025-04-07  8:19 ` [PATCH 3/7] mmc: msm_sdhci: handle bulk clock initialization error Jorge Ramirez-Ortiz
@ 2025-04-07  8:19 ` Jorge Ramirez-Ortiz
  2025-04-07  9:03   ` neil.armstrong
  2025-04-07  8:19 ` [PATCH 5/7] configs: dragonboard820: enable GPIO Jorge Ramirez-Ortiz
                   ` (2 subsequent siblings)
  6 siblings, 1 reply; 21+ messages in thread
From: Jorge Ramirez-Ortiz @ 2025-04-07  8:19 UTC (permalink / raw)
  To: jorge.ramirez, caleb.connolly, neil.armstrong, sumit.garg
  Cc: u-boot-qcom, u-boot

Select the right clock for sdhci.

Signed-off-by: Jorge Ramirez-Ortiz <jorge.ramirez@oss.qualcomm.com>
---
 drivers/clk/qcom/clock-apq8096.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/clk/qcom/clock-apq8096.c b/drivers/clk/qcom/clock-apq8096.c
index bc00826a5e8..551f52d5197 100644
--- a/drivers/clk/qcom/clock-apq8096.c
+++ b/drivers/clk/qcom/clock-apq8096.c
@@ -83,7 +83,7 @@ static ulong apq8096_clk_set_rate(struct clk *clk, ulong rate)
 	struct msm_clk_priv *priv = dev_get_priv(clk->dev);
 
 	switch (clk->id) {
-	case GCC_SDCC1_APPS_CLK: /* SDC1 */
+	case GCC_SDCC2_APPS_CLK: /* SDC2 */
 		return clk_init_sdc(priv, rate);
 		break;
 	case GCC_BLSP2_UART2_APPS_CLK: /*UART2*/
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH 5/7] configs: dragonboard820: enable GPIO
  2025-04-07  8:19 Dragonboard 820c - fix board support Jorge Ramirez-Ortiz
                   ` (3 preceding siblings ...)
  2025-04-07  8:19 ` [PATCH 4/7] clk/qcom: apq8096: fix the sdhci clock Jorge Ramirez-Ortiz
@ 2025-04-07  8:19 ` Jorge Ramirez-Ortiz
  2025-04-07  9:03   ` neil.armstrong
  2025-04-07  8:19 ` [PATCH 6/7] mach-snapdragon: board interface to enforce fdt Jorge Ramirez-Ortiz
  2025-04-07  8:19 ` [PATCH 7/7] board: qualcommm: dragonboard820c: external fdt Jorge Ramirez-Ortiz
  6 siblings, 1 reply; 21+ messages in thread
From: Jorge Ramirez-Ortiz @ 2025-04-07  8:19 UTC (permalink / raw)
  To: jorge.ramirez, caleb.connolly, neil.armstrong, sumit.garg
  Cc: u-boot-qcom, u-boot

Configure GPIO.

Signed-off-by: Jorge Ramirez-Ortiz <jorge.ramirez@oss.qualcomm.com>
---
 configs/dragonboard820c_defconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/configs/dragonboard820c_defconfig b/configs/dragonboard820c_defconfig
index e29bea7deb2..b5b6bc026e8 100644
--- a/configs/dragonboard820c_defconfig
+++ b/configs/dragonboard820c_defconfig
@@ -45,4 +45,5 @@ CONFIG_PINCTRL_QCOM_APQ8096=y
 CONFIG_DM_PMIC=y
 CONFIG_PMIC_QCOM=y
 CONFIG_MSM_SERIAL=y
+CONFIG_MSM_GPIO=y
 CONFIG_SPMI_MSM=y
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH 6/7] mach-snapdragon: board interface to enforce fdt
  2025-04-07  8:19 Dragonboard 820c - fix board support Jorge Ramirez-Ortiz
                   ` (4 preceding siblings ...)
  2025-04-07  8:19 ` [PATCH 5/7] configs: dragonboard820: enable GPIO Jorge Ramirez-Ortiz
@ 2025-04-07  8:19 ` Jorge Ramirez-Ortiz
  2025-04-07  9:04   ` neil.armstrong
  2025-04-07 10:02   ` Caleb Connolly
  2025-04-07  8:19 ` [PATCH 7/7] board: qualcommm: dragonboard820c: external fdt Jorge Ramirez-Ortiz
  6 siblings, 2 replies; 21+ messages in thread
From: Jorge Ramirez-Ortiz @ 2025-04-07  8:19 UTC (permalink / raw)
  To: jorge.ramirez, caleb.connolly, neil.armstrong, sumit.garg
  Cc: u-boot-qcom, u-boot

Some platforms might require the external fdt to boot.

This change provides a mechanism to the board initializaion code to make
the requet explicit.

Signed-off-by: Jorge Ramirez-Ortiz <jorge.ramirez@oss.qualcomm.com>
---
 arch/arm/mach-snapdragon/board.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/arch/arm/mach-snapdragon/board.c b/arch/arm/mach-snapdragon/board.c
index 2ef936aab75..1bca9dce20f 100644
--- a/arch/arm/mach-snapdragon/board.c
+++ b/arch/arm/mach-snapdragon/board.c
@@ -150,7 +150,13 @@ static void show_psci_version(void)
 /* We support booting U-Boot with an internal DT when running as a first-stage bootloader
  * or for supporting quirky devices where it's easier to leave the downstream DT in place
  * to improve ABL compatibility. Otherwise, we use the DT provided by ABL.
+ *
+ * Alternatively the board can enforce the external fdt.
  */
+bool __weak qcom_board_fdt_external(void)
+{
+	return false;
+}
 int board_fdt_blob_setup(void **fdtp)
 {
 	struct fdt_header *fdt;
@@ -161,6 +167,12 @@ int board_fdt_blob_setup(void **fdtp)
 	external_valid = fdt && !fdt_check_header(fdt);
 	internal_valid = !fdt_check_header(*fdtp);
 
+	if (qcom_board_fdt_external() && external_valid) {
+		debug("Using external FDT\n");
+		*fdtp = fdt;
+		goto out;
+	}
+
 	/*
 	 * There is no point returning an error here, U-Boot can't do anything useful in this situation.
 	 * Bail out while we can still print a useful error message.
@@ -178,6 +190,7 @@ int board_fdt_blob_setup(void **fdtp)
 		*fdtp = fdt;
 	}
 
+out:
 	/*
 	 * Parse the /memory node while we're here,
 	 * this makes it easy to do other things early.
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH 7/7] board: qualcommm: dragonboard820c: external fdt
  2025-04-07  8:19 Dragonboard 820c - fix board support Jorge Ramirez-Ortiz
                   ` (5 preceding siblings ...)
  2025-04-07  8:19 ` [PATCH 6/7] mach-snapdragon: board interface to enforce fdt Jorge Ramirez-Ortiz
@ 2025-04-07  8:19 ` Jorge Ramirez-Ortiz
  6 siblings, 0 replies; 21+ messages in thread
From: Jorge Ramirez-Ortiz @ 2025-04-07  8:19 UTC (permalink / raw)
  To: jorge.ramirez, caleb.connolly, neil.armstrong, sumit.garg
  Cc: u-boot-qcom, u-boot

The chainloaded u-boot requires the external fdt.

Signed-off-by: Jorge Ramirez-Ortiz <jorge.ramirez@oss.qualcomm.com>
---
 board/qualcomm/dragonboard820c/dragonboard820c.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/board/qualcomm/dragonboard820c/dragonboard820c.c b/board/qualcomm/dragonboard820c/dragonboard820c.c
index d3333a59db0..e7f477b69fe 100644
--- a/board/qualcomm/dragonboard820c/dragonboard820c.c
+++ b/board/qualcomm/dragonboard820c/dragonboard820c.c
@@ -94,6 +94,11 @@ static void sdhci_power_init(void)
 			rclk[i].val  << rclk[i].bit);
 }
 
+bool qcom_board_fdt_external(void)
+{
+	return true;
+}
+
 void qcom_board_init(void)
 {
 	sdhci_power_init();
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 21+ messages in thread

* Re: [PATCH 1/7] board: qualcomm: dragonboard820c: udpate readme
  2025-04-07  8:19 ` [PATCH 1/7] board: qualcomm: dragonboard820c: udpate readme Jorge Ramirez-Ortiz
@ 2025-04-07  9:01   ` neil.armstrong
  0 siblings, 0 replies; 21+ messages in thread
From: neil.armstrong @ 2025-04-07  9:01 UTC (permalink / raw)
  To: Jorge Ramirez-Ortiz, caleb.connolly, sumit.garg; +Cc: u-boot-qcom, u-boot

On 07/04/2025 10:19, Jorge Ramirez-Ortiz wrote:
> Update build instructions.
> 
> Signed-off-by: Jorge Ramirez-Ortiz <jorge.ramirez@oss.qualcomm.com>
> ---
>   board/qualcomm/dragonboard820c/readme.txt | 47 ++++++++++-------------
>   1 file changed, 21 insertions(+), 26 deletions(-)
> 
> diff --git a/board/qualcomm/dragonboard820c/readme.txt b/board/qualcomm/dragonboard820c/readme.txt
> index 966e9520e85..5817c837fdf 100644
> --- a/board/qualcomm/dragonboard820c/readme.txt
> +++ b/board/qualcomm/dragonboard820c/readme.txt
> @@ -16,10 +16,7 @@
>                        Build & Run instructions
>   ================================================================================
>   
> -1) Install mkbootimg and dtbTool from Codeaurora:
> -
> -   git://codeaurora.org/quic/kernel/skales
> -   commit 8492547e404e969262d9070dee9bdd15668bb70f worked for me.
> +1) Install mkbootimg
>   
>   2) Setup CROSS_COMPILE to aarch64 compiler or if you use ccache just do
>      CROSS_COMPILE="ccache aarch64-linux-gnu-"
> @@ -33,15 +30,15 @@
>   
>      $ touch rd
>   
> -5) Generate qualcomm device tree table with dtbTool
> +5) Append the dtb to the u-boot binary
>   
> -   $ dtbTool -o dt.img arch/arm/dts
> +   $ gzip u-boot-dtb.bin
> +   $ cat u-boot.dtb >> u-boot-dtb.bin.gz
>   
>   6) Generate Android boot image with mkbootimg:
>   
> -   $ mkbootimg --kernel=u-boot-dtb.bin             \
> +   $ mkbootimg --kernel=u-boot-dtb.bin.gz          \
>                  --output=u-boot.img                 \
> -               --dt=dt.img                         \
>                  --pagesize 4096                     \
>                  --base 0x80000000                   \
>                  --ramdisk=rd                        \
> @@ -251,44 +248,42 @@ Wait for 5 seconds before proceeding
>   [5300] booting linux @ 0x80080000, ramdisk @ 0x82200000 (0), tags/device tree @ 0x82000000
>   [5310] Jumping to kernel via monitor
>   
> -U-Boot 2017.11-00145-ge895117 (Nov 29 2017 - 10:04:06 +0100)
> +U-Boot 2025.04-rc5-00020-g40a61ca0e7eb-dirty (Apr 07 2025 - 09:37:03 +0200)
>   Qualcomm-DragonBoard 820C
>   
> -DRAM:  3 GiB
> -PSCI:  v1.0
> -MMC:   sdhci@74a4900: 0
> +DRAM:  3.5 GiB (effective 3 GiB)
> +Core:  136 devices, 18 uclasses, devicetree: board
> +MMC:   Bulk clocks not available (-19), trying core clock
> +mmc@74a4900: 0
> +Loading Environment from EXT4... OK
>   In:    serial@75b0000
>   Out:   serial@75b0000
>   Err:   serial@75b0000
> -Net:   Net Initialization Skipped
> -No ethernet found.
> +Net:   No ethernet found.
>   Hit any key to stop autoboot:  0
>   switch to partitions #0, OK
>   mmc0 is current device
>   Scanning mmc 0:1...
>   Found /extlinux/extlinux.conf
>   Retrieving file: /extlinux/extlinux.conf
> -433 bytes read in 71 ms (5.9 KiB/s)
>   1:      nfs root
> -
> +Enter choice: 1:        nfs root
>   Retrieving file: /uImage
> -19397184 bytes read in 2024 ms (9.1 MiB/s)
> -append: root=/dev/nfs rw nfsroot=192.168.1.2:/db820c/rootfs,v3,tcp rootwait ip=dhcp consoleblank=0 console=tty0 console=ttyMSM0,115200n8 earlyprintk earlycon=msm_serial_dm,0x75b0000 androidboot.bootdevice=624000.ufshc androidboot.verifiedbootstate=orange androidboot.ver0
> -
> +append: root=/dev/nfs rw nfsroot=192.168.1.6:/home/jramirez/Src/qualcomm-lt/db820c/rootfs,v3,tcp rootwait ip=dhcp consoleblank=0 console=tty0 console=ttyMSM0,115200n8 earlyprintk earlyco0
>   Retrieving file: /apq8096-db820c.dtb
> -38134 bytes read in 37 ms (1005.9 KiB/s)
> -
> -## Booting kernel from Legacy Image at 95000000 ...
> +## Booting kernel from Legacy Image at 155000000 ...
>      Image Name:   Dragonboard820c
>      Image Type:   AArch64 Linux Kernel Image (uncompressed)
>      Data Size:    19397120 Bytes = 18.5 MiB
>      Load Address: 80080000
>      Entry Point:  80080000
>      Verifying Checksum ... OK
> -## Flattened Device Tree blob at 93000000
> -   Booting using the fdt blob at 0x93000000
> -   Loading Kernel Image ... OK
> -   Using Device Tree in place at 0000000093000000, end 000000009300c4f5
> +## Flattened Device Tree blob at 148600000
> +   Booting using the fdt blob at 0x148600000
> +Working FDT set to 148600000
> +   Loading Kernel Image to 80080000
> +   Using Device Tree in place at 0000000148600000, end 000000014860c4f5
> +Working FDT set to 148600000
>   
>   Starting kernel ...
>   

Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH 2/7] clk/qcom: apq8096: fix set rate for the uart clock
  2025-04-07  8:19 ` [PATCH 2/7] clk/qcom: apq8096: fix set rate for the uart clock Jorge Ramirez-Ortiz
@ 2025-04-07  9:01   ` neil.armstrong
  0 siblings, 0 replies; 21+ messages in thread
From: neil.armstrong @ 2025-04-07  9:01 UTC (permalink / raw)
  To: Jorge Ramirez-Ortiz, caleb.connolly, sumit.garg; +Cc: u-boot-qcom, u-boot

On 07/04/2025 10:19, Jorge Ramirez-Ortiz wrote:
> The function should return a valid rate.
> 
> Signed-off-by: Jorge Ramirez-Ortiz <jorge.ramirez@oss.qualcomm.com>
> ---
>   drivers/clk/qcom/clock-apq8096.c | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/clk/qcom/clock-apq8096.c b/drivers/clk/qcom/clock-apq8096.c
> index c77d69128b0..bc00826a5e8 100644
> --- a/drivers/clk/qcom/clock-apq8096.c
> +++ b/drivers/clk/qcom/clock-apq8096.c
> @@ -87,7 +87,8 @@ static ulong apq8096_clk_set_rate(struct clk *clk, ulong rate)
>   		return clk_init_sdc(priv, rate);
>   		break;
>   	case GCC_BLSP2_UART2_APPS_CLK: /*UART2*/
> -		return clk_init_uart(priv);
> +		clk_init_uart(priv);
> +		return 7372800;
>   	default:
>   		return 0;
>   	}

Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH 3/7] mmc: msm_sdhci: handle bulk clock initialization error
  2025-04-07  8:19 ` [PATCH 3/7] mmc: msm_sdhci: handle bulk clock initialization error Jorge Ramirez-Ortiz
@ 2025-04-07  9:02   ` neil.armstrong
  2025-04-07  9:10     ` Neil Armstrong
  0 siblings, 1 reply; 21+ messages in thread
From: neil.armstrong @ 2025-04-07  9:02 UTC (permalink / raw)
  To: Jorge Ramirez-Ortiz, caleb.connolly, sumit.garg; +Cc: u-boot-qcom, u-boot

On 07/04/2025 10:19, Jorge Ramirez-Ortiz wrote:
> Some boards do not require all clocks to be available (i.e:
> dragonboard820c).

Can you specify which clock isn't available ? Because we have clk-stub for that

Thanks,
Neil

> 
> This change provides a fallback to the core clock when the bulk cant be
> retrived.
> 
> Signed-off-by: Jorge Ramirez-Ortiz <jorge.ramirez@oss.qualcomm.com>
> ---
>   drivers/mmc/msm_sdhci.c | 27 +++++++++++++++++++++++++--
>   1 file changed, 25 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/mmc/msm_sdhci.c b/drivers/mmc/msm_sdhci.c
> index 27bb7052fca..8081330bd25 100644
> --- a/drivers/mmc/msm_sdhci.c
> +++ b/drivers/mmc/msm_sdhci.c
> @@ -9,6 +9,7 @@
>   
>   #include <clk.h>
>   #include <dm.h>
> +#include <dm/devres.h>
>   #include <malloc.h>
>   #include <sdhci.h>
>   #include <wait_bit.h>
> @@ -56,6 +57,17 @@ struct msm_sdhc_variant_info {
>   
>   DECLARE_GLOBAL_DATA_PTR;
>   
> +static int get_core_clock(struct udevice *dev, struct clk_bulk *bulk)
> +{
> +	bulk->count = 1;
> +
> +	bulk->clks = devm_kcalloc(dev, 1, sizeof(struct clk), GFP_KERNEL);
> +	if (!bulk->clks)
> +		return -ENOMEM;
> +
> +	return clk_get_by_name(dev, "core", &bulk->clks[0]);
> +}
> +
>   static int msm_sdc_clk_init(struct udevice *dev)
>   {
>   	struct msm_sdhc *prv = dev_get_priv(dev);
> @@ -73,8 +85,15 @@ static int msm_sdc_clk_init(struct udevice *dev)
>   
>   	ret = clk_get_bulk(dev, &prv->clks);
>   	if (ret) {
> -		log_warning("Couldn't get mmc clocks: %d\n", ret);
> -		return ret;
> +		log_warning("Bulk clocks not available (%d), trying core clock\n", ret);
> +
> +		/* Sometimes not all clocks are needed - chainloading uboot */
> +		ret = get_core_clock(dev, &prv->clks);
> +		if (ret) {
> +			log_warning("Core clock not available:(%d)\n", ret);
> +			return ret;
> +		}
> +		n_clks = 1;
>   	}
>   
>   	ret = clk_enable_bulk(&prv->clks);
> @@ -83,6 +102,9 @@ static int msm_sdc_clk_init(struct udevice *dev)
>   		return ret;
>   	}
>   
> +	if (n_clks == 1)
> +		goto set_rate;
> +
>   	/* If clock-names is unspecified, then the first clock is the core clock */
>   	if (!ofnode_get_property(node, "clock-names", &n_clks)) {
>   		if (!clk_set_rate(&prv->clks.clks[0], clk_rate)) {
> @@ -105,6 +127,7 @@ static int msm_sdc_clk_init(struct udevice *dev)
>   		return -EINVAL;
>   	}
>   
> +set_rate:
>   	/* The clock is already enabled by the clk_bulk above */
>   	clk_rate = clk_set_rate(&prv->clks.clks[i], clk_rate);
>   	/* If we get a rate of 0 then something has probably gone wrong. */


^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH 4/7] clk/qcom: apq8096: fix the sdhci clock
  2025-04-07  8:19 ` [PATCH 4/7] clk/qcom: apq8096: fix the sdhci clock Jorge Ramirez-Ortiz
@ 2025-04-07  9:03   ` neil.armstrong
  0 siblings, 0 replies; 21+ messages in thread
From: neil.armstrong @ 2025-04-07  9:03 UTC (permalink / raw)
  To: Jorge Ramirez-Ortiz, caleb.connolly, sumit.garg; +Cc: u-boot-qcom, u-boot

On 07/04/2025 10:19, Jorge Ramirez-Ortiz wrote:
> Select the right clock for sdhci.
> 
> Signed-off-by: Jorge Ramirez-Ortiz <jorge.ramirez@oss.qualcomm.com>
> ---
>   drivers/clk/qcom/clock-apq8096.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/clk/qcom/clock-apq8096.c b/drivers/clk/qcom/clock-apq8096.c
> index bc00826a5e8..551f52d5197 100644
> --- a/drivers/clk/qcom/clock-apq8096.c
> +++ b/drivers/clk/qcom/clock-apq8096.c
> @@ -83,7 +83,7 @@ static ulong apq8096_clk_set_rate(struct clk *clk, ulong rate)
>   	struct msm_clk_priv *priv = dev_get_priv(clk->dev);
>   
>   	switch (clk->id) {
> -	case GCC_SDCC1_APPS_CLK: /* SDC1 */
> +	case GCC_SDCC2_APPS_CLK: /* SDC2 */
>   		return clk_init_sdc(priv, rate);
>   		break;
>   	case GCC_BLSP2_UART2_APPS_CLK: /*UART2*/

Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH 5/7] configs: dragonboard820: enable GPIO
  2025-04-07  8:19 ` [PATCH 5/7] configs: dragonboard820: enable GPIO Jorge Ramirez-Ortiz
@ 2025-04-07  9:03   ` neil.armstrong
  0 siblings, 0 replies; 21+ messages in thread
From: neil.armstrong @ 2025-04-07  9:03 UTC (permalink / raw)
  To: Jorge Ramirez-Ortiz, caleb.connolly, sumit.garg; +Cc: u-boot-qcom, u-boot

On 07/04/2025 10:19, Jorge Ramirez-Ortiz wrote:
> Configure GPIO.
> 
> Signed-off-by: Jorge Ramirez-Ortiz <jorge.ramirez@oss.qualcomm.com>
> ---
>   configs/dragonboard820c_defconfig | 1 +
>   1 file changed, 1 insertion(+)
> 
> diff --git a/configs/dragonboard820c_defconfig b/configs/dragonboard820c_defconfig
> index e29bea7deb2..b5b6bc026e8 100644
> --- a/configs/dragonboard820c_defconfig
> +++ b/configs/dragonboard820c_defconfig
> @@ -45,4 +45,5 @@ CONFIG_PINCTRL_QCOM_APQ8096=y
>   CONFIG_DM_PMIC=y
>   CONFIG_PMIC_QCOM=y
>   CONFIG_MSM_SERIAL=y
> +CONFIG_MSM_GPIO=y
>   CONFIG_SPMI_MSM=y

Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH 6/7] mach-snapdragon: board interface to enforce fdt
  2025-04-07  8:19 ` [PATCH 6/7] mach-snapdragon: board interface to enforce fdt Jorge Ramirez-Ortiz
@ 2025-04-07  9:04   ` neil.armstrong
  2025-04-07  9:52     ` Jorge Ramirez
  2025-04-07 10:02   ` Caleb Connolly
  1 sibling, 1 reply; 21+ messages in thread
From: neil.armstrong @ 2025-04-07  9:04 UTC (permalink / raw)
  To: Jorge Ramirez-Ortiz, caleb.connolly, sumit.garg; +Cc: u-boot-qcom, u-boot

Hi,

On 07/04/2025 10:19, Jorge Ramirez-Ortiz wrote:
> Some platforms might require the external fdt to boot.

Why ? we may want to build the fdt in, and discard the external fdt for some reasons.

> 
> This change provides a mechanism to the board initializaion code to make
> the requet explicit.
> 
> Signed-off-by: Jorge Ramirez-Ortiz <jorge.ramirez@oss.qualcomm.com>
> ---
>   arch/arm/mach-snapdragon/board.c | 13 +++++++++++++
>   1 file changed, 13 insertions(+)
> 
> diff --git a/arch/arm/mach-snapdragon/board.c b/arch/arm/mach-snapdragon/board.c
> index 2ef936aab75..1bca9dce20f 100644
> --- a/arch/arm/mach-snapdragon/board.c
> +++ b/arch/arm/mach-snapdragon/board.c
> @@ -150,7 +150,13 @@ static void show_psci_version(void)
>   /* We support booting U-Boot with an internal DT when running as a first-stage bootloader
>    * or for supporting quirky devices where it's easier to leave the downstream DT in place
>    * to improve ABL compatibility. Otherwise, we use the DT provided by ABL.
> + *
> + * Alternatively the board can enforce the external fdt.
>    */
> +bool __weak qcom_board_fdt_external(void)
> +{
> +	return false;
> +}
>   int board_fdt_blob_setup(void **fdtp)
>   {
>   	struct fdt_header *fdt;
> @@ -161,6 +167,12 @@ int board_fdt_blob_setup(void **fdtp)
>   	external_valid = fdt && !fdt_check_header(fdt);
>   	internal_valid = !fdt_check_header(*fdtp);
>   
> +	if (qcom_board_fdt_external() && external_valid) {
> +		debug("Using external FDT\n");
> +		*fdtp = fdt;
> +		goto out;
> +	}
> +
>   	/*
>   	 * There is no point returning an error here, U-Boot can't do anything useful in this situation.
>   	 * Bail out while we can still print a useful error message.
> @@ -178,6 +190,7 @@ int board_fdt_blob_setup(void **fdtp)
>   		*fdtp = fdt;
>   	}
>   
> +out:
>   	/*
>   	 * Parse the /memory node while we're here,
>   	 * this makes it easy to do other things early.


^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH 3/7] mmc: msm_sdhci: handle bulk clock initialization error
  2025-04-07  9:02   ` neil.armstrong
@ 2025-04-07  9:10     ` Neil Armstrong
  2025-04-07  9:38       ` Jorge Ramirez
  0 siblings, 1 reply; 21+ messages in thread
From: Neil Armstrong @ 2025-04-07  9:10 UTC (permalink / raw)
  To: Jorge Ramirez-Ortiz, caleb.connolly, sumit.garg; +Cc: u-boot-qcom, u-boot

On 07/04/2025 11:02, neil.armstrong@linaro.org wrote:
> On 07/04/2025 10:19, Jorge Ramirez-Ortiz wrote:
>> Some boards do not require all clocks to be available (i.e:
>> dragonboard820c).
> 
> Can you specify which clock isn't available ? Because we have clk-stub for that

Enable:
CONFIG_CLK_STUB=y

and change this:
diff --git a/drivers/clk/clk-stub.c b/drivers/clk/clk-stub.c
index 343fa5cd3fe..c14f5b6e1a6 100644
--- a/drivers/clk/clk-stub.c
+++ b/drivers/clk/clk-stub.c
@@ -14,7 +14,7 @@
  static const struct udevice_id nop_parent_ids[] = {
         { .compatible = "qcom,rpm-proc" },
         { .compatible = "qcom,glink-rpm" },
-       { .compatible = "qcom,rpm-sm6115" },
+       { .compatible = "qcom,glink-smd-rpm" },
         { }
  };

And clk_get_bulk() should work!

Neil

> 
> Thanks,
> Neil
> 
>>
>> This change provides a fallback to the core clock when the bulk cant be
>> retrived.
>>
>> Signed-off-by: Jorge Ramirez-Ortiz <jorge.ramirez@oss.qualcomm.com>
>> ---
>>   drivers/mmc/msm_sdhci.c | 27 +++++++++++++++++++++++++--
>>   1 file changed, 25 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/mmc/msm_sdhci.c b/drivers/mmc/msm_sdhci.c
>> index 27bb7052fca..8081330bd25 100644
>> --- a/drivers/mmc/msm_sdhci.c
>> +++ b/drivers/mmc/msm_sdhci.c
>> @@ -9,6 +9,7 @@
>>   #include <clk.h>
>>   #include <dm.h>
>> +#include <dm/devres.h>
>>   #include <malloc.h>
>>   #include <sdhci.h>
>>   #include <wait_bit.h>
>> @@ -56,6 +57,17 @@ struct msm_sdhc_variant_info {
>>   DECLARE_GLOBAL_DATA_PTR;
>> +static int get_core_clock(struct udevice *dev, struct clk_bulk *bulk)
>> +{
>> +    bulk->count = 1;
>> +
>> +    bulk->clks = devm_kcalloc(dev, 1, sizeof(struct clk), GFP_KERNEL);
>> +    if (!bulk->clks)
>> +        return -ENOMEM;
>> +
>> +    return clk_get_by_name(dev, "core", &bulk->clks[0]);
>> +}
>> +
>>   static int msm_sdc_clk_init(struct udevice *dev)
>>   {
>>       struct msm_sdhc *prv = dev_get_priv(dev);
>> @@ -73,8 +85,15 @@ static int msm_sdc_clk_init(struct udevice *dev)
>>       ret = clk_get_bulk(dev, &prv->clks);
>>       if (ret) {
>> -        log_warning("Couldn't get mmc clocks: %d\n", ret);
>> -        return ret;
>> +        log_warning("Bulk clocks not available (%d), trying core clock\n", ret);
>> +
>> +        /* Sometimes not all clocks are needed - chainloading uboot */
>> +        ret = get_core_clock(dev, &prv->clks);
>> +        if (ret) {
>> +            log_warning("Core clock not available:(%d)\n", ret);
>> +            return ret;
>> +        }
>> +        n_clks = 1;
>>       }
>>       ret = clk_enable_bulk(&prv->clks);
>> @@ -83,6 +102,9 @@ static int msm_sdc_clk_init(struct udevice *dev)
>>           return ret;
>>       }
>> +    if (n_clks == 1)
>> +        goto set_rate;
>> +
>>       /* If clock-names is unspecified, then the first clock is the core clock */
>>       if (!ofnode_get_property(node, "clock-names", &n_clks)) {
>>           if (!clk_set_rate(&prv->clks.clks[0], clk_rate)) {
>> @@ -105,6 +127,7 @@ static int msm_sdc_clk_init(struct udevice *dev)
>>           return -EINVAL;
>>       }
>> +set_rate:
>>       /* The clock is already enabled by the clk_bulk above */
>>       clk_rate = clk_set_rate(&prv->clks.clks[i], clk_rate);
>>       /* If we get a rate of 0 then something has probably gone wrong. */
> 


^ permalink raw reply related	[flat|nested] 21+ messages in thread

* Re: [PATCH 3/7] mmc: msm_sdhci: handle bulk clock initialization error
  2025-04-07  9:10     ` Neil Armstrong
@ 2025-04-07  9:38       ` Jorge Ramirez
  2025-04-07  9:53         ` Neil Armstrong
  0 siblings, 1 reply; 21+ messages in thread
From: Jorge Ramirez @ 2025-04-07  9:38 UTC (permalink / raw)
  To: Neil Armstrong
  Cc: Jorge Ramirez-Ortiz, caleb.connolly, sumit.garg, u-boot-qcom,
	u-boot

On 07/04/25 11:10:45, Neil Armstrong wrote:
> On 07/04/2025 11:02, neil.armstrong@linaro.org wrote:
> > On 07/04/2025 10:19, Jorge Ramirez-Ortiz wrote:
> > > Some boards do not require all clocks to be available (i.e:
> > > dragonboard820c).
> > 
> > Can you specify which clock isn't available ? Because we have clk-stub for that

right, either GCC_SDCC2_AHB_CLK or RPM_SMD_XO_CLK_SRC (we have
GCC_SDCC2_APPS_CLK which is the one I needed to initialize and work with
MMC).

> 
> Enable:
> CONFIG_CLK_STUB=y
> 
> and change this:
> diff --git a/drivers/clk/clk-stub.c b/drivers/clk/clk-stub.c
> index 343fa5cd3fe..c14f5b6e1a6 100644
> --- a/drivers/clk/clk-stub.c
> +++ b/drivers/clk/clk-stub.c
> @@ -14,7 +14,7 @@
>  static const struct udevice_id nop_parent_ids[] = {
>         { .compatible = "qcom,rpm-proc" },
>         { .compatible = "qcom,glink-rpm" },
> -       { .compatible = "qcom,rpm-sm6115" },
> +       { .compatible = "qcom,glink-smd-rpm" },
>         { }
>  };
> 
> And clk_get_bulk() should work!

ah cool. yes  that did work but something else popped up
is it worth looking further into this? 

U-Boot 2025.04-rc5-00022-gccd064439bc2-dirty (Apr 07 2025 - 11:30:21 +0200)
Qualcomm-DragonBoard 820C
DRAM:  3.5 GiB (effective 3 GiB)
Core:  140 devices, 18 uclasses, devicetree: board
MMC:   Couldn't set MMC core clock rate: 0
Couldn't set MMC core clock rate: 0
mmc@74a4900 - probe failed: -22
Couldn't set MMC core clock rate: 0
Loading Environment from EXT4... Couldn't set MMC core clock rate: 0
** Bad device specification mmc 0 **
In:    serial@75b0000
Out:   serial@75b0000
Err:   serial@75b0000
Net:   No ethernet found.
dragonboard820c =>

> 
> Neil
> 
> > 
> > Thanks,
> > Neil
> > 
> > > 
> > > This change provides a fallback to the core clock when the bulk cant be
> > > retrived.
> > > 
> > > Signed-off-by: Jorge Ramirez-Ortiz <jorge.ramirez@oss.qualcomm.com>
> > > ---
> > >   drivers/mmc/msm_sdhci.c | 27 +++++++++++++++++++++++++--
> > >   1 file changed, 25 insertions(+), 2 deletions(-)
> > > 
> > > diff --git a/drivers/mmc/msm_sdhci.c b/drivers/mmc/msm_sdhci.c
> > > index 27bb7052fca..8081330bd25 100644
> > > --- a/drivers/mmc/msm_sdhci.c
> > > +++ b/drivers/mmc/msm_sdhci.c
> > > @@ -9,6 +9,7 @@
> > >   #include <clk.h>
> > >   #include <dm.h>
> > > +#include <dm/devres.h>
> > >   #include <malloc.h>
> > >   #include <sdhci.h>
> > >   #include <wait_bit.h>
> > > @@ -56,6 +57,17 @@ struct msm_sdhc_variant_info {
> > >   DECLARE_GLOBAL_DATA_PTR;
> > > +static int get_core_clock(struct udevice *dev, struct clk_bulk *bulk)
> > > +{
> > > +    bulk->count = 1;
> > > +
> > > +    bulk->clks = devm_kcalloc(dev, 1, sizeof(struct clk), GFP_KERNEL);
> > > +    if (!bulk->clks)
> > > +        return -ENOMEM;
> > > +
> > > +    return clk_get_by_name(dev, "core", &bulk->clks[0]);
> > > +}
> > > +
> > >   static int msm_sdc_clk_init(struct udevice *dev)
> > >   {
> > >       struct msm_sdhc *prv = dev_get_priv(dev);
> > > @@ -73,8 +85,15 @@ static int msm_sdc_clk_init(struct udevice *dev)
> > >       ret = clk_get_bulk(dev, &prv->clks);
> > >       if (ret) {
> > > -        log_warning("Couldn't get mmc clocks: %d\n", ret);
> > > -        return ret;
> > > +        log_warning("Bulk clocks not available (%d), trying core clock\n", ret);
> > > +
> > > +        /* Sometimes not all clocks are needed - chainloading uboot */
> > > +        ret = get_core_clock(dev, &prv->clks);
> > > +        if (ret) {
> > > +            log_warning("Core clock not available:(%d)\n", ret);
> > > +            return ret;
> > > +        }
> > > +        n_clks = 1;
> > >       }
> > >       ret = clk_enable_bulk(&prv->clks);
> > > @@ -83,6 +102,9 @@ static int msm_sdc_clk_init(struct udevice *dev)
> > >           return ret;
> > >       }
> > > +    if (n_clks == 1)
> > > +        goto set_rate;
> > > +
> > >       /* If clock-names is unspecified, then the first clock is the core clock */
> > >       if (!ofnode_get_property(node, "clock-names", &n_clks)) {
> > >           if (!clk_set_rate(&prv->clks.clks[0], clk_rate)) {
> > > @@ -105,6 +127,7 @@ static int msm_sdc_clk_init(struct udevice *dev)
> > >           return -EINVAL;
> > >       }
> > > +set_rate:
> > >       /* The clock is already enabled by the clk_bulk above */
> > >       clk_rate = clk_set_rate(&prv->clks.clks[i], clk_rate);
> > >       /* If we get a rate of 0 then something has probably gone wrong. */
> > 
> 

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH 6/7] mach-snapdragon: board interface to enforce fdt
  2025-04-07  9:04   ` neil.armstrong
@ 2025-04-07  9:52     ` Jorge Ramirez
  0 siblings, 0 replies; 21+ messages in thread
From: Jorge Ramirez @ 2025-04-07  9:52 UTC (permalink / raw)
  To: neil.armstrong
  Cc: Jorge Ramirez-Ortiz, caleb.connolly, sumit.garg, u-boot-qcom,
	u-boot

On 07/04/25 11:04:30, neil.armstrong@linaro.org wrote:
> Hi,
> 
> On 07/04/2025 10:19, Jorge Ramirez-Ortiz wrote:
> > Some platforms might require the external fdt to boot.
> 
> Why ? we may want to build the fdt in, and discard the external fdt for some reasons.

on the db820c, the device tree that u-boot builds is passed to the LK
appendeded with the image via fastboot: the LK, processes it, ammends
the device tree and then hands it back to u-boot.

see the boot trace:

[2830] Only one appended non-skales DTB, select it.                                                                                                                                        
[2850] cmdline:  androidboot.bootdevice=624000.ufshc androidboot.verifiedbootstate=orange androidboot.veritymode=enforcing androidboot.serialno=2f490ecf androidboot.baseband=apq mdss_mdp0
[2860] Updating device tree: start                                                                                                                                                         
[2860] Updating device tree: done                                                                                                                                                          
[2870] Return value from recv_data: 14                                                                                                                                                     
[2880] RPM GLINK UnInit                                                                                                                                                                    
[2880] Qseecom De-Init Done in Appsbl                                                                                                                                                      
[2880] booting linux @ 0x80080000, ramdisk @ 0x82200000 (0), tags/device tree @ 0x82000000                                                                                                 
[2890] Jumping to kernel via monitor                                                                                                                                                       
                                                                                                                                                                                           
                                                                                                                                                                                           
U-Boot 2025.04-rc5-00022-gccd064439bc2 (Apr 07 2025 - 10:06:51 +0200)                                                                                                                      
Qualcomm-DragonBoard 820C                                                                                                                                                                  
                              

It is this external fdt that we need; so I thought allowing the board to
request the external fdt explicitily might make sense.

if you have some other idea/suggestion, please let me know, happy to abide.

> 
> > 
> > This change provides a mechanism to the board initializaion code to make
> > the requet explicit.
> > 
> > Signed-off-by: Jorge Ramirez-Ortiz <jorge.ramirez@oss.qualcomm.com>
> > ---
> >   arch/arm/mach-snapdragon/board.c | 13 +++++++++++++
> >   1 file changed, 13 insertions(+)
> > 
> > diff --git a/arch/arm/mach-snapdragon/board.c b/arch/arm/mach-snapdragon/board.c
> > index 2ef936aab75..1bca9dce20f 100644
> > --- a/arch/arm/mach-snapdragon/board.c
> > +++ b/arch/arm/mach-snapdragon/board.c
> > @@ -150,7 +150,13 @@ static void show_psci_version(void)
> >   /* We support booting U-Boot with an internal DT when running as a first-stage bootloader
> >    * or for supporting quirky devices where it's easier to leave the downstream DT in place
> >    * to improve ABL compatibility. Otherwise, we use the DT provided by ABL.
> > + *
> > + * Alternatively the board can enforce the external fdt.
> >    */
> > +bool __weak qcom_board_fdt_external(void)
> > +{
> > +	return false;
> > +}
> >   int board_fdt_blob_setup(void **fdtp)
> >   {
> >   	struct fdt_header *fdt;
> > @@ -161,6 +167,12 @@ int board_fdt_blob_setup(void **fdtp)
> >   	external_valid = fdt && !fdt_check_header(fdt);
> >   	internal_valid = !fdt_check_header(*fdtp);
> > +	if (qcom_board_fdt_external() && external_valid) {
> > +		debug("Using external FDT\n");
> > +		*fdtp = fdt;
> > +		goto out;
> > +	}
> > +
> >   	/*
> >   	 * There is no point returning an error here, U-Boot can't do anything useful in this situation.
> >   	 * Bail out while we can still print a useful error message.
> > @@ -178,6 +190,7 @@ int board_fdt_blob_setup(void **fdtp)
> >   		*fdtp = fdt;
> >   	}
> > +out:
> >   	/*
> >   	 * Parse the /memory node while we're here,
> >   	 * this makes it easy to do other things early.
> 

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH 3/7] mmc: msm_sdhci: handle bulk clock initialization error
  2025-04-07  9:38       ` Jorge Ramirez
@ 2025-04-07  9:53         ` Neil Armstrong
  2025-04-07 10:36           ` Jorge Ramirez
  0 siblings, 1 reply; 21+ messages in thread
From: Neil Armstrong @ 2025-04-07  9:53 UTC (permalink / raw)
  To: Jorge Ramirez; +Cc: caleb.connolly, sumit.garg, u-boot-qcom, u-boot

On 07/04/2025 11:38, Jorge Ramirez wrote:
> On 07/04/25 11:10:45, Neil Armstrong wrote:
>> On 07/04/2025 11:02, neil.armstrong@linaro.org wrote:
>>> On 07/04/2025 10:19, Jorge Ramirez-Ortiz wrote:
>>>> Some boards do not require all clocks to be available (i.e:
>>>> dragonboard820c).
>>>
>>> Can you specify which clock isn't available ? Because we have clk-stub for that
> 
> right, either GCC_SDCC2_AHB_CLK or RPM_SMD_XO_CLK_SRC (we have
> GCC_SDCC2_APPS_CLK which is the one I needed to initialize and work with
> MMC).
> 
>>
>> Enable:
>> CONFIG_CLK_STUB=y
>>
>> and change this:
>> diff --git a/drivers/clk/clk-stub.c b/drivers/clk/clk-stub.c
>> index 343fa5cd3fe..c14f5b6e1a6 100644
>> --- a/drivers/clk/clk-stub.c
>> +++ b/drivers/clk/clk-stub.c
>> @@ -14,7 +14,7 @@
>>   static const struct udevice_id nop_parent_ids[] = {
>>          { .compatible = "qcom,rpm-proc" },
>>          { .compatible = "qcom,glink-rpm" },
>> -       { .compatible = "qcom,rpm-sm6115" },
>> +       { .compatible = "qcom,glink-smd-rpm" },
>>          { }
>>   };
>>
>> And clk_get_bulk() should work!
> 
> ah cool. yes  that did work but something else popped up
> is it worth looking further into this?

Yeah look at clk_init_sdc(), it sets SDCC2_AHB & SDCC2_APPS, so you can change next patch to:

diff --git a/drivers/clk/qcom/clock-apq8096.c b/drivers/clk/qcom/clock-apq8096.c
index c77d69128b0..832cda332dc 100644
--- a/drivers/clk/qcom/clock-apq8096.c
+++ b/drivers/clk/qcom/clock-apq8096.c
@@ -83,7 +83,7 @@ static ulong apq8096_clk_set_rate(struct clk *clk, ulong rate)
         struct msm_clk_priv *priv = dev_get_priv(clk->dev);

         switch (clk->id) {
-       case GCC_SDCC1_APPS_CLK: /* SDC1 */
+       case GCC_SDCC2_AHB_CLK: /* SDC2 */
                 return clk_init_sdc(priv, rate);
                 break;
         case GCC_BLSP2_UART2_APPS_CLK: /*UART2*/


Neil

> 
> U-Boot 2025.04-rc5-00022-gccd064439bc2-dirty (Apr 07 2025 - 11:30:21 +0200)
> Qualcomm-DragonBoard 820C
> DRAM:  3.5 GiB (effective 3 GiB)
> Core:  140 devices, 18 uclasses, devicetree: board
> MMC:   Couldn't set MMC core clock rate: 0
> Couldn't set MMC core clock rate: 0
> mmc@74a4900 - probe failed: -22
> Couldn't set MMC core clock rate: 0
> Loading Environment from EXT4... Couldn't set MMC core clock rate: 0
> ** Bad device specification mmc 0 **
> In:    serial@75b0000
> Out:   serial@75b0000
> Err:   serial@75b0000
> Net:   No ethernet found.
> dragonboard820c =>
> 
>>
>> Neil
>>
>>>
>>> Thanks,
>>> Neil
>>>
>>>>
>>>> This change provides a fallback to the core clock when the bulk cant be
>>>> retrived.
>>>>
>>>> Signed-off-by: Jorge Ramirez-Ortiz <jorge.ramirez@oss.qualcomm.com>
>>>> ---
>>>>    drivers/mmc/msm_sdhci.c | 27 +++++++++++++++++++++++++--
>>>>    1 file changed, 25 insertions(+), 2 deletions(-)
>>>>
>>>> diff --git a/drivers/mmc/msm_sdhci.c b/drivers/mmc/msm_sdhci.c
>>>> index 27bb7052fca..8081330bd25 100644
>>>> --- a/drivers/mmc/msm_sdhci.c
>>>> +++ b/drivers/mmc/msm_sdhci.c
>>>> @@ -9,6 +9,7 @@
>>>>    #include <clk.h>
>>>>    #include <dm.h>
>>>> +#include <dm/devres.h>
>>>>    #include <malloc.h>
>>>>    #include <sdhci.h>
>>>>    #include <wait_bit.h>
>>>> @@ -56,6 +57,17 @@ struct msm_sdhc_variant_info {
>>>>    DECLARE_GLOBAL_DATA_PTR;
>>>> +static int get_core_clock(struct udevice *dev, struct clk_bulk *bulk)
>>>> +{
>>>> +    bulk->count = 1;
>>>> +
>>>> +    bulk->clks = devm_kcalloc(dev, 1, sizeof(struct clk), GFP_KERNEL);
>>>> +    if (!bulk->clks)
>>>> +        return -ENOMEM;
>>>> +
>>>> +    return clk_get_by_name(dev, "core", &bulk->clks[0]);
>>>> +}
>>>> +
>>>>    static int msm_sdc_clk_init(struct udevice *dev)
>>>>    {
>>>>        struct msm_sdhc *prv = dev_get_priv(dev);
>>>> @@ -73,8 +85,15 @@ static int msm_sdc_clk_init(struct udevice *dev)
>>>>        ret = clk_get_bulk(dev, &prv->clks);
>>>>        if (ret) {
>>>> -        log_warning("Couldn't get mmc clocks: %d\n", ret);
>>>> -        return ret;
>>>> +        log_warning("Bulk clocks not available (%d), trying core clock\n", ret);
>>>> +
>>>> +        /* Sometimes not all clocks are needed - chainloading uboot */
>>>> +        ret = get_core_clock(dev, &prv->clks);
>>>> +        if (ret) {
>>>> +            log_warning("Core clock not available:(%d)\n", ret);
>>>> +            return ret;
>>>> +        }
>>>> +        n_clks = 1;
>>>>        }
>>>>        ret = clk_enable_bulk(&prv->clks);
>>>> @@ -83,6 +102,9 @@ static int msm_sdc_clk_init(struct udevice *dev)
>>>>            return ret;
>>>>        }
>>>> +    if (n_clks == 1)
>>>> +        goto set_rate;
>>>> +
>>>>        /* If clock-names is unspecified, then the first clock is the core clock */
>>>>        if (!ofnode_get_property(node, "clock-names", &n_clks)) {
>>>>            if (!clk_set_rate(&prv->clks.clks[0], clk_rate)) {
>>>> @@ -105,6 +127,7 @@ static int msm_sdc_clk_init(struct udevice *dev)
>>>>            return -EINVAL;
>>>>        }
>>>> +set_rate:
>>>>        /* The clock is already enabled by the clk_bulk above */
>>>>        clk_rate = clk_set_rate(&prv->clks.clks[i], clk_rate);
>>>>        /* If we get a rate of 0 then something has probably gone wrong. */
>>>
>>


^ permalink raw reply related	[flat|nested] 21+ messages in thread

* Re: [PATCH 6/7] mach-snapdragon: board interface to enforce fdt
  2025-04-07  8:19 ` [PATCH 6/7] mach-snapdragon: board interface to enforce fdt Jorge Ramirez-Ortiz
  2025-04-07  9:04   ` neil.armstrong
@ 2025-04-07 10:02   ` Caleb Connolly
  2025-04-07 10:33     ` Jorge Ramirez
  1 sibling, 1 reply; 21+ messages in thread
From: Caleb Connolly @ 2025-04-07 10:02 UTC (permalink / raw)
  To: Jorge Ramirez-Ortiz, neil.armstrong, sumit.garg; +Cc: u-boot-qcom, u-boot

Hi Jorge,

On 4/7/25 10:19, Jorge Ramirez-Ortiz wrote:
> Some platforms might require the external fdt to boot.

The better way to do this is to use the u-boot-nodtb.bin to build your 
boot image rather than the one which includes the internal FDT. If that 
works I'd prefer it (and it can be mentioned in the build instructions). 
Otherwise it would be good to know what the issue is here.

Kind regards,>
> This change provides a mechanism to the board initializaion code to make
> the requet explicit.
> 
> Signed-off-by: Jorge Ramirez-Ortiz <jorge.ramirez@oss.qualcomm.com>
> ---
>   arch/arm/mach-snapdragon/board.c | 13 +++++++++++++
>   1 file changed, 13 insertions(+)
> 
> diff --git a/arch/arm/mach-snapdragon/board.c b/arch/arm/mach-snapdragon/board.c
> index 2ef936aab75..1bca9dce20f 100644
> --- a/arch/arm/mach-snapdragon/board.c
> +++ b/arch/arm/mach-snapdragon/board.c
> @@ -150,7 +150,13 @@ static void show_psci_version(void)
>   /* We support booting U-Boot with an internal DT when running as a first-stage bootloader
>    * or for supporting quirky devices where it's easier to leave the downstream DT in place
>    * to improve ABL compatibility. Otherwise, we use the DT provided by ABL.
> + *
> + * Alternatively the board can enforce the external fdt.
>    */
> +bool __weak qcom_board_fdt_external(void)
> +{
> +	return false;
> +}
>   int board_fdt_blob_setup(void **fdtp)
>   {
>   	struct fdt_header *fdt;
> @@ -161,6 +167,12 @@ int board_fdt_blob_setup(void **fdtp)
>   	external_valid = fdt && !fdt_check_header(fdt);
>   	internal_valid = !fdt_check_header(*fdtp);
>   
> +	if (qcom_board_fdt_external() && external_valid) {
> +		debug("Using external FDT\n");
> +		*fdtp = fdt;
> +		goto out;
> +	}
> +
>   	/*
>   	 * There is no point returning an error here, U-Boot can't do anything useful in this situation.
>   	 * Bail out while we can still print a useful error message.
> @@ -178,6 +190,7 @@ int board_fdt_blob_setup(void **fdtp)
>   		*fdtp = fdt;
>   	}
>   
> +out:
>   	/*
>   	 * Parse the /memory node while we're here,
>   	 * this makes it easy to do other things early.

-- 
Caleb (they/them)


^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH 6/7] mach-snapdragon: board interface to enforce fdt
  2025-04-07 10:02   ` Caleb Connolly
@ 2025-04-07 10:33     ` Jorge Ramirez
  0 siblings, 0 replies; 21+ messages in thread
From: Jorge Ramirez @ 2025-04-07 10:33 UTC (permalink / raw)
  To: Caleb Connolly
  Cc: Jorge Ramirez-Ortiz, neil.armstrong, sumit.garg, u-boot-qcom,
	u-boot

On 07/04/25 12:02:31, Caleb Connolly wrote:
> Hi Jorge,
> 
> On 4/7/25 10:19, Jorge Ramirez-Ortiz wrote:
> > Some platforms might require the external fdt to boot.
> 
> The better way to do this is to use the u-boot-nodtb.bin to build your boot
> image rather than the one which includes the internal FDT. If that works I'd
> prefer it (and it can be mentioned in the build instructions).

ah of course, yep, will do that.

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH 3/7] mmc: msm_sdhci: handle bulk clock initialization error
  2025-04-07  9:53         ` Neil Armstrong
@ 2025-04-07 10:36           ` Jorge Ramirez
  0 siblings, 0 replies; 21+ messages in thread
From: Jorge Ramirez @ 2025-04-07 10:36 UTC (permalink / raw)
  To: Neil Armstrong
  Cc: Jorge Ramirez, caleb.connolly, sumit.garg, u-boot-qcom, u-boot

On 07/04/25 11:53:06, Neil Armstrong wrote:
> On 07/04/2025 11:38, Jorge Ramirez wrote:
> > On 07/04/25 11:10:45, Neil Armstrong wrote:
> > > On 07/04/2025 11:02, neil.armstrong@linaro.org wrote:
> > > > On 07/04/2025 10:19, Jorge Ramirez-Ortiz wrote:
> > > > > Some boards do not require all clocks to be available (i.e:
> > > > > dragonboard820c).
> > > > 
> > > > Can you specify which clock isn't available ? Because we have clk-stub for that
> > 
> > right, either GCC_SDCC2_AHB_CLK or RPM_SMD_XO_CLK_SRC (we have
> > GCC_SDCC2_APPS_CLK which is the one I needed to initialize and work with
> > MMC).
> > 
> > > 
> > > Enable:
> > > CONFIG_CLK_STUB=y

ok, taking this into the db820 defconfig

> > > 
> > > and change this:
> > > diff --git a/drivers/clk/clk-stub.c b/drivers/clk/clk-stub.c
> > > index 343fa5cd3fe..c14f5b6e1a6 100644
> > > --- a/drivers/clk/clk-stub.c
> > > +++ b/drivers/clk/clk-stub.c
> > > @@ -14,7 +14,7 @@
> > >   static const struct udevice_id nop_parent_ids[] = {
> > >          { .compatible = "qcom,rpm-proc" },
> > >          { .compatible = "qcom,glink-rpm" },
> > > -       { .compatible = "qcom,rpm-sm6115" },
> > > +       { .compatible = "qcom,glink-smd-rpm" },
> > >          { }
> > >   };


so do we need this change to be persistent? are you commiting it?

> > > 
> > > And clk_get_bulk() should work!
> > 
> > ah cool. yes  that did work but something else popped up
> > is it worth looking further into this?
> 
> Yeah look at clk_init_sdc(), it sets SDCC2_AHB & SDCC2_APPS, so you can change next patch to:

perfect. all good now.


> 
> diff --git a/drivers/clk/qcom/clock-apq8096.c b/drivers/clk/qcom/clock-apq8096.c
> index c77d69128b0..832cda332dc 100644
> --- a/drivers/clk/qcom/clock-apq8096.c
> +++ b/drivers/clk/qcom/clock-apq8096.c
> @@ -83,7 +83,7 @@ static ulong apq8096_clk_set_rate(struct clk *clk, ulong rate)
>         struct msm_clk_priv *priv = dev_get_priv(clk->dev);
> 
>         switch (clk->id) {
> -       case GCC_SDCC1_APPS_CLK: /* SDC1 */
> +       case GCC_SDCC2_AHB_CLK: /* SDC2 */
>                 return clk_init_sdc(priv, rate);
>                 break;
>         case GCC_BLSP2_UART2_APPS_CLK: /*UART2*/
> 
> 
> Neil
> 

^ permalink raw reply	[flat|nested] 21+ messages in thread

end of thread, other threads:[~2025-04-07 10:36 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-07  8:19 Dragonboard 820c - fix board support Jorge Ramirez-Ortiz
2025-04-07  8:19 ` [PATCH 1/7] board: qualcomm: dragonboard820c: udpate readme Jorge Ramirez-Ortiz
2025-04-07  9:01   ` neil.armstrong
2025-04-07  8:19 ` [PATCH 2/7] clk/qcom: apq8096: fix set rate for the uart clock Jorge Ramirez-Ortiz
2025-04-07  9:01   ` neil.armstrong
2025-04-07  8:19 ` [PATCH 3/7] mmc: msm_sdhci: handle bulk clock initialization error Jorge Ramirez-Ortiz
2025-04-07  9:02   ` neil.armstrong
2025-04-07  9:10     ` Neil Armstrong
2025-04-07  9:38       ` Jorge Ramirez
2025-04-07  9:53         ` Neil Armstrong
2025-04-07 10:36           ` Jorge Ramirez
2025-04-07  8:19 ` [PATCH 4/7] clk/qcom: apq8096: fix the sdhci clock Jorge Ramirez-Ortiz
2025-04-07  9:03   ` neil.armstrong
2025-04-07  8:19 ` [PATCH 5/7] configs: dragonboard820: enable GPIO Jorge Ramirez-Ortiz
2025-04-07  9:03   ` neil.armstrong
2025-04-07  8:19 ` [PATCH 6/7] mach-snapdragon: board interface to enforce fdt Jorge Ramirez-Ortiz
2025-04-07  9:04   ` neil.armstrong
2025-04-07  9:52     ` Jorge Ramirez
2025-04-07 10:02   ` Caleb Connolly
2025-04-07 10:33     ` Jorge Ramirez
2025-04-07  8:19 ` [PATCH 7/7] board: qualcommm: dragonboard820c: external fdt Jorge Ramirez-Ortiz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox