[PATCH v4 09/12] rockchip: mmc: rockchip_dw_mmc: add rk3066/rk3188 support
Johan Jonker
jbx6244 at gmail.com
Wed Apr 6 17:29:34 CEST 2022
Hi,
On 4/6/22 16:50, Kever Yang wrote:
> Hi Johan,
>
> On 2022/4/4 07:06, 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
>> can't be used to switch it on.
>
> There is an option "u-boot,spl-fifo-mode", which already used for many
> SoCs,
>
> could you try with it?
Rk3066 SPL makes use of dt-plat.c to describe the DT, because of memory
size and it's BOOTROM doesn't have build-in SD card support like the
later models.
u-boot-tpl.bin : 25,112 bytes
u-boot-spl.bin : 39,280 bytes
u-boot-dtb.img : 328,678 bytes
Example rockchip_dwmmc_probe function:
old:
priv->fifo_mode = 0;
vs.
new:
priv->fifo_mode = dtplat->u_boot_spl_fifo_mode
The use of u_boot_spl_fifo_mode in C code would make it a requirement
for other SoC types to include it in "static struct
dtd_rockchip_rk3288_dw_mshc" as well:
.u_boot_spl_fifo_mode = false,
Please advise how to get progress here as.
Kind regards,
Johan
===
static struct dtd_rockchip_rk3288_dw_mshc dtv_mmc_at_10214000 = {
.bus_width = 0x4,
.cap_mmc_highspeed = true,
.cap_sd_highspeed = true,
.clock_frequency = 0x2faf080,
.clocks = {
{0, {448}},
{0, {72}},},
.dma_names = "rx-tx",
.dmas = {0xa, 0x1},
.fifo_depth = 0x100,
.fifo_mode = true,
.max_frequency = 0x3d0900,
.reg = {0x10214000, 0x1000},
.reset_names = "reset",
.resets = {0x2, 0x51},
.u_boot_spl_fifo_mode = true,
.vmmc_supply = 0xf,
};
U_BOOT_DRVINFO(mmc_at_10214000) = {
.name = "rockchip_rk3288_dw_mshc",
.plat = &dtv_mmc_at_10214000,
.plat_size = sizeof(dtv_mmc_at_10214000),
.parent_idx = -1,
};
>
>
> Thanks,
>
> - Kever
>
>> Add a data structure linked to the compatible string
>> to enable.
>>
>> Signed-off-by: Johan Jonker <jbx6244 at gmail.com>
>> ---
>>
>> Changed V4:
>> use boolean
>> ---
>> 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 be065ec0c3..45488dd7bd 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 = true;
>> + else
>> + priv->fifo_mode = false;
>> 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)
More information about the U-Boot
mailing list