All of lore.kernel.org
 help / color / mirror / Atom feed
From: Yixun Lan <dlan@kernel.org>
To: Ulf Hansson <ulfh@kernel.org>, Rob Herring <robh@kernel.org>,
	 Krzysztof Kozlowski <krzk+dt@kernel.org>,
	 Conor Dooley <conor+dt@kernel.org>,
	Adrian Hunter <adrian.hunter@intel.com>
Cc: Long Wan <long.wan@linux.spacemit.com>,
	linux-mmc@vger.kernel.org,  devicetree@vger.kernel.org,
	linux-riscv@lists.infradead.org,  spacemit@lists.linux.dev,
	linux-kernel@vger.kernel.org,  Yixun Lan <dlan@kernel.org>
Subject: [PATCH 3/4] mmc: sdhci-of-k1: Set clock-frequency of io clock
Date: Wed, 02 Sep 2026 07:03:14 +0000	[thread overview]
Message-ID: <20260902-07-k3-sdhci-dts-v1-3-4e7909cf4233@kernel.org> (raw)
In-Reply-To: <20260902-07-k3-sdhci-dts-v1-0-4e7909cf4233@kernel.org>

From: Long Wan <long.wan@linux.spacemit.com>

Add a clock-frequency property to set the rate of io clock, for SDIO
case, a clock frequency need to propagate down early.

Signed-off-by: Long Wan <long.wan@linux.spacemit.com>
Signed-off-by: Yixun Lan <dlan@kernel.org>
---
 drivers/mmc/host/sdhci-of-k1.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/mmc/host/sdhci-of-k1.c b/drivers/mmc/host/sdhci-of-k1.c
