Skip to contentSkip to conversation

Suspend/resume support for some 83xx/85xx/86xx boards

PATCH Applied Anton Vorontsov 3 participants 21 messages Sep 15, 2009 – Nov 5, 2009

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

v4 cover Suspend/resume support for some 83xx/85xx/86xx boards

Quoted 6 lines · Anton Vorontsov

On Mon, Sep 14, 2009 at 03:45:10PM -0500, Scott Wood wrote:
[...]

Quoted 4 lines
Quoted 3 lines

You can't request the firmware in the qe driver's ->suspend() routine necause the firmware may be on e.g. NFS filesystem or USB stick (implies having QE Ethernet or QE USB fully functional).

Quoted 6 lines
Quoted 2 lines

Is there any way for software to read out the current firmware from the device, or is it write-only?

Hm, I didn't look into iram stuff that much, but seemingly I can read it back and save. In the end, it's just a ram that we access in a weird way... Let me try it.

Okay... that might sound silly, but the microcode stuff isn't needed at all. While the QE really shuts down, its iram is preserved. I'm not sure why it didn't work for me before, but now it does work. Heh.

Note that QE reset is still needed, it's QE microcode reload that we don't need. I was also curious if MPC8568 QE needs reset after sleep, so I unpacked the board and tested it. It needs the reset just as MPC8569. I also found a paragraph in reference manual that somewhat proves "QE turns off during sleep" behaviour.

So here is a new patch set. Changes:

- Removed QE stuff from fsl_pmc;
- New patches added:
powerpc/qe: QE also shuts down on MPC8568 powerpc/qe: Implement QE driver for handling resume on MPC85xx

Thanks,

Signature · 3 lines
Anton Vorontsov
email: [email protected]
irc://irc.freenode.net/bd2
#1 lore raw

PATCH v4 1/7 powerpc/qe: Make qe_reset() code path safe for repeated invocation

For MPC8569 CPUs we'll need to reset QE after each suspend, so make qe_reset() code path suitable for repeated invocation, that is:

- Don't initialize rheap structures if already initialized;
- Don't allocate muram for SDMA if already allocated, just reinitialize registers with previously allocated muram offset;
- Remove __init attributes from qe_reset() and cpm_muram_init();

---
 arch/powerpc/include/asm/qe.h    |    2 +-
 arch/powerpc/sysdev/cpm_common.c |    5 ++++-
 arch/powerpc/sysdev/qe_lib/qe.c  |   12 +++++++-----
 3 files changed, 12 insertions(+), 7 deletions(-)
arch/powerpc/include/asm/qe.h +1 -1
index 20c0b07..fe507ff 100644
@@ -87,7 +87,7 @@ extern spinlock_t cmxgcr_lock;
 
 /* Export QE common operations */
 #ifdef CONFIG_QUICC_ENGINE
-extern void __init qe_reset(void);
+extern void qe_reset(void);
 #else
 static inline void qe_reset(void) {}
 #endif
arch/powerpc/sysdev/cpm_common.c +4 -1
index e4b6d66..9de72c9 100644
@@ -72,7 +72,7 @@ static phys_addr_t muram_pbase;
 /* Max address size we deal with */
 #define OF_MAX_ADDR_CELLS	4
 
