summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorMichael Tretter <m.tretter@pengutronix.de>2021-06-16 09:39:53 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2021-06-16 09:52:13 +0200
commit2778c17f92fbb5ea2451f62ebdd6a74afc938cb2 (patch)
tree32ae002e478e398aaf26c5fd2c9763993e9b701d /drivers
parent0d1ad596030009864f1a97a5e108f97666ac82a5 (diff)
downloadbarebox-2778c17f92fbb5ea2451f62ebdd6a74afc938cb2.tar.gz
barebox-2778c17f92fbb5ea2451f62ebdd6a74afc938cb2.tar.xz
mci: mci-core: respect disable-wp property
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> Link: https://lore.barebox.org/20210616073957.1872965-2-m.tretter@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/mci/mci-core.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/mci/mci-core.c b/drivers/mci/mci-core.c
index a160b98894..a094f3cbf5 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)