[PATCH] mmc: sdhci-msm: Command Queue (CQ) Register changes for v5.0

Sachin Gupta posted 1 patch 1 year, 2 months ago
drivers/mmc/host/sdhci-msm.c | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+)
[PATCH] mmc: sdhci-msm: Command Queue (CQ) Register changes for v5.0
Posted by Sachin Gupta 1 year, 2 months ago
For SDHC version 5.0 onwards, ICE3.0 specific registers are added in
CQ register space,  due to which few CQ registers(like CQ_VENDOR_GFG,
CQ_CMD_DBG_RAM) are shifted. This change is to add right offset to 
shifted registers.

Signed-off-by: Sahitya Tummala <stummala@codeaurora.org>
Signed-off-by: Sarthak Garg <sartgarg@codeaurora.org>
Signed-off-by: kamasali <quic_kamasali@quicinc.com>
Signed-off-by: Sachin Gupta <quic_sachgupt@quicinc.com>
---
 drivers/mmc/host/sdhci-msm.c | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/drivers/mmc/host/sdhci-msm.c b/drivers/mmc/host/sdhci-msm.c
index e00208535bd1..364e91049376 100644
--- a/drivers/mmc/host/sdhci-msm.c
+++ b/drivers/mmc/host/sdhci-msm.c
@@ -146,6 +146,8 @@
 /* CQHCI vendor specific registers */
 #define CQHCI_VENDOR_CFG1	0xA00
 #define CQHCI_VENDOR_DIS_RST_ON_CQ_EN	(0x3 << 13)
