All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH 1/3] mx7_common: use psci 1.0 instead of 0.1
@ 2018-01-05  6:03 Anson Huang
  2018-01-05  6:03 ` [U-Boot] [PATCH 2/3] imx: mx7: psci: add system reset support Anson Huang
  2018-01-05  6:03 ` [U-Boot] [PATCH 3/3] imx: mx7: psci: add system power off support Anson Huang
  0 siblings, 2 replies; 5+ messages in thread
From: Anson Huang @ 2018-01-05  6:03 UTC (permalink / raw)
  To: u-boot

Use PSCI 1.0 instead of 0.1 to support more power
management feature like system reset, power off etc..

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
---
 include/configs/mx7_common.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/include/configs/mx7_common.h b/include/configs/mx7_common.h
index 16e4d95..7861712 100644
--- a/include/configs/mx7_common.h
+++ b/include/configs/mx7_common.h
@@ -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
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [U-Boot] [PATCH 2/3] imx: mx7: psci: add system reset support
  2018-01-05  6:03 [U-Boot] [PATCH 1/3] mx7_common: use psci 1.0 instead of 0.1 Anson Huang
@ 2018-01-05  6:03 ` Anson Huang
  2018-01-05  6:03 ` [U-Boot] [PATCH 3/3] imx: mx7: psci: add system power off support Anson Huang
  1 sibling, 0 replies; 5+ messages in thread
From: Anson Huang @ 2018-01-05  6:03 UTC (permalink / raw)
  To: u-boot

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 <Anson.Huang@nxp.com>
---
 arch/arm/mach-imx/mx7/psci-mx7.c | 5 +++++
 arch/arm/mach-imx/mx7/psci.S     | 7 +++++++
 2 files changed, 12 insertions(+)

diff --git a/arch/arm/mach-imx/mx7/psci-mx7.c b/arch/arm/mach-imx/mx7/psci-mx7.c
index 7f429b0..66f6db6 100644
--- a/arch/arm/mach-imx/mx7/psci-mx7.c
+++ b/arch/arm/mach-imx/mx7/psci-mx7.c
@@ -74,3 +74,8 @@ __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)
+{
+	writew(1 << 2, WDOG1_BASE_ADDR);
+}
diff --git a/arch/arm/mach-imx/mx7/psci.S b/arch/arm/mach-imx/mx7/psci.S
index fc5eb34..59f98cd 100644
--- a/arch/arm/mach-imx/mx7/psci.S
+++ b/arch/arm/mach-imx/mx7/psci.S
@@ -43,4 +43,11 @@ psci_cpu_off:
 1: 	wfi
 	b 1b
 
+.globl psci_system_reset
+psci_system_reset:
+	b	imx_system_reset
+
+2: 	wfi
+	b 2b
+
 	.popsection
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [U-Boot] [PATCH 3/3] imx: mx7: psci: add system power off support
  2018-01-05  6:03 [U-Boot] [PATCH 1/3] mx7_common: use psci 1.0 instead of 0.1 Anson Huang
  2018-01-05  6:03 ` [U-Boot] [PATCH 2/3] imx: mx7: psci: add system reset support Anson Huang
@ 2018-01-05  6:03 ` Anson Huang
  2018-01-05 18:49   ` Troy Kisky
  1 sibling, 1 reply; 5+ messages in thread
From: Anson Huang @ 2018-01-05  6:03 UTC (permalink / raw)
  To: u-boot

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 <Anson.Huang@nxp.com>
---
 arch/arm/mach-imx/mx7/psci-mx7.c | 18 ++++++++++++++++++
 arch/arm/mach-imx/mx7/psci.S     |  7 +++++++
 2 files changed, 25 insertions(+)

diff --git a/arch/arm/mach-imx/mx7/psci-mx7.c b/arch/arm/mach-imx/mx7/psci-mx7.c
index 66f6db6..0e515f0 100644
--- a/arch/arm/mach-imx/mx7/psci-mx7.c
+++ b/arch/arm/mach-imx/mx7/psci-mx7.c
@@ -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
+
 static inline void imx_gpcv2_set_m_core_pgc(bool enable, u32 offset)
 {
 	writel(enable, GPC_IPS_BASE_ADDR + offset);
@@ -79,3 +85,15 @@ __secure void imx_system_reset(void)
 {
 	writew(1 << 2, WDOG1_BASE_ADDR);
 }
+
+__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);
+}
diff --git a/arch/arm/mach-imx/mx7/psci.S b/arch/arm/mach-imx/mx7/psci.S
index 59f98cd..3d15016 100644
--- a/arch/arm/mach-imx/mx7/psci.S
+++ b/arch/arm/mach-imx/mx7/psci.S
@@ -50,4 +50,11 @@ psci_system_reset:
 2: 	wfi
 	b 2b
 
+.globl psci_system_off
+psci_system_off:
+	b	imx_system_off
+
+3: 	wfi
+	b 3b
+
 	.popsection
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [U-Boot] [PATCH 3/3] imx: mx7: psci: add system power off support
  2018-01-05  6:03 ` [U-Boot] [PATCH 3/3] imx: mx7: psci: add system power off support Anson Huang
@ 2018-01-05 18:49   ` Troy Kisky
  2018-01-06  2:35     ` Anson Huang
  0 siblings, 1 reply; 5+ messages in thread
