[PATCH v2 1/3] mci: core: act upon broken-cd device tree property
Ahmad Fatoum
a.fatoum at pengutronix.de
Fri Sep 30 08:33:15 PDT 2022
We didn't care much for broken-cd so far, still we have some drivers
implementing the card_present callback, which we should ignore when
card-detect is marked broken.
Signed-off-by: Ahmad Fatoum <a.fatoum at pengutronix.de>
---
v1 -> v2:
- new patch
---
drivers/mci/mci-core.c | 12 ++++++++----
include/mci.h | 1 +
2 files changed, 9 insertions(+), 4 deletions(-)
diff --git a/drivers/mci/mci-core.c b/drivers/mci/mci-core.c
index 8c08a4f61f63..5f4457bab3df 100644
--- a/drivers/mci/mci-core.c
+++ b/drivers/mci/mci-core.c
@@ -1750,10 +1750,13 @@ static int mci_card_probe(struct mci *mci)
int i, rc, disknum, ret;
bool has_bootpart = false;
- if (host->card_present && !host->card_present(host) &&
- !host->non_removable) {
- dev_err(&mci->dev, "no card inserted\n");
- return -ENODEV;
+ if (host->card_present && !host->card_present(host) && !host->non_removable) {
+ if (!host->broken_cd) {
+ dev_err(&mci->dev, "no card inserted\n");
+ return -ENODEV;
+ }
+
+ dev_info(&mci->dev, "no card inserted (ignoring)\n");
}
ret = regulator_enable(host->supply);
@@ -2043,6 +2046,7 @@ void mci_of_parse_node(struct mci_host *host,
}
}
+ host->broken_cd = of_property_read_bool(np, "broken-cd");
host->non_removable = of_property_read_bool(np, "non-removable");
host->no_sd = of_property_read_bool(np, "no-sd");
host->disable_wp = of_property_read_bool(np, "disable-wp");
diff --git a/include/mci.h b/include/mci.h
index 2098b4fbf084..d949310fac30 100644
--- a/include/mci.h
+++ b/include/mci.h
@@ -404,6 +404,7 @@ struct mci_host {
unsigned max_req_size;
unsigned dsr_val; /**< optional dsr value */
int use_dsr; /**< optional dsr usage flag */
+ int broken_cd; /**< card detect is broken */
bool non_removable; /**< device is non removable */
bool no_sd; /**< do not send SD commands during initialization */
bool disable_wp; /**< ignore write-protect detection logic */
--
2.30.2
More information about the barebox
mailing list