rcar_gen3: plat: Clean up rcar_pwrc_code_copy_to_system_ram()
authorMarek Vasut <marek.vasut+renesas@gmail.com>
Mon, 31 Dec 2018 16:12:45 +0000 (17:12 +0100)
committerMarek Vasut <marek.vasut+renesas@gmail.com>
Tue, 8 Jan 2019 13:08:44 +0000 (14:08 +0100)
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 <marek.vasut+renesas@gmail.com>
drivers/renesas/rcar/pwrc/pwrc.c
plat/renesas/rcar/bl31_plat_setup.c
plat/renesas/rcar/plat_pm.c

index 8cdfe75e54079e90ffb965d1f4fb15ecadfde717..c01a1de9b6adb78eb8d36ca02fd85e4d6aac9250 100644 (file)
@@ -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);
index c648a07057e1fe4b39fbe0769e48e12a660f5ac0..4e08b5a82ad4c170f0f2476bc91abc1d728f475e 100644 (file)
@@ -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)
index 7086613f82e599b7707ee0743a1335f29247da59..dbf3ac54ded5b6b65251db734b7980b867f5c644 100644 (file)
@@ -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