diff options
author | Jaehoon Chung <jh80.chung@samsung.com> | 2016-07-26 19:06:24 +0900 |
---|---|---|
committer | Jaehoon Chung <jh80.chung@samsung.com> | 2016-08-05 11:31:07 +0900 |
commit | 14bed52d276afd36b9674ee7aa2c2ad9d2f4e59e (patch) | |
tree | ca94e6432dd7394113c956e721aa115353ccee2b /drivers/mmc/sdhci.c | |
parent | 6a879ec8e7ac9905ad10b98e9cd585622c64b17c (diff) | |
download | u-boot-14bed52d276afd36b9674ee7aa2c2ad9d2f4e59e.tar.gz |
mmc: sdhci: remove the unnecessary arguments for sdhci_setup_cfg
Some arguments don't need to pass to sdhci_setup_cfg.
Generic variable can be used in sdhci_setup_cfg, and some arguments are
already included in sdhci_host struct.
It's enough that just pass the board specific things to sdhci_setup_cfg().
After removing the unnecessary arguments, it's more simpler than before.
It doesn't consider "Version" and "Capabilities" anymore in each SoC
driver.
Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'drivers/mmc/sdhci.c')
-rw-r--r-- | drivers/mmc/sdhci.c | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/drivers/mmc/sdhci.c b/drivers/mmc/sdhci.c index c275314f51..60108fde94 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; |