All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v1] ARM: imx6: add pm_power_off support for i.mx6 chips
@ 2014-09-11  6:41 ` Robin Gong
  0 siblings, 0 replies; 5+ messages in thread
From: Robin Gong @ 2014-09-11  6:41 UTC (permalink / raw)
  To: linux-arm-kernel

All chips of i.mx6 can be powered off by programming SNVS.
For example :
On i.mx6q-sabresd board, PMIC_ON_REQ connect with external
pmic ON/OFF pin, that will cause the whole PMIC powered off
except VSNVS. And system can restart once PMIC_ON_REQ goes
high by push POWRER key.

Signed-off-by: Robin Gong <b38343@freescale.com>
---
 arch/arm/mach-imx/common.h      |  1 +
 arch/arm/mach-imx/mach-imx6q.c  |  2 ++
 arch/arm/mach-imx/mach-imx6sl.c |  2 ++
 arch/arm/mach-imx/mach-imx6sx.c |  2 ++
 arch/arm/mach-imx/system.c      | 22 +++++++++++++++++++++-
 5 files changed, 28 insertions(+), 1 deletion(-)

diff --git a/arch/arm/mach-imx/common.h b/arch/arm/mach-imx/common.h
index 1dabf43..baca11a 100644
--- a/arch/arm/mach-imx/common.h
+++ b/arch/arm/mach-imx/common.h
@@ -62,6 +62,7 @@ void mxc_set_cpu_type(unsigned int type);
 void mxc_restart(enum reboot_mode, const char *);
 void mxc_arch_reset_init(void __iomem *);
 void mxc_arch_reset_init_dt(void);
+void mxc_power_off_init(void);
 int mx51_revision(void);
 int mx53_revision(void);
 void imx_set_aips(void __iomem *);
diff --git a/arch/arm/mach-imx/mach-imx6q.c b/arch/arm/mach-imx/mach-imx6q.c
index d51c6e9..3d6610d 100644
--- a/arch/arm/mach-imx/mach-imx6q.c
+++ b/arch/arm/mach-imx/mach-imx6q.c
@@ -270,6 +270,8 @@ static void __init imx6q_init_machine(void)
 
 	mxc_arch_reset_init_dt();
 
+	mxc_power_off_init();
+
 	parent = imx_soc_device_init();
 	if (parent == NULL)
 		pr_warn("failed to initialize soc device\n");
diff --git a/arch/arm/mach-imx/mach-imx6sl.c b/arch/arm/mach-imx/mach-imx6sl.c
index ed263a2..c07e6e8 100644
--- a/arch/arm/mach-imx/mach-imx6sl.c
+++ b/arch/arm/mach-imx/mach-imx6sl.c
@@ -50,6 +50,8 @@ static void __init imx6sl_init_machine(void)
 
 	mxc_arch_reset_init_dt();
 
+	mxc_power_off_init();
+
 	parent = imx_soc_device_init();
 	if (parent == NULL)
 		pr_warn("failed to initialize soc device\n");
diff --git a/arch/arm/mach-imx/mach-imx6sx.c b/arch/arm/mach-imx/mach-imx6sx.c
index 3de3b73..68ea070 100644
--- a/arch/arm/mach-imx/mach-imx6sx.c
+++ b/arch/arm/mach-imx/mach-imx6sx.c
@@ -20,6 +20,8 @@ static void __init imx6sx_init_machine(void)
 
 	mxc_arch_reset_init_dt();
 
+	mxc_power_off_init();
+
 	parent = imx_soc_device_init();
 	if (parent == NULL)
 		pr_warn("failed to initialize soc device\n");
diff --git a/arch/arm/mach-imx/system.c b/arch/arm/mach-imx/system.c
index d14c33f..925fb29 100644
--- a/arch/arm/mach-imx/system.c
+++ b/arch/arm/mach-imx/system.c
@@ -23,6 +23,7 @@
 #include <linux/delay.h>
 #include <linux/of.h>
 #include <linux/of_address.h>
+#include <linux/pm.h>
 
 #include <asm/system_misc.h>
 #include <asm/proc-fns.h>
@@ -32,7 +33,9 @@
 #include "common.h"
 #include "hardware.h"
 
-static void __iomem *wdog_base;
+#define SNVS_LPCR               0x04
+
+static void __iomem *wdog_base, *snvs_base;
 static struct clk *wdog_clk;
 
 /*
@@ -104,6 +107,23 @@ void __init mxc_arch_reset_init_dt(void)
 		clk_prepare(wdog_clk);
 }
 
+static void power_off_snvs(void)
+{
+	 u32 value = readl(snvs_base + SNVS_LPCR);
+	/* set TOP and DP_EN bit */
+	writel(value | 0x60, snvs_base + SNVS_LPCR);
+}
+
+void __init mxc_power_off_init(void)
+{
+	struct device_node *np;
+
+	np = of_find_compatible_node(NULL, NULL, "fsl,sec-v4.0-mon-rtc-lp");
+	snvs_base = of_iomap(np, 0);
+	WARN_ON(!snvs_base);
+	pm_power_off = power_off_snvs;
+}
+
 #ifdef CONFIG_CACHE_L2X0
 void __init imx_init_l2cache(void)
 {
-- 
1.9.1

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

* [PATCH v1] ARM: imx6: add pm_power_off support for i.mx6 chips
@ 2014-09-11  6:41 ` Robin Gong
  0 siblings, 0 replies; 5+ messages in thread
