* [PATCH v1 1/1] mmc: sdhci-of-dwcmshc: Add hw_reset() support for BlueField-3 SoC
@ 2024-08-26 21:26 Liming Sun
2024-08-27 15:11 ` kernel test robot
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Liming Sun @ 2024-08-26 21:26 UTC (permalink / raw)
To: Adrian Hunter, Ulf Hansson, David Thompson
Cc: Liming Sun, linux-mmc, linux-kernel
The eMMC RST_N register is implemented as secure register on
the BlueField-3 SoC and controlled by TF-A. This commit adds the
hw_reset() support which sends an SMC call to TF-A for the eMMC
HW reset.
Reviewed-by: David Thompson <davthompson@nvidia.com>
Signed-off-by: Liming Sun <limings@nvidia.com>
---
drivers/mmc/host/sdhci-of-dwcmshc.c | 27 +++++++++++++++++++++++++++
1 file changed, 27 insertions(+)
diff --git a/drivers/mmc/host/sdhci-of-dwcmshc.c b/drivers/mmc/host/sdhci-of-dwcmshc.c
index ba8960d8b2d4..3c763e67e4ac 100644
--- a/drivers/mmc/host/sdhci-of-dwcmshc.c
+++ b/drivers/mmc/host/sdhci-of-dwcmshc.c
@@ -8,6 +8,7 @@
*/
#include <linux/acpi.h>
+#include <linux/arm-smccc.h>
#include <linux/bitfield.h>
#include <linux/clk.h>
#include <linux/dma-mapping.h>
@@ -201,6 +202,9 @@
SDHCI_TRNS_BLK_CNT_EN | \
SDHCI_TRNS_DMA)
+/* SMC call for BlueField-3 eMMC RST_N */
+#define BLUEFIELD_SMC_SET_EMMC_RST_N 0x82000007
+
enum dwcmshc_rk_type {
DWCMSHC_RK3568,
DWCMSHC_RK3588,
@@ -1111,6 +1115,29 @@ static const struct sdhci_ops sdhci_dwcmshc_ops = {
.irq = dwcmshc_cqe_irq_handler,
};
+#ifdef CONFIG_ACPI
+static void dwcmshc_bf3_hw_reset(struct sdhci_host *host)
+{
+ struct arm_smccc_res res = { 0 };
+
+ arm_smccc_smc(BLUEFIELD_SMC_SET_EMMC_RST_N, 0, 0, 0, 0, 0, 0, 0, &res);
+
+ if (res.a0)
+ pr_err("%s: RST_N failed.\n", mmc_hostname(host->mmc));
+}
+
+static const struct sdhci_ops sdhci_dwcmshc_bf3_ops = {
+ .set_clock = sdhci_set_clock,
+ .set_bus_width = sdhci_set_bus_width,
+ .set_uhs_signaling = dwcmshc_set_uhs_signaling,
+ .get_max_clock = dwcmshc_get_max_clock,
+ .reset = sdhci_reset,
+ .adma_write_desc = dwcmshc_adma_write_desc,
+ .irq = dwcmshc_cqe_irq_handler,
+ .hw_reset = dwcmshc_bf3_hw_reset,
+};
+#endif
+
static const struct sdhci_ops sdhci_dwcmshc_rk35xx_ops = {
.set_clock = dwcmshc_rk3568_set_clock,
.set_bus_width = sdhci_set_bus_width,
--
2.18.4
^ permalink raw reply related [flat|nested] 5+ messages in thread* Re: [PATCH v1 1/1] mmc: sdhci-of-dwcmshc: Add hw_reset() support for BlueField-3 SoC 2024-08-26 21:26 [PATCH v1 1/1] mmc: sdhci-of-dwcmshc: Add hw_reset() support for BlueField-3 SoC Liming Sun @ 2024-08-27 15:11 ` kernel test robot 2024-08-27 15:42 ` kernel test robot 2024-08-27 16:40 ` [PATCH v2] " Liming Sun 2 siblings, 0 replies; 5+ messages in thread From: kernel test robot @ 2024-08-27 15:11 UTC (permalink / raw) To: Liming Sun, Adrian Hunter, Ulf Hansson, David Thompson Cc: oe-kbuild-all, Liming Sun, linux-mmc, linux-kernel Hi Liming, kernel test robot noticed the following build warnings: [auto build test WARNING on linus/master] [also build test WARNING on v6.11-rc5 next-20240827] [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-hw_reset-support-for-BlueField-3-SoC/20240827-052819 base: linus/master patch link: https://lore.kernel.org/r/73703c853e36f3cd61114e4ac815926d94a1a802.1724695127.git.limings%40nvidia.com patch subject: [PATCH v1 1/1] mmc: sdhci-of-dwcmshc: Add hw_reset() support for BlueField-3 SoC config: loongarch-allmodconfig (https://download.01.org/0day-ci/archive/20240827/202408272252.lAVSmMBR-lkp@intel.com/config) compiler: loongarch64-linux-gcc (GCC) 14.1.0 reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240827/202408272252.lAVSmMBR-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/202408272252.lAVSmMBR-lkp@intel.com/ All warnings (new ones prefixed by >>): >> drivers/mmc/host/sdhci-of-dwcmshc.c:919:31: warning: 'sdhci_dwcmshc_bf3_ops' defined but not used [-Wunused-const-variable=] 919 | static const struct sdhci_ops sdhci_dwcmshc_bf3_ops = { | ^~~~~~~~~~~~~~~~~~~~~ vim +/sdhci_dwcmshc_bf3_ops +919 drivers/mmc/host/sdhci-of-dwcmshc.c 918 > 919 static const struct sdhci_ops sdhci_dwcmshc_bf3_ops = { 920 .set_clock = sdhci_set_clock, 921 .set_bus_width = sdhci_set_bus_width, 922 .set_uhs_signaling = dwcmshc_set_uhs_signaling, 923 .get_max_clock = dwcmshc_get_max_clock, 924 .reset = sdhci_reset, 925 .adma_write_desc = dwcmshc_adma_write_desc, 926 .irq = dwcmshc_cqe_irq_handler, 927 .hw_reset = dwcmshc_bf3_hw_reset, 928 }; 929 #endif 930 -- 0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v1 1/1] mmc: sdhci-of-dwcmshc: Add hw_reset() support for BlueField-3 SoC 2024-08-26 21:26 [PATCH v1 1/1] mmc: sdhci-of-dwcmshc: Add hw_reset() support for BlueField-3 SoC Liming Sun 2024-08-27 15:11 ` kernel test robot @ 2024-08-27 15:42 ` kernel test robot 2024-08-27 16:40 ` [PATCH v2] " Liming Sun 2 siblings, 0 replies; 5+ messages in thread From: kernel test robot @ 2024-08-27 15:42 UTC (permalink / raw) To: Liming Sun, Adrian Hunter, Ulf Hansson, David Thompson Cc: llvm, oe-kbuild-all, Liming Sun, linux-mmc, linux-kernel Hi Liming, kernel test robot noticed the following build warnings: [auto build test WARNING on linus/master] [also build test WARNING on v6.11-rc5 next-20240827] [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-hw_reset-support-for-BlueField-3-SoC/20240827-052819 base: linus/master patch link: https://lore.kernel.org/r/73703c853e36f3cd61114e4ac815926d94a1a802.1724695127.git.limings%40nvidia.com patch subject: [PATCH v1 1/1] mmc: sdhci-of-dwcmshc: Add hw_reset() support for BlueField-3 SoC config: riscv-defconfig (https://download.01.org/0day-ci/archive/20240827/202408272323.10IOsTV8-lkp@intel.com/config) compiler: clang version 20.0.0git (https://github.com/llvm/llvm-project 08e5a1de8227512d4774a534b91cb2353cef6284) reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240827/202408272323.10IOsTV8-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/202408272323.10IOsTV8-lkp@intel.com/ All warnings (new ones prefixed by >>): In file included from drivers/mmc/host/sdhci-of-dwcmshc.c:14: In file included from include/linux/dma-mapping.h:11: In file included from include/linux/scatterlist.h:8: In file included from include/linux/mm.h:2228: include/linux/vmstat.h:517:36: warning: arithmetic between different enumeration types ('enum node_stat_item' and 'enum lru_list') [-Wenum-enum-conversion] 517 | return node_stat_name(NR_LRU_BASE + lru) + 3; // skip "nr_" | ~~~~~~~~~~~ ^ ~~~ >> drivers/mmc/host/sdhci-of-dwcmshc.c:919:31: warning: unused variable 'sdhci_dwcmshc_bf3_ops' [-Wunused-const-variable] 919 | static const struct sdhci_ops sdhci_dwcmshc_bf3_ops = { | ^~~~~~~~~~~~~~~~~~~~~ 2 warnings generated. vim +/sdhci_dwcmshc_bf3_ops +919 drivers/mmc/host/sdhci-of-dwcmshc.c 918 > 919 static const struct sdhci_ops sdhci_dwcmshc_bf3_ops = { 920 .set_clock = sdhci_set_clock, 921 .set_bus_width = sdhci_set_bus_width, 922 .set_uhs_signaling = dwcmshc_set_uhs_signaling, 923 .get_max_clock = dwcmshc_get_max_clock, 924 .reset = sdhci_reset, 925 .adma_write_desc = dwcmshc_adma_write_desc, 926 .irq = dwcmshc_cqe_irq_handler, 927 .hw_reset = dwcmshc_bf3_hw_reset, 928 }; 929 #endif 930 -- 0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki ^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH v2] mmc: sdhci-of-dwcmshc: Add hw_reset() support for BlueField-3 SoC 2024-08-26 21:26 [PATCH v1 1/1] mmc: sdhci-of-dwcmshc: Add hw_reset() support for BlueField-3 SoC Liming Sun 2024-08-27 15:11 ` kernel test robot 2024-08-27 15:42 ` kernel test robot @ 2024-08-27 16:40 ` Liming Sun 2024-08-28 15:23 ` Ulf Hansson 2 siblings, 1 reply; 5+ messages in thread From: Liming Sun @ 2024-08-27 16:40 UTC (permalink / raw) To: Adrian Hunter, Ulf Hansson, David Thompson Cc: Liming Sun, linux-mmc, linux-kernel The eMMC RST_N register is implemented as secure register on the BlueField-3 SoC and controlled by TF-A. This commit adds the hw_reset() support which sends an SMC call to TF-A for the eMMC HW reset. Reviewed-by: David Thompson <davthompson@nvidia.com> Signed-off-by: Liming Sun <limings@nvidia.com> --- v1->v2: Fixed a typo reported by test robot. v1: Initial version. --- drivers/mmc/host/sdhci-of-dwcmshc.c | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/drivers/mmc/host/sdhci-of-dwcmshc.c b/drivers/mmc/host/sdhci-of-dwcmshc.c index ba8960d8b2d4..8999b97263af 100644 --- a/drivers/mmc/host/sdhci-of-dwcmshc.c +++ b/drivers/mmc/host/sdhci-of-dwcmshc.c @@ -8,6 +8,7 @@ */ #include <linux/acpi.h> +#include <linux/arm-smccc.h> #include <linux/bitfield.h> #include <linux/clk.h> #include <linux/dma-mapping.h> @@ -201,6 +202,9 @@ SDHCI_TRNS_BLK_CNT_EN | \ SDHCI_TRNS_DMA) +/* SMC call for BlueField-3 eMMC RST_N */ +#define BLUEFIELD_SMC_SET_EMMC_RST_N 0x82000007 + enum dwcmshc_rk_type { DWCMSHC_RK3568, DWCMSHC_RK3588, @@ -1111,6 +1115,29 @@ static const struct sdhci_ops sdhci_dwcmshc_ops = { .irq = dwcmshc_cqe_irq_handler, }; +#ifdef CONFIG_ACPI +static void dwcmshc_bf3_hw_reset(struct sdhci_host *host) +{ + struct arm_smccc_res res = { 0 }; + + arm_smccc_smc(BLUEFIELD_SMC_SET_EMMC_RST_N, 0, 0, 0, 0, 0, 0, 0, &res); + + if (res.a0) + pr_err("%s: RST_N failed.\n", mmc_hostname(host->mmc)); +} + +static const struct sdhci_ops sdhci_dwcmshc_bf3_ops = { + .set_clock = sdhci_set_clock, + .set_bus_width = sdhci_set_bus_width, + .set_uhs_signaling = dwcmshc_set_uhs_signaling, + .get_max_clock = dwcmshc_get_max_clock, + .reset = sdhci_reset, + .adma_write_desc = dwcmshc_adma_write_desc, + .irq = dwcmshc_cqe_irq_handler, + .hw_reset = dwcmshc_bf3_hw_reset, +}; +#endif + static const struct sdhci_ops sdhci_dwcmshc_rk35xx_ops = { .set_clock = dwcmshc_rk3568_set_clock, .set_bus_width = sdhci_set_bus_width, @@ -1163,7 +1190,7 @@ static const struct dwcmshc_pltfm_data sdhci_dwcmshc_pdata = { #ifdef CONFIG_ACPI static const struct dwcmshc_pltfm_data sdhci_dwcmshc_bf3_pdata = { .pdata = { - .ops = &sdhci_dwcmshc_ops, + .ops = &sdhci_dwcmshc_bf3_ops, .quirks = SDHCI_QUIRK_CAP_CLOCK_BASE_BROKEN, .quirks2 = SDHCI_QUIRK2_PRESET_VALUE_BROKEN | SDHCI_QUIRK2_ACMD23_BROKEN, -- 2.30.1 ^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH v2] mmc: sdhci-of-dwcmshc: Add hw_reset() support for BlueField-3 SoC 2024-08-27 16:40 ` [PATCH v2] " Liming Sun @ 2024-08-28 15:23 ` Ulf Hansson 0 siblings, 0 replies; 5+ messages in thread From: Ulf Hansson @ 2024-08-28 15:23 UTC (permalink / raw) To: Liming Sun; +Cc: Adrian Hunter, David Thompson, linux-mmc, linux-kernel On Tue, 27 Aug 2024 at 18:40, Liming Sun <limings@nvidia.com> wrote: > > The eMMC RST_N register is implemented as secure register on > the BlueField-3 SoC and controlled by TF-A. This commit adds the > hw_reset() support which sends an SMC call to TF-A for the eMMC > HW reset. > > Reviewed-by: David Thompson <davthompson@nvidia.com> > Signed-off-by: Liming Sun <limings@nvidia.com> Applied for next, thanks! Kind regards Uffe > --- > v1->v2: > Fixed a typo reported by test robot. > v1: Initial version. > --- > drivers/mmc/host/sdhci-of-dwcmshc.c | 29 ++++++++++++++++++++++++++++- > 1 file changed, 28 insertions(+), 1 deletion(-) > > diff --git a/drivers/mmc/host/sdhci-of-dwcmshc.c b/drivers/mmc/host/sdhci-of-dwcmshc.c > index ba8960d8b2d4..8999b97263af 100644 > --- a/drivers/mmc/host/sdhci-of-dwcmshc.c > +++ b/drivers/mmc/host/sdhci-of-dwcmshc.c > @@ -8,6 +8,7 @@ > */ > > #include <linux/acpi.h> > +#include <linux/arm-smccc.h> > #include <linux/bitfield.h> > #include <linux/clk.h> > #include <linux/dma-mapping.h> > @@ -201,6 +202,9 @@ > SDHCI_TRNS_BLK_CNT_EN | \ > SDHCI_TRNS_DMA) > > +/* SMC call for BlueField-3 eMMC RST_N */ > +#define BLUEFIELD_SMC_SET_EMMC_RST_N 0x82000007 > + > enum dwcmshc_rk_type { > DWCMSHC_RK3568, > DWCMSHC_RK3588, > @@ -1111,6 +1115,29 @@ static const struct sdhci_ops sdhci_dwcmshc_ops = { > .irq = dwcmshc_cqe_irq_handler, > }; > > +#ifdef CONFIG_ACPI > +static void dwcmshc_bf3_hw_reset(struct sdhci_host *host) > +{ > + struct arm_smccc_res res = { 0 }; > + > + arm_smccc_smc(BLUEFIELD_SMC_SET_EMMC_RST_N, 0, 0, 0, 0, 0, 0, 0, &res); > + > + if (res.a0) > + pr_err("%s: RST_N failed.\n", mmc_hostname(host->mmc)); > +} > + > +static const struct sdhci_ops sdhci_dwcmshc_bf3_ops = { > + .set_clock = sdhci_set_clock, > + .set_bus_width = sdhci_set_bus_width, > + .set_uhs_signaling = dwcmshc_set_uhs_signaling, > + .get_max_clock = dwcmshc_get_max_clock, > + .reset = sdhci_reset, > + .adma_write_desc = dwcmshc_adma_write_desc, > + .irq = dwcmshc_cqe_irq_handler, > + .hw_reset = dwcmshc_bf3_hw_reset, > +}; > +#endif > + > static const struct sdhci_ops sdhci_dwcmshc_rk35xx_ops = { > .set_clock = dwcmshc_rk3568_set_clock, > .set_bus_width = sdhci_set_bus_width, > @@ -1163,7 +1190,7 @@ static const struct dwcmshc_pltfm_data sdhci_dwcmshc_pdata = { > #ifdef CONFIG_ACPI > static const struct dwcmshc_pltfm_data sdhci_dwcmshc_bf3_pdata = { > .pdata = { > - .ops = &sdhci_dwcmshc_ops, > + .ops = &sdhci_dwcmshc_bf3_ops, > .quirks = SDHCI_QUIRK_CAP_CLOCK_BASE_BROKEN, > .quirks2 = SDHCI_QUIRK2_PRESET_VALUE_BROKEN | > SDHCI_QUIRK2_ACMD23_BROKEN, > -- > 2.30.1 > ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2024-08-28 15:24 UTC | newest] Thread overview: 5+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2024-08-26 21:26 [PATCH v1 1/1] mmc: sdhci-of-dwcmshc: Add hw_reset() support for BlueField-3 SoC Liming Sun 2024-08-27 15:11 ` kernel test robot 2024-08-27 15:42 ` kernel test robot 2024-08-27 16:40 ` [PATCH v2] " Liming Sun 2024-08-28 15:23 ` Ulf Hansson
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox