aboutsummaryrefslogtreecommitdiff
path: root/drivers/mmc
diff options
context:
space:
mode:
authorStephan Gerhold <stephan@gerhold.net>2021-07-06 16:54:35 +0200
committerPeng Fan <peng.fan@nxp.com>2021-07-30 17:13:02 +0800
commit4daf2ec357c1c22ec0dc8db206add877f6632bc8 (patch)
treec2cdc83c17192f6122c94f229c799166e9a124f1 /drivers/mmc
parent19e1da0c66454bd6206a4badfdc0077d7fd76aed (diff)
downloadu-boot-4daf2ec357c1c22ec0dc8db206add877f6632bc8.zip
u-boot-4daf2ec357c1c22ec0dc8db206add877f6632bc8.tar.gz
u-boot-4daf2ec357c1c22ec0dc8db206add877f6632bc8.tar.bz2
mmc: arm_pl180_mmci: Simplify code using mmc_of_parse()
Simplify the code a bit by using the common mmc_of_parse() function instead of duplicating the device tree parsing code. We can still get a default value for cfg->f_max by assigning it before calling mmc_of_parse(). Another advantage of this refactoring is that we parse more properties now, e.g. "non-removable" can be used to disable CD entirely. Signed-off-by: Stephan Gerhold <stephan@gerhold.net> Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com> Tested-by: Patrice Chotard <patrice.chotard@foss.st.com> on stm32f769-disco Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com>
Diffstat (limited to 'drivers/mmc')
-rw-r--r--drivers/mmc/arm_pl180_mmci.c19
1 files changed, 4 insertions, 15 deletions
diff --git a/drivers/mmc/arm_pl180_mmci.c b/drivers/mmc/arm_pl180_mmci.c
index e632eed..809b865 100644
--- a/drivers/mmc/arm_pl180_mmci.c
+++ b/drivers/mmc/arm_pl180_mmci.c
@@ -424,7 +424,6 @@ static int arm_pl180_mmc_probe(struct udevice *dev)
struct pl180_mmc_host *host = dev_get_priv(dev);
struct mmc_config *cfg = &pdata->cfg;
struct clk clk;
- u32 bus_width;
u32 periphid;
int ret;
@@ -457,24 +456,14 @@ static int arm_pl180_mmc_probe(struct udevice *dev)
cfg->voltages = VOLTAGE_WINDOW_SD;
cfg->host_caps = 0;
cfg->f_min = host->clock_in / (2 * (SDI_CLKCR_CLKDIV_INIT_V1 + 1));
- cfg->f_max = dev_read_u32_default(dev, "max-frequency", MMC_CLOCK_MAX);
+ cfg->f_max = MMC_CLOCK_MAX;
cfg->b_max = CONFIG_SYS_MMC_MAX_BLK_COUNT;
gpio_request_by_name(dev, "cd-gpios", 0, &host->cd_gpio, GPIOD_IS_IN);
- bus_width = dev_read_u32_default(dev, "bus-width", 1);
- switch (bus_width) {
- case 8:
- cfg->host_caps |= MMC_MODE_8BIT;
- /* Hosts capable of 8-bit transfers can also do 4 bits */
- case 4:
- cfg->host_caps |= MMC_MODE_4BIT;
- break;
- case 1:
- break;
- default:
- dev_err(dev, "Invalid bus-width value %u\n", bus_width);
- }
+ ret = mmc_of_parse(dev, cfg);
+ if (ret)
+ return ret;
arm_pl180_mmc_init(host);
mmc->priv = host;