devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 00/48] ARM: at91: rework Atmel TCB drivers
@ 2016-06-10 22:03 Alexandre Belloni
  2016-06-10 22:03 ` [PATCH 02/48] ARM: at91: Document new TCB bindings Alexandre Belloni
  0 siblings, 1 reply; 6+ messages in thread
From: Alexandre Belloni @ 2016-06-10 22:03 UTC (permalink / raw)
  To: Nicolas Ferre
  Cc: Boris Brezillon, Jean-Christophe Plagniol-Villard,
	linux-arm-kernel, linux-kernel, Alexandre Belloni,
	Antoine Aubert, Daniel Lezcano, devicetree, Douglas Gilbert,
	Fabio Porcedda, Gregory CLEMENT, Gregory Hermant,
	Joachim Eastwood, linux-clk, linux-pwm, Marek Vasut,
	Martin Reimann, Rob Herring, Rodolfo Giometti, Sergio Tanzilli,
	Stephen Boyd, Thierry Reding

Hi,

This series reworks the Atmel Timer counter Block drivers. Those blocks
each have 3 counters with 2 channels each and can be used for
multiple functions:
 - timers
 - PWMs
 - Quadrature decoders
 - Stepper motor counters

Up until now, each TCB was fully used by each driver, possibly wasting
counters/channels.

There is a second issue motivating that rework. Until now, the PIT is
still used to boot then later in the boot sequence, the clocksource is
switched to the TCB. This ends up not working well with preempt-rt
because on some SoCs, the PIT interrupt is shared with the DBGU uart.
When using preempt-rt the interrupt flags for the PIT and the DBGU end
up being incompatible.

The whole rework doesn't break the DT ABI for the clocksource as the old
driver is kept anyway for AVR32. However, I still took the time to
switch all the upstreamed board dts to the new bindings.
However, there is no other choice than breaking the mainly unused
pwm-atmel-tcb binding. Only the kizbox is actually using it.

I hope we could quickly come to an agreement on the new DT bindings and
include those changes in 4.8.

Regarding the tcbclksrc driver, I'm not completely happy with the
request_irq/free_irq thing but there is not much choice unless we want
to pass in the clksrc handler even when using the clkevt driver as they
may share the same interrupt.

Cc: Antoine Aubert <a.aubert@overkiz.com>
Cc: Daniel Lezcano <daniel.lezcano@linaro.org>
Cc: devicetree@vger.kernel.org
Cc: Douglas Gilbert <dgilbert@interlog.com>
Cc: Fabio Porcedda <fabio.porcedda@gmail.com>
Cc: Gregory CLEMENT <gregory.clement@free-electrons.com>
Cc: Gregory Hermant <gregory.hermant@calao-systems.com>
Cc: Joachim Eastwood <manabian@gmail.com>
Cc: linux-clk@vger.kernel.org
Cc: linux-pwm@vger.kernel.org
Cc: Marek Vasut <marex@denx.de>
Cc: Martin Reimann <martin.reimann@egnite.de>
Cc: Rob Herring <robh+dt@kernel.org>
Cc: Rodolfo Giometti <giometti@linux.it>
Cc: Sergio Tanzilli <tanzilli@acmesystems.it>
Cc: Stephen Boyd <sboyd@codeaurora.org>
Cc: Thierry Reding <thierry.reding@gmail.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Tim Schendekehl <tim.schendekehl@egnite.de>

Alexandre Belloni (47):
  ARM: at91: Document new TCB bindings
  ARM: dts: at91: at91rm9200: TC blocks are also simple-mfd and syscon
    devices
  ARM: dts: at91: at91rm9200ek; use TCB0 as clocksource
  ARM: dts: at91: mpa1600; use TCB0 as clocksource
  ARM: dts: at91: at91sam9260: TC blocks are also simple-mfd and syscon
    devices
  ARM: dts: at91: ethernut5: use TCB0 as clocksource
  ARM: dts: at91: foxg20: use TCB0 as clocksource
  ARM: dts: at91: animeo_ip: use TCB0 as clocksource
  ARM: dts: at91: kizbox: use TCB0 as clocksource
  ARM: dts: at91: at91sam9g20ek: use TCB0 as clocksource
  ARM: dts: at91: ge863-pro3: use TCB0 as clocksource
  ARM: dts: at91: at91sam9261: TC blocks are also simple-mfd and syscon
    devices
  ARM: dts: at91: at91sam9261ek: use TCB0 as clocksource
  ARM: dts: at91: at91sam9263: TC blocks are also simple-mfd and syscon
    devices
  ARM: dts: at91: at91sam9263ek: use TCB0 as clocksource
  ARM: dts: at91: calao: use TCB0 as clocksource
  ARM: dts: at91: at91sam9g45: TC blocks are also simple-mfd and syscon
    devices
  ARM: dts: at91: at91sam9m10g45ek: use TCB0 as clocksource
  ARM: dts: at91: pm9g45: use TCB0 as clocksource
  ARM: dts: at91: at91sam9rl: TC blocks are also simple-mfd and syscon
    devices
  ARM: dts: at91: at91sam9rlek: use TCB0 as clocksource
  ARM: dts: at91: at91sam9n12: TC blocks are also simple-mfd and syscon
    devices
  ARM: dts: at91: at91sam9n12ek: use TCB0 as clocksource
  ARM: dts: at91: at91sam9x5: TC blocks are also simple-mfd and syscon
    devices
  ARM: dts: at91: at91sam9x5cm: use TCB0 as clocksource
  ARM: dts: at91: acme/g25: use TCB0 as clocksource
  ARM: dts: at91: cosino: use TCB0 as clocksource
  ARM: dts: at91: kizboxmini: use TCB0 as clocksource
  ARM: dts: at91: sama5d3: TC blocks are also simple-mfd and syscon
    devices
  ARM: dts: at91: sama5d3xek; use TCB0 as clocksource
  ARM: dts: at91: sama5d3 Xplained: use TCB0 as clocksource
  ARM: dts: at91: kizbox2: use TCB0 as clocksource
  ARM: dts: at91: sama5d4: TC blocks are also simple-mfd and syscon
    devices
  ARM: dts: at91: sama5d4: Add TCB2
  ARM: dts: at91: sama5d4ek: use TCB2 as clocksource
  ARM: dts: at91: sama5d4 Xplained: use TCB2 as clocksource
  ARM: dts: at91: ma5d4: use TCB2 as clocksource
  ARM: dts: at91: vinco: use TCB2 as clocksource
  ARM: dts: at91: sama5d2: TC blocks are also simple-mfd and syscon
    devices
  ARM: dts: at91: sama5d2 Xplained: use TCB0 as clocksource
  clocksource/drivers: Add a new driver for the Atmel ARM TC blocks
  clocksource/drivers: Add a clockevent driver for Atmel TC blocks
  clocksource: atmel-pit: allow unselecting ATMEL_PIT
  ARM: at91/defconfig: sama5: unselect ATMEL_PIT
  ARM: at91/defconfig: at91_dt unselect ATMEL_PIT
  PWM: atmel-tcb: switch to new binding
  ARM: dts: at91: kizbox: switch to new pwm-atmel-tcb binding

Cyrille Pitchen (1):
  clk: at91: replace usleep() by udelay() calls

 .../devicetree/bindings/arm/atmel-at91.txt         |  32 ---
 .../devicetree/bindings/mfd/atmel-tcb.txt          |  62 +++++
 .../devicetree/bindings/pwm/atmel-tcb-pwm.txt      |  12 +-
 arch/arm/boot/dts/animeo_ip.dts                    |  12 +
 arch/arm/boot/dts/at91-ariag25.dts                 |  12 +
 arch/arm/boot/dts/at91-ariettag25.dts              |  12 +
 arch/arm/boot/dts/at91-cosino.dtsi                 |  12 +
 arch/arm/boot/dts/at91-foxg20.dts                  |  12 +
 arch/arm/boot/dts/at91-kizbox.dts                  |  54 +++-
 arch/arm/boot/dts/at91-kizbox2.dts                 |  12 +
 arch/arm/boot/dts/at91-kizboxmini.dts              |  12 +
 arch/arm/boot/dts/at91-qil_a9260.dts               |  12 +
 arch/arm/boot/dts/at91-sama5d2_xplained.dts        |  12 +
 arch/arm/boot/dts/at91-sama5d3_xplained.dts        |  12 +
 arch/arm/boot/dts/at91-sama5d4_ma5d4.dtsi          |  12 +
 arch/arm/boot/dts/at91-sama5d4_xplained.dts        |  12 +
 arch/arm/boot/dts/at91-sama5d4ek.dts               |  12 +
 arch/arm/boot/dts/at91-vinco.dts                   |  12 +
 arch/arm/boot/dts/at91rm9200.dtsi                  |   8 +-
 arch/arm/boot/dts/at91rm9200ek.dts                 |  12 +
 arch/arm/boot/dts/at91sam9260.dtsi                 |   8 +-
 arch/arm/boot/dts/at91sam9261.dtsi                 |   4 +-
 arch/arm/boot/dts/at91sam9261ek.dts                |  12 +
 arch/arm/boot/dts/at91sam9263.dtsi                 |   4 +-
 arch/arm/boot/dts/at91sam9263ek.dts                |  12 +
 arch/arm/boot/dts/at91sam9g20ek_common.dtsi        |  12 +
 arch/arm/boot/dts/at91sam9g45.dtsi                 |   8 +-
 arch/arm/boot/dts/at91sam9m10g45ek.dts             |  12 +
 arch/arm/boot/dts/at91sam9n12.dtsi                 |   8 +-
 arch/arm/boot/dts/at91sam9n12ek.dts                |  12 +
 arch/arm/boot/dts/at91sam9rl.dtsi                  |   4 +-
 arch/arm/boot/dts/at91sam9rlek.dts                 |  12 +
 arch/arm/boot/dts/at91sam9x5.dtsi                  |   8 +-
 arch/arm/boot/dts/at91sam9x5cm.dtsi                |  12 +
 arch/arm/boot/dts/ethernut5.dts                    |  12 +
 arch/arm/boot/dts/ge863-pro3.dtsi                  |  12 +
 arch/arm/boot/dts/mpa1600.dts                      |  12 +
 arch/arm/boot/dts/pm9g45.dts                       |  12 +
 arch/arm/boot/dts/sama5d2.dtsi                     |   8 +-
 arch/arm/boot/dts/sama5d3.dtsi                     |   4 +-
 arch/arm/boot/dts/sama5d3_tcb1.dtsi                |   4 +-
 arch/arm/boot/dts/sama5d3xcm.dtsi                  |  12 +
 arch/arm/boot/dts/sama5d4.dtsi                     |  18 +-
 arch/arm/boot/dts/tny_a9260_common.dtsi            |  12 +
 arch/arm/boot/dts/tny_a9263.dts                    |  12 +
 arch/arm/boot/dts/usb_a9260_common.dtsi            |  12 +
 arch/arm/boot/dts/usb_a9263.dts                    |  12 +
 arch/arm/configs/at91_dt_defconfig                 |   1 +
 arch/arm/configs/sama5_defconfig                   |   1 +
 drivers/clk/at91/clk-main.c                        |   2 +-
 drivers/clk/at91/clk-slow.c                        |   6 +-
 drivers/clocksource/Kconfig                        |  32 ++-
 drivers/clocksource/Makefile                       |   4 +-
 drivers/clocksource/timer-atmel-tcbclkevt.c        | 220 +++++++++++++++
 drivers/clocksource/timer-atmel-tcbclksrc.c        | 305 +++++++++++++++++++++
 drivers/pwm/Kconfig                                |   3 +-
 drivers/pwm/pwm-atmel-tcb.c                        | 219 ++++++++-------
 include/soc/at91/atmel_tcb.h                       | 220 +++++++++++++++
 58 files changed, 1452 insertions(+), 179 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/mfd/atmel-tcb.txt
 create mode 100644 drivers/clocksource/timer-atmel-tcbclkevt.c
 create mode 100644 drivers/clocksource/timer-atmel-tcbclksrc.c
 create mode 100644 include/soc/at91/atmel_tcb.h

-- 
2.8.1

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 02/48] ARM: at91: Document new TCB bindings
  2016-06-10 22:03 [PATCH 00/48] ARM: at91: rework Atmel TCB drivers Alexandre Belloni
@ 2016-06-10 22:03 ` Alexandre Belloni
  2016-06-14 21:47   ` Rob Herring
  0 siblings, 1 reply; 6+ messages in thread
From: Alexandre Belloni @ 2016-06-10 22:03 UTC (permalink / raw)
  To: Nicolas Ferre
  Cc: Boris Brezillon, Jean-Christophe Plagniol-Villard,
	linux-arm-kernel, linux-kernel, Alexandre Belloni,
	Daniel Lezcano, Thierry Reding, linux-pwm, Rob Herring,
	devicetree

The current binding for the TCB is not flexible enough for some use cases
and prevents proper utilization of all the channels.

Cc: Daniel Lezcano <daniel.lezcano@linaro.org>
Cc: Thierry Reding <thierry.reding@gmail.com>
Cc: linux-pwm@vger.kernel.org
Cc: Rob Herring <robh+dt@kernel.org>
Cc: devicetree@vger.kernel.org
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
---
 .../devicetree/bindings/arm/atmel-at91.txt         | 32 -----------
 .../devicetree/bindings/mfd/atmel-tcb.txt          | 62 ++++++++++++++++++++++
 .../devicetree/bindings/pwm/atmel-tcb-pwm.txt      | 12 +++--
 3 files changed, 69 insertions(+), 37 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/mfd/atmel-tcb.txt

diff --git a/Documentation/devicetree/bindings/arm/atmel-at91.txt b/Documentation/devicetree/bindings/arm/atmel-at91.txt
index e1f5ad855f14..3dc758403d03 100644
--- a/Documentation/devicetree/bindings/arm/atmel-at91.txt
+++ b/Documentation/devicetree/bindings/arm/atmel-at91.txt
@@ -60,38 +60,6 @@ System Timer (ST) required properties:
 Its subnodes can be:
 - watchdog: compatible should be "atmel,at91rm9200-wdt"
 
-TC/TCLIB Timer required properties:
-- compatible: Should be "atmel,<chip>-tcb".
-  <chip> can be "at91rm9200" or "at91sam9x5"
-- reg: Should contain registers location and length
-- interrupts: Should contain all interrupts for the TC block
-  Note that you can specify several interrupt cells if the TC
-  block has one interrupt per channel.
-- clock-names: tuple listing input clock names.
-	Required elements: "t0_clk", "slow_clk"
-	Optional elements: "t1_clk", "t2_clk"
-- clocks: phandles to input clocks.
-
-Examples:
-
-One interrupt per TC block:
-	tcb0: timer@fff7c000 {
-		compatible = "atmel,at91rm9200-tcb";
-		reg = <0xfff7c000 0x100>;
-		interrupts = <18 4>;
-		clocks = <&tcb0_clk>;
-		clock-names = "t0_clk";
-	};
-
-One interrupt per TC channel in a TC block:
-	tcb1: timer@fffdc000 {
-		compatible = "atmel,at91rm9200-tcb";
-		reg = <0xfffdc000 0x100>;
-		interrupts = <26 4 27 4 28 4>;
-		clocks = <&tcb1_clk>;
-		clock-names = "t0_clk";
-	};
-
 RSTC Reset Controller required properties:
 - compatible: Should be "atmel,<chip>-rstc".
   <chip> can be "at91sam9260" or "at91sam9g45" or "sama5d3"
diff --git a/Documentation/devicetree/bindings/mfd/atmel-tcb.txt b/Documentation/devicetree/bindings/mfd/atmel-tcb.txt
new file mode 100644
index 000000000000..48196752c78f
--- /dev/null
+++ b/Documentation/devicetree/bindings/mfd/atmel-tcb.txt
@@ -0,0 +1,62 @@
+* Device tree bindings for Atmel Timer Counter Blocks
+- compatible: Should be "atmel,<chip>-tcb", "simple-mfd", "syscon".
+  <chip> can be "at91rm9200" or "at91sam9x5"
+- reg: Should contain registers location and length
+- #address-cells: has to be 1
+- #size-cells: has to be 0
+- interrupts: Should contain all interrupts for the TC block
+  Note that you can specify several interrupt cells if the TC
+  block has one interrupt per channel.
+- clock-names: tuple listing input clock names.
+	Required elements: "t0_clk", "slow_clk"
+	Optional elements: "t1_clk", "t2_clk"
+- clocks: phandles to input clocks.
+
+The TCB can expose multiple subdevices:
+ * a clocksource and clockevent device
+   - compatible: Should be "atmel,tcb-clksrc"
+   - reg: Should contain the TCB channels to be used. If the
+     counter width is 16 bits (at91rm9200-tcb), two consecutive
+     channels are needed. Else, only one channel will be used.
+
+ * a clockevent device
+   - compatible: Should be "atmel,tcb-clkevt"
+   - reg: Should contain the TCB channel to be used
+
+ * a PWM chip: see ../pwm/atmel-tcb-pwm.txt
+
+Examples:
+
+One interrupt per TC block:
+	tcb0: timer@fff7c000 {
+		compatible = "atmel,at91rm9200-tcb", "simple-mfd", "syscon";
+		#address-cells = <1>;
+		#size-cells = <0>;
+		reg = <0xfff7c000 0x100>;
+		interrupts = <18 4>;
+		clocks = <&tcb0_clk>;
+		clock-names = "t0_clk";
+
+		timer@0 {
+			compatible = "atmel,tcb-clksrc";
+			reg = <0>, <1>;
+		};
+
+		timer@2 {
+			compatible = "atmel,tcb-clkevt";
+			reg = <2>;
+		};
+	};
+
+One interrupt per TC channel in a TC block:
+	tcb1: timer@fffdc000 {
+		compatible = "atmel,at91rm9200-tcb", "simple-mfd", "syscon";
+		#address-cells = <1>;
+		#size-cells = <0>;
+		reg = <0xfffdc000 0x100>;
+		interrupts = <26 4>, <27 4>, <28 4>;
+		clocks = <&tcb1_clk>;
+		clock-names = "t0_clk";
+	};
+
+
diff --git a/Documentation/devicetree/bindings/pwm/atmel-tcb-pwm.txt b/Documentation/devicetree/bindings/pwm/atmel-tcb-pwm.txt
index 8031148bcf85..ab8fbd5ba184 100644
--- a/Documentation/devicetree/bindings/pwm/atmel-tcb-pwm.txt
+++ b/Documentation/devicetree/bindings/pwm/atmel-tcb-pwm.txt
@@ -2,15 +2,17 @@ Atmel TCB PWM controller
 
 Required properties:
 - compatible: should be "atmel,tcb-pwm"
+- reg: tcb channel to use. Each channel can export 2 PWMs
 - #pwm-cells: should be 3. See pwm.txt in this directory for a description of
   the cells format. The only third cell flag supported by this binding is
   PWM_POLARITY_INVERTED.
-- tc-block: The Timer Counter block to use as a PWM chip.
 
 Example:
 
-pwm {
-	compatible = "atmel,tcb-pwm";
-	#pwm-cells = <3>;
-	tc-block = <1>;
+tcb0: timer@f800c000 {
+	pwm@0 {
+		compatible = "atmel,tcb-pwm";
+		reg = <0>;
+		#pwm-cells = <3>;
+	};
 };
-- 
2.8.1

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH 02/48] ARM: at91: Document new TCB bindings
  2016-06-10 22:03 ` [PATCH 02/48] ARM: at91: Document new TCB bindings Alexandre Belloni
