RE: [PATCH v4 01/11] PWMSS: Add PWM Subsystem driver for parent-child relationship

2012-11-23 Thread Philip, Avinash
On Fri, Nov 23, 2012 at 02:17:04, Thierry Reding wrote:
 On Wed, Nov 21, 2012 at 06:40:58PM +0530, Philip, Avinash wrote:
 [...]
  +static const struct of_device_id pwmss_of_match[] = {
  +   {
  +   .compatible = ti,am33xx-pwmss,
  +   },
 
 For consistency with other drivers this should be all on one line.

Ok I will correct it.

 
  +static const struct dev_pm_ops pwmss_pm_ops = {
  +   SET_SYSTEM_SLEEP_PM_OPS(pwmss_suspend, pwmss_resume)
  +};
 
 This could be even shorter:
 
 static SIMPLE_DEV_PM_OPS(pwmss_pm_ops, pwmss_suspend, pwmss_resume);

Ok I will correct it.

Thanks
Avinash

 
 Thierry
 

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v4 01/11] PWMSS: Add PWM Subsystem driver for parent-child relationship

2012-11-22 Thread Thierry Reding
On Wed, Nov 21, 2012 at 06:40:58PM +0530, Philip, Avinash wrote:
[...]
 +static const struct of_device_id pwmss_of_match[] = {
 + {
 + .compatible = ti,am33xx-pwmss,
 + },

For consistency with other drivers this should be all on one line.

 +static const struct dev_pm_ops pwmss_pm_ops = {
 + SET_SYSTEM_SLEEP_PM_OPS(pwmss_suspend, pwmss_resume)
 +};

This could be even shorter:

static SIMPLE_DEV_PM_OPS(pwmss_pm_ops, pwmss_suspend, pwmss_resume);

Thierry


pgpCwZQKrm7f1.pgp
Description: PGP signature


[PATCH v4 01/11] PWMSS: Add PWM Subsystem driver for parent-child relationship

2012-11-21 Thread Philip, Avinash
In some platforms (like am33xx), PWM sub modules (ECAP, EHRPWM, EQEP)
are integrated to PWM subsystem. These PWM submodules has resources
shared and only one register bit-field is provided to control
module/clock enable/disable, makes it difficult to handle common
resources from independent PWMSS submodule drivers.

So the solution here implemented in this patch is, to create driver for
PWMSS and take the role of parent driver for PWM submodules. PWMSS
parent driver enumerates all the child nodes under PWMSS module. Also
symbol pwmss_submodule_state_change exported to enable clock gating
for individual PWMSS submodules, and submodule drivers has to enable
clock gating from their drivers.

As this is only supported during DT boot, the parent-child relationship
is created and populated in DT execution flow. The only required change
is inside DTS file, making EHRPWM  ECAP as a child to PWMSS node.

Signed-off-by: Philip, Avinash avinashphi...@ti.com
---
Changes since v3:
- Corrected the usage of ranges property in documentation.
- Add pwm prefix to tipwmss.h file

Changes since v2:
- Set build attribute to bool type.
- Add pwm prefix to tipwmss.c file
- Span mutex protection for read modify approach.
- Use SET_SYSTEM_SLEEP_PM_OPS
- Add PWM subsystem bit fields to tipwmss.h
- Remove devinit  devexit attributes.
- Left out adding of child node's DT property in Documentation
  as those definitions are part of later patches.

Changes since v1:
- Add conditional check for PWM subsystem clock enabling.
- Add context save/restore for PWM subsystem clock config register.

:00 100644 000... b067ea7... A  
Documentation/devicetree/bindings/pwm/pwm-tipwmss.txt
:100644 100644 ed81720... 1dc32a8... M  drivers/pwm/Kconfig
:100644 100644 acfe482... e12b722... M  drivers/pwm/Makefile
:00 100644 000... 30d3674... A  drivers/pwm/pwm-tipwmss.c
:00 100644 000... 11f76a1... A  drivers/pwm/pwm-tipwmss.h
 .../devicetree/bindings/pwm/pwm-tipwmss.txt|   31 +
 drivers/pwm/Kconfig|   11 ++
 drivers/pwm/Makefile   |1 +
 drivers/pwm/pwm-tipwmss.c  |  143 
 drivers/pwm/pwm-tipwmss.h  |   39 ++
 5 files changed, 225 insertions(+), 0 deletions(-)

diff --git a/Documentation/devicetree/bindings/pwm/pwm-tipwmss.txt 
b/Documentation/devicetree/bindings/pwm/pwm-tipwmss.txt
new file mode 100644
index 000..b067ea7
--- /dev/null
+++ b/Documentation/devicetree/bindings/pwm/pwm-tipwmss.txt
@@ -0,0 +1,31 @@
+TI SOC based PWM Subsystem
+
+Required properties:
+- compatible: Must be ti,am33xx-pwmss;
+- reg: physical base address and size of the registers map.
+- address-cells: Specify the number of u32 entries needed in child nodes.
+ Should set to 1.
+- size-cells: specify number of u32 entries needed to specify child nodes size
+   in reg property. Should set to 1.
+- ranges: describes the address mapping of a memory-mapped bus. Should set to
+  physical address map of child's base address, physical address within
+  parent's address  space and length of the address map. For am33xx,
+  3 set of child register maps present, ECAP register space, EQEP
+  register space, EHRPWM register space.
+
+Also child nodes should also populated under PWMSS DT node.
+
+Example:
+pwmss0: pwmss@4830 {
+   compatible = ti,am33xx-pwmss;
+   reg = 0x4830 0x10;
+   ti,hwmods = epwmss0;
+   #address-cells = 1;
+   #size-cells = 1;
+   status = disabled;
+   ranges = 0x48300100 0x48300100 0x80   /* ECAP */
+ 0x48300180 0x48300180 0x80   /* EQEP */
+ 0x48300200 0x48300200 0x80; /* EHRPWM */
+
+   /* child nodes go here */
+};
diff --git a/drivers/pwm/Kconfig b/drivers/pwm/Kconfig
index ed81720..1dc32a8 100644
--- a/drivers/pwm/Kconfig
+++ b/drivers/pwm/Kconfig
@@ -125,6 +125,7 @@ config PWM_TEGRA
 config  PWM_TIECAP
tristate ECAP PWM support
depends on SOC_AM33XX
+   select PWM_TIPWMSS
help
  PWM driver support for the ECAP APWM controller found on AM33XX
  TI SOC
@@ -135,6 +136,7 @@ config  PWM_TIECAP
 config  PWM_TIEHRPWM
tristate EHRPWM PWM support
depends on SOC_AM33XX
+   select PWM_TIPWMSS
help
  PWM driver support for the EHRPWM controller found on AM33XX
  TI SOC
@@ -142,6 +144,15 @@ config  PWM_TIEHRPWM
  To compile this driver as a module, choose M here: the module
  will be called pwm-tiehrpwm.
 
+config  PWM_TIPWMSS
+   bool
+   depends on SOC_AM33XX  (PWM_TIEHRPWM || PWM_TIECAP)
+   help
+ PWM Subsystem driver support for AM33xx SOC.
+
+ PWM submodules require PWM config space access from submodule
+ drivers and require common