mirror of
https://github.com/openwrt/openwrt.git
synced 2024-12-25 00:11:13 +00:00
01d8e41c16
Changelog: https://cdn.kernel.org/pub/linux/kernel/v6.x/ChangeLog-6.6.51 Removed upstreamed: generic/backport-6.6/200-regmap-maple-work-around-false-positive-warning.patch generic/backport-6.6/822-v6.11-0012-nvmem-Fix-return-type-of-devm_nvmem_device_get-in-ke.patch bcm27xx/patches-6.6/950-1018-drivers-mmc-apply-SD-quirks-earlier-during-probe.patch Manually rebased: bcm27xx/patches-6.6/950-0993-drivers-mmc-cqhci-clear-CQHCI_CTL-if-halt-fails.patch ramips/patches-6.6/311-MIPS-use-set_mode-to-enable-disable-the-cevt-r4k-irq.patch[4] All other patches automatically rebased. 1. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.6.51&id=e42ea96d6d36a16526cb82b8aa2e5422814c3250 2. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.6.51&id=3d1baf322a3a69b38b6b2d511cfe0d611d1b5462 3. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.6.51&id=115a755bb38db5a1175be44e6a9a93a0a8233885 4. Adapted the changes from Hauke Mehrtens' modification in PR#16366 to 5.15.167 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/16370 Signed-off-by: Robert Marko <robimarko@gmail.com>
80 lines
2.7 KiB
Diff
80 lines
2.7 KiB
Diff
From 382e6f9ec8c66b99657922073f5b9b312925dc1f Mon Sep 17 00:00:00 2001
|
|
From: Jonathan Bell <jonathan@raspberrypi.com>
|
|
Date: Tue, 26 Mar 2024 13:36:23 +0000
|
|
Subject: [PATCH 0995/1085] drivers: mmc: be more cautious when manipulating
|
|
Command Queue enable
|
|
|
|
Don't attempt to turn on CQ if the other mandatory features are not
|
|
indicated as supported by the card. Also make sure that the register write
|
|
actually stuck, as some cards claim support but never report back that
|
|
the queue engine is enabled.
|
|
|
|
Signed-off-by: Jonathan Bell <jonathan@raspberrypi.com>
|
|
---
|
|
drivers/mmc/core/sd.c | 8 ++++++--
|
|
drivers/mmc/core/sd_ops.c | 22 ++++++++++++++++++++++
|
|
2 files changed, 28 insertions(+), 2 deletions(-)
|
|
|
|
--- a/drivers/mmc/core/sd.c
|
|
+++ b/drivers/mmc/core/sd.c
|
|
@@ -1089,8 +1089,12 @@ static int sd_parse_ext_reg_perf(struct
|
|
if ((reg_buf[4] & BIT(0)) && !mmc_card_broken_sd_cache(card))
|
|
card->ext_perf.feature_support |= SD_EXT_PERF_CACHE;
|
|
|
|
- /* Command queue support indicated via queue depth bits (0 to 4). */
|
|
- if (reg_buf[6] & 0x1f) {
|
|
+ /*
|
|
+ * Command queue support indicated via queue depth bits (0 to 4).
|
|
+ * Qualify this with the other mandatory required features.
|
|
+ */
|
|
+ if (reg_buf[6] & 0x1f && card->ext_power.feature_support & SD_EXT_POWER_OFF_NOTIFY &&
|
|
+ card->ext_perf.feature_support & SD_EXT_PERF_CACHE) {
|
|
card->ext_perf.feature_support |= SD_EXT_PERF_CMD_QUEUE;
|
|
card->ext_csd.cmdq_depth = reg_buf[6] & 0x1f;
|
|
card->ext_csd.cmdq_support = true;
|
|
--- a/drivers/mmc/core/sd_ops.c
|
|
+++ b/drivers/mmc/core/sd_ops.c
|
|
@@ -8,6 +8,7 @@
|
|
#include <linux/slab.h>
|
|
#include <linux/types.h>
|
|
#include <linux/export.h>
|
|
+#include <linux/ktime.h>
|
|
#include <linux/scatterlist.h>
|
|
|
|
#include <linux/mmc/host.h>
|
|
@@ -448,6 +449,8 @@ static int mmc_sd_cmdq_switch(struct mmc
|
|
{
|
|
int err;
|
|
u8 reg = 0;
|
|
+ u8 *reg_buf = card->ext_reg_buf;
|
|
+ ktime_t timeout;
|
|
/*
|
|
* SD offers two command queueing modes - sequential (in-order) and
|
|
* voluntary (out-of-order). Apps Class A2 performance is only
|
|
@@ -460,6 +463,25 @@ static int mmc_sd_cmdq_switch(struct mmc
|
|
/* Performance enhancement register byte 262 controls command queueing */
|
|
err = mmc_sd_write_ext_reg(card, card->ext_perf.fno, card->ext_perf.page,
|
|
card->ext_perf.offset + 262, reg);
|
|
+ if (err)
|
|
+ goto out;
|
|
+
|
|
+ /* Poll the register - cards may have a lazy init/deinit sequence. */
|
|
+ timeout = ktime_add_ms(ktime_get(), 10);
|
|
+ while (1) {
|
|
+ err = mmc_sd_read_ext_reg(card, card->ext_perf.fno, card->ext_perf.page,
|
|
+ card->ext_perf.offset + 262, 1, reg_buf);
|
|
+ if (err)
|
|
+ break;
|
|
+ if ((reg_buf[0] & BIT(0)) == reg)
|
|
+ break;
|
|
+ if (ktime_after(ktime_get(), timeout)) {
|
|
+ err = -EBADMSG;
|
|
+ break;
|
|
+ }
|
|
+ usleep_range(100, 200);
|
|
+ }
|
|
+out:
|
|
if (!err)
|
|
card->ext_csd.cmdq_en = enable;
|
|
|