From: Troy Kisky @ 2018-01-05 18:49 UTC (permalink / raw)
  To: u-boot

On 1/4/2018 10:03 PM, Anson Huang wrote:
> 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 <Anson.Huang@nxp.com>
> ---
>  arch/arm/mach-imx/mx7/psci-mx7.c | 18 ++++++++++++++++++
>  arch/arm/mach-imx/mx7/psci.S     |  7 +++++++
>  2 files changed, 25 insertions(+)
> 
> diff --git a/arch/arm/mach-imx/mx7/psci-mx7.c b/arch/arm/mach-imx/mx7/psci-mx7.c
> index 66f6db6..0e515f0 100644
> --- a/arch/arm/mach-imx/mx7/psci-mx7.c
> +++ b/arch/arm/mach-imx/mx7/psci-mx7.c
> @@ -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
> +
>  static inline void imx_gpcv2_set_m_core_pgc(bool enable, u32 offset)
>  {
>  	writel(enable, GPC_IPS_BASE_ADDR + offset);
> @@ -79,3 +85,15 @@ __secure void imx_system_reset(void)
>  {
>  	writew(1 << 2, WDOG1_BASE_ADDR);
>  }
> +
> +__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);
> +}
> diff --git a/arch/arm/mach-imx/mx7/psci.S b/arch/arm/mach-imx/mx7/psci.S
> index 59f98cd..3d15016 100644
> --- a/arch/arm/mach-imx/mx7/psci.S
> +++ b/arch/arm/mach-imx/mx7/psci.S
> @@ -50,4 +50,11 @@ psci_system_reset:
>  2: 	wfi
>  	b 2b
>  
> +.globl psci_system_off
> +psci_system_off:
> +	b	imx_system_off


Should this be "bl" for this and the previous patch ?


> +
> +3: 	wfi
> +	b 3b
> +
>  	.popsection
> 

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [U-Boot] [PATCH 3/3] imx: mx7: psci: add system power off support
  2018-01-05 18:49   ` Troy Kisky
@ 2018-01-06  2:35     ` Anson Huang
  0 siblings, 0 replies; 5+ messages in thread
From: Anson Huang @ 2018-01-06  2:35 UTC (permalink / raw)
  To: u-boot



Best Regards!
Anson Huang


> -----Original Message-----
> From: Troy Kisky [mailto:troy.kisky at boundarydevices.com]
> Sent: 2018-01-06 2:49 AM
> To: Anson Huang <anson.huang@nxp.com>; sbabic at denx.de; Fabio Estevam
> <fabio.estevam@nxp.com>; albert.u.boot at aribaud.net;
> christian.gmeiner at gmail.com; Peng Fan <peng.fan@nxp.com>; u-
> boot at lists.denx.de
> Subject: Re: [U-Boot] [PATCH 3/3] imx: mx7: psci: add system power off
> support
> 
> On 1/4/2018 10:03 PM, Anson Huang wrote:
> > 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 <Anson.Huang@nxp.com>
> > ---
> >  arch/arm/mach-imx/mx7/psci-mx7.c | 18 ++++++++++++++++++
> >  arch/arm/mach-imx/mx7/psci.S     |  7 +++++++
> >  2 files changed, 25 insertions(+)
> >
> > diff --git a/arch/arm/mach-imx/mx7/psci-mx7.c
> > b/arch/arm/mach-imx/mx7/psci-mx7.c
> > index 66f6db6..0e515f0 100644
> > --- a/arch/arm/mach-imx/mx7/psci-mx7.c
> > +++ b/arch/arm/mach-imx/mx7/psci-mx7.c
> > @@ -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
> > +
> >  static inline void imx_gpcv2_set_m_core_pgc(bool enable, u32 offset)
> > {
> >  	writel(enable, GPC_IPS_BASE_ADDR + offset); @@ -79,3 +85,15 @@
> > __secure void imx_system_reset(void)  {
> >  	writew(1 << 2, WDOG1_BASE_ADDR);
> >  }
> > +
> > +__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); }
> > diff --git a/arch/arm/mach-imx/mx7/psci.S
> > b/arch/arm/mach-imx/mx7/psci.S index 59f98cd..3d15016 100644
> > --- a/arch/arm/mach-imx/mx7/psci.S
> > +++ b/arch/arm/mach-imx/mx7/psci.S
> > @@ -50,4 +50,11 @@ psci_system_reset:
> >  2: 	wfi
> >  	b 2b
> >
> > +.globl psci_system_off
> > +psci_system_off:
> > +	b	imx_system_off
> 
> 
> Should this be "bl" for this and the previous patch ?


Ah, yes, thanks for your comment. I sent a V2 patch set, please help review.

Anson.

> 
> 
> > +
> > +3: 	wfi
> > +	b 3b
> > +
> >  	.popsection
> >

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2018-01-06  2:35 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-01-05  6:03 [U-Boot] [PATCH 1/3] mx7_common: use psci 1.0 instead of 0.1 Anson Huang
2018-01-05  6:03 ` [U-Boot] [PATCH 2/3] imx: mx7: psci: add system reset support Anson Huang
2018-01-05  6:03 ` [U-Boot] [PATCH 3/3] imx: mx7: psci: add system power off support Anson Huang
2018-01-05 18:49   ` Troy Kisky
2018-01-06  2:35     ` Anson Huang

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.