Re: [PATCH v1 2/2] rockchip: mmc: rockchip_dw_mmc: add rk3066/rk3188 support

2022-03-12 Thread Johan Jonker
Hi Jagan,

On 3/12/22 10:02, Jagan Teki wrote:
> On Sat, Jan 8, 2022 at 12:04 AM Johan Jonker  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


Re: [PATCH v1 2/2] rockchip: mmc: rockchip_dw_mmc: add rk3066/rk3188 support

2022-03-12 Thread Jagan Teki
On Sat, Jan 8, 2022 at 12:04 AM Johan Jonker  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"


[PATCH v1 2/2] rockchip: mmc: rockchip_dw_mmc: add rk3066/rk3188 support

2022-01-07 Thread 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
can't be used to switch it on.
Add a data structure linked to the compatible string
to enable.

Signed-off-by: Johan Jonker 
---
 drivers/mmc/rockchip_dw_mmc.c | 16 +---
 1 file changed, 13 insertions(+), 3 deletions(-)

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 
 #include 
 
+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 = >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] = 40;  /*  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)
-- 
2.20.1