* [PATCH v2 v2 0/2] mmc: sdhci-msm: Add firmware-managed resource support for Nord SDCC
@ 2026-12-05 0:21 Anjana Hari
2026-12-05 0:21 ` [PATCH v2 v2 1/2] dt-bindings: mmc: sdhci-msm: Document " Anjana Hari
2026-12-05 0:21 ` [PATCH v2 v2 2/2] mmc: sdhci-msm: Add support for firmware-managed resource platforms Anjana Hari
0 siblings, 2 replies; 5+ messages in thread
From: Anjana Hari @ 2026-12-05 0:21 UTC (permalink / raw)
To: ulfh, robh, krzk+dt, conor+dt, adrian.hunter, anjana.hari
Cc: linux-arm-msm, linux-mmc, devicetree, linux-kernel,
shazad.hussain, manivannan.sadhasivam, nitin.rawat, ram.gupta
On certain Qualcomm automotive SoCs such as Nord, platform resources
including clocks, interconnect bandwidth, resets, and regulators are
owned and managed by firmware rather than directly by Linux. The
firmware abstracts these resources behind logical power domains and
exposes control through the SCMI power protocol.
This series extends the sdhci-msm driver to support this
firmware-managed model. Instead of directly programming GCC clocks and
PMIC regulators, the driver operates through two logical power domains:
- "power": controls the SDCC rail. The driver requests power state
transitions via pm_runtime_resume_and_get() / pm_runtime_put_sync()
on the domain device, which are forwarded to firmware as SCMI
power-state messages.
- "perf": the SCMI perf domain driver dynamically registers the
supported clock frequencies as OPPs by querying firmware at probe
time. Clock rate selection uses dev_pm_opp_find_freq_floor() and
dev_pm_opp_set_opp() on this domain.
Patch 1 adds the Device Tree binding for the new "qcom,nord-sdhci"
compatible string, documenting the two power-domain properties and the
absence of clock, interconnect, reset, and regulator entries.
Patch 2 introduces the firmware-managed variant in the driver. A new
sdhci_msm_fw_v5_var descriptor is added with its pd_data populated;
probe detects this and selects firmware-specific platform data and ops.
The new ops implement clock rate selection through the perf domain OPP
path and route suspend/resume through SCMI power-state transitions
rather than local clock and regulator management.
Changes in v2:
- dt-bindings: drop redundant "bindings" from subject [Krzysztof Kozlowski]
- dt-bindings: remove driver implementation details from commit message [Krzysztof Kozlowski]
- dt-bindings: document that CQHCI is not supported on this interface [Krzysztof Kozlowski]
- dt-bindings: drop redundant description from iommus property [Krzysztof Kozlowski]
- Fix host->runtime_suspended not updated on fw_managed runtime PM paths [sashiko-bot]
- Fix NULL deref and PM refcount underflow in sdhci_msm_remove() [sashiko-bot]
- Remove redundant pwr_dev RPM refs under PD_FLAG_DEV_LINK_ON [sashiko-bot]
- Fix unused label fw_detach causing build failure with CONFIG_WERROR=y [sashiko-bot]
Signed-off-by: Anjana Hari <anjana.hari@oss.qualcomm.com>
---
Anjana Hari (2):
dt-bindings: mmc: sdhci-msm: Document Nord SDCC
mmc: sdhci-msm: Add support for firmware-managed resource platforms
.../bindings/mmc/qcom,nord-sdhci.yaml | 89 ++++++++
drivers/mmc/host/sdhci-msm.c | 192 +++++++++++++++++-
2 files changed, 275 insertions(+), 6 deletions(-)
create mode 100644 Documentation/devicetree/bindings/mmc/qcom,nord-sdhci.yaml
--
2.34.1
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH v2 v2 1/2] dt-bindings: mmc: sdhci-msm: Document Nord SDCC
2026-12-05 0:21 [PATCH v2 v2 0/2] mmc: sdhci-msm: Add firmware-managed resource support for Nord SDCC Anjana Hari
@ 2026-12-05 0:21 ` Anjana Hari
2026-12-05 0:35 ` sashiko-bot
2026-12-05 0:21 ` [PATCH v2 v2 2/2] mmc: sdhci-msm: Add support for firmware-managed resource platforms Anjana Hari
1 sibling, 1 reply; 5+ messages in thread
From: Anjana Hari @ 2026-12-05 0:21 UTC (permalink / raw)
To: ulfh, robh, krzk+dt, conor+dt, adrian.hunter, anjana.hari
Cc: linux-arm-msm, linux-mmc, devicetree, linux-kernel,
shazad.hussain, manivannan.sadhasivam, nitin.rawat, ram.gupta
Add Device Tree binding for the Nord SDHCI variant of the Qualcomm
sdhci-msm controller, where platform resources are managed by firmware
through the SCMI power protocol rather than being directly accessible
to Linux.
Unlike existing sdhci-msm variants, this binding does not require
clock, interconnect, reset, or regulator properties. Instead, platform
resource control is abstracted behind two logical power domains:
- "power": controls the SDCC rail power state.
- "perf": exposes the supported clock frequencies as OPPs populated
dynamically by the SCMI perf domain driver at probe time via the
SCMI performance protocol.
Both domains must be listed under power-domains with their names
declared in power-domain-names.
Signed-off-by: Anjana Hari <anjana.hari@oss.qualcomm.com>
---
.../bindings/mmc/qcom,nord-sdhci.yaml | 89 +++++++++++++++++++
1 file changed, 89 insertions(+)
create mode 100644 Documentation/devicetree/bindings/mmc/qcom,nord-sdhci.yaml
diff --git a/Documentation/devicetree/bindings/mmc/qcom,nord-sdhci.yaml b/Documentation/devicetree/bindings/mmc/qcom,nord-sdhci.yaml
new file mode 100644
index 000000000000..883a607accb6
--- /dev/null
+++ b/Documentation/devicetree/bindings/mmc/qcom,nord-sdhci.yaml
@@ -0,0 +1,89 @@
+# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/mmc/qcom,nord-sdhci.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Qualcomm Nord SDHCI Controller
+
+maintainers:
+ - Anjana Hari <anjana.hari@oss.qualcomm.com>
+
+description:
+ SDHCI (SD Host Controller Interface) present on Qualcomm Nord SoC.
+ Clock and power resources are managed by firmware through an SCMI
+ server, so no clock entries are required in the device tree node.
+ This interface does not support command queuing (CQE/CQHCI).
+
+properties:
+ compatible:
+ const: qcom,nord-sdhci
+
+ reg:
+ maxItems: 1
+
+ reg-names:
+ items:
+ - const: hc
+
+ interrupts:
+ maxItems: 2
+
+ interrupt-names:
+ items:
+ - const: hc_irq
+ - const: pwr_irq
+
+ iommus:
+ maxItems: 1
+
+ dma-coherent: true
+
+ power-domains:
+ maxItems: 2
+
+ power-domain-names:
+ items:
+ - const: power
+ - const: perf
+
+required:
+ - compatible
+ - reg
+ - reg-names
+ - interrupts
+ - interrupt-names
+ - iommus
+ - dma-coherent
+ - power-domains
+ - power-domain-names
+
+allOf:
+ - $ref: sdhci-common.yaml#
+
+unevaluatedProperties: false
+
+examples:
+ - |
+ #include <dt-bindings/interrupt-controller/arm-gic.h>
+
+ mmc@b84000 {
+ compatible = "qcom,nord-sdhci";
+ reg = <0x000b84000 0x1000>;
+ reg-names = "hc";
+
+ interrupts = <GIC_SPI 261 IRQ_TYPE_LEVEL_HIGH>,
+ <GIC_SPI 227 IRQ_TYPE_LEVEL_HIGH>;
+ interrupt-names = "hc_irq", "pwr_irq";
+
+ bus-width = <4>;
+ no-sd;
+ no-mmc;
+ non-removable;
+
+ iommus = <&apps_smmu 0x1580 0x0>;
+ dma-coherent;
+
+ power-domains = <&scmi34_pd 0>, <&scmi34_dvfs 0>;
+ power-domain-names = "power", "perf";
+ };
--
2.34.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH v2 v2 2/2] mmc: sdhci-msm: Add support for firmware-managed resource platforms
2026-12-05 0:21 [PATCH v2 v2 0/2] mmc: sdhci-msm: Add firmware-managed resource support for Nord SDCC Anjana Hari
2026-12-05 0:21 ` [PATCH v2 v2 1/2] dt-bindings: mmc: sdhci-msm: Document " Anjana Hari
@ 2026-12-05 0:21 ` Anjana Hari
2026-12-05 0:39 ` sashiko-bot
1 sibling, 1 reply; 5+ messages in thread
From: Anjana Hari @ 2026-12-05 0:21 UTC (permalink / raw)
To: ulfh, robh, krzk+dt, conor+dt, adrian.hunter, anjana.hari
Cc: linux-arm-msm, linux-mmc, devicetree, linux-kernel,
shazad.hussain, manivannan.sadhasivam, nitin.rawat, ram.gupta
On certain Qualcomm automotive SoCs such as Nord, platform resources
including clocks, interconnect bandwidth, resets, and regulators are
owned and managed by firmware rather than directly by Linux. The
firmware abstracts these resources behind logical power domains and
exposes control through the SCMI power protocol.
Introduce a firmware-managed variant of the sdhci-msm driver that
operates through this abstraction instead of directly programming GCC
clocks and PMIC regulators.
The firmware-managed model uses two logical power domains, attached at
probe time via dev_pm_domain_attach_list():
- "power" domain: governs SDCC rail power state. It is activated at
probe and released at remove via pm_runtime_resume_and_get() and
pm_runtime_put_sync() on the domain device. These calls are
translated by the SCMI power protocol into firmware power-state
requests.
- "perf" domain: the SCMI perf domain driver populates OPPs at probe
time by querying the firmware-reported performance levels via
perf_ops->device_opps_add(). Clock rate selection uses
dev_pm_opp_find_freq_floor() to locate the nearest OPP at or below
the requested frequency, then dev_pm_opp_set_opp() to apply it,
rather than directly programming the GCC clock tree.
A new variant sdhci_msm_fw_v5_var is introduced with the compatible
string "qcom,nord-sdhci". Detection is automatic at probe: a non-NULL
pd_data.pd_names in the variant descriptor marks the platform as
firmware-managed, causing probe to select firmware-specific platform
data (sdhci_msm_fw_pdata) and ops (sdhci_msm_fw_ops).
The firmware-managed ops provide:
- sdhci_msm_fw_get_max_clock: queries the perf domain OPP table
using dev_pm_opp_find_freq_floor() at ULONG_MAX to discover the
maximum supported frequency, replacing the direct GCC readout.
- sdhci_msm_fw_set_clock: routes clock rate programming through the
perf domain OPP path, reusing the existing bus-mode multiplier
logic to derive the target rate.
Suspend and resume sequences bypass local clock and regulator management
for firmware-managed platforms, as firmware handles those transitions
autonomously in response to SCMI power-state transitions from the
runtime PM framework.
Co-developed by: Shazad Hussain <shazad.hussain@oss.qualcomm.com>
Signed-off-by: Shazad Hussain <shazad.hussain@oss.qualcomm.com>
Signed-off-by: Anjana Hari <anjana.hari@oss.qualcomm.com>
---
drivers/mmc/host/sdhci-msm.c | 192 +++++++++++++++++++++++++++++++++--
1 file changed, 186 insertions(+), 6 deletions(-)
diff --git a/drivers/mmc/host/sdhci-msm.c b/drivers/mmc/host/sdhci-msm.c
index 32b1bcba47d6..bec5d192a9be 100644
--- a/drivers/mmc/host/sdhci-msm.c
+++ b/drivers/mmc/host/sdhci-msm.c
@@ -8,8 +8,9 @@
#include <linux/module.h>
#include <linux/delay.h>
#include <linux/mmc/mmc.h>
-#include <linux/pm_runtime.h>
+#include <linux/pm_domain.h>
#include <linux/pm_opp.h>
+#include <linux/pm_runtime.h>
#include <linux/slab.h>
#include <linux/iopoll.h>
#include <linux/regulator/consumer.h>
@@ -168,6 +169,8 @@
#define ICE_HCI_PARAM_CCI GENMASK(7, 0)
#define ICE_HCI_PARAM_CE GENMASK(8, 8)
+#define DOMAIN_IDX_PERF 1
+
struct sdhci_msm_offset {
u32 core_hc_mode;
u32 core_mci_data_cnt;
@@ -275,6 +278,11 @@ struct sdhci_msm_variant_info {
bool restore_dll_config;
const struct sdhci_msm_variant_ops *var_ops;
const struct sdhci_msm_offset *offset;
+ /*
+ * pd_names != NULL marks this variant as firmware managed;
+ * see fw_managed detection in sdhci_msm_probe().
+ */
+ const struct dev_pm_domain_attach_data pd_data;
};
struct sdhci_msm_host {
@@ -285,6 +293,7 @@ struct sdhci_msm_host {
struct clk *xo_clk; /* TCXO clk needed for FLL feature of cm_dll*/
/* core, iface, cal and sleep clocks */
struct clk_bulk_data bulk_clks[4];
+ struct dev_pm_domain_list *pd_list;
#ifdef CONFIG_MMC_CRYPTO
struct qcom_ice *ice;
#endif
@@ -302,6 +311,7 @@ struct sdhci_msm_host {
u32 caps_0;
bool mci_removed;
bool restore_dll_config;
+ bool fw_managed;
const struct sdhci_msm_variant_ops *var_ops;
const struct sdhci_msm_offset *offset;
bool use_cdr;
@@ -414,6 +424,45 @@ static void msm_set_clock_rate_for_bus_mode(struct sdhci_host *host,
mmc_hostname(host->mmc), achieved_rate, timing);
}
+static int msm_fw_set_clock_rate_for_bus_mode(struct sdhci_host *host,
+ unsigned int clock)
+{
+ struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
+ struct sdhci_msm_host *msm_host = sdhci_pltfm_priv(pltfm_host);
+ struct device *dev = mmc_dev(host->mmc);
+ struct dev_pm_opp *opp;
+ struct device *perf_dev;
+ struct mmc_ios ios = host->mmc->ios;
+ unsigned long clock_long = (unsigned long)clock;
+ unsigned long desired_rate;
+ unsigned int mult;
+ int ret;
+
+ perf_dev = msm_host->pd_list->pd_devs[DOMAIN_IDX_PERF];
+
+ mult = msm_get_clock_mult_for_bus_mode(host, clock, ios.timing);
+ desired_rate = clock_long * mult;
+
+ /* Find the nearest OPP at or below the requested frequency. */
+ opp = dev_pm_opp_find_freq_floor(perf_dev, &desired_rate);
+ if (IS_ERR(opp)) {
+ dev_err(dev, "Failed to find OPP for freq %lu: %pe\n", clock_long, opp);
+ return PTR_ERR(opp);
+ }
+
+ ret = dev_pm_opp_set_opp(perf_dev, opp);
+ dev_pm_opp_put(opp);
+ if (ret) {
+ dev_err(dev, "Failed to set OPP for freq %lu: %d\n", clock_long, ret);
+ return ret;
+ }
+
+ /* desired_rate was rounded down by find_freq_floor to the actual OPP rate. */
+ host->mmc->actual_clock = mult ? desired_rate / mult : desired_rate;
+ msm_host->clk_rate = desired_rate;
+ return 0;
+}
+
/* Platform specific tuning */
static inline int msm_dll_poll_ck_out_en(struct sdhci_host *host, u8 poll)
{
@@ -1253,7 +1302,10 @@ static int sdhci_msm_execute_tuning(struct mmc_host *mmc, u32 opcode)
*/
if (host->flags & SDHCI_HS400_TUNING) {
sdhci_msm_hc_select_mode(host);
- msm_set_clock_rate_for_bus_mode(host, ios.clock, ios.timing);
+ if (msm_host->fw_managed)
+ msm_fw_set_clock_rate_for_bus_mode(host, ios.clock);
+ else
+ msm_set_clock_rate_for_bus_mode(host, ios.clock, ios.timing);
host->flags &= ~SDHCI_HS400_TUNING;
}
@@ -1847,6 +1899,28 @@ static unsigned int sdhci_msm_get_min_clock(struct sdhci_host *host)
return SDHCI_MSM_MIN_CLOCK;
}
+static unsigned int sdhci_msm_fw_get_max_clock(struct sdhci_host *host)
+{
+ struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
+ struct sdhci_msm_host *msm_host = sdhci_pltfm_priv(pltfm_host);
+ unsigned long max_freq = ULONG_MAX;
+ struct dev_pm_opp *opp;
+ struct device *perf_dev;
+ struct device *dev = mmc_dev(host->mmc);
+
+ perf_dev = msm_host->pd_list->pd_devs[DOMAIN_IDX_PERF];
+
+ opp = dev_pm_opp_find_freq_floor(perf_dev, &max_freq);
+ if (IS_ERR(opp)) {
+ dev_err(dev, "Failed to find opp for freq %lu\n", max_freq);
+ return SDHCI_MSM_MIN_CLOCK;
+ }
+
+ dev_pm_opp_put(opp);
+
+ return max_freq;
+}
+
/*
* __sdhci_msm_set_clock - sdhci_msm clock control.
*
@@ -1892,6 +1966,25 @@ static void sdhci_msm_set_clock(struct sdhci_host *host, unsigned int clock)
__sdhci_msm_set_clock(host, clock);
}
+static void sdhci_msm_fw_set_clock(struct sdhci_host *host, unsigned int clock)
+{
+ struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
+ struct sdhci_msm_host *msm_host = sdhci_pltfm_priv(pltfm_host);
+
+ if (!clock) {
+ host->mmc->actual_clock = 0;
+ msm_host->clk_rate = 0;
+ goto out;
+ }
+
+ sdhci_msm_hc_select_mode(host);
+
+ if (msm_fw_set_clock_rate_for_bus_mode(host, clock))
+ return;
+out:
+ __sdhci_msm_set_clock(host, clock);
+}
+
/*****************************************************************************\
* *
* Inline Crypto Engine (ICE) support *
@@ -2550,6 +2643,17 @@ static const struct sdhci_msm_variant_info sdhci_msm_v5_var = {
.offset = &sdhci_msm_v5_offset,
};
+static const struct sdhci_msm_variant_info sdhci_msm_fw_v5_var = {
+ .mci_removed = true,
+ .var_ops = &v5_var_ops,
+ .offset = &sdhci_msm_v5_offset,
+ .pd_data = {
+ .pd_flags = PD_FLAG_DEV_LINK_ON,
+ .pd_names = (const char * []) { "power", "perf" },
+ .num_pd_names = 2,
+ },
+};
+
static const struct sdhci_msm_variant_info sdm845_sdhci_var = {
.mci_removed = true,
.restore_dll_config = true,
@@ -2566,6 +2670,7 @@ static const struct of_device_id sdhci_msm_dt_match[] = {
{.compatible = "qcom,sdhci-msm-v5", .data = &sdhci_msm_v5_var},
{.compatible = "qcom,sdm670-sdhci", .data = &sdm845_sdhci_var},
{.compatible = "qcom,sdm845-sdhci", .data = &sdm845_sdhci_var},
+ {.compatible = "qcom,nord-sdhci", .data = &sdhci_msm_fw_v5_var},
{.compatible = "qcom,sc7180-sdhci", .data = &sdm845_sdhci_var},
{},
};
@@ -2587,6 +2692,21 @@ static const struct sdhci_ops sdhci_msm_ops = {
.set_timeout = sdhci_msm_set_timeout,
};
+static const struct sdhci_ops sdhci_msm_fw_ops = {
+ .reset = sdhci_and_cqhci_reset,
+ .set_clock = sdhci_msm_fw_set_clock,
+ .get_min_clock = sdhci_msm_get_min_clock,
+ .get_max_clock = sdhci_msm_fw_get_max_clock,
+ .set_bus_width = sdhci_set_bus_width,
+ .set_uhs_signaling = sdhci_msm_set_uhs_signaling,
+ .write_w = sdhci_msm_writew,
+ .write_b = sdhci_msm_writeb,
+ .irq = sdhci_msm_cqe_irq,
+ .dump_vendor_regs = sdhci_msm_dump_vendor_regs,
+ .set_power = sdhci_set_power_noreg,
+ .set_timeout = sdhci_msm_set_timeout,
+};
+
static const struct sdhci_pltfm_data sdhci_msm_pdata = {
.quirks = SDHCI_QUIRK_BROKEN_CARD_DETECTION |
SDHCI_QUIRK_SINGLE_POWER_WRITE |
@@ -2597,6 +2717,16 @@ static const struct sdhci_pltfm_data sdhci_msm_pdata = {
.ops = &sdhci_msm_ops,
};
+static const struct sdhci_pltfm_data sdhci_msm_fw_pdata = {
+ .quirks = SDHCI_QUIRK_BROKEN_CARD_DETECTION |
+ SDHCI_QUIRK_SINGLE_POWER_WRITE |
+ SDHCI_QUIRK_CAP_CLOCK_BASE_BROKEN |
+ SDHCI_QUIRK_MULTIBLOCK_READ_ACMD12,
+
+ .quirks2 = SDHCI_QUIRK2_PRESET_VALUE_BROKEN,
+ .ops = &sdhci_msm_fw_ops,
+};
+
static inline void sdhci_msm_get_of_property(struct platform_device *pdev,
struct sdhci_host *host)
{
@@ -2665,8 +2795,21 @@ static int sdhci_msm_probe(struct platform_device *pdev)
const struct sdhci_msm_offset *msm_offset;
const struct sdhci_msm_variant_info *var_info;
struct device_node *node = pdev->dev.of_node;
+ bool fw_managed;
- host = sdhci_pltfm_init(pdev, &sdhci_msm_pdata, sizeof(*msm_host));
+ var_info = of_device_get_match_data(&pdev->dev);
+ if (!var_info)
+ return -ENODEV;
+ fw_managed = !!var_info->pd_data.pd_names;
+
+ /*
+ * Based on variant info, differentiate platform initialization
+ * for local and remote managed resource platforms.
+ */
+ if (fw_managed)
+ host = sdhci_pltfm_init(pdev, &sdhci_msm_fw_pdata, sizeof(*msm_host));
+ else
+ host = sdhci_pltfm_init(pdev, &sdhci_msm_pdata, sizeof(*msm_host));
if (IS_ERR(host))
return PTR_ERR(host);
@@ -2684,12 +2827,11 @@ static int sdhci_msm_probe(struct platform_device *pdev)
* Based on the compatible string, load the required msm host info from
* the data associated with the version info.
*/
- var_info = of_device_get_match_data(&pdev->dev);
-
msm_host->mci_removed = var_info->mci_removed;
msm_host->restore_dll_config = var_info->restore_dll_config;
msm_host->var_ops = var_info->var_ops;
msm_host->offset = var_info->offset;
+ msm_host->fw_managed = fw_managed;
msm_offset = msm_host->offset;
@@ -2698,6 +2840,27 @@ static int sdhci_msm_probe(struct platform_device *pdev)
msm_host->saved_tuning_phase = INVALID_TUNING_PHASE;
+ if (msm_host->fw_managed) {
+ ret = dev_pm_domain_attach_list(&pdev->dev, &var_info->pd_data,
+ &msm_host->pd_list);
+ if (ret < 0)
+ return dev_err_probe(&pdev->dev, ret,
+ "Failed to attach power domains\n");
+
+ if (ret != var_info->pd_data.num_pd_names)
+ return dev_err_probe(&pdev->dev, -ENODEV,
+ "Expected %d power domains, got %d\n",
+ var_info->pd_data.num_pd_names, ret);
+
+ /*
+ * Skip initializing clocks, regulators and reset in kernel
+ * for firmware managed platforms. The device link created by
+ * dev_pm_domain_attach_list() with DL_FLAG_PM_RUNTIME ensures
+ * the power domain is on before probe reaches this point.
+ */
+ goto skip_resource_init;
+ }
+
ret = sdhci_msm_gcc_reset(&pdev->dev, host);
if (ret)
return ret;
@@ -2786,6 +2949,7 @@ static int sdhci_msm_probe(struct platform_device *pdev)
}
}
+skip_resource_init:
/* Reset the vendor spec register to power on reset state */
writel_relaxed(CORE_VENDOR_SPEC_POR_VAL,
host->ioaddr + msm_offset->core_vendor_spec);
@@ -2917,6 +3081,10 @@ static int sdhci_msm_probe(struct platform_device *pdev)
bus_clk_disable:
if (!IS_ERR(msm_host->bus_clk))
clk_disable_unprepare(msm_host->bus_clk);
+ if (msm_host->fw_managed) {
+ dev_pm_domain_detach_list(msm_host->pd_list);
+ msm_host->pd_list = NULL;
+ }
return ret;
}
@@ -2934,6 +3102,11 @@ static void sdhci_msm_remove(struct platform_device *pdev)
pm_runtime_disable(&pdev->dev);
pm_runtime_put_noidle(&pdev->dev);
+ if (msm_host->fw_managed) {
+ dev_pm_domain_detach_list(msm_host->pd_list);
+ msm_host->pd_list = NULL;
+ }
+
clk_bulk_disable_unprepare(ARRAY_SIZE(msm_host->bulk_clks),
msm_host->bulk_clks);
if (!IS_ERR(msm_host->bus_clk))
@@ -2951,6 +3124,9 @@ static int sdhci_msm_runtime_suspend(struct device *dev)
host->runtime_suspended = true;
spin_unlock_irqrestore(&host->lock, flags);
+ if (msm_host->fw_managed)
+ return 0;
+
/* Drop the performance vote */
dev_pm_opp_set_rate(dev, 0);
clk_bulk_disable_unprepare(ARRAY_SIZE(msm_host->bulk_clks),
@@ -2967,6 +3143,9 @@ static int sdhci_msm_runtime_resume(struct device *dev)
unsigned long flags;
int ret;
+ if (msm_host->fw_managed)
+ goto clr_suspended;
+
ret = clk_bulk_prepare_enable(ARRAY_SIZE(msm_host->bulk_clks),
msm_host->bulk_clks);
if (ret)
@@ -2987,10 +3166,11 @@ static int sdhci_msm_runtime_resume(struct device *dev)
if (ret)
return ret;
+clr_suspended:
spin_lock_irqsave(&host->lock, flags);
host->runtime_suspended = false;
spin_unlock_irqrestore(&host->lock, flags);
-
+out:
return ret;
}
--
2.34.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH v2 v2 1/2] dt-bindings: mmc: sdhci-msm: Document Nord SDCC
2026-12-05 0:21 ` [PATCH v2 v2 1/2] dt-bindings: mmc: sdhci-msm: Document " Anjana Hari
@ 2026-12-05 0:35 ` sashiko-bot
0 siblings, 0 replies; 5+ messages in thread
From: sashiko-bot @ 2026-12-05 0:35 UTC (permalink / raw)
To: Anjana Hari; +Cc: devicetree, robh, conor+dt
Thank you for your contribution! Sashiko AI review found 3 potential
issues to consider:
- [Medium] dt-bindings: mmc: qcom,nord-sdhci collides with Nord Embedded
vs SA8797P naming
- [Low] dt-bindings: mmc: redundant single-entry reg-names marked
required
- [Low] dt-bindings: mmc: example reg address uses 9-hex-digit literal
0x000b84000
--
commit f71cc97145dbc2a8d1da9006072225a9e778904d
Author: Anjana Hari <anjana.hari@oss.qualcomm.com>
dt-bindings: mmc: sdhci-msm: Document Nord SDCC
This commit adds a Device Tree binding schema for the Qualcomm Nord
SDHCI controller variant whose clocks and power rails are managed by
firmware via SCMI power and performance domains.
> diff --git a/Documentation/devicetree/bindings/mmc/qcom,nord-sdhci.yaml b/Documentation/devicetree/bindings/mmc/qcom,nord-sdhci.yaml
> new file mode 100644
> index 0000000000000..883a607accb6b
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/mmc/qcom,nord-sdhci.yaml
> @@ -0,0 +1,89 @@
[ ... ]
> +properties:
> + compatible:
> + const: qcom,nord-sdhci
[Severity: Medium]
Should this binding use qcom,sa8797p-sdhci (and qcom,sa8797p-sdhci.yaml)
instead of qcom,nord-sdhci?
Nord Embedded (nord-embedded.dtsi) exposes OS-managed SDCC4 clocks and
resets in drivers/clk/qcom/negcc-nord.c, while this schema targets the
SCMI firmware-managed GearVM/SA8797P variant (nord-gearvm.dtsi, where
scmi34_pd and scmi34_dvfs live) and disallows clocks and resets.
Other Nord bindings reserve qcom,nord-* for OS-managed Nord Embedded
(e.g., qcom,nord-ufshc) and use qcom,sa8797p-* for SCMI GearVM (e.g.,
qcom,sa8797p-ufshc). Claiming qcom,nord-sdhci here prevents Nord
Embedded from using it under qcom,sdhci-msm.yaml without schema clashes.
> +
> + reg:
> + maxItems: 1
> +
> + reg-names:
> + items:
> + - const: hc
[Severity: Low]
Can reg-names be dropped from properties and required?
With reg fixed to maxItems: 1, a single-entry reg-names ("hc") adds no
value: sdhci_pltfm_init() maps the region by index 0 rather than by
name. Marking it required adds unnecessary DT ABI boilerplate and
rejects valid single-region nodes that omit it.
[ ... ]
> + mmc@b84000 {
> + compatible = "qcom,nord-sdhci";
> + reg = <0x000b84000 0x1000>;
[Severity: Low]
This isn't a bug, but 0x000b84000 has an extraneous leading zero (9 hex
digits for a 32-bit address cell) and should be 0x00b84000 or 0xb84000.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261205002150.2655647-1-anjana.hari@oss.qualcomm.com?part=1
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v2 v2 2/2] mmc: sdhci-msm: Add support for firmware-managed resource platforms
2026-12-05 0:21 ` [PATCH v2 v2 2/2] mmc: sdhci-msm: Add support for firmware-managed resource platforms Anjana Hari
@ 2026-12-05 0:39 ` sashiko-bot
0 siblings, 0 replies; 5+ messages in thread
From: sashiko-bot @ 2026-12-05 0:39 UTC (permalink / raw)
To: Anjana Hari; +Cc: devicetree, robh, conor+dt
Thank you for your contribution! Sashiko AI review found 7 potential
issues to consider:
- [High] mmc: sdhci-msm: uninitialized ret returned in
sdhci_msm_runtime_resume()
- [Medium] mmc: sdhci-msm: unused label out in
sdhci_msm_runtime_resume()
- [Medium] mmc: sdhci-msm: ignored error from
msm_fw_set_clock_rate_for_bus_mode()
- [Medium] mmc: sdhci-msm: power domains detached before devm pwr_irq is
freed
- [Low] mmc: sdhci-msm: commit message and probe comment disagree with
code
- [Low] mmc: sdhci-msm: duplicated ops, pdata, and clock helper for
fw_managed
- [Low] mmc: sdhci-msm: wrong format specifier and unmultiplied rate in
logs
--
commit 38ff9cbc8a2b7913f5a908acb8571a7d6ed30822
Author: Anjana Hari <anjana.hari@oss.qualcomm.com>
> mmc: sdhci-msm: Add support for firmware-managed resource platforms
>
> On certain Qualcomm automotive SoCs such as Nord, platform resources
> including clocks, interconnect bandwidth, resets, and regulators are
> owned and managed by firmware rather than directly by Linux. The
> firmware abstracts these resources behind logical power domains and
> exposes control through the SCMI power protocol.
>
> Introduce a firmware-managed variant of the sdhci-msm driver that
> operates through this abstraction instead of directly programming GCC
> clocks and PMIC regulators.
>
> The firmware-managed model uses two logical power domains, attached at
> probe time via dev_pm_domain_attach_list():
>
> - "power" domain: governs SDCC rail power state. It is activated at
> probe and released at remove via pm_runtime_resume_and_get() and
> pm_runtime_put_sync() on the domain device. These calls are
> translated by the SCMI power protocol into firmware power-state
> requests.
>
> - "perf" domain: the SCMI perf domain driver populates OPPs at probe
> time by querying the firmware-reported performance levels via
> perf_ops->device_opps_add(). Clock rate selection uses
> dev_pm_opp_find_freq_floor() to locate the nearest OPP at or below
> the requested frequency, then dev_pm_opp_set_opp() to apply it,
> rather than directly programming the GCC clock tree.
>
> A new variant sdhci_msm_fw_v5_var is introduced with the compatible
> string "qcom,nord-sdhci". Detection is automatic at probe: a non-NULL
> pd_data.pd_names in the variant descriptor marks the platform as
> firmware-managed, causing probe to select firmware-specific platform
> data (sdhci_msm_fw_pdata) and ops (sdhci_msm_fw_ops).
>
> The firmware-managed ops provide:
> - sdhci_msm_fw_get_max_clock: queries the perf domain OPP table
> using dev_pm_opp_find_freq_floor() at ULONG_MAX to discover the
> maximum supported frequency, replacing the direct GCC readout.
> - sdhci_msm_fw_set_clock: routes clock rate programming through the
> perf domain OPP path, reusing the existing bus-mode multiplier
> logic to derive the target rate.
>
> Suspend and resume sequences bypass local clock and regulator management
> for firmware-managed platforms, as firmware handles those transitions
> autonomously in response to SCMI power-state transitions from the
> runtime PM framework.
>
> Co-developed by: Shazad Hussain <shazad.hussain@oss.qualcomm.com>
> Signed-off-by: Shazad Hussain <shazad.hussain@oss.qualcomm.com>
> Signed-off-by: Anjana Hari <anjana.hari@oss.qualcomm.com>
[Severity: Low]
The commit message describes the "power" domain as activated at probe and
released at remove via pm_runtime_resume_and_get() and pm_runtime_put_sync()
on the domain device, whereas the code attaches both domains with
PD_FLAG_DEV_LINK_ON so they follow runtime PM transitions on the host device.
It also states that suspend and resume bypass local regulator management,
which those callbacks never did, and the comment in sdhci_msm_probe() says
skip_resource_init skips regulators and credits DL_FLAG_PM_RUNTIME alone,
even though sdhci_msm_register_vreg() still runs after skip_resource_init
and PD_FLAG_DEV_LINK_ON (DL_FLAG_RPM_ACTIVE) is what powers on the domain
during link creation.
Finally, the trailer "Co-developed by:" is missing the second hyphen and
should be "Co-developed-by:".
> diff --git a/drivers/mmc/host/sdhci-msm.c b/drivers/mmc/host/sdhci-msm.c
> index aecd425bf0951..2c013ee401d11 100644
> --- a/drivers/mmc/host/sdhci-msm.c
> +++ b/drivers/mmc/host/sdhci-msm.c
[ ... ]
> @@ -414,6 +424,45 @@ static void msm_set_clock_rate_for_bus_mode(struct sdhci_host *host,
> mmc_hostname(host->mmc), achieved_rate, timing);
> }
>
> +static int msm_fw_set_clock_rate_for_bus_mode(struct sdhci_host *host,
> + unsigned int clock)
> +{
...
> + mult = msm_get_clock_mult_for_bus_mode(host, clock, ios.timing);
> + desired_rate = clock_long * mult;
> +
> + /* Find the nearest OPP at or below the requested frequency. */
> + opp = dev_pm_opp_find_freq_floor(perf_dev, &desired_rate);
> + if (IS_ERR(opp)) {
> + dev_err(dev, "Failed to find OPP for freq %lu: %pe\n", clock_long, opp);
> + return PTR_ERR(opp);
> + }
> +
> + ret = dev_pm_opp_set_opp(perf_dev, opp);
> + dev_pm_opp_put(opp);
> + if (ret) {
> + dev_err(dev, "Failed to set OPP for freq %lu: %d\n", clock_long, ret);
> + return ret;
> + }
[Severity: Low]
Should these dev_err() messages log the multiplied frequency passed to the
OPP framework instead of clock_long? In DDR and HS400 modes where mult is 2,
this reports half of the OPP frequency that failed.
In sdhci_msm_probe(), var_info->pd_data.num_pd_names is a u32 and should be
formatted with %u rather than %d.
[ ... ]
> @@ -1253,7 +1302,10 @@ static int sdhci_msm_execute_tuning(struct mmc_host *mmc, u32 opcode)
> */
> if (host->flags & SDHCI_HS400_TUNING) {
> sdhci_msm_hc_select_mode(host);
> - msm_set_clock_rate_for_bus_mode(host, ios.clock, ios.timing);
> + if (msm_host->fw_managed)
> + msm_fw_set_clock_rate_for_bus_mode(host, ios.clock);
> + else
> + msm_set_clock_rate_for_bus_mode(host, ios.clock, ios.timing);
> host->flags &= ~SDHCI_HS400_TUNING;
> }
[Severity: Medium]
Does sdhci_msm_execute_tuning() ignore an error returned by
msm_fw_set_clock_rate_for_bus_mode()?
sdhci_msm_hc_select_mode() has already switched the controller to MCLK/2 for
HS400 tuning, expecting MCLK to be raised to 2x ios.clock. If OPP lookup or
dev_pm_opp_set_opp() fails, tuning still clears SDHCI_HS400_TUNING and runs
DLL initialization and phase tuning at half the target clock frequency.
Checking and returning the error avoids tuning at the wrong clock rate.
[ ... ]
> @@ -2587,6 +2692,21 @@ static const struct sdhci_ops sdhci_msm_ops = {
> .set_timeout = sdhci_msm_set_timeout,
> };
>
> +static const struct sdhci_ops sdhci_msm_fw_ops = {
> + .reset = sdhci_and_cqhci_reset,
> + .set_clock = sdhci_msm_fw_set_clock,
> + .get_min_clock = sdhci_msm_get_min_clock,
> + .get_max_clock = sdhci_msm_fw_get_max_clock,
> + .set_bus_width = sdhci_set_bus_width,
> + .set_uhs_signaling = sdhci_msm_set_uhs_signaling,
> + .write_w = sdhci_msm_writew,
> + .write_b = sdhci_msm_writeb,
> + .irq = sdhci_msm_cqe_irq,
> + .dump_vendor_regs = sdhci_msm_dump_vendor_regs,
> + .set_power = sdhci_set_power_noreg,
> + .set_timeout = sdhci_msm_set_timeout,
> +};
> +
> static const struct sdhci_pltfm_data sdhci_msm_pdata = {
> .quirks = SDHCI_QUIRK_BROKEN_CARD_DETECTION |
> SDHCI_QUIRK_SINGLE_POWER_WRITE |
> @@ -2597,6 +2717,16 @@ static const struct sdhci_pltfm_data sdhci_msm_pdata = {
> .ops = &sdhci_msm_ops,
> };
>
> +static const struct sdhci_pltfm_data sdhci_msm_fw_pdata = {
> + .quirks = SDHCI_QUIRK_BROKEN_CARD_DETECTION |
> + SDHCI_QUIRK_SINGLE_POWER_WRITE |
> + SDHCI_QUIRK_CAP_CLOCK_BASE_BROKEN |
> + SDHCI_QUIRK_MULTIBLOCK_READ_ACMD12,
> +
> + .quirks2 = SDHCI_QUIRK2_PRESET_VALUE_BROKEN,
> + .ops = &sdhci_msm_fw_ops,
> +};
[Severity: Low]
This isn't a bug, but sdhci_msm_fw_ops duplicates 10 of 12 callbacks from
sdhci_msm_ops, sdhci_msm_fw_pdata duplicates all quirks from
sdhci_msm_pdata, and sdhci_msm_fw_set_clock() duplicates the control flow of
sdhci_msm_set_clock().
Since msm_host->fw_managed is already stored in struct sdhci_msm_host,
dispatching on it inside sdhci_msm_get_max_clock() and
msm_set_clock_rate_for_bus_mode() would drop the duplicated tables and
helper and prevent future quirks or callback drift. Using
devm_pm_domain_attach_list() would also remove the duplicated manual
dev_pm_domain_detach_list() calls in probe error unwind and remove.
[ ... ]
> @@ -2934,6 +3102,11 @@ static void sdhci_msm_remove(struct platform_device *pdev)
> pm_runtime_disable(&pdev->dev);
> pm_runtime_put_noidle(&pdev->dev);
>
> + if (msm_host->fw_managed) {
> + dev_pm_domain_detach_list(msm_host->pd_list);
> + msm_host->pd_list = NULL;
> + }
> +
> clk_bulk_disable_unprepare(ARRAY_SIZE(msm_host->bulk_clks),
> msm_host->bulk_clks);
> if (!IS_ERR(msm_host->bus_clk))
[Severity: Medium]
Can sdhci_msm_pwr_irq() access controller registers after the SCMI power
domain is powered off?
sdhci_msm_probe() unmasks core_pwrctl_mask and registers sdhci_msm_pwr_irq()
with devm_request_threaded_irq(), so pwr_irq is not freed and synchronized
until devres_release_all() runs after sdhci_msm_remove() (or a failed probe)
returns. Meanwhile, dev_pm_domain_detach_list() deletes the device links
and powers off the domain immediately via dev_pm_domain_detach(dev, true).
CPU0 CPU1
sdhci_msm_remove()
sdhci_remove_host()
sdhci_reset_for_all()
sdhci_msm_pwr_irq()
sdhci_msm_handle_pwr_irq()
dev_pm_domain_detach_list()
dev_pm_domain_detach()
msm_host_readl(...) <-- unpowered MMIO
devres_release_all()
devm_irq_release()
Reading or writing controller registers while the power domain is off can
trigger a synchronous external abort. Attaching the domains with
devm_pm_domain_attach_list() before devm_request_threaded_irq() preserves
LIFO teardown order.
[ ... ]
> @@ -2967,6 +3143,9 @@ static int sdhci_msm_runtime_resume(struct device *dev)
> unsigned long flags;
> int ret;
>
> + if (msm_host->fw_managed)
> + goto clr_suspended;
> +
> ret = clk_bulk_prepare_enable(ARRAY_SIZE(msm_host->bulk_clks),
> msm_host->bulk_clks);
> if (ret)
[Severity: High]
Does sdhci_msm_runtime_resume() return an uninitialized ret when
msm_host->fw_managed is true?
Jumping to clr_suspended skips every assignment to ret and returns stack
garbage to the runtime PM core. Whenever that value is non-zero,
__rpm_callback() treats runtime resume as failed, latches
dev->power.runtime_error, and calls __rpm_put_suppliers() to drop the SCMI
power and perf domain references even though host->runtime_suspended was
already cleared to false. Subsequent sdhci_irq() or sdhci_led_control()
calls can then access unpowered MMIO and trigger a synchronous external
abort.
[ ... ]
> @@ -2987,10 +3166,11 @@ static int sdhci_msm_runtime_resume(struct device *dev)
> if (ret)
> return ret;
>
> +clr_suspended:
> spin_lock_irqsave(&host->lock, flags);
> host->runtime_suspended = false;
> spin_unlock_irqrestore(&host->lock, flags);
> -
> +out:
> return ret;
> }
[Severity: Medium]
Is the out: label unused in sdhci_msm_runtime_resume()? Nothing jumps to
it, which triggers a -Wunused-label warning and breaks builds with
CONFIG_WERROR=y.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261205002150.2655647-1-anjana.hari@oss.qualcomm.com?part=2
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2026-12-05 0:39 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-05 0:21 [PATCH v2 v2 0/2] mmc: sdhci-msm: Add firmware-managed resource support for Nord SDCC Anjana Hari
2026-12-05 0:21 ` [PATCH v2 v2 1/2] dt-bindings: mmc: sdhci-msm: Document " Anjana Hari
2026-12-05 0:35 ` sashiko-bot
2026-12-05 0:21 ` [PATCH v2 v2 2/2] mmc: sdhci-msm: Add support for firmware-managed resource platforms Anjana Hari
2026-12-05 0:39 ` sashiko-bot
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.