Skip to content

Commit ff6f028

Browse files
shawn1221Ulf Hansson
authored andcommitted
mmc: dw_mmc-rockchip: Add memory clock auto-gating support
Per design recommendations, the memory clock can be gated when there is no in-flight transfer, which helps save power. This feature is introduced alongside internal phase support, and this patch enables it. Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
1 parent 93daf13 commit ff6f028

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

drivers/mmc/host/dw_mmc-rockchip.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919
#define RK3288_CLKGEN_DIV 2
2020
#define SDMMC_TIMING_CON0 0x130
2121
#define SDMMC_TIMING_CON1 0x134
22+
#define SDMMC_MISC_CON 0x138
23+
#define MEM_CLK_AUTOGATE_ENABLE BIT(5)
2224
#define ROCKCHIP_MMC_DELAY_SEL BIT(10)
2325
#define ROCKCHIP_MMC_DEGREE_MASK 0x3
2426
#define ROCKCHIP_MMC_DEGREE_OFFSET 1
@@ -470,6 +472,7 @@ static int dw_mci_rk3576_parse_dt(struct dw_mci *host)
470472

471473
static int dw_mci_rockchip_init(struct dw_mci *host)
472474
{
475+
struct dw_mci_rockchip_priv_data *priv = host->priv;
473476
int ret, i;
474477

475478
/* It is slot 8 on Rockchip SoCs */
@@ -494,6 +497,9 @@ static int dw_mci_rockchip_init(struct dw_mci *host)
494497
dev_warn(host->dev, "no valid minimum freq: %d\n", ret);
495498
}
496499

500+
if (priv->internal_phase)
501+
mci_writel(host, MISC_CON, MEM_CLK_AUTOGATE_ENABLE);
502+
497503
return 0;
498504
}
499505

0 commit comments

Comments
 (0)