Skip to content

Commit 73abb1f

Browse files
cazoustorulf
authored andcommitted
mmc: dw_mmc-rockchip: Add support for rk3576 SoCs
On rk3576 the tunable clocks are inside the controller itself, removing the need for the "ciu-drive" and "ciu-sample" clocks. That makes it a new type of controller that has its own dt_parse function. Signed-off-by: Detlev Casanova <[email protected]> Reviewed-by: Heiko Stuebner <[email protected]> Link: https://lore.kernel.org/r/010201919997044d-c3a008d1-afbc-462f-a928-fc1ece785bdb-000000@eu-west-1.amazonses.com Signed-off-by: Ulf Hansson <[email protected]>
1 parent 5990344 commit 73abb1f

File tree

1 file changed

+43
-5
lines changed

1 file changed

+43
-5
lines changed

drivers/mmc/host/dw_mmc-rockchip.c

Lines changed: 43 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -407,7 +407,7 @@ static int dw_mci_rk3288_execute_tuning(struct dw_mci_slot *slot, u32 opcode)
407407
return ret;
408408
}
409409

410-
static int dw_mci_rk3288_parse_dt(struct dw_mci *host)
410+
static int dw_mci_common_parse_dt(struct dw_mci *host)
411411
{
412412
struct device_node *np = host->dev->of_node;
413413
struct dw_mci_rockchip_priv_data *priv;
@@ -417,13 +417,29 @@ static int dw_mci_rk3288_parse_dt(struct dw_mci *host)
417417
return -ENOMEM;
418418

419419
if (of_property_read_u32(np, "rockchip,desired-num-phases",
420-
&priv->num_phases))
420+
&priv->num_phases))
421421
priv->num_phases = 360;
422422

423423
if (of_property_read_u32(np, "rockchip,default-sample-phase",
424-
&priv->default_sample_phase))
424+
&priv->default_sample_phase))
425425
priv->default_sample_phase = 0;
426426

427+
host->priv = priv;
428+
429+
return 0;
430+
}
431+
432+
static int dw_mci_rk3288_parse_dt(struct dw_mci *host)
433+
{
434+
struct dw_mci_rockchip_priv_data *priv;
435+
int err;
436+
437+
err = dw_mci_common_parse_dt(host);
438+
if (err)
439+
return err;
440+
441+
priv = host->priv;
442+
427443
priv->drv_clk = devm_clk_get(host->dev, "ciu-drive");
428444
if (IS_ERR(priv->drv_clk))
429445
dev_dbg(host->dev, "ciu-drive not available\n");
@@ -432,13 +448,25 @@ static int dw_mci_rk3288_parse_dt(struct dw_mci *host)
432448
if (IS_ERR(priv->sample_clk))
433449
dev_dbg(host->dev, "ciu-sample not available\n");
434450

435-
host->priv = priv;
436-
437451
priv->internal_phase = false;
438452

439453
return 0;
440454
}
441455

456+
static int dw_mci_rk3576_parse_dt(struct dw_mci *host)
457+
{
458+
struct dw_mci_rockchip_priv_data *priv;
459+
int err = dw_mci_common_parse_dt(host);
460+
if (err)
461+
return err;
462+
463+
priv = host->priv;
464+
465+
priv->internal_phase = true;
466+
467+
return 0;
468+
}
469+
442470
static int dw_mci_rockchip_init(struct dw_mci *host)
443471
{
444472
int ret, i;
@@ -480,11 +508,21 @@ static const struct dw_mci_drv_data rk3288_drv_data = {
480508
.init = dw_mci_rockchip_init,
481509
};
482510

511+
static const struct dw_mci_drv_data rk3576_drv_data = {
512+
.common_caps = MMC_CAP_CMD23,
513+
.set_ios = dw_mci_rk3288_set_ios,
514+
.execute_tuning = dw_mci_rk3288_execute_tuning,
515+
.parse_dt = dw_mci_rk3576_parse_dt,
516+
.init = dw_mci_rockchip_init,
517+
};
518+
483519
static const struct of_device_id dw_mci_rockchip_match[] = {
484520
{ .compatible = "rockchip,rk2928-dw-mshc",
485521
.data = &rk2928_drv_data },
486522
{ .compatible = "rockchip,rk3288-dw-mshc",
487523
.data = &rk3288_drv_data },
524+
{ .compatible = "rockchip,rk3576-dw-mshc",
525+
.data = &rk3576_drv_data },
488526
{},
489527
};
490528
MODULE_DEVICE_TABLE(of, dw_mci_rockchip_match);

0 commit comments

Comments
 (0)