aboutsummaryrefslogtreecommitdiff
path: root/drivers/ram
diff options
context:
space:
mode:
authorTom Rini <trini@konsulko.com>2022-03-28 12:36:49 -0400
committerTom Rini <trini@konsulko.com>2022-03-28 12:36:49 -0400
commit34d2b7f20369d62c0f091d6572a8c0ea4655cf14 (patch)
tree0591ee99c118e0e196730b6ec6582986200e6313 /drivers/ram
parent7f0826c169ff14d62e92d02f85d33d0030d45c12 (diff)
parente893e8ea6a5d3af312747d00f93587559193a426 (diff)
downloadu-boot-34d2b7f20369d62c0f091d6572a8c0ea4655cf14.zip
u-boot-34d2b7f20369d62c0f091d6572a8c0ea4655cf14.tar.gz
u-boot-34d2b7f20369d62c0f091d6572a8c0ea4655cf14.tar.bz2
Merge tag 'v2022.04-rc5' into next
Prepare v2022.04-rc5
Diffstat (limited to 'drivers/ram')
-rw-r--r--drivers/ram/rockchip/sdram_rk3188.c2
-rw-r--r--drivers/ram/rockchip/sdram_rk3288.c2
-rw-r--r--drivers/ram/stm32mp1/stm32mp1_ddr.c25
-rw-r--r--drivers/ram/stm32mp1/stm32mp1_ddr_regs.h6
4 files changed, 33 insertions, 2 deletions
diff --git a/drivers/ram/rockchip/sdram_rk3188.c b/drivers/ram/rockchip/sdram_rk3188.c
index d9ed8ad..be8ba44 100644
--- a/drivers/ram/rockchip/sdram_rk3188.c
+++ b/drivers/ram/rockchip/sdram_rk3188.c
@@ -762,7 +762,7 @@ static int sdram_init(struct dram_info *dram,
* CS1, n=2
* CS0 & CS1, n = 3
*/
- sdram_params->ch[channel].rank = 2,
+ sdram_params->ch[channel].rank = 2;
clrsetbits_le32(&publ->pgcr, 0xF << 18,
(sdram_params->ch[channel].rank | 1) << 18);
diff --git a/drivers/ram/rockchip/sdram_rk3288.c b/drivers/ram/rockchip/sdram_rk3288.c
index f3e4a28..227a3cc 100644
--- a/drivers/ram/rockchip/sdram_rk3288.c
+++ b/drivers/ram/rockchip/sdram_rk3288.c
@@ -862,7 +862,7 @@ static int sdram_init(struct dram_info *dram,
* CS1, n=2
* CS0 & CS1, n = 3
*/
- sdram_params->ch[channel].rank = 2,
+ sdram_params->ch[channel].rank = 2;
clrsetbits_le32(&publ->pgcr, 0xF << 18,
(sdram_params->ch[channel].rank | 1) << 18);
diff --git a/drivers/ram/stm32mp1/stm32mp1_ddr.c b/drivers/ram/stm32mp1/stm32mp1_ddr.c
index 4d78aa5..528a171 100644
--- a/drivers/ram/stm32mp1/stm32mp1_ddr.c
+++ b/drivers/ram/stm32mp1/stm32mp1_ddr.c
@@ -27,6 +27,8 @@
#define RCC_DDRITFCR_DPHYAPBRST (BIT(17))
#define RCC_DDRITFCR_DPHYRST (BIT(18))
#define RCC_DDRITFCR_DPHYCTLRST (BIT(19))
+#define RCC_DDRITFCR_DDRCKMOD_MASK GENMASK(22, 20)
+#define RCC_DDRITFCR_DDRCKMOD_ASR BIT(20)
struct reg_desc {
const char *name;
@@ -651,6 +653,26 @@ static void stm32mp1_refresh_restore(struct stm32mp1_ddrctl *ctl,
wait_sw_done_ack(ctl);
}
+static void stm32mp1_asr_enable(struct ddr_info *priv)
+{
+ struct stm32mp1_ddrctl *ctl = priv->ctl;
+
+ clrsetbits_le32(priv->rcc + RCC_DDRITFCR, RCC_DDRITFCR_DDRCKMOD_MASK,
+ RCC_DDRITFCR_DDRCKMOD_ASR);
+
+ start_sw_done(ctl);
+
+ setbits_le32(&ctl->hwlpctl, DDRCTRL_HWLPCTL_HW_LP_EN);
+ writel(DDRCTRL_PWRTMG_POWERDOWN_TO_X32(0x10) |
+ DDRCTRL_PWRTMG_SELFREF_TO_X32(0x01),
+ &ctl->pwrtmg);
+ setbits_le32(&ctl->pwrctl, DDRCTRL_PWRCTL_EN_DFI_DRAM_CLK_DISABLE);
+ setbits_le32(&ctl->pwrctl, DDRCTRL_PWRCTL_SELFREF_EN);
+
+ setbits_le32(&ctl->dfimisc, DDRCTRL_DFIMISC_DFI_INIT_COMPLETE_EN);
+ wait_sw_done_ack(ctl);
+}
+
/* board-specific DDR power initializations. */
__weak int board_ddr_power_init(enum ddr_type ddr_type)
{
@@ -822,6 +844,9 @@ start:
stm32mp1_refresh_restore(priv->ctl, config->c_reg.rfshctl3,
config->c_reg.pwrctl);
+/* Enable auto-self-refresh, which saves a bit of power at runtime. */
+ stm32mp1_asr_enable(priv);
+
/* enable uMCTL2 AXI port 0 and 1 */
setbits_le32(&priv->ctl->pctrl_0, DDRCTRL_PCTRL_N_PORT_EN);
setbits_le32(&priv->ctl->pctrl_1, DDRCTRL_PCTRL_N_PORT_EN);
diff --git a/drivers/ram/stm32mp1/stm32mp1_ddr_regs.h b/drivers/ram/stm32mp1/stm32mp1_ddr_regs.h
index f1a26e3..42be1ba 100644
--- a/drivers/ram/stm32mp1/stm32mp1_ddr_regs.h
+++ b/drivers/ram/stm32mp1/stm32mp1_ddr_regs.h
@@ -265,8 +265,14 @@ struct stm32mp1_ddrphy {
#define DDRCTRL_PWRCTL_SELFREF_EN BIT(0)
#define DDRCTRL_PWRCTL_POWERDOWN_EN BIT(1)
+#define DDRCTRL_PWRCTL_EN_DFI_DRAM_CLK_DISABLE BIT(3)
#define DDRCTRL_PWRCTL_SELFREF_SW BIT(5)
+#define DDRCTRL_PWRTMG_SELFREF_TO_X32(n) (((n) & 0xff) << 16)
+#define DDRCTRL_PWRTMG_POWERDOWN_TO_X32(n) ((n) & 0x1f)
+
+#define DDRCTRL_HWLPCTL_HW_LP_EN BIT(0)
+
#define DDRCTRL_RFSHCTL3_DIS_AUTO_REFRESH BIT(0)
#define DDRCTRL_RFSHTMG_T_RFC_NOM_X1_X32_MASK GENMASK(27, 16)