From: Daniel Mack <daniel@zonque.org>
To: ulf.hansson@linaro.org, robh+dt@kernel.org, mark.rutland@arm.com
Cc: robert.jarzmik@free.fr, linux-mmc@vger.kernel.org,
devicetree@vger.kernel.org, Daniel Mack <daniel@zonque.org>
Subject: [PATCH v2 5/7] mmc: pxamci: call mmc_of_parse()
Date: Sat, 30 Jun 2018 20:14:03 +0200 [thread overview]
Message-ID: <20180630181405.17630-6-daniel@zonque.org> (raw)
In-Reply-To: <20180630181405.17630-1-daniel@zonque.org>
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>
---
.../devicetree/bindings/mmc/pxa-mmc.txt | 4 ++--
drivers/mmc/host/pxamci.c | 24 ++++++++++---------
2 files changed, 15 insertions(+), 13 deletions(-)
diff --git a/Documentation/devicetree/bindings/mmc/pxa-mmc.txt b/Documentation/devicetree/bindings/mmc/pxa-mmc.txt
index b7025de7dced..f2687752597e 100644
--- a/Documentation/devicetree/bindings/mmc/pxa-mmc.txt
+++ b/Documentation/devicetree/bindings/mmc/pxa-mmc.txt
@@ -10,8 +10,8 @@ Optional properties:
- marvell,detect-delay-ms: sets the detection delay timeout in ms.
- marvell,gpio-power: GPIO spec for the card power enable pin
-This file documents differences between the core properties in mmc.txt
-and the properties used by the pxa-mmc driver.
+In addition to the properties described in this docuent, the details
+described in mmc.txt are supported.
Examples:
diff --git a/drivers/mmc/host/pxamci.c b/drivers/mmc/host/pxamci.c
index 3df60c7babce..e046e684b3f9 100644
--- a/drivers/mmc/host/pxamci.c
+++ b/drivers/mmc/host/pxamci.c
@@ -591,11 +591,13 @@ static const struct of_device_id 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 pxamci_platform_data *pdata;
u32 tmp;
+ int ret;
if (!np)
return 0;
@@ -604,11 +606,6 @@ static int pxamci_of_init(struct platform_device *pdev)
if (!pdata)
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 */
pdata->gpio_power =
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)
pdata->detect_delay_ms = tmp;
+ ret = mmc_of_parse(mmc);
+ if (ret < 0)
+ return ret;
+
pdev->dev.platform_data = pdata;
return 0;
}
#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;
}
@@ -634,10 +636,6 @@ static int pxamci_probe(struct platform_device *pdev)
struct resource *r;
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);
irq = platform_get_irq(pdev, 0);
if (irq < 0)
@@ -672,6 +670,10 @@ static int pxamci_probe(struct platform_device *pdev)
*/
mmc->max_blk_count = 65535;
+ ret = pxamci_of_init(pdev, mmc);
+ if (ret)
+ return ret;
+
host = mmc_priv(mmc);
host->mmc = mmc;
host->pdata = pdev->dev.platform_data;
--
2.17.1
next prev parent reply other threads:[~2018-06-30 18:14 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-06-30 18:13 [PATCH v2 0/7] mmc: pxamci: cleanups and minor DT tweaks Daniel Mack
2018-06-30 18:13 ` [PATCH v2 1/7] mmc: pxamci: remove irq from private context Daniel Mack
2018-06-30 18:14 ` [PATCH v2 2/7] mmc: pxamci: remove dma resources " Daniel Mack
2018-06-30 18:14 ` [PATCH v2 3/7] mmc: pxamci: remove dead code from pxamci_remove() Daniel Mack
2018-06-30 18:14 ` [PATCH v2 4/7] mmc: pxamci: fix indenting Daniel Mack
2018-06-30 18:14 ` Daniel Mack [this message]
2018-06-30 18:14 ` [PATCH v2 6/7] mmc: pxamci: remove pxa-mmc,gpio-power from devicetree bindings Daniel Mack
2018-06-30 18:14 ` [PATCH v2 7/7] mmc: pxamci: let mmc core handle regulators Daniel Mack
2018-07-02 14:38 ` [PATCH v2 0/7] mmc: pxamci: cleanups and minor DT tweaks Ulf Hansson
2018-07-02 14:43 ` Daniel Mack
2018-07-02 14:47 ` Ulf Hansson
2018-07-02 15:23 ` Robert Jarzmik
2018-07-03 5:35 ` Ulf Hansson
2018-07-03 9:23 ` Daniel Mack
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180630181405.17630-6-daniel@zonque.org \
--to=daniel@zonque.org \
--cc=devicetree@vger.kernel.org \
--cc=linux-mmc@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=robert.jarzmik@free.fr \
--cc=robh+dt@kernel.org \
--cc=ulf.hansson@linaro.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).