summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/mmc/msm_sdhci.c4
-rw-r--r--drivers/mmc/rockchip_sdhci.c8
-rw-r--r--drivers/mmc/sdhci.c26
-rw-r--r--drivers/mmc/zynq_sdhci.c6
4 files changed, 19 insertions, 25 deletions
diff --git a/drivers/mmc/msm_sdhci.c b/drivers/mmc/msm_sdhci.c
index e90a044..a8cb9e2 100644
--- a/drivers/mmc/msm_sdhci.c
+++ b/drivers/mmc/msm_sdhci.c
@@ -143,9 +143,7 @@ static int msm_sdc_probe(struct udevice *dev)
/* Set host controller version */
host->version = sdhci_readw(host, SDHCI_HOST_VERSION);
- caps = sdhci_readl(host, SDHCI_CAPABILITIES);
- ret = sdhci_setup_cfg(&plat->cfg, dev->name, caps,
- 0, 0, host->version, host->quirks, 0);
+ ret = sdhci_setup_cfg(&plat->cfg, host, 0, 0);
host->mmc = &plat->mmc;
if (ret)
return ret;
diff --git a/drivers/mmc/rockchip_sdhci.c b/drivers/mmc/rockchip_sdhci.c
index 023c29b..624029b 100644
--- a/drivers/mmc/rockchip_sdhci.c
+++ b/drivers/mmc/rockchip_sdhci.c
@@ -33,15 +33,11 @@ static int arasan_sdhci_probe(struct udevice *dev)
struct rockchip_sdhc *prv = dev_get_priv(dev);
struct sdhci_host *host = &prv->host;
int ret;
- u32 caps;
- host->version = sdhci_readw(host, SDHCI_HOST_VERSION);
host->quirks = SDHCI_QUIRK_WAIT_SEND_CMD;
- caps = sdhci_readl(host, SDHCI_CAPABILITIES);
- ret = sdhci_setup_cfg(&plat->cfg, dev->name, host->bus_width,
- caps, CONFIG_ROCKCHIP_SDHCI_MAX_FREQ, EMMC_MIN_FREQ,
- host->version, host->quirks, 0);
+ ret = sdhci_setup_cfg(&plat->cfg, host, CONFIG_ROCKCHIP_SDHCI_MAX_FREQ,
+ EMMC_MIN_FREQ);
host->mmc = &plat->mmc;
if (ret)
diff --git a/drivers/mmc/sdhci.c b/drivers/mmc/sdhci.c
index c275314..60108fd 100644
--- a/drivers/mmc/sdhci.c
+++ b/drivers/mmc/sdhci.c
@@ -511,18 +511,22 @@ static const struct mmc_ops sdhci_ops = {
};
#endif
-int sdhci_setup_cfg(struct mmc_config *cfg, const char *name,
- uint caps, u32 max_clk, u32 min_clk, uint version,
- uint quirks, uint host_caps)
+int sdhci_setup_cfg(struct mmc_config *cfg, struct sdhci_host *host,
+ u32 max_clk, u32 min_clk)
{
- cfg->name = name;
+ u32 caps;
+
+ caps = sdhci_readl(host, SDHCI_CAPABILITIES);
+ host->version = sdhci_readw(host, SDHCI_HOST_VERSION);
+
+ cfg->name = host->name;
#ifndef CONFIG_DM_MMC_OPS
cfg->ops = &sdhci_ops;
#endif
if (max_clk)
cfg->f_max = max_clk;
else {
- if (version >= SDHCI_SPEC_300)
+ if (SDHCI_GET_VERSION(host) >= SDHCI_SPEC_300)
cfg->f_max = (caps & SDHCI_CLOCK_V3_BASE_MASK) >>
SDHCI_CLOCK_BASE_SHIFT;
else
@@ -535,7 +539,7 @@ int sdhci_setup_cfg(struct mmc_config *cfg, const char *name,
if (min_clk)
cfg->f_min = min_clk;
else {
- if (version >= SDHCI_SPEC_300)
+ if (SDHCI_GET_VERSION(host) >= SDHCI_SPEC_300)
cfg->f_min = cfg->f_max / SDHCI_MAX_DIV_SPEC_300;
else
cfg->f_min = cfg->f_max / SDHCI_MAX_DIV_SPEC_200;
@@ -549,13 +553,13 @@ int sdhci_setup_cfg(struct mmc_config *cfg, const char *name,
cfg->voltages |= MMC_VDD_165_195;
cfg->host_caps = MMC_MODE_HS | MMC_MODE_HS_52MHz | MMC_MODE_4BIT;
- if (version >= SDHCI_SPEC_300) {
+ if (SDHCI_GET_VERSION(host) >= SDHCI_SPEC_300) {
if (caps & SDHCI_CAN_DO_8BIT)
cfg->host_caps |= MMC_MODE_8BIT;
}
- if (host_caps)
- cfg->host_caps |= host_caps;
+ if (host->host_caps)
+ cfg->host_caps |= host->host_caps;
cfg->b_max = CONFIG_SYS_MMC_MAX_BLK_COUNT;
@@ -582,9 +586,7 @@ int add_sdhci(struct sdhci_host *host, u32 max_clk, u32 min_clk)
}
#endif
- if (sdhci_setup_cfg(&host->cfg, host->name, caps,
- max_clk, min_clk, SDHCI_GET_VERSION(host),
- host->quirks, host->host_caps)) {
+ if (sdhci_setup_cfg(&host->cfg, host, max_clk, min_clk)) {
printf("%s: Hardware doesn't specify base clock frequency\n",
__func__);
return -EINVAL;
diff --git a/drivers/mmc/zynq_sdhci.c b/drivers/mmc/zynq_sdhci.c
index 69d6151..bf54219 100644
--- a/drivers/mmc/zynq_sdhci.c
+++ b/drivers/mmc/zynq_sdhci.c
@@ -40,10 +40,8 @@ static int arasan_sdhci_probe(struct udevice *dev)
host->version = sdhci_readw(host, SDHCI_HOST_VERSION);
caps = sdhci_readl(host, SDHCI_CAPABILITIES);
- ret = sdhci_setup_cfg(&plat->cfg, dev->name,
- caps, CONFIG_ZYNQ_SDHCI_MAX_FREQ,
- CONFIG_ZYNQ_SDHCI_MIN_FREQ, host->version,
- host->quirks, 0);
+ ret = sdhci_setup_cfg(&plat->cfg, host, CONFIG_ZYNQ_SDHCI_MAX_FREQ,
+ CONFIG_ZYNQ_SDHCI_MIN_FREQ);
host->mmc = &plat->mmc;
if (ret)
return ret;