Skip to content

Commit 5de1867

Browse files
committed
Merge tag 'mmc-v5.10-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/ulfh/mmc
Pull MMC fixes from Ulf Hansson: "A couple of MMC fixes: - sdhci-of-arasan: Stabilize communication by fixing tap value configs - sdhci-pci: Use SDR25 timing for HS mode for BYT-based Intel HWs" * tag 'mmc-v5.10-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/ulfh/mmc: mmc: sdhci-of-arasan: Issue DLL reset explicitly mmc: sdhci-of-arasan: Use Mask writes for Tap delays mmc: sdhci-of-arasan: Allow configuring zero tap values mmc: sdhci-pci: Prefer SDR25 timing for High Speed mode for BYT-based Intel controllers
2 parents e65b309 + d06d60d commit 5de1867

2 files changed

Lines changed: 30 additions & 34 deletions

File tree

drivers/mmc/host/sdhci-of-arasan.c

Lines changed: 19 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,10 @@
3030
#define SDHCI_ARASAN_VENDOR_REGISTER 0x78
3131

3232
#define SDHCI_ARASAN_ITAPDLY_REGISTER 0xF0F8
33+
#define SDHCI_ARASAN_ITAPDLY_SEL_MASK 0xFF
34+
3335
#define SDHCI_ARASAN_OTAPDLY_REGISTER 0xF0FC
36+
#define SDHCI_ARASAN_OTAPDLY_SEL_MASK 0x3F
3437

3538
#define SDHCI_ARASAN_CQE_BASE_ADDR 0x200
3639
#define VENDOR_ENHANCED_STROBE BIT(0)
@@ -600,14 +603,8 @@ static int sdhci_zynqmp_sdcardclk_set_phase(struct clk_hw *hw, int degrees)
600603
u8 tap_delay, tap_max = 0;
601604
int ret;
602605

603-
/*
604-
* This is applicable for SDHCI_SPEC_300 and above
605-
* ZynqMP does not set phase for <=25MHz clock.
606-
* If degrees is zero, no need to do anything.
607-
*/
608-
if (host->version < SDHCI_SPEC_300 ||
609-
host->timing == MMC_TIMING_LEGACY ||
610-
host->timing == MMC_TIMING_UHS_SDR12 || !degrees)
606+
/* This is applicable for SDHCI_SPEC_300 and above */
607+
if (host->version < SDHCI_SPEC_300)
611608
return 0;
612609

613610
switch (host->timing) {
@@ -638,6 +635,9 @@ static int sdhci_zynqmp_sdcardclk_set_phase(struct clk_hw *hw, int degrees)
638635
if (ret)
639636
pr_err("Error setting Output Tap Delay\n");
640637

638+
/* Release DLL Reset */
639+
zynqmp_pm_sd_dll_reset(node_id, PM_DLL_RESET_RELEASE);
640+
641641
return ret;
642642
}
643643

@@ -668,16 +668,13 @@ static int sdhci_zynqmp_sampleclk_set_phase(struct clk_hw *hw, int degrees)
668668
u8 tap_delay, tap_max = 0;
669669
int ret;
670670

671-
/*
672-
* This is applicable for SDHCI_SPEC_300 and above
673-
* ZynqMP does not set phase for <=25MHz clock.
674-
* If degrees is zero, no need to do anything.
675-
*/
676-
if (host->version < SDHCI_SPEC_300 ||
677-
host->timing == MMC_TIMING_LEGACY ||
678-
host->timing == MMC_TIMING_UHS_SDR12 || !degrees)
671+
/* This is applicable for SDHCI_SPEC_300 and above */
672+
if (host->version < SDHCI_SPEC_300)
679673
return 0;
680674

