Skip to contentSkip to conversation

Qualcomm: fix sdm845 clocks and enable fastboot

PATCH Applied Caleb Connolly 2 participants 9 messages Mar 24, 2025 – Mar 31, 2025

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

cover Qualcomm: fix sdm845 clocks and enable fastboot

Fix clock init failures for USB and UFS on SDM845 devices, stub the RPMh clock controller, enable DM_USB_GADGET and fastboot support for all Qualcomm platforms supported by qcom_defconfig.

Fastboot isn't super useful yet, but can be used for flashing MMC (either internal or sdcard).

Depends on https://lore.kernel.org/u-boot/[email protected]
Depends on https://lore.kernel.org/u-boot/[email protected]/

---
Caleb Connolly (4):
clk/stub: add sdm845 rpmh clock clk/qcom: sdm845: add GCC_AGGRE_UFS_PHY_AXI_CLK
mach-snapdragon: enable DM_USB_GADGET by default
qcom_defconfig: enable fastboot

 arch/arm/Kconfig                  | 1 +
 configs/dragonboard410c_defconfig | 1 +
 configs/qcom_defconfig            | 5 +++++
 drivers/clk/clk-stub.c            | 1 +
 drivers/clk/qcom/clock-sdm845.c   | 1 +
 5 files changed, 9 insertions(+)

---
base-commit: dcb6a5e7651f4a6cebfad4389119407e2a852783

Caleb Connolly <[email protected]>

#1 lore raw

PATCH 1/4 clk/stub: add sdm845 rpmh clock

Necessary for UFS to successfully probe all clocks.

---
 drivers/clk/clk-stub.c | 1 +
 1 file changed, 1 insertion(+)
