mmc: pxamci: call mmc_of_parse()

Call into mmc_of_parse() from pxamci_of_init(). As it needs a pointer to a
struct mmc_host, refactor the code a bit.

This allows all generic MMC properties to be set that are described in
Documentation/devicetree/bindings/mmc/mmc.txt. Reword the documentation
a bit to make that clear.

The "cd" and "wp" gpio lookups are removed as the lookup will now be
done by mmc_of_parse().

Signed-off-by: Daniel Mack <daniel@zonque.org>
Acked-by: Robert Jarzmik <robert.jarzmik@free.fr>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
This commit is contained in:
Daniel Mack 2018-06-30 20:14:03 +02:00 committed by Ulf Hansson
parent 0da5358b29
commit fa3a511546
2 changed files with 15 additions and 13 deletions

View file

@ -10,8 +10,8 @@ Optional properties:
- marvell,detect-delay-ms: sets the detection delay timeout in ms. - marvell,detect-delay-ms: sets the detection delay timeout in ms.
- marvell,gpio-power: GPIO spec for the card power enable pin - marvell,gpio-power: GPIO spec for the card power enable pin
This file documents differences between the core properties in mmc.txt In addition to the properties described in this docuent, the details
and the properties used by the pxa-mmc driver. described in mmc.txt are supported.
Examples: Examples:

View file

@ -591,11 +591,13 @@ static const struct of_device_id pxa_mmc_dt_ids[] = {
MODULE_DEVICE_TABLE(of, pxa_mmc_dt_ids); MODULE_DEVICE_TABLE(of, pxa_mmc_dt_ids);
static int pxamci_of_init(struct platform_device *pdev) static int pxamci_of_init(struct platform_device *pdev,
struct mmc_host *mmc)
{ {
struct device_node *np = pdev->dev.of_node; struct device_node *np = pdev->dev.of_node;
struct pxamci_platform_data *pdata; struct pxamci_platform_data *pdata;
u32 tmp; u32 tmp;
int ret;
if (!np) if (!np)
return 0; return 0;
@ -604,11 +606,6 @@ static int pxamci_of_init(struct platform_device *pdev)
if (!pdata) if (!pdata)
return -ENOMEM; return -ENOMEM;
pdata->gpio_card_detect =
of_get_named_gpio(np, "cd-gpios", 0);
pdata->gpio_card_ro =
of_get_named_gpio(np, "wp-gpios", 0);
/* pxa-mmc specific */ /* pxa-mmc specific */
pdata->gpio_power = pdata->gpio_power =
of_get_named_gpio(np, "pxa-mmc,gpio-power", 0); of_get_named_gpio(np, "pxa-mmc,gpio-power", 0);
@ -616,12 +613,17 @@ static int pxamci_of_init(struct platform_device *pdev)
if (of_property_read_u32(np, "pxa-mmc,detect-delay-ms", &tmp) == 0) if (of_property_read_u32(np, "pxa-mmc,detect-delay-ms", &tmp) == 0)
pdata->detect_delay_ms = tmp; pdata->detect_delay_ms = tmp;
ret = mmc_of_parse(mmc);
if (ret < 0)
return ret;
pdev->dev.platform_data = pdata; pdev->dev.platform_data = pdata;
return 0; return 0;
} }
#else #else
static int pxamci_of_init(struct platform_device *pdev) static int pxamci_of_init(struct platform_device *pdev,
struct mmc_host *mmc)
{ {
return 0; return 0;
} }
@ -634,10 +636,6 @@ static int pxamci_probe(struct platform_device *pdev)
struct resource *r; struct resource *r;
int ret, irq, gpio_cd = -1, gpio_ro = -1, gpio_power = -1; int ret, irq, gpio_cd = -1, gpio_ro = -1, gpio_power = -1;
ret = pxamci_of_init(pdev);
if (ret)
return ret;
r = platform_get_resource(pdev, IORESOURCE_MEM, 0); r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
irq = platform_get_irq(pdev, 0); irq = platform_get_irq(pdev, 0);
if (irq < 0) if (irq < 0)
@ -672,6 +670,10 @@ static int pxamci_probe(struct platform_device *pdev)
*/ */
mmc->max_blk_count = 65535; mmc->max_blk_count = 65535;
ret = pxamci_of_init(pdev, mmc);
if (ret)
return ret;
host = mmc_priv(mmc); host = mmc_priv(mmc);
host->mmc = mmc; host->mmc = mmc;
host->pdata = pdev->dev.platform_data; host->pdata = pdev->dev.platform_data;