Skip to content

Commit f614fb6

Browse files
wenbinmei1storulf
authored andcommitted
mmc: core: Add host specific tuning support for eMMC HS400 mode
This adds a ->execute_hs400_tuning() host callback to enable optional support for host specific tuning for eMMC HS400 mode. Additionally, share mmc_get_ext_csd() through the public host headerfile, to allow it to be used by the host drivers, which is needed to support the HS400 tuning. Signed-off-by: Wenbin Mei <wenbin.mei@mediatek.com> Link: https://lore.kernel.org/r/20210917124803.22871-3-wenbin.mei@mediatek.com Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
1 parent fb4708e commit f614fb6

File tree

3 files changed

+12
-1
lines changed

3 files changed

+12
-1
lines changed

drivers/mmc/core/mmc.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1224,6 +1224,14 @@ static int mmc_select_hs400(struct mmc_card *card)
12241224
mmc_set_timing(host, MMC_TIMING_MMC_HS400);
12251225
mmc_set_bus_speed(card);
12261226

1227+
if (host->ops->execute_hs400_tuning) {
1228+
mmc_retune_disable(host);
1229+
err = host->ops->execute_hs400_tuning(host, card);
1230+
mmc_retune_enable(host);
1231+
if (err)
1232+
goto out_err;
1233+
}
1234+
12271235
if (host->ops->hs400_complete)
12281236
host->ops->hs400_complete(host);
12291237

drivers/mmc/core/mmc_ops.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ int mmc_spi_read_ocr(struct mmc_host *host, int highcap, u32 *ocrp);
3838
int mmc_spi_set_crc(struct mmc_host *host, int use_crc);
3939
int mmc_bus_test(struct mmc_card *card, u8 bus_width);
4040
int mmc_can_ext_csd(struct mmc_card *card);
41-
int mmc_get_ext_csd(struct mmc_card *card, u8 **new_ext_csd);
4241
int mmc_switch_status(struct mmc_card *card, bool crc_err_fatal);
4342
bool mmc_prepare_busy_cmd(struct mmc_host *host, struct mmc_command *cmd,
4443
unsigned int timeout_ms);

include/linux/mmc/host.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,9 @@ struct mmc_host_ops {
162162
/* Prepare HS400 target operating frequency depending host driver */
163163
int (*prepare_hs400_tuning)(struct mmc_host *host, struct mmc_ios *ios);
164164

165+
/* Execute HS400 tuning depending host driver */
166+
int (*execute_hs400_tuning)(struct mmc_host *host, struct mmc_card *card);
167+
165168
/* Prepare switch to DDR during the HS400 init sequence */
166169
int (*hs400_prepare_ddr)(struct mmc_host *host);
167170

@@ -634,5 +637,6 @@ static inline enum dma_data_direction mmc_get_dma_dir(struct mmc_data *data)
634637

635638
int mmc_send_tuning(struct mmc_host *host, u32 opcode, int *cmd_error);
636639
int mmc_send_abort_tuning(struct mmc_host *host, u32 opcode);
640+
int mmc_get_ext_csd(struct mmc_card *card, u8 **new_ext_csd);
637641

638642
#endif /* LINUX_MMC_HOST_H */

0 commit comments

Comments
 (0)