Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1522894 > unrolled thread

[PATCH 0/2] MMC: davinci: fix card detect and write protect

Started byAxel Haslam <ahaslam@baylibre.com>
First post2016-11-15 17:30 +0100
Last post2016-11-18 15:40 +0100
Articles 4 — 3 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH 0/2] MMC: davinci: fix card detect and write protect Axel Haslam <ahaslam@baylibre.com> - 2016-11-15 17:30 +0100
    [PATCH 2/2] MMC: davinci: request gpios using gpio descriptors Axel Haslam <ahaslam@baylibre.com> - 2016-11-15 17:30 +0100
      Re: [PATCH 2/2] MMC: davinci: request gpios using gpio descriptors David Lechner <david@lechnology.com> - 2016-11-18 23:50 +0100
    Re: [PATCH 0/2] MMC: davinci: fix card detect and write protect Ulf Hansson <ulf.hansson@linaro.org> - 2016-11-18 15:40 +0100

#1522894 — [PATCH 0/2] MMC: davinci: fix card detect and write protect

FromAxel Haslam <ahaslam@baylibre.com>
Date2016-11-15 17:30 +0100
Subject[PATCH 0/2] MMC: davinci: fix card detect and write protect
Message-ID<sDOMq-7jG-5@gated-at.bofh.it>
This series fixes the card detect and write protect parsing for
the davinci_mmc driver, and takes care of a technical debt to 
remove card polling when a card detect gpio is available.

In the case of a platform based boot we register the gpios
using the APIs provided by slot-gpio.

In the case of a DT based boot we use the mmc_of_parse API to parse
all DT properties and register the gpios.

If this series is accepted, the next series will convert all users
to use gpio descriptors and we could then remove the platform
callbacks.

This was tested on the omap138-lcdk, and the da850-evm, with 
additional patches to platform data and dts files.

Axel Haslam (2):
  MMC: davinci: use mmc_of_parse to parse common mmc configuration
  MMC: davinci: request gpios using gpio descriptors

 drivers/mmc/host/davinci_mmc.c | 130 +++++++++++++++++++++--------------------
 1 file changed, 66 insertions(+), 64 deletions(-)

-- 
2.10.1

[toc] | [next] | [standalone]


#1522897 — [PATCH 2/2] MMC: davinci: request gpios using gpio descriptors

FromAxel Haslam <ahaslam@baylibre.com>
Date2016-11-15 17:30 +0100
Subject[PATCH 2/2] MMC: davinci: request gpios using gpio descriptors
Message-ID<sDOMq-7jG-11@gated-at.bofh.it>
In reply to#1522894
Request card detect and write protect gpios using the provided API
by mmc core.

If a gpio is provided for card detect, we don't need to poll.
So only use polling when a gpio is not provided.

Once all pdata users register the gpios using gpio descriptors,
we could remove the platform callbacks.

Signed-off-by: Axel Haslam <ahaslam@baylibre.com>
---
 drivers/mmc/host/davinci_mmc.c | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/drivers/mmc/host/davinci_mmc.c b/drivers/mmc/host/davinci_mmc.c
index 619e50e..36b5af8 100644
--- a/drivers/mmc/host/davinci_mmc.c
+++ b/drivers/mmc/host/davinci_mmc.c
@@ -1167,6 +1167,7 @@ static int mmc_davinci_parse_pdata(struct mmc_host *mmc)
 	struct platform_device *pdev = to_platform_device(mmc->parent);
 	struct davinci_mmc_config *pdata = pdev->dev.platform_data;
 	struct mmc_davinci_host *host;
+	int ret;
 
 	if (!pdata)
 		return -EINVAL;
@@ -1184,7 +1185,6 @@ static int mmc_davinci_parse_pdata(struct mmc_host *mmc)
 	if (pdata && (pdata->wires == 8))
 		mmc->caps |= (MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA);
 
-	mmc->caps |= MMC_CAP_NEEDS_POLL;
 	mmc->f_min = 312500;
 	mmc->f_max = 25000000;
 	if (pdata && pdata->max_freq)
@@ -1192,6 +1192,17 @@ static int mmc_davinci_parse_pdata(struct mmc_host *mmc)
 	if (pdata && pdata->caps)
 		mmc->caps |= pdata->caps;
 
+	/* Register a cd gpio, if there is not one, enable polling */
+	ret = mmc_gpiod_request_cd(mmc, "cd", 0, false, 0, NULL);
+	if (ret == -EPROBE_DEFER)
+		return ret;
+	else if (ret)
+		mmc->caps |= MMC_CAP_NEEDS_POLL;
+
+	ret = mmc_gpiod_request_ro(mmc, "wp", 0, false, 0, NULL);
+	if (ret == -EPROBE_DEFER)
+		return ret;
+
 	return 0;
 }
 
-- 
2.10.1

[toc] | [prev] | [next] | [standalone]


#1525741 — Re: [PATCH 2/2] MMC: davinci: request gpios using gpio descriptors

FromDavid Lechner <david@lechnology.com>
Date2016-11-18 23:50 +0100
SubjectRe: [PATCH 2/2] MMC: davinci: request gpios using gpio descriptors
Message-ID<sF08N-4RY-19@gated-at.bofh.it>
In reply to#1522897
On 11/15/2016 10:28 AM, Axel Haslam wrote:
> Request card detect and write protect gpios using the provided API
> by mmc core.
>
> If a gpio is provided for card detect, we don't need to poll.
> So only use polling when a gpio is not provided.
>
> Once all pdata users register the gpios using gpio descriptors,
> we could remove the platform callbacks.
>
> Signed-off-by: Axel Haslam <ahaslam@baylibre.com>
> ---

Tested-by: David Lechner <david@lechnology.com>

Working for me on LEGO MINDSTORMS EV3.

[toc] | [prev] | [next] | [standalone]


#1525395

FromUlf Hansson <ulf.hansson@linaro.org>
Date2016-11-18 15:40 +0100
Message-ID<sESuB-8nd-3@gated-at.bofh.it>
In reply to#1522894
On 15 November 2016 at 17:28, Axel Haslam <ahaslam@baylibre.com> wrote:
> This series fixes the card detect and write protect parsing for
> the davinci_mmc driver, and takes care of a technical debt to
> remove card polling when a card detect gpio is available.
>
> In the case of a platform based boot we register the gpios
> using the APIs provided by slot-gpio.
>
> In the case of a DT based boot we use the mmc_of_parse API to parse
> all DT properties and register the gpios.
>
> If this series is accepted, the next series will convert all users
> to use gpio descriptors and we could then remove the platform
> callbacks.
>
> This was tested on the omap138-lcdk, and the da850-evm, with
> additional patches to platform data and dts files.
>
> Axel Haslam (2):
>   MMC: davinci: use mmc_of_parse to parse common mmc configuration
>   MMC: davinci: request gpios using gpio descriptors
>
>  drivers/mmc/host/davinci_mmc.c | 130 +++++++++++++++++++++--------------------
>  1 file changed, 66 insertions(+), 64 deletions(-)
>
> --
> 2.10.1
>

Thanks, applied for next!

Kind regards
Uffe

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web