[OpenWrt-Devel] [PATCH] ramips: mmc: Read mmc-caps from dt with mmc_of_parse
Benedikt-Alexander Mokroß
openwrt at bamkrs.de
Mon Apr 27 04:40:56 EDT 2020
The original mmc-driver for ramips used hardcoded mmc-caps.
This patch removes the hardcoded caps and enables dt parsing with
mmc_of_parse.
Signed-off-by: Benedikt-Alexander Mokroß <openwrt at bamkrs.de>
---
.../ramips/files/drivers/mmc/host/mtk-mmc/sd.c | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
diff --git a/target/linux/ramips/files/drivers/mmc/host/mtk-mmc/sd.c
b/target/linux/ramips/files/drivers/mmc/host/mtk-mmc/sd.c
index 8cbc87da3a..c027526118 100644
--- a/target/linux/ramips/files/drivers/mmc/host/mtk-mmc/sd.c
+++ b/target/linux/ramips/files/drivers/mmc/host/mtk-mmc/sd.c
@@ -2235,10 +2235,19 @@ static int msdc_drv_probe(struct platform_device
*pdev)
mmc->f_max = HOST_MAX_MCLK;
mmc->ocr_avail = MSDC_OCR_AVAIL;
- mmc->caps = MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED;
+ ret = mmc_of_parse(mmc);
+ if (ret)
+ goto release;
- //TODO: read this as bus-width from dt (via mmc_of_parse)
- mmc->caps |= MMC_CAP_4_BIT_DATA;
+ if (mmc->f_max > HOST_MAX_MCLK) {
+ dev_warn(mmc->parent,
+ "\"max-frequency\" property greater than max-frequency of %d, using
%d.\n",
+ HOST_MAX_MCLK, HOST_MAX_MCLK);
+ mmc->f_max = HOST_MAX_MCLK;
+ }
+
+ /* It seems these caps must be set regardles of the dt */
+ mmc->caps = MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED;
cd_active_low = !of_property_read_bool(pdev->dev.of_node,
"mediatek,cd-high");
--
2.20.1
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel
More information about the openwrt-devel
mailing list