drivers/clk/clk-stub.c +1 -0
index 343fa5cd3fe1704c6bb15a8c9852b9b4e4990351..521ecfc5917b45f8ffaf2f25aabcc5abb4863cea 100644
@@ -49,8 +49,9 @@ static struct clk_ops stub_clk_ops = {
 };
 
 static const struct udevice_id stub_clk_ids[] = {
 	{ .compatible = "qcom,rpmcc" },
+	{ .compatible = "qcom,sdm845-rpmh-clk" },
 	{ .compatible = "qcom,sc7280-rpmh-clk" },
 	{ .compatible = "qcom,sm8150-rpmh-clk" },
 	{ .compatible = "qcom,sm8250-rpmh-clk" },
 	{ .compatible = "qcom,sm8550-rpmh-clk" },
Signature · 1 line
2.49.0
Reviewed-by on v1 1/4
#2 lore raw

Re: [PATCH 1/4] clk/stub: add sdm845 rpmh clock

Quoted 13 lines · Caleb Connolly

Necessary for UFS to successfully probe all clocks.

---
  drivers/clk/clk-stub.c | 1 +
  1 file changed, 1 insertion(+)
drivers/clk/clk-stub.c +0 -0
index 343fa5cd3fe1704c6bb15a8c9852b9b4e4990351..521ecfc5917b45f8ffaf2f25aabcc5abb4863cea 100644

drivers/clk/clk-stub.c static struct clk_ops stub_clk_ops = { · line 57

Quoted 9 lines
drivers/clk/clk-stub.c +1 -0
@@ -49,8 +49,9 @@ static struct clk_ops stub_clk_ops = {
  };
 
  static const struct udevice_id stub_clk_ids[] = {
  	{ .compatible = "qcom,rpmcc" },
+	{ .compatible = "qcom,sdm845-rpmh-clk" },
  	{ .compatible = "qcom,sc7280-rpmh-clk" },
  	{ .compatible = "qcom,sm8150-rpmh-clk" },
  	{ .compatible = "qcom,sm8250-rpmh-clk" },
  	{ .compatible = "qcom,sm8550-rpmh-clk" },
#3 lore raw

PATCH 2/4 clk/qcom: sdm845: add GCC_AGGRE_UFS_PHY_AXI_CLK

In reply to Caleb Connolly

Missing for UFS.

---
 drivers/clk/qcom/clock-sdm845.c | 1 +
 1 file changed, 1 insertion(+)
drivers/clk/qcom/clock-sdm845.c +1 -0
index 7fd875e55d5443f170801172a373e0405041e1d1..5c8702ef2fe00a46a30dbdfddd6e649d20465006 100644
@@ -113,8 +113,9 @@ static const struct gate_clk sdm845_clks[] = {
 	GATE_CLK(GCC_UFS_CARD_RX_SYMBOL_1_CLK,		0x750a8, 0x00000001),
 	GATE_CLK(GCC_UFS_CARD_TX_SYMBOL_0_CLK,		0x75014, 0x00000001),
 	GATE_CLK(GCC_UFS_CARD_UNIPRO_CORE_CLK,		0x75054, 0x00000001),
 	GATE_CLK(GCC_UFS_MEM_CLKREF_CLK,		0x8c000, 0x00000001),
+	GATE_CLK(GCC_AGGRE_UFS_PHY_AXI_CLK,		0x82024, 0x00000001),
 	GATE_CLK(GCC_UFS_PHY_AHB_CLK,			0x77010, 0x00000001),
 	GATE_CLK(GCC_UFS_PHY_AXI_CLK,			0x7700c, 0x00000001),
 	GATE_CLK(GCC_UFS_PHY_ICE_CORE_CLK,		0x77058, 0x00000001),
 	GATE_CLK(GCC_UFS_PHY_PHY_AUX_CLK,		0x7708c, 0x00000001),
Signature · 1 line
2.49.0
Reviewed-by on v1 2/4
#4 lore raw

Re: [PATCH 2/4] clk/qcom: sdm845: add GCC_AGGRE_UFS_PHY_AXI_CLK

Quoted 13 lines · Caleb Connolly

Missing for UFS.

---
  drivers/clk/qcom/clock-sdm845.c | 1 +
  1 file changed, 1 insertion(+)
drivers/clk/qcom/clock-sdm845.c +0 -0
index 7fd875e55d5443f170801172a373e0405041e1d1..5c8702ef2fe00a46a30dbdfddd6e649d20465006 100644

drivers/clk/qcom/clock-sdm845.c static const struct gate_clk sdm845_clks[] = { · line 121

Quoted 9 lines
drivers/clk/qcom/clock-sdm845.c +1 -0
@@ -113,8 +113,9 @@ static const struct gate_clk sdm845_clks[] = {
  	GATE_CLK(GCC_UFS_CARD_RX_SYMBOL_1_CLK,		0x750a8, 0x00000001),
  	GATE_CLK(GCC_UFS_CARD_TX_SYMBOL_0_CLK,		0x75014, 0x00000001),
  	GATE_CLK(GCC_UFS_CARD_UNIPRO_CORE_CLK,		0x75054, 0x00000001),
  	GATE_CLK(GCC_UFS_MEM_CLKREF_CLK,		0x8c000, 0x00000001),
+	GATE_CLK(GCC_AGGRE_UFS_PHY_AXI_CLK,		0x82024, 0x00000001),
  	GATE_CLK(GCC_UFS_PHY_AHB_CLK,			0x77010, 0x00000001),
  	GATE_CLK(GCC_UFS_PHY_AXI_CLK,			0x7700c, 0x00000001),
  	GATE_CLK(GCC_UFS_PHY_ICE_CORE_CLK,		0x77058, 0x00000001),
  	GATE_CLK(GCC_UFS_PHY_PHY_AUX_CLK,		0x7708c, 0x00000001),
#5 lore raw

PATCH 3/4 mach-snapdragon: enable DM_USB_GADGET by default

In reply to Caleb Connolly

This is required for gadget modes to work on most platforms. It must be disabled for dragonboard410c since that doesn't use dwc3. USB on other MSM8916 platforms isn't supported by qcom_defconfig anyway.

---
 arch/arm/Kconfig                  | 1 +
 configs/dragonboard410c_defconfig | 1 +
 2 files changed, 2 insertions(+)
arch/arm/Kconfig +1 -0
index 32b80da9869a1647b7b295d3070964fa11f4fc65..63aefeda9575fec8fc57194358df0819397d088e 100644
@@ -1120,8 +1120,9 @@ config ARCH_SNAPDRAGON
 	select SYSRESET
 	select SYSRESET_PSCI
 	imply OF_UPSTREAM
 	imply CMD_DM
+	imply DM_USB_GADGET
 
 config ARCH_SOCFPGA
 	bool "Altera SOCFPGA family"
 	select ARCH_EARLY_INIT_R
configs/dragonboard410c_defconfig +1 -0
index 967817f4f58e901fc827b4ed991ddd61d1167efa..5870aae83b4fc8d6897eb0f18cc4eb153d299c11 100644
@@ -59,8 +59,9 @@ CONFIG_DM_PMIC=y
 CONFIG_PMIC_QCOM=y
 CONFIG_MSM_SERIAL=y
 CONFIG_SPMI_MSM=y
 CONFIG_USB=y
+# CONFIG_DM_USB_GADGET is not set
 CONFIG_USB_EHCI_HCD=y
 CONFIG_USB_EHCI_MSM=y
 CONFIG_USB_ULPI_VIEWPORT=y
 CONFIG_USB_ULPI=y
Signature · 1 line
2.49.0
#6 lore raw

PATCH 4/4 qcom_defconfig: enable fastboot

In reply to Caleb Connolly

Enable fastboot support over USB, using MMC as the backend. This will be the internal eMMC on devices that have it, or the sdcard slot on devices with UFS (if available).

We don't use a fixed address for the fastboot buffer because it's allocated at runtime per-board. Entering fastboot mode should be done by executing "run fastboot" or manually running:

fastboot -l $fastboot_addr_r usb 0

---
 configs/qcom_defconfig | 5 +++++
 1 file changed, 5 insertions(+)
configs/qcom_defconfig +5 -0
index ba4d38d100e053e3708ee2623bf3530787b6b94f..f5c005d9c4093e4902b05213ab2f54c8ca70208a 100644
@@ -61,8 +61,13 @@ CONFIG_CLK_QCOM_SC7280=y
 CONFIG_CLK_QCOM_X1E80100=y
 CONFIG_DFU_MMC=y
 CONFIG_DFU_SCSI=y
 CONFIG_SYS_DFU_DATA_BUF_SIZE=0x200000
+CONFIG_USB_FUNCTION_FASTBOOT=y
+CONFIG_FASTBOOT_BUF_ADDR=0x0
+CONFIG_FASTBOOT_FLASH=y
+CONFIG_FASTBOOT_FLASH_MMC_DEV=0
+CONFIG_FASTBOOT_MMC_USER_SUPPORT=y
 CONFIG_MSM_GPIO=y
 CONFIG_QCOM_PMIC_GPIO=y
 CONFIG_DM_I2C=y
 CONFIG_SYS_I2C_QUP=y
Signature · 1 line
2.49.0
Reviewed-by on v1 4/4
#7 lore raw

Re: [PATCH 4/4] qcom_defconfig: enable fastboot

Quoted 24 lines · Caleb Connolly

Enable fastboot support over USB, using MMC as the backend. This will be the internal eMMC on devices that have it, or the sdcard slot on devices with UFS (if available).

We don't use a fixed address for the fastboot buffer because it's allocated at runtime per-board. Entering fastboot mode should be done by executing "run fastboot" or manually running:

fastboot -l $fastboot_addr_r usb 0

---
  configs/qcom_defconfig | 5 +++++
  1 file changed, 5 insertions(+)
configs/qcom_defconfig +0 -0
index ba4d38d100e053e3708ee2623bf3530787b6b94f..f5c005d9c4093e4902b05213ab2f54c8ca70208a 100644
@@ -61,8 +61,13 @@ CONFIG_CLK_QCOM_SC7280=y
  CONFIG_CLK_QCOM_X1E80100=y
  CONFIG_DFU_MMC=y
  CONFIG_DFU_SCSI=y

configs/qcom_defconfig CONFIG_CLK_QCOM_SC7280=y · line 73

Quoted 10 lines
configs/qcom_defconfig +5 -0
  CONFIG_SYS_DFU_DATA_BUF_SIZE=0x200000
+CONFIG_USB_FUNCTION_FASTBOOT=y
+CONFIG_FASTBOOT_BUF_ADDR=0x0
+CONFIG_FASTBOOT_FLASH=y
+CONFIG_FASTBOOT_FLASH_MMC_DEV=0
+CONFIG_FASTBOOT_MMC_USER_SUPPORT=y
  CONFIG_MSM_GPIO=y
  CONFIG_QCOM_PMIC_GPIO=y
  CONFIG_DM_I2C=y
  CONFIG_SYS_I2C_QUP=y
author Applied
#8 lore raw
In reply to Caleb Connolly
Quoted 8 lines · Caleb Connolly

Fix clock init failures for USB and UFS on SDM845 devices, stub the RPMh clock controller, enable DM_USB_GADGET and fastboot support for all Qualcomm platforms supported by qcom_defconfig.

Fastboot isn't super useful yet, but can be used for flashing MMC (either internal or sdcard).

[...]

Applied, thanks!

[1/4] clk/stub: add sdm845 rpmh clock

      https://source.denx.de/u-boot/custodians/u-boot-snapdragon/-/commit/f1db41b320b7

[2/4] clk/qcom: sdm845: add GCC_AGGRE_UFS_PHY_AXI_CLK
https://source.denx.de/u-boot/custodians/u-boot-snapdragon/-/commit/15cde58aaf5f
[3/4] mach-snapdragon: enable DM_USB_GADGET by default
https://source.denx.de/u-boot/custodians/u-boot-snapdragon/-/commit/7235dbedfce3
[4/4] qcom_defconfig: enable fastboot
https://source.denx.de/u-boot/custodians/u-boot-snapdragon/-/commit/af2bc4c21dd1

Best regards,

Signature · 1 line
Caleb Connolly <[email protected]>