Dragonboard 820c - fix board support
Subsystems (6)
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
PATCH 1/7 board: qualcomm: dragonboard820c: udpate readme
Update build instructions.
--- board/qualcomm/dragonboard820c/readme.txt | 47 ++++++++++------------- 1 file changed, 21 insertions(+), 26 deletions(-)
board/qualcomm/dragonboard820c/readme.txt +21 -26
@@ -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 ...
Signature · 1 line
2.34.1
Re: [PATCH 1/7] board: qualcomm: dragonboard820c: udpate readme
Quoted 94 lines · Jorge Ramirez-Ortiz
Update build instructions.
Signed-off-by Jorge Ramirez-Ortiz <[email protected]>--- board/qualcomm/dragonboard820c/readme.txt | 47 ++++++++++------------- 1 file changed, 21 insertions(+), 26 deletions(-)board/qualcomm/dragonboard820c/readme.txt +15
-25@@ -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
board/qualcomm/dragonboard820c/readme.txt Wait for 5 seconds before proceeding · line 289
Quoted 10 lines
board/qualcomm/dragonboard820c/readme.txt +6
-1- 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 ...
PATCH 2/7 clk/qcom: apq8096: fix set rate for the uart clock
In reply to Jorge Ramirez-OrtizThe function should return a valid rate.
--- drivers/clk/qcom/clock-apq8096.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/clk/qcom/clock-apq8096.c +2 -1
@@ -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 ; }
Signature · 1 line
2.34.1
Re: [PATCH 2/7] clk/qcom: apq8096: fix set rate for the uart clock
Quoted 12 lines · Jorge Ramirez-Ortiz
The function should return a valid rate.
Signed-off-by Jorge Ramirez-Ortiz <[email protected]>--- drivers/clk/qcom/clock-apq8096.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)drivers/clk/qcom/clock-apq8096.c +0
-0
drivers/clk/qcom/clock-apq8096.c static ulong apq8096_clk_set_rate(struct clk *clk, ulong rate) · line 94
Quoted 9 lines
drivers/clk/qcom/clock-apq8096.c +2
-1@@ -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 ; }
PATCH 3/7 mmc: msm_sdhci: handle bulk clock initialization error
In reply to Jorge Ramirez-OrtizSome 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.
--- drivers/mmc/msm_sdhci.c | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-)
drivers/mmc/msm_sdhci.c +25 -2
@@ -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. */
Signature · 1 line
2.34.1
Re: [PATCH 3/7] mmc: msm_sdhci: handle bulk clock initialization error
Quoted 2 lines · Jorge Ramirez-Ortiz
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
Quoted 75 lines
This change provides a fallback to the core clock when the bulk cant be retrived.
Signed-off-by Jorge Ramirez-Ortiz <[email protected]>--- drivers/mmc/msm_sdhci.c | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-)drivers/mmc/msm_sdhci.c +25
-2@@ -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. */
Re: [PATCH 3/7] mmc: msm_sdhci: handle bulk clock initialization error
Quoted 5 lines · On 07/04/2025 11:02, [email protected] wrote:
Quoted 2 lines · Jorge Ramirez-Ortiz
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:
drivers/clk/clk-stub.c +1 -1
@@ -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
Quoted 73 lines
Thanks,
NeilQuoted 68 lines
This change provides a fallback to the core clock when the bulk cant be retrived.
Signed-off-by Jorge Ramirez-Ortiz <[email protected]>---
drivers/mmc/msm_sdhci.c| 27 +++++++++++++++++++++++++--1 file changed, 25 insertions(+), 2 deletions(-)drivers/mmc/msm_sdhci.c +25
-2@@ -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. */
Re: [PATCH 3/7] mmc: msm_sdhci: handle bulk clock initialization error
Quoted 6 lines · Neil Armstrong
Quoted 5 lines · On 07/04/2025 11:02, [email protected] wrote:
Quoted 2 lines · Jorge Ramirez-Ortiz
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).
Quoted 18 lines
Enable:
CONFIG_CLK_STUB=yand change this:
drivers/clk/clk-stub.c +1
-1@@ -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" }, { } };
Quoted 1 line
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 =>
Quoted 77 lines
Neil
Quoted 73 lines
Thanks,
NeilQuoted 68 lines
This change provides a fallback to the core clock when the bulk cant be retrived.
Signed-off-by Jorge Ramirez-Ortiz <[email protected]>---
drivers/mmc/msm_sdhci.c| 27 +++++++++++++++++++++++++--1 file changed, 25 insertions(+), 2 deletions(-)drivers/mmc/msm_sdhci.c +25
-2@@ -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. */
Re: [PATCH 3/7] mmc: msm_sdhci: handle bulk clock initialization error
Quoted 30 lines · Jorge Ramirez
Quoted 6 lines · Neil Armstrong
Quoted 5 lines · On 07/04/2025 11:02, [email protected] wrote:
Quoted 2 lines · Jorge Ramirez-Ortiz
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_CLKorRPM_SMD_XO_CLK_SRC(we haveGCC_SDCC2_APPS_CLKwhich is the one I needed to initialize and work with MMC).Quoted 18 lines
Enable:
CONFIG_CLK_STUB=yand change this:
drivers/clk/clk-stub.c +1
-1@@ -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" }, { } };
Quoted 4 lines
Quoted 1 line
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:
drivers/clk/qcom/clock-apq8096.c +1 -1
@@ -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
Quoted 94 lines
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: 0Couldn'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 =>
Quoted 77 lines
Neil
Quoted 73 lines
Thanks,
NeilQuoted 68 lines
This change provides a fallback to the core clock when the bulk cant be retrived.
Signed-off-by Jorge Ramirez-Ortiz <[email protected]>--- drivers/mmc/msm_sdhci.c | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-)drivers/mmc/msm_sdhci.c +25
-2@@ -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. */
Re: [PATCH 3/7] mmc: msm_sdhci: handle bulk clock initialization error
Quoted 9 lines · Neil Armstrong
Quoted 8 lines · Jorge Ramirez
Quoted 6 lines · Neil Armstrong
Quoted 5 lines · On 07/04/2025 11:02, [email protected] wrote:
Quoted 2 lines · Jorge Ramirez-Ortiz
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
Quoted 7 lines
Quoted 7 lines
right, either
GCC_SDCC2_AHB_CLKorRPM_SMD_XO_CLK_SRC(we haveGCC_SDCC2_APPS_CLKwhich is the one I needed to initialize and work with MMC).Quoted 3 lines
Enable:
CONFIG_CLK_STUB=y
ok, taking this into the db820 defconfig
Quoted 14 lines
Quoted 14 lines
Quoted 7 lines
and change this:
drivers/clk/clk-stub.c +0
-0drivers/clk/clk-stub.c line 19
Quoted 7 lines
drivers/clk/clk-stub.c +1
-1@@ -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?
Quoted 7 lines
Quoted 5 lines
Quoted 2 lines
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 setsSDCC2_AHB&SDCC2_APPS, so you can change next patch to:
perfect. all good now.
Quoted 18 lines
drivers/clk/qcom/clock-apq8096.c +1
-1@@ -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
PATCH 4/7 clk/qcom: apq8096: fix the sdhci clock
In reply to Jorge Ramirez-OrtizSelect the right clock for sdhci.
--- drivers/clk/qcom/clock-apq8096.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clk/qcom/clock-apq8096.c +1 -1
@@ -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*/
Signature · 1 line
2.34.1
Re: [PATCH 4/7] clk/qcom: apq8096: fix the sdhci clock
Quoted 12 lines · Jorge Ramirez-Ortiz
Select the right clock for sdhci.
Signed-off-by Jorge Ramirez-Ortiz <[email protected]>--- drivers/clk/qcom/clock-apq8096.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/clk/qcom/clock-apq8096.c +0
-0
drivers/clk/qcom/clock-apq8096.c static ulong apq8096_clk_set_rate(struct clk *clk, ulong rate) · line 89
Quoted 8 lines
drivers/clk/qcom/clock-apq8096.c +1
-1@@ -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*/
PATCH 5/7 configs: dragonboard820: enable GPIO
In reply to Jorge Ramirez-OrtizConfigure GPIO.
--- configs/dragonboard820c_defconfig | 1 + 1 file changed, 1 insertion(+)
configs/dragonboard820c_defconfig +1 -0
@@ -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
Signature · 1 line
2.34.1
Re: [PATCH 5/7] configs: dragonboard820: enable GPIO
Quoted 12 lines · Jorge Ramirez-Ortiz
Configure GPIO.
Signed-off-by Jorge Ramirez-Ortiz <[email protected]>--- configs/dragonboard820c_defconfig | 1 + 1 file changed, 1 insertion(+)configs/dragonboard820c_defconfig +0
-0
configs/dragonboard820c_defconfig CONFIG_PINCTRL_QCOM_APQ8096=y · line 49
Quoted 5 lines
configs/dragonboard820c_defconfig +1
-0@@ -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
PATCH 6/7 mach-snapdragon: board interface to enforce fdt
In reply to Jorge Ramirez-OrtizSome platforms might require the external fdt to boot.
This change provides a mechanism to the board initializaion code to make the requet explicit.
--- arch/arm/mach-snapdragon/board.c | 13 +++++++++++++ 1 file changed, 13 insertions(+)
arch/arm/mach-snapdragon/board.c +13 -0
@@ -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.
Signature · 1 line
2.34.1
Re: [PATCH 6/7] mach-snapdragon: board interface to enforce fdt
Hi,
Quoted 1 line · Jorge Ramirez-Ortiz
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.
Quoted 48 lines
This change provides a mechanism to the board initializaion code to make the requet explicit.
Signed-off-by Jorge Ramirez-Ortiz <[email protected]>--- arch/arm/mach-snapdragon/board.c | 13 +++++++++++++ 1 file changed, 13 insertions(+)arch/arm/mach-snapdragon/board.c +13
-0@@ -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.
Re: [PATCH 6/7] mach-snapdragon: board interface to enforce fdt
Quoted 6 lines · On 07/04/25 11:04:30, [email protected] wrote:
Hi,
Quoted 1 line · Jorge Ramirez-Ortiz
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.
Quoted 48 lines
Quoted 47 lines
This change provides a mechanism to the board initializaion code to make the requet explicit.
Signed-off-by Jorge Ramirez-Ortiz <[email protected]>--- arch/arm/mach-snapdragon/board.c | 13 +++++++++++++ 1 file changed, 13 insertions(+)arch/arm/mach-snapdragon/board.c +13
-0@@ -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.
Re: [PATCH 6/7] mach-snapdragon: board interface to enforce fdt
In reply to Jorge Ramirez-OrtizHi Jorge,
Quoted 1 line · Jorge Ramirez-Ortiz
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,>
Quoted 47 lines
This change provides a mechanism to the board initializaion code to make the requet explicit.
Signed-off-by Jorge Ramirez-Ortiz <[email protected]>--- arch/arm/mach-snapdragon/board.c | 13 +++++++++++++ 1 file changed, 13 insertions(+)arch/arm/mach-snapdragon/board.c +13
-0@@ -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.
Signature · 1 line
Caleb (they/them)
Re: [PATCH 6/7] mach-snapdragon: board interface to enforce fdt
Quoted 8 lines · Caleb Connolly
Hi Jorge,
Quoted 1 line · Jorge Ramirez-Ortiz
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.
PATCH 7/7 board: qualcommm: dragonboard820c: external fdt
In reply to Jorge Ramirez-OrtizThe chainloaded u-boot requires the external fdt.
--- board/qualcomm/dragonboard820c/dragonboard820c.c | 5 +++++ 1 file changed, 5 insertions(+)
board/qualcomm/dragonboard820c/dragonboard820c.c +5 -0
@@ -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 ();
Signature · 1 line
2.34.1