Skip to contentSkip to conversation

mmc: sdhci-tegra: Separate T19x and T23x SoC data

PATCH Superseded Prathamesh Shete 3 participants 4 messages Sep 12, 2022

Subsystems (3)

v1 of 8 Superseded Latest is v8 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 mmc: sdhci-tegra: Separate T19x and T23x SoC data

Create new SoC data structure for T23x platforms.

---
 drivers/mmc/host/sdhci-tegra.c | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)
drivers/mmc/host/sdhci-tegra.c +16 -1
index 2d2d8260c681..136c045d8f01 100644
@@ -1525,7 +1525,8 @@ static const struct sdhci_pltfm_data sdhci_tegra186_pdata = {
 		  SDHCI_QUIRK_NO_HISPD_BIT |
 		  SDHCI_QUIRK_BROKEN_ADMA_ZEROLEN_DESC |
 		  SDHCI_QUIRK_CAP_CLOCK_BASE_BROKEN,
-	.quirks2 = SDHCI_QUIRK2_PRESET_VALUE_BROKEN,
+	.quirks2 = SDHCI_QUIRK2_PRESET_VALUE_BROKEN |
+		   SDHCI_QUIRK2_ISSUE_CMD_DAT_RESET_TOGETHER,
 	.ops  = &tegra186_sdhci_ops,
 };
 
@@ -1556,7 +1557,21 @@ static const struct sdhci_tegra_soc_data soc_data_tegra194 = {
 	.max_tap_delay = 139,
 };
 