@ 2016-06-14 21:47   ` Rob Herring
  2016-06-15  7:29     ` Boris Brezillon
  0 siblings, 1 reply; 6+ messages in thread
From: Rob Herring @ 2016-06-14 21:47 UTC (permalink / raw)
  To: Alexandre Belloni
  Cc: Nicolas Ferre, Boris Brezillon, Jean-Christophe Plagniol-Villard,
	linux-arm-kernel, linux-kernel, Daniel Lezcano, Thierry Reding,
	linux-pwm, devicetree

On Sat, Jun 11, 2016 at 12:03:05AM +0200, Alexandre Belloni wrote:
> The current binding for the TCB is not flexible enough for some use cases
> and prevents proper utilization of all the channels.
> 
> Cc: Daniel Lezcano <daniel.lezcano@linaro.org>
> Cc: Thierry Reding <thierry.reding@gmail.com>
> Cc: linux-pwm@vger.kernel.org
> Cc: Rob Herring <robh+dt@kernel.org>
> Cc: devicetree@vger.kernel.org
> Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
> ---
>  .../devicetree/bindings/arm/atmel-at91.txt         | 32 -----------
>  .../devicetree/bindings/mfd/atmel-tcb.txt          | 62 ++++++++++++++++++++++
>  .../devicetree/bindings/pwm/atmel-tcb-pwm.txt      | 12 +++--
>  3 files changed, 69 insertions(+), 37 deletions(-)
>  create mode 100644 Documentation/devicetree/bindings/mfd/atmel-tcb.txt

