]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
rockchip: mmc: get the fifo mode and fifo depth property from dts
authorhuang lin <hl@rock-chips.com>
Tue, 17 Nov 2015 06:20:24 +0000 (14:20 +0800)
committerSimon Glass <sjg@chromium.org>
Tue, 1 Dec 2015 15:07:22 +0000 (08:07 -0700)
rk3036 mmc do not have internal dma, so we use fifo mode when read
and write data, we get the fifo mode and fifo depth property from
dts, pass to dw_mmc driver.

Signed-off-by: Lin Huang <hl@rock-chips.com>
arch/arm/dts/rk3036.dtsi
drivers/mmc/rockchip_dw_mmc.c

index 0daae1ec309663b6fa5bf2a7a53b26518bc9747c..ecf54163185f1b7081718c1d03601f5e10e40b87 100644 (file)
                cap-mmc-highspeed;
                mmc-ddr-1_8v;
                disable-wp;
+               fifo-mode;
                non-removable;
                num-slots = <1>;
                default-sample-phase = <158>;
index dfe20f90f5d5dc688e7a16b3a2fbe6517d9f70ab..aeaec6c86588ce3ac7e86e21daef708f74c0775c 100644 (file)
@@ -64,6 +64,7 @@ static int rockchip_dwmmc_probe(struct udevice *dev)
        struct dwmci_host *host = &priv->host;
        u32 minmax[2];
        int ret;
+       int fifo_depth;
 
        priv->grf = syscon_get_first_range(ROCKCHIP_SYSCON_GRF);
        if (IS_ERR(priv->grf))
@@ -72,10 +73,22 @@ static int rockchip_dwmmc_probe(struct udevice *dev)
        if (ret)
                return ret;
 
-       ret = fdtdec_get_int_array(gd->fdt_blob, dev->of_offset,
-                                  "clock-freq-min-max", minmax, 2);
-       if (!ret)
-               ret = add_dwmci(host, minmax[1], minmax[0]);
+       if (fdtdec_get_int_array(gd->fdt_blob, dev->of_offset,
+                                "clock-freq-min-max", minmax, 2))
+               return -EINVAL;
+
+       fifo_depth = fdtdec_get_int(gd->fdt_blob, dev->of_offset,
+                                   "fifo-depth", 0);
+       if (fifo_depth < 0)
+               return -EINVAL;
+
+       host->fifoth_val = MSIZE(0x2) |
+               RX_WMARK(fifo_depth / 2 - 1) | TX_WMARK(fifo_depth / 2);
+
+       if (fdtdec_get_bool(gd->fdt_blob, dev->of_offset, "fifo-mode"))
+               host->fifo_mode = true;
+
+       ret = add_dwmci(host, minmax[1], minmax[0]);
        if (ret)
                return ret;