27/04/2020 10:40, Benedikt-Alexander Mokroß:
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ß <[email protected]>
---
  .../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");


While the commit message mentions the removal of multiple hardcoded caps, it's only MMC_CAP_4_BIT_DATA as far as I can see.

Now that the hardcoded MMC_CAP_4_BIT_DATA is gone, the bus-width property need to be added to all existing devicetree source files using the driver, to keep the former behaviour.

With the switch to the common mmc binding, at least the mediatek,cd-high property can be replaced by their mmc binding equivalent "cd-inverted".

Mathias

_______________________________________________
openwrt-devel mailing list
[email protected]
https://lists.openwrt.org/mailman/listinfo/openwrt-devel

Reply via email to