From: Robin Gong @ 2014-09-11  6:41 UTC (permalink / raw)
  To: shawn.guo, kernel, linux; +Cc: linux-arm-kernel, linux-kernel

All chips of i.mx6 can be powered off by programming SNVS.
For example :
On i.mx6q-sabresd board, PMIC_ON_REQ connect with external
pmic ON/OFF pin, that will cause the whole PMIC powered off
except VSNVS. And system can restart once PMIC_ON_REQ goes
high by push POWRER key.

Signed-off-by: Robin Gong <b38343@freescale.com>
---
 arch/arm/mach-imx/common.h      |  1 +
 arch/arm/mach-imx/mach-imx6q.c  |  2 ++
 arch/arm/mach-imx/mach-imx6sl.c |  2 ++
 arch/arm/mach-imx/mach-imx6sx.c |  2 ++
 arch/arm/mach-imx/system.c      | 22 +++++++++++++++++++++-
 5 files changed, 28 insertions(+), 1 deletion(-)

diff --git a/arch/arm/mach-imx/common.h b/arch/arm/mach-imx/common.h
index 1dabf43..baca11a 100644
--- a/arch/arm/mach-imx/common.h
+++ b/arch/arm/mach-imx/common.h
@@ -62,6 +62,7 @@ void mxc_set_cpu_type(unsigned int type);
 void mxc_restart(enum reboot_mode, const char *);
 void mxc_arch_reset_init(void __iomem *);
 void mxc_arch_reset_init_dt(void);
+void mxc_power_off_init(void);
 int mx51_revision(void);
 int mx53_revision(void);
 void imx_set_aips(void __iomem *);
diff --git a/arch/arm/mach-imx/mach-imx6q.c b/arch/arm/mach-imx/mach-imx6q.c
index d51c6e9..3d6610d 100644
--- a/arch/arm/mach-imx/mach-imx6q.c
+++ b/arch/arm/mach-imx/mach-imx6q.c
@@ -270,6 +270,8 @@ static void __init imx6q_init_machine(void)
 
 	mxc_arch_reset_init_dt();
 
+	mxc_power_off_init();
+
 	parent = imx_soc_device_init();
 	if (parent == NULL)
 		pr_warn("failed to initialize soc device\n");
diff --git a/arch/arm/mach-imx/mach-imx6sl.c b/arch/arm/mach-imx/mach-imx6sl.c
index ed263a2..c07e6e8 100644
--- a/arch/arm/mach-imx/mach-imx6sl.c
+++ b/arch/arm/mach-imx/mach-imx6sl.c
@@ -50,6 +50,8 @@ static void __init imx6sl_init_machine(void)
 
 	mxc_arch_reset_init_dt();
 