[...]

> diff --git a/Documentation/devicetree/bindings/mfd/atmel-tcb.txt b/Documentation/devicetree/bindings/mfd/atmel-tcb.txt
> new file mode 100644
> index 000000000000..48196752c78f
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/mfd/atmel-tcb.txt
> @@ -0,0 +1,62 @@
> +* Device tree bindings for Atmel Timer Counter Blocks
> +- compatible: Should be "atmel,<chip>-tcb", "simple-mfd", "syscon".
> +  <chip> can be "at91rm9200" or "at91sam9x5"
> +- reg: Should contain registers location and length
> +- #address-cells: has to be 1
> +- #size-cells: has to be 0
> +- interrupts: Should contain all interrupts for the TC block
> +  Note that you can specify several interrupt cells if the TC
> +  block has one interrupt per channel.
> +- clock-names: tuple listing input clock names.
> +	Required elements: "t0_clk", "slow_clk"
> +	Optional elements: "t1_clk", "t2_clk"
> +- clocks: phandles to input clocks.

What is the order of clocks?

> +
> +The TCB can expose multiple subdevices:
> + * a clocksource and clockevent device

No. These compatible names are linuxisms. Describe features of the 
timers to be able to select which timer to use if you need to pick 
certain timers. For example, interrupt capability could be used to 
select the clkevt.

