devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Boris Brezillon <boris.brezillon-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
To: Alexandre Belloni
	<alexandre.belloni-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>,
	Rob Herring <robh-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
Cc: Daniel Lezcano
	<daniel.lezcano-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>,
	Nicolas Ferre
	<nicolas.ferre-UWL1GkI3JZL3oGB3hsPCZA@public.gmane.org>,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	Thomas Gleixner <tglx-hfZtesqFncYOwBW4kG4KsQ@public.gmane.org>,
	"devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
	<devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>
Subject: Re: [PATCH 46/58] clocksource/drivers: Add a new driver for the Atmel ARM TC blocks
Date: Thu, 8 Jun 2017 07:42:36 +0200	[thread overview]
Message-ID: <20170608074236.62924f01@bbrezillon> (raw)
In-Reply-To: <20170607231715.ns2vcxza2eexnzjs-m++hUPXGwpdeoWH0uzbU5w@public.gmane.org>

Le Thu, 8 Jun 2017 01:17:15 +0200,
Alexandre Belloni <alexandre.belloni-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org> a écrit :

> On 07/06/2017 at 23:08:48 +0200, Daniel Lezcano wrote:
> > > I was going to agree but this is not flexible enough because the
> > > quadrature decoder always uses the first two channels. So on some
> > > products, we may have:
> > >  - TCB0:
> > >    o channels 0,1: qdec
> > >    o channel 2: clocksource
> > > 
> > >  - TCB1:
> > >    o channels 0,1: qdec
> > >    o channel 2: clockevent
> > > 
> > > This avoids wasting TCB channels.  
> > 
> > Ok. In this case you can check if the interrupt is specified for the node, if
> > yes, then it is a clockevent.
> >   
> 
> But currently it is always specified in the SoC's dtsi. I don't find
> that too practical to push that to the board's dts. Also, lying by
> omission (the IRQ is always wired) in the DT is not different from
> having a property selecting which timer is the clocksource and which is
> the clockevent.
> 

I agree with Alexandre here. Really, there's not much we can do to
detect which timer should be used as a clockevent and which one should
be used as a clocksource except explicitly specifying it in the DT.
Having an interrupt defined in one case (clockevent) and undefined in
the other case (clocksource), is just as hack-ish as the detection logic
Alexandre developed to avoid explicitly specifying the function
assigned to a specific timer.

Can we please find a solution that makes everyone happy (DT,
clocksoure/clockevent and at91 maintainers)?

How about adding a linux,timer-function property to specify which
function this timer is providing?

Something like that for example:

	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>, <&clk32k>;
		clock-names = "t0_clk", "slow_clk";

		timer@0 {
			compatible = "atmel,tcb-timer";
			reg = <0>, <1>;
			linux,timer-function = "clocksource";
		};

		timer@2 {
			compatible = "atmel,tcb-timer";
			reg = <2>;
			linux,timer-function = "clockevent";
		};
	};

Alternatively, we could have a property or a node in chosen describing which
timer should be used:

	chosen {
		clockevent {
			timer = <&timer2>;
		};

		clocksource {
			timer = <&timer0>;
		};

		/*
		 * or
		 *
		 * clockevent = <&timer2>;
		 * clocksource = <&timer0>;
		 *
		 * but I think the clocksource/clockevent node approach
		 * is more future proof in case we need to add extra
		 * information like the expected resolution/precision or
		 * anything that could be tweakable.
		 */
	};

	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>, <&clk32k>;
		clock-names = "t0_clk", "slow_clk";

		timer0: timer@0 {
			compatible = "atmel,tcb-timer";
			reg = <0>, <1>;
		};

		timer2: timer@2 {
			compatible = "atmel,tcb-timer";
			reg = <2>;
		};
	};
--
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

  parent reply	other threads:[~2017-06-08  5:42 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-30 21:50 [PATCH 00/58] ARM: at91: rework Atmel TCB drivers Alexandre Belloni
2017-05-30 21:50 ` [PATCH 01/58] ARM: at91: Document new TCB bindings Alexandre Belloni
     [not found]   ` <20170530215139.9983-2-alexandre.belloni-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
2017-06-07 21:17     ` Rob Herring
2017-05-31  6:34 ` [PATCH 00/58] ARM: at91: rework Atmel TCB drivers Peter Rosin
2017-05-31  7:21   ` Alexandre Belloni
     [not found] ` <20170530215139.9983-47-alexandre.belloni@free-electrons.com>
     [not found]   ` <20170606152104.GC2345@mai>
     [not found]     ` <20170606180559.pkrr7ux2qqnmsd6y@piout.net>
     [not found]       ` <20170607141735.GH2345@mai>
     [not found]         ` <20170607152750.tksmyf5p3oajbsac@piout.net>
     [not found]           ` <20170607210848.GJ2345@mai>
     [not found]             ` <20170607231715.ns2vcxza2eexnzjs@piout.net>
     [not found]               ` <20170607231715.ns2vcxza2eexnzjs-m++hUPXGwpdeoWH0uzbU5w@public.gmane.org>
2017-06-08  5:42                 ` Boris Brezillon [this message]
2017-06-08  7:44                   ` [PATCH 46/58] clocksource/drivers: Add a new driver for the Atmel ARM TC blocks Daniel Lezcano
2017-06-08  7:59                     ` Alexandre Belloni
2017-06-08  8:24                       ` Daniel Lezcano
2017-06-08  8:33                         ` Boris Brezillon
2017-06-08  8:42                         ` Alexandre Belloni
2017-06-08  8:13                     ` Boris Brezillon
2017-06-08  8:40                       ` Daniel Lezcano
2017-06-08  8:57                         ` Boris Brezillon
2017-06-12 12:54                         ` Nicolas Ferre
     [not found]                           ` <eada48f9-55b5-859d-d37e-4c9e938bc29d-UWL1GkI3JZL3oGB3hsPCZA@public.gmane.org>
2017-06-12 13:25                             ` Daniel Lezcano
     [not found]                               ` <4c2a5425-acb4-c639-7f54-1dd933c44d03-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2017-06-12 15:26                                 ` Nicolas Ferre
2017-07-06  6:40 ` [PATCH 00/58] ARM: at91: rework Atmel TCB drivers Thierry Reding

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=20170608074236.62924f01@bbrezillon \
    --to=boris.brezillon-wi1+55scjutkeb57/3fjtnbpr1lh4cv8@public.gmane.org \
    --cc=alexandre.belloni-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org \
    --cc=daniel.lezcano-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org \
    --cc=devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=nicolas.ferre-UWL1GkI3JZL3oGB3hsPCZA@public.gmane.org \
    --cc=robh-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
    --cc=tglx-hfZtesqFncYOwBW4kG4KsQ@public.gmane.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).