Skip to content

Commit b75a52b

Browse files
shawn1221storulf
authored andcommitted
mmc: sdhci-of-dwcmshc: Update DLL and pre-change delay for rockchip platform
For Rockchip platform, DLL bypass bit and start bit need to be set if DLL is not locked. And adjust pre-change delay to 0x3 for better signal test result. Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com> Link: https://lore.kernel.org/r/1675298118-64243-2-git-send-email-shawn.lin@rock-chips.com Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
1 parent 152b524 commit b75a52b

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

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

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@
4848
#define DWCMSHC_EMMC_DLL_RXCLK_SRCSEL 29
4949
#define DWCMSHC_EMMC_DLL_START_POINT 16
5050
#define DWCMSHC_EMMC_DLL_INC 8
51+
#define DWCMSHC_EMMC_DLL_BYPASS BIT(24)
5152
#define DWCMSHC_EMMC_DLL_DLYENA BIT(27)
5253
#define DLL_TXCLK_TAPNUM_DEFAULT 0x10
5354
#define DLL_TXCLK_TAPNUM_90_DEGREES 0xA
@@ -60,6 +61,7 @@
6061
#define DLL_RXCLK_NO_INVERTER 1
6162
#define DLL_RXCLK_INVERTER 0
6263
#define DLL_CMDOUT_TAPNUM_90_DEGREES 0x8
64+
#define DLL_RXCLK_ORI_GATE BIT(31)
6365
#define DLL_CMDOUT_TAPNUM_FROM_SW BIT(24)
6466
#define DLL_CMDOUT_SRC_CLK_NEG BIT(28)
6567
#define DLL_CMDOUT_EN_SRC_CLK_NEG BIT(29)
@@ -234,9 +236,12 @@ static void dwcmshc_rk3568_set_clock(struct sdhci_host *host, unsigned int clock
234236
sdhci_writel(host, extra, reg);
235237

236238
if (clock <= 52000000) {
237-
/* Disable DLL and reset both of sample and drive clock */
238-
sdhci_writel(host, 0, DWCMSHC_EMMC_DLL_CTRL);
239-
sdhci_writel(host, 0, DWCMSHC_EMMC_DLL_RXCLK);
239+
/*
240+
* Disable DLL and reset both of sample and drive clock.
241+
* The bypass bit and start bit need to be set if DLL is not locked.
242+
*/
243+
sdhci_writel(host, DWCMSHC_EMMC_DLL_BYPASS | DWCMSHC_EMMC_DLL_START, DWCMSHC_EMMC_DLL_CTRL);
244+
sdhci_writel(host, DLL_RXCLK_ORI_GATE, DWCMSHC_EMMC_DLL_RXCLK);
240245
sdhci_writel(host, 0, DWCMSHC_EMMC_DLL_TXCLK);
241246
sdhci_writel(host, 0, DECMSHC_EMMC_DLL_CMDOUT);
242247
/*
@@ -279,7 +284,7 @@ static void dwcmshc_rk3568_set_clock(struct sdhci_host *host, unsigned int clock
279284
}
280285

281286
extra = 0x1 << 16 | /* tune clock stop en */
282-
0x2 << 17 | /* pre-change delay */
287+
0x3 << 17 | /* pre-change delay */
283288
0x3 << 19; /* post-change delay */
284289
sdhci_writel(host, extra, dwc_priv->vendor_specific_area1 + DWCMSHC_EMMC_ATCTRL);
285290

0 commit comments

Comments
 (0)