Subject: Missing pieces for AM335x PWM / backlight support

The following changes since commit d683b96b072dc4680fc74964eca77e6a23d1fa6e:

Linux 3.10-rc4 (2013-06-02 17:11:17 +0900)

are available in the git repository at:

git://git.breakpoint.cc/bigeasy/linux.git tags/am335x-pwm

for you to fetch changes up to 6b319b16a27463c93ec36e59458448aae3ab94cd:

ARM: dts: AM33XX: Add PWM backlight DT data to am335x-evmsk (2013-06-06 14:59:18 +0200)

----------------------------------------------------------------
Collected patches from Philip Avinash to get PWM working on AM335x-evm.
The series includes the TBCLK and device tree entries.

----------------------------------------------------------------
Philip Avinash (4):
ARM: AM33XX: clk: Add clock node for EHRPWM TBCLK
ARM: dts: AM33XX: Add PWMSS device tree nodes
ARM: dts: AM33XX: Add PWM backlight DT data to am335x-evm
ARM: dts: AM33XX: Add PWM backlight DT data to am335x-evmsk

arch/arm/boot/dts/am335x-evm.dts | 23 +++++++++
arch/arm/boot/dts/am335x-evmsk.dts | 23 +++++++++
arch/arm/boot/dts/am33xx.dtsi | 84 +++++++++++++++++++++++++++++++++
arch/arm/mach-omap2/cclock33xx_data.c | 30 ++++++++++++
arch/arm/mach-omap2/control.h | 8 ++++
5 files changed, 168 insertions(+)

Sebastian


Subject: [PATCH 1/4] ARM: AM33XX: clk: Add clock node for EHRPWM TBCLK

From: Philip Avinash <[email protected]>

EHRPWM module requires explicit clock gating of TBCLK from control
module. Hence add TBCLK clock node in clock tree for EHRPWM modules.

Signed-off-by: Philip Avinash <[email protected]>
[bigeasy: remove CK_AM33XX]
Signed-off-by: Sebastian Andrzej Siewior <[email protected]>
---
arch/arm/mach-omap2/cclock33xx_data.c | 30 ++++++++++++++++++++++++++++++
arch/arm/mach-omap2/control.h | 8 ++++++++
2 files changed, 38 insertions(+)

diff --git a/arch/arm/mach-omap2/cclock33xx_data.c b/arch/arm/mach-omap2/cclock33xx_data.c
index af3544c..0346de5 100644
--- a/arch/arm/mach-omap2/cclock33xx_data.c
+++ b/arch/arm/mach-omap2/cclock33xx_data.c
@@ -862,6 +862,33 @@ static struct clk_hw_omap wdt1_fck_hw = {

DEFINE_STRUCT_CLK(wdt1_fck, wdt_ck_parents, gpio_fck_ops);

+static const char *pwmss_clk_parents[] = {
+ "dpll_per_m2_ck",
+};
+
+static const struct clk_ops ehrpwm_tbclk_ops = {
+ .enable = &omap2_dflt_clk_enable,
+ .disable = &omap2_dflt_clk_disable,
+};
+
+DEFINE_CLK_OMAP_MUX_GATE(ehrpwm0_tbclk, "l4ls_clkdm",
+ NULL, NULL, 0,
+ AM33XX_CTRL_REGADDR(AM33XX_PWMSS_TBCLK_CLKCTRL),
+ AM33XX_PWMSS0_TBCLKEN_SHIFT,
+ NULL, pwmss_clk_parents, ehrpwm_tbclk_ops);
+
+DEFINE_CLK_OMAP_MUX_GATE(ehrpwm1_tbclk, "l4ls_clkdm",
+ NULL, NULL, 0,
+ AM33XX_CTRL_REGADDR(AM33XX_PWMSS_TBCLK_CLKCTRL),
+ AM33XX_PWMSS1_TBCLKEN_SHIFT,
+ NULL, pwmss_clk_parents, ehrpwm_tbclk_ops);
+
+DEFINE_CLK_OMAP_MUX_GATE(ehrpwm2_tbclk, "l4ls_clkdm",
+ NULL, NULL, 0,
+ AM33XX_CTRL_REGADDR(AM33XX_PWMSS_TBCLK_CLKCTRL),
+ AM33XX_PWMSS2_TBCLKEN_SHIFT,
+ NULL, pwmss_clk_parents, ehrpwm_tbclk_ops);
+
/*
* clkdev
*/
@@ -942,6 +969,9 @@ static struct omap_clk am33xx_clks[] = {
CLK(NULL, "clkout2_div_ck", &clkout2_div_ck),
CLK(NULL, "timer_32k_ck", &clkdiv32k_ick),
CLK(NULL, "timer_sys_ck", &sys_clkin_ck),
+ CLK("48300200.ehrpwm", "tbclk", &ehrpwm0_tbclk),
+ CLK("48302200.ehrpwm", "tbclk", &ehrpwm1_tbclk),
+ CLK("48304200.ehrpwm", "tbclk", &ehrpwm2_tbclk),
};


diff --git a/arch/arm/mach-omap2/control.h b/arch/arm/mach-omap2/control.h
index e6c3281..35d17a6 100644
--- a/arch/arm/mach-omap2/control.h
+++ b/arch/arm/mach-omap2/control.h
@@ -358,6 +358,14 @@
#define AM33XX_CONTROL_STATUS_SYSBOOT1_WIDTH 0x2
#define AM33XX_CONTROL_STATUS_SYSBOOT1_MASK (0x3 << 22)

+/* AM33XX PWMSS Control register */
+#define AM33XX_PWMSS_TBCLK_CLKCTRL 0x664
+
+/* AM33XX PWMSS Control bitfields */
+#define AM33XX_PWMSS0_TBCLKEN_SHIFT 0
+#define AM33XX_PWMSS1_TBCLKEN_SHIFT 1
+#define AM33XX_PWMSS2_TBCLKEN_SHIFT 2
+
/* CONTROL OMAP STATUS register to identify OMAP3 features */
#define OMAP3_CONTROL_OMAP_STATUS 0x044c

--
1.7.10.4

Subject: [PATCH 2/4] ARM: dts: AM33XX: Add PWMSS device tree nodes

From: Philip Avinash <[email protected]>

Add PWMSS device tree nodes in relation with ECAP & EHRPWM DT nodes to
AM33XX SoC family. Also populates device tree nodes for ECAP & EHRPWM by
adding necessary properties like pwm-cells, base reg & set disabled as
status.

Signed-off-by: Philip Avinash <[email protected]>
Reviewed-by: Thierry Reding <[email protected]>
Signed-off-by: Sebastian Andrzej Siewior <[email protected]>
---
arch/arm/boot/dts/am33xx.dtsi | 84 +++++++++++++++++++++++++++++++++++++++++
1 file changed, 84 insertions(+)

diff --git a/arch/arm/boot/dts/am33xx.dtsi b/arch/arm/boot/dts/am33xx.dtsi
index 1460d9b..7fa9c5f 100644
--- a/arch/arm/boot/dts/am33xx.dtsi
+++ b/arch/arm/boot/dts/am33xx.dtsi
@@ -343,6 +343,90 @@
ti,hwmods = "usb_otg_hs";
};

+ epwmss0: epwmss@48300000 {
+ compatible = "ti,am33xx-pwmss";
+ reg = <0x48300000 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 */
+
+ ecap0: ecap@48300100 {
+ compatible = "ti,am33xx-ecap";
+ #pwm-cells = <3>;
+ reg = <0x48300100 0x80>;
+ ti,hwmods = "ecap0";
+ status = "disabled";
+ };
+
+ ehrpwm0: ehrpwm@48300200 {
+ compatible = "ti,am33xx-ehrpwm";
+ #pwm-cells = <3>;
+ reg = <0x48300200 0x80>;
+ ti,hwmods = "ehrpwm0";
+ status = "disabled";
+ };
+ };
+
+ epwmss1: epwmss@48302000 {
+ compatible = "ti,am33xx-pwmss";
+ reg = <0x48302000 0x10>;
+ ti,hwmods = "epwmss1";
+ #address-cells = <1>;
+ #size-cells = <1>;
+ status = "disabled";
+ ranges = <0x48302100 0x48302100 0x80 /* ECAP */
+ 0x48302180 0x48302180 0x80 /* EQEP */
+ 0x48302200 0x48302200 0x80>; /* EHRPWM */
+
+ ecap1: ecap@48302100 {
+ compatible = "ti,am33xx-ecap";
+ #pwm-cells = <3>;
+ reg = <0x48302100 0x80>;
+ ti,hwmods = "ecap1";
+ status = "disabled";
+ };
+
+ ehrpwm1: ehrpwm@48302200 {
+ compatible = "ti,am33xx-ehrpwm";
+ #pwm-cells = <3>;
+ reg = <0x48302200 0x80>;
+ ti,hwmods = "ehrpwm1";
+ status = "disabled";
+ };
+ };
+
+ epwmss2: epwmss@48304000 {
+ compatible = "ti,am33xx-pwmss";
+ reg = <0x48304000 0x10>;
+ ti,hwmods = "epwmss2";
+ #address-cells = <1>;
+ #size-cells = <1>;
+ status = "disabled";
+ ranges = <0x48304100 0x48304100 0x80 /* ECAP */
+ 0x48304180 0x48304180 0x80 /* EQEP */
+ 0x48304200 0x48304200 0x80>; /* EHRPWM */
+
+ ecap2: ecap@48304100 {
+ compatible = "ti,am33xx-ecap";
+ #pwm-cells = <3>;
+ reg = <0x48304100 0x80>;
+ ti,hwmods = "ecap2";
+ status = "disabled";
+ };
+
+ ehrpwm2: ehrpwm@48304200 {
+ compatible = "ti,am33xx-ehrpwm";
+ #pwm-cells = <3>;
+ reg = <0x48304200 0x80>;
+ ti,hwmods = "ehrpwm2";
+ status = "disabled";
+ };
+ };
+
mac: ethernet@4a100000 {
compatible = "ti,cpsw";
ti,hwmods = "cpgmac0";
--
1.7.10.4

Subject: [PATCH 4/4] ARM: dts: AM33XX: Add PWM backlight DT data to am335x-evmsk

From: Philip Avinash <[email protected]>

PWM output from ecap2 uses as backlight source. Also adds low threshold
value to have a uniform divisions in brightness-levels scales with
inverse polarity.

Signed-off-by: Philip Avinash <[email protected]>
Reviewed-by: Thierry Reding <[email protected]>
Signed-off-by: Sebastian Andrzej Siewior <[email protected]>
---
arch/arm/boot/dts/am335x-evmsk.dts | 23 +++++++++++++++++++++++
1 file changed, 23 insertions(+)

diff --git a/arch/arm/boot/dts/am335x-evmsk.dts b/arch/arm/boot/dts/am335x-evmsk.dts
index f67c360..c21fdaf 100644
--- a/arch/arm/boot/dts/am335x-evmsk.dts
+++ b/arch/arm/boot/dts/am335x-evmsk.dts
@@ -51,6 +51,12 @@
0x9c 0x27 /* gpmc_ben0_cle.gpio2_5, INPUT | MODE7 */
>;
};
+
+ ecap2_pins: backlight_pins {
+ pinctrl-single,pins = <
+ 0x19c 0x4 /* mcasp0_ahclkr.ecap2_in_pwm2_out MODE4 */
+ >;
+ };
};

