All of lore.kernel.org
 help / color / mirror / Atom feed
From: alexander.stein@systec-electronic.com (Alexander Stein)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH V2 2/2] timer: imx-tpm: add imx tpm timer support
Date: Tue, 13 Jun 2017 10:19:47 +0200	[thread overview]
Message-ID: <2318694.E4xdUbedMD@ws-stein> (raw)
In-Reply-To: <1497340725-26594-3-git-send-email-aisheng.dong@nxp.com>

On Tuesday 13 June 2017 15:58:45, Dong Aisheng wrote:
> diff --git a/drivers/clocksource/timer-imx-tpm.c
> b/drivers/clocksource/timer-imx-tpm.c new file mode 100644
> index 0000000..940a4f75
> --- /dev/null
> +++ b/drivers/clocksource/timer-imx-tpm.c
> @@ -0,0 +1,227 @@
> [...]
> +static int tpm_set_next_event(unsigned long delta,
> +				struct clock_event_device *evt)
> +{
> +	unsigned long next, now;
> +
> +	next = readl(timer_base + TPM_CNT) + delta;
> +	writel(next, timer_base + TPM_C0V);
> +	now = readl(timer_base + TPM_CNT);

What about:
> now = readl(timer_base + TPM_CNT);
> next = now + delta;
> writel(next, timer_base + TPM_C0V);
> return 0;

> +	return (int)((next - now) <= 0) ? -ETIME : 0;

Can this error actually happen, even with your implementation?

Best regards,
Alexander

WARNING: multiple messages have this Message-ID (diff)
From: Alexander Stein <alexander.stein@systec-electronic.com>
To: linux-kernel@vger.kernel.org
Cc: Dong Aisheng <aisheng.dong@nxp.com>,
	linux-arm-kernel@lists.infradead.org, daniel.lezcano@linaro.org,
	tglx@linutronix.de, shawnguo@kernel.org, ping.bai@nxp.com,
	anson.huang@nxp.com, dongas86@gmail.com, kernel@pengutronix.de,
	arnd@arndb.de, Anson Huang <Anson.Huang@nxp.com>
Subject: Re: [PATCH V2 2/2] timer: imx-tpm: add imx tpm timer support
Date: Tue, 13 Jun 2017 10:19:47 +0200	[thread overview]
Message-ID: <2318694.E4xdUbedMD@ws-stein> (raw)
In-Reply-To: <1497340725-26594-3-git-send-email-aisheng.dong@nxp.com>

On Tuesday 13 June 2017 15:58:45, Dong Aisheng wrote:
> diff --git a/drivers/clocksource/timer-imx-tpm.c
> b/drivers/clocksource/timer-imx-tpm.c new file mode 100644
> index 0000000..940a4f75
> --- /dev/null
> +++ b/drivers/clocksource/timer-imx-tpm.c
> @@ -0,0 +1,227 @@
> [...]
> +static int tpm_set_next_event(unsigned long delta,
> +				struct clock_event_device *evt)
> +{
> +	unsigned long next, now;
> +
> +	next = readl(timer_base + TPM_CNT) + delta;
> +	writel(next, timer_base + TPM_C0V);
> +	now = readl(timer_base + TPM_CNT);

What about:
> now = readl(timer_base + TPM_CNT);
> next = now + delta;
> writel(next, timer_base + TPM_C0V);
> return 0;

> +	return (int)((next - now) <= 0) ? -ETIME : 0;

Can this error actually happen, even with your implementation?

Best regards,
Alexander

  reply	other threads:[~2017-06-13  8:19 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-13  7:58 [PATCH V2 0/2] timer: add imx tpm timer support Dong Aisheng
2017-06-13  7:58 ` Dong Aisheng
2017-06-13  7:58 ` [PATCH V2 1/2] dt-bindings: timer: add nxp tpm timer binding doc Dong Aisheng
2017-06-13  7:58   ` Dong Aisheng
2017-06-13  7:58   ` Dong Aisheng
2017-06-13  7:58 ` [PATCH V2 2/2] timer: imx-tpm: add imx tpm timer support Dong Aisheng
2017-06-13  7:58   ` Dong Aisheng
2017-06-13  8:19   ` Alexander Stein [this message]
2017-06-13  8:19     ` Alexander Stein
2017-06-19 15:36     ` Dong Aisheng
2017-06-19 15:36       ` Dong Aisheng
2017-06-13 13:54   ` Daniel Lezcano
2017-06-13 13:54     ` Daniel Lezcano
2017-06-19 15:34     ` Dong Aisheng
2017-06-19 15:34       ` Dong Aisheng

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=2318694.E4xdUbedMD@ws-stein \
    --to=alexander.stein@systec-electronic.com \
    --cc=linux-arm-kernel@lists.infradead.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.