Skip to content

Commit 5c30f34

Browse files
Veerabhadrarao Badigantistorulf
authored andcommitted
mmc: host: sdhci-msm: Configure dll-user-control in dll init sequence
With SDCC v5.1.0, additional setting needed for enabling DLL output. The dll-user-control register need to be configured during dll initialization for getting proper dll output. Without this configuration, we don't get the DLL lock status properly. Also update the DLL register settings according to the SDCC Hardware Programming Guide. Signed-off-by: Veerabhadrarao Badiganti <[email protected]> Signed-off-by: Sarthak Garg <[email protected]> Acked-by: Adrian Hunter <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Ulf Hansson <[email protected]>
1 parent 97306b6 commit 5c30f34

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

drivers/mmc/host/sdhci-msm.c

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,11 @@
5757
#define CORE_FLL_CYCLE_CNT BIT(18)
5858
#define CORE_DLL_CLOCK_DISABLE BIT(21)
5959

60+
#define DLL_USR_CTL_POR_VAL 0x10800
61+
#define ENABLE_DLL_LOCK_STATUS BIT(26)
62+
#define FINE_TUNE_MODE_EN BIT(27)
63+
#define BIAS_OK_SIGNAL BIT(29)
64+
6065
#define CORE_VENDOR_SPEC_POR_VAL 0xa9c
6166
#define CORE_CLK_PWRSAVE BIT(1)
6267
#define CORE_HC_MCLK_SEL_DFLT (2 << 8)
@@ -157,6 +162,7 @@ struct sdhci_msm_offset {
157162
u32 core_dll_config_3;
158163
u32 core_ddr_config_old; /* Applicable to sdcc minor ver < 0x49 */
159164
u32 core_ddr_config;
165+
u32 core_dll_usr_ctl; /* Present on SDCC5.1 onwards */
160166
};
161167

162168
static const struct sdhci_msm_offset sdhci_msm_v5_offset = {
@@ -186,6 +192,7 @@ static const struct sdhci_msm_offset sdhci_msm_v5_offset = {
186192
.core_dll_config_2 = 0x254,
187193
.core_dll_config_3 = 0x258,
188194
.core_ddr_config = 0x25c,
195+
.core_dll_usr_ctl = 0x388,
189196
};
190197

191198
static const struct sdhci_msm_offset sdhci_msm_mci_offset = {
@@ -231,6 +238,7 @@ struct sdhci_msm_variant_ops {
231238
struct sdhci_msm_variant_info {
232239
bool mci_removed;
233240
bool restore_dll_config;
241+
bool uses_tassadar_dll;
234242
const struct sdhci_msm_variant_ops *var_ops;
235243
const struct sdhci_msm_offset *offset;
236244
};
@@ -263,6 +271,7 @@ struct sdhci_msm_host {
263271
bool use_cdr;
264272
u32 transfer_mode;
265273
bool updated_ddr_cfg;
274+
bool uses_tassadar_dll;
266275
};
267276

268277
static const struct sdhci_msm_offset *sdhci_priv_msm_offset(struct sdhci_host *host)
@@ -677,6 +686,17 @@ static int msm_init_cm_dll(struct sdhci_host *host)
677686
msm_offset->core_dll_config_2);
678687
}
679688

689+
/*
690+
* Configure DLL user control register to enable DLL status.
691+
* This setting is applicable to SDCC v5.1 onwards only.
692+
*/
693+
if (msm_host->uses_tassadar_dll) {
694+
config = DLL_USR_CTL_POR_VAL | FINE_TUNE_MODE_EN |
695+
ENABLE_DLL_LOCK_STATUS | BIAS_OK_SIGNAL;
696+
writel_relaxed(config, host->ioaddr +
697+
msm_offset->core_dll_usr_ctl);
698+
}
699+
680700
config = readl_relaxed(host->ioaddr +
681701
msm_offset->core_dll_config);
682702
config |= CORE_DLL_EN;
@@ -1861,10 +1881,18 @@ static const struct sdhci_msm_variant_info sdm845_sdhci_var = {
18611881
.offset = &sdhci_msm_v5_offset,
18621882
};
18631883

1884+
static const struct sdhci_msm_variant_info sm8250_sdhci_var = {
1885+
.mci_removed = true,
1886+
.uses_tassadar_dll = true,
1887+
.var_ops = &v5_var_ops,
1888+
.offset = &sdhci_msm_v5_offset,
1889+
};
1890+
18641891
static const struct of_device_id sdhci_msm_dt_match[] = {
18651892
{.compatible = "qcom,sdhci-msm-v4", .data = &sdhci_msm_mci_var},
18661893
{.compatible = "qcom,sdhci-msm-v5", .data = &sdhci_msm_v5_var},
18671894
{.compatible = "qcom,sdm845-sdhci", .data = &sdm845_sdhci_var},
1895+
{.compatible = "qcom,sm8250-sdhci", .data = &sm8250_sdhci_var},
18681896
{},
18691897
};
18701898

@@ -1930,6 +1958,7 @@ static int sdhci_msm_probe(struct platform_device *pdev)
19301958
msm_host->restore_dll_config = var_info->restore_dll_config;
19311959
msm_host->var_ops = var_info->var_ops;
19321960
msm_host->offset = var_info->offset;
1961+
msm_host->uses_tassadar_dll = var_info->uses_tassadar_dll;
19331962

19341963
msm_offset = msm_host->offset;
19351964

0 commit comments

Comments
 (0)