mmc: core: Support UHS-II card access
PATCH 7/7 mmc: core: Support UHS-II card access
From: Jason Lai <[email protected]>
From: Jason Lai <[email protected]>
Provide a function to transform legacy SD command packet into UHS-II SD-TRAN DCMD packet. Each host controller can assign their own request function in struct mmc_host_ops to process UHS-II command packet.
Signed-off-by Jason Lai <[email protected]>
--- drivers/mmc/core/core.c | 26 ++++++++++++- drivers/mmc/core/sd_uhs2.c | 78 +++++++++++++++++++++++++++++++++++++- drivers/mmc/core/sd_uhs2.h | 3 +- 3 files changed, 102 insertions(+), 5 deletions(-)
drivers/mmc/core/core.c +24 -2
@@ -31,6 +31,7 @@#include <linux/mmc/mmc.h> #include <linux/mmc/sd.h> #include <linux/mmc/slot-gpio.h> +#include <linux/mmc/sd_uhs2.h> #define CREATE_TRACE_POINTS #include <trace/events/mmc.h>
@@ -42,6 +43,7 @@#include "host.h" #include "sdio_bus.h" #include "pwrseq.h" +#include "sd_uhs2.h" #include "mmc_ops.h" #include "sd_ops.h"
@@ -335,6 +337,8 @@ static int mmc_mrq_prep(struct mmc_host *host, struct mmc_request *mrq)int mmc_start_request (struct mmc_host *host,struct mmc_request *mrq) { +struct uhs2_command uhs2_cmd; +u32 payload[4 ];/* for maximum size */ int err;init_completion (&mrq->cmd_completion);
@@ -352,6 +356,13 @@ int mmc_start_request(struct mmc_host *host, struct mmc_request *mrq)if (err)return err; +if (host->flags &MMC_UHS2_SUPPORT && + host->flags &MMC_UHS2_INITIALIZED ) { + uhs2_cmd.payload = payload; + mrq->cmd->uhs2_cmd = &uhs2_cmd; +uhs2_prepare_sd_cmd (host, mrq); + } +led_trigger_event (host->led,LED_FULL );__mmc_start_request (host, mrq);
@@ -431,6 +442,8 @@ EXPORT_SYMBOL(mmc_wait_for_req_done);*/ int mmc_cqe_start_req (struct mmc_host *host,struct mmc_request *mrq) { +struct uhs2_command uhs2_cmd; +u32 payload[4 ];/* for maximum size */ int err;/*
@@ -451,6 +464,13 @@ int mmc_cqe_start_req(struct mmc_host *host, struct mmc_request *mrq)if (err) goto out_err; +if (host->flags &MMC_UHS2_SUPPORT && + host->flags &MMC_UHS2_INITIALIZED ) { + uhs2_cmd.payload = payload; + mrq->cmd->uhs2_cmd = &uhs2_cmd; +uhs2_prepare_sd_cmd (host, mrq); + } + err = host->cqe_ops->cqe_request (host, mrq);if (err) goto out_err;
@@ -899,8 +919,10 @@ static inline void mmc_set_ios(struct mmc_host *host)*/ void mmc_set_chip_select (struct mmc_host *host,int mode) { - host->ios.chip_select = mode; -mmc_set_ios (host); +if (!(host->flags &MMC_UHS2_INITIALIZED )) { + host->ios.chip_select = mode; +mmc_set_ios (host); + } }/*
drivers/mmc/core/sd_uhs2.c +76 -2
90 lines not on this page · raw message
drivers/mmc/core/sd_uhs2.h +2 -1
@@ -15,6 +15,7 @@#define UHS2_PHY_INIT_ERR 1 -int mmc_attach_sd_uhs2(struct mmc_host *host) +int mmc_attach_sd_uhs2 (struct mmc_host *host); +int uhs2_prepare_sd_cmd (struct mmc_host *host,struct mmc_request *mrq);#endif /* MMC_UHS2_H */
Signature · 1 line
2.32.0