From a4b36d773babd517b8208d487ea6beb060aab610 Mon Sep 17 00:00:00 2001 From: Subhash Jadavani Date: Fri, 31 Mar 2017 16:50:59 -0700 Subject: mmc: sdhci-msm: add SDR104 CRC workaround enablement control On Certain chipsets, SDR104 mode might be unstable causing CRC error on the interface. So we need a workaround which would skip printing register dumps on CRC errors and also downgrade bus speed mode to SDR50/DDR50 in case of continuous CRC errors. This patch adds "qcom,sdr104-wa" property to enable this workaround if required. Change-Id: I626d8ef45a97e8e6558e7f20be496de1f5a2a438 Signed-off-by: Subhash Jadavani --- include/linux/mmc/host.h | 1 + 1 file changed, 1 insertion(+) (limited to 'include') diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h index 055b879dfa6b..37069eb12861 100644 --- a/include/linux/mmc/host.h +++ b/include/linux/mmc/host.h @@ -595,6 +595,7 @@ struct mmc_host { struct io_latency_state io_lat_s; #endif + bool sdr104_wa; unsigned long private[0] ____cacheline_aligned; }; -- cgit v1.2.3 From 0cbf1d2db710f0b9fb0b63934d214b2ef19cd650 Mon Sep 17 00:00:00 2001 From: Asutosh Das Date: Thu, 30 Mar 2017 14:41:16 -0700 Subject: mmc: sd: reduce the bus speed in case of multiple CRC errors in SDR104 UHS-I SD cards support SDR104 mode which runs the SD card interface clock upto 208 MHz. But we may see repeated CRC errors in SDR104 with some SDCC controllers. If this happens, this change would reinit the card to lower speed (SDR50) hoping that CRC error rate would reduce at lower clock speed (100MHz for SDR50). Change-Id: I140d29fdf500bb89881a0f2c1f768fe0c5afa9d5 Signed-off-by: Asutosh Das Signed-off-by: Subhash Jadavani --- include/linux/mmc/card.h | 2 ++ include/linux/mmc/core.h | 1 + include/linux/mmc/host.h | 10 ++++++++++ 3 files changed, 13 insertions(+) (limited to 'include') diff --git a/include/linux/mmc/card.h b/include/linux/mmc/card.h index 1c87478b5fc0..e7e172a23a16 100644 --- a/include/linux/mmc/card.h +++ b/include/linux/mmc/card.h @@ -435,6 +435,8 @@ struct mmc_card { u8 *cached_ext_csd; bool cmdq_init; struct mmc_bkops_info bkops; + bool err_in_sdr104; + bool sdr104_blocked; }; /* diff --git a/include/linux/mmc/core.h b/include/linux/mmc/core.h index 1068953943d8..2a1a6fec179f 100644 --- a/include/linux/mmc/core.h +++ b/include/linux/mmc/core.h @@ -169,6 +169,7 @@ extern int __mmc_switch_cmdq_mode(struct mmc_command *cmd, u8 set, u8 index, extern int mmc_send_tuning(struct mmc_host *host, u32 opcode, int *cmd_error); extern int mmc_get_ext_csd(struct mmc_card *card, u8 **new_ext_csd); extern int mmc_set_auto_bkops(struct mmc_card *card, bool enable); +extern int mmc_suspend_clk_scaling(struct mmc_host *host); #define MMC_ERASE_ARG 0x00000000 #define MMC_SECURE_ERASE_ARG 0x80000000 diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h index 37069eb12861..d9e12c1b1748 100644 --- a/include/linux/mmc/host.h +++ b/include/linux/mmc/host.h @@ -729,6 +729,16 @@ static inline int mmc_host_uhs(struct mmc_host *host) MMC_CAP_UHS_DDR50); } +static inline void mmc_host_clear_sdr104(struct mmc_host *host) +{ + host->caps &= ~MMC_CAP_UHS_SDR104; +} + +static inline void mmc_host_set_sdr104(struct mmc_host *host) +{ + host->caps |= MMC_CAP_UHS_SDR104; +} + static inline int mmc_host_packed_wr(struct mmc_host *host) { return host->caps2 & MMC_CAP2_PACKED_WR; -- cgit v1.2.3