From: Michael Tretter <m.tretter@pengutronix.de>
To: barebox@lists.infradead.org
Cc: Michael Graichen <michael.graichen@hotmail.com>
Subject: [PATCH 1/5] mci: mci-core: respect disable-wp property
Date: Wed, 16 Jun 2021 09:39:53 +0200 [thread overview]
Message-ID: <20210616073957.1872965-2-m.tretter@pengutronix.de> (raw)
In-Reply-To: <20210616073957.1872965-1-m.tretter@pengutronix.de>
Systems without write-protect pin should ignore the write protect logic
and assume that an SD card is always read-write. This is expressed by
the disable-wp dt property.
Respect the disable-wp property and don't call the write protection
check in these cases.
Signed-off-by: Michael Tretter <m.tretter@pengutronix.de>
---
drivers/mci/mci-core.c | 4 +++-
include/mci.h | 1 +
2 files changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/mci/mci-core.c b/drivers/mci/mci-core.c
index a160b9889459..a094f3cbf522 100644
--- a/drivers/mci/mci-core.c
+++ b/drivers/mci/mci-core.c
@@ -1358,7 +1358,8 @@ static int __maybe_unused mci_sd_write(struct block_device *blk,
mci_blk_part_switch(part);
- if (host->card_write_protected && host->card_write_protected(host)) {
+ if (!host->disable_wp &&
+ host->card_write_protected && host->card_write_protected(host)) {
dev_err(&mci->dev, "card write protected\n");
return -EPERM;
}
@@ -2016,6 +2017,7 @@ void mci_of_parse_node(struct mci_host *host,
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");
}
void mci_of_parse(struct mci_host *host)
diff --git a/include/mci.h b/include/mci.h
index df2437f6181b..922aeaecf3de 100644
--- a/include/mci.h
+++ b/include/mci.h
@@ -406,6 +406,7 @@ struct mci_host {
int use_dsr; /**< optional dsr usage flag */
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 */
struct regulator *supply;
/** init the host interface */
--
2.29.2
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
next prev parent reply other threads:[~2021-06-16 7:41 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-06-16 7:39 [PATCH 0/5] Cleanup and fix arasan-sdhci Michael Tretter
2021-06-16 7:39 ` Michael Tretter [this message]
2021-06-16 7:39 ` [PATCH 2/5] mci: arasan: fix most checkpatch warnings Michael Tretter
2021-06-16 7:39 ` [PATCH 3/5] mci: arasan: remove duplicate stop clock Michael Tretter
2021-06-16 7:39 ` [PATCH 4/5] mci: arasan: wait for XFER_COMPLETE for busy response Michael Tretter
2021-06-16 7:39 ` [PATCH 5/5] ARM: zynqmp: defconfig: enable MCI_ARASAN Michael Tretter
2021-06-16 7:52 ` [PATCH 0/5] Cleanup and fix arasan-sdhci Sascha Hauer
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=20210616073957.1872965-2-m.tretter@pengutronix.de \
--to=m.tretter@pengutronix.de \
--cc=barebox@lists.infradead.org \
--cc=michael.graichen@hotmail.com \
/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