Skip to content

Commit 7eb42da

Browse files
lsun100storulf
authored andcommitted
mmc: sdhci-of-dwcmshc: Add hw_reset() support for BlueField-3 SoC
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 <[email protected]> Signed-off-by: Liming Sun <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Ulf Hansson <[email protected]>
1 parent f5e1638 commit 7eb42da

File tree

1 file changed

+28
-1
lines changed

1 file changed

+28
-1
lines changed

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

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
*/
99

1010
#include <linux/acpi.h>
11+
#include <linux/arm-smccc.h>
1112
#include <linux/bitfield.h>
1213
#include <linux/clk.h>
1314
#include <linux/dma-mapping.h>
@@ -201,6 +202,9 @@
201202
SDHCI_TRNS_BLK_CNT_EN | \
202203
SDHCI_TRNS_DMA)
203204

205+
/* SMC call for BlueField-3 eMMC RST_N */
206+
#define BLUEFIELD_SMC_SET_EMMC_RST_N 0x82000007
207+
204208
enum dwcmshc_rk_type {
205209
DWCMSHC_RK3568,
206210
DWCMSHC_RK3588,
@@ -1111,6 +1115,29 @@ static const struct sdhci_ops sdhci_dwcmshc_ops = {
11111115
.irq = dwcmshc_cqe_irq_handler,
11121116
};
11131117

1118+
#ifdef CONFIG_ACPI
1119+
static void dwcmshc_bf3_hw_reset(struct sdhci_host *host)
1120+
{
1121+
struct arm_smccc_res res = { 0 };
1122+
1123+
arm_smccc_smc(BLUEFIELD_SMC_SET_EMMC_RST_N, 0, 0, 0, 0, 0, 0, 0, &res);
1124+
1125+
if (res.a0)
1126+
pr_err("%s: RST_N failed.\n", mmc_hostname(host->mmc));
1127+
}
1128+
1129+
static const struct sdhci_ops sdhci_dwcmshc_bf3_ops = {
1130+
.set_clock = sdhci_set_clock,
1131+
.set_bus_width = sdhci_set_bus_width,
1132+
.set_uhs_signaling = dwcmshc_set_uhs_signaling,
1133+
.get_max_clock = dwcmshc_get_max_clock,
1134+
.reset = sdhci_reset,
1135+
.adma_write_desc = dwcmshc_adma_write_desc,
1136+
.irq = dwcmshc_cqe_irq_handler,
1137+
.hw_reset = dwcmshc_bf3_hw_reset,
1138+
};
1139+
#endif
1140+
11141141
static const struct sdhci_ops sdhci_dwcmshc_rk35xx_ops = {
11151142
.set_clock = dwcmshc_rk3568_set_clock,
11161143
.set_bus_width = sdhci_set_bus_width,
@@ -1163,7 +1190,7 @@ static const struct dwcmshc_pltfm_data sdhci_dwcmshc_pdata = {
11631190
#ifdef CONFIG_ACPI
11641191
static const struct dwcmshc_pltfm_data sdhci_dwcmshc_bf3_pdata = {
11651192
.pdata = {
1166-
.ops = &sdhci_dwcmshc_ops,
1193+
.ops = &sdhci_dwcmshc_bf3_ops,
11671194
.quirks = SDHCI_QUIRK_CAP_CLOCK_BASE_BROKEN,
11681195
.quirks2 = SDHCI_QUIRK2_PRESET_VALUE_BROKEN |
11691196
SDHCI_QUIRK2_ACMD23_BROKEN,

0 commit comments

Comments
 (0)