Message ID | 20220107183406.1804-2-jbx6244@gmail.com |
---|---|
State | Superseded |
Delegated to: | Kever Yang |
Headers | show |
Series | [v1,1/2] rockchip: mmc: rockchip_dw_mmc: fix ciu clock index | expand |
On Sat, Jan 8, 2022 at 12:04 AM Johan Jonker <jbx6244@gmail.com> wrote: > > The Rockchip SoCs rk3066/rk3188 have mmc DT nodes > with as compatible string "rockchip,rk2928-dw-mshc". > Add support to the existing driver with help of > a DM_DRIVER_ALIAS. > > This type needs a permanent enabled fifo. > The other Rockchip SoCs not always have the property > "fifo-mode" in the TPL/SPL DT nodes, so dtplat structures No, it is not true. we have property for spl/tpl to enable that. "u-boot,spl-fifo-mode"
Hi Jagan, On 3/12/22 10:02, Jagan Teki wrote: > On Sat, Jan 8, 2022 at 12:04 AM Johan Jonker <jbx6244@gmail.com> wrote: >> >> The Rockchip SoCs rk3066/rk3188 have mmc DT nodes >> with as compatible string "rockchip,rk2928-dw-mshc". >> Add support to the existing driver with help of >> a DM_DRIVER_ALIAS. >> >> This type needs a permanent enabled fifo. >> The other Rockchip SoCs not always have the property >> "fifo-mode" in the TPL/SPL DT nodes, so dtplat structures > > No, it is not true. we have property for spl/tpl to enable that. > "u-boot,spl-fifo-mode" This is not usable for rk3066/rk3188 and OF_PLATDATA in combination with c code as there's no guaranty that other models have this property in the dtplat structure. It's about finding a solution for disabling fifo-mode and OF_PLATDATA. There's also a V2 with a more generic approach. Could you have a look at it as well. Whatever which method is preferred. #if CONFIG_IS_ENABLED(OF_PLATDATA) struct dtd_rockchip_rk3288_dw_mshc dtplat; #endif Johan
diff --git a/drivers/mmc/rockchip_dw_mmc.c b/drivers/mmc/rockchip_dw_mmc.c index be065ec0..5fdfcef2 100644 --- a/drivers/mmc/rockchip_dw_mmc.c +++ b/drivers/mmc/rockchip_dw_mmc.c @@ -19,6 +19,11 @@ #include <linux/delay.h> #include <linux/err.h> +enum rockchip_dwmmc_type { + RK2928_MSHC, + RK3288_MSHC, +}; + struct rockchip_mmc_plat { #if CONFIG_IS_ENABLED(OF_PLATDATA) struct dtd_rockchip_rk3288_dw_mshc dtplat; @@ -111,6 +116,7 @@ static int rockchip_dwmmc_probe(struct udevice *dev) #if CONFIG_IS_ENABLED(OF_PLATDATA) struct dtd_rockchip_rk3288_dw_mshc *dtplat = &plat->dtplat; + enum rockchip_dwmmc_type type = dev_get_driver_data(dev); host->name = dev->name; host->ioaddr = map_sysmem(dtplat->reg[0], dtplat->reg[1]); @@ -119,7 +125,10 @@ static int rockchip_dwmmc_probe(struct udevice *dev) host->priv = dev; host->dev_index = 0; priv->fifo_depth = dtplat->fifo_depth; - priv->fifo_mode = 0; + if (type == RK2928_MSHC) + priv->fifo_mode = 1; + else + priv->fifo_mode = 0; priv->minmax[0] = 400000; /* 400 kHz */ priv->minmax[1] = dtplat->max_frequency; @@ -163,8 +172,8 @@ static int rockchip_dwmmc_bind(struct udevice *dev) } static const struct udevice_id rockchip_dwmmc_ids[] = { - { .compatible = "rockchip,rk2928-dw-mshc" }, - { .compatible = "rockchip,rk3288-dw-mshc" }, + { .compatible = "rockchip,rk2928-dw-mshc", .data = RK2928_MSHC }, + { .compatible = "rockchip,rk3288-dw-mshc", .data = RK3288_MSHC }, { } }; @@ -180,5 +189,6 @@ U_BOOT_DRIVER(rockchip_rk3288_dw_mshc) = { .plat_auto = sizeof(struct rockchip_mmc_plat), }; +DM_DRIVER_ALIAS(rockchip_rk3288_dw_mshc, rockchip_rk2928_dw_mshc) DM_DRIVER_ALIAS(rockchip_rk3288_dw_mshc, rockchip_rk3328_dw_mshc) DM_DRIVER_ALIAS(rockchip_rk3288_dw_mshc, rockchip_rk3368_dw_mshc)
The Rockchip SoCs rk3066/rk3188 have mmc DT nodes with as compatible string "rockchip,rk2928-dw-mshc". Add support to the existing driver with help of a DM_DRIVER_ALIAS. This type needs a permanent enabled fifo. The other Rockchip SoCs not always have the property "fifo-mode" in the TPL/SPL DT nodes, so dtplat structures can't be used to switch it on. Add a data structure linked to the compatible string to enable. Signed-off-by: Johan Jonker <jbx6244@gmail.com> --- drivers/mmc/rockchip_dw_mmc.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-)