index 37b0911e7cf2..e6ab40c9a555 100644
--- a/drivers/mmc/host/sdhci-of-k1.c
+++ b/drivers/mmc/host/sdhci-of-k1.c
@@ -438,6 +438,8 @@ static inline int spacemit_sdhci_get_clocks(struct device *dev,
 					    struct sdhci_pltfm_host *pltfm_host)
 {
 	struct spacemit_sdhci_host *sdhst = sdhci_pltfm_priv(pltfm_host);
+	struct device_node *np = dev->of_node;
+	u32 freq;
 
 	sdhst->clk_core = devm_clk_get_enabled(dev, "core");
 	if (IS_ERR(sdhst->clk_core))
@@ -447,6 +449,9 @@ static inline int spacemit_sdhci_get_clocks(struct device *dev,
 	if (IS_ERR(sdhst->clk_io))
 		return -EINVAL;
 
+	if (!of_property_read_u32(np, "clock-frequency", &freq))
+		clk_set_rate(sdhst->clk_io, freq);
+
 	pltfm_host->clk = sdhst->clk_io;
 
 	return 0;

-- 
2.55.0


WARNING: multiple messages have this Message-ID (diff)
From: Yixun Lan <dlan@kernel.org>
To: Ulf Hansson <ulfh@kernel.org>, Rob Herring <robh@kernel.org>,
	 Krzysztof Kozlowski <krzk+dt@kernel.org>,
	 Conor Dooley <conor+dt@kernel.org>,
	Adrian Hunter <adrian.hunter@intel.com>
Cc: Long Wan <long.wan@linux.spacemit.com>,
	linux-mmc@vger.kernel.org,  devicetree@vger.kernel.org,
	linux-riscv@lists.infradead.org,  spacemit@lists.linux.dev,
	linux-kernel@vger.kernel.org,  Yixun Lan <dlan@kernel.org>
Subject: [PATCH 3/4] mmc: sdhci-of-k1: Set clock-frequency of io clock
Date: Wed, 02 Sep 2026 07:03:14 +0000	[thread overview]
Message-ID: <20260902-07-k3-sdhci-dts-v1-3-4e7909cf4233@kernel.org> (raw)
In-Reply-To: <20260902-07-k3-sdhci-dts-v1-0-4e7909cf4233@kernel.org>

From: Long Wan <long.wan@linux.spacemit.com>

Add a clock-frequency property to set the rate of io clock, for SDIO
case, a clock frequency need to propagate down early.

Signed-off-by: Long Wan <long.wan@linux.spacemit.com>
Signed-off-by: Yixun Lan <dlan@kernel.org>
---
 drivers/mmc/host/sdhci-of-k1.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/mmc/host/sdhci-of-k1.c b/drivers/mmc/host/sdhci-of-k1.c
index 37b0911e7cf2..e6ab40c9a555 100644
--- a/drivers/mmc/host/sdhci-of-k1.c
+++ b/drivers/mmc/host/sdhci-of-k1.c
@@ -438,6 +438,8 @@ static inline int spacemit_sdhci_get_clocks(struct device *dev,
 					    struct sdhci_pltfm_host *pltfm_host)
 {
 	struct spacemit_sdhci_host *sdhst = sdhci_pltfm_priv(pltfm_host);
+	struct device_node *np = dev->of_node;
+	u32 freq;
 
 	sdhst->clk_core = devm_clk_get_enabled(dev, "core");
 	if (IS_ERR(sdhst->clk_core))
@@ -447,6 +449,9 @@ static inline int spacemit_sdhci_get_clocks(struct device *dev,
 	if (IS_ERR(sdhst->clk_io))
 		return -EINVAL;
 
+	if (!of_property_read_u32(np, "clock-frequency", &freq))
+		clk_set_rate(sdhst->clk_io, freq);
+
 	pltfm_host->clk = sdhst->clk_io;
 
 	return 0;

-- 
2.55.0


_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

  parent reply	other threads:[~2026-09-02  7:03 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-02  7:03 [PATCH 0/4] mmc: spacemit: Introduce two DT properties Yixun Lan
2026-09-02  7:03 ` Yixun Lan
2026-09-02  7:03 ` [PATCH 1/4] dt-bindings: mmc: spacemit-sdhci: Add clock-frequency property Yixun Lan
2026-09-02  7:03   ` Yixun Lan
2026-09-02  7:11   ` sashiko-bot
2026-09-02  9:08     ` Yixun Lan
2026-09-02  7:03 ` [PATCH 2/4] dt-bindings: mmc: spacemit,sdhci: Add tx delay property Yixun Lan
2026-09-02  7:03   ` Yixun Lan
2026-09-02 18:03   ` Conor Dooley
2026-09-02 18:03     ` Conor Dooley
2026-09-03 13:00   ` Krzysztof Kozlowski
2026-09-03 13:00     ` Krzysztof Kozlowski
2026-09-04 20:32     ` Yixun Lan
2026-09-04 20:32       ` Yixun Lan
2026-09-02  7:03 ` Yixun Lan [this message]
2026-09-02  7:03   ` [PATCH 3/4] mmc: sdhci-of-k1: Set clock-frequency of io clock Yixun Lan
2026-09-02  7:14   ` sashiko-bot
2026-09-03  3:29   ` Troy Mitchell
2026-09-03  3:29     ` Troy Mitchell
2026-09-03 10:29     ` Yixun Lan
2026-09-03 10:29       ` Yixun Lan
2026-09-02  7:03 ` [PATCH 4/4] mmc: sdhci-of-k1: Add TX tuning parameter Yixun Lan
2026-09-02  7:03   ` Yixun Lan
2026-09-03  3:27   ` Troy Mitchell
2026-09-03  3:27     ` Troy Mitchell
2026-09-03 10:37     ` Yixun Lan
2026-09-03 10:37       ` Yixun Lan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260902-07-k3-sdhci-dts-v1-3-4e7909cf4233@kernel.org \
    --to=dlan@kernel.org \
    --cc=adrian.hunter@intel.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=krzk+dt@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mmc@vger.kernel.org \
    --cc=linux-riscv@lists.infradead.org \
    --cc=long.wan@linux.spacemit.com \
    --cc=robh@kernel.org \
    --cc=spacemit@lists.linux.dev \
    --cc=ulfh@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.