From 2778c17f92fbb5ea2451f62ebdd6a74afc938cb2 Mon Sep 17 00:00:00 2001 From: Michael Tretter Date: Wed, 16 Jun 2021 09:39:53 +0200 Subject: 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 Link: https://lore.barebox.org/20210616073957.1872965-2-m.tretter@pengutronix.de Signed-off-by: Sascha Hauer --- drivers/mci/mci-core.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'drivers/mci') 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) -- cgit v1.2.3