ocp {
@@ -94,6 +100,16 @@
st,max-limit-z = <750>;
};
};
+
+ epwmss2: epwmss@48304000 {
+ status = "okay";
+
+ ecap2: ecap@48304100 {
+ status = "okay";
+ pinctrl-names = "default";
+ pinctrl-0 = <&ecap2_pins>;
+ };
+ };
};

vbat: fixedregulator@0 {
@@ -170,6 +186,13 @@
gpios = <&gpio2 5 0>;
};
};
+
+ backlight {
+ compatible = "pwm-backlight";
+ pwms = <&ecap2 0 50000 1>;
+ brightness-levels = <0 58 61 66 75 90 125 170 255>;
+ default-brightness-level = <8>;
+ };
};

/include/ "tps65910.dtsi"
--
1.7.10.4

Subject: [PATCH 3/4] ARM: dts: AM33XX: Add PWM backlight DT data to am335x-evm

From: Philip Avinash <[email protected]>

PWM output from ecap0 uses as backlight source. Also adds low threshold
value to have a uniform divisions in brightness-levels scales.

Signed-off-by: Philip Avinash <[email protected]>
Reviewed-by: Thierry Reding <[email protected]>
Signed-off-by: Sebastian Andrzej Siewior <[email protected]>
---
arch/arm/boot/dts/am335x-evm.dts | 23 +++++++++++++++++++++++
1 file changed, 23 insertions(+)

diff --git a/arch/arm/boot/dts/am335x-evm.dts b/arch/arm/boot/dts/am335x-evm.dts
index 0423298..35b2f77 100644
--- a/arch/arm/boot/dts/am335x-evm.dts
+++ b/arch/arm/boot/dts/am335x-evm.dts
@@ -44,6 +44,12 @@
0x154 0x27 /* spi0_d0.gpio0_3, INPUT | MODE7 */
>;
};
+
+ ecap0_pins: backlight_pins {
+ pinctrl-single,pins = <
+ 0x164 0x0 /* eCAP0_in_PWM0_out.eCAP0_in_PWM0_out MODE0 */
+ >;
+ };
};

ocp {
@@ -102,6 +108,16 @@
reg = <0x48>;
};
};
+
+ epwmss0: epwmss@48300000 {
+ status = "okay";
+
+ ecap0: ecap@48300100 {
+ status = "okay";
+ pinctrl-names = "default";
+ pinctrl-0 = <&ecap0_pins>;
+ };
+ };
};

vbat: fixedregulator@0 {
@@ -158,6 +174,13 @@
gpio-key,wakeup;
};
};
+
+ backlight {
+ compatible = "pwm-backlight";
+ pwms = <&ecap0 0 50000 0>;
+ brightness-levels = <0 51 53 56 62 75 101 152 255>;
+ default-brightness-level = <8>;
+ };
};

/include/ "tps65910.dtsi"
--
1.7.10.4

2013-06-09 07:13:23

by Paul Walmsley

[permalink] [raw]
Subject: Re: [PATCH 1/4] ARM: AM33XX: clk: Add clock node for EHRPWM TBCLK

On Thu, 6 Jun 2013, Sebastian Andrzej Siewior wrote:

> From: Philip Avinash <[email protected]>
>
> EHRPWM module requires explicit clock gating of TBCLK from control
> module. Hence add TBCLK clock node in clock tree for EHRPWM modules.
>
> Signed-off-by: Philip Avinash <[email protected]>
> [bigeasy: remove CK_AM33XX]
> Signed-off-by: Sebastian Andrzej Siewior <[email protected]>

Thanks, queued.

- Paul

Subject: Re: [PATCH 2/4] ARM: dts: AM33XX: Add PWMSS device tree nodes

On 06/06/2013 03:52 PM, Sebastian Andrzej Siewior wrote:
> From: Philip Avinash <[email protected]>
>
> Add PWMSS device tree nodes in relation with ECAP & EHRPWM DT nodes to
> AM33XX SoC family. Also populates device tree nodes for ECAP & EHRPWM by
> adding necessary properties like pwm-cells, base reg & set disabled as
> status.
>
> Signed-off-by: Philip Avinash <[email protected]>
> Reviewed-by: Thierry Reding <[email protected]>
> Signed-off-by: Sebastian Andrzej Siewior <[email protected]>

Can someone please grab #2 till #4? Paul took just #1 as far as I can
tell.

Sebastian

2013-06-12 16:41:46

by Felipe Balbi

[permalink] [raw]
Subject: Re: [PATCH 2/4] ARM: dts: AM33XX: Add PWMSS device tree nodes

Hi,

On Wed, Jun 12, 2013 at 06:10:32PM +0200, Sebastian Andrzej Siewior wrote:
> On 06/06/2013 03:52 PM, Sebastian Andrzej Siewior wrote:
> > From: Philip Avinash <[email protected]>
> >
> > Add PWMSS device tree nodes in relation with ECAP & EHRPWM DT nodes to
> > AM33XX SoC family. Also populates device tree nodes for ECAP & EHRPWM by
> > adding necessary properties like pwm-cells, base reg & set disabled as
> > status.
> >
> > Signed-off-by: Philip Avinash <[email protected]>
> > Reviewed-by: Thierry Reding <[email protected]>
> > Signed-off-by: Sebastian Andrzej Siewior <[email protected]>
>
> Can someone please grab #2 till #4? Paul took just #1 as far as I can
> tell.

DTS should be Benoit Cousson

--
balbi


Attachments:
(No filename) (753.00 B)
signature.asc (836.00 B)
Digital signature
Download all attachments
Subject: Re: [PATCH 2/4] ARM: dts: AM33XX: Add PWMSS device tree nodes

On 06/12/2013 06:40 PM, Felipe Balbi wrote:
> On Wed, Jun 12, 2013 at 06:10:32PM +0200, Sebastian Andrzej Siewior wrote:
>> On 06/06/2013 03:52 PM, Sebastian Andrzej Siewior wrote:
>>> From: Philip Avinash <[email protected]>
>>>
>>> Add PWMSS device tree nodes in relation with ECAP & EHRPWM DT nodes to
>>> AM33XX SoC family. Also populates device tree nodes for ECAP & EHRPWM by
>>> adding necessary properties like pwm-cells, base reg & set disabled as
>>> status.
>> Can someone please grab #2 till #4? Paul took just #1 as far as I can
>> tell.
>
> DTS should be Benoit Cousson

So, Benoit. Would you please be so kind and pick up the dts pieces?

Sebastian

2013-06-19 01:29:59

by Benoit Cousson

[permalink] [raw]
Subject: Re: [PATCH 2/4] ARM: dts: AM33XX: Add PWMSS device tree nodes

Hi Sebastian,

On 06/18/2013 08:36 AM, Sebastian Andrzej Siewior wrote:
> On 06/12/2013 06:40 PM, Felipe Balbi wrote:
>> On Wed, Jun 12, 2013 at 06:10:32PM +0200, Sebastian Andrzej Siewior wrote:
>>> On 06/06/2013 03:52 PM, Sebastian Andrzej Siewior wrote:
>>>> From: Philip Avinash <[email protected]>
>>>>
>>>> Add PWMSS device tree nodes in relation with ECAP & EHRPWM DT nodes to
>>>> AM33XX SoC family. Also populates device tree nodes for ECAP & EHRPWM by
>>>> adding necessary properties like pwm-cells, base reg & set disabled as
>>>> status.
>>> Can someone please grab #2 till #4? Paul took just #1 as far as I can
>>> tell.
>>
>> DTS should be Benoit Cousson
>
> So, Benoit. Would you please be so kind and pick up the dts pieces?

That's done. Patches are available in
git://git.kernel.org/pub/scm/linux/kernel/git/bcousson/linux-omap-dt.git
for_3.11/dts

Thanks,
Benoit