[PATCH] mci: core: add write_reliable device parameter
Michael Grzeschik
m.grzeschik at pengutronix.de
Tue Oct 8 16:12:28 PDT 2024
Add mmcX.write_reliable parameter so it can be queried by
scripts and board code.
Signed-off-by: Michael Grzeschik <m.grzeschik at pengutronix.de>
---
drivers/mci/mci-core.c | 23 +++++++++++++++++++++++
1 file changed, 23 insertions(+)
diff --git a/drivers/mci/mci-core.c b/drivers/mci/mci-core.c
index 48a3df9ec9..1b7526abfa 100644
--- a/drivers/mci/mci-core.c
+++ b/drivers/mci/mci-core.c
@@ -2680,6 +2680,22 @@ static int mci_get_partition_setting_completed(struct mci *mci)
return ret;
}
+static int mci_get_write_reliable(struct mci *mci)
+{
+ u8 *ext_csd;
+ int ret;
+
+ ext_csd = mci_get_ext_csd(mci);
+ if (IS_ERR(ext_csd))
+ return PTR_ERR(ext_csd);
+
+ ret = ext_csd[EXT_CSD_WR_REL_SET] & 0x1f;
+
+ dma_free(ext_csd);
+
+ return ret;
+}
+
/**
* Probe an MCI card at the given host interface
* @param mci MCI device instance
@@ -2796,6 +2812,13 @@ static int mci_card_probe(struct mci *mci)
"Failed to determine EXT_CSD_PARTITION_SETTING_COMPLETED\n");
else
dev_add_param_bool_fixed(&mci->dev, "partitioning_completed", ret);
+
+ ret = mci_get_write_reliable(mci);
+ if (ret < 0)
+ dev_dbg(&mci->dev,
+ "Failed to determine EXT_CSD_WR_REL_SET\n");
+ else
+ dev_add_param_bool_fixed(&mci->dev, "write_reliable", ret);
}
mci_parse_cid(mci);
--
2.39.5
More information about the barebox
mailing list