[U-Boot] [PATCH v5 14/21] rockchip: mmc: get the fifo mode and fifo depth property from dts
Simon Glass
sjg at chromium.org
Fri Nov 13 19:13:38 CET 2015
Hi Lin,
On 10 November 2015 at 03:24, Lin Huang <hl at rock-chips.com> wrote:
> 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 at rock-chips.com>
> ---
> arch/arm/dts/rk3036.dtsi | 1 +
> drivers/mmc/rockchip_dw_mmc.c | 28 ++++++++++++++++++++++------
> 2 files changed, 23 insertions(+), 6 deletions(-)
>
> diff --git a/arch/arm/dts/rk3036.dtsi b/arch/arm/dts/rk3036.dtsi
> index 0daae1e..ecf5416 100644
> --- a/arch/arm/dts/rk3036.dtsi
> +++ b/arch/arm/dts/rk3036.dtsi
> @@ -257,6 +257,7 @@
> cap-mmc-highspeed;
> mmc-ddr-1_8v;
> disable-wp;
> + fifo-mode;
> non-removable;
> num-slots = <1>;
> default-sample-phase = <158>;
> diff --git a/drivers/mmc/rockchip_dw_mmc.c b/drivers/mmc/rockchip_dw_mmc.c
> index f11c8e0..616e0bb 100644
> --- a/drivers/mmc/rockchip_dw_mmc.c
> +++ b/drivers/mmc/rockchip_dw_mmc.c
> @@ -50,8 +50,10 @@ static int rockchip_dwmmc_ofdata_to_platdata(struct udevice *dev)
> host->get_mmc_clk = rockchip_dwmmc_get_mmc_clk;
> host->priv = dev;
>
> - /* TODO(sjg at chromium.org): Remove the need for this hack */
> - host->dev_index = (ulong)host->ioaddr == 0xff0f0000 ? 0 : 1;
> + /* use non-removeable as sdcard and emmc as judgement */
> + if (fdtdec_lookup_phandle(gd->fdt_blob, dev->of_offset, "non-removable")
> + == -FDT_ERR_NOTFOUND)
> + host->dev_index = 1;
I think this should be a separate patch as it does not relate to your
commit message.
Also can you use fdtdec_get_bool() instead?
>
> return 0;
> }
> @@ -63,6 +65,7 @@ static int rockchip_dwmmc_probe(struct udevice *dev)
> struct dwmci_host *host = &priv->host;
> u32 minmax[2];
> int ret;
> + u32 fifo_depth;
int, I think
>
> priv->grf = syscon_get_first_range(ROCKCHIP_SYSCON_GRF);
> if (IS_ERR(priv->grf))
> @@ -71,10 +74,23 @@ 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)
Cannot be < 0 if u32 - so I think int is better.
> + return -EINVAL;
> +
> + host->fifoth_val = MSIZE(0x2) |
> + RX_WMARK(fifo_depth / 2 - 1) | TX_WMARK(fifo_depth / 2);
> +
> + if (fdtdec_lookup_phandle(gd->fdt_blob, dev->of_offset, "fifo-mode")
> + != -FDT_ERR_NOTFOUND)
fdtdec_get_bool()
> + host->fifo_mode = 1;
host->fifo_mode = true;
> +
> + ret = add_dwmci(host, minmax[1], minmax[0]);
> if (ret)
> return ret;
>
> --
> 1.9.1
>
Regards,
Simon
More information about the U-Boot
mailing list