Skip to content

Commit c17aecf

Browse files
lsun100storulf
authored andcommitted
mmc: dw_mmc-bluefield: Add support for eMMC HW reset
The eMMC RST_N register is implemented as secure register on the BlueField SoC and controlled by TF-A. This commit 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/2c459196c6867e325f9386ec0559efea464cfdd6.1718213918.git.limings@nvidia.com Signed-off-by: Ulf Hansson <[email protected]>
1 parent f21adcb commit c17aecf

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

drivers/mmc/host/dw_mmc-bluefield.c

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
* Copyright (C) 2018 Mellanox Technologies.
44
*/
55

6+
#include <linux/arm-smccc.h>
67
#include <linux/bitfield.h>
78
#include <linux/bitops.h>
89
#include <linux/mmc/host.h>
@@ -20,6 +21,9 @@
2021
#define BLUEFIELD_UHS_REG_EXT_SAMPLE 2
2122
#define BLUEFIELD_UHS_REG_EXT_DRIVE 4
2223

24+
/* SMC call for RST_N */
25+
#define BLUEFIELD_SMC_SET_EMMC_RST_N 0x82000007
26+
2327
static void dw_mci_bluefield_set_ios(struct dw_mci *host, struct mmc_ios *ios)
2428
{
2529
u32 reg;
@@ -34,8 +38,20 @@ static void dw_mci_bluefield_set_ios(struct dw_mci *host, struct mmc_ios *ios)
3438
mci_writel(host, UHS_REG_EXT, reg);
3539
}
3640

41+
static void dw_mci_bluefield_hw_reset(struct dw_mci *host)
42+
{
43+
struct arm_smccc_res res = { 0 };
44+
45+
arm_smccc_smc(BLUEFIELD_SMC_SET_EMMC_RST_N, 0, 0, 0, 0, 0, 0, 0,
46+
&res);
47+
48+
if (res.a0)
49+
pr_err("RST_N failed.\n");
50+
}
51+
3752
static const struct dw_mci_drv_data bluefield_drv_data = {
38-
.set_ios = dw_mci_bluefield_set_ios
53+
.set_ios = dw_mci_bluefield_set_ios,
54+
.hw_reset = dw_mci_bluefield_hw_reset
3955
};
4056

4157
static const struct of_device_id dw_mci_bluefield_match[] = {

0 commit comments

Comments
 (0)