+#define CQE_V5_VENDOR_CFG	0x900
+#define CQHCI_VENDOR_CFG	0x100
 
 struct sdhci_msm_offset {
 	u32 core_hc_mode;
@@ -290,6 +292,7 @@ struct sdhci_msm_host {
 	u32 dll_config;
 	u32 ddr_config;
 	bool vqmmc_enabled;
+	bool cqhci_offset_changed;
 };
 
 static const struct sdhci_msm_offset *sdhci_priv_msm_offset(struct sdhci_host *host)
@@ -2249,11 +2252,20 @@ static int sdhci_msm_start_signal_voltage_switch(struct mmc_host *mmc,
 #define SDHCI_MSM_DUMP(f, x...) \
 	pr_err("%s: " DRIVER_NAME ": " f, mmc_hostname(host->mmc), ## x)
 
+#define DRV_NAME "cqhci"
+#define CQHCI_DUMP(f, x...) \
+	pr_err("%s: " DRV_NAME ": " f, mmc_hostname(host->mmc), ## x)
+
 static void sdhci_msm_dump_vendor_regs(struct sdhci_host *host)
 {
 	struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
 	struct sdhci_msm_host *msm_host = sdhci_pltfm_priv(pltfm_host);
 	const struct sdhci_msm_offset *msm_offset = msm_host->offset;
+	struct cqhci_host *cq_host;
+	int offset = 0;
+
+	if (msm_host->cqhci_offset_changed)
+		offset = CQE_V5_VENDOR_CFG;
 
 	SDHCI_MSM_DUMP("----------- VENDOR REGISTER DUMP -----------\n");
 
@@ -2273,6 +2285,8 @@ static void sdhci_msm_dump_vendor_regs(struct sdhci_host *host)
 		readl_relaxed(host->ioaddr +
 			msm_offset->core_vendor_spec_func2),
 		readl_relaxed(host->ioaddr + msm_offset->core_vendor_spec3));
+	CQHCI_DUMP("Vendor cfg 0x%08x\n",
+		readl_relaxed(cq_host->mmio + CQHCI_VENDOR_CFG + offset));
 }
 
 static const struct sdhci_msm_variant_ops mci_var_ops = {
@@ -2584,6 +2598,14 @@ static int sdhci_msm_probe(struct platform_device *pdev)
 	if (core_major == 1 && core_minor >= 0x49)
 		msm_host->updated_ddr_cfg = true;
 
+	/* For SDHC v5.0.0 onwards, ICE 3.0 specific registers are added
+	 * in CQ register space, due to which few CQ registers are
+	 * shifted. Set cqhci_offset_changed boolean to use updated address.
+	 */
+	if (core_major == 1 && core_minor >= 0x6B)
+		msm_host->cqhci_offset_changed = true;
+
+
 	if (core_major == 1 && core_minor >= 0x71)
 		msm_host->uses_tassadar_dll = true;
 
-- 
2.17.1
Re: [PATCH] mmc: sdhci-msm: Command Queue (CQ) Register changes for v5.0
Posted by kernel test robot 1 year, 2 months ago
Hi Sachin,

kernel test robot noticed the following build warnings:

[auto build test WARNING on linus/master]
[also build test WARNING on ulf-hansson-mmc-mirror/next v6.13-rc1 next-20241128]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Sachin-Gupta/mmc-sdhci-msm-Command-Queue-CQ-Register-changes-for-v5-0/20241202-170044
base:   linus/master
patch link:    https://lore.kernel.org/r/20241202085631.13468-1-quic_sachgupt%40quicinc.com
patch subject: [PATCH] mmc: sdhci-msm: Command Queue (CQ) Register changes for v5.0
config: s390-allmodconfig (https://download.01.org/0day-ci/archive/20241202/202412022356.OfhUSoyq-lkp@intel.com/config)
compiler: clang version 20.0.0git (https://github.com/llvm/llvm-project 592c0fe55f6d9a811028b5f3507be91458ab2713)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20241202/202412022356.OfhUSoyq-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202412022356.OfhUSoyq-lkp@intel.com/

All warnings (new ones prefixed by >>):

   In file included from drivers/mmc/host/sdhci-msm.c:8:
   In file included from include/linux/module.h:19:
   In file included from include/linux/elf.h:6:
   In file included from arch/s390/include/asm/elf.h:181:
   In file included from arch/s390/include/asm/mmu_context.h:11:
   In file included from arch/s390/include/asm/pgalloc.h:18:
   In file included from include/linux/mm.h:2223:
   include/linux/vmstat.h:504:43: warning: arithmetic between different enumeration types ('enum zone_stat_item' and 'enum numa_stat_item') [-Wenum-enum-conversion]
     504 |         return vmstat_text[NR_VM_ZONE_STAT_ITEMS +
         |                            ~~~~~~~~~~~~~~~~~~~~~ ^
     505 |                            item];
         |                            ~~~~
   include/linux/vmstat.h:511:43: warning: arithmetic between different enumeration types ('enum zone_stat_item' and 'enum numa_stat_item') [-Wenum-enum-conversion]
     511 |         return vmstat_text[NR_VM_ZONE_STAT_ITEMS +
         |                            ~~~~~~~~~~~~~~~~~~~~~ ^
     512 |                            NR_VM_NUMA_EVENT_ITEMS +
         |                            ~~~~~~~~~~~~~~~~~~~~~~
   include/linux/vmstat.h:518:36: warning: arithmetic between different enumeration types ('enum node_stat_item' and 'enum lru_list') [-Wenum-enum-conversion]
     518 |         return node_stat_name(NR_LRU_BASE + lru) + 3; // skip "nr_"
         |                               ~~~~~~~~~~~ ^ ~~~
   include/linux/vmstat.h:524:43: warning: arithmetic between different enumeration types ('enum zone_stat_item' and 'enum numa_stat_item') [-Wenum-enum-conversion]
     524 |         return vmstat_text[NR_VM_ZONE_STAT_ITEMS +
         |                            ~~~~~~~~~~~~~~~~~~~~~ ^
     525 |                            NR_VM_NUMA_EVENT_ITEMS +
         |                            ~~~~~~~~~~~~~~~~~~~~~~
>> drivers/mmc/host/sdhci-msm.c:2289:17: warning: variable 'cq_host' is uninitialized when used here [-Wuninitialized]
    2289 |                 readl_relaxed(cq_host->mmio + CQHCI_VENDOR_CFG + offset));
         |                               ^~~~~~~
   drivers/mmc/host/sdhci-msm.c:2257:61: note: expanded from macro 'CQHCI_DUMP'
    2257 |         pr_err("%s: " DRV_NAME ": " f, mmc_hostname(host->mmc), ## x)
         |                                                                    ^
   include/linux/printk.h:544:33: note: expanded from macro 'pr_err'
     544 |         printk(KERN_ERR pr_fmt(fmt), ##__VA_ARGS__)
         |                                        ^~~~~~~~~~~
   include/linux/printk.h:501:60: note: expanded from macro 'printk'
     501 | #define printk(fmt, ...) printk_index_wrap(_printk, fmt, ##__VA_ARGS__)
         |                                                            ^~~~~~~~~~~
   include/linux/printk.h:473:19: note: expanded from macro 'printk_index_wrap'
     473 |                 _p_func(_fmt, ##__VA_ARGS__);                           \
         |                                 ^~~~~~~~~~~
   drivers/mmc/host/sdhci-msm.c:2264:28: note: initialize the variable 'cq_host' to silence this warning
    2264 |         struct cqhci_host *cq_host;
         |                                   ^
         |                                    = NULL
   5 warnings generated.


vim +/cq_host +2289 drivers/mmc/host/sdhci-msm.c

  2250	
  2251	#define DRIVER_NAME "sdhci_msm"
  2252	#define SDHCI_MSM_DUMP(f, x...) \
  2253		pr_err("%s: " DRIVER_NAME ": " f, mmc_hostname(host->mmc), ## x)
  2254	
  2255	#define DRV_NAME "cqhci"
  2256	#define CQHCI_DUMP(f, x...) \
  2257		pr_err("%s: " DRV_NAME ": " f, mmc_hostname(host->mmc), ## x)
  2258	
  2259	static void sdhci_msm_dump_vendor_regs(struct sdhci_host *host)
  2260	{
  2261		struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
  2262		struct sdhci_msm_host *msm_host = sdhci_pltfm_priv(pltfm_host);
  2263		const struct sdhci_msm_offset *msm_offset = msm_host->offset;
  2264		struct cqhci_host *cq_host;
  2265		int offset = 0;
  2266	
  2267		if (msm_host->cqhci_offset_changed)
  2268			offset = CQE_V5_VENDOR_CFG;
  2269	
  2270		SDHCI_MSM_DUMP("----------- VENDOR REGISTER DUMP -----------\n");
  2271	
  2272		SDHCI_MSM_DUMP(
  2273				"DLL sts: 0x%08x | DLL cfg:  0x%08x | DLL cfg2: 0x%08x\n",
  2274			readl_relaxed(host->ioaddr + msm_offset->core_dll_status),
  2275			readl_relaxed(host->ioaddr + msm_offset->core_dll_config),
  2276			readl_relaxed(host->ioaddr + msm_offset->core_dll_config_2));
  2277		SDHCI_MSM_DUMP(
  2278				"DLL cfg3: 0x%08x | DLL usr ctl:  0x%08x | DDR cfg: 0x%08x\n",
  2279			readl_relaxed(host->ioaddr + msm_offset->core_dll_config_3),
  2280			readl_relaxed(host->ioaddr + msm_offset->core_dll_usr_ctl),
  2281			readl_relaxed(host->ioaddr + msm_offset->core_ddr_config));
  2282		SDHCI_MSM_DUMP(
  2283				"Vndr func: 0x%08x | Vndr func2 : 0x%08x Vndr func3: 0x%08x\n",
  2284			readl_relaxed(host->ioaddr + msm_offset->core_vendor_spec),
  2285			readl_relaxed(host->ioaddr +
  2286				msm_offset->core_vendor_spec_func2),
  2287			readl_relaxed(host->ioaddr + msm_offset->core_vendor_spec3));
  2288		CQHCI_DUMP("Vendor cfg 0x%08x\n",
> 2289			readl_relaxed(cq_host->mmio + CQHCI_VENDOR_CFG + offset));
  2290	}
  2291	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
Re: [PATCH] mmc: sdhci-msm: Command Queue (CQ) Register changes for v5.0
Posted by kernel test robot 1 year, 2 months ago
Hi Sachin,

kernel test robot noticed the following build warnings:

[auto build test WARNING on linus/master]
[also build test WARNING on ulf-hansson-mmc-mirror/next v6.13-rc1 next-20241128]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Sachin-Gupta/mmc-sdhci-msm-Command-Queue-CQ-Register-changes-for-v5-0/20241202-170044
base:   linus/master
patch link:    https://lore.kernel.org/r/20241202085631.13468-1-quic_sachgupt%40quicinc.com
patch subject: [PATCH] mmc: sdhci-msm: Command Queue (CQ) Register changes for v5.0
config: arm64-randconfig-001-20241202 (https://download.01.org/0day-ci/archive/20241202/202412022051.5NYO7EbI-lkp@intel.com/config)
compiler: aarch64-linux-gcc (GCC) 14.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20241202/202412022051.5NYO7EbI-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202412022051.5NYO7EbI-lkp@intel.com/

All warnings (new ones prefixed by >>):

   In file included from include/asm-generic/bug.h:22,
                    from arch/arm64/include/asm/bug.h:26,
                    from include/linux/bug.h:5,
                    from arch/arm64/include/asm/cpufeature.h:24,
                    from arch/arm64/include/asm/hwcap.h:9,
                    from arch/arm64/include/asm/arch_timer.h:12,
                    from arch/arm64/include/asm/timex.h:8,
                    from include/linux/timex.h:67,
                    from include/linux/time32.h:13,
                    from include/linux/time.h:60,
                    from include/linux/stat.h:19,
                    from include/linux/module.h:13,
                    from drivers/mmc/host/sdhci-msm.c:8:
   drivers/mmc/host/sdhci-msm.c: In function 'sdhci_msm_dump_vendor_regs':
>> drivers/mmc/host/sdhci-msm.c:2289:38: warning: 'cq_host' is used uninitialized [-Wuninitialized]
    2289 |                 readl_relaxed(cq_host->mmio + CQHCI_VENDOR_CFG + offset));
         |                               ~~~~~~~^~~~~~
   include/linux/printk.h:473:33: note: in definition of macro 'printk_index_wrap'
     473 |                 _p_func(_fmt, ##__VA_ARGS__);                           \
         |                                 ^~~~~~~~~~~
   include/linux/printk.h:544:9: note: in expansion of macro 'printk'
     544 |         printk(KERN_ERR pr_fmt(fmt), ##__VA_ARGS__)
         |         ^~~~~~
   drivers/mmc/host/sdhci-msm.c:2257:9: note: in expansion of macro 'pr_err'
    2257 |         pr_err("%s: " DRV_NAME ": " f, mmc_hostname(host->mmc), ## x)
         |         ^~~~~~
   drivers/mmc/host/sdhci-msm.c:2288:9: note: in expansion of macro 'CQHCI_DUMP'
    2288 |         CQHCI_DUMP("Vendor cfg 0x%08x\n",
         |         ^~~~~~~~~~
   drivers/mmc/host/sdhci-msm.c:2264:28: note: 'cq_host' was declared here
    2264 |         struct cqhci_host *cq_host;
         |                            ^~~~~~~


vim +/cq_host +2289 drivers/mmc/host/sdhci-msm.c

  2250	
  2251	#define DRIVER_NAME "sdhci_msm"
  2252	#define SDHCI_MSM_DUMP(f, x...) \
  2253		pr_err("%s: " DRIVER_NAME ": " f, mmc_hostname(host->mmc), ## x)
  2254	
  2255	#define DRV_NAME "cqhci"
  2256	#define CQHCI_DUMP(f, x...) \
  2257		pr_err("%s: " DRV_NAME ": " f, mmc_hostname(host->mmc), ## x)
  2258	
  2259	static void sdhci_msm_dump_vendor_regs(struct sdhci_host *host)
  2260	{
  2261		struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
  2262		struct sdhci_msm_host *msm_host = sdhci_pltfm_priv(pltfm_host);
  2263		const struct sdhci_msm_offset *msm_offset = msm_host->offset;
  2264		struct cqhci_host *cq_host;
  2265		int offset = 0;
  2266	
  2267		if (msm_host->cqhci_offset_changed)
  2268			offset = CQE_V5_VENDOR_CFG;
  2269	
  2270		SDHCI_MSM_DUMP("----------- VENDOR REGISTER DUMP -----------\n");
  2271	
  2272		SDHCI_MSM_DUMP(
  2273				"DLL sts: 0x%08x | DLL cfg:  0x%08x | DLL cfg2: 0x%08x\n",
  2274			readl_relaxed(host->ioaddr + msm_offset->core_dll_status),
  2275			readl_relaxed(host->ioaddr + msm_offset->core_dll_config),
  2276			readl_relaxed(host->ioaddr + msm_offset->core_dll_config_2));
  2277		SDHCI_MSM_DUMP(
  2278				"DLL cfg3: 0x%08x | DLL usr ctl:  0x%08x | DDR cfg: 0x%08x\n",
  2279			readl_relaxed(host->ioaddr + msm_offset->core_dll_config_3),
  2280			readl_relaxed(host->ioaddr + msm_offset->core_dll_usr_ctl),
  2281			readl_relaxed(host->ioaddr + msm_offset->core_ddr_config));
  2282		SDHCI_MSM_DUMP(
  2283				"Vndr func: 0x%08x | Vndr func2 : 0x%08x Vndr func3: 0x%08x\n",
  2284			readl_relaxed(host->ioaddr + msm_offset->core_vendor_spec),
  2285			readl_relaxed(host->ioaddr +
  2286				msm_offset->core_vendor_spec_func2),
  2287			readl_relaxed(host->ioaddr + msm_offset->core_vendor_spec3));
  2288		CQHCI_DUMP("Vendor cfg 0x%08x\n",
> 2289			readl_relaxed(cq_host->mmio + CQHCI_VENDOR_CFG + offset));
  2290	}
  2291	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki