Re: [PATCH v4] powerpc/rcpm: add RCPM driver

2015-06-25 Thread Scott Wood
On Tue, 2015-06-23 at 16:07 +0800, yuantian.t...@freescale.com wrote:
 From: Tang Yuantian yuantian.t...@freescale.com
 
 There is a RCPM (Run Control/Power Management) in Freescale QorIQ
 series processors. The device performs tasks associated with device
 run control and power management.
 
 The driver implements some features: mask/unmask irq, enter/exit low
 power states, freeze time base, etc.
 
 Signed-off-by: Chenhui Zhao chenhui.z...@freescale.com
 Signed-off-by: Tang Yuantian yuantian.t...@freescale.com
 ---
 v4:
   - refine bindings document
 v3:
   - added static and __init modifier to fsl_rcpm_init
 v2:
   - fix code style issues
   - refine compatible string match part
 
  Documentation/devicetree/bindings/soc/fsl/rcpm.txt |  42 +++
  arch/powerpc/include/asm/fsl_guts.h| 105 +++
  arch/powerpc/include/asm/fsl_pm.h  |  48 +++
  arch/powerpc/platforms/85xx/Kconfig|   1 +
  arch/powerpc/sysdev/Kconfig|   5 +
  arch/powerpc/sysdev/Makefile   |   1 +
  arch/powerpc/sysdev/fsl_rcpm.c | 338 
 +
  7 files changed, 540 insertions(+)
  create mode 100644 Documentation/devicetree/bindings/soc/fsl/rcpm.txt
  create mode 100644 arch/powerpc/include/asm/fsl_pm.h
  create mode 100644 arch/powerpc/sysdev/fsl_rcpm.c
 
 diff --git a/Documentation/devicetree/bindings/soc/fsl/rcpm.txt 
 b/Documentation/devicetree/bindings/soc/fsl/rcpm.txt
 new file mode 100644
 index 000..1f58018
 --- /dev/null
 +++ b/Documentation/devicetree/bindings/soc/fsl/rcpm.txt
 @@ -0,0 +1,42 @@
 +* Run Control and Power Management
 +
 +The RCPM performs all device-level tasks associated with device run control
 +and power management.
 +
 +Required properites:
 +  - reg : Offset and length of the register set of RCPM block.
 +  - compatible : Sould contain a chip-specific RCPM block compatible string
 + and (if applicable) may contain a chassis-version RCPM compatible 
 string.
 + Chip-specific strings are of the form fsl,chip-rcpm, such as:
 + * fsl,p2041-rcpm
 + * fsl,p3041-rcpm
 + * fsl,p4080-rcpm
 + * fsl,p5020-rcpm
 + * fsl,p5040-rcpm
 + * fsl,t4240-rcpm
 + * fsl,b4420-rcpm
 + * fsl,b4860-rcpm
 +
 + Chassis-version RCPM strings include:
 + * fsl,qoriq-rcpm-1.0: for chassis 1.0 rcpm
 + * fsl,qoriq-rcpm-2.0: for chassis 2.0 rcpm
 +
 +All references to 1.0 and 2.0 refer to the QorIQ chassis version to
 +which the chip complies.
 +Chassis Version  Example Chips
 +---  ---
 +1.0  p4080, p5020, p5040, p2041, p3041
 +2.0  t4240, b4860, t1040, b4420

I don't think it's accurate to call t1040 chassis 2.0.

-Scott

___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev

[PATCH v4] powerpc/rcpm: add RCPM driver

2015-06-23 Thread Yuantian.Tang
From: Tang Yuantian yuantian.t...@freescale.com

There is a RCPM (Run Control/Power Management) in Freescale QorIQ
series processors. The device performs tasks associated with device
run control and power management.

The driver implements some features: mask/unmask irq, enter/exit low
power states, freeze time base, etc.

Signed-off-by: Chenhui Zhao chenhui.z...@freescale.com
Signed-off-by: Tang Yuantian yuantian.t...@freescale.com
---
v4:
- refine bindings document
v3:
- added static and __init modifier to fsl_rcpm_init
v2:
- fix code style issues
- refine compatible string match part

 Documentation/devicetree/bindings/soc/fsl/rcpm.txt |  42 +++
 arch/powerpc/include/asm/fsl_guts.h| 105 +++
 arch/powerpc/include/asm/fsl_pm.h  |  48 +++
 arch/powerpc/platforms/85xx/Kconfig|   1 +
 arch/powerpc/sysdev/Kconfig|   5 +
 arch/powerpc/sysdev/Makefile   |   1 +
 arch/powerpc/sysdev/fsl_rcpm.c | 338 +
 7 files changed, 540 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/soc/fsl/rcpm.txt
 create mode 100644 arch/powerpc/include/asm/fsl_pm.h
 create mode 100644 arch/powerpc/sysdev/fsl_rcpm.c

