From: Arnd Bergmann <arnd@arndb.de>
To: monstr@monstr.eu
Cc: Bart Tanghe <bart.tanghe@thomasmore.be>,
thierry.reding@gmail.com, michal.simek@xilinx.com,
robh+dt@kernel.org, pawel.moll@arm.com, mark.rutland@arm.com,
ijc+devicetree@hellion.org.uk, galak@codeaurora.org,
rob@landley.net, grant.likely@linaro.org,
linux-pwm@vger.kernel.org, devicetree@vger.kernel.org,
linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [rfc]pwm: add xilinx pwm driver
Date: Thu, 15 May 2014 14:20:11 +0200 [thread overview]
Message-ID: <5049141.XmehsUeakV@wuerfel> (raw)
In-Reply-To: <53748D84.5040005@monstr.eu>
On Thursday 15 May 2014 11:48:52 Michal Simek wrote:
> On 05/14/2014 01:26 PM, Bart Tanghe wrote:
> > add Xilinx PWM support - axi timer hardware block
> >
> > Signed-off-by: Bart Tanghe <bart.tanghe@thomasmore.be>
> > diff --git a/Documentation/devicetree/bindings/pwm/pwm-xlnx.txt b/Documentation/devicetree/bindings/pwm/pwm-xlnx.txt
> > new file mode 100644
> > index 0000000..cb48926
> > --- /dev/null
> > +++ b/Documentation/devicetree/bindings/pwm/pwm-xlnx.txt
> > @@ -0,0 +1,20 @@
> > +Xilinx PWM controller
> > +
> > +Required properties:
> > +- compatible: should be "xlnx,pwm-xlnx"
> > +- add a clock source to the description
> > +
> > +Examples:
> > +
> > + axi_timer_0: timer@42800000 {
> > + clock-frequency = <100000000>;
>
> just remove this from example it is not needed and unused.
>
>
> > + clocks = <&clkc 15>;
> > + compatible = "xlnx,xlnx-pwm";
> > + reg = <0x42800000 0x10000>;
> > + xlnx,count-width = <0x20>;
> > + xlnx,gen0-assert = <0x1>;
> > + xlnx,gen1-assert = <0x1>;
> > + xlnx,one-timer-only = <0x0>;
> > + xlnx,trig0-assert = <0x1>;
> > + xlnx,trig1-assert = <0x1>;
> > + } ;
>
> ok. This has to be done completely differently.
> I have looked around and found one a little bit older
> example but it is in the Linux kernel.
> It is pwm-atmel-tcb.c driver and atmel_tclib.c and tcb_clksrc.c.
>
> Arnd: Isn't there any newer better example how to manage it?
Note that we have two atmel pwm drivers: drivers/misc/atmel_pwm.c
and drivers/pwm/pwm-atmel.c. If you want to take that as an example,
make sure you use base on the latter.
> Back to atmel example - they are maintaining
> internal list of timers (atmel_tclib.c)
> and then clocksource driver (tcb_clksrc.c) is asking with atmel_tc_alloc() for it.
> The same is for pwm driver (pwm-atmel-tcb.c).
>
> They probably have all timers the same which is not
> our case because they can be different but this can be solved
> with flags.
>
> From DT point of view I think this is the reasonable description
>
> axi_timer_0: timer@42800000 {
> clocks = <&clkc 15>;
> compatible = "xlnx,xps-timer-1.00.a";
> interrupt-parent = <&xps_intc_0>;
> interrupts = < 3 2 >;
> reg = <0x42800000 0x10000>;
> xlnx,count-width = <0x20>;
> xlnx,gen0-assert = <0x1>;
> xlnx,gen1-assert = <0x1>;
> xlnx,one-timer-only = <0x0>;
> xlnx,trig0-assert = <0x1>;
> xlnx,trig1-assert = <0x1>;
> } ;
>
>
> pwm {
> compatible = "xlnx,timer-pwm";
> #pwm-cells = <2>;
> timer = <&axi_timer_0>;
> };
>
>
> Allocation function will also require to do a change
> in clocksource driver because currently the first
> timer in the DTS/system is taken for clocksource/clockevents
> (others are just ignored).
> That's why will be necessary to add clock-handle property
> to cpu node to exactly describe which timer is system timer.
> The same as is for interrupt-handle (more intc's can be in design).
If there is just one set of registers, I wouldn't object to
having just a single node in DT, and just one driver that registers
to both the clocksource and the PWM interfaces. That might
simplify the code.
> cpus {
> #address-cells = <1>;
> #cpus = <1>;
> #size-cells = <0>;
> microblaze_0: cpu@0 {
> compatible = "xlnx,microblaze-8.50.a";
> interrupt-handle = <µblaze_0_intc>;
> ...
> clock-handle = <&axi_timer_X>;
> ...
> } ;
> } ;
>
> Then clocksource driver will ask just exact timer which is suitable
> to provide clocksource/clockevent. It can be also split and
> use 2 cells format to specify which timer should be used.
> clocksource-handle = <&axi_timer_X 0>;
> clockeven-handle = <&axi_timer_X 1>;
This seems fine, too.
Arnd
next prev parent reply other threads:[~2014-05-15 12:20 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-05-14 11:26 [rfc]pwm: add xilinx pwm driver Bart Tanghe
2014-05-15 7:23 ` Arnd Bergmann
2014-05-15 8:50 ` Bart Tanghe
2014-05-15 10:33 ` Michal Simek
2014-05-15 11:30 ` Bart Tanghe
2014-05-15 11:54 ` Michal Simek
2014-05-15 9:48 ` Michal Simek
2014-05-15 12:20 ` Arnd Bergmann [this message]
2014-05-15 13:56 ` Michal Simek
2014-05-15 16:30 ` Arnd Bergmann
2014-05-15 20:49 ` Thierry Reding
2014-05-16 8:44 ` Michal Simek
2014-05-16 7:53 ` Michal Simek
2014-09-04 10:41 ` Bart Tanghe
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=5049141.XmehsUeakV@wuerfel \
--to=arnd@arndb.de \
--cc=bart.tanghe@thomasmore.be \
--cc=devicetree@vger.kernel.org \
--cc=galak@codeaurora.org \
--cc=grant.likely@linaro.org \
--cc=ijc+devicetree@hellion.org.uk \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pwm@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=michal.simek@xilinx.com \
--cc=monstr@monstr.eu \
--cc=pawel.moll@arm.com \
--cc=rob@landley.net \
--cc=robh+dt@kernel.org \
--cc=thierry.reding@gmail.com \
/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