linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Dongsheng Wang <dongsheng.wang@freescale.com>
To: <scottwood@freescale.com>
Cc: linuxppc-dev@lists.ozlabs.org, hongtao.jia@freescale.com,
	Wang Dongsheng <dongsheng.wang@freescale.com>,
	jason.jin@freescale.com
Subject: [PATCH] powerpc/fsl: add power_off support for fsl platform
Date: Wed, 4 Feb 2015 14:47:01 +0800	[thread overview]
Message-ID: <1423032421-31561-1-git-send-email-dongsheng.wang@freescale.com> (raw)

From: Wang Dongsheng <dongsheng.wang@freescale.com>

QIXIS System Logic FPGA support to manage system power. So we
through QIXIS to power off freescale SOC.

Signed-off-by: Wang Dongsheng <dongsheng.wang@freescale.com>

diff --git a/arch/powerpc/platforms/85xx/corenet_generic.c b/arch/powerpc/platforms/85xx/corenet_generic.c
index 1f309cc..e1a1eb5 100644
--- a/arch/powerpc/platforms/85xx/corenet_generic.c
+++ b/arch/powerpc/platforms/85xx/corenet_generic.c
@@ -81,6 +81,8 @@ void __init corenet_gen_setup_arch(void)
 	pr_info("%s board\n", ppc_md.name);
 
 	mpc85xx_qe_init();
+
+	ppc_md_fixup();
 }
 
 static const struct of_device_id of_device_ids[] = {
diff --git a/arch/powerpc/sysdev/fsl_soc.c b/arch/powerpc/sysdev/fsl_soc.c
index 99269c0..6de9f1b 100644
--- a/arch/powerpc/sysdev/fsl_soc.c
+++ b/arch/powerpc/sysdev/fsl_soc.c
@@ -215,6 +215,54 @@ void fsl_rstcr_restart(char *cmd)
 }
 #endif
 
+#define QIXIS_PWR_CTL2		0x21
+#define QIXIS_PWR_CTL2_PWR	0x80
+static void fsl_power_off(void)
+{
+	struct device_node *pixis_node;
+	void __iomem *pixis;
+	u32 pwroff_offset, value;
+
+	pixis_node = of_find_compatible_node(NULL, NULL, "fsl,fpga-qixis");
+	if (!pixis_node) {
+		pr_err("%s: Missing pixis node\n", __func__);
+		return;
+	}
+
+	pwroff_offset = QIXIS_PWR_CTL2;
+	value = QIXIS_PWR_CTL2_PWR;
+
+	pixis = of_iomap(pixis_node, 0);
+	of_node_put(pixis_node);
+	if (!pixis) {
+		pr_err("%s: Could not map pixis registers\n", __func__);
+		return;
+	}
+
+	local_irq_disable();
+
+	setbits8(pixis + pwroff_offset, value);
+
+	iounmap(pixis);
+
+	while (1)
+		;
+}
+
+void ppc_md_fixup(void)
+{
+	struct device_node *np;
+
+	np = of_find_compatible_node(NULL, NULL, "fsl,fpga-qixis");
+	if (!np)
+		return;
+
+	of_node_put(np);
+
+	pm_power_off = fsl_power_off;
+	ppc_md.halt = fsl_power_off;
+}
+
 #if defined(CONFIG_FB_FSL_DIU) || defined(CONFIG_FB_FSL_DIU_MODULE)
 struct platform_diu_data_ops diu_ops;
 EXPORT_SYMBOL(diu_ops);
diff --git a/arch/powerpc/sysdev/fsl_soc.h b/arch/powerpc/sysdev/fsl_soc.h
index 4c5a19e..ca90e24 100644
--- a/arch/powerpc/sysdev/fsl_soc.h
+++ b/arch/powerpc/sysdev/fsl_soc.h
@@ -21,6 +21,8 @@ struct device_node;
 
 extern void fsl_rstcr_restart(char *cmd);
 
+void ppc_md_fixup(void);
+
 /* The different ports that the DIU can be connected to */
 enum fsl_diu_monitor_port {
 	FSL_DIU_PORT_DVI,	/* DVI */
-- 
2.1.0.27.g96db324

             reply	other threads:[~2015-02-04  7:04 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-04  6:47 Dongsheng Wang [this message]
2015-02-25  2:29 ` [PATCH] powerpc/fsl: add power_off support for fsl platform Scott Wood
2015-02-26  7:54   ` Dongsheng.Wang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1423032421-31561-1-git-send-email-dongsheng.wang@freescale.com \
    --to=dongsheng.wang@freescale.com \
    --cc=hongtao.jia@freescale.com \
    --cc=jason.jin@freescale.com \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=scottwood@freescale.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).