From 8d8d6a3a14cad89b3afe4e4c8b1641bc415dc8ff Mon Sep 17 00:00:00 2001
From: Jonathan Bell <jonathan@raspberrypi.com>
Date: Tue, 26 Mar 2024 13:39:47 +0000
Subject: [PATCH 0996/1085] drivers: mmc: add debugfs entries for SD extension
 registers

Also report the card's supported queue depth in the message log.

Signed-off-by: Jonathan Bell <jonathan@raspberrypi.com>
---
 drivers/mmc/core/mmc.c | 4 ++--
 drivers/mmc/core/sd.c  | 9 ++++++---
 2 files changed, 8 insertions(+), 5 deletions(-)

--- a/drivers/mmc/core/mmc.c
+++ b/drivers/mmc/core/mmc.c
@@ -1915,8 +1915,8 @@ static int mmc_init_card(struct mmc_host
 			host->cqe_enabled = true;
 
 			if (card->ext_csd.cmdq_en) {
-				pr_info("%s: Command Queue Engine enabled\n",
-					mmc_hostname(host));
+				pr_info("%s: Command Queue Engine enabled, %u tags\n",
+					mmc_hostname(host), card->ext_csd.cmdq_depth);
 			} else {
 				host->hsq_enabled = true;
 				pr_info("%s: Host Software Queue enabled\n",
--- a/drivers/mmc/core/sd.c
+++ b/drivers/mmc/core/sd.c
@@ -715,7 +715,8 @@ MMC_DEV_ATTR(oemid, "0x%04x\n", card->ci
 MMC_DEV_ATTR(serial, "0x%08x\n", card->cid.serial);
 MMC_DEV_ATTR(ocr, "0x%08x\n", card->ocr);
 MMC_DEV_ATTR(rca, "0x%04x\n", card->rca);
-
+MMC_DEV_ATTR(ext_perf, "%02x\n", card->ext_perf.feature_support);
+MMC_DEV_ATTR(ext_power, "%02x\n", card->ext_power.feature_support);
 
 static ssize_t mmc_dsr_show(struct device *dev, struct device_attribute *attr,
 			    char *buf)
@@ -777,6 +778,8 @@ static struct attribute *sd_std_attrs[]
 	&dev_attr_ocr.attr,
 	&dev_attr_rca.attr,
 	&dev_attr_dsr.attr,
+	&dev_attr_ext_perf.attr,
+	&dev_attr_ext_power.attr,
 	NULL,
 };
 
@@ -1512,8 +1515,8 @@ cont:
 			host->cqe_enabled = true;
 
 			if (card->ext_csd.cmdq_en) {
-				pr_info("%s: Command Queue Engine enabled\n",
-					mmc_hostname(host));
+				pr_info("%s: Command Queue Engine enabled, %u tags\n",
+					mmc_hostname(host), card->ext_csd.cmdq_depth);
 			} else {
 				host->hsq_enabled = true;
 				pr_info("%s: Host Software Queue enabled\n",
