Skip to contentSkip to conversation

arm64: dts: qcom: lemans-evk: Update SDHC storage support via overlays

PATCH New Monish Chunara 2 participants 5 messages Nov 25

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

v2 cover arm64: dts: qcom: lemans-evk: Update SDHC storage support via overlays

This is the v2 of the series that updates the device tree configuration for the LeMans EVK board to support dynamic selection between SD card and eMMC storage.

The LeMans EVK hardware supports either an SD card or eMMC, but the interfaces are mutually exclusive as they share the same controller and resources. Previously, SD card support was hardcoded in the main device tree, preventing easy switching to eMMC.

This series refactors the SDHC configuration by:

1. Moving the existing SD card configuration into a dedicated overlay.
2. Adding a new overlay to support eMMC.
3. Updating the common SDHC node in the SoC dtsi to include necessary resources (clocks, register ranges) required by the eMMC configuration.

This allows the bootloader to apply the appropriate overlay based on the desired storage medium.

Changes in v2:
- Propagate Reviewed-by tags (Konrad)
- Segregate the SoC file changes for eMMC command queue feature as a
separate patch (Konrad)
- Also update the corresponding resources in LeMans Embedded specific
DT
- Rectify the register address format (Konrad, sashiko-bot)
- Link to v1: https://lore.kernel.org/all/[email protected]/

Monish Chunara (3):
arm64: dts: qcom: lemans-evk: Move SD card support to overlay
arm64: dts: qcom: lemans: Add CQE register region for SDHC
arm64: dts: qcom: lemans-evk: Add SDHCI support for eMMC via overlay

 arch/arm64/boot/dts/qcom/Makefile             |  6 ++
 arch/arm64/boot/dts/qcom/lemans-embedded.dtsi |  6 +-
 arch/arm64/boot/dts/qcom/lemans-evk-emmc.dtso | 64 +++++++++++++++++++
 .../boot/dts/qcom/lemans-evk-sd-card.dtso     | 25 ++++++++
 arch/arm64/boot/dts/qcom/lemans-evk.dts       | 16 -----
 arch/arm64/boot/dts/qcom/lemans.dtsi          |  4 +-
 6 files changed, 102 insertions(+), 19 deletions(-)
 create mode 100644 arch/arm64/boot/dts/qcom/lemans-evk-emmc.dtso
 create mode 100644 arch/arm64/boot/dts/qcom/lemans-evk-sd-card.dtso
Signature · 1 line
2.34.1
#1 lore raw

PATCH v2 1/3 arm64: dts: qcom: lemans-evk: Move SD card support to overlay

The lemans EVK board supports either eMMC or SD-card, but only one can be active at a time.

Move the SDHC node for SD card into a dedicated device tree overlay. This decoupling allows the storage medium to be selected dynamically by applying the appropriate overlay for either SD card or eMMC support.

---
 arch/arm64/boot/dts/qcom/Makefile             |  3 +++
 .../boot/dts/qcom/lemans-evk-sd-card.dtso     | 25 +++++++++++++++++++
 arch/arm64/boot/dts/qcom/lemans-evk.dts       | 16 ------------
 3 files changed, 28 insertions(+), 16 deletions(-)
 create mode 100644 arch/arm64/boot/dts/qcom/lemans-evk-sd-card.dtso
arch/arm64/boot/dts/qcom/Makefile +3 -0
index 19310879349d..fb894ff002c6 100644
@@ -67,6 +67,9 @@ dtb-$(CONFIG_ARCH_QCOM)	+= kaanapali-xiaomi-nezha-cn.dtb kaanapali-xiaomi-nezha-
 dtb-$(CONFIG_ARCH_QCOM)	+= kalambo-crd.dtb
 dtb-$(CONFIG_ARCH_QCOM)	+= lemans-evk.dtb
 
