lkml.org 
[lkml]   [2023]   [Aug]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH V2 1/2] mmc: core: Add host specific tuning support for SD HS mode
Date
Added .prepare_hs_tuning and .execute_hs_tuning host callbacks to
support host-specific tuning for SD high speed mode.

Signed-off-by: Wenchao Chen <wenchao.chen@unisoc.com>
---
drivers/mmc/core/sd.c | 12 ++++++++++++
include/linux/mmc/host.h | 6 ++++++
2 files changed, 18 insertions(+)

diff --git a/drivers/mmc/core/sd.c b/drivers/mmc/core/sd.c
index 246ce027ae0a..ac2da8f2fbce 100644
--- a/drivers/mmc/core/sd.c
+++ b/drivers/mmc/core/sd.c
@@ -1518,6 +1518,12 @@ static int mmc_sd_init_card(struct mmc_host *host, u32 ocr,
*/
mmc_set_clock(host, mmc_sd_get_max_clock(card));

+ if (host->ops->prepare_hs_tuning) {
+ err = host->ops->prepare_hs_tuning(host, card);
+ if (err)
+ goto free_card;
+ }
+
/*
* Switch to wider bus (if supported).
*/
@@ -1529,6 +1535,12 @@ static int mmc_sd_init_card(struct mmc_host *host, u32 ocr,

mmc_set_bus_width(host, MMC_BUS_WIDTH_4);
}
+
+ if (host->ops->execute_hs_tuning) {
+ err = host->ops->execute_hs_tuning(host, card);
+ if (err)
+ goto free_card;
+ }
}
cont:
if (!oldcard) {
diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h
index 461d1543893b..13cf894b9e3c 100644
--- a/include/linux/mmc/host.h
+++ b/include/linux/mmc/host.h
@@ -184,6 +184,12 @@ struct mmc_host_ops {
/* Execute HS400 tuning depending host driver */
int (*execute_hs400_tuning)(struct mmc_host *host, struct mmc_card *card);

+ /* Prepare HS tuning depending host driver */
+ int (*prepare_hs_tuning)(struct mmc_host *host, struct mmc_card *card);
+
+ /* Execute HS tuning depending host driver */
+ int (*execute_hs_tuning)(struct mmc_host *host, struct mmc_card *card);
+
/* Prepare switch to DDR during the HS400 init sequence */
int (*hs400_prepare_ddr)(struct mmc_host *host);

--
2.17.1
\
 
 \ /
  Last update: 2023-08-15 03:43    [W:0.145 / U:0.096 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site