675+
/* Assert DLL Reset */
676+
zynqmp_pm_sd_dll_reset(node_id, PM_DLL_RESET_ASSERT);
677+
681678
switch (host->timing) {
682679
case MMC_TIMING_MMC_HS:
683680
case MMC_TIMING_SD_HS:
@@ -733,14 +730,8 @@ static int sdhci_versal_sdcardclk_set_phase(struct clk_hw *hw, int degrees)
733730
struct sdhci_host *host = sdhci_arasan->host;
734731
u8 tap_delay, tap_max = 0;
735732

736-
/*
737-
* This is applicable for SDHCI_SPEC_300 and above
738-
* Versal does not set phase for <=25MHz clock.
739-
* If degrees is zero, no need to do anything.
740-
*/
741-
if (host->version < SDHCI_SPEC_300 ||
742-
host->timing == MMC_TIMING_LEGACY ||
743-
host->timing == MMC_TIMING_UHS_SDR12 || !degrees)
733+
/* This is applicable for SDHCI_SPEC_300 and above */
734+
if (host->version < SDHCI_SPEC_300)
744735
return 0;
745736

746737
switch (host->timing) {
@@ -773,6 +764,7 @@ static int sdhci_versal_sdcardclk_set_phase(struct clk_hw *hw, int degrees)
773764
regval = sdhci_readl(host, SDHCI_ARASAN_OTAPDLY_REGISTER);
774765
regval |= SDHCI_OTAPDLY_ENABLE;
775766
sdhci_writel(host, regval, SDHCI_ARASAN_OTAPDLY_REGISTER);
767+
regval &= ~SDHCI_ARASAN_OTAPDLY_SEL_MASK;
776768
regval |= tap_delay;
777769
sdhci_writel(host, regval, SDHCI_ARASAN_OTAPDLY_REGISTER);
778770
}
@@ -804,14 +796,8 @@ static int sdhci_versal_sampleclk_set_phase(struct clk_hw *hw, int degrees)
804796
struct sdhci_host *host = sdhci_arasan->host;
805797
u8 tap_delay, tap_max = 0;
806798

807-
/*
808-
* This is applicable for SDHCI_SPEC_300 and above
809-
* Versal does not set phase for <=25MHz clock.
810-
* If degrees is zero, no need to do anything.
811-
*/
812-
if (host->version < SDHCI_SPEC_300 ||
813-
host->timing == MMC_TIMING_LEGACY ||
814-
host->timing == MMC_TIMING_UHS_SDR12 || !degrees)
799+
/* This is applicable for SDHCI_SPEC_300 and above */
800+
if (host->version < SDHCI_SPEC_300)
815801
return 0;
816802

817803
switch (host->timing) {
@@ -846,6 +832,7 @@ static int sdhci_versal_sampleclk_set_phase(struct clk_hw *hw, int degrees)
846832
sdhci_writel(host, regval, SDHCI_ARASAN_ITAPDLY_REGISTER);
847833
regval |= SDHCI_ITAPDLY_ENABLE;
848834
sdhci_writel(host, regval, SDHCI_ARASAN_ITAPDLY_REGISTER);
835+
regval &= ~SDHCI_ARASAN_ITAPDLY_SEL_MASK;
849836
regval |= tap_delay;
850837
sdhci_writel(host, regval, SDHCI_ARASAN_ITAPDLY_REGISTER);
851838
regval &= ~SDHCI_ITAPDLY_CHGWIN;

drivers/mmc/host/sdhci-pci-core.c

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -665,6 +665,15 @@ static void sdhci_intel_set_power(struct sdhci_host *host, unsigned char mode,
665665
}
666666
}
667667

668+
static void sdhci_intel_set_uhs_signaling(struct sdhci_host *host,
669+
unsigned int timing)
670+
{
671+
/* Set UHS timing to SDR25 for High Speed mode */
672+
if (timing == MMC_TIMING_MMC_HS || timing == MMC_TIMING_SD_HS)
673+
timing = MMC_TIMING_UHS_SDR25;
674+
sdhci_set_uhs_signaling(host, timing);
675+
}
676+
668677
#define INTEL_HS400_ES_REG 0x78
669678
#define INTEL_HS400_ES_BIT BIT(0)
670679

@@ -721,7 +730,7 @@ static const struct sdhci_ops sdhci_intel_byt_ops = {
721730
.enable_dma = sdhci_pci_enable_dma,
722731
.set_bus_width = sdhci_set_bus_width,
723732
.reset = sdhci_reset,
724-
.set_uhs_signaling = sdhci_set_uhs_signaling,
733+
.set_uhs_signaling = sdhci_intel_set_uhs_signaling,
725734
.hw_reset = sdhci_pci_hw_reset,
726735
};
727736

@@ -731,7 +740,7 @@ static const struct sdhci_ops sdhci_intel_glk_ops = {
731740
.enable_dma = sdhci_pci_enable_dma,
732741
.set_bus_width = sdhci_set_bus_width,
733742
.reset = sdhci_cqhci_reset,
734-
.set_uhs_signaling = sdhci_set_uhs_signaling,
743+
.set_uhs_signaling = sdhci_intel_set_uhs_signaling,
735744
.hw_reset = sdhci_pci_hw_reset,
736745
.irq = sdhci_cqhci_irq,
737746
};

0 commit comments

Comments
 (0)