+	mxc_power_off_init();
+
 	parent = imx_soc_device_init();
 	if (parent == NULL)
 		pr_warn("failed to initialize soc device\n");
diff --git a/arch/arm/mach-imx/mach-imx6sx.c b/arch/arm/mach-imx/mach-imx6sx.c
index 3de3b73..68ea070 100644
--- a/arch/arm/mach-imx/mach-imx6sx.c
+++ b/arch/arm/mach-imx/mach-imx6sx.c
@@ -20,6 +20,8 @@ static void __init imx6sx_init_machine(void)
 
 	mxc_arch_reset_init_dt();
 
+	mxc_power_off_init();
+
 	parent = imx_soc_device_init();
 	if (parent == NULL)
 		pr_warn("failed to initialize soc device\n");
diff --git a/arch/arm/mach-imx/system.c b/arch/arm/mach-imx/system.c
index d14c33f..925fb29 100644
--- a/arch/arm/mach-imx/system.c
+++ b/arch/arm/mach-imx/system.c
@@ -23,6 +23,7 @@
 #include <linux/delay.h>
 #include <linux/of.h>
 #include <linux/of_address.h>
+#include <linux/pm.h>
 
 #include <asm/system_misc.h>
 #include <asm/proc-fns.h>
@@ -32,7 +33,9 @@
 #include "common.h"
 #include "hardware.h"
 
