linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Daniel Lezcano <daniel.lezcano@linaro.org>
To: Alexandre Belloni <alexandre.belloni@free-electrons.com>
Cc: Nicolas Ferre <nicolas.ferre@atmel.com>,
	Boris Brezillon <boris.brezillon@free-electrons.com>,
	Jean-Christophe Plagniol-Villard <plagnioj@jcrosoft.com>,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org,
	Thomas Gleixner <tglx@linutronix.de>
Subject: Re: [PATCH 42/48] clocksource/drivers: Add a new driver for the Atmel ARM TC blocks
Date: Tue, 16 May 2017 16:25:04 +0200	[thread overview]
Message-ID: <d2485b56-52fa-6532-76cb-222f0c139566@linaro.org> (raw)
In-Reply-To: <20170516115916.ip3ea34bofg3jpuo@piout.net>

On 16/05/2017 13:59, Alexandre Belloni wrote:
> Hi Daniel,
> 
> Almost one year later, I'm back on that topic.
> 
> On 24/06/2016 at 12:07:01 +0200, Daniel Lezcano wrote:
>>> diff --git a/drivers/clocksource/Kconfig b/drivers/clocksource/Kconfig
>>> index 47352d25c15e..ff7f4022c749 100644
>>> --- a/drivers/clocksource/Kconfig
>>> +++ b/drivers/clocksource/Kconfig
>>> @@ -258,6 +258,19 @@ config ATMEL_ST
>>>   	select CLKSRC_OF
>>>   	select MFD_SYSCON
>>>
>>> +config ATMEL_ARM_TCB_CLKSRC
>>> +	bool "TC Block Clocksource"
>>
>> The Kconfig options are set now with the COMPILE_TEST option in order to
>> increase the compilation test coverage.
>>
>> Please, add bool "TC Block Clocksource" if COMPILE_TEST, ...
>>
>>> +	select REGMAP_MMIO
>>> +	depends on GENERIC_CLOCKEVENTS
>>> +	depends on SOC_AT91RM9200 || SOC_AT91SAM9 || SOC_SAMA5
>>> +	default SOC_AT91RM9200 || SOC_AT91SAM9 || SOC_SAMA5
>>
>> ... remove these dependencies and let the SoC's Kconfig to select the timer
>> like the other timers are.
>>
> 
> The main issue with what you suggest is that it removes the possibility
> to not compile the driver. This may be interesting for people using the
> PIT as the clocksource/clockevent and the TCBs for something else.

Is it really a problem? We tend as much as possible to make silent
options in order to let the platform config to select the right clock.


>>> +static cycle_t tc_get_cycles(struct clocksource *cs)
>>> +{
>>> +	unsigned long	flags;
>>> +	u32		lower, upper, tmp;
>>> +
>>> +	raw_local_irq_save(flags);
>>> +	do {
>>> +		regmap_read(tc.regmap, ATMEL_TC_CV(1), &upper);
>>> +		regmap_read(tc.regmap, ATMEL_TC_CV(0), &lower);
>>> +		regmap_read(tc.regmap, ATMEL_TC_CV(1), &tmp);
>>> +	} while (upper != tmp);
>>> +
>>> +	raw_local_irq_restore(flags);
>>
>> Why is this lock needed ?
>>
> 
> I've taken that from the old driver, I'm not sure this is needed. Maybe
> to lower the chance to have upper != tmp.
> 
>>> +	return (upper << 16) | lower;
>>> +}
>>> +

I don't think this is needed.

>>> +static int tcb_clkevt_oneshot(struct clock_event_device *dev)
>>> +{
>>> +	int ret;
>>> +
>>> +	if (tc.irq_requested)
>>> +		return 0;
>>> +
>>> +	ret = request_irq(tc.irq, tc_clkevt_irq, IRQF_TIMER | IRQF_SHARED,
>>> +			  "tcb_clkevt", &tc);
>>> +	if (!ret)
>>> +		tc.irq_requested = true;
>>
>> The legacy driver checks clockevent_state_detached() and disables the clock.
>>
> 
> This feature is different from the legacy driver. Here, the driver is
> using a single TCB channel for both clocksource and clockevent while the
> legacy driver always uses at least two channels.
> 
>> Why is 'irq_requested' and request_irq/free_irq cleaner ?
>>
>> Isn't there a configuration with the TCB register to disable the clockevent
>> only ?
>>
> 
> I'll try something cleaner anyway.

Ok.


-- 
 <http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs

Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog

  reply	other threads:[~2017-05-16 14:25 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
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 [this message]
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=d2485b56-52fa-6532-76cb-222f0c139566@linaro.org \
    --to=daniel.lezcano@linaro.org \
    --cc=alexandre.belloni@free-electrons.com \
    --cc=boris.brezillon@free-electrons.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nicolas.ferre@atmel.com \
    --cc=plagnioj@jcrosoft.com \
    --cc=tglx@linutronix.de \
    /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).