Suspend/resume support for some 83xx/85xx/86xx boards
v2 cover Suspend/resume support for some 83xx/85xx/86xx boards
Quoted 2 lines · Kumar Gala
Quoted 2 lines
This patch adds suspend/resume support for MPC8540-compatible and MPC8569 CPUs.
[...]
Quoted 2 lines
I'd also like to get Scott's Ack on this and the device tree patches before accepting them.
Heh, I didn't notice that the PMC bindings for 85xx describe devdisr registers (and thus sleep = <> properties).
So here are updated patches that should comply with the bindings. Plus,
- It appears that 86xx PMCs registers-compatible with 85xx, so we can support both. Thus move 85xx/suspend.c to sysdev/fsl_pmc.c;
- New patch that adds suspend/resume for MPC8610HPCD;
- New patch that adds suspend/resume for 83xx QE boards;
- Some fixes in "Make qe_reset() code path safe for repeated invocation" patch.
Thanks,
Signature · 3 lines
Anton Vorontsov email: [email protected] irc://irc.freenode.net/bd2
PATCH v2 1/5 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
@@ -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
@@ -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
@@ -91,7 +91,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 );
@@ -317,16 +317,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
PATCH v2 2/5 powerpc/85xx/86xx: Add suspend/resume support
In reply to Anton VorontsovThis patch adds suspend/resume support for MPC8540, MPC8569 and MPC8641D-compatible CPUs.
MPC8540 and MPC8641D-compatible PMCs are trivial: we just write the SLP bit into the PM control and status register.
MPC8569 is a bit trickier, QE turns off during suspend, thus on resume we must reload QE microcode and reset QE.
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 | 124 +++++++++++++++++++++++++++++++++++++++++ 3 files changed, 135 insertions(+), 1 deletions(-) create mode 100644 arch/powerpc/sysdev/fsl_pmc.c
arch/powerpc/Kconfig +10 -1
@@ -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
@@ -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 +124 -0
124 lines not on this page · raw message
Signature · 1 line
1.6.3.3
PATCH v2 3/5 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
@@ -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
@@ -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
PATCH v2 4/5 powerpc/86xx: Add power management support for MPC8610HPCD boards
In reply to Anton VorontsovThis 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
@@ -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
@@ -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
PATCH v2 5/5 powerpc/83xx: Add power management support for MPC83xx QE boards
In reply to Anton VorontsovSimply 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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
RE: [PATCH 1/5] powerpc/qe: Make qe_reset() code path safe for repeated invocation
In reply to Anton VorontsovIs the need to reinitialize the QE after resume something that is unique to the 8569, or would it apply to the 8360 and 8323 also?
-----Original Message-----
From: Anton Vorontsov [mailto:[email protected]]
Sent: Sun 8/30/2009 2:37 PM
To: Kumar Gala
Cc: Tabi Timur-B04825; Wood Scott-B07421; [email protected]
Subject: [PATCH 1/5] 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
@@ -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
@@ -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
@@ -91,7 +91,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 );
@@ -317,16 +317,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
RE: [PATCH 2/5] powerpc/85xx/86xx: Add suspend/resume support
In reply to Anton VorontsovWhat about the 8610?
-----Original Message-----
From: Anton Vorontsov [mailto:[email protected]]
Sent: Sun 8/30/2009 2:37 PM
To: Kumar Gala
Cc: Tabi Timur-B04825; Wood Scott-B07421; [email protected]
Subject: [PATCH 2/5] powerpc/85xx/86xx: Add suspend/resume support
This patch adds suspend/resume support for MPC8540, MPC8569 and MPC8641D-compatible CPUs.
MPC8540 and MPC8641D-compatible PMCs are trivial: we just write the SLP bit into the PM control and status register.
MPC8569 is a bit trickier, QE turns off during suspend, thus on resume we must reload QE microcode and reset QE.
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.
Re: [PATCH 1/5] powerpc/qe: Make qe_reset() code path safe for repeated invocation
In reply to Tabi Timur-B04825Quoted 2 lines · On Sun, Aug 30, 2009 at 05:36:28PM -0700, Tabi Timur-B04825 wrote:
Is the need to reinitialize the QE after resume something that is unique to the 8569, or would it apply to the 8360 and 8323 also?
8569 is unique in this regard, though I'm not sure if that's by design or because of some errata.
Just as 8569 is unique that it needs QE microcode loaded externally since the CPU doesn't have any ROM where the microcode can be stored.
Thanks,
Signature · 3 lines
Anton Vorontsov email: [email protected] irc://irc.freenode.net/bd2
Re: [PATCH 2/5] powerpc/85xx/86xx: Add suspend/resume support
In reply to Tabi Timur-B04825Quoted 2 lines · On Sun, Aug 30, 2009 at 05:38:05PM -0700, Tabi Timur-B04825 wrote:
What about the 8610?
Yes, it is supported. The bindings decribe that 8641d should be used as a base match, so 8610-pmc is 8641d-compatible.
Thanks,
Signature · 3 lines
Anton Vorontsov email: [email protected] irc://irc.freenode.net/bd2
Quoted 13 lines · Anton Vorontsov
Quoted 2 lines · Kumar Gala
Quoted 2 lines
This patch adds suspend/resume support for MPC8540-compatible and MPC8569 CPUs.
[...]
Quoted 2 lines
I'd also like to get Scott's Ack on this and the device tree patches before accepting them.
Heh, I didn't notice that the PMC bindings for 85xx describe devdisr registers (and thus sleep = <> properties).
So here are updated patches that should comply with the bindings. Plus,
Quoted 6 lines
- It appears that 86xx PMCs registers-compatible with 85xx, so we can support both. Thus move
85xx/suspend.ctosysdev/fsl_pmc.c;
- New patch that adds suspend/resume for MPC8610HPCD;
- New patch that adds suspend/resume for 83xx QE boards;
- Some fixes in "Makeqe_reset()code path safe for repeated invocation" patch.
Kumar,
Is there any issues with the patches? Can you merge them for 2.6.32?
Thanks!
Signature · 3 lines
Anton Vorontsov email: [email protected] irc://irc.freenode.net/bd2
Re: [PATCH 2/5] powerpc/85xx/86xx: Add suspend/resume support
In reply to Anton VorontsovQuoted 6 lines · Anton Vorontsov
This patch adds suspend/resume support for MPC8540, MPC8569 and MPC8641D-compatible CPUs.
MPC8540 and MPC8641D-compatible PMCs are trivial: we just write the SLP bit into the PM control and status register.
Quoted 6 lines
MPC8569 is a bit trickier, QE turns off during suspend, thus on resume we must reload QE microcode and reset QE.
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.
We've got some code floating around here for that; it's just been falling through the cracks as far as getting a chance to clean up and push upstream. Hopefully it'll happen soon.
Quoted 13 lines
Signed-off-by Anton Vorontsov <[email protected]>--- arch/powerpc/Kconfig | 11 +++- arch/powerpc/sysdev/Makefile | 1 + arch/powerpc/sysdev/fsl_pmc.c | 124 +++++++++++++++++++++++++++++++++++++++++ 3 files changed, 135 insertions(+), 1 deletions(-) create mode 100644 arch/powerpc/sysdev/fsl_pmc.carch/powerpc/Kconfig +0
-0
arch/powerpc/Kconfig config ARCH_HIBERNATION_POSSIBLE · line 216
Quoted 6 lines
arch/powerpc/Kconfig +2
-1@@ -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
This isn't directed at this patch, but why do we need this list? Can't each platform figure out for itself whether it can actually register that suspend_ops struct, just like any other driver?
arch/powerpc/Kconfig config FSL_PCI · line 652
Quoted 13 lines
arch/powerpc/Kconfig +7
-0config 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
I wish we had a better name for 85xx+86xx than "FSL". :-(
arch/powerpc/Kconfig config FSL_PCI · line 656
Quoted 4 lines
arch/powerpc/Kconfig +4
-0+static int pmc_suspend_enter(suspend_state_t state) +{ + setbits32(&pmc_regs->pmcsr, PMCSR_SLP); + /* At this point, the CPU is asleep. */
I'm not sure that we're guaranteed that the sleep has taken effect immediately -- we may need to do a loop waiting for it to clear (on 85xx), probably with some delays to give the bus a chance to become idle.
I'm not sure how much of that is necessary under certain conditions, versus just paranoia, though. Something like what you have here worked well enough for us in testing -- but having that clear immediately after makes me nervous. At least a read-back seems appropriate (which I suppose the clbits32 does, but I'd prefer something more explicit).
arch/powerpc/Kconfig config FSL_PCI
Quoted 2 lines
arch/powerpc/Kconfig +2
-0+ /* For 86xx we need to clear the bit on resume, 85xx don't care. */ + clrbits32(&pmc_regs->pmcsr, PMCSR_SLP);
Hmm, how does this work? Does it only enter sleep mode on the rising edge of that bit?
The 8610 manual says that that bit should only be set as part of a sequence also involving the use of MSR[POW] (section 23.5.1.4).
arch/powerpc/Kconfig
Quoted 9 lines
arch/powerpc/Kconfig +9
-0+ if (pmc_qefw) { + int ret; + + ret = qe_upload_firmware(pmc_qefw); + if (ret) + dev_err(pmc_dev, "could not upload firmware\n"); + + qe_reset(); + }
Does this really belong here, or should the QE subsystem have a device struct with suspend/resume ops?
-Scott
Quoted 7 lines · Anton Vorontsov
Quoted 6 lines · Anton Vorontsov
Quoted 2 lines · Kumar Gala
Quoted 2 lines
This patch adds suspend/resume support for MPC8540-compatible and MPC8569 CPUs.
[...]
Quoted 2 lines
I'd also like to get Scott's Ack on this and the device tree patches before accepting them.
ACK the device tree stuff.
-Scott
PATCH v3 2/5 powerpc/85xx/86xx: Add suspend/resume support
In reply to Scott WoodThis patch adds suspend/resume support for MPC8540, MPC8569 and MPC8641D-compatible CPUs.
MPC8540 and MPC8641D-compatible PMCs are trivial: we just write the SLP bit into the PM control and status register.
MPC8569 is a bit trickier, QE turns off during suspend, thus on resume we must reload QE microcode and reset QE.
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.
---
On Mon, Sep 14, 2009 at 12:28:11PM -0500, Scott Wood wrote:
[...]
Quoted 7 lines
Quoted 3 lines
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.
We've got some code floating around here for that; it's just been falling through the cracks as far as getting a chance to clean up and push upstream. Hopefully it'll happen soon.
Nice.
[...]
Quoted 12 lines
Review config ARCH_HIBERNATION_POSSIBLE · line 216
Quoted 8 lines
+++ b/arch/powerpc/Kconfig
(quoted diff) +2
-1@@ -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_86xxThis isn't directed at this patch, but why do we need this list? Can't each platform figure out for itself whether it can actually register that
suspend_opsstruct, just like any other driver?
Good question. Disabling PM also makes some drivers less tested, since there are a lot of #ifdef CONFIG_PM in the drivers.
Though in this patch I'm just following current practice, if a cleanup patch for all platforms is desired, I can readily implement it.
[...]
Quoted 9 lines
Review config ARCH_HIBERNATION_POSSIBLE
Quoted 7 lines
(quoted diff) +7
-0+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.cI wish we had a better name for 85xx+86xx than "FSL". :-(
Ditto. It took me quite some time to pick the name, couldn't find anything better.
Quoted 8 lines
Review
Quoted 4 lines
(quoted diff) +4
-0+static int pmc_suspend_enter(suspend_state_t state) +{ + setbits32(&pmc_regs->pmcsr, PMCSR_SLP); + /* At this point, the CPU is asleep. */I'm not sure that we're guaranteed that the sleep has taken effect immediately -- we may need to do a loop waiting for it to clear (on 85xx), probably with some delays to give the bus a chance to become idle.
Brilliant idea, thanks!
But it works vice versa: upon write, the code flow stops immediately (on 85xx and 86xx), so there wouldn't any point in trying to readback the pmcsr. But upon resume, on 86xx (and most probably on 85xx, though we don't see it), the SLP bit doesn't clear immediately, we have to wait for it. This eliminates the need for clearing the bit for 86xx (i.e. the clearing operation worked as a small delay).
Quoted 8 lines
I'm not sure how much of that is necessary under certain conditions, versus just paranoia, though.
Something like what you have here worked
well enough for us in testing -- but having that clear immediately after makes me nervous. At least a read-back seems appropriate (which I suppose the clbits32 does, but I'd prefer something more explicit).
Quoted 5 lines
Review
Quoted 2 lines
(quoted diff) +2
-0+ /* For 86xx we need to clear the bit on resume, 85xx don't care. */ + clrbits32(&pmc_regs->pmcsr, PMCSR_SLP);Hmm, how does this work? Does it only enter sleep mode on the rising edge of that bit?
No, it appears it is the same as in 85xx, the bit clears by itself, but we must wait for it. So your idea about looping and reading the register actually eliminates the need for clrbits32(). Without the clrbit32 (aka delay) or proper looping we would let device drivers to resume too early, and things, obviously, didn't work.
Quoted 2 lines
The 8610 manual says that that bit should only be set as part of a sequence also involving the use of MSR[POW] (section 23.5.1.4).
Well, 23.4.1.12 says:
| Sleep status
| 0 The device is not attempting to reach sleep mode.
| 1 The device is attempting to enter sleep mode because
| POWMGTCSR[SLP] is set, or HID0[SLEEP] and MSR[POW] in
^^| the e600 core are set. The core has halted fetching, snooping | to the L1 and L2 caches is disabled, ....
The same in 85xx specs.
I can confirm this on real hw, after setting the SLP bit, the 8610 actually goes into sleep mode, no code flow happens until a wakeup event. So playing with MSR[POW] doesn't seem to be necessary. The same for 85xx.
Quoted 4 lines
Quoted 4 lines
(quoted diff) +4
-0+ if (pmc_qefw) { + int ret; + + ret = qe_upload_firmware(pmc_qefw);
Quoted 8 lines
Review
Quoted 5 lines
(quoted diff) +5
-0+ if (ret) + dev_err(pmc_dev, "could not upload firmware\n"); + + qe_reset(); + }Does this really belong here, or should the QE subsystem have a device struct with suspend/resume ops?
This exact snippet could be moved to the "qe" device driver, yes. But I didn't bother because fsl_pmc have to request the QE firmware.
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).
We can solve that by implementing ppc_md.suspend_prepare() (must be called from userspace context), there we could request the firmware. Then QE device driver would reload it in its resume() callback. Needless to say that it makes things a bit more complicated to follow.
The current code vanishes without QE anyway. But if you insist, I can do the suspend_prepare() thing, although I'd prefer it as a cleanup patch for 2.6.33, since it would touch more code, specifically I'm concerned about ppc generic files.
How about this patch?
Thanks!
arch/powerpc/Kconfig | 11 +++- arch/powerpc/sysdev/Makefile | 1 + arch/powerpc/sysdev/fsl_pmc.c | 131 +++++++++++++++++++++++++++++++++++++++++ 3 files changed, 142 insertions(+), 1 deletions(-) create mode 100644 arch/powerpc/sysdev/fsl_pmc.c
arch/powerpc/Kconfig +10 -1
@@ -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
@@ -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 +131 -0
131 lines not on this page · raw message
Signature · 1 line
1.6.3.3
Re: [PATCH v3 2/5] powerpc/85xx/86xx: Add suspend/resume support
Quoted 6 lines · Anton Vorontsov
This patch adds suspend/resume support for MPC8540, MPC8569 and MPC8641D-compatible CPUs.
MPC8540 and MPC8641D-compatible PMCs are trivial: we just write the SLP bit into the PM control and status register.
Quoted 8 lines
MPC8569 is a bit trickier, QE turns off during suspend, thus on resume we must reload QE microcode and reset QE.
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.
Signed-off-by Anton Vorontsov <[email protected]>
Quoted 8 lines
Quoted 3 lines
I'm not sure that we're guaranteed that the sleep has taken effect immediately -- we may need to do a loop waiting for it to clear (on 85xx), probably with some delays to give the bus a chance to become idle.
Brilliant idea, thanks!
But it works vice versa: upon write, the code flow stops immediately (on 85xx and 86xx),
That's what I've observed as well; the question is whether it's always guaranteed to be immediate.
Quoted 13 lines
Quoted 2 lines
The 8610 manual says that that bit should only be set as part of a sequence also involving the use of MSR[POW] (section 23.5.1.4).
Well, 23.4.1.12 says:
| Sleep status | 0 The device is not attempting to reach sleep mode. | 1 The device is attempting to enter sleep mode because | POWMGTCSR[SLP] is set, or HID0[SLEEP] and MSR[POW] in ^^| the e600 core are set. The core has halted fetching, snooping | to the L1 and L2 caches is disabled, ....
Quoted 6 lines
The same in 85xx specs.
I can confirm this on real hw, after setting the SLP bit, the 8610 actually goes into sleep mode, no code flow happens until a wakeup event. So playing with MSR[POW] doesn't seem to be necessary. The same for 85xx.
OK, looks like section 23.5.1.4 is just bogus.
Quoted 6 lines
This exact snippet could be moved to the "qe" device driver, yes. But I didn't bother because
fsl_pmchave to request the QE firmware.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).
Is there any way for software to read out the current firmware from the device, or is it write-only?
Quoted 10 lines
We can solve that by implementing
ppc_md.suspend_prepare()(must be called from userspace context), there we could request the firmware. Then QE device driver would reload it in itsresume()callback. Needless to say that it makes things a bit more complicated to follow.The current code vanishes without QE anyway. But if you insist, I can do the
suspend_prepare()thing, although I'd prefer it as a cleanup patch for 2.6.33, since it would touch more code, specifically I'm concerned about ppc generic files.
I don't insist, it just struck me as odd.
-Scott
Re: [PATCH v3 2/5] powerpc/85xx/86xx: Add suspend/resume support
On Mon, Sep 14, 2009 at 03:45:10PM -0500, Scott Wood wrote:
[...]
Quoted 6 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).
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.
Thanks,
Signature · 3 lines
Anton Vorontsov email: [email protected] irc://irc.freenode.net/bd2