-int __init cpm_muram_init(void)
+int cpm_muram_init(void)
 {
 	struct device_node *np;
 	struct resource r;
@@ -81,6 +81,9 @@ int __init cpm_muram_init(void)
 	int i = 0;
 	int ret = 0;
 
+	if (muram_pbase)
+		return 0;
+
 	spin_lock_init(&cpm_muram_lock);
 	/* initialize the info header */
 	rh_init(&cpm_muram_info, 1,
arch/powerpc/sysdev/qe_lib/qe.c +7 -5
index fff2701..1ed1a9f 100644
@@ -104,7 +104,7 @@ phys_addr_t get_qe_base(void)
 
 EXPORT_SYMBOL(get_qe_base);
 
-void __init qe_reset(void)
+void qe_reset(void)
 {
 	if (qe_immr == NULL)
 		qe_immr = ioremap(get_qe_base(), QE_IMMAP_SIZE);
@@ -330,16 +330,18 @@ EXPORT_SYMBOL(qe_put_snum);
 static int qe_sdma_init(void)
 {
 	struct sdma __iomem *sdma = &qe_immr->sdma;
-	unsigned long sdma_buf_offset;
+	static unsigned long sdma_buf_offset = (unsigned long)-ENOMEM;
 
 	if (!sdma)
 		return -ENODEV;
 
 	/* allocate 2 internal temporary buffers (512 bytes size each) for
 	 * the SDMA */
- 	sdma_buf_offset = qe_muram_alloc(512 * 2, 4096);
-	if (IS_ERR_VALUE(sdma_buf_offset))
-		return -ENOMEM;
+	if (IS_ERR_VALUE(sdma_buf_offset)) {
+		sdma_buf_offset = qe_muram_alloc(512 * 2, 4096);
+		if (IS_ERR_VALUE(sdma_buf_offset))
+			return -ENOMEM;
+	}
 
 	out_be32(&sdma->sdebcr, (u32) sdma_buf_offset & QE_SDEBCR_BA_MASK);
  	out_be32(&sdma->sdmr, (QE_SDMR_GLB_1_MSK |
Signature · 1 line
1.6.3.3
#3 lore raw

PATCH v4 2/7 powerpc/qe: QE also shuts down on MPC8568

In reply to Anton Vorontsov

It appears that QE shuts down on all MPC85xx CPUs (i.e. MPC8568 and MPC8569) and thus needs reset upon resume.

So modify qe_alive_during_sleep() to account that.

---
 arch/powerpc/include/asm/qe.h   |   23 ++++++++++++++++++++++-
 arch/powerpc/sysdev/qe_lib/qe.c |   13 -------------
 2 files changed, 22 insertions(+), 14 deletions(-)
arch/powerpc/include/asm/qe.h +22 -1
index fe507ff..0947b36 100644
@@ -163,7 +163,28 @@ int qe_get_snum(void);
 void qe_put_snum(u8 snum);
 unsigned int qe_get_num_of_risc(void);
 unsigned int qe_get_num_of_snums(void);
-int qe_alive_during_sleep(void);
+
+static inline int qe_alive_during_sleep(void)
+{
+	/*
+	 * MPC8568E reference manual says:
+	 *
+	 * "...power down sequence waits for all I/O interfaces to become idle.
+	 *  In some applications this may happen eventually without actively
+	 *  shutting down interfaces, but most likely, software will have to
+	 *  take steps to shut down the eTSEC, QUICC Engine Block, and PCI
+	 *  interfaces before issuing the command (either the write to the core
+	 *  MSR[WE] as described above or writing to POWMGTCSR) to put the
+	 *  device into sleep state."
+	 *
+	 * MPC8569E reference manual has a similar paragraph.
+	 */
+#ifdef CONFIG_PPC_85xx
+	return 0;
+#else
+	return 1;
+#endif
+}
 
 /* we actually use cpm_muram implementation, define this for convenience */
 #define qe_muram_init cpm_muram_init
arch/powerpc/sysdev/qe_lib/qe.c +0 -13
index 1ed1a9f..4eaf2a9 100644
@@ -65,19 +65,6 @@ static unsigned int qe_num_of_snum;
 
 static phys_addr_t qebase = -1;
 
-int qe_alive_during_sleep(void)
-{
-	static int ret = -1;
-
-	if (ret != -1)
-		return ret;
-
-	ret = !of_find_compatible_node(NULL, NULL, "fsl,mpc8569-pmc");
-
-	return ret;
-}
-EXPORT_SYMBOL(qe_alive_during_sleep);
-
 phys_addr_t get_qe_base(void)
 {
 	struct device_node *qe;
Signature · 1 line
1.6.3.3
#5 lore raw

PATCH v4 3/7 powerpc/qe: Implement QE driver for handling resume on MPC85xx

In reply to Anton Vorontsov

So far the driver is used to reset QE upon resume, which is needed on 85xx. Later we can move some QE initialization steps into probe().

---
 arch/powerpc/sysdev/qe_lib/qe.c |   34 ++++++++++++++++++++++++++++++++++
 1 files changed, 34 insertions(+), 0 deletions(-)
arch/powerpc/sysdev/qe_lib/qe.c +34 -0
index 4eaf2a9..149393c 100644
@@ -27,6 +27,8 @@
 #include <linux/delay.h>
 #include <linux/ioport.h>
 #include <linux/crc32.h>
+#include <linux/mod_devicetable.h>
+#include <linux/of_platform.h>
 #include <asm/irq.h>
 #include <asm/page.h>
 #include <asm/pgtable.h>
@@ -647,3 +649,35 @@ unsigned int qe_get_num_of_snums(void)
 	return num_of_snums;
 }
 EXPORT_SYMBOL(qe_get_num_of_snums);
+
+#if defined(CONFIG_SUSPEND) && defined(CONFIG_PPC_85xx)
+static int qe_resume(struct of_device *ofdev)
+{
+	if (!qe_alive_during_sleep())
+		qe_reset();
+	return 0;
+}
+
+static int qe_probe(struct of_device *ofdev, const struct of_device_id *id)
+{
+	return 0;
+}
+
+static const struct of_device_id qe_ids[] = {
+	{ .compatible = "fsl,qe", },
+	{ },
+};
+
+static struct of_platform_driver qe_driver = {
+	.driver.name = "fsl-qe",
+	.match_table = qe_ids,
+	.probe = qe_probe,
+	.resume = qe_resume,
+};
+
+static int __init qe_drv_init(void)
+{
+	return of_register_platform_driver(&qe_driver);
+}
+device_initcall(qe_drv_init);
+#endif /* defined(CONFIG_SUSPEND) && defined(CONFIG_PPC_85xx) */
Signature · 1 line
1.6.3.3
#7 lore raw

PATCH v4 4/7 powerpc/85xx/86xx: Add suspend/resume support

In reply to Anton Vorontsov

This patch adds suspend/resume support for MPC8540 and MPC8641D- compatible CPUs. To reach sleep state, we just write the SLP bit into the PM control and status register.

So far we don't support Deep Sleep mode as found in newer MPC85xx CPUs (i.e. MPC8536). It can be relatively easy implemented though, and for it we reserve 'mem' suspend type.

---
 arch/powerpc/Kconfig          |   11 +++++-
 arch/powerpc/sysdev/Makefile  |    1 +
 arch/powerpc/sysdev/fsl_pmc.c |   88 +++++++++++++++++++++++++++++++++++++++++
 3 files changed, 99 insertions(+), 1 deletions(-)
 create mode 100644 arch/powerpc/sysdev/fsl_pmc.c
arch/powerpc/Kconfig +10 -1
index d00131c..a0743a7 100644
@@ -212,7 +212,8 @@ config ARCH_HIBERNATION_POSSIBLE
 
 config ARCH_SUSPEND_POSSIBLE
 	def_bool y
-	depends on ADB_PMU || PPC_EFIKA || PPC_LITE5200 || PPC_83xx
+	depends on ADB_PMU || PPC_EFIKA || PPC_LITE5200 || PPC_83xx || \
+		   PPC_85xx || PPC_86xx
 
 config PPC_DCR_NATIVE
 	bool
@@ -642,6 +643,14 @@ config FSL_PCI
 	select PPC_INDIRECT_PCI
 	select PCI_QUIRKS
 
+config FSL_PMC
+	bool
+	default y
+	depends on SUSPEND && (PPC_85xx || PPC_86xx)
+	help
+	  Freescale MPC85xx/MPC86xx power management controller support
+	  (suspend/resume). For MPC83xx see platforms/83xx/suspend.c
+
 config 4xx_SOC
 	bool
 
arch/powerpc/sysdev/Makefile +1 -0
index 9d4b174..5642924 100644
@@ -16,6 +16,7 @@ obj-$(CONFIG_U3_DART)		+= dart_iommu.o
 obj-$(CONFIG_MMIO_NVRAM)	+= mmio_nvram.o
 obj-$(CONFIG_FSL_SOC)		+= fsl_soc.o
 obj-$(CONFIG_FSL_PCI)		+= fsl_pci.o $(fsl-msi-obj-y)
+obj-$(CONFIG_FSL_PMC)		+= fsl_pmc.o
 obj-$(CONFIG_FSL_LBC)		+= fsl_lbc.o
 obj-$(CONFIG_FSL_GTM)		+= fsl_gtm.o
 obj-$(CONFIG_MPC8xxx_GPIO)	+= mpc8xxx_gpio.o
arch/powerpc/sysdev/fsl_pmc.c new file +88 -0

88 lines not on this page · raw message

Signature · 1 line
1.6.3.3
#9 lore raw

PATCH v4 5/7 powerpc/85xx: Add power management support for MPC85xxMDS boards

In reply to Anton Vorontsov

- Add power management controller nodes;
- Add interrupts for RTC nodes, the RTC interrupt may be used as a wakeup source;
- Add sleep properties and sleep-nexus nodes.

---
 arch/powerpc/boot/dts/mpc8568mds.dts      |  119 +++++++++++++++++++----------
 arch/powerpc/boot/dts/mpc8569mds.dts      |  111 ++++++++++++++++++---------
 arch/powerpc/platforms/85xx/mpc85xx_mds.c |    1 +
 3 files changed, 153 insertions(+), 78 deletions(-)
arch/powerpc/boot/dts/mpc8568mds.dts +79 -40
index 00c2bbd..6d892ba 100644
@@ -40,6 +40,8 @@
 			i-cache-line-size = <32>;	// 32 bytes
 			d-cache-size = <0x8000>;		// L1, 32K
 			i-cache-size = <0x8000>;		// L1, 32K
+			sleep = <&pmc 0x00008000	// core
+				 &pmc 0x00004000>;	// timebase
 			timebase-frequency = <0>;
 			bus-frequency = <0>;
 			clock-frequency = <0>;
@@ -94,31 +96,41 @@
 			interrupts = <16 2>;
 		};
 
-		i2c@3000 {
+		i2c-sleep-nexus {
 			#address-cells = <1>;
-			#size-cells = <0>;
-			cell-index = <0>;
-			compatible = "fsl-i2c";
-			reg = <0x3000 0x100>;
-			interrupts = <43 2>;
-			interrupt-parent = <&mpic>;
-			dfsrr;
+			#size-cells = <1>;
+			compatible = "simple-bus";
+			sleep = <&pmc 0x00000004>;
+			ranges;
 
-			rtc@68 {
-				compatible = "dallas,ds1374";
-				reg = <0x68>;
+			i2c@3000 {
+				#address-cells = <1>;
+				#size-cells = <0>;
+				cell-index = <0>;
+				compatible = "fsl-i2c";
+				reg = <0x3000 0x100>;
+				interrupts = <43 2>;
+				interrupt-parent = <&mpic>;
+				dfsrr;
+
+				rtc@68 {
+					compatible = "dallas,ds1374";
+					reg = <0x68>;
+					interrupts = <3 1>;
+					interrupt-parent = <&mpic>;
+				};
 			};
-		};
 
-		i2c@3100 {
-			#address-cells = <1>;
-			#size-cells = <0>;
-			cell-index = <1>;
-			compatible = "fsl-i2c";
-			reg = <0x3100 0x100>;
-			interrupts = <43 2>;
-			interrupt-parent = <&mpic>;
-			dfsrr;
+			i2c@3100 {
+				#address-cells = <1>;
+				#size-cells = <0>;
+				cell-index = <1>;
+				compatible = "fsl-i2c";
+				reg = <0x3100 0x100>;
+				interrupts = <43 2>;
+				interrupt-parent = <&mpic>;
+				dfsrr;
+			};
 		};
 
 		dma@21300 {
@@ -128,6 +140,8 @@
 			reg = <0x21300 0x4>;
 			ranges = <0x0 0x21100 0x200>;
 			cell-index = <0>;
+			sleep = <&pmc 0x00000400>;
+
 			dma-channel@0 {
 				compatible = "fsl,mpc8568-dma-channel",
 						"fsl,eloplus-dma-channel";
@@ -176,6 +190,7 @@
 			interrupt-parent = <&mpic>;
 			tbi-handle = <&tbi0>;
 			phy-handle = <&phy2>;
+			sleep = <&pmc 0x00000080>;
 
 			mdio@520 {
 				#address-cells = <1>;
@@ -228,6 +243,7 @@
 			interrupt-parent = <&mpic>;
 			tbi-handle = <&tbi1>;
 			phy-handle = <&phy3>;
+			sleep = <&pmc 0x00000040>;
 
 			mdio@520 {
 				#address-cells = <1>;
@@ -242,30 +258,47 @@
 			};
 		};
 
-		serial0: serial@4500 {
-			cell-index = <0>;
-			device_type = "serial";
-			compatible = "ns16550";
-			reg = <0x4500 0x100>;
-			clock-frequency = <0>;
-			interrupts = <42 2>;
-			interrupt-parent = <&mpic>;
+		duart-sleep-nexus {
+			#address-cells = <1>;
+			#size-cells = <1>;
+			compatible = "simple-bus";
+			sleep = <&pmc 0x00000002>;
+			ranges;
+
+			serial0: serial@4500 {
+				cell-index = <0>;
+				device_type = "serial";
+				compatible = "ns16550";
+				reg = <0x4500 0x100>;
+				clock-frequency = <0>;
+				interrupts = <42 2>;
+				interrupt-parent = <&mpic>;
+			};
+
+			serial1: serial@4600 {
+				cell-index = <1>;
+				device_type = "serial";
+				compatible = "ns16550";
+				reg = <0x4600 0x100>;
+				clock-frequency = <0>;
+				interrupts = <42 2>;
+				interrupt-parent = <&mpic>;
+			};
 		};
 
-		global-utilities@e0000 {	//global utilities block
-			compatible = "fsl,mpc8548-guts";
+		global-utilities@e0000 {
+			#address-cells = <1>;
+			#size-cells = <1>;
+			compatible = "fsl,mpc8568-guts", "fsl,mpc8548-guts";
 			reg = <0xe0000 0x1000>;
+			ranges = <0 0xe0000 0x1000>;
 			fsl,has-rstcr;
-		};
 
-		serial1: serial@4600 {
-			cell-index = <1>;
-			device_type = "serial";
-			compatible = "ns16550";
-			reg = <0x4600 0x100>;
-			clock-frequency = <0>;
-			interrupts = <42 2>;
-			interrupt-parent = <&mpic>;
+			pmc: power@70 {
+				compatible = "fsl,mpc8568-pmc",
+					     "fsl,mpc8548-pmc";
+				reg = <0x70 0x20>;
+			};
 		};
 
 		crypto@30000 {
@@ -277,6 +310,7 @@
 			fsl,channel-fifo-len = <24>;
 			fsl,exec-units-mask = <0xfe>;
 			fsl,descriptor-types-mask = <0x12b0ebf>;
+			sleep = <&pmc 0x01000000>;
 		};
 
 		mpic: pic@40000 {
@@ -376,6 +410,7 @@
 		compatible = "fsl,qe";
 		ranges = <0x0 0xe0080000 0x40000>;
 		reg = <0xe0080000 0x480>;
+		sleep = <&pmc 0x00000800>;
 		brg-frequency = <0>;
 		bus-frequency = <396000000>;
 		fsl,qe-num-riscs = <2>;
@@ -509,6 +544,7 @@
 		bus-range = <0 255>;
 		ranges = <0x2000000 0x0 0x80000000 0x80000000 0x0 0x20000000
 			  0x1000000 0x0 0x0 0xe2000000 0x0 0x800000>;
+		sleep = <&pmc 0x80000000>;
 		clock-frequency = <66666666>;
 		#interrupt-cells = <1>;
 		#size-cells = <2>;
@@ -534,6 +570,7 @@
 		bus-range = <0 255>;
 		ranges = <0x2000000 0x0 0xa0000000 0xa0000000 0x0 0x10000000
 			  0x1000000 0x0 0x0 0xe2800000 0x0 0x800000>;
+		sleep = <&pmc 0x20000000>;
 		clock-frequency = <33333333>;
 		#interrupt-cells = <1>;
 		#size-cells = <2>;
@@ -570,5 +607,7 @@
 			      55 2 /* msg2_tx   */
 			      56 2 /* msg2_rx   */>;
 		interrupt-parent = <&mpic>;
+		sleep = <&pmc 0x00080000   /* controller */
+			 &pmc 0x00040000>; /* message unit */
 	};
 };
arch/powerpc/boot/dts/mpc8569mds.dts +73 -38

174 lines not on this page · raw message

arch/powerpc/platforms/85xx/mpc85xx_mds.c +1 -0
index 20a61d0..995ddad 100644
@@ -300,6 +300,7 @@ static struct of_device_id mpc85xx_ids[] = {
 	{ .compatible = "fsl,qe", },
 	{ .compatible = "gianfar", },
 	{ .compatible = "fsl,rapidio-delta", },
+	{ .compatible = "fsl,mpc8548-guts", },
 	{},
 };
 
Signature · 1 line
1.6.3.3
#17 lore raw

PATCH v4 6/7 powerpc/86xx: Add power management support for MPC8610HPCD boards

In reply to Anton Vorontsov

This patch adds needed nodes and properties to support suspend/resume on the MPC8610HPCD boards.

There is a dedicated switch (SW9) that is used to wake up the boards. By default the SW9 button is routed to IRQ8, but could be re-routed (via PIXIS) to sreset.

With 'no_console_suspend' kernel command line argument specified, the board is also able to wakeup upon serial port input.

---
 Documentation/powerpc/dts-bindings/fsl/board.txt |    4 ++
 arch/powerpc/boot/dts/mpc8610_hpcd.dts           |   26 ++++++++++++
 arch/powerpc/platforms/86xx/mpc8610_hpcd.c       |   48 ++++++++++++++++++++--
 3 files changed, 74 insertions(+), 4 deletions(-)
Documentation/powerpc/dts-bindings/fsl/board.txt +4 -0
index e8b5bc2..39e9415 100644
@@ -20,12 +20,16 @@ Required properities:
 - compatible : should be "fsl,fpga-pixis".
 - reg : should contain the address and the length of the FPPGA register
   set.
+- interrupt-parent: should specify phandle for the interrupt controller.
+- interrupts : should specify event (wakeup) IRQ.
 
 Example (MPC8610HPCD):
 
 	board-control@e8000000 {
 		compatible = "fsl,fpga-pixis";
 		reg = <0xe8000000 32>;
+		interrupt-parent = <&mpic>;
+		interrupts = <8 8>;
 	};
 
 * Freescale BCSR GPIO banks
arch/powerpc/boot/dts/mpc8610_hpcd.dts +26 -0
index f468d21..9535ce6 100644
@@ -35,6 +35,8 @@
 			i-cache-line-size = <32>;
 			d-cache-size = <32768>;		// L1
 			i-cache-size = <32768>;		// L1
+			sleep = <&pmc 0x00008000 0	// core
+				 &pmc 0x00004000 0>;	// timebase
 			timebase-frequency = <0>;	// From uboot
 			bus-frequency = <0>;		// From uboot
 			clock-frequency = <0>;		// From uboot
@@ -60,6 +62,7 @@
 			  5 0 0xe8480000 0x00008000
 			  6 0 0xe84c0000 0x00008000
 			  3 0 0xe8000000 0x00000020>;
+		sleep = <&pmc 0x08000000 0>;
 
 		flash@0,0 {
 			compatible = "cfi-flash";
@@ -105,6 +108,8 @@
 			compatible = "fsl,fpga-pixis";
 			reg = <3 0 0x20>;
 			ranges = <0 3 0 0x20>;
+			interrupt-parent = <&mpic>;
+			interrupts = <8 8>;
 
 			sdcsr_pio: gpio-controller@a {
 				#gpio-cells = <2>;
@@ -163,6 +168,7 @@
 			reg = <0x3100 0x100>;
 			interrupts = <43 2>;
 			interrupt-parent = <&mpic>;
+			sleep = <&pmc 0x00000004 0>;
 			dfsrr;
 		};
 
@@ -174,6 +180,7 @@
 			clock-frequency = <0>;
 			interrupts = <42 2>;
 			interrupt-parent = <&mpic>;
+			sleep = <&pmc 0x00000002 0>;
 		};
 
 		serial1: serial@4600 {
@@ -184,6 +191,7 @@
 			clock-frequency = <0>;
 			interrupts = <42 2>;
 			interrupt-parent = <&mpic>;
+			sleep = <&pmc 0x00000008 0>;
 		};
 
 		spi@7000 {
@@ -196,6 +204,7 @@
 			interrupt-parent = <&mpic>;
 			mode = "cpu";
 			gpios = <&sdcsr_pio 7 0>;
+			sleep = <&pmc 0x00000800 0>;
 
 			mmc-slot@0 {
 				compatible = "fsl,mpc8610hpcd-mmc-slot",
@@ -213,6 +222,7 @@
 			reg = <0x2c000 100>;
 			interrupts = <72 2>;
 			interrupt-parent = <&mpic>;
+			sleep = <&pmc 0x04000000 0>;
 		};
 
 		mpic: interrupt-controller@40000 {
@@ -241,9 +251,18 @@
 		};
 
 		global-utilities@e0000 {
+			#address-cells = <1>;
+			#size-cells = <1>;
 			compatible = "fsl,mpc8610-guts";
 			reg = <0xe0000 0x1000>;
+			ranges = <0 0xe0000 0x1000>;
 			fsl,has-rstcr;
+
+			pmc: power@70 {
+				compatible = "fsl,mpc8610-pmc",
+					     "fsl,mpc8641d-pmc";
+				reg = <0x70 0x20>;
+			};
 		};
 
 		wdt@e4000 {
@@ -262,6 +281,7 @@
 			fsl,playback-dma = <&dma00>;
 			fsl,capture-dma = <&dma01>;
 			fsl,fifo-depth = <8>;
+			sleep = <&pmc 0 0x08000000>;
 		};
 
 		ssi@16100 {
@@ -271,6 +291,7 @@
 			interrupt-parent = <&mpic>;
 			interrupts = <63 2>;
 			fsl,fifo-depth = <8>;
+			sleep = <&pmc 0 0x04000000>;
 		};
 
 		dma@21300 {
@@ -280,6 +301,7 @@
 			cell-index = <0>;
 			reg = <0x21300 0x4>; /* DMA general status register */
 			ranges = <0x0 0x21100 0x200>;
+			sleep = <&pmc 0x00000400 0>;
 
 			dma00: dma-channel@0 {
 				compatible = "fsl,mpc8610-dma-channel",
@@ -322,6 +344,7 @@
 			cell-index = <1>;
 			reg = <0xc300 0x4>; /* DMA general status register */
 			ranges = <0x0 0xc100 0x200>;
+			sleep = <&pmc 0x00000200 0>;
 
 			dma-channel@0 {
 				compatible = "fsl,mpc8610-dma-channel",
@@ -369,6 +392,7 @@
 		bus-range = <0 0>;
 		ranges = <0x02000000 0x0 0x80000000 0x80000000 0x0 0x10000000
 			  0x01000000 0x0 0x00000000 0xe1000000 0x0 0x00100000>;
+		sleep = <&pmc 0x80000000 0>;
 		clock-frequency = <33333333>;
 		interrupt-parent = <&mpic>;
 		interrupts = <24 2>;
@@ -398,6 +422,7 @@
 		bus-range = <1 3>;
 		ranges = <0x02000000 0x0 0xa0000000 0xa0000000 0x0 0x10000000
 			  0x01000000 0x0 0x00000000 0xe3000000 0x0 0x00100000>;
+		sleep = <&pmc 0x40000000 0>;
 		clock-frequency = <33333333>;
 		interrupt-parent = <&mpic>;
 		interrupts = <26 2>;
@@ -474,6 +499,7 @@
 				 0x0000 0 0 4 &mpic 7 1>;
 		interrupt-parent = <&mpic>;
 		interrupts = <25 2>;
+		sleep = <&pmc 0x20000000 0>;
 		clock-frequency = <33333333>;
 	};
 };
arch/powerpc/platforms/86xx/mpc8610_hpcd.c +44 -4

76 lines not on this page · raw message

Signature · 1 line
1.6.3.3
#19 lore raw

PATCH v4 7/7 powerpc/83xx: Add power management support for MPC83xx QE boards

In reply to Anton Vorontsov

Simply add power management controller nodes and sleep properties.

---
 arch/powerpc/boot/dts/kmeter1.dts     |    7 +++++++
 arch/powerpc/boot/dts/mpc832x_mds.dts |    9 +++++++++
 arch/powerpc/boot/dts/mpc832x_rdb.dts |    9 +++++++++
 arch/powerpc/boot/dts/mpc836x_mds.dts |    9 +++++++++
 arch/powerpc/boot/dts/mpc836x_rdk.dts |    9 +++++++++
 5 files changed, 43 insertions(+), 0 deletions(-)
arch/powerpc/boot/dts/kmeter1.dts +7 -0
index 167044f..65b8b4f 100644
@@ -59,6 +59,13 @@
 		reg = <0xe0000000 0x00000200>;
 		bus-frequency = <0>;	/* Filled in by U-Boot */
 
+		pmc: power@b00 {
+			compatible = "fsl,mpc8360-pmc", "fsl,mpc8349-pmc";
+			reg = <0xb00 0x100 0xa00 0x100>;
+			interrupts = <80 0x8>;
+			interrupt-parent = <&ipic>;
+		};
+
 		i2c@3000 {
 			#address-cells = <1>;
 			#size-cells = <0>;
arch/powerpc/boot/dts/mpc832x_mds.dts +9 -0
index 436c9c6..05ad8c9 100644
@@ -79,6 +79,13 @@
 			reg = <0x200 0x100>;
 		};
 
+		pmc: power@b00 {
+			compatible = "fsl,mpc8323-pmc", "fsl,mpc8349-pmc";
+			reg = <0xb00 0x100 0xa00 0x100>;
+			interrupts = <80 0x8>;
+			interrupt-parent = <&ipic>;
+		};
+
 		i2c@3000 {
 			#address-cells = <1>;
 			#size-cells = <0>;
@@ -163,6 +170,7 @@
 			fsl,channel-fifo-len = <24>;
 			fsl,exec-units-mask = <0x4c>;
 			fsl,descriptor-types-mask = <0x0122003f>;
+			sleep = <&pmc 0x03000000>;
 		};
 
 		ipic: pic@700 {
@@ -428,5 +436,6 @@
 		       0xe0008300 0x8>;		/* config space access registers */
 		compatible = "fsl,mpc8349-pci";
 		device_type = "pci";
+		sleep = <&pmc 0x00010000>;
 	};
 };
arch/powerpc/boot/dts/mpc832x_rdb.dts +9 -0
index 9a0952f..f4fadb2 100644
@@ -62,6 +62,13 @@
 			reg = <0x200 0x100>;
 		};
 
+		pmc: power@b00 {
+			compatible = "fsl,mpc8323-pmc", "fsl,mpc8349-pmc";
+			reg = <0xb00 0x100 0xa00 0x100>;
+			interrupts = <80 0x8>;
+			interrupt-parent = <&ipic>;
+		};
+
 		i2c@3000 {
 			#address-cells = <1>;
 			#size-cells = <0>;
@@ -141,6 +148,7 @@
 			fsl,channel-fifo-len = <24>;
 			fsl,exec-units-mask = <0x4c>;
 			fsl,descriptor-types-mask = <0x0122003f>;
+			sleep = <&pmc 0x03000000>;
 		};
 
 		ipic:pic@700 {
@@ -360,5 +368,6 @@
 		       0xe0008300 0x8>;		/* config space access registers */
 		compatible = "fsl,mpc8349-pci";
 		device_type = "pci";
+		sleep = <&pmc 0x00010000>;
 	};
 };
arch/powerpc/boot/dts/mpc836x_mds.dts +9 -0
index 39ff4c8..45cfa1c 100644
@@ -99,6 +99,13 @@
 			reg = <0x200 0x100>;
 		};
 
+		pmc: power@b00 {
+			compatible = "fsl,mpc8360-pmc", "fsl,mpc8349-pmc";
+			reg = <0xb00 0x100 0xa00 0x100>;
+			interrupts = <80 0x8>;
+			interrupt-parent = <&ipic>;
+		};
+
 		i2c@3000 {
 			#address-cells = <1>;
 			#size-cells = <0>;
@@ -194,6 +201,7 @@
 			fsl,channel-fifo-len = <24>;
 			fsl,exec-units-mask = <0x7e>;
 			fsl,descriptor-types-mask = <0x01010ebf>;
+			sleep = <&pmc 0x03000000>;
 		};
 
 		ipic: pic@700 {
@@ -470,5 +478,6 @@
 		       0xe0008300 0x8>;		/* config space access registers */
 		compatible = "fsl,mpc8349-pci";
 		device_type = "pci";
+		sleep = <&pmc 0x00010000>;
 	};
 };
arch/powerpc/boot/dts/mpc836x_rdk.dts +9 -0
index 6315d6f..bdf4459 100644
@@ -71,6 +71,13 @@
 			reg = <0x200 0x100>;
 		};
 
+		pmc: power@b00 {
+			compatible = "fsl,mpc8360-pmc", "fsl,mpc8349-pmc";
+			reg = <0xb00 0x100 0xa00 0x100>;
+			interrupts = <80 0x8>;
+			interrupt-parent = <&ipic>;
+		};
+
 		i2c@3000 {
 			#address-cells = <1>;
 			#size-cells = <0>;
@@ -161,6 +168,7 @@
 			fsl,channel-fifo-len = <24>;
 			fsl,exec-units-mask = <0x7e>;
 			fsl,descriptor-types-mask = <0x01010ebf>;
+			sleep = <&pmc 0x03000000>;
 		};
 
 		ipic: interrupt-controller@700 {
@@ -455,6 +463,7 @@
 				 0xa800 0 0 2 &ipic 20 8
 				 0xa800 0 0 3 &ipic 21 8
 				 0xa800 0 0 4 &ipic 18 8>;
+		sleep = <&pmc 0x00010000>;
 		/* filled by u-boot */
 		bus-range = <0 0>;
 		clock-frequency = <0>;
Signature · 1 line
1.6.3.3
Applied
#2 lore raw

Re: [PATCH 1/7] powerpc/qe: Make qe_reset() code path safe for repeated invocation

In reply to Anton Vorontsov
Quoted 9 lines · Anton Vorontsov

For MPC8569 CPUs we'll need to reset QE after each suspend, so make qe_reset() code path suitable for repeated invocation, that is:

- Don't initialize rheap structures if already initialized;
- Don't allocate muram for SDMA if already allocated, just reinitialize
registers with previously allocated muram offset;
- Remove __init attributes from qe_reset() and cpm_muram_init();

Quoted 6 lines

---

arch/powerpc/include/asm/qe.h    |    2 +-
arch/powerpc/sysdev/cpm_common.c |    5 ++++-
arch/powerpc/sysdev/qe_lib/qe.c  |   12 +++++++-----
3 files changed, 12 insertions(+), 7 deletions(-)

applied to next.

- k

Applied
#4 lore raw

Re: [PATCH 2/7] powerpc/qe: QE also shuts down on MPC8568

In reply to Anton Vorontsov
Quoted 10 lines · Anton Vorontsov

It appears that QE shuts down on all MPC85xx CPUs (i.e. MPC8568 and MPC8569) and thus needs reset upon resume.

So modify qe_alive_during_sleep() to account that.

---

arch/powerpc/include/asm/qe.h   |   23 ++++++++++++++++++++++-
arch/powerpc/sysdev/qe_lib/qe.c |   13 -------------
2 files changed, 22 insertions(+), 14 deletions(-)

applied to next.

- k

#10 lore raw

Re: [PATCH 5/7] powerpc/85xx: Add power management support for MPC85xxMDS boards

In reply to Anton Vorontsov
Quoted 7 lines · Anton Vorontsov

- Add power management controller nodes;
- Add interrupts for RTC nodes, the RTC interrupt may be used as a wakeup source;
- Add sleep properties and sleep-nexus nodes.

Quoted 7 lines

---
arch/powerpc/boot/dts/mpc8568mds.dts | 119 ++++++++++++++++++

+----------
arch/powerpc/boot/dts/mpc8569mds.dts      |  111 +++++++++++++++++ 
+---------
arch/powerpc/platforms/85xx/mpc85xx_mds.c |    1 +
3 files changed, 153 insertions(+), 78 deletions(-)
arch/powerpc/boot/dts/mpc8568mds.dts +0 -0
index 00c2bbd..6d892ba 100644
@@ -40,6 +40,8 @@
			i-cache-line-size = <32>;	// 32 bytes
			d-cache-size = <0x8000>;		// L1, 32K
			i-cache-size = <0x8000>;		// L1, 32K

+ sleep = <&pmc 0x00008000 // core
+ &pmc 0x00004000>; // timebase

Just so I'm clear this is the devdisr bit position?

- k

#11 lore raw

Re: [PATCH 5/7] powerpc/85xx: Add power management support for MPC85xxMDS boards

Quoted 29 lines · Kumar Gala
Quoted 14 lines · Anton Vorontsov

- Add power management controller nodes;
- Add interrupts for RTC nodes, the RTC interrupt may be used as a wakeup source;
- Add sleep properties and sleep-nexus nodes.

---
arch/powerpc/boot/dts/mpc8568mds.dts | 119 ++++++++++++++++++

+----------
arch/powerpc/boot/dts/mpc8569mds.dts      |  111 +++++++++++++++++ 
+---------
arch/powerpc/platforms/85xx/mpc85xx_mds.c |    1 +
3 files changed, 153 insertions(+), 78 deletions(-)
arch/powerpc/boot/dts/mpc8568mds.dts +2 -0
index 00c2bbd..6d892ba 100644
@@ -40,6 +40,8 @@
 			i-cache-line-size = <32>;	// 32 bytes
 			d-cache-size = <0x8000>;		// L1, 32K
 			i-cache-size = <0x8000>;		// L1, 32K
+			sleep = <&pmc 0x00008000	// core
+				 &pmc 0x00004000>;	// timebase
 
Quoted 1 line

Just so I'm clear this is the devdisr bit position?

Also where in the code do we use this? I'm not seeing it.

- k

#13 lore raw

Re: [PATCH 5/7] powerpc/85xx: Add power management support for MPC85xxMDS boards

In reply to Kumar Gala

On Thu, Nov 05, 2009 at 07:58:49AM -0600, Kumar Gala wrote:
[...]

Quoted 10 lines
arch/powerpc/boot/dts/mpc8568mds.dts +2 -0
@@ -40,6 +40,8 @@
 			i-cache-line-size = <32>;	// 32 bytes
 			d-cache-size = <0x8000>;		// L1, 32K
 			i-cache-size = <0x8000>;		// L1, 32K
+			sleep = <&pmc 0x00008000	// core
+				 &pmc 0x00004000>;	// timebase
 

Just so I'm clear this is the devdisr bit position?

Yep, as described in the bindings.

Thanks,

Signature · 3 lines
Anton Vorontsov
email: [email protected]
irc://irc.freenode.net/bd2
#14 lore raw

Re: [PATCH 5/7] powerpc/85xx: Add power management support for MPC85xxMDS boards

Quoted 11 lines · Anton Vorontsov

On Thu, Nov 05, 2009 at 07:58:49AM -0600, Kumar Gala wrote:
[...]

Quoted 9 lines
arch/powerpc/boot/dts/mpc8568mds.dts +2 -0
@@ -40,6 +40,8 @@
 			i-cache-line-size = <32>;	// 32 bytes
 			d-cache-size = <0x8000>;		// L1, 32K
 			i-cache-size = <0x8000>;		// L1, 32K
+			sleep = <&pmc 0x00008000	// core
+				 &pmc 0x00004000>;	// timebase
 
Quoted 3 lines
Quoted 1 line

Just so I'm clear this is the devdisr bit position?

Yep, as described in the bindings.

I don't think the binding is clear that for 85xx these are DEVDISR bit positions for the given SoC.

- k

#12 lore raw

Re: [PATCH 5/7] powerpc/85xx: Add power management support for MPC85xxMDS boards

In reply to Kumar Gala

On Thu, Nov 05, 2009 at 08:02:44AM -0600, Kumar Gala wrote:
[...]

Quoted 12 lines
Quoted 12 lines
arch/powerpc/ renamed from arch/powerpc/boot/dts/mpc8568mds.dts +0 -0

boot/dts/mpc8568mds.dts
index 00c2bbd..6d892ba 100644

arch/powerpc/boot/dts/mpc8568mds.dts +2 -0
@@ -40,6 +40,8 @@
 			i-cache-line-size = <32>;	// 32 bytes
 			d-cache-size = <0x8000>;		// L1, 32K
 			i-cache-size = <0x8000>;		// L1, 32K
+			sleep = <&pmc 0x00008000	// core
+				 &pmc 0x00004000>;	// timebase
 
Quoted 3 lines
Quoted 1 line

Just so I'm clear this is the devdisr bit position?

Also where in the code do we use this? I'm not seeing it.

We don't use it (yet). The per-device power management is not yet implemented. It is relatively easy to do on 83xx, but on 85xx there is a restriction: we can't re-enable the device after we disable it, i.e. POR sequence is needed. Though, we may want to disable all 'unused' (say echo 1 > /sys/devices/.../permanently_disable) to save some power.

Thanks,

Signature · 3 lines
Anton Vorontsov
email: [email protected]
irc://irc.freenode.net/bd2
Applied
#6 lore raw

Re: [PATCH 3/7] powerpc/qe: Implement QE driver for handling resume on MPC85xx

In reply to Anton Vorontsov
Quoted 8 lines · Anton Vorontsov

So far the driver is used to reset QE upon resume, which is needed on 85xx. Later we can move some QE initialization steps into probe().

---
arch/powerpc/sysdev/qe_lib/qe.c | 34 ++++++++++++++++++++++++++++++
++++

1 files changed, 34 insertions(+), 0 deletions(-)

applied to next

- k

Applied
#16 lore raw

Re: [PATCH 5/7] powerpc/85xx: Add power management support for MPC85xxMDS boards

In reply to Anton Vorontsov
Quoted 7 lines · Anton Vorontsov

- Add power management controller nodes;
- Add interrupts for RTC nodes, the RTC interrupt may be used as a wakeup source;
- Add sleep properties and sleep-nexus nodes.

Quoted 7 lines

---
arch/powerpc/boot/dts/mpc8568mds.dts | 119 ++++++++++++++++++

+----------
arch/powerpc/boot/dts/mpc8569mds.dts      |  111 +++++++++++++++++ 
+---------
arch/powerpc/platforms/85xx/mpc85xx_mds.c |    1 +
3 files changed, 153 insertions(+), 78 deletions(-)

applied to next

- k

Applied
#8 lore raw

Re: [PATCH 4/7] powerpc/85xx/86xx: Add suspend/resume support

In reply to Anton Vorontsov
Quoted 10 lines · Anton Vorontsov

This patch adds suspend/resume support for MPC8540 and MPC8641D- compatible CPUs. To reach sleep state, we just write the SLP bit into the PM control and status register.

So far we don't support Deep Sleep mode as found in newer MPC85xx CPUs (i.e. MPC8536). It can be relatively easy implemented though, and for it we reserve 'mem' suspend type.

Quoted 7 lines

---

arch/powerpc/Kconfig          |   11 +++++-
arch/powerpc/sysdev/Makefile  |    1 +
arch/powerpc/sysdev/fsl_pmc.c |   88 ++++++++++++++++++++++++++++++++ 
+++++++++
3 files changed, 99 insertions(+), 1 deletions(-)

create mode 100644 arch/powerpc/sysdev/fsl_pmc.c

applied to next

- k

Applied
#18 lore raw

Re: [PATCH 6/7] powerpc/86xx: Add power management support for MPC8610HPCD boards

In reply to Anton Vorontsov
Quoted 10 lines · Anton Vorontsov

This patch adds needed nodes and properties to support suspend/resume on the MPC8610HPCD boards.

There is a dedicated switch (SW9) that is used to wake up the boards. By default the SW9 button is routed to IRQ8, but could be re-routed (via PIXIS) to sreset.

With 'no_console_suspend' kernel command line argument specified, the board is also able to wakeup upon serial port input.

Quoted 8 lines

---

Documentation/powerpc/dts-bindings/fsl/board.txt |    4 ++
arch/powerpc/boot/dts/mpc8610_hpcd.dts           |   26 ++++++++++++
arch/powerpc/platforms/86xx/mpc8610_hpcd.c       |   48 +++++++++++++ 
+++++++--
3 files changed, 74 insertions(+), 4 deletions(-)

applied to next

- k

Applied
#20 lore raw

Re: [PATCH 7/7] powerpc/83xx: Add power management support for MPC83xx QE boards

In reply to Anton Vorontsov
Quoted 11 lines · Anton Vorontsov

Simply add power management controller nodes and sleep properties.

---

arch/powerpc/boot/dts/kmeter1.dts     |    7 +++++++
arch/powerpc/boot/dts/mpc832x_mds.dts |    9 +++++++++
arch/powerpc/boot/dts/mpc832x_rdb.dts |    9 +++++++++
arch/powerpc/boot/dts/mpc836x_mds.dts |    9 +++++++++
arch/powerpc/boot/dts/mpc836x_rdk.dts |    9 +++++++++
5 files changed, 43 insertions(+), 0 deletions(-)

applied to next

- k

#15 lore raw

Re: [PATCH 5/7] powerpc/85xx: Add power management support for MPC85xxMDS boards

In reply to Kumar Gala
Quoted 14 lines · Kumar Gala
Quoted 11 lines · Anton Vorontsov

On Thu, Nov 05, 2009 at 07:58:49AM -0600, Kumar Gala wrote:
[...]

Quoted 9 lines
arch/powerpc/boot/dts/mpc8568mds.dts +2 -0
@@ -40,6 +40,8 @@
 			i-cache-line-size = <32>;	// 32 bytes
 			d-cache-size = <0x8000>;		// L1, 32K
 			i-cache-size = <0x8000>;		// L1, 32K
+			sleep = <&pmc 0x00008000	// core
+				 &pmc 0x00004000>;	// timebase
 
Quoted 8 lines
Quoted 3 lines
Quoted 1 line

Just so I'm clear this is the devdisr bit position?

Yep, as described in the bindings.

I don't think the binding is clear that for 85xx these are DEVDISR bit positions for the given SoC.

From dts-bindings/fsl/pmc.txt:

fsl,mpc8548-pmc: Sleep specifiers consist of one or two cells, the first of which will be ORed into DEVDISR (and the second into DEVDISR2, if present -- this cell should be zero or absent if the hardware does not have DEVDISR2) upon a request for permanent device disabling. This sleep controller does not support configuring devices to disable during system sleep (unless supported by another compatible match), or dynamically.

-Scott