Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

mmc: sdhci-of-dwcmshc: implement specific set_uhs_signaling

We need a different set_uhs_signaling implementation for
MMC_TIMING_MMC_HS and MMC_TIMING_MMC_HS400.

Signed-off-by: Jisheng Zhang <Jisheng.Zhang@synaptics.com>
Link: https://lore.kernel.org/r/20200513182602.3636a551@xhacker.debian
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>

authored by

Jisheng Zhang and committed by
Ulf Hansson
554232e8 e4bf1b09

+30 -1
+30 -1
drivers/mmc/host/sdhci-of-dwcmshc.c
··· 16 16 17 17 #include "sdhci-pltfm.h" 18 18 19 + /* DWCMSHC specific Mode Select value */ 20 + #define DWCMSHC_CTRL_HS400 0x7 21 + 19 22 #define BOUNDARY_OK(addr, len) \ 20 23 ((addr | (SZ_128M - 1)) == ((addr + len - 1) | (SZ_128M - 1))) 21 24 ··· 49 46 sdhci_adma_write_desc(host, desc, addr, len, cmd); 50 47 } 51 48 49 + static void dwcmshc_set_uhs_signaling(struct sdhci_host *host, 50 + unsigned int timing) 51 + { 52 + u16 ctrl_2; 53 + 54 + ctrl_2 = sdhci_readw(host, SDHCI_HOST_CONTROL2); 55 + /* Select Bus Speed Mode for host */ 56 + ctrl_2 &= ~SDHCI_CTRL_UHS_MASK; 57 + if ((timing == MMC_TIMING_MMC_HS200) || 58 + (timing == MMC_TIMING_UHS_SDR104)) 59 + ctrl_2 |= SDHCI_CTRL_UHS_SDR104; 60 + else if (timing == MMC_TIMING_UHS_SDR12) 61 + ctrl_2 |= SDHCI_CTRL_UHS_SDR12; 62 + else if ((timing == MMC_TIMING_UHS_SDR25) || 63 + (timing == MMC_TIMING_MMC_HS)) 64 + ctrl_2 |= SDHCI_CTRL_UHS_SDR25; 65 + else if (timing == MMC_TIMING_UHS_SDR50) 66 + ctrl_2 |= SDHCI_CTRL_UHS_SDR50; 67 + else if ((timing == MMC_TIMING_UHS_DDR50) || 68 + (timing == MMC_TIMING_MMC_DDR52)) 69 + ctrl_2 |= SDHCI_CTRL_UHS_DDR50; 70 + else if (timing == MMC_TIMING_MMC_HS400) 71 + ctrl_2 |= DWCMSHC_CTRL_HS400; 72 + sdhci_writew(host, ctrl_2, SDHCI_HOST_CONTROL2); 73 + } 74 + 52 75 static const struct sdhci_ops sdhci_dwcmshc_ops = { 53 76 .set_clock = sdhci_set_clock, 54 77 .set_bus_width = sdhci_set_bus_width, 55 - .set_uhs_signaling = sdhci_set_uhs_signaling, 78 + .set_uhs_signaling = dwcmshc_set_uhs_signaling, 56 79 .get_max_clock = sdhci_pltfm_clk_get_max_clock, 57 80 .reset = sdhci_reset, 58 81 .adma_write_desc = dwcmshc_adma_write_desc,