Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1419797 > unrolled thread
| Started by | Alexandre Belloni <alexandre.belloni@free-electrons.com> |
|---|---|
| First post | 2016-06-11 00:20 +0200 |
| Last post | 2016-06-11 00:20 +0200 |
| Articles | 20 on this page of 26 — 5 participants |
Back to article view | Back to linux.kernel
[PATCH 00/48] ARM: at91: rework Atmel TCB drivers Alexandre Belloni <alexandre.belloni@free-electrons.com> - 2016-06-11 00:20 +0200
[PATCH 01/48] clk: at91: replace usleep() by udelay() calls Alexandre Belloni <alexandre.belloni@free-electrons.com> - 2016-06-11 00:20 +0200
Re: [PATCH 01/48] clk: at91: replace usleep() by udelay() calls Arnd Bergmann <arnd@arndb.de> - 2016-06-11 00:40 +0200
Re: [PATCH 01/48] clk: at91: replace usleep() by udelay() calls Alexandre Belloni <alexandre.belloni@free-electrons.com> - 2016-06-11 00:40 +0200
Re: [PATCH 01/48] clk: at91: replace usleep() by udelay() calls Alexandre Belloni <alexandre.belloni@free-electrons.com> - 2016-06-13 17:30 +0200
Re: [PATCH 01/48] clk: at91: replace usleep() by udelay() calls Arnd Bergmann <arnd@arndb.de> - 2016-06-13 21:30 +0200
Re: [PATCH 01/48] clk: at91: replace usleep() by udelay() calls Afzal Mohammed <afzal.mohd.ma@gmail.com> - 2016-06-14 18:10 +0200
Re: [PATCH 01/48] clk: at91: replace usleep() by udelay() calls Boris Brezillon <boris.brezillon@free-electrons.com> - 2016-06-14 18:20 +0200
Re: [PATCH 01/48] clk: at91: replace usleep() by udelay() calls Boris Brezillon <boris.brezillon@free-electrons.com> - 2016-06-11 10:00 +0200
[PATCH 07/48] ARM: dts: at91: ethernut5: use TCB0 as clocksource Alexandre Belloni <alexandre.belloni@free-electrons.com> - 2016-06-11 00:20 +0200
[PATCH 02/48] ARM: at91: Document new TCB bindings Alexandre Belloni <alexandre.belloni@free-electrons.com> - 2016-06-11 00:20 +0200
Re: [PATCH 02/48] ARM: at91: Document new TCB bindings Rob Herring <robh@kernel.org> - 2016-06-14 23:50 +0200
Re: [PATCH 02/48] ARM: at91: Document new TCB bindings Boris Brezillon <boris.brezillon@free-electrons.com> - 2016-06-15 09:40 +0200
Re: [PATCH 02/48] ARM: at91: Document new TCB bindings Rob Herring <robh@kernel.org> - 2016-06-21 22:10 +0200
Re: [PATCH 02/48] ARM: at91: Document new TCB bindings Rob Herring <robh@kernel.org> - 2016-06-21 22:50 +0200
[PATCH 11/48] ARM: dts: at91: at91sam9g20ek: use TCB0 as clocksource Alexandre Belloni <alexandre.belloni@free-electrons.com> - 2016-06-11 00:20 +0200
[PATCH 23/48] ARM: dts: at91: at91sam9n12: TC blocks are also simple-mfd and syscon devices Alexandre Belloni <alexandre.belloni@free-electrons.com> - 2016-06-11 00:20 +0200
[PATCH 26/48] ARM: dts: at91: at91sam9x5cm: use TCB0 as clocksource Alexandre Belloni <alexandre.belloni@free-electrons.com> - 2016-06-11 00:20 +0200
[PATCH 22/48] ARM: dts: at91: at91sam9rlek: use TCB0 as clocksource Alexandre Belloni <alexandre.belloni@free-electrons.com> - 2016-06-11 00:20 +0200
[PATCH 06/48] ARM: dts: at91: at91sam9260: TC blocks are also simple-mfd and syscon devices Alexandre Belloni <alexandre.belloni@free-electrons.com> - 2016-06-11 00:20 +0200
[PATCH 14/48] ARM: dts: at91: at91sam9261ek: use TCB0 as clocksource Alexandre Belloni <alexandre.belloni@free-electrons.com> - 2016-06-11 00:20 +0200
[PATCH 28/48] ARM: dts: at91: cosino: use TCB0 as clocksource Alexandre Belloni <alexandre.belloni@free-electrons.com> - 2016-06-11 00:20 +0200
[PATCH 29/48] ARM: dts: at91: kizboxmini: use TCB0 as clocksource Alexandre Belloni <alexandre.belloni@free-electrons.com> - 2016-06-11 00:20 +0200
[PATCH 24/48] ARM: dts: at91: at91sam9n12ek: use TCB0 as clocksource Alexandre Belloni <alexandre.belloni@free-electrons.com> - 2016-06-11 00:20 +0200
[PATCH 08/48] ARM: dts: at91: foxg20: use TCB0 as clocksource Alexandre Belloni <alexandre.belloni@free-electrons.com> - 2016-06-11 00:20 +0200
[PATCH 20/48] ARM: dts: at91: pm9g45: use TCB0 as clocksource Alexandre Belloni <alexandre.belloni@free-electrons.com> - 2016-06-11 00:20 +0200
Page 1 of 2 [1] 2 Next page →
| From | Alexandre Belloni <alexandre.belloni@free-electrons.com> |
|---|---|
| Date | 2016-06-11 00:20 +0200 |
| Subject | [PATCH 00/48] ARM: at91: rework Atmel TCB drivers |
| Message-ID | <rICMO-2IE-7@gated-at.bofh.it> |
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
[toc] | [next] | [standalone]
| From | Alexandre Belloni <alexandre.belloni@free-electrons.com> |
|---|---|
| Date | 2016-06-11 00:20 +0200 |
| Subject | [PATCH 01/48] clk: at91: replace usleep() by udelay() calls |
| Message-ID | <rICWu-2P1-31@gated-at.bofh.it> |
| In reply to | #1419797 |
From: Cyrille Pitchen <cyrille.pitchen@atmel.com> Fix the main and slow clock .prepare() implementations which used to call usleep() when the scheduler wasn't ready yet. Cc: Stephen Boyd <sboyd@codeaurora.org> Cc: linux-clk@vger.kernel.org Signed-off-by: Cyrille Pitchen <cyrille.pitchen@atmel.com> Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com> --- drivers/clk/at91/clk-main.c | 2 +- drivers/clk/at91/clk-slow.c | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/clk/at91/clk-main.c b/drivers/clk/at91/clk-main.c index 58b5baca670c..12c5062aeb92 100644 --- a/drivers/clk/at91/clk-main.c +++ b/drivers/clk/at91/clk-main.c @@ -342,7 +342,7 @@ static int clk_main_probe_frequency(struct regmap *regmap) regmap_read(regmap, AT91_CKGR_MCFR, &mcfr); if (mcfr & AT91_PMC_MAINRDY) return 0; - usleep_range(MAINF_LOOP_MIN_WAIT, MAINF_LOOP_MAX_WAIT); + udelay(MAINF_LOOP_MIN_WAIT); } while (time_before(prep_time, timeout)); return -ETIMEDOUT; diff --git a/drivers/clk/at91/clk-slow.c b/drivers/clk/at91/clk-slow.c index 61090b1146cf..612e893ce994 100644 --- a/drivers/clk/at91/clk-slow.c +++ b/drivers/clk/at91/clk-slow.c @@ -76,7 +76,7 @@ static int clk_slow_osc_prepare(struct clk_hw *hw) writel(tmp | AT91_SCKC_OSC32EN, sckcr); - usleep_range(osc->startup_usec, osc->startup_usec + 1); + udelay(osc->startup_usec); return 0; } @@ -195,7 +195,7 @@ static int clk_slow_rc_osc_prepare(struct clk_hw *hw) writel(readl(sckcr) | AT91_SCKC_RCEN, sckcr); - usleep_range(osc->startup_usec, osc->startup_usec + 1); + udelay(osc->startup_usec); return 0; } @@ -304,7 +304,7 @@ static int clk_sam9x5_slow_set_parent(struct clk_hw *hw, u8 index) writel(tmp, sckcr); - usleep_range(SLOWCK_SW_TIME_USEC, SLOWCK_SW_TIME_USEC + 1); + udelay(SLOWCK_SW_TIME_USEC); return 0; } -- 2.8.1
[toc] | [prev] | [next] | [standalone]
| From | Arnd Bergmann <arnd@arndb.de> |
|---|---|
| Date | 2016-06-11 00:40 +0200 |
| Subject | Re: [PATCH 01/48] clk: at91: replace usleep() by udelay() calls |
| Message-ID | <rIDfQ-2Za-3@gated-at.bofh.it> |
| In reply to | #1419798 |
On Saturday, June 11, 2016 12:03:04 AM CEST Alexandre Belloni wrote: > From: Cyrille Pitchen <cyrille.pitchen@atmel.com> > > Fix the main and slow clock .prepare() implementations which used to call > usleep() when the scheduler wasn't ready yet. > Does this have to be called that early? It seems wasteful to always call udelay() here, when these are functions that are normally allowed to sleep. Arnd
[toc] | [prev] | [next] | [standalone]
| From | Alexandre Belloni <alexandre.belloni@free-electrons.com> |
|---|---|
| Date | 2016-06-11 00:40 +0200 |
| Subject | Re: [PATCH 01/48] clk: at91: replace usleep() by udelay() calls |
| Message-ID | <rIDfQ-2Za-9@gated-at.bofh.it> |
| In reply to | #1419823 |
On 11/06/2016 at 00:30:36 +0200, Arnd Bergmann wrote : > On Saturday, June 11, 2016 12:03:04 AM CEST Alexandre Belloni wrote: > > From: Cyrille Pitchen <cyrille.pitchen@atmel.com> > > > > Fix the main and slow clock .prepare() implementations which used to call > > usleep() when the scheduler wasn't ready yet. > > > > Does this have to be called that early? It seems wasteful to always > call udelay() here, when these are functions that are normally > allowed to sleep. > Well, the main issue here is that we want to be able to prepare_enable the slow clock before we are allowed to sleep. Thinking about it when writing that, I realize that when I reworked my series, I removed the dependency between the clocksource TCB and the slow_clock. But I guess we still have one on the main clock. I'll check whether this is still necessary. -- Alexandre Belloni, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com
[toc] | [prev] | [next] | [standalone]
| From | Alexandre Belloni <alexandre.belloni@free-electrons.com> |
|---|---|
| Date | 2016-06-13 17:30 +0200 |
| Subject | Re: [PATCH 01/48] clk: at91: replace usleep() by udelay() calls |
| Message-ID | <rJBYn-86X-35@gated-at.bofh.it> |
| In reply to | #1419823 |
On 11/06/2016 at 00:30:36 +0200, Arnd Bergmann wrote : > On Saturday, June 11, 2016 12:03:04 AM CEST Alexandre Belloni wrote: > > From: Cyrille Pitchen <cyrille.pitchen@atmel.com> > > > > Fix the main and slow clock .prepare() implementations which used to call > > usleep() when the scheduler wasn't ready yet. > > > > Does this have to be called that early? It seems wasteful to always > call udelay() here, when these are functions that are normally > allowed to sleep. > So I've tested it and something like that would work: if (system_state < SYSTEM_RUNNING) udelay(osc->startup_usec); else usleep_range(osc->startup_usec, osc->startup_usec + 1); But I'm afraid it would be the first driver to actually do something like that (however, it is already the only driver trying to sleep). -- Alexandre Belloni, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com
[toc] | [prev] | [next] | [standalone]
| From | Arnd Bergmann <arnd@arndb.de> |
|---|---|
| Date | 2016-06-13 21:30 +0200 |
| Subject | Re: [PATCH 01/48] clk: at91: replace usleep() by udelay() calls |
| Message-ID | <rJFIB-2aM-5@gated-at.bofh.it> |
| In reply to | #1420999 |
On Monday, June 13, 2016 5:24:09 PM CEST Alexandre Belloni wrote: > On 11/06/2016 at 00:30:36 +0200, Arnd Bergmann wrote : > > On Saturday, June 11, 2016 12:03:04 AM CEST Alexandre Belloni wrote: > > > From: Cyrille Pitchen <cyrille.pitchen@atmel.com> > > > > > > Fix the main and slow clock .prepare() implementations which used to call > > > usleep() when the scheduler wasn't ready yet. > > > > > > > Does this have to be called that early? It seems wasteful to always > > call udelay() here, when these are functions that are normally > > allowed to sleep. > > > > So I've tested it and something like that would work: > > if (system_state < SYSTEM_RUNNING) > udelay(osc->startup_usec); > else > usleep_range(osc->startup_usec, osc->startup_usec + 1); I think that's reasonable in this case. > But I'm afraid it would be the first driver to actually do something > like that (however, it is already the only driver trying to sleep). We have a lot of drivers that call potentially sleeping function from the .prepare callback, e.g. when they go to an i2c controller. Arnd
[toc] | [prev] | [next] | [standalone]
| From | Afzal Mohammed <afzal.mohd.ma@gmail.com> |
|---|---|
| Date | 2016-06-14 18:10 +0200 |
| Subject | Re: [PATCH 01/48] clk: at91: replace usleep() by udelay() calls |
| Message-ID | <rJZ4C-79l-19@gated-at.bofh.it> |
| In reply to | #1420999 |
Hi, On Mon, Jun 13, 2016 at 05:24:09PM +0200, Alexandre Belloni wrote: > On 11/06/2016 at 00:30:36 +0200, Arnd Bergmann wrote : > > Does this have to be called that early? It seems wasteful to always > > call udelay() here, when these are functions that are normally > > allowed to sleep. > So I've tested it and something like that would work: > > if (system_state < SYSTEM_RUNNING) > udelay(osc->startup_usec); > else > usleep_range(osc->startup_usec, osc->startup_usec + 1); > > But I'm afraid it would be the first driver to actually do something > like that (however, it is already the only driver trying to sleep). tglx has suggested to modify clock core to handle a somewhat similar kind of scenario (probably should work here too) and avoid driver changes, http://lkml.kernel.org/r/alpine.DEB.2.11.1606061448010.28031@nanos Regards afzal
[toc] | [prev] | [next] | [standalone]
| From | Boris Brezillon <boris.brezillon@free-electrons.com> |
|---|---|
| Date | 2016-06-14 18:20 +0200 |
| Subject | Re: [PATCH 01/48] clk: at91: replace usleep() by udelay() calls |
| Message-ID | <rJZeh-7cH-15@gated-at.bofh.it> |
| In reply to | #1422052 |
On Tue, 14 Jun 2016 21:35:17 +0530 Afzal Mohammed <afzal.mohd.ma@gmail.com> wrote: > Hi, > > On Mon, Jun 13, 2016 at 05:24:09PM +0200, Alexandre Belloni wrote: > > On 11/06/2016 at 00:30:36 +0200, Arnd Bergmann wrote : > > > > Does this have to be called that early? It seems wasteful to always > > > call udelay() here, when these are functions that are normally > > > allowed to sleep. > > > So I've tested it and something like that would work: > > > > if (system_state < SYSTEM_RUNNING) > > udelay(osc->startup_usec); > > else > > usleep_range(osc->startup_usec, osc->startup_usec + 1); > > > > But I'm afraid it would be the first driver to actually do something > > like that (however, it is already the only driver trying to sleep). > > tglx has suggested to modify clock core to handle a somewhat similar > kind of scenario (probably should work here too) and avoid driver > changes, > > http://lkml.kernel.org/r/alpine.DEB.2.11.1606061448010.28031@nanos Oh, interesting. Definitely a better solution than this custom check. -- Boris Brezillon, Free Electrons Embedded Linux and Kernel engineering http://free-electrons.com
[toc] | [prev] | [next] | [standalone]
| From | Boris Brezillon <boris.brezillon@free-electrons.com> |
|---|---|
| Date | 2016-06-11 10:00 +0200 |
| Subject | Re: [PATCH 01/48] clk: at91: replace usleep() by udelay() calls |
| Message-ID | <rILZL-en-1@gated-at.bofh.it> |
| In reply to | #1419798 |
On Sat, 11 Jun 2016 00:03:04 +0200 Alexandre Belloni <alexandre.belloni@free-electrons.com> wrote: > From: Cyrille Pitchen <cyrille.pitchen@atmel.com> > > Fix the main and slow clock .prepare() implementations which used to call > usleep() when the scheduler wasn't ready yet. > > Cc: Stephen Boyd <sboyd@codeaurora.org> > Cc: linux-clk@vger.kernel.org > Signed-off-by: Cyrille Pitchen <cyrille.pitchen@atmel.com> > Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com> > --- > drivers/clk/at91/clk-main.c | 2 +- > drivers/clk/at91/clk-slow.c | 6 +++--- > 2 files changed, 4 insertions(+), 4 deletions(-) > > diff --git a/drivers/clk/at91/clk-main.c b/drivers/clk/at91/clk-main.c > index 58b5baca670c..12c5062aeb92 100644 > --- a/drivers/clk/at91/clk-main.c > +++ b/drivers/clk/at91/clk-main.c > @@ -342,7 +342,7 @@ static int clk_main_probe_frequency(struct regmap *regmap) > regmap_read(regmap, AT91_CKGR_MCFR, &mcfr); > if (mcfr & AT91_PMC_MAINRDY) > return 0; > - usleep_range(MAINF_LOOP_MIN_WAIT, MAINF_LOOP_MAX_WAIT); > + udelay(MAINF_LOOP_MIN_WAIT); > } while (time_before(prep_time, timeout)); > > return -ETIMEDOUT; > diff --git a/drivers/clk/at91/clk-slow.c b/drivers/clk/at91/clk-slow.c > index 61090b1146cf..612e893ce994 100644 > --- a/drivers/clk/at91/clk-slow.c > +++ b/drivers/clk/at91/clk-slow.c > @@ -76,7 +76,7 @@ static int clk_slow_osc_prepare(struct clk_hw *hw) > > writel(tmp | AT91_SCKC_OSC32EN, sckcr); > > - usleep_range(osc->startup_usec, osc->startup_usec + 1); > + udelay(osc->startup_usec); If you're using udelay() you should probably move the code in ->prepare() into ->enable(). The same goes for the following changes. > > return 0; > } > @@ -195,7 +195,7 @@ static int clk_slow_rc_osc_prepare(struct clk_hw *hw) > > writel(readl(sckcr) | AT91_SCKC_RCEN, sckcr); > > - usleep_range(osc->startup_usec, osc->startup_usec + 1); > + udelay(osc->startup_usec); > > return 0; > } > @@ -304,7 +304,7 @@ static int clk_sam9x5_slow_set_parent(struct clk_hw *hw, u8 index) > > writel(tmp, sckcr); > > - usleep_range(SLOWCK_SW_TIME_USEC, SLOWCK_SW_TIME_USEC + 1); > + udelay(SLOWCK_SW_TIME_USEC); > > return 0; > } -- Boris Brezillon, Free Electrons Embedded Linux and Kernel engineering http://free-electrons.com
[toc] | [prev] | [next] | [standalone]
| From | Alexandre Belloni <alexandre.belloni@free-electrons.com> |
|---|---|
| Date | 2016-06-11 00:20 +0200 |
| Subject | [PATCH 07/48] ARM: dts: at91: ethernut5: use TCB0 as clocksource |
| Message-ID | <rICWu-2P1-35@gated-at.bofh.it> |
| In reply to | #1419797 |
Use tcb0 as the clocksource like previously selected in at91_dt_defconfig.
Cc: Martin Reimann <martin.reimann@egnite.de>
Cc: Tim Schendekehl <tim.schendekehl@egnite.de>
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
---
arch/arm/boot/dts/ethernut5.dts | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/arch/arm/boot/dts/ethernut5.dts b/arch/arm/boot/dts/ethernut5.dts
index 243044343ee8..26ce9ee46c05 100644
--- a/arch/arm/boot/dts/ethernut5.dts
+++ b/arch/arm/boot/dts/ethernut5.dts
@@ -36,6 +36,18 @@
status = "okay";
};
+ tcb0: timer@fffa0000 {
+ timer@0 {
+ compatible = "atmel,tcb-clksrc";
+ reg = <0>, <1>;
+ };
+
+ timer@2 {
+ compatible = "atmel,tcb-clkevt";
+ reg = <2>;
+ };
+ };
+
usart0: serial@fffb0000 {
status = "okay";
};
--
2.8.1
[toc] | [prev] | [next] | [standalone]
| From | Alexandre Belloni <alexandre.belloni@free-electrons.com> |
|---|---|
| Date | 2016-06-11 00:20 +0200 |
| Subject | [PATCH 02/48] ARM: at91: Document new TCB bindings |
| Message-ID | <rICWu-2P1-45@gated-at.bofh.it> |
| In reply to | #1419797 |
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
[toc] | [prev] | [next] | [standalone]
| From | Rob Herring <robh@kernel.org> |
|---|---|
| Date | 2016-06-14 23:50 +0200 |
| Subject | Re: [PATCH 02/48] ARM: at91: Document new TCB bindings |
| Message-ID | <rK4nD-20k-1@gated-at.bofh.it> |
| In reply to | #1419800 |
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
>
[toc] | [prev] | [next] | [standalone]
| From | Boris Brezillon <boris.brezillon@free-electrons.com> |
|---|---|
| Date | 2016-06-15 09:40 +0200 |
| Subject | Re: [PATCH 02/48] ARM: at91: Document new TCB bindings |
| Message-ID | <rKdAD-80i-63@gated-at.bofh.it> |
| In reply to | #1422364 |
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
[toc] | [prev] | [next] | [standalone]
| From | Rob Herring <robh@kernel.org> |
|---|---|
| Date | 2016-06-21 22:10 +0200 |
| Subject | Re: [PATCH 02/48] ARM: at91: Document new TCB bindings |
| Message-ID | <rMA9H-22L-13@gated-at.bofh.it> |
| In reply to | #1422708 |
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/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
[toc] | [prev] | [next] | [standalone]
| From | Rob Herring <robh@kernel.org> |
|---|---|
| Date | 2016-06-21 22:50 +0200 |
| Subject | Re: [PATCH 02/48] ARM: at91: Document new TCB bindings |
| Message-ID | <rMAMp-2gO-5@gated-at.bofh.it> |
| In reply to | #1422708 |
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
[toc] | [prev] | [next] | [standalone]
| From | Alexandre Belloni <alexandre.belloni@free-electrons.com> |
|---|---|
| Date | 2016-06-11 00:20 +0200 |
| Subject | [PATCH 11/48] ARM: dts: at91: at91sam9g20ek: use TCB0 as clocksource |
| Message-ID | <rICWu-2P1-33@gated-at.bofh.it> |
| In reply to | #1419797 |
Use tcb0 as the clocksource like previously selected in at91_dt_defconfig.
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
---
arch/arm/boot/dts/at91sam9g20ek_common.dtsi | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/arch/arm/boot/dts/at91sam9g20ek_common.dtsi b/arch/arm/boot/dts/at91sam9g20ek_common.dtsi
index e9cc99b6353a..e13018b4df01 100644
--- a/arch/arm/boot/dts/at91sam9g20ek_common.dtsi
+++ b/arch/arm/boot/dts/at91sam9g20ek_common.dtsi
@@ -51,6 +51,18 @@
status = "okay";
};
+ tcb0: timer@fffa0000 {
+ timer@0 {
+ compatible = "atmel,tcb-clksrc";
+ reg = <0>, <1>;
+ };
+
+ timer@2 {
+ compatible = "atmel,tcb-clkevt";
+ reg = <2>;
+ };
+ };
+
usart0: serial@fffb0000 {
pinctrl-0 =
<&pinctrl_usart0
--
2.8.1
[toc] | [prev] | [next] | [standalone]
| From | Alexandre Belloni <alexandre.belloni@free-electrons.com> |
|---|---|
| Date | 2016-06-11 00:20 +0200 |
| Subject | [PATCH 23/48] ARM: dts: at91: at91sam9n12: TC blocks are also simple-mfd and syscon devices |
| Message-ID | <rICWu-2P1-43@gated-at.bofh.it> |
| In reply to | #1419797 |
Add simple-mfd and syscon to the TC blocks to allow to register one of the
channels as clocksource properly at boot time. It also allows to use regmap
instead of tclib.
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
---
arch/arm/boot/dts/at91sam9n12.dtsi | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/arch/arm/boot/dts/at91sam9n12.dtsi b/arch/arm/boot/dts/at91sam9n12.dtsi
index 95569a87b6c9..1f26cb66238e 100644
--- a/arch/arm/boot/dts/at91sam9n12.dtsi
+++ b/arch/arm/boot/dts/at91sam9n12.dtsi
@@ -430,7 +430,9 @@
};
tcb0: timer@f8008000 {
- compatible = "atmel,at91sam9x5-tcb";
+ compatible = "atmel,at91sam9x5-tcb", "simple-mfd", "syscon";
+ #address-cells = <1>;
+ #size-cells = <0>;
reg = <0xf8008000 0x100>;
interrupts = <17 IRQ_TYPE_LEVEL_HIGH 0>;
clocks = <&tcb_clk>, <&clk32k>;
@@ -438,7 +440,9 @@
};
tcb1: timer@f800c000 {
- compatible = "atmel,at91sam9x5-tcb";
+ compatible = "atmel,at91sam9x5-tcb", "simple-mfd", "syscon";
+ #address-cells = <1>;
+ #size-cells = <0>;
reg = <0xf800c000 0x100>;
interrupts = <17 IRQ_TYPE_LEVEL_HIGH 0>;
clocks = <&tcb_clk>, <&clk32k>;
--
2.8.1
[toc] | [prev] | [next] | [standalone]
| From | Alexandre Belloni <alexandre.belloni@free-electrons.com> |
|---|---|
| Date | 2016-06-11 00:20 +0200 |
| Subject | [PATCH 26/48] ARM: dts: at91: at91sam9x5cm: use TCB0 as clocksource |
| Message-ID | <rICWu-2P1-47@gated-at.bofh.it> |
| In reply to | #1419797 |
Use tcb0 as the clocksource like previously selected in at91_dt_defconfig.
[tested on at91sam9x25ek and at91sam9x35ek]
Tested-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
---
arch/arm/boot/dts/at91sam9x5cm.dtsi | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/arch/arm/boot/dts/at91sam9x5cm.dtsi b/arch/arm/boot/dts/at91sam9x5cm.dtsi
index b098ad8cd93a..40676cc9b172 100644
--- a/arch/arm/boot/dts/at91sam9x5cm.dtsi
+++ b/arch/arm/boot/dts/at91sam9x5cm.dtsi
@@ -24,6 +24,18 @@
ahb {
apb {
+ tcb0: timer@f8008000 {
+ timer@0 {
+ compatible = "atmel,tcb-clksrc";
+ reg = <0>;
+ };
+
+ timer@1 {
+ compatible = "atmel,tcb-clkevt";
+ reg = <1>;
+ };
+ };
+
pinctrl@fffff400 {
1wire_cm {
pinctrl_1wire_cm: 1wire_cm-0 {
--
2.8.1
[toc] | [prev] | [next] | [standalone]
| From | Alexandre Belloni <alexandre.belloni@free-electrons.com> |
|---|---|
| Date | 2016-06-11 00:20 +0200 |
| Subject | [PATCH 22/48] ARM: dts: at91: at91sam9rlek: use TCB0 as clocksource |
| Message-ID | <rICWv-2P1-57@gated-at.bofh.it> |
| In reply to | #1419797 |
Use tcb0 as the clocksource like previously selected in at91_dt_defconfig.
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
---
arch/arm/boot/dts/at91sam9rlek.dts | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/arch/arm/boot/dts/at91sam9rlek.dts b/arch/arm/boot/dts/at91sam9rlek.dts
index f10566f759cd..cc0b6b19c5bf 100644
--- a/arch/arm/boot/dts/at91sam9rlek.dts
+++ b/arch/arm/boot/dts/at91sam9rlek.dts
@@ -101,6 +101,18 @@
};
apb {
+ tcb0: timer@fffa0000 {
+ timer@0 {
+ compatible = "atmel,tcb-clksrc";
+ reg = <0>, <1>;
+ };
+
+ timer@2 {
+ compatible = "atmel,tcb-clkevt";
+ reg = <2>;
+ };
+ };
+
mmc0: mmc@fffa4000 {
pinctrl-0 = <
&pinctrl_board_mmc0
--
2.8.1
[toc] | [prev] | [next] | [standalone]
| From | Alexandre Belloni <alexandre.belloni@free-electrons.com> |
|---|---|
| Date | 2016-06-11 00:20 +0200 |
| Subject | [PATCH 06/48] ARM: dts: at91: at91sam9260: TC blocks are also simple-mfd and syscon devices |
| Message-ID | <rICWu-2P1-49@gated-at.bofh.it> |
| In reply to | #1419797 |
Add simple-mfd and syscon to the TC blocks to allow to register one of the
channels as clocksource properly at boot time. It also allows to use
regmap instead of tclib.
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
---
arch/arm/boot/dts/at91sam9260.dtsi | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/arch/arm/boot/dts/at91sam9260.dtsi b/arch/arm/boot/dts/at91sam9260.dtsi
index d4884dd1c243..7b2aa604a924 100644
--- a/arch/arm/boot/dts/at91sam9260.dtsi
+++ b/arch/arm/boot/dts/at91sam9260.dtsi
@@ -376,7 +376,9 @@
};
tcb0: timer@fffa0000 {
- compatible = "atmel,at91rm9200-tcb";
+ compatible = "atmel,at91rm9200-tcb", "simple-mfd", "syscon";
+ #address-cells = <1>;
+ #size-cells = <0>;
reg = <0xfffa0000 0x100>;
interrupts = <17 IRQ_TYPE_LEVEL_HIGH 0
18 IRQ_TYPE_LEVEL_HIGH 0
@@ -386,7 +388,9 @@
};
tcb1: timer@fffdc000 {
- compatible = "atmel,at91rm9200-tcb";
+ compatible = "atmel,at91rm9200-tcb", "simple-mfd", "syscon";
+ #address-cells = <1>;
+ #size-cells = <0>;
reg = <0xfffdc000 0x100>;
interrupts = <26 IRQ_TYPE_LEVEL_HIGH 0
27 IRQ_TYPE_LEVEL_HIGH 0
--
2.8.1
[toc] | [prev] | [next] | [standalone]
Page 1 of 2 [1] 2 Next page →
Back to top | Article view | linux.kernel
csiph-web