+lemans-evk-sd-card-dtbs := lemans-evk.dtb lemans-evk-sd-card.dtbo
+dtb-$(CONFIG_ARCH_QCOM) += lemans-evk-sd-card.dtb
+
 lemans-evk-camera-csi1-imx577-dtbs	:= lemans-evk.dtb lemans-evk-camera-csi1-imx577.dtbo
 lemans-evk-camera-dtbs	:= lemans-evk.dtb lemans-evk-camera.dtbo
 
arch/arm64/boot/dts/qcom/lemans-evk-sd-card.dtso new file +25 -0
new file mode 100644
index 000000000000..007ab6347349
@@ -0,0 +1,25 @@
+// SPDX-License-Identifier: BSD-3-Clause
+/*
+ * Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.
+ */
+
+/dts-v1/;
+/plugin/;
+
+#include <dt-bindings/gpio/gpio.h>
+
+&sdhc {
+	vmmc-supply = <&vmmc_sdc>;
+	vqmmc-supply = <&vreg_sdc>;
+
+	pinctrl-0 = <&sdc_default>, <&sd_cd>;
+	pinctrl-1 = <&sdc_sleep>, <&sd_cd>;
+	pinctrl-names = "default", "sleep";
+
+	bus-width = <4>;
+	cd-gpios = <&tlmm 36 GPIO_ACTIVE_LOW>;
+	no-mmc;
+	no-sdio;
+
+	status = "okay";
+};
arch/arm64/boot/dts/qcom/lemans-evk.dts +0 -16
index 603a3fa18994..05a6e0c27538 100644
@@ -962,22 +962,6 @@ &remoteproc_gpdsp1 {
 	status = "okay";
 };
 
