rockchip: mmc: rockchip_dw_mmc: fix ciu clock index
Subsystems (2)
PATCH 1/2 rockchip: mmc: rockchip_dw_mmc: fix ciu clock index
The document rockchip-dw-mshc.yaml decribes a maximum of 4 clocks. In the rockchip_dw_mmc driver the clock name in use was "fixed" to "ciu" with index 1, but later reverted back to index 0. The clock drivers can handle both, but the calling driver should submit correct data as a standard practice.
Fix the "ciu" clock index by setting it back to 1.
clock-names:
minItems: 2
items:
- const: biu
- const: ciu
- const: ciu-drive
- const: ciu-sample
--- drivers/mmc/rockchip_dw_mmc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/mmc/rockchip_dw_mmc.c +2 -2
@@ -123,11 +123,11 @@ static int rockchip_dwmmc_probe(struct udevice *dev) priv->minmax[0 ] =400000 ;/* 400 kHz */ priv->minmax[1 ] = dtplat->max_frequency; - ret =clk_get_by_phandle (dev, dtplat->clocks, &priv->clk); + ret =clk_get_by_phandle (dev, &dtplat->clocks[1 ], &priv->clk);if (ret <0 )return ret;#else - ret =clk_get_by_index (dev,0 , &priv->clk); + ret =clk_get_by_index (dev,1 , &priv->clk);if (ret <0 )return ret;#endif
Signature · 1 line
2.20.1
PATCH 2/2 rockchip: mmc: rockchip_dw_mmc: add rk3066/rk3188 support
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.
--- drivers/mmc/rockchip_dw_mmc.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-)
drivers/mmc/rockchip_dw_mmc.c +13 -3
@@ -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)
Signature · 1 line
2.20.1
Re: [PATCH v1 2/2] rockchip: mmc: rockchip_dw_mmc: add rk3066/rk3188 support
Quoted 9 lines · Johan Jonker
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"
Re: [PATCH v1 2/2] rockchip: mmc: rockchip_dw_mmc: add rk3066/rk3188 support
Hi Jagan,
Quoted 7 lines · Jagan Teki
Quoted 6 lines · Johan Jonker
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.
Quoted 7 lines
Quoted 3 lines
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 structuresNo, 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