-static void __iomem *wdog_base;
+#define SNVS_LPCR               0x04
+
+static void __iomem *wdog_base, *snvs_base;
 static struct clk *wdog_clk;
 
 /*
@@ -104,6 +107,23 @@ void __init mxc_arch_reset_init_dt(void)
 		clk_prepare(wdog_clk);
 }
 
+static void power_off_snvs(void)
+{
+	 u32 value = readl(snvs_base + SNVS_LPCR);
+	/* set TOP and DP_EN bit */
+	writel(value | 0x60, snvs_base + SNVS_LPCR);
+}
+
+void __init mxc_power_off_init(void)
+{
+	struct device_node *np;
+
+	np = of_find_compatible_node(NULL, NULL, "fsl,sec-v4.0-mon-rtc-lp");
+	snvs_base = of_iomap(np, 0);
+	WARN_ON(!snvs_base);
+	pm_power_off = power_off_snvs;
+}
+
 #ifdef CONFIG_CACHE_L2X0
 void __init imx_init_l2cache(void)
 {
-- 
1.9.1


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

* [PATCH v1] ARM: imx6: add pm_power_off support for i.mx6 chips
  2014-09-11  6:41 ` Robin Gong
@ 2014-09-11  8:29   ` Shawn Guo
  -1 siblings, 0 replies; 5+ messages in thread
From: Shawn Guo @ 2014-09-11  8:29 UTC (permalink / raw)
  To: linux-arm-kernel

On Thu, Sep 11, 2014 at 02:41:07PM +0800, Robin Gong wrote:
> All chips of i.mx6 can be powered off by programming SNVS.
> For example :
> On i.mx6q-sabresd board, PMIC_ON_REQ connect with external
> pmic ON/OFF pin, that will cause the whole PMIC powered off
> except VSNVS. And system can restart once PMIC_ON_REQ goes
> high by push POWRER key.
> 
> Signed-off-by: Robin Gong <b38343@freescale.com>
> ---
>  arch/arm/mach-imx/common.h      |  1 +
>  arch/arm/mach-imx/mach-imx6q.c  |  2 ++
>  arch/arm/mach-imx/mach-imx6sl.c |  2 ++
>  arch/arm/mach-imx/mach-imx6sx.c |  2 ++
>  arch/arm/mach-imx/system.c      | 22 +++++++++++++++++++++-
>  5 files changed, 28 insertions(+), 1 deletion(-)

I think we'd better add a little poweroff driver under
drivers/power/reset/ rather than having it in platform code.

Shawn

> 
> diff --git a/arch/arm/mach-imx/common.h b/arch/arm/mach-imx/common.h
> index 1dabf43..baca11a 100644
> --- a/arch/arm/mach-imx/common.h
> +++ b/arch/arm/mach-imx/common.h
> @@ -62,6 +62,7 @@ void mxc_set_cpu_type(unsigned int type);
>  void mxc_restart(enum reboot_mode, const char *);
>  void mxc_arch_reset_init(void __iomem *);
>  void mxc_arch_reset_init_dt(void);
> +void mxc_power_off_init(void);
>  int mx51_revision(void);
>  int mx53_revision(void);
>  void imx_set_aips(void __iomem *);
> diff --git a/arch/arm/mach-imx/mach-imx6q.c b/arch/arm/mach-imx/mach-imx6q.c
> index d51c6e9..3d6610d 100644
> --- a/arch/arm/mach-imx/mach-imx6q.c
> +++ b/arch/arm/mach-imx/mach-imx6q.c
> @@ -270,6 +270,8 @@ static void __init imx6q_init_machine(void)
>  
>  	mxc_arch_reset_init_dt();
>  
> +	mxc_power_off_init();
> +
>  	parent = imx_soc_device_init();
>  	if (parent == NULL)
>  		pr_warn("failed to initialize soc device\n");
> diff --git a/arch/arm/mach-imx/mach-imx6sl.c b/arch/arm/mach-imx/mach-imx6sl.c
> index ed263a2..c07e6e8 100644
> --- a/arch/arm/mach-imx/mach-imx6sl.c
> +++ b/arch/arm/mach-imx/mach-imx6sl.c
> @@ -50,6 +50,8 @@ static void __init imx6sl_init_machine(void)
>  
>  	mxc_arch_reset_init_dt();
>  
> +	mxc_power_off_init();
> +
>  	parent = imx_soc_device_init();
>  	if (parent == NULL)
>  		pr_warn("failed to initialize soc device\n");
> diff --git a/arch/arm/mach-imx/mach-imx6sx.c b/arch/arm/mach-imx/mach-imx6sx.c
> index 3de3b73..68ea070 100644
> --- a/arch/arm/mach-imx/mach-imx6sx.c
> +++ b/arch/arm/mach-imx/mach-imx6sx.c
> @@ -20,6 +20,8 @@ static void __init imx6sx_init_machine(void)
>  
>  	mxc_arch_reset_init_dt();
>  
> +	mxc_power_off_init();
> +
>  	parent = imx_soc_device_init();
>  	if (parent == NULL)
>  		pr_warn("failed to initialize soc device\n");
> diff --git a/arch/arm/mach-imx/system.c b/arch/arm/mach-imx/system.c
> index d14c33f..925fb29 100644
> --- a/arch/arm/mach-imx/system.c
> +++ b/arch/arm/mach-imx/system.c
> @@ -23,6 +23,7 @@
>  #include <linux/delay.h>
>  #include <linux/of.h>
>  #include <linux/of_address.h>
> +#include <linux/pm.h>
>  
>  #include <asm/system_misc.h>
>  #include <asm/proc-fns.h>
> @@ -32,7 +33,9 @@
>  #include "common.h"
>  #include "hardware.h"
>  
> -static void __iomem *wdog_base;
> +#define SNVS_LPCR               0x04
> +
> +static void __iomem *wdog_base, *snvs_base;
>  static struct clk *wdog_clk;
>  
>  /*
> @@ -104,6 +107,23 @@ void __init mxc_arch_reset_init_dt(void)
>  		clk_prepare(wdog_clk);
>  }
>  
> +static void power_off_snvs(void)
> +{
> +	 u32 value = readl(snvs_base + SNVS_LPCR);
> +	/* set TOP and DP_EN bit */
> +	writel(value | 0x60, snvs_base + SNVS_LPCR);
> +}
> +
> +void __init mxc_power_off_init(void)
> +{
> +	struct device_node *np;
> +
> +	np = of_find_compatible_node(NULL, NULL, "fsl,sec-v4.0-mon-rtc-lp");
> +	snvs_base = of_iomap(np, 0);
> +	WARN_ON(!snvs_base);
> +	pm_power_off = power_off_snvs;
> +}
> +
>  #ifdef CONFIG_CACHE_L2X0
>  void __init imx_init_l2cache(void)
>  {
> -- 
> 1.9.1
> 

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

* Re: [PATCH v1] ARM: imx6: add pm_power_off support for i.mx6 chips
@ 2014-09-11  8:29   ` Shawn Guo
  0 siblings, 0 replies; 5+ messages in thread
From: Shawn Guo @ 2014-09-11  8:29 UTC (permalink / raw)
  To: Robin Gong; +Cc: kernel, linux, linux-arm-kernel, linux-kernel

On Thu, Sep 11, 2014 at 02:41:07PM +0800, Robin Gong wrote:
> All chips of i.mx6 can be powered off by programming SNVS.
> For example :
> On i.mx6q-sabresd board, PMIC_ON_REQ connect with external
> pmic ON/OFF pin, that will cause the whole PMIC powered off
> except VSNVS. And system can restart once PMIC_ON_REQ goes
> high by push POWRER key.
> 
> Signed-off-by: Robin Gong <b38343@freescale.com>
> ---
>  arch/arm/mach-imx/common.h      |  1 +
>  arch/arm/mach-imx/mach-imx6q.c  |  2 ++
>  arch/arm/mach-imx/mach-imx6sl.c |  2 ++
>  arch/arm/mach-imx/mach-imx6sx.c |  2 ++
>  arch/arm/mach-imx/system.c      | 22 +++++++++++++++++++++-
>  5 files changed, 28 insertions(+), 1 deletion(-)

I think we'd better add a little poweroff driver under
drivers/power/reset/ rather than having it in platform code.

Shawn

> 
> diff --git a/arch/arm/mach-imx/common.h b/arch/arm/mach-imx/common.h
> index 1dabf43..baca11a 100644
> --- a/arch/arm/mach-imx/common.h
> +++ b/arch/arm/mach-imx/common.h
> @@ -62,6 +62,7 @@ void mxc_set_cpu_type(unsigned int type);
>  void mxc_restart(enum reboot_mode, const char *);
>  void mxc_arch_reset_init(void __iomem *);
>  void mxc_arch_reset_init_dt(void);
> +void mxc_power_off_init(void);
>  int mx51_revision(void);
>  int mx53_revision(void);
>  void imx_set_aips(void __iomem *);
> diff --git a/arch/arm/mach-imx/mach-imx6q.c b/arch/arm/mach-imx/mach-imx6q.c
> index d51c6e9..3d6610d 100644
> --- a/arch/arm/mach-imx/mach-imx6q.c
> +++ b/arch/arm/mach-imx/mach-imx6q.c
> @@ -270,6 +270,8 @@ static void __init imx6q_init_machine(void)
>  
>  	mxc_arch_reset_init_dt();
>  
> +	mxc_power_off_init();
> +
>  	parent = imx_soc_device_init();
>  	if (parent == NULL)
>  		pr_warn("failed to initialize soc device\n");
> diff --git a/arch/arm/mach-imx/mach-imx6sl.c b/arch/arm/mach-imx/mach-imx6sl.c
> index ed263a2..c07e6e8 100644
> --- a/arch/arm/mach-imx/mach-imx6sl.c
> +++ b/arch/arm/mach-imx/mach-imx6sl.c
> @@ -50,6 +50,8 @@ static void __init imx6sl_init_machine(void)
>  
>  	mxc_arch_reset_init_dt();
>  
> +	mxc_power_off_init();
> +
>  	parent = imx_soc_device_init();
>  	if (parent == NULL)
>  		pr_warn("failed to initialize soc device\n");
> diff --git a/arch/arm/mach-imx/mach-imx6sx.c b/arch/arm/mach-imx/mach-imx6sx.c
> index 3de3b73..68ea070 100644
> --- a/arch/arm/mach-imx/mach-imx6sx.c
> +++ b/arch/arm/mach-imx/mach-imx6sx.c
> @@ -20,6 +20,8 @@ static void __init imx6sx_init_machine(void)
>  
>  	mxc_arch_reset_init_dt();
>  
> +	mxc_power_off_init();
> +
>  	parent = imx_soc_device_init();
>  	if (parent == NULL)
>  		pr_warn("failed to initialize soc device\n");
> diff --git a/arch/arm/mach-imx/system.c b/arch/arm/mach-imx/system.c
> index d14c33f..925fb29 100644
> --- a/arch/arm/mach-imx/system.c
> +++ b/arch/arm/mach-imx/system.c
> @@ -23,6 +23,7 @@
>  #include <linux/delay.h>
>  #include <linux/of.h>
>  #include <linux/of_address.h>
> +#include <linux/pm.h>
>  
>  #include <asm/system_misc.h>
>  #include <asm/proc-fns.h>
> @@ -32,7 +33,9 @@
>  #include "common.h"
>  #include "hardware.h"
>  
> -static void __iomem *wdog_base;
> +#define SNVS_LPCR               0x04
> +
> +static void __iomem *wdog_base, *snvs_base;
>  static struct clk *wdog_clk;
>  
>  /*
> @@ -104,6 +107,23 @@ void __init mxc_arch_reset_init_dt(void)
>  		clk_prepare(wdog_clk);
>  }
>  
> +static void power_off_snvs(void)
> +{
> +	 u32 value = readl(snvs_base + SNVS_LPCR);
> +	/* set TOP and DP_EN bit */
> +	writel(value | 0x60, snvs_base + SNVS_LPCR);
> +}
> +
> +void __init mxc_power_off_init(void)
> +{
> +	struct device_node *np;
> +
> +	np = of_find_compatible_node(NULL, NULL, "fsl,sec-v4.0-mon-rtc-lp");
> +	snvs_base = of_iomap(np, 0);
> +	WARN_ON(!snvs_base);
> +	pm_power_off = power_off_snvs;
> +}
> +
>  #ifdef CONFIG_CACHE_L2X0
>  void __init imx_init_l2cache(void)
>  {
> -- 
> 1.9.1
> 

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

* [PATCH v1] ARM: imx6: add pm_power_off support for i.mx6 chips
  2014-10-21  1:06 [PATCH v2] ARM: dts: imx6dl: disable dma support for spi on i.mx6dl Robin Gong
@ 2014-10-21  1:06 ` Robin Gong
  0 siblings, 0 replies; 5+ messages in thread
From: Robin Gong @ 2014-10-21  1:06 UTC (permalink / raw)
  To: vinod.koul, dan.j.williams, andriy.shevchenko
  Cc: dmaengine, linux-kernel, b38343

All chips of i.mx6 can be powered off by programming SNVS.
For example :
On i.mx6q-sabresd board, PMIC_ON_REQ connect with external
pmic ON/OFF pin, that will cause the whole PMIC powered off
except VSNVS. And system can restart once PMIC_ON_REQ goes
high by push POWRER key.

Signed-off-by: Robin Gong <b38343@freescale.com>
---
 arch/arm/mach-imx/common.h      |  1 +
 arch/arm/mach-imx/mach-imx6q.c  |  2 ++
 arch/arm/mach-imx/mach-imx6sl.c |  2 ++
 arch/arm/mach-imx/mach-imx6sx.c |  2 ++
 arch/arm/mach-imx/system.c      | 22 +++++++++++++++++++++-
 5 files changed, 28 insertions(+), 1 deletion(-)

diff --git a/arch/arm/mach-imx/common.h b/arch/arm/mach-imx/common.h
index 1dabf43..baca11a 100644
--- a/arch/arm/mach-imx/common.h
+++ b/arch/arm/mach-imx/common.h
@@ -62,6 +62,7 @@ void mxc_set_cpu_type(unsigned int type);
 void mxc_restart(enum reboot_mode, const char *);
 void mxc_arch_reset_init(void __iomem *);
 void mxc_arch_reset_init_dt(void);
+void mxc_power_off_init(void);
 int mx51_revision(void);
 int mx53_revision(void);
 void imx_set_aips(void __iomem *);
diff --git a/arch/arm/mach-imx/mach-imx6q.c b/arch/arm/mach-imx/mach-imx6q.c
index d51c6e9..3d6610d 100644
--- a/arch/arm/mach-imx/mach-imx6q.c
+++ b/arch/arm/mach-imx/mach-imx6q.c
@@ -270,6 +270,8 @@ static void __init imx6q_init_machine(void)
 
 	mxc_arch_reset_init_dt();
 
+	mxc_power_off_init();
+
 	parent = imx_soc_device_init();
 	if (parent == NULL)
 		pr_warn("failed to initialize soc device\n");
diff --git a/arch/arm/mach-imx/mach-imx6sl.c b/arch/arm/mach-imx/mach-imx6sl.c
index ed263a2..c07e6e8 100644
--- a/arch/arm/mach-imx/mach-imx6sl.c
+++ b/arch/arm/mach-imx/mach-imx6sl.c
@@ -50,6 +50,8 @@ static void __init imx6sl_init_machine(void)
 
 	mxc_arch_reset_init_dt();
 
+	mxc_power_off_init();
+
 	parent = imx_soc_device_init();
 	if (parent == NULL)
 		pr_warn("failed to initialize soc device\n");
diff --git a/arch/arm/mach-imx/mach-imx6sx.c b/arch/arm/mach-imx/mach-imx6sx.c
index 3de3b73..68ea070 100644
--- a/arch/arm/mach-imx/mach-imx6sx.c
+++ b/arch/arm/mach-imx/mach-imx6sx.c
@@ -20,6 +20,8 @@ static void __init imx6sx_init_machine(void)
 
 	mxc_arch_reset_init_dt();
 
+	mxc_power_off_init();
+
 	parent = imx_soc_device_init();
 	if (parent == NULL)
 		pr_warn("failed to initialize soc device\n");
diff --git a/arch/arm/mach-imx/system.c b/arch/arm/mach-imx/system.c
index d14c33f..925fb29 100644
--- a/arch/arm/mach-imx/system.c
+++ b/arch/arm/mach-imx/system.c
@@ -23,6 +23,7 @@
 #include <linux/delay.h>
 #include <linux/of.h>
 #include <linux/of_address.h>
+#include <linux/pm.h>
 
 #include <asm/system_misc.h>
 #include <asm/proc-fns.h>
@@ -32,7 +33,9 @@
 #include "common.h"
 #include "hardware.h"
 
-static void __iomem *wdog_base;
+#define SNVS_LPCR               0x04
+
+static void __iomem *wdog_base, *snvs_base;
 static struct clk *wdog_clk;
 
 /*
@@ -104,6 +107,23 @@ void __init mxc_arch_reset_init_dt(void)
 		clk_prepare(wdog_clk);
 }
 
+static void power_off_snvs(void)
+{
+	 u32 value = readl(snvs_base + SNVS_LPCR);
+	/* set TOP and DP_EN bit */
+	writel(value | 0x60, snvs_base + SNVS_LPCR);
+}
+
+void __init mxc_power_off_init(void)
+{
+	struct device_node *np;
+
+	np = of_find_compatible_node(NULL, NULL, "fsl,sec-v4.0-mon-rtc-lp");
+	snvs_base = of_iomap(np, 0);
+	WARN_ON(!snvs_base);
+	pm_power_off = power_off_snvs;
+}
+
 #ifdef CONFIG_CACHE_L2X0
 void __init imx_init_l2cache(void)
 {
-- 
1.9.1


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

end of thread, other threads:[~2014-10-21  2:12 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-09-11  6:41 [PATCH v1] ARM: imx6: add pm_power_off support for i.mx6 chips Robin Gong
2014-09-11  6:41 ` Robin Gong
2014-09-11  8:29 ` Shawn Guo
2014-09-11  8:29   ` Shawn Guo
  -- strict thread matches above, loose matches on Subject: below --
2014-10-21  1:06 [PATCH v2] ARM: dts: imx6dl: disable dma support for spi on i.mx6dl Robin Gong
2014-10-21  1:06 ` [PATCH v1] ARM: imx6: add pm_power_off support for i.mx6 chips Robin Gong

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.