-&sdhc {
-	vmmc-supply = <&vmmc_sdc>;
-	vqmmc-supply = <&vreg_sdc>;
-
-	pinctrl-0 = <&sdc_default>, <&sd_cd>;
-	pinctrl-1 = <&sdc_sleep>, <&sd_cd>;
-	pinctrl-names = "default", "sleep";
-
-	bus-width = <4>;
-	cd-gpios = <&tlmm 36 GPIO_ACTIVE_LOW>;
-	no-mmc;
-	no-sdio;
-
-	status = "okay";
-};
-
 &serdes0 {
 	vdda-0p9-supply = <&vreg_l4a>;
 	vdda-1p2-supply = <&vreg_l1c>;
Signature · 1 line
2.34.1
#2 lore raw

PATCH v2 2/3 arm64: dts: qcom: lemans: Add CQE register region for SDHC

In reply to Monish Chunara

The SDHC controller on Lemans has a Command Queue Engine (CQE) whose registers sit in a separate region after the host controller registers. Describe this region in the sdhc node, along with matching reg-names, so the sdhci-msm driver can map it and enable command queuing support for eMMC.

The controller also needs the XO clock as a reference for its internal logic. Add RPMH_CXO_CLK as the "xo" clock for this purpose.

---
 arch/arm64/boot/dts/qcom/lemans-embedded.dtsi | 6 ++++--
 arch/arm64/boot/dts/qcom/lemans.dtsi          | 4 +++-
 2 files changed, 7 insertions(+), 3 deletions(-)
arch/arm64/boot/dts/qcom/lemans-embedded.dtsi +4 -2
index 0be39bb9de1e..2ae492455fae 100644
@@ -1636,9 +1636,11 @@ &remoteproc_gpdsp1 {
 
 &sdhc {
 	clocks = <&gcc GCC_SDCC1_AHB_CLK>,
-		 <&gcc GCC_SDCC1_APPS_CLK>;
+		 <&gcc GCC_SDCC1_APPS_CLK>,
+		 <&rpmhcc RPMH_CXO_CLK>;
 	clock-names = "iface",
-		      "core";
+		      "core",
+		      "xo";
 
 	interconnects = <&aggre1_noc MASTER_SDC QCOM_ICC_TAG_ALWAYS
 			 &mc_virt SLAVE_EBI1 QCOM_ICC_TAG_ALWAYS>,
arch/arm64/boot/dts/qcom/lemans.dtsi +3 -1
index e298747c06bc..2946853354f8 100644
@@ -2937,7 +2937,9 @@ apss_tpdm2_out: endpoint {
 
 		sdhc: mmc@87c4000 {
 			compatible = "qcom,sa8775p-sdhci", "qcom,sdhci-msm-v5";
-			reg = <0x0 0x087c4000 0x0 0x1000>;
+			reg = <0x0 0x087c4000 0x0 0x1000>,
+			      <0x0 0x087c5000 0x0 0x1000>;
+			reg-names = "hc", "cqhci";
 
 			interrupts = <GIC_SPI 383 IRQ_TYPE_LEVEL_HIGH>,
 				     <GIC_SPI 521 IRQ_TYPE_LEVEL_HIGH>;
Signature · 1 line
2.34.1
#3 lore raw

PATCH v2 3/3 arm64: dts: qcom: lemans-evk: Add SDHCI support for eMMC via overlay

In reply to Monish Chunara

Enable the SDHCI controller for eMMC functionality on the lemans EVK using a device tree overlay. Configure the corresponding addresse space and resources for eMMC.

---
 arch/arm64/boot/dts/qcom/Makefile             |  3 +
 arch/arm64/boot/dts/qcom/lemans-evk-emmc.dtso | 64 +++++++++++++++++++
 2 files changed, 67 insertions(+)
 create mode 100644 arch/arm64/boot/dts/qcom/lemans-evk-emmc.dtso
arch/arm64/boot/dts/qcom/Makefile +3 -0
index fb894ff002c6..25dae330d74e 100644
@@ -67,6 +67,9 @@ dtb-$(CONFIG_ARCH_QCOM)	+= kaanapali-xiaomi-nezha-cn.dtb kaanapali-xiaomi-nezha-
 dtb-$(CONFIG_ARCH_QCOM)	+= kalambo-crd.dtb
 dtb-$(CONFIG_ARCH_QCOM)	+= lemans-evk.dtb
 
+lemans-evk-emmc-dtbs := lemans-evk.dtb lemans-evk-emmc.dtbo
+dtb-$(CONFIG_ARCH_QCOM) += lemans-evk-emmc.dtb
+
 lemans-evk-sd-card-dtbs := lemans-evk.dtb lemans-evk-sd-card.dtbo
 dtb-$(CONFIG_ARCH_QCOM) += lemans-evk-sd-card.dtb
 
arch/arm64/boot/dts/qcom/lemans-evk-emmc.dtso new file +64 -0

64 lines not on this page · raw message

Signature · 1 line
2.34.1
#4 lore raw

Re: [PATCH V2 3/3] arm64: dts: qcom: lemans-evk: Add SDHCI support for eMMC via overlay

Thank you for your contribution! Sashiko AI review found 3 potential issues to consider: - [High] arm64: dts: qcom: lemans-evk-emmc: broken overlay root and dummy regulators - [Low] arm64: dts…

Thank you for your contribution! Sashiko AI review found 3 potential issues to consider:
- [High] arm64: dts: qcom: lemans-evk-emmc: broken overlay root and dummy regulators
- [Low] arm64: dts: qcom: lemans-evk-emmc: drive-strength on input-only sdc1_rclk
- [Low] arm64: dts: qcom: lemans-evk-emmc: unused header includes and style issues
--

commit 0884fd1ba1dd2afefa178620baee944918f3c9b0
Author: Monish Chunara <[email protected]>

arm64: dts: qcom: lemans-evk: Add SDHCI support for eMMC via overlay

This commit adds a devicetree overlay to enable the SDHCI controller for eMMC on the lemans EVK board and wires it into the build.

Quoted 7 lines
arch/arm64/boot/dts/qcom/lemans-evk-emmc.dtso new file +1 -0
new file mode 100644
index 0000000000000..52739d39a1ff8
@@ -0,0 +1,64 @@
+// SPDX-License-Identifier: BSD-3-Clause

arch/arm64/boot/dts/qcom/lemans-evk-emmc.dtso line 11

Quoted 10 lines
arch/arm64/boot/dts/qcom/lemans-evk-emmc.dtso new file +10 -0
+/*
+ * Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.
+ */
+
+/dts-v1/;
+/plugin/;
+
+#include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/clock/qcom,rpmh.h>
+#include <dt-bindings/clock/qcom,sa8775p-gcc.h>

[Severity: Low]
This isn't a bug, but none of these three dt-bindings headers are used in this file. Also, qcom,dll-config below uses uppercase hex digits instead of lowercase <0x000f64ec>, and the subnodes under &tlmm are indented with spaces rather than tabs.

Quoted 12 lines
arch/arm64/boot/dts/qcom/lemans-evk-emmc.dtso new file +12 -0
+
+/ {
+	vmmc_sdc1: regulator-l8c {
+		compatible = "regulator-fixed";
+		regulator-name = "vreg-sdc1";
+
+		regulator-min-microvolt = <2960000>;
+		regulator-max-microvolt = <2960000>;
+	};
+
+	vqmmc_sdc1: regulator-s4a {
+		compatible = "regulator-fixed";

arch/arm64/boot/dts/qcom/lemans-evk-emmc.dtso line 33

Quoted 10 lines
arch/arm64/boot/dts/qcom/lemans-evk-emmc.dtso new file +10 -0
+		regulator-name = "vqmmc-sdc1";
+
+		regulator-min-microvolt = <1800000>;
+		regulator-max-microvolt = <1800000>;
+	};
+};
+
+&sdhc {
+	vmmc-supply = <&vmmc_sdc1>;
+	vqmmc-supply = <&vqmmc_sdc1>;

[Severity: High]
Does using / { ... }; in a /plugin/; overlay cause fdtoverlay to drop regulator-l8c and regulator-s4a, and shouldn't &sdhc reference the existing RPMH regulators &vreg_l8c and &vreg_s4a from lemans-evk.dts instead?

In a /plugin/; overlay, dtc only wraps nodes targeted via a reference such as &{/} in a fragment@N/__overlay__ node. Nodes placed under / { ... }; sit at the root of the .dtbo without an __overlay__ child, so fdtoverlay skips them when building lemans-evk-emmc.dtb and leaves vmmc-supply and vqmmc-supply with dangling phandles (and runtime overlay application via of_overlay_fdt_apply() fails with -ENODEV). In addition, lemans-evk.dts already defines the real RPMH PMIC regulators vreg_l8c and vreg_s4a under &apps_rsc; defining dummy regulator-fixed nodes prevents sdhci_msm from voting for or controlling the PMIC rails.

[ ... ]

arch/arm64/boot/dts/qcom/lemans-evk-emmc.dtso line 64

Quoted 12 lines
arch/arm64/boot/dts/qcom/lemans-evk-emmc.dtso new file +12 -0
+&tlmm {
+        sdc_rclk: sdc1-rclk-state {
+                pins = "sdc1_rclk";
+                bias-pull-down;
+        };
+
+        sdc_rclk_sleep: sdc1-rclk-sleep-state {
+                pins = "sdc1_rclk";
+                drive-strength = <2>;
+                bias-bus-hold;
+        };
+};

[Severity: Low]
Should drive-strength be removed from sdc_rclk_sleep?

sdc1_rclk is an input-only return clock strobe pin with no hardware drive-strength field. In drivers/pinctrl/qcom/pinctrl-sa8775p.c:

drivers/pinctrl/qcom/pinctrl-sa8775p.c:sa8775p_groups[] {
	...
	[150] = SDC_QDSD_PINGROUP(sdc1_rclk, 0x199000, 15, 0),
	[151] = SDC_QDSD_PINGROUP(sdc1_clk, 0x199000, 13, 6),
	[152] = SDC_QDSD_PINGROUP(sdc1_cmd, 0x199000, 11, 3),
	[153] = SDC_QDSD_PINGROUP(sdc1_data, 0x199000, 9, 0),
	...
}

Because sdc1_rclk shares control register 0x199000 with the other SDC1 pins and has drv_bit set to 0, configuring drive-strength on sdc1_rclk writes to bits [2:0] of 0x199000, which is sdc1_data's drive-strength field.

Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=3