Commit fdb9de12 authored by NeilBrown's avatar NeilBrown Committed by Ulf Hansson
Browse files

mmc: omap_hsmmc: use mmc_of_parse to parse common mmc configuration.



This ensures that all standard options are available to hsmmc,
In particular, I need cap-power-off-card.

Signed-off-by: default avatarNeilBrown <neilb@suse.de>
Signed-off-by: default avatarUlf Hansson <ulf.hansson@linaro.org>
parent 41afa314
Loading
Loading
Loading
Loading
+8 −25
Original line number Original line Diff line number Diff line
@@ -1929,13 +1929,6 @@ static struct omap_hsmmc_platform_data *of_get_hsmmc_pdata(struct device *dev)
{
{
	struct omap_hsmmc_platform_data *pdata;
	struct omap_hsmmc_platform_data *pdata;
	struct device_node *np = dev->of_node;
	struct device_node *np = dev->of_node;
	u32 bus_width, max_freq;
	int cd_gpio, wp_gpio;

	cd_gpio = of_get_named_gpio(np, "cd-gpios", 0);
	wp_gpio = of_get_named_gpio(np, "wp-gpios", 0);
	if (cd_gpio == -EPROBE_DEFER || wp_gpio == -EPROBE_DEFER)
		return ERR_PTR(-EPROBE_DEFER);


	pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL);
	pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL);
	if (!pdata)
	if (!pdata)
@@ -1944,34 +1937,20 @@ static struct omap_hsmmc_platform_data *of_get_hsmmc_pdata(struct device *dev)
	if (of_find_property(np, "ti,dual-volt", NULL))
	if (of_find_property(np, "ti,dual-volt", NULL))
		pdata->controller_flags |= OMAP_HSMMC_SUPPORTS_DUAL_VOLT;
		pdata->controller_flags |= OMAP_HSMMC_SUPPORTS_DUAL_VOLT;


	pdata->switch_pin = cd_gpio;
	pdata->switch_pin = -EINVAL;
	pdata->gpio_wp = wp_gpio;
	pdata->gpio_wp = -EINVAL;


	if (of_find_property(np, "ti,non-removable", NULL)) {
	if (of_find_property(np, "ti,non-removable", NULL)) {
		pdata->nonremovable = true;
		pdata->nonremovable = true;
		pdata->no_regulator_off_init = true;
		pdata->no_regulator_off_init = true;
	}
	}
	of_property_read_u32(np, "bus-width", &bus_width);
	if (bus_width == 4)
		pdata->caps |= MMC_CAP_4_BIT_DATA;
	else if (bus_width == 8)
		pdata->caps |= MMC_CAP_8_BIT_DATA;


	if (of_find_property(np, "ti,needs-special-reset", NULL))
	if (of_find_property(np, "ti,needs-special-reset", NULL))
		pdata->features |= HSMMC_HAS_UPDATED_RESET;
		pdata->features |= HSMMC_HAS_UPDATED_RESET;


	if (!of_property_read_u32(np, "max-frequency", &max_freq))
		pdata->max_freq = max_freq;

	if (of_find_property(np, "ti,needs-special-hs-handling", NULL))
	if (of_find_property(np, "ti,needs-special-hs-handling", NULL))
		pdata->features |= HSMMC_HAS_HSPE_SUPPORT;
		pdata->features |= HSMMC_HAS_HSPE_SUPPORT;


	if (of_find_property(np, "keep-power-in-suspend", NULL))
		pdata->pm_caps |= MMC_PM_KEEP_POWER;

	if (of_find_property(np, "enable-sdio-wakeup", NULL))
		pdata->pm_caps |= MMC_PM_WAKE_SDIO_IRQ;

	return pdata;
	return pdata;
}
}
#else
#else
@@ -2029,6 +2008,10 @@ static int omap_hsmmc_probe(struct platform_device *pdev)
		goto err;
		goto err;
	}
	}


	ret = mmc_of_parse(mmc);
	if (ret)
		goto err1;

	host		= mmc_priv(mmc);
	host		= mmc_priv(mmc);
	host->mmc	= mmc;
	host->mmc	= mmc;
	host->pdata	= pdata;
	host->pdata	= pdata;
@@ -2057,7 +2040,7 @@ static int omap_hsmmc_probe(struct platform_device *pdev)


	if (pdata->max_freq > 0)
	if (pdata->max_freq > 0)
		mmc->f_max = pdata->max_freq;
		mmc->f_max = pdata->max_freq;
	else
	else if (mmc->f_max == 0)
		mmc->f_max = OMAP_MMC_MAX_CLOCK;
		mmc->f_max = OMAP_MMC_MAX_CLOCK;


	spin_lock_init(&host->irq_lock);
	spin_lock_init(&host->irq_lock);
@@ -2111,7 +2094,7 @@ static int omap_hsmmc_probe(struct platform_device *pdev)
	if (mmc_pdata(host)->nonremovable)
	if (mmc_pdata(host)->nonremovable)
		mmc->caps |= MMC_CAP_NONREMOVABLE;
		mmc->caps |= MMC_CAP_NONREMOVABLE;


	mmc->pm_caps = mmc_pdata(host)->pm_caps;
	mmc->pm_caps |= mmc_pdata(host)->pm_caps;


	omap_hsmmc_conf_bus_power(host);
	omap_hsmmc_conf_bus_power(host);