> +   - compatible: Should be "atmel,tcb-clksrc"
> +   - reg: Should contain the TCB channels to be used. If the
> +     counter width is 16 bits (at91rm9200-tcb), two consecutive
> +     channels are needed. Else, only one channel will be used.
> +
> + * a clockevent device
> +   - compatible: Should be "atmel,tcb-clkevt"
> +   - reg: Should contain the TCB channel to be used
> +
> + * a PWM chip: see ../pwm/atmel-tcb-pwm.txt
> +
> +Examples:
> +
> +One interrupt per TC block:
> +	tcb0: timer@fff7c000 {
> +		compatible = "atmel,at91rm9200-tcb", "simple-mfd", "syscon";
> +		#address-cells = <1>;
> +		#size-cells = <0>;
> +		reg = <0xfff7c000 0x100>;
> +		interrupts = <18 4>;
> +		clocks = <&tcb0_clk>;
> +		clock-names = "t0_clk";

Missing slow_clk

> +
> +		timer@0 {
> +			compatible = "atmel,tcb-clksrc";
> +			reg = <0>, <1>;
> +		};
> +
> +		timer@2 {
> +			compatible = "atmel,tcb-clkevt";
> +			reg = <2>;
> +		};
> +	};
> +
> +One interrupt per TC channel in a TC block:
> +	tcb1: timer@fffdc000 {
> +		compatible = "atmel,at91rm9200-tcb", "simple-mfd", "syscon";
> +		#address-cells = <1>;
> +		#size-cells = <0>;
> +		reg = <0xfffdc000 0x100>;
> +		interrupts = <26 4>, <27 4>, <28 4>;
> +		clocks = <&tcb1_clk>;
> +		clock-names = "t0_clk";
> +	};
> +
> +
> diff --git a/Documentation/devicetree/bindings/pwm/atmel-tcb-pwm.txt b/Documentation/devicetree/bindings/pwm/atmel-tcb-pwm.txt
> index 8031148bcf85..ab8fbd5ba184 100644
> --- a/Documentation/devicetree/bindings/pwm/atmel-tcb-pwm.txt
> +++ b/Documentation/devicetree/bindings/pwm/atmel-tcb-pwm.txt
> @@ -2,15 +2,17 @@ Atmel TCB PWM controller
>  
>  Required properties:
>  - compatible: should be "atmel,tcb-pwm"
> +- reg: tcb channel to use. Each channel can export 2 PWMs

