mx7_common: use psci 1.0 instead of 0.1
Subsystems (3)
PATCH v3 1/3 mx7_common: use psci 1.0 instead of 0.1
Use PSCI 1.0 instead of 0.1 to support more power management feature like system reset, power off etc..
--- include/configs/mx7_common.h | 2 ++ 1 file changed, 2 insertions(+)
include/configs/mx7_common.h +2 -0
@@ -62,6 +62,8 @@#define CONFIG_ARMV7_SECURE_BASE 0x00900000 +#define CONFIG_ARMV7_PSCI_1_0 +/* Secure boot (HAB) support */ #ifdef CONFIG_SECURE_BOOT #define CONFIG_CSF_SIZE 0x2000
Signature · 1 line
1.9.1
PATCH v3 2/3 imx: mx7: psci: add system reset support
Add i.MX7 PSCI system reset support, linux
kernel can use "reboot" command to reset
system even wdog driver is disabled in kernel.
--- arch/arm/mach-imx/mx7/psci-mx7.c | 15 ++++++++++++++- arch/arm/mach-imx/mx7/psci.S | 7 +++++++ 2 files changed, 21 insertions(+), 1 deletion(-)
arch/arm/mach-imx/mx7/psci-mx7.c +14 -1
@@ -10,7 +10,7 @@#include <asm/secure.h> #include <asm/arch/imx-regs.h> #include <common.h> - +#include <fsl_wdog.h> #define GPC_CPU_PGC_SW_PDN_REQ 0xfc#define GPC_CPU_PGC_SW_PUP_REQ 0xf0
@@ -26,6 +26,9 @@#define BP_SRC_A7RCR0_A7_CORE_RESET0 0#define BP_SRC_A7RCR1_A7_CORE1_ENABLE 1 +#define CCM_ROOT_WDOG 0xbb80 +#define CCM_CCGR_WDOG1 0x49c0 +static inline void imx_gpcv2_set_m_core_pgc (bool enable,u32 offset) {writel (enable,GPC_IPS_BASE_ADDR + offset);
@@ -74,3 +77,13 @@ __secure int imx_cpu_off(int cpu)writel (0 ,SRC_BASE_ADDR + cpu *8 +SRC_GPR1_MX7D +4 );return 0 ; } + +__secure void imx_system_reset(void) +{ +struct wdog_regs *wdog = (struct wdog_regs *)WDOG1_BASE_ADDR ; + +/* make sure WDOG1 clock is enabled */ +writel (0x1 <<28 ,CCM_BASE_ADDR +CCM_ROOT_WDOG ); +writel (0x3 ,CCM_BASE_ADDR +CCM_CCGR_WDOG1 ); +writew (WCR_WDE , &wdog->wcr); +}
arch/arm/mach-imx/mx7/psci.S +7 -0
@@ -43,4 +43,11 @@ psci_cpu_off: 1: wfi b 1b +.globl psci_system_reset +psci_system_reset: + bl imx_system_reset + +2: wfi + b 2b + .popsection
Signature · 1 line
1.9.1
PATCH v3 2/3 imx: mx7: psci: add system reset support
Quoted 54 lines · Anson Huang
Add i.MX7 PSCI system reset support, linux
kernel can use "reboot" command to reset
system even wdog driver is disabled in kernel.Signed-off-by Anson Huang <[email protected]>--- arch/arm/mach-imx/mx7/psci-mx7.c | 15 ++++++++++++++- arch/arm/mach-imx/mx7/psci.S | 7 +++++++ 2 files changed, 21 insertions(+), 1 deletion(-)arch/arm/mach-imx/mx7/psci-mx7.c +14
-1@@ -10,7 +10,7 @@#include <asm/secure.h> #include <asm/arch/imx-regs.h> #include <common.h> - +#include <fsl_wdog.h> #define GPC_CPU_PGC_SW_PDN_REQ 0xfc#define GPC_CPU_PGC_SW_PUP_REQ 0xf0@@ -26,6 +26,9 @@#define BP_SRC_A7RCR0_A7_CORE_RESET0 0#define BP_SRC_A7RCR1_A7_CORE1_ENABLE 1 +#define CCM_ROOT_WDOG 0xbb80 +#define CCM_CCGR_WDOG1 0x49c0 +static inline void imx_gpcv2_set_m_core_pgc (bool enable,u32 offset) {writel (enable,GPC_IPS_BASE_ADDR + offset);@@ -74,3 +77,13 @@ __secure int imx_cpu_off(int cpu)writel (0 ,SRC_BASE_ADDR + cpu *8 +SRC_GPR1_MX7D +4 );return 0 ; } + +__secure void imx_system_reset(void) +{ +struct wdog_regs *wdog = (struct wdog_regs *)WDOG1_BASE_ADDR ; + +/* make sure WDOG1 clock is enabled */ +writel (0x1 <<28 ,CCM_BASE_ADDR +CCM_ROOT_WDOG ); +writel (0x3 ,CCM_BASE_ADDR +CCM_CCGR_WDOG1 ); +writew (WCR_WDE , &wdog->wcr); +}arch/arm/mach-imx/mx7/psci.S +0
-0@@ -43,4 +43,11 @@ psci_cpu_off: 1: wfi
arch/arm/mach-imx/mx7/psci.S psci_cpu_off: · line 53
Quoted 10 lines
arch/arm/mach-imx/mx7/psci.S +7
-0b 1b +.globl psci_system_reset +psci_system_reset: + bl imx_system_reset + +2: wfi + b 2b + .popsection
Applied to u-boot-imx, thanks !
Best regards,
Stefano Babic
Signature · 5 lines
===================================================================== DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de =====================================================================
PATCH v3 3/3 imx: mx7: psci: add system power off support
In reply to Anson HuangAdd i.MX7 PSCI system power off support, linux
kernel can use "poweroff" command to power off
system via SNVS, PMIC power will be disabled.
--- arch/arm/mach-imx/mx7/psci-mx7.c | 18 ++++++++++++++++++ arch/arm/mach-imx/mx7/psci.S | 7 +++++++ 2 files changed, 25 insertions(+)
arch/arm/mach-imx/mx7/psci-mx7.c +18 -0
@@ -26,6 +26,12 @@#define BP_SRC_A7RCR0_A7_CORE_RESET0 0#define BP_SRC_A7RCR1_A7_CORE1_ENABLE 1 +#define SNVS_LPCR 0x38 +#define BP_SNVS_LPCR_DP_EN 0x20 +#define BP_SNVS_LPCR_TOP 0x40 + +#define CCM_CCGR_SNVS 0x4250 +#define CCM_ROOT_WDOG 0xbb80#define CCM_CCGR_WDOG1 0x49c0
@@ -87,3 +93,15 @@ __secure void imx_system_reset(void)writel (0x3 ,CCM_BASE_ADDR +CCM_CCGR_WDOG1 );writew (WCR_WDE , &wdog->wcr); } + +__secure void imx_system_off(void) +{ +u32 val; + +/* make sure SNVS clock is enabled */ +writel (0x3 ,CCM_BASE_ADDR +CCM_CCGR_SNVS ); + + val =readl (SNVS_BASE_ADDR +SNVS_LPCR ); + val |=BP_SNVS_LPCR_DP_EN |BP_SNVS_LPCR_TOP ; +writel (val,SNVS_BASE_ADDR +SNVS_LPCR ); +}
arch/arm/mach-imx/mx7/psci.S +7 -0
@@ -50,4 +50,11 @@ psci_system_reset: 2: wfi b 2b +.globl psci_system_off +psci_system_off: + bl imx_system_off + +3: wfi + b 3b + .popsection
Signature · 1 line
1.9.1
PATCH v3 3/3 imx: mx7: psci: add system power off support
Quoted 50 lines · Anson Huang
Add i.MX7 PSCI system power off support, linux
kernel can use "poweroff" command to power off
system via SNVS, PMIC power will be disabled.Signed-off-by Anson Huang <[email protected]>--- arch/arm/mach-imx/mx7/psci-mx7.c | 18 ++++++++++++++++++ arch/arm/mach-imx/mx7/psci.S | 7 +++++++ 2 files changed, 25 insertions(+)arch/arm/mach-imx/mx7/psci-mx7.c +18
-0@@ -26,6 +26,12 @@#define BP_SRC_A7RCR0_A7_CORE_RESET0 0#define BP_SRC_A7RCR1_A7_CORE1_ENABLE 1 +#define SNVS_LPCR 0x38 +#define BP_SNVS_LPCR_DP_EN 0x20 +#define BP_SNVS_LPCR_TOP 0x40 + +#define CCM_CCGR_SNVS 0x4250 +#define CCM_ROOT_WDOG 0xbb80#define CCM_CCGR_WDOG1 0x49c0@@ -87,3 +93,15 @@ __secure void imx_system_reset(void)writel (0x3 ,CCM_BASE_ADDR +CCM_CCGR_WDOG1 );writew (WCR_WDE , &wdog->wcr); } + +__secure void imx_system_off(void) +{ +u32 val; + +/* make sure SNVS clock is enabled */ +writel (0x3 ,CCM_BASE_ADDR +CCM_CCGR_SNVS ); + + val =readl (SNVS_BASE_ADDR +SNVS_LPCR ); + val |=BP_SNVS_LPCR_DP_EN |BP_SNVS_LPCR_TOP ; +writel (val,SNVS_BASE_ADDR +SNVS_LPCR ); +}arch/arm/mach-imx/mx7/psci.S +0
-0@@ -50,4 +50,11 @@ psci_system_reset: 2: wfi
arch/arm/mach-imx/mx7/psci.S psci_system_reset: · line 60
Quoted 10 lines
arch/arm/mach-imx/mx7/psci.S +7
-0b 2b +.globl psci_system_off +psci_system_off: + bl imx_system_off + +3: wfi + b 3b + .popsection
Applied to u-boot-imx, thanks !
Best regards,
Stefano Babic
Signature · 5 lines
===================================================================== DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de =====================================================================