diff --git a/Documentation/devicetree/bindings/soc/fsl/rcpm.txt 
b/Documentation/devicetree/bindings/soc/fsl/rcpm.txt
new file mode 100644
index 000..1f58018
--- /dev/null
+++ b/Documentation/devicetree/bindings/soc/fsl/rcpm.txt
@@ -0,0 +1,42 @@
+* Run Control and Power Management
+
+The RCPM performs all device-level tasks associated with device run control
+and power management.
+
+Required properites:
+  - reg : Offset and length of the register set of RCPM block.
+  - compatible : Sould contain a chip-specific RCPM block compatible string
+   and (if applicable) may contain a chassis-version RCPM compatible 
string.
+   Chip-specific strings are of the form fsl,chip-rcpm, such as:
+   * fsl,p2041-rcpm
+   * fsl,p3041-rcpm
+   * fsl,p4080-rcpm
+   * fsl,p5020-rcpm
+   * fsl,p5040-rcpm
+   * fsl,t4240-rcpm
+   * fsl,b4420-rcpm
+   * fsl,b4860-rcpm
+
+   Chassis-version RCPM strings include:
+   * fsl,qoriq-rcpm-1.0: for chassis 1.0 rcpm
+   * fsl,qoriq-rcpm-2.0: for chassis 2.0 rcpm
+
+All references to 1.0 and 2.0 refer to the QorIQ chassis version to
+which the chip complies.
+Chassis VersionExample Chips
+------
+1.0p4080, p5020, p5040, p2041, p3041
+2.0t4240, b4860, t1040, b4420
+
+Example:
+The RCPM node for T4240:
+   rcpm: global-utilities@e2000 {
+   compatible = fsl,t4240-rcpm, fsl,qoriq-rcpm-2.0;
+   reg = 0xe2000 0x1000;
+   };
+
+The RCPM node for P4080:
+   rcpm: global-utilities@e2000 {
+   compatible = fsl,qoriq-rcpm-1.0;
+   reg = 0xe2000 0x1000;
+   };
diff --git a/arch/powerpc/include/asm/fsl_guts.h 
b/arch/powerpc/include/asm/fsl_guts.h
index 43b6bb1..a67413c 100644
--- a/arch/powerpc/include/asm/fsl_guts.h
+++ b/arch/powerpc/include/asm/fsl_guts.h
@@ -188,5 +188,110 @@ static inline void guts_set_pmuxcr_dma(struct ccsr_guts 
__iomem *guts,
 
 #endif
 
+struct ccsr_rcpm_v1 {
+   u8  res[4];
+   __be32  cdozsr; /* 0x0004 Core Doze Status Register */
+   u8  res0008[4];
+   __be32  cdozcr; /* 0x000c Core Doze Control Register */
+   u8  res0010[4];
+   __be32  cnapsr; /* 0x0014 Core Nap Status Register */
+   u8  res0018[4];
+   __be32  cnapcr; /* 0x001c Core Nap Control Register */
+   u8  res0020[4];
+   __be32  cdozpsr;/* 0x0024 Core Doze Previous Status Register */
+   u8  res0028[4];
+   __be32  cnappsr;/* 0x002c Core Nap Previous Status Register */
+   u8  res0030[4];
+   __be32  cwaitsr;/* 0x0034 Core Wait Status Register */
+   u8  res0038[4];
+   __be32  cwdtdsr;/* 0x003c Core Watchdog Detect Status Register */
+   __be32  powmgtcsr;  /* 0x0040 PM ControlStatus Register */
+#define RCPM_POWMGTCSR_SLP 0x0002
+   u8  res0044[12];
+   __be32  ippdexpcr;  /* 0x0050 IP Powerdown Exception Control Register */
+   u8  res0054[16];
+   __be32  cpmimr; /* 0x0064 Core PM IRQ Mask Register */
+   u8  res0068[4];
+   __be32  cpmcimr;/* 0x006c Core PM Critical IRQ Mask Register */
+   u8  res0070[4];
+   __be32  cpmmcmr;/* 0x0074 Core PM Machine Check Mask Register */
+   u8  res0078[4];
+   __be32  cpmnmimr;   /* 0x007c Core PM NMI Mask Register */
+   u8  res0080[4];
+   __be32  ctbenr; /* 0x0084 Core Time Base Enable Register */
+   u8  res0088[4];
+   __be32  ctbckselr;  /* 0x008c Core Time Base Clock Select Register */
+