|
8 | 8 | */
|
9 | 9 |
|
10 | 10 | #include <linux/acpi.h>
|
| 11 | +#include <linux/arm-smccc.h> |
11 | 12 | #include <linux/bitfield.h>
|
12 | 13 | #include <linux/clk.h>
|
13 | 14 | #include <linux/dma-mapping.h>
|
|
201 | 202 | SDHCI_TRNS_BLK_CNT_EN | \
|
202 | 203 | SDHCI_TRNS_DMA)
|
203 | 204 |
|
| 205 | +/* SMC call for BlueField-3 eMMC RST_N */ |
| 206 | +#define BLUEFIELD_SMC_SET_EMMC_RST_N 0x82000007 |
| 207 | + |
204 | 208 | enum dwcmshc_rk_type {
|
205 | 209 | DWCMSHC_RK3568,
|
206 | 210 | DWCMSHC_RK3588,
|
@@ -1111,6 +1115,29 @@ static const struct sdhci_ops sdhci_dwcmshc_ops = {
|
1111 | 1115 | .irq = dwcmshc_cqe_irq_handler,
|
1112 | 1116 | };
|
1113 | 1117 |
|
| 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 | + |
1114 | 1141 | static const struct sdhci_ops sdhci_dwcmshc_rk35xx_ops = {
|
1115 | 1142 | .set_clock = dwcmshc_rk3568_set_clock,
|
1116 | 1143 | .set_bus_width = sdhci_set_bus_width,
|
@@ -1163,7 +1190,7 @@ static const struct dwcmshc_pltfm_data sdhci_dwcmshc_pdata = {
|
1163 | 1190 | #ifdef CONFIG_ACPI
|
1164 | 1191 | static const struct dwcmshc_pltfm_data sdhci_dwcmshc_bf3_pdata = {
|
1165 | 1192 | .pdata = {
|
1166 |
| - .ops = &sdhci_dwcmshc_ops, |
| 1193 | + .ops = &sdhci_dwcmshc_bf3_ops, |
1167 | 1194 | .quirks = SDHCI_QUIRK_CAP_CLOCK_BASE_BROKEN,
|
1168 | 1195 | .quirks2 = SDHCI_QUIRK2_PRESET_VALUE_BROKEN |
|
1169 | 1196 | SDHCI_QUIRK2_ACMD23_BROKEN,
|
|
0 commit comments