openwrt/target/linux/bcm27xx/patches-6.6/950-1112-mmc-sdhci-brcmstb-add-hs400_downgrade-callback-for-b.patch
John Audia 69dd5a788f kernel: bump 6.6 to 6.6.37
Changelog: https://cdn.kernel.org/pub/linux/kernel/v6.x/ChangeLog-6.6.37

Added:
	generic/hack-6.6/900-fix-build-to-handle-return-value.patch[1]

Manually rebased:
	generic/pending-6.6/834-ledtrig-libata.patch

Removed upstreamed:
	bcm27xx/patches-6.6/950-0398-drm-panel-panel-ilitek9881c-Use-cansleep-methods.patch[2]

All other patches automatically rebased.

1. Patch suggested by @DragonBluep to circumvent upstream breakage of kernel 6.6.37 compilation. See comments in https://github.com/openwrt/openwrt/pull/15879 for additional discussion.
2. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.6.37&id=1618f7a875ffd916596392fd29880c0429b8af60

Build system: x86/64
Build-tested: x86/64/AMD Cezanne, flogic/xiaomi_redmi-router-ax6000-ubootmod, ramips/tplink_archer-a6-v3
Run-tested: x86/64/AMD Cezanne, flogic/xiaomi_redmi-router-ax6000-ubootmod, ramips/tplink_archer-a6-v3

Signed-off-by: John Audia <therealgraysky@proton.me>
Link: https://github.com/openwrt/openwrt/pull/15879
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
2024-07-10 23:59:37 +02:00

50 lines
1.8 KiB
Diff

From fd051511cd5e7e38315adfe728b1481cbe480331 Mon Sep 17 00:00:00 2001
From: Jonathan Bell <jonathan@raspberrypi.com>
Date: Tue, 4 Jun 2024 09:51:17 +0100
Subject: [PATCH 1112/1135] mmc: sdhci-brcmstb: add hs400_downgrade callback
for bcm2712
The attached PHY performs parameter validation, so the switch from HS200
to HS (before selecting HS400/HS400es) with a 200MHz clock fails to
update pad timings and results in CRC errors from the card.
Underclocking the interface is safe, so do that in the downgrade callback.
Signed-off-by: Jonathan Bell <jonathan@raspberrypi.com>
---
drivers/mmc/host/sdhci-brcmstb.c | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
--- a/drivers/mmc/host/sdhci-brcmstb.c
+++ b/drivers/mmc/host/sdhci-brcmstb.c
@@ -198,6 +198,20 @@ static void sdhci_brcmstb_set_uhs_signal
sdhci_writew(host, ctrl_2, SDHCI_HOST_CONTROL2);
}
+static void sdhci_bcm2712_hs400_downgrade(struct mmc_host *mmc)
+{
+ struct sdhci_host *host = mmc_priv(mmc);
+ /*
+ * The eMMC PHY and its internal controller parses and validates
+ * the uhs_mode, divisor, pin_sel, and sampling clock select
+ * output from the SD controller. It will refuse to update its
+ * config if HS timings are selected while the clock is >52MHz.
+ * so bump the clock down now before card/controller setup is
+ * performed.
+ */
+ sdhci_bcm2712_set_clock(host, 52000000);
+}
+
static void sdhci_brcmstb_cfginit_2712(struct sdhci_host *host)
{
struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
@@ -216,6 +230,8 @@ static void sdhci_brcmstb_cfginit_2712(s
reg &= ~SDIO_CFG_MAX_50MHZ_MODE_ENABLE;
reg |= SDIO_CFG_MAX_50MHZ_MODE_STRAP_OVERRIDE;
writel(reg, brcmstb_priv->cfg_regs + SDIO_CFG_MAX_50MHZ_MODE);
+
+ host->mmc_host_ops.hs400_downgrade = sdhci_bcm2712_hs400_downgrade;
}
if ((host->mmc->caps & MMC_CAP_NONREMOVABLE) ||