Is there a difference in channels? If not, then this compatible should 
go.

>  - #pwm-cells: should be 3. See pwm.txt in this directory for a description of
>    the cells format. The only third cell flag supported by this binding is
>    PWM_POLARITY_INVERTED.
> -- tc-block: The Timer Counter block to use as a PWM chip.
>  
>  Example:
>  
> -pwm {
> -	compatible = "atmel,tcb-pwm";
> -	#pwm-cells = <3>;
> -	tc-block = <1>;
> +tcb0: timer@f800c000 {
> +	pwm@0 {
> +		compatible = "atmel,tcb-pwm";
> +		reg = <0>;
> +		#pwm-cells = <3>;
> +	};
>  };
> -- 
> 2.8.1
> 

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 02/48] ARM: at91: Document new TCB bindings
  2016-06-14 21:47   ` Rob Herring
@ 2016-06-15  7:29     ` Boris Brezillon
  2016-06-21 20:08       ` Rob Herring
  2016-06-21 20:28       ` Rob Herring
  0 siblings, 2 replies; 6+ messages in thread
From: Boris Brezillon @ 2016-06-15  7:29 UTC (permalink / raw)
  To: Rob Herring
  Cc: Alexandre Belloni, Nicolas Ferre,
	Jean-Christophe Plagniol-Villard, linux-arm-kernel, linux-kernel,
	Daniel Lezcano, Thierry Reding, linux-pwm, devicetree

