From b51a773ec334f2068a481c79a21b2c314fe9125d Mon Sep 17 00:00:00 2001 From: Marek Vasut Date: Mon, 31 Dec 2018 17:12:45 +0100 Subject: [PATCH] rcar_gen3: plat: Clean up rcar_pwrc_code_copy_to_system_ram() Call the function only from architecture setup and at the end of suspend cycle instead of calling it all over the place. Signed-off-by: Marek Vasut --- drivers/renesas/rcar/pwrc/pwrc.c | 5 ----- plat/renesas/rcar/bl31_plat_setup.c | 1 + plat/renesas/rcar/plat_pm.c | 5 +---- 3 files changed, 2 insertions(+), 9 deletions(-) diff --git a/drivers/renesas/rcar/pwrc/pwrc.c b/drivers/renesas/rcar/pwrc/pwrc.c index 8cdfe75e..c01a1de9 100644 --- a/drivers/renesas/rcar/pwrc/pwrc.c +++ b/drivers/renesas/rcar/pwrc/pwrc.c @@ -650,7 +650,6 @@ void rcar_pwrc_set_suspend_to_ram(void) DEVICE_SRAM_STACK_SIZE); uint32_t sctlr; - rcar_pwrc_code_copy_to_system_ram(); rcar_pwrc_save_generic_timer(rcar_stack_generic_timer); /* disable MMU */ @@ -665,10 +664,7 @@ void rcar_pwrc_init_suspend_to_ram(void) { #if PMIC_ROHM_BD9571 uint8_t mode; -#endif - rcar_pwrc_code_copy_to_system_ram(); -#if PMIC_ROHM_BD9571 if (rcar_iic_dvfs_receive(PMIC, PMIC_BKUP_MODE_CNT, &mode)) panic(); @@ -683,7 +679,6 @@ void rcar_pwrc_suspend_to_ram(void) #if RCAR_SYSTEM_RESET_KEEPON_DDR int32_t error; - rcar_pwrc_code_copy_to_system_ram(); error = rcar_iic_dvfs_send(PMIC, REG_KEEP10, 0); if (error) { ERROR("Failed send KEEP10 init ret=%d \n", error); diff --git a/plat/renesas/rcar/bl31_plat_setup.c b/plat/renesas/rcar/bl31_plat_setup.c index c648a070..4e08b5a8 100644 --- a/plat/renesas/rcar/bl31_plat_setup.c +++ b/plat/renesas/rcar/bl31_plat_setup.c @@ -100,6 +100,7 @@ void bl31_plat_arch_setup(void) , BL31_COHERENT_RAM_BASE, BL31_COHERENT_RAM_LIMIT #endif ); + rcar_pwrc_code_copy_to_system_ram(); } void bl31_platform_setup(void) diff --git a/plat/renesas/rcar/plat_pm.c b/plat/renesas/rcar/plat_pm.c index 7086613f..dbf3ac54 100644 --- a/plat/renesas/rcar/plat_pm.c +++ b/plat/renesas/rcar/plat_pm.c @@ -155,6 +155,7 @@ static void rcar_pwr_domain_suspend_finish(const psci_power_state_t write_cntfrq_el0(plat_get_syscnt_freq2()); mmio_write_32(RCAR_CNTC_BASE + CNTCR_OFF, CNTCR_FCREQ(U(0)) | CNTCR_EN); rcar_pwrc_setup(); + rcar_pwrc_code_copy_to_system_ram(); #if RCAR_SYSTEM_SUSPEND rcar_pwrc_init_suspend_to_ram(); @@ -167,11 +168,9 @@ static void __dead2 rcar_system_off(void) { #if PMIC_ROHM_BD9571 #if PMIC_LEVEL_MODE - rcar_pwrc_code_copy_to_system_ram(); if (rcar_iic_dvfs_send(PMIC, DVFS_SET_VID, DVFS_SET_VID_0V)) ERROR("BL3-1:Failed the SYSTEM-OFF.\n"); #else - rcar_pwrc_code_copy_to_system_ram(); if (rcar_iic_dvfs_send(PMIC, BKUP_MODE_CNT, P_ALL_OFF)) ERROR("BL3-1:Failed the SYSTEM-RESET.\n"); #endif @@ -204,7 +203,6 @@ static void __dead2 rcar_system_reset(void) uint8_t mode; int32_t error; - rcar_pwrc_code_copy_to_system_ram(); error = rcar_iic_dvfs_send(PMIC, REG_KEEP10, KEEP10_MAGIC); if (error) { ERROR("Failed send KEEP10 magic ret=%d \n", error); @@ -227,7 +225,6 @@ static void __dead2 rcar_system_reset(void) rcar_pwrc_set_suspend_to_ram(); done: #else - rcar_pwrc_code_copy_to_system_ram(); if (rcar_iic_dvfs_send(PMIC, BKUP_MODE_CNT, P_ALL_OFF)) ERROR("BL3-1:Failed the SYSTEM-RESET.\n"); #endif -- 2.30.2