Skip to content

Commit 1dfbe3f

Browse files
Sarthak Gargstorulf
authored andcommitted
mmc: sdhci-msm: Update DDR_CONFIG as per device tree file
Certain platforms require different settings in the SDCC_HC_REG_DDR_CONFIG register. This setting can change from platform to platform. So the driver should check whether a particular platform require a different setting by reading the device tree file and use it. Signed-off-by: Bao D. Nguyen <[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 04816e6 commit 1dfbe3f

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

drivers/mmc/host/sdhci-msm.c

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -275,6 +275,7 @@ struct sdhci_msm_host {
275275
u32 transfer_mode;
276276
bool updated_ddr_cfg;
277277
bool uses_tassadar_dll;
278+
u32 ddr_config;
278279
};
279280

280281
static const struct sdhci_msm_offset *sdhci_priv_msm_offset(struct sdhci_host *host)
@@ -987,7 +988,7 @@ static int sdhci_msm_cm_dll_sdc4_calibration(struct sdhci_host *host)
987988
ddr_cfg_offset = msm_offset->core_ddr_config;
988989
else
989990
ddr_cfg_offset = msm_offset->core_ddr_config_old;
990-
writel_relaxed(DDR_CONFIG_POR_VAL, host->ioaddr + ddr_cfg_offset);
991+
writel_relaxed(msm_host->ddr_config, host->ioaddr + ddr_cfg_offset);
991992

992993
if (mmc->ios.enhanced_strobe) {
993994
config = readl_relaxed(host->ioaddr +
@@ -1933,6 +1934,19 @@ static const struct sdhci_pltfm_data sdhci_msm_pdata = {
19331934
.ops = &sdhci_msm_ops,
19341935
};
19351936

1937+
static inline void sdhci_msm_get_of_property(struct platform_device *pdev,
1938+
struct sdhci_host *host)
1939+
{
1940+
struct device_node *node = pdev->dev.of_node;
1941+
struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
1942+
struct sdhci_msm_host *msm_host = sdhci_pltfm_priv(pltfm_host);
1943+
1944+
if (of_property_read_u32(node, "qcom,ddr-config",
1945+
&msm_host->ddr_config))
1946+
msm_host->ddr_config = DDR_CONFIG_POR_VAL;
1947+
}
1948+
1949+
19361950
static int sdhci_msm_probe(struct platform_device *pdev)
19371951
{
19381952
struct sdhci_host *host;
@@ -1976,6 +1990,7 @@ static int sdhci_msm_probe(struct platform_device *pdev)
19761990
msm_offset = msm_host->offset;
19771991

19781992
sdhci_get_of_property(pdev);
1993+
sdhci_msm_get_of_property(pdev, host);
19791994

19801995
msm_host->saved_tuning_phase = INVALID_TUNING_PHASE;
19811996

0 commit comments

Comments
 (0)