linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: boris.brezillon@free-electrons.com (Boris Brezillon)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 02/48] ARM: at91: Document new TCB bindings
Date: Wed, 15 Jun 2016 09:29:55 +0200	[thread overview]
Message-ID: <20160615092955.261f14fb@bbrezillon> (raw)
In-Reply-To: <20160614214737.GA10294@rob-hp-laptop>

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 at vger.kernel.org
> > Cc: Rob Herring <robh+dt@kernel.org>
> > Cc: devicetree at 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 at 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 at 0 {
> > +			compatible = "atmel,tcb-clksrc";
> > +			reg = <0>, <1>;
> > +		};
> > +
> > +		timer at 2 {
> > +			compatible = "atmel,tcb-clkevt";
> > +			reg = <2>;
> > +		};
> > +	};
> > +
> > +One interrupt per TC channel in a TC block:
> > +	tcb1: timer at 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 at f800c000 {
> > +	pwm at 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

  reply	other threads:[~2016-06-15  7:29 UTC|newest]

Thread overview: 75+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-10 22:03 [PATCH 00/48] ARM: at91: rework Atmel TCB drivers Alexandre Belloni
2016-06-10 22:03 ` [PATCH 01/48] clk: at91: replace usleep() by udelay() calls Alexandre Belloni
2016-06-10 22:30   ` Arnd Bergmann
2016-06-10 22:37     ` Alexandre Belloni
2016-06-13 15:24     ` Alexandre Belloni
2016-06-13 19:26       ` Arnd Bergmann
2016-06-14 16:05       ` Afzal Mohammed
2016-06-14 16:18         ` Boris Brezillon
2016-06-11  7:49   ` Boris Brezillon
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 [this message]
2016-06-21 20:08       ` Rob Herring
2016-06-21 20:28       ` Rob Herring
2016-06-10 22:03 ` [PATCH 03/48] ARM: dts: at91: at91rm9200: TC blocks are also simple-mfd and syscon devices Alexandre Belloni
2016-06-10 22:03 ` [PATCH 04/48] ARM: dts: at91: at91rm9200ek; use TCB0 as clocksource Alexandre Belloni
2016-06-10 22:03 ` [PATCH 05/48] ARM: dts: at91: mpa1600; " Alexandre Belloni
2016-06-10 22:03 ` [PATCH 06/48] ARM: dts: at91: at91sam9260: TC blocks are also simple-mfd and syscon devices Alexandre Belloni
2016-06-10 22:03 ` [PATCH 07/48] ARM: dts: at91: ethernut5: use TCB0 as clocksource Alexandre Belloni
2016-06-10 22:03 ` [PATCH 08/48] ARM: dts: at91: foxg20: " Alexandre Belloni
2016-06-10 22:03 ` [PATCH 09/48] ARM: dts: at91: animeo_ip: " Alexandre Belloni
2016-06-10 22:03 ` [PATCH 10/48] ARM: dts: at91: kizbox: " Alexandre Belloni
2016-06-10 22:03 ` [PATCH 11/48] ARM: dts: at91: at91sam9g20ek: " Alexandre Belloni
2016-06-10 22:03 ` [PATCH 12/48] ARM: dts: at91: ge863-pro3: " Alexandre Belloni
2016-06-10 22:03 ` [PATCH 13/48] ARM: dts: at91: at91sam9261: TC blocks are also simple-mfd and syscon devices Alexandre Belloni
2016-06-10 22:03 ` [PATCH 14/48] ARM: dts: at91: at91sam9261ek: use TCB0 as clocksource Alexandre Belloni
2016-06-10 22:03 ` [PATCH 15/48] ARM: dts: at91: at91sam9263: TC blocks are also simple-mfd and syscon devices Alexandre Belloni
2016-06-10 22:03 ` [PATCH 16/48] ARM: dts: at91: at91sam9263ek: use TCB0 as clocksource Alexandre Belloni
2016-06-10 22:03 ` [PATCH 17/48] ARM: dts: at91: calao: " Alexandre Belloni
2016-06-10 22:03 ` [PATCH 18/48] ARM: dts: at91: at91sam9g45: TC blocks are also simple-mfd and syscon devices Alexandre Belloni
2016-06-10 22:03 ` [PATCH 19/48] ARM: dts: at91: at91sam9m10g45ek: use TCB0 as clocksource Alexandre Belloni
2016-06-10 22:03 ` [PATCH 20/48] ARM: dts: at91: pm9g45: " Alexandre Belloni
2016-06-10 22:03 ` [PATCH 21/48] ARM: dts: at91: at91sam9rl: TC blocks are also simple-mfd and syscon devices Alexandre Belloni
2016-06-10 22:03 ` [PATCH 22/48] ARM: dts: at91: at91sam9rlek: use TCB0 as clocksource Alexandre Belloni
2016-06-10 22:03 ` [PATCH 23/48] ARM: dts: at91: at91sam9n12: TC blocks are also simple-mfd and syscon devices Alexandre Belloni
2016-06-10 22:03 ` [PATCH 24/48] ARM: dts: at91: at91sam9n12ek: use TCB0 as clocksource Alexandre Belloni
2016-06-10 22:03 ` [PATCH 25/48] ARM: dts: at91: at91sam9x5: TC blocks are also simple-mfd and syscon devices Alexandre Belloni
2016-06-10 22:03 ` [PATCH 26/48] ARM: dts: at91: at91sam9x5cm: use TCB0 as clocksource Alexandre Belloni
2016-06-10 22:03 ` [PATCH 27/48] ARM: dts: at91: acme/g25: " Alexandre Belloni
2016-06-10 22:03 ` [PATCH 28/48] ARM: dts: at91: cosino: " Alexandre Belloni
2016-06-10 22:03 ` [PATCH 29/48] ARM: dts: at91: kizboxmini: " Alexandre Belloni
2016-06-10 22:03 ` [PATCH 30/48] ARM: dts: at91: sama5d3: TC blocks are also simple-mfd and syscon devices Alexandre Belloni
2016-06-10 22:03 ` [PATCH 31/48] ARM: dts: at91: sama5d3xek; use TCB0 as clocksource Alexandre Belloni
2016-06-10 22:03 ` [PATCH 32/48] ARM: dts: at91: sama5d3 Xplained: " Alexandre Belloni
2016-06-10 22:03 ` [PATCH 33/48] ARM: dts: at91: kizbox2: " Alexandre Belloni
2016-06-10 22:03 ` [PATCH 34/48] ARM: dts: at91: sama5d4: TC blocks are also simple-mfd and syscon devices Alexandre Belloni
2016-06-10 22:03 ` [PATCH 35/48] ARM: dts: at91: sama5d4: Add TCB2 Alexandre Belloni
2016-06-10 22:03 ` [PATCH 36/48] ARM: dts: at91: sama5d4ek: use TCB2 as clocksource Alexandre Belloni
2016-06-10 22:03 ` [PATCH 37/48] ARM: dts: at91: sama5d4 Xplained: " Alexandre Belloni
2016-06-10 22:03 ` [PATCH 38/48] ARM: dts: at91: ma5d4: " Alexandre Belloni
2016-06-10 22:03 ` [PATCH 39/48] ARM: dts: at91: vinco: " Alexandre Belloni
2016-06-10 22:03 ` [PATCH 40/48] ARM: dts: at91: sama5d2: TC blocks are also simple-mfd and syscon devices Alexandre Belloni
2016-06-10 22:03 ` [PATCH 41/48] ARM: dts: at91: sama5d2 Xplained: use TCB0 as clocksource Alexandre Belloni
2016-06-10 22:03 ` [PATCH 42/48] clocksource/drivers: Add a new driver for the Atmel ARM TC blocks Alexandre Belloni
2016-06-11 12:48   ` Boris Brezillon
2016-06-22 13:07     ` Daniel Lezcano
2016-06-22 13:13       ` Boris Brezillon
2016-06-24 10:07   ` Daniel Lezcano
2017-05-16 11:59     ` Alexandre Belloni
2017-05-16 14:25       ` Daniel Lezcano
2017-05-16 14:35         ` Alexandre Belloni
2016-06-10 22:03 ` [PATCH 43/48] clocksource/drivers: Add a clockevent driver for Atmel " Alexandre Belloni
2016-06-10 22:03 ` [PATCH 44/48] clocksource: atmel-pit: allow unselecting ATMEL_PIT Alexandre Belloni
2016-06-11  9:43   ` Thomas Gleixner
2016-06-11 10:53     ` Alexandre Belloni
2016-06-13 19:04       ` Boris Brezillon
2016-06-13 19:14         ` Thomas Gleixner
2016-06-16 14:41           ` Boris Brezillon
2016-06-10 22:03 ` [PATCH 45/48] ARM: at91/defconfig: sama5: unselect ATMEL_PIT Alexandre Belloni
2016-06-10 22:03 ` [PATCH 46/48] ARM: at91/defconfig: at91_dt " Alexandre Belloni
2016-06-10 22:03 ` [PATCH 47/48] PWM: atmel-tcb: switch to new binding Alexandre Belloni
2016-06-11  2:22   ` kbuild test robot
2016-06-10 22:03 ` [PATCH 48/48] ARM: dts: at91: kizbox: switch to new pwm-atmel-tcb binding Alexandre Belloni
2016-06-11  0:14   ` kbuild test robot
2016-06-11 10:25     ` Alexandre Belloni

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160615092955.261f14fb@bbrezillon \
    --to=boris.brezillon@free-electrons.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).