On Tue, 14 Jun 2016 16:47:37 -0500
Rob Herring <robh@kernel.org> wrote:

> On Sat, Jun 11, 2016 at 12:03:05AM +0200, Alexandre Belloni wrote:
> > The current binding for the TCB is not flexible enough for some use cases
> > and prevents proper utilization of all the channels.
> > 
> > Cc: Daniel Lezcano <daniel.lezcano@linaro.org>
> > Cc: Thierry Reding <thierry.reding@gmail.com>
> > Cc: linux-pwm@vger.kernel.org
> > Cc: Rob Herring <robh+dt@kernel.org>
> > Cc: devicetree@vger.kernel.org
> > Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
> > ---
> >  .../devicetree/bindings/arm/atmel-at91.txt         | 32 -----------
> >  .../devicetree/bindings/mfd/atmel-tcb.txt          | 62 ++++++++++++++++++++++
> >  .../devicetree/bindings/pwm/atmel-tcb-pwm.txt      | 12 +++--
> >  3 files changed, 69 insertions(+), 37 deletions(-)
> >  create mode 100644 Documentation/devicetree/bindings/mfd/atmel-tcb.txt  
> 
> [...]
> 
> > diff --git a/Documentation/devicetree/bindings/mfd/atmel-tcb.txt b/Documentation/devicetree/bindings/mfd/atmel-tcb.txt
> > new file mode 100644
> > index 000000000000..48196752c78f
> > --- /dev/null
> > +++ b/Documentation/devicetree/bindings/mfd/atmel-tcb.txt
> > @@ -0,0 +1,62 @@
> > +* Device tree bindings for Atmel Timer Counter Blocks
> > +- compatible: Should be "atmel,<chip>-tcb", "simple-mfd", "syscon".
> > +  <chip> can be "at91rm9200" or "at91sam9x5"
> > +- reg: Should contain registers location and length
> > +- #address-cells: has to be 1
> > +- #size-cells: has to be 0
> > +- interrupts: Should contain all interrupts for the TC block
> > +  Note that you can specify several interrupt cells if the TC
> > +  block has one interrupt per channel.
> > +- clock-names: tuple listing input clock names.
> > +	Required elements: "t0_clk", "slow_clk"
> > +	Optional elements: "t1_clk", "t2_clk"
> > +- clocks: phandles to input clocks.  
> 
> What is the order of clocks?
> 
> > +
> > +The TCB can expose multiple subdevices:
> > + * a clocksource and clockevent device  
> 
> No. These compatible names are linuxisms. Describe features of the 
> timers to be able to select which timer to use if you need to pick 
> certain timers. For example, interrupt capability could be used to 
> select the clkevt.

Would 'atmel,tcb-free-running-timer' (to replace 'atmel,tcb-clksrc') and
'atmel,tcb-programmable-timer' (to replace 'atmel,tcb-clkevt') be
acceptable?

