mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Daniel Lezcano <daniel.lezcano@linaro.org>
To: Dong Aisheng <aisheng.dong@nxp.com>, linux-kernel@vger.kernel.org
Cc: linux-arm-kernel@lists.infradead.org, tglx@linutronix.de,
	shawnguo@kernel.org, ping.bai@nxp.com, anson.huang@nxp.com,
	dongas86@gmail.com, kernel@pengutronix.de,
	Arnd Bergmann <arnd@arndb.de>
Subject: Re: [PATCH V4 2/2] timer: imx-tpm: add imx tpm timer support
Date: Mon, 31 Jul 2017 16:29:13 +0200	[thread overview]
Message-ID: <d10c57c3-3174-3dbf-c784-ef1ff94cb06e@linaro.org> (raw)
In-Reply-To: <1499222112-9988-3-git-send-email-aisheng.dong@nxp.com>

On 05/07/2017 04:35, Dong Aisheng wrote:
> IMX Timer/PWM Module (TPM) supports both timer and pwm function while
> this patch only adds the timer support. PWM would be added later.
> 
> The TPM counter, compare and capture registers are clocked by an
> asynchronous clock that can remain enabled in low power modes.
> 
> NOTE: We observed in a very small probability, the bus fabric
> contention between GPU and A7 may results a few cycles delay
> of writing CNT registers which may cause the min_delta event got
> missed, so we need add a ETIME check here in case it happened.
> 
> Cc: Daniel Lezcano <daniel.lezcano@linaro.org>
> Cc: Arnd Bergmann <arnd@arndb.de>
> Cc: Thomas Gleixner <tglx@linutronix.de>
> Cc: Shawn Guo <shawnguo@kernel.org>
> Cc: Anson Huang <Anson.Huang@nxp.com>
> Cc: Bai Ping <ping.bai@nxp.com>
> Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
> 
> ---
> ChangeLog:
> v3->v4: 
>  * also add ETIME explanation in function
> v2->v3:
>  * address all comments from Daniel Lezcano
>  * add more explaination on ETIME check in commit message
> v1->v2:
>  * change to readl/writel from __raw_readl/writel according to Arnd's
>    suggestion to avoid endian issue
>  * add help information in Kconfig
>  * add more error checking
> ---
>  drivers/clocksource/Kconfig         |   8 ++
>  drivers/clocksource/Makefile        |   1 +
>  drivers/clocksource/timer-imx-tpm.c | 239 ++++++++++++++++++++++++++++++++++++
>  3 files changed, 248 insertions(+)
>  create mode 100644 drivers/clocksource/timer-imx-tpm.c

[ ... ]

> +static struct irqaction tpm_timer_irq = {
> +	.name		= "i.MX7ULP TPM Timer",
> +	.flags		= IRQF_TIMER | IRQF_IRQPOLL,
> +	.handler	= tpm_timer_interrupt,
> +	.dev_id		= &clockevent_tpm,
> +};
>

Please remove the structure above and use request_irq instead of
setup_irq below + return code checking.

> +static int __init tpm_clockevent_init(unsigned long rate, int irq)
> +{
> +	setup_irq(irq, &tpm_timer_irq);
> +
> +	clockevent_tpm.cpumask = cpumask_of(0);
> +	clockevent_tpm.irq = irq;
> +	clockevents_config_and_register(&clockevent_tpm,
> +					rate, 300, 0xfffffffe);
> +
> +	return 0;
> +}
> +
> +static int __init tpm_timer_init(struct device_node *np)
> +{

[ ... ]

> +	rate = clk_get_rate(per) >> 3;

Why ?

> +	tpm_clocksource_init(rate);
> +	tpm_clockevent_init(rate, irq);

Check.

> +	return 0;
> +
> +err_per_clk_enable:
> +	clk_disable_unprepare(ipg);
> +err_ipg_clk_enable:

No need to add an extra label.

> +err_clk_get:
> +	clk_put(per);
> +	clk_put(ipg);
> +err_iomap:
> +	iounmap(timer_base);
> +	return ret;
> +}
> +CLOCKSOURCE_OF_DECLARE(imx7ulp, "fsl,imx7ulp-tpm", tpm_timer_init);

CLOCKSOURCE_OF_DECLARE is renamed to TIMER_OF_DECLARE.

Thanks!

  -- Daniel


-- 
 <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-07-31 14:29 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-05  2:35 [PATCH V4 0/2] timer: " Dong Aisheng
2017-07-05  2:35 ` [PATCH V4 1/2] dt-bindings: timer: add nxp tpm timer binding doc Dong Aisheng
2017-07-05  2:35 ` [PATCH V4 2/2] timer: imx-tpm: add imx tpm timer support Dong Aisheng
2017-07-31 14:29   ` Daniel Lezcano [this message]
2017-08-01  3:33     ` A.s. Dong
2017-07-05  8:23 ` [PATCH V4 0/2] timer: " Jonathan Cameron
2017-07-05  8:48   ` A.s. Dong
2017-07-20  9:59 ` A.s. Dong

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=d10c57c3-3174-3dbf-c784-ef1ff94cb06e@linaro.org \
    --to=daniel.lezcano@linaro.org \
    --cc=aisheng.dong@nxp.com \
    --cc=anson.huang@nxp.com \
    --cc=arnd@arndb.de \
    --cc=dongas86@gmail.com \
    --cc=kernel@pengutronix.de \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ping.bai@nxp.com \
    --cc=shawnguo@kernel.org \
    --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

all inboxes | Powered by JetHome®