From: Walter Lozano <walter.lozano@collabora.com>
To: u-boot@lists.denx.de
Subject: [PATCH v2 4/6] mmc: fsl_esdhc_imx: add CD support when OF_PLATDATA is enabled
Date: Wed, 22 Jul 2020 10:14:36 -0300 [thread overview]
Message-ID: <20200722131438.12215-5-walter.lozano@collabora.com> (raw)
In-Reply-To: <20200722131438.12215-1-walter.lozano@collabora.com>
After enabling OF_PLATDATA support to both MMC and GPIO drivers add the
support for card detection.
Signed-off-by: Walter Lozano <walter.lozano@collabora.com>
---
(no changes since v1)
drivers/mmc/fsl_esdhc_imx.c | 27 ++++++++++++++++++++++++++-
1 file changed, 26 insertions(+), 1 deletion(-)
diff --git a/drivers/mmc/fsl_esdhc_imx.c b/drivers/mmc/fsl_esdhc_imx.c
index f2509b5cc9..4448565b5a 100644
--- a/drivers/mmc/fsl_esdhc_imx.c
+++ b/drivers/mmc/fsl_esdhc_imx.c
@@ -1498,7 +1498,32 @@ static int fsl_esdhc_probe(struct udevice *dev)
priv->bus_width = 4;
else
priv->bus_width = 1;
- priv->non_removable = 1;
+
+ if (dtplat->non_removable)
+ priv->non_removable = 1;
+ else
+ priv->non_removable = 0;
+
+#if CONFIG_IS_ENABLED(DM_GPIO)
+ if (!priv->non_removable) {
+ struct udevice *gpiodev;
+ struct driver_info *info;
+
+ info = (struct driver_info *)dtplat->cd_gpios->node;
+
+ ret = device_get_by_driver_info(info, &gpiodev);
+
+ if (ret)
+ return ret;
+
+ ret = gpio_dev_request_index(gpiodev, gpiodev->name, "cd-gpios",
+ dtplat->cd_gpios->arg[0], GPIOD_IS_IN,
+ dtplat->cd_gpios->arg[1], &priv->cd_gpio);
+
+ if (ret)
+ return ret;
+ }
+#endif
#endif
if (data)
--
2.20.1
next prev parent reply other threads:[~2020-07-22 13:14 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-22 13:14 [PATCH v2 0/6] mx6cuboxi: enable OF_PLATDATA with MMC support Walter Lozano
2020-07-22 13:14 ` [PATCH v2 1/6] mmc: fsl_esdhc_imx: rename driver name to match ll_entry Walter Lozano
2020-07-26 14:54 ` Simon Glass
2020-07-22 13:14 ` [PATCH v2 2/6] mmc: fsl_esdhc_imx: add OF_PLATDATA support Walter Lozano
2020-07-26 14:54 ` Simon Glass
2020-07-22 13:14 ` [PATCH v2 3/6] gpio: mxc_gpio: " Walter Lozano
2020-07-26 14:54 ` Simon Glass
2020-07-27 12:10 ` Stefano Babic
2020-07-29 15:32 ` Walter Lozano
2020-07-22 13:14 ` Walter Lozano [this message]
2020-07-26 14:54 ` [PATCH v2 4/6] mmc: fsl_esdhc_imx: add CD support when OF_PLATDATA is enabled Simon Glass
2020-07-22 13:14 ` [PATCH v2 5/6] drivers: rename more drivers to match compatible string Walter Lozano
2020-07-26 14:54 ` Simon Glass
2020-07-22 13:14 ` [PATCH v2 6/6] mx6cuboxi: enable OF_PLATDATA Walter Lozano
2020-07-26 14:54 ` Simon Glass
2020-07-23 1:34 ` [PATCH v2 0/6] mx6cuboxi: enable OF_PLATDATA with MMC support Peng Fan
2020-07-23 2:01 ` Walter Lozano
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=20200722131438.12215-5-walter.lozano@collabora.com \
--to=walter.lozano@collabora.com \
--cc=u-boot@lists.denx.de \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.