> 
> > +   - compatible: Should be "atmel,tcb-clksrc"
> > +   - reg: Should contain the TCB channels to be used. If the
> > +     counter width is 16 bits (at91rm9200-tcb), two consecutive
> > +     channels are needed. Else, only one channel will be used.
> > +
> > + * a clockevent device
> > +   - compatible: Should be "atmel,tcb-clkevt"
> > +   - reg: Should contain the TCB channel to be used
> > +
> > + * a PWM chip: see ../pwm/atmel-tcb-pwm.txt
> > +
> > +Examples:
> > +
> > +One interrupt per TC block:
> > +	tcb0: timer@fff7c000 {
> > +		compatible = "atmel,at91rm9200-tcb", "simple-mfd", "syscon";
> > +		#address-cells = <1>;
> > +		#size-cells = <0>;
> > +		reg = <0xfff7c000 0x100>;
> > +		interrupts = <18 4>;
> > +		clocks = <&tcb0_clk>;
> > +		clock-names = "t0_clk";  
> 
> Missing slow_clk
> 
> > +
> > +		timer@0 {
> > +			compatible = "atmel,tcb-clksrc";
> > +			reg = <0>, <1>;
> > +		};
> > +
> > +		timer@2 {
> > +			compatible = "atmel,tcb-clkevt";
> > +			reg = <2>;
> > +		};
> > +	};
> > +
> > +One interrupt per TC channel in a TC block:
> > +	tcb1: timer@fffdc000 {
> > +		compatible = "atmel,at91rm9200-tcb", "simple-mfd", "syscon";
> > +		#address-cells = <1>;
> > +		#size-cells = <0>;
> > +		reg = <0xfffdc000 0x100>;
> > +		interrupts = <26 4>, <27 4>, <28 4>;
> > +		clocks = <&tcb1_clk>;
> > +		clock-names = "t0_clk";
> > +	};
> > +
> > +
> > diff --git a/Documentation/devicetree/bindings/pwm/atmel-tcb-pwm.txt b/Documentation/devicetree/bindings/pwm/atmel-tcb-pwm.txt
> > index 8031148bcf85..ab8fbd5ba184 100644
> > --- a/Documentation/devicetree/bindings/pwm/atmel-tcb-pwm.txt
> > +++ b/Documentation/devicetree/bindings/pwm/atmel-tcb-pwm.txt
> > @@ -2,15 +2,17 @@ Atmel TCB PWM controller
> >  
> >  Required properties:
> >  - compatible: should be "atmel,tcb-pwm"
> > +- reg: tcb channel to use. Each channel can export 2 PWMs  
> 
> Is there a difference in channels? If not, then this compatible should 
> go.

This one I don't understand.
The TCB (Timer Counter Block) is an MFD containing 3 Timer Counter
devices. Each of these devices (also called channels) can be assigned a
specific mode:
- timer mode (free-running of programmable)
- waveform generator mode (IOW, a PWM)
- capture mode (an IIO device, but we don't have any driver for that
  right now)

So each sub-device of the TCB is represented as a sub-node with its own
compatible. Is there a problem with that?

> 
> >  - #pwm-cells: should be 3. See pwm.txt in this directory for a description of
> >    the cells format. The only third cell flag supported by this binding is
> >    PWM_POLARITY_INVERTED.
> > -- tc-block: The Timer Counter block to use as a PWM chip.
> >  
> >  Example:
> >  
> > -pwm {
> > -	compatible = "atmel,tcb-pwm";
> > -	#pwm-cells = <3>;
> > -	tc-block = <1>;
> > +tcb0: timer@f800c000 {
> > +	pwm@0 {
> > +		compatible = "atmel,tcb-pwm";
> > +		reg = <0>;
> > +		#pwm-cells = <3>;
> > +	};
> >  };
> > -- 
> > 2.8.1
> >   



-- 
Boris Brezillon, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 02/48] ARM: at91: Document new TCB bindings
  2016-06-15  7:29     ` Boris Brezillon
@ 2016-06-21 20:08       ` Rob Herring
  2016-06-21 20:28       ` Rob Herring
  1 sibling, 0 replies; 6+ messages in thread
From: Rob Herring @ 2016-06-21 20:08 UTC (permalink / raw)
  To: Boris Brezillon
  Cc: Alexandre Belloni, Nicolas Ferre,
	Jean-Christophe Plagniol-Villard,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA, Daniel Lezcano,
	Thierry Reding, linux-pwm-u79uwXL29TY76Z2rM5mHXA,
	devicetree-u79uwXL29TY76Z2rM5mHXA

On Wed, Jun 15, 2016 at 09:29:55AM +0200, Boris Brezillon wrote:
> On Tue, 14 Jun 2016 16:47:37 -0500
> Rob Herring <robh-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org> wrote:
> 
> > On Sat, Jun 11, 2016 at 12:03:05AM +0200, Alexandre Belloni wrote:
> > > The current binding for the TCB is not flexible enough for some use cases
> > > and prevents proper utilization of all the channels.
> > > 
> > > Cc: Daniel Lezcano <daniel.lezcano-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
> > > Cc: Thierry Reding <thierry.reding-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
> > > Cc: linux-pwm-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
> > > Cc: Rob Herring <robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
> > > Cc: devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
> > > Signed-off-by: Alexandre Belloni <alexandre.belloni-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
> > > ---
> > >  .../devicetree/bindings/arm/atmel-at91.txt         | 32 -----------
> > >  .../devicetree/bindings/mfd/atmel-tcb.txt          | 62 ++++++++++++++++++++++
> > >  .../devicetree/bindings/pwm/atmel-tcb-pwm.txt      | 12 +++--
> > >  3 files changed, 69 insertions(+), 37 deletions(-)
> > >  create mode 100644 Documentation/devicetree/bindings/mfd/atmel-tcb.txt  
> > 
> > [...]
> > 
> > > diff --git a/Documentation/devicetree/bindings/mfd/atmel-tcb.txt b/Documentation/devicetree/bindings/mfd/atmel-tcb.txt
> > > new file mode 100644
> > > index 000000000000..48196752c78f
> > > --- /dev/null
> > > +++ b/Documentation/devicetree/bindings/mfd/atmel-tcb.txt
> > > @@ -0,0 +1,62 @@
> > > +* Device tree bindings for Atmel Timer Counter Blocks
> > > +- compatible: Should be "atmel,<chip>-tcb", "simple-mfd", "syscon".
> > > +  <chip> can be "at91rm9200" or "at91sam9x5"
> > > +- reg: Should contain registers location and length
> > > +- #address-cells: has to be 1
> > > +- #size-cells: has to be 0
> > > +- interrupts: Should contain all interrupts for the TC block
> > > +  Note that you can specify several interrupt cells if the TC
> > > +  block has one interrupt per channel.
> > > +- clock-names: tuple listing input clock names.
> > > +	Required elements: "t0_clk", "slow_clk"
> > > +	Optional elements: "t1_clk", "t2_clk"
> > > +- clocks: phandles to input clocks.  
> > 
> > What is the order of clocks?
> > 
> > > +
> > > +The TCB can expose multiple subdevices:
> > > + * a clocksource and clockevent device  
> > 
> > No. These compatible names are linuxisms. Describe features of the 
> > timers to be able to select which timer to use if you need to pick 
> > certain timers. For example, interrupt capability could be used to 
> > select the clkevt.
> 
> Would 'atmel,tcb-free-running-timer' (to replace 'atmel,tcb-clksrc') and
> 'atmel,tcb-programmable-timer' (to replace 'atmel,tcb-clkevt') be
> acceptable?

If that somehow matches the documentation or accurately describes the 
h/w capabilities for them, then yes.

Rob
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 02/48] ARM: at91: Document new TCB bindings
  2016-06-15  7:29     ` Boris Brezillon
  2016-06-21 20:08       ` Rob Herring
@ 2016-06-21 20:28       ` Rob Herring
  1 sibling, 0 replies; 6+ messages in thread