+static const struct sdhci_tegra_soc_data soc_data_tegra234 = {
+	.pdata = &sdhci_tegra186_pdata,
+	.dma_mask = DMA_BIT_MASK(39),
+	.nvquirks = NVQUIRK_NEEDS_PAD_CONTROL |
+		    NVQUIRK_HAS_PADCALIB |
+		    NVQUIRK_DIS_CARD_CLK_CONFIG_TAP |
+		    NVQUIRK_ENABLE_SDR50 |
+		    NVQUIRK_ENABLE_SDR104 |
+		    NVQUIRK_HAS_TMCLK,
+	.min_tap_delay = 95,
+	.max_tap_delay = 111,
+};
+
 static const struct of_device_id sdhci_tegra_dt_match[] = {
+	{ .compatible = "nvidia,tegra234-sdhci", .data = &soc_data_tegra234 },
 	{ .compatible = "nvidia,tegra194-sdhci", .data = &soc_data_tegra194 },
 	{ .compatible = "nvidia,tegra186-sdhci", .data = &soc_data_tegra186 },
 	{ .compatible = "nvidia,tegra210-sdhci", .data = &soc_data_tegra210 },
Signature · 1 line
2.17.1
#1 lore raw

PATCH 2/2 mmc: sdhci-tegra: Use actual clock rate for SW tuning correction

Ensure tegra_host member "curr_clk_rate" holds the actual clock rate instead of requested clock rate for proper use during tuning correction algorithm.

Fixes ea8fc5953e8b ("mmc: tegra: update hw tuning process")
---
 drivers/mmc/host/sdhci-tegra.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mmc/host/sdhci-tegra.c +1 -1
index 136c045d8f01..3a3d188e8c65 100644
@@ -773,7 +773,7 @@ static void tegra_sdhci_set_clock(struct sdhci_host *host, unsigned int clock)
 		dev_err(dev, "failed to set clk rate to %luHz: %d\n",
 			host_clk, err);
 
-	tegra_host->curr_clk_rate = host_clk;
+	tegra_host->curr_clk_rate = clk_get_rate(pltfm_host->clk);
 	if (tegra_host->ddr_signaling)
 		host->max_clk = host_clk;
 	else
Signature · 1 line
2.17.1
maintainer
#2 lore raw
In reply to Prathamesh Shete
Quoted 1 line · Prathamesh Shete

Create new SoC data structure for T23x platforms.

Always helpful to say why we need to add new SoC data. Ie. what is different?

Quoted 42 lines
---
  drivers/mmc/host/sdhci-tegra.c | 17 ++++++++++++++++-
  1 file changed, 16 insertions(+), 1 deletion(-)
drivers/mmc/host/sdhci-tegra.c +16 -1
index 2d2d8260c681..136c045d8f01 100644
@@ -1525,7 +1525,8 @@ static const struct sdhci_pltfm_data sdhci_tegra186_pdata = {
  		  SDHCI_QUIRK_NO_HISPD_BIT |
  		  SDHCI_QUIRK_BROKEN_ADMA_ZEROLEN_DESC |
  		  SDHCI_QUIRK_CAP_CLOCK_BASE_BROKEN,
-	.quirks2 = SDHCI_QUIRK2_PRESET_VALUE_BROKEN,
+	.quirks2 = SDHCI_QUIRK2_PRESET_VALUE_BROKEN |
+		   SDHCI_QUIRK2_ISSUE_CMD_DAT_RESET_TOGETHER,
  	.ops  = &tegra186_sdhci_ops,
  };
 
@@ -1556,7 +1557,21 @@ static const struct sdhci_tegra_soc_data soc_data_tegra194 = {
  	.max_tap_delay = 139,
  };
 
+static const struct sdhci_tegra_soc_data soc_data_tegra234 = {
+	.pdata = &sdhci_tegra186_pdata,
+	.dma_mask = DMA_BIT_MASK(39),
+	.nvquirks = NVQUIRK_NEEDS_PAD_CONTROL |
+		    NVQUIRK_HAS_PADCALIB |
+		    NVQUIRK_DIS_CARD_CLK_CONFIG_TAP |
+		    NVQUIRK_ENABLE_SDR50 |
+		    NVQUIRK_ENABLE_SDR104 |
+		    NVQUIRK_HAS_TMCLK,
+	.min_tap_delay = 95,
+	.max_tap_delay = 111,
+};
+
  static const struct of_device_id sdhci_tegra_dt_match[] = {
+	{ .compatible = "nvidia,tegra234-sdhci", .data = &soc_data_tegra234 },
  	{ .compatible = "nvidia,tegra194-sdhci", .data = &soc_data_tegra194 },
  	{ .compatible = "nvidia,tegra186-sdhci", .data = &soc_data_tegra186 },
  	{ .compatible = "nvidia,tegra210-sdhci", .data = &soc_data_tegra210 },
Signature · 1 line
nvpublic
#3 lore raw
In reply to Prathamesh Shete
Thank you for the patch! Yet something to improve:

Hi Prathamesh,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on tegra/for-next]
[also build test ERROR on linus/master v6.0-rc5 next-20220912] [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/Prathamesh-Shete/mmc-sdhci-tegra-Separate-T19x-and-T23x-SoC-data/20220912-212611
base:   https://git.kernel.org/pub/scm/linux/kernel/git/tegra/linux.git for-next
config: m68k-allmodconfig (https://download.01.org/0day-ci/archive/20220913/[email protected]/config)
compiler: m68k-linux-gcc (GCC) 12.1.0

reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# https://github.com/intel-lab-lkp/linux/commit/d1a916947a4fb73d2982138d4e35dc50b4d19b3c
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review Prathamesh-Shete/mmc-sdhci-tegra-Separate-T19x-and-T23x-SoC-data/20220912-212611 git checkout d1a916947a4fb73d2982138d4e35dc50b4d19b3c
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=m68k SHELL=/bin/bash drivers/mmc/host/

If you fix the issue, kindly add following tag where applicable

All errors (new ones prefixed by >>):

>> drivers/mmc/host/sdhci-tegra.c:1529:20: error: 'SDHCI_QUIRK2_ISSUE_CMD_DAT_RESET_TOGETHER' undeclared here (not in a function)
    1529 |                    SDHCI_QUIRK2_ISSUE_CMD_DAT_RESET_TOGETHER,
         |                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

vim +/SDHCI_QUIRK2_ISSUE_CMD_DAT_RESET_TOGETHER +1529 drivers/mmc/host/sdhci-tegra.c

1521
1522 static const struct sdhci_pltfm_data sdhci_tegra186_pdata = {
1523 .quirks = SDHCI_QUIRK_BROKEN_TIMEOUT_VAL |

  1524			  SDHCI_QUIRK_SINGLE_POWER_WRITE |
  1525			  SDHCI_QUIRK_NO_HISPD_BIT |
  1526			  SDHCI_QUIRK_BROKEN_ADMA_ZEROLEN_DESC |
  1527			  SDHCI_QUIRK_CAP_CLOCK_BASE_BROKEN,
  1528		.quirks2 = SDHCI_QUIRK2_PRESET_VALUE_BROKEN |
> 1529			   SDHCI_QUIRK2_ISSUE_CMD_DAT_RESET_TOGETHER,

1530 .ops = &tegra186_sdhci_ops,
1531 };
1532

Signature · 2 lines
0-DAY CI Kernel Test Service
https://01.org/lkp