Skip to contentSkip to conversation

mmc: sdhci-of-dwcmshc: add ACPI match data for BlueField-3 SoC

PATCH Superseded Liming Sun 4 participants 8 messages Jul 29, 2022 – Aug 15, 2022

Subsystems (2)
lore
Share & tools
lore

Liming Sun

author
#0 lore raw

PATCH 1/1 mmc: sdhci-of-dwcmshc: add ACPI match data for BlueField-3 SoC

Commit 08f3dff799d43 introduces the of_device_get_match_data() checking for some chip but breaks the BlueField-3 firmware which uses ACPI instead. This commit adds the ACPI match data and quirks/quirks2 to re-enable the support of BlueField-3 SoC.

---
 drivers/mmc/host/sdhci-of-dwcmshc.c | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)
drivers/mmc/host/sdhci-of-dwcmshc.c +12 -2
index bac874ab0b33..173a9167a2f8 100644
@@ -279,6 +279,13 @@ static const struct sdhci_pltfm_data sdhci_dwcmshc_pdata = {
 	.quirks2 = SDHCI_QUIRK2_PRESET_VALUE_BROKEN,
 };
 
+static const struct sdhci_pltfm_data sdhci_dwcmshc_bf3_pdata = {
+	.ops = &sdhci_dwcmshc_ops,
+	.quirks = SDHCI_QUIRK_CAP_CLOCK_BASE_BROKEN,
+	.quirks2 = SDHCI_QUIRK2_PRESET_VALUE_BROKEN |
+		   SDHCI_QUIRK2_ACMD23_BROKEN,
+};
+
 static const struct sdhci_pltfm_data sdhci_dwcmshc_rk3568_pdata = {
 	.ops = &sdhci_dwcmshc_rk3568_ops,
 	.quirks = SDHCI_QUIRK_CAP_CLOCK_BASE_BROKEN |
@@ -336,7 +343,10 @@ MODULE_DEVICE_TABLE(of, sdhci_dwcmshc_dt_ids);
 
 #ifdef CONFIG_ACPI
 static const struct acpi_device_id sdhci_dwcmshc_acpi_ids[] = {
-	{ .id = "MLNXBF30" },
+	{
+		.id = "MLNXBF30",
+		.driver_data = (kernel_ulong_t)&sdhci_dwcmshc_bf3_pdata,
+	},
 	{}
 };
 #endif
@@ -352,7 +362,7 @@ static int dwcmshc_probe(struct platform_device *pdev)
 	int err;
 	u32 extra;
 
-	pltfm_data = of_device_get_match_data(&pdev->dev);
+	pltfm_data = device_get_match_data(&pdev->dev);
 	if (!pltfm_data) {
 		dev_err(&pdev->dev, "Error: No device match data found\n");
 		return -ENODEV;
Signature · 1 line
2.30.1
#1 lore raw
Thank you for the patch! Perhaps something to improve:

Hi Liming,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on linus/master]
[also build test WARNING on ulf-hansson-mmc-mirror/next v5.19-rc8] [cannot apply to next-20220728]
[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/Liming-Sun/mmc-sdhci-of-dwcmshc-add-ACPI-match-data-for-BlueField-3-SoC/20220729-211808
base:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 6e2c0490769ef8a95b61304389116ccc85c53e12
config: riscv-buildonly-randconfig-r002-20220729 (https://download.01.org/0day-ci/archive/20220730/[email protected]/config)
compiler: clang version 16.0.0 (https://github.com/llvm/llvm-project 52cd00cabf479aa7eb6dbb063b7ba41ea57bce9e)

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
# install riscv cross compiling tool for clang build
# apt-get install binutils-riscv64-linux-gnu
# https://github.com/intel-lab-lkp/linux/commit/0826c5e41791f253a28b7284805be00108b1f841
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review Liming-Sun/mmc-sdhci-of-dwcmshc-add-ACPI-match-data-for-BlueField-3-SoC/20220729-211808 git checkout 0826c5e41791f253a28b7284805be00108b1f841
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=riscv SHELL=/bin/bash drivers/mmc/host/

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

All warnings (new ones prefixed by >>):

>> drivers/mmc/host/sdhci-of-dwcmshc.c:282:38: warning: unused variable 'sdhci_dwcmshc_bf3_pdata' [-Wunused-const-variable]
   static const struct sdhci_pltfm_data sdhci_dwcmshc_bf3_pdata = {
                                        ^

1 warning generated.

vim +/sdhci_dwcmshc_bf3_pdata +282 drivers/mmc/host/sdhci-of-dwcmshc.c

281

 > 282	static const struct sdhci_pltfm_data sdhci_dwcmshc_bf3_pdata = {

283 .ops = &sdhci_dwcmshc_ops,
284 .quirks = SDHCI_QUIRK_CAP_CLOCK_BASE_BROKEN,
285 .quirks2 = SDHCI_QUIRK2_PRESET_VALUE_BROKEN |
286 SDHCI_QUIRK2_ACMD23_BROKEN,
287 };
288

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

PATCH v2 1/1 mmc: sdhci-of-dwcmshc: add ACPI match data for BlueField-3 SoC

In reply to Liming Sun

Commit 08f3dff799d43 introduces the of_device_get_match_data() checking for some chip but breaks the BlueField-3 firmware which uses ACPI instead. This commit adds the ACPI match data and quirks/quirks2 to re-enable the support of BlueField-3 SoC.

---
v1->v2:
Fixes an acpi warning

v1: Initial version.

---
 drivers/mmc/host/sdhci-of-dwcmshc.c | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)
drivers/mmc/host/sdhci-of-dwcmshc.c +14 -2
index bac874ab0b33..a0c73ddaaaa4 100644
@@ -279,6 +279,15 @@ static const struct sdhci_pltfm_data sdhci_dwcmshc_pdata = {
 	.quirks2 = SDHCI_QUIRK2_PRESET_VALUE_BROKEN,
 };
 
+#ifdef CONFIG_ACPI
+static const struct sdhci_pltfm_data sdhci_dwcmshc_bf3_pdata = {
+	.ops = &sdhci_dwcmshc_ops,
+	.quirks = SDHCI_QUIRK_CAP_CLOCK_BASE_BROKEN,
+	.quirks2 = SDHCI_QUIRK2_PRESET_VALUE_BROKEN |
+		   SDHCI_QUIRK2_ACMD23_BROKEN,
+};
+#endif
+
 static const struct sdhci_pltfm_data sdhci_dwcmshc_rk3568_pdata = {
 	.ops = &sdhci_dwcmshc_rk3568_ops,
 	.quirks = SDHCI_QUIRK_CAP_CLOCK_BASE_BROKEN |
@@ -336,7 +345,10 @@ MODULE_DEVICE_TABLE(of, sdhci_dwcmshc_dt_ids);
 
 #ifdef CONFIG_ACPI
 static const struct acpi_device_id sdhci_dwcmshc_acpi_ids[] = {
-	{ .id = "MLNXBF30" },
+	{
+		.id = "MLNXBF30",
+		.driver_data = (kernel_ulong_t)&sdhci_dwcmshc_bf3_pdata,
+	},
 	{}
 };
 #endif
@@ -352,7 +364,7 @@ static int dwcmshc_probe(struct platform_device *pdev)
 	int err;
 	u32 extra;
 
-	pltfm_data = of_device_get_match_data(&pdev->dev);
+	pltfm_data = device_get_match_data(&pdev->dev);
 	if (!pltfm_data) {
 		dev_err(&pdev->dev, "Error: No device match data found\n");
 		return -ENODEV;
Signature · 1 line
2.30.1
maintainer
#3 lore raw
Quoted 7 lines · Liming Sun

Commit 08f3dff799d43 introduces the of_device_get_match_data() checking for some chip but breaks the BlueField-3 firmware which uses ACPI instead. This commit adds the ACPI match data and quirks/quirks2 to re-enable the support of BlueField-3 SoC.

Please re-base this patch because it does not apply to latest mmc "next" branch.

Quoted 50 lines

---
v1->v2:
Fixes an acpi warning

v1: Initial version.

---
 drivers/mmc/host/sdhci-of-dwcmshc.c | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)
drivers/mmc/host/sdhci-of-dwcmshc.c +14 -2
index bac874ab0b33..a0c73ddaaaa4 100644
@@ -279,6 +279,15 @@ static const struct sdhci_pltfm_data sdhci_dwcmshc_pdata = {
 	.quirks2 = SDHCI_QUIRK2_PRESET_VALUE_BROKEN,
 };
 
+#ifdef CONFIG_ACPI
+static const struct sdhci_pltfm_data sdhci_dwcmshc_bf3_pdata = {
+	.ops = &sdhci_dwcmshc_ops,
+	.quirks = SDHCI_QUIRK_CAP_CLOCK_BASE_BROKEN,
+	.quirks2 = SDHCI_QUIRK2_PRESET_VALUE_BROKEN |
+		   SDHCI_QUIRK2_ACMD23_BROKEN,
+};
+#endif
+
 static const struct sdhci_pltfm_data sdhci_dwcmshc_rk3568_pdata = {
 	.ops = &sdhci_dwcmshc_rk3568_ops,
 	.quirks = SDHCI_QUIRK_CAP_CLOCK_BASE_BROKEN |
@@ -336,7 +345,10 @@ MODULE_DEVICE_TABLE(of, sdhci_dwcmshc_dt_ids);
 
 #ifdef CONFIG_ACPI
 static const struct acpi_device_id sdhci_dwcmshc_acpi_ids[] = {
-	{ .id = "MLNXBF30" },
+	{
+		.id = "MLNXBF30",
+		.driver_data = (kernel_ulong_t)&sdhci_dwcmshc_bf3_pdata,
+	},
 	{}
 };
 #endif
@@ -352,7 +364,7 @@ static int dwcmshc_probe(struct platform_device *pdev)
 	int err;
 	u32 extra;
 
-	pltfm_data = of_device_get_match_data(&pdev->dev);
+	pltfm_data = device_get_match_data(&pdev->dev);
 	if (!pltfm_data) {
 		dev_err(&pdev->dev, "Error: No device match data found\n");
 		return -ENODEV;
author
#4 lore raw

Thanks. Done and rebased to mmc 'next' in patch v3.

Quoted 76 lines

-----Original Message-----
From: Adrian Hunter <[email protected]>
Sent: Monday, August 8, 2022 4:26 AM
To: Liming Sun <[email protected]>; Ulf Hansson <[email protected]>; David Woods <[email protected]>; Shawn Lin <shawn.lin@rock- chips.com>
Cc: [email protected]; [email protected]
Subject: Re: [PATCH v2] mmc: sdhci-of-dwcmshc: add ACPI match data for BlueField-3 SoC

Quoted 7 lines · Liming Sun

Commit 08f3dff799d43 introduces the of_device_get_match_data() checking for some chip but breaks the BlueField-3 firmware which uses ACPI instead. This commit adds the ACPI match data and quirks/quirks2 to re-enable the support of BlueField-3 SoC.

Please re-base this patch because it does not apply to latest mmc "next" branch.

Review

Quoted 10 lines

---
v1->v2:
Fixes an acpi warning

v1: Initial version.

---
 drivers/mmc/host/sdhci-of-dwcmshc.c | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)
(quoted diff) +0 -0

b/drivers/mmc/host/sdhci-of-dwcmshc.c

drivers/mmc/host/sdhci-of-dwcmshc.c static const struct sdhci_pltfm_data

Quoted 4 lines

index bac874ab0b33..a0c73ddaaaa4 100644

drivers/mmc/host/sdhci-of-dwcmshc.c +0 -0
@@ -279,6 +279,15 @@ static const struct sdhci_pltfm_data

sdhci_dwcmshc_pdata = {

drivers/mmc/host/sdhci-of-dwcmshc.c MODULE_DEVICE_TABLE(of,

Quoted 16 lines
drivers/mmc/host/sdhci-of-dwcmshc.c +9 -0
 	.quirks2 = SDHCI_QUIRK2_PRESET_VALUE_BROKEN,
 };
 
+#ifdef CONFIG_ACPI
+static const struct sdhci_pltfm_data sdhci_dwcmshc_bf3_pdata = {
+	.ops = &sdhci_dwcmshc_ops,
+	.quirks = SDHCI_QUIRK_CAP_CLOCK_BASE_BROKEN,
+	.quirks2 = SDHCI_QUIRK2_PRESET_VALUE_BROKEN |
+		   SDHCI_QUIRK2_ACMD23_BROKEN,
+};
+#endif
+
 static const struct sdhci_pltfm_data sdhci_dwcmshc_rk3568_pdata = {
 	.ops = &sdhci_dwcmshc_rk3568_ops,
 	.quirks = SDHCI_QUIRK_CAP_CLOCK_BASE_BROKEN |
@@ -336,7 +345,10 @@ MODULE_DEVICE_TABLE(of,

sdhci_dwcmshc_dt_ids);

drivers/mmc/host/sdhci-of-dwcmshc.c static int dwcmshc_probe(struct platform_device

Quoted 12 lines
drivers/mmc/host/sdhci-of-dwcmshc.c +4 -1
 #ifdef CONFIG_ACPI
 static const struct acpi_device_id sdhci_dwcmshc_acpi_ids[] = {
-	{ .id = "MLNXBF30" },
+	{
+		.id = "MLNXBF30",
+		.driver_data = (kernel_ulong_t)&sdhci_dwcmshc_bf3_pdata,
+	},
 	{}
 };
 #endif
@@ -352,7 +364,7 @@ static int dwcmshc_probe(struct platform_device

*pdev)

Quoted 8 lines
drivers/mmc/host/sdhci-of-dwcmshc.c +1 -1
 	int err;
 	u32 extra;
 
-	pltfm_data = of_device_get_match_data(&pdev->dev);
+	pltfm_data = device_get_match_data(&pdev->dev);
 	if (!pltfm_data) {
 		dev_err(&pdev->dev, "Error: No device match data found\n");
 		return -ENODEV;
author
#5 lore raw

PATCH v3 1/1 mmc: sdhci-of-dwcmshc: add ACPI match data for BlueField-3 SoC

In reply to Liming Sun

Commit 08f3dff799d43 introduces the of_device_get_match_data() checking for some chip but breaks the BlueField-3 firmware which uses ACPI instead. This commit adds the ACPI match data and quirks/quirks2 to re-enable the support of BlueField-3 SoC.

---
v2->v3:
Rebase to mmc next
v1->v2:
Fixes an acpi warning

v1: Initial version.

---
 drivers/mmc/host/sdhci-of-dwcmshc.c | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)
drivers/mmc/host/sdhci-of-dwcmshc.c +14 -2
index 4e904850973c..a7343d4bc50e 100644
@@ -349,6 +349,15 @@ static const struct sdhci_pltfm_data sdhci_dwcmshc_pdata = {
 	.quirks2 = SDHCI_QUIRK2_PRESET_VALUE_BROKEN,
 };
 
+#ifdef CONFIG_ACPI
+static const struct sdhci_pltfm_data sdhci_dwcmshc_bf3_pdata = {
+	.ops = &sdhci_dwcmshc_ops,
+	.quirks = SDHCI_QUIRK_CAP_CLOCK_BASE_BROKEN,
+	.quirks2 = SDHCI_QUIRK2_PRESET_VALUE_BROKEN |
+		   SDHCI_QUIRK2_ACMD23_BROKEN,
+};
+#endif
+
 static const struct sdhci_pltfm_data sdhci_dwcmshc_rk35xx_pdata = {
 	.ops = &sdhci_dwcmshc_rk35xx_ops,
 	.quirks = SDHCI_QUIRK_CAP_CLOCK_BASE_BROKEN |
@@ -431,7 +440,10 @@ MODULE_DEVICE_TABLE(of, sdhci_dwcmshc_dt_ids);
 
 #ifdef CONFIG_ACPI
 static const struct acpi_device_id sdhci_dwcmshc_acpi_ids[] = {
-	{ .id = "MLNXBF30" },
+	{
+		.id = "MLNXBF30",
+		.driver_data = (kernel_ulong_t)&sdhci_dwcmshc_bf3_pdata,
+	},
 	{}
 };
 #endif
@@ -447,7 +459,7 @@ static int dwcmshc_probe(struct platform_device *pdev)
 	int err;
 	u32 extra;
 
-	pltfm_data = of_device_get_match_data(&pdev->dev);
+	pltfm_data = device_get_match_data(&pdev->dev);
 	if (!pltfm_data) {
 		dev_err(&pdev->dev, "Error: No device match data found\n");
 		return -ENODEV;
Signature · 1 line
2.30.1
maintainer Acked-by on v3 1/1
#6 lore raw
Quoted 7 lines · Liming Sun

Commit 08f3dff799d43 introduces the of_device_get_match_data() checking for some chip but breaks the BlueField-3 firmware which uses ACPI instead. This commit adds the ACPI match data and quirks/quirks2 to re-enable the support of BlueField-3 SoC.

Quoted 52 lines

---
v2->v3:
Rebase to mmc next
v1->v2:
Fixes an acpi warning

v1: Initial version.

---
 drivers/mmc/host/sdhci-of-dwcmshc.c | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)
drivers/mmc/host/sdhci-of-dwcmshc.c +14 -2
index 4e904850973c..a7343d4bc50e 100644
@@ -349,6 +349,15 @@ static const struct sdhci_pltfm_data sdhci_dwcmshc_pdata = {
 	.quirks2 = SDHCI_QUIRK2_PRESET_VALUE_BROKEN,
 };
 
+#ifdef CONFIG_ACPI
+static const struct sdhci_pltfm_data sdhci_dwcmshc_bf3_pdata = {
+	.ops = &sdhci_dwcmshc_ops,
+	.quirks = SDHCI_QUIRK_CAP_CLOCK_BASE_BROKEN,
+	.quirks2 = SDHCI_QUIRK2_PRESET_VALUE_BROKEN |
+		   SDHCI_QUIRK2_ACMD23_BROKEN,
+};
+#endif
+
 static const struct sdhci_pltfm_data sdhci_dwcmshc_rk35xx_pdata = {
 	.ops = &sdhci_dwcmshc_rk35xx_ops,
 	.quirks = SDHCI_QUIRK_CAP_CLOCK_BASE_BROKEN |
@@ -431,7 +440,10 @@ MODULE_DEVICE_TABLE(of, sdhci_dwcmshc_dt_ids);
 
 #ifdef CONFIG_ACPI
 static const struct acpi_device_id sdhci_dwcmshc_acpi_ids[] = {
-	{ .id = "MLNXBF30" },
+	{
+		.id = "MLNXBF30",
+		.driver_data = (kernel_ulong_t)&sdhci_dwcmshc_bf3_pdata,
+	},
 	{}
 };
 #endif
@@ -447,7 +459,7 @@ static int dwcmshc_probe(struct platform_device *pdev)
 	int err;
 	u32 extra;
 
-	pltfm_data = of_device_get_match_data(&pdev->dev);
+	pltfm_data = device_get_match_data(&pdev->dev);
 	if (!pltfm_data) {
 		dev_err(&pdev->dev, "Error: No device match data found\n");
 		return -ENODEV;
#7 lore raw
In reply to Liming Sun
Quoted 8 lines · Liming Sun

Commit 08f3dff799d43 introduces the of_device_get_match_data() checking for some chip but breaks the BlueField-3 firmware which uses ACPI instead. This commit adds the ACPI match data and quirks/quirks2 to re-enable the support of BlueField-3 SoC.

Applied for fixes, by adding a stable+fixes tag, thanks!

Kind regards
Uffe

Quoted 55 lines

---
v2->v3:
Rebase to mmc next
v1->v2:
Fixes an acpi warning

v1: Initial version.

---
 drivers/mmc/host/sdhci-of-dwcmshc.c | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)
drivers/mmc/host/sdhci-of-dwcmshc.c +14 -3
index 4e904850973c..a7343d4bc50e 100644
@@ -349,6 +349,15 @@ static const struct sdhci_pltfm_data sdhci_dwcmshc_pdata = {
        .quirks2 = SDHCI_QUIRK2_PRESET_VALUE_BROKEN,
 };
 
+#ifdef CONFIG_ACPI
+static const struct sdhci_pltfm_data sdhci_dwcmshc_bf3_pdata = {
+       .ops = &sdhci_dwcmshc_ops,
+       .quirks = SDHCI_QUIRK_CAP_CLOCK_BASE_BROKEN,
+       .quirks2 = SDHCI_QUIRK2_PRESET_VALUE_BROKEN |
+                  SDHCI_QUIRK2_ACMD23_BROKEN,
+};
+#endif
+
 static const struct sdhci_pltfm_data sdhci_dwcmshc_rk35xx_pdata = {
        .ops = &sdhci_dwcmshc_rk35xx_ops,
        .quirks = SDHCI_QUIRK_CAP_CLOCK_BASE_BROKEN |
@@ -431,7 +440,10 @@ MODULE_DEVICE_TABLE(of, sdhci_dwcmshc_dt_ids);
 
 #ifdef CONFIG_ACPI
 static const struct acpi_device_id sdhci_dwcmshc_acpi_ids[] = {
-       { .id = "MLNXBF30" },
+       {
+               .id = "MLNXBF30",
+               .driver_data = (kernel_ulong_t)&sdhci_dwcmshc_bf3_pdata,
+       },
        {}
 };
 #endif
@@ -447,7 +459,7 @@ static int dwcmshc_probe(struct platform_device *pdev)
        int err;
        u32 extra;
 
-       pltfm_data = of_device_get_match_data(&pdev->dev);
+       pltfm_data = device_get_match_data(&pdev->dev);
        if (!pltfm_data) {
                dev_err(&pdev->dev, "Error: No device match data found\n");
                return -ENODEV;
--

2.30.1