aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mmc/host/sdhci-xenon-phy.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/mmc/host/sdhci-xenon-phy.c')
-rw-r--r--drivers/mmc/host/sdhci-xenon-phy.c40
1 files changed, 22 insertions, 18 deletions
diff --git a/drivers/mmc/host/sdhci-xenon-phy.c b/drivers/mmc/host/sdhci-xenon-phy.c
index 03ce57ef4585..8cf3a375de65 100644
--- a/drivers/mmc/host/sdhci-xenon-phy.c
+++ b/drivers/mmc/host/sdhci-xenon-phy.c
@@ -651,11 +651,13 @@ static int get_dt_pad_ctrl_data(struct sdhci_host *host,
struct device_node *np,
struct xenon_emmc_phy_params *params)
{
+ struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
+ struct xenon_priv *priv = sdhci_pltfm_priv(pltfm_host);
int ret = 0;
const char *name;
struct resource iomem;
- if (of_device_is_compatible(np, "marvell,armada-3700-sdhci"))
+ if (priv->hw_version == XENON_A3700)
params->pad_ctrl.set_soc_pad = armada_3700_soc_pad_voltage_set;
else
return 0;
@@ -689,35 +691,37 @@ static int get_dt_pad_ctrl_data(struct sdhci_host *host,
return ret;
}
-static int xenon_emmc_phy_parse_param_dt(struct sdhci_host *host,
- struct device_node *np,
- struct xenon_emmc_phy_params *params)
+static int xenon_emmc_phy_parse_params(struct sdhci_host *host,
+ struct device *dev,
+ struct xenon_emmc_phy_params *params)
{
u32 value;
params->slow_mode = false;
- if (of_property_read_bool(np, "marvell,xenon-phy-slow-mode"))
+ if (device_property_read_bool(dev, "marvell,xenon-phy-slow-mode"))
params->slow_mode = true;
params->znr = XENON_ZNR_DEF_VALUE;
- if (!of_property_read_u32(np, "marvell,xenon-phy-znr", &value))
+ if (!device_property_read_u32(dev, "marvell,xenon-phy-znr", &value))
params->znr = value & XENON_ZNR_MASK;
params->zpr = XENON_ZPR_DEF_VALUE;
- if (!of_property_read_u32(np, "marvell,xenon-phy-zpr", &value))
+ if (!device_property_read_u32(dev, "marvell,xenon-phy-zpr", &value))
params->zpr = value & XENON_ZPR_MASK;
params->nr_tun_times = XENON_TUN_CONSECUTIVE_TIMES;
- if (!of_property_read_u32(np, "marvell,xenon-phy-nr-success-tun",
- &value))
+ if (!device_property_read_u32(dev, "marvell,xenon-phy-nr-success-tun",
+ &value))
params->nr_tun_times = value & XENON_TUN_CONSECUTIVE_TIMES_MASK;
params->tun_step_divider = XENON_TUNING_STEP_DIVIDER;
- if (!of_property_read_u32(np, "marvell,xenon-phy-tun-step-divider",
- &value))
+ if (!device_property_read_u32(dev, "marvell,xenon-phy-tun-step-divider",
+ &value))
params->tun_step_divider = value & 0xFF;
- return get_dt_pad_ctrl_data(host, np, params);
+ if (dev->of_node)
+ return get_dt_pad_ctrl_data(host, dev->of_node, params);
+ return 0;
}
/* Set SoC PHY Voltage PAD */
@@ -811,7 +815,7 @@ int xenon_phy_adj(struct sdhci_host *host, struct mmc_ios *ios)
return ret;
}
-static int xenon_add_phy(struct device_node *np, struct sdhci_host *host,
+static int xenon_add_phy(struct device *dev, struct sdhci_host *host,
const char *phy_name)
{
struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
@@ -830,15 +834,15 @@ static int xenon_add_phy(struct device_node *np, struct sdhci_host *host,
if (ret)
return ret;
- return xenon_emmc_phy_parse_param_dt(host, np, priv->phy_params);
+ return xenon_emmc_phy_parse_params(host, dev, priv->phy_params);
}
-int xenon_phy_parse_dt(struct device_node *np, struct sdhci_host *host)
+int xenon_phy_parse_params(struct device *dev, struct sdhci_host *host)
{
const char *phy_type = NULL;
- if (!of_property_read_string(np, "marvell,xenon-phy-type", &phy_type))
- return xenon_add_phy(np, host, phy_type);
+ if (!device_property_read_string(dev, "marvell,xenon-phy-type", &phy_type))
+ return xenon_add_phy(dev, host, phy_type);
- return xenon_add_phy(np, host, "emmc 5.1 phy");
+ return xenon_add_phy(dev, host, "emmc 5.1 phy");
}