mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH v2 1/3] mci: core: act upon broken-cd device tree property
@ 2022-09-30 15:33 Ahmad Fatoum
  2022-09-30 15:33 ` [PATCH v2 2/3] mci: core: add broken_cd device parameter Ahmad Fatoum
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Ahmad Fatoum @ 2022-09-30 15:33 UTC (permalink / raw)
  To: barebox; +Cc: mfe, Ahmad Fatoum

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@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




^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2022-10-04  8:55 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-30 15:33 [PATCH v2 1/3] mci: core: act upon broken-cd device tree property Ahmad Fatoum
2022-09-30 15:33 ` [PATCH v2 2/3] mci: core: add broken_cd device parameter Ahmad Fatoum
2022-09-30 15:33 ` [PATCH v2 3/3] mci: core: fixup broken-cd information into kernel DT Ahmad Fatoum
2022-09-30 16:22 ` [PATCH v2 1/3] mci: core: act upon broken-cd device tree property Ahmad Fatoum
2022-10-04  8:53 ` Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox