From: Walter Lozano <walter.lozano@collabora.com>
To: u-boot@lists.denx.de
Subject: [PATCH v3 4/6] mmc: fsl_esdhc_imx: add CD support when OF_PLATDATA is enabled
Date: Wed, 29 Jul 2020 12:31:19 -0300 [thread overview]
Message-ID: <20200729153121.29548-5-walter.lozano@collabora.com> (raw)
In-Reply-To: <20200729153121.29548-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>
Reviewed-by: Simon Glass <sjg@chromium.org>
---
Changes in v3:
- Change #ifdef to if when possible
drivers/mmc/fsl_esdhc_imx.c | 25 ++++++++++++++++++++++++-
1 file changed, 24 insertions(+), 1 deletion(-)
diff --git a/drivers/mmc/fsl_esdhc_imx.c b/drivers/mmc/fsl_esdhc_imx.c
index 2713682cf7..788677984b 100644
--- a/drivers/mmc/fsl_esdhc_imx.c
+++ b/drivers/mmc/fsl_esdhc_imx.c
@@ -1498,7 +1498,30 @@ 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) && !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
if (data)
--
2.20.1
next prev parent reply other threads:[~2020-07-29 15:31 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-29 15:31 [PATCH v3 0/6] mx6cuboxi: enable OF_PLATDATA with MMC support Walter Lozano
2020-07-29 15:31 ` [PATCH v3 1/6] mmc: fsl_esdhc_imx: rename driver name to match ll_entry Walter Lozano
2020-08-04 8:52 ` sbabic at denx.de
2020-07-29 15:31 ` [PATCH v3 2/6] mmc: fsl_esdhc_imx: add OF_PLATDATA support Walter Lozano
2020-08-04 8:52 ` sbabic at denx.de
2020-07-29 15:31 ` [PATCH v3 3/6] gpio: mxc_gpio: " Walter Lozano
2020-08-04 8:52 ` sbabic at denx.de
2020-07-29 15:31 ` Walter Lozano [this message]
2020-08-04 8:52 ` [PATCH v3 4/6] mmc: fsl_esdhc_imx: add CD support when OF_PLATDATA is enabled sbabic at denx.de
2020-07-29 15:31 ` [PATCH v3 5/6] drivers: rename more drivers to match compatible string Walter Lozano
2020-08-04 8:52 ` sbabic at denx.de
2020-07-29 15:31 ` [PATCH v3 6/6] mx6cuboxi: enable OF_PLATDATA Walter Lozano
2020-08-04 8:52 ` sbabic at denx.de
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=20200729153121.29548-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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox