git: 40363144e85b - main - sdhci: rockchip: rk3568: Fix the eMMC card clock
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 05 Nov 2026 14:51:12 UTC
The branch main has been updated by manu:
URL: https://cgit.FreeBSD.org/src/commit/?id=40363144e85b08bbe581248066054c77ca0281b4
commit 40363144e85b08bbe581248066054c77ca0281b4
Author: Emmanuel Vadot <manu@FreeBSD.org>
AuthorDate: 2026-10-20 11:04:16 +0000
Commit: Emmanuel Vadot <manu@FreeBSD.org>
CommitDate: 2026-11-05 14:50:38 +0000
sdhci: rockchip: rk3568: Fix the eMMC card clock
The divider of the controller is not functional on Rockchip, the card clock
is the rate of the core clock. Request the core clock rounded down so that
the closest available rate is selected and report a failure, which was
ignored before. The eMMC was identified at the wrong clock and was never
detected.
Reviewed by: mmel
Differential Revision: https://reviews.freebsd.org/D60893
---
sys/dev/sdhci/sdhci_fdt_rockchip.c | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/sys/dev/sdhci/sdhci_fdt_rockchip.c b/sys/dev/sdhci/sdhci_fdt_rockchip.c
index 932165045bb9..c0499e41c6c2 100644
--- a/sys/dev/sdhci/sdhci_fdt_rockchip.c
+++ b/sys/dev/sdhci/sdhci_fdt_rockchip.c
@@ -177,7 +177,16 @@ sdhci_fdt_rockchip_set_clock(device_t dev, struct sdhci_slot *slot, int clock)
clock = 375000;
if (clock) {
- clk_set_freq(sc->clk_core, clock, 0);
+ /*
+ * The divider of the controller is not functional, the
+ * card clock is the rate of the core clock.
+ */
+ i = clk_set_freq(sc->clk_core, clock,
+ CLK_SET_ROUND_DOWN);
+ if (i != 0 && bootverbose)
+ device_printf(dev,
+ "cannot set the core clock to %d Hz: %d\n",
+ clock, i);
if (clock <= 52000000) {
bus_write_4(sc->mem_res[slot->num],