From: Rob Herring @ 2016-06-21 20:28 UTC (permalink / raw)
  To: Boris Brezillon
  Cc: linux-pwm, devicetree, Daniel Lezcano, Nicolas Ferre,
	linux-kernel, Thierry Reding, Alexandre Belloni,
	Jean-Christophe Plagniol-Villard, linux-arm-kernel

On Wed, Jun 15, 2016 at 09:29:55AM +0200, Boris Brezillon wrote:
> On Tue, 14 Jun 2016 16:47:37 -0500
> Rob Herring <robh@kernel.org> wrote:
> 
> > On Sat, Jun 11, 2016 at 12:03:05AM +0200, Alexandre Belloni wrote:
> > > The current binding for the TCB is not flexible enough for some use cases
> > > and prevents proper utilization of all the channels.
> > > 
> > > Cc: Daniel Lezcano <daniel.lezcano@linaro.org>
> > > Cc: Thierry Reding <thierry.reding@gmail.com>
> > > Cc: linux-pwm@vger.kernel.org
> > > Cc: Rob Herring <robh+dt@kernel.org>
> > > Cc: devicetree@vger.kernel.org
> > > Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
> > > ---
> > >  .../devicetree/bindings/arm/atmel-at91.txt         | 32 -----------
> > >  .../devicetree/bindings/mfd/atmel-tcb.txt          | 62 ++++++++++++++++++++++
> > >  .../devicetree/bindings/pwm/atmel-tcb-pwm.txt      | 12 +++--
> > >  3 files changed, 69 insertions(+), 37 deletions(-)
> > >  create mode 100644 Documentation/devicetree/bindings/mfd/atmel-tcb.txt  
> > 
> > [...]


> > > diff --git a/Documentation/devicetree/bindings/pwm/atmel-tcb-pwm.txt b/Documentation/devicetree/bindings/pwm/atmel-tcb-pwm.txt
> > > index 8031148bcf85..ab8fbd5ba184 100644
> > > --- a/Documentation/devicetree/bindings/pwm/atmel-tcb-pwm.txt
> > > +++ b/Documentation/devicetree/bindings/pwm/atmel-tcb-pwm.txt
> > > @@ -2,15 +2,17 @@ Atmel TCB PWM controller
> > >  
> > >  Required properties:
> > >  - compatible: should be "atmel,tcb-pwm"
> > > +- reg: tcb channel to use. Each channel can export 2 PWMs  
> > 
> > Is there a difference in channels? If not, then this compatible should 
> > go.
> 
> This one I don't understand.
> The TCB (Timer Counter Block) is an MFD containing 3 Timer Counter
> devices. Each of these devices (also called channels) can be assigned a
> specific mode:
> - timer mode (free-running of programmable)
> - waveform generator mode (IOW, a PWM)
> - capture mode (an IIO device, but we don't have any driver for that
>   right now)
> 
> So each sub-device of the TCB is represented as a sub-node with its own
> compatible. Is there a problem with that?

Missed this in my first reply. I guess for purposes of referencing pwm 
from other nodes this is okay.

Rob

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2016-06-21 20:28 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-06-10 22:03 [PATCH 00/48] ARM: at91: rework Atmel TCB drivers Alexandre Belloni
2016-06-10 22:03 ` [PATCH 02/48] ARM: at91: Document new TCB bindings Alexandre Belloni
2016-06-14 21:47   ` Rob Herring
2016-06-15  7:29     ` Boris Brezillon
2016-06-21 20:08       ` Rob Herring
2016-06-21 20:28       ` Rob Herring

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).