devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Daniel Lezcano <daniel.lezcano-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
To: Ezequiel Garcia
	<ezequiel.garcia-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org,
	linux-watchdog-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Cc: Lior Amsalem <alior-eYqpPyKDWXRBDgjK7y7TUQ@public.gmane.org>,
	Thomas Petazzoni
	<thomas.petazzoni-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>,
	Jason Cooper <jason-NLaQJdtUoK4Be96aLqz0jA@public.gmane.org>,
	Tawfik Bayouk <tawfik-eYqpPyKDWXRBDgjK7y7TUQ@public.gmane.org>,
	Andrew Lunn <andrew-g2DYL2Zd6BY@public.gmane.org>,
	Jason Gunthorpe
	<jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>,
	Wim Van Sebroeck <wim-IQzOog9fTRqzQB+pC5nmwQ@public.gmane.org>,
	Gregory Clement
	<gregory.clement-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>,
	Sebastian Hesselbarth
	<sebastian.hesselbarth-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Subject: Re: [PATCH v2 02/15] clocksource: orion: Use atomic access for shared registers
Date: Tue, 21 Jan 2014 10:57:37 +0100	[thread overview]
Message-ID: <52DE4491.2000505@linaro.org> (raw)
In-Reply-To: <1390295561-3466-3-git-send-email-ezequiel.garcia-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>

On 01/21/2014 10:12 AM, Ezequiel Garcia wrote:
> Replace the driver-specific thread-safe shared register API
> by the recently introduced atomic_io_clear_set().
>
> Signed-off-by: Ezequiel Garcia <ezequiel.garcia-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>

Hi Ezequiel,

in the future, put me in Cc when modifying files in clocksource that 
will make my life easier to track the changes.

Thanks.
   -- Daniel

> ---
>   drivers/clocksource/time-orion.c | 28 ++++++++++------------------
>   1 file changed, 10 insertions(+), 18 deletions(-)
>
> diff --git a/drivers/clocksource/time-orion.c b/drivers/clocksource/time-orion.c
> index 9c7f018..3f14e56 100644
> --- a/drivers/clocksource/time-orion.c
> +++ b/drivers/clocksource/time-orion.c
> @@ -35,20 +35,6 @@
>   #define ORION_ONESHOT_MAX	0xfffffffe
>
>   static void __iomem *timer_base;
> -static DEFINE_SPINLOCK(timer_ctrl_lock);
> -
> -/*
> - * Thread-safe access to TIMER_CTRL register
> - * (shared with watchdog timer)
> - */
> -void orion_timer_ctrl_clrset(u32 clr, u32 set)
> -{
> -	spin_lock(&timer_ctrl_lock);
> -	writel((readl(timer_base + TIMER_CTRL) & ~clr) | set,
> -		timer_base + TIMER_CTRL);
> -	spin_unlock(&timer_ctrl_lock);
> -}
> -EXPORT_SYMBOL(orion_timer_ctrl_clrset);
>   /*
>    * Free-running clocksource handling.
> @@ -68,7 +54,8 @@ static int orion_clkevt_next_event(unsigned long delta,
>   {
>   	/* setup and enable one-shot timer */
>   	writel(delta, timer_base + TIMER1_VAL);
> -	orion_timer_ctrl_clrset(TIMER1_RELOAD_EN, TIMER1_EN);
> +	atomic_io_modify(timer_base + TIMER_CTRL,
> +		TIMER1_RELOAD_EN | TIMER1_EN, TIMER1_EN);

I am not convinced this change is worth.

Could you elaborate the race the spinlock should prevent ?

>
>   	return 0;
>   }
> @@ -80,10 +67,13 @@ static void orion_clkevt_mode(enum clock_event_mode mode,
>   		/* setup and enable periodic timer at 1/HZ intervals */
>   		writel(ticks_per_jiffy - 1, timer_base + TIMER1_RELOAD);
>   		writel(ticks_per_jiffy - 1, timer_base + TIMER1_VAL);
> -		orion_timer_ctrl_clrset(0, TIMER1_RELOAD_EN | TIMER1_EN);
> +		atomic_io_modify(timer_base + TIMER_CTRL,
> +			TIMER1_RELOAD_EN | TIMER1_EN,
> +			TIMER1_RELOAD_EN | TIMER1_EN);
>   	} else {
>   		/* disable timer */
> -		orion_timer_ctrl_clrset(TIMER1_RELOAD_EN | TIMER1_EN, 0);
> +		atomic_io_modify(timer_base + TIMER_CTRL,
> +			TIMER1_RELOAD_EN | TIMER1_EN, 0);
>   	}
>   }
>
> @@ -131,7 +121,9 @@ static void __init orion_timer_init(struct device_node *np)
>   	/* setup timer0 as free-running clocksource */
>   	writel(~0, timer_base + TIMER0_VAL);
>   	writel(~0, timer_base + TIMER0_RELOAD);
> -	orion_timer_ctrl_clrset(0, TIMER0_RELOAD_EN | TIMER0_EN);
> +	atomic_io_modify(timer_base + TIMER_CTRL,
> +		TIMER0_RELOAD_EN | TIMER0_EN,
> +		TIMER0_RELOAD_EN | TIMER0_EN);
>   	clocksource_mmio_init(timer_base + TIMER0_VAL, "orion_clocksource",
>   			      clk_get_rate(clk), 300, 32,
>   			      clocksource_mmio_readl_down);
>


-- 
  <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

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  parent reply	other threads:[~2014-01-21  9:57 UTC|newest]

Thread overview: 64+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-21  9:12 [PATCH v2 00/15] Armada 370/XP watchdog support Ezequiel Garcia
     [not found] ` <1390295561-3466-1-git-send-email-ezequiel.garcia-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
2014-01-21  9:12   ` [PATCH v2 01/15] ARM: Introduce atomic MMIO modify Ezequiel Garcia
2014-01-21  9:45     ` Arnd Bergmann
2014-01-21 10:46       ` Ezequiel Garcia
2014-01-21  9:12   ` [PATCH v2 02/15] clocksource: orion: Use atomic access for shared registers Ezequiel Garcia
     [not found]     ` <1390295561-3466-3-git-send-email-ezequiel.garcia-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
2014-01-21  9:46       ` Arnd Bergmann
2014-01-21  9:58         ` Sebastian Hesselbarth
     [not found]           ` <52DE44B9.70308-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2014-01-21 10:54             ` Arnd Bergmann
2014-01-21 11:02               ` Andrew Lunn
2014-01-21  9:57       ` Daniel Lezcano [this message]
     [not found]         ` <52DE4491.2000505-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2014-01-21 10:53           ` Ezequiel Garcia
2014-01-21  9:12   ` [PATCH v2 03/15] watchdog: " Ezequiel Garcia
     [not found]     ` <1390295561-3466-4-git-send-email-ezequiel.garcia-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
2014-01-21  9:19       ` Fabio Estevam
     [not found]         ` <CAOMZO5BKjpkjQGOOAQ5fwmxhg1SYTmTq4Y9tUCZaDSQiosGYyw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2014-01-21  9:42           ` Ezequiel Garcia
2014-01-21  9:54       ` Arnd Bergmann
2014-01-21 10:13         ` Andrew Lunn
2014-01-21  9:12   ` [PATCH v2 04/15] watchdog: orion: Handle IRQ Ezequiel Garcia
2014-01-21  9:12   ` [PATCH v2 05/15] watchdog: orion: Make RSTOUT register a separate resource Ezequiel Garcia
     [not found]     ` <1390295561-3466-6-git-send-email-ezequiel.garcia-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
2014-01-21 23:33       ` Jason Gunthorpe
2014-01-22  9:48         ` Arnd Bergmann
2014-01-22 16:21           ` Ezequiel Garcia
2014-01-22 18:01             ` Ezequiel Garcia
2014-01-22 18:14               ` Jason Gunthorpe
2014-01-22 18:21                 ` Arnd Bergmann
     [not found]                 ` <20140122181409.GV18269-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2014-01-22 18:29                   ` Ezequiel Garcia
2014-01-21  9:12   ` [PATCH v2 06/15] watchdog: orion: Remove unneeded BRIDGE_CAUSE clear Ezequiel Garcia
     [not found]     ` <1390295561-3466-7-git-send-email-ezequiel.garcia-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
2014-01-21 23:35       ` Jason Gunthorpe
     [not found]         ` <20140121233537.GS18269-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2014-01-22 16:49           ` Ezequiel Garcia
2014-01-22 17:34             ` Jason Gunthorpe
     [not found]               ` <20140122173417.GT18269-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2014-01-22 17:45                 ` Ezequiel Garcia
2014-01-22 17:50                   ` Jason Gunthorpe
     [not found]                     ` <20140122175030.GU18269-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2014-01-22 18:03                       ` Ezequiel Garcia
2014-01-22 20:31                 ` Sebastian Hesselbarth
     [not found]                   ` <52E02AB6.7040104-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2014-01-22 20:52                     ` Jason Gunthorpe
     [not found]                       ` <20140122205213.GW18269-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2014-01-22 22:12                         ` Ezequiel Garcia
2014-01-22 22:31                           ` Jason Gunthorpe
     [not found]                             ` <20140122223117.GX18269-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2014-01-22 22:56                               ` Ezequiel Garcia
2014-01-23  0:03                               ` Sebastian Hesselbarth
     [not found]                                 ` <52E05C4E.9060709-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2014-01-23  0:19                                   ` Jason Gunthorpe
     [not found]                                     ` <20140123001934.GY18269-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2014-01-23  0:35                                       ` Sebastian Hesselbarth
2014-01-23 12:04                                       ` Ezequiel Garcia
2014-01-22 23:49                         ` Sebastian Hesselbarth
     [not found]                           ` <52E0591E.6030009-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2014-01-23 11:10                             ` Ezequiel Garcia
2014-01-23 11:54                               ` Ezequiel Garcia
2014-01-23 21:15                                 ` Sebastian Hesselbarth
2014-01-21  9:12   ` [PATCH v2 07/15] watchdog: orion: Introduce an orion_watchdog device structure Ezequiel Garcia
2014-01-21  9:12   ` [PATCH v2 08/15] watchdog: orion: Introduce per-compatible of_device_id data Ezequiel Garcia
2014-01-21  9:12   ` [PATCH v2 09/15] watchdog: orion: Add per-compatible clock initialization Ezequiel Garcia
     [not found]     ` <1390295561-3466-10-git-send-email-ezequiel.garcia-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
2014-01-21  9:18       ` Fabio Estevam
     [not found]         ` <CAOMZO5BDS8Dh1PR6SJv1CK5Pkq5mub-Hs7c4RhxUn7o5efnbKg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2014-01-21  9:43           ` Ezequiel Garcia
2014-01-21  9:12   ` [PATCH v2 10/15] watchdog: orion: Add per-compatible watchdog start implementation Ezequiel Garcia
2014-01-21  9:12   ` [PATCH v2 11/15] watchdog: orion: Add support for Armada 370 and Armada XP SoC Ezequiel Garcia
2014-01-21  9:12   ` [PATCH v2 12/15] ARM: mvebu: Enable Armada 370/XP watchdog in the devicetree Ezequiel Garcia
2014-01-21  9:12   ` [PATCH v2 13/15] ARM: kirkwood: Add RSTOUT 'reg' entry to devicetree Ezequiel Garcia
2014-01-21  9:12   ` [PATCH v2 14/15] watchdog: orion: Allow to build on any Orion platform Ezequiel Garcia
     [not found]     ` <1390295561-3466-15-git-send-email-ezequiel.garcia-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
2014-01-21  9:41       ` Sebastian Hesselbarth
     [not found]         ` <52DE40BD.10700-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2014-01-21  9:45           ` Andrew Lunn
     [not found]             ` <20140121094501.GA13396-g2DYL2Zd6BY@public.gmane.org>
2014-01-21 10:04               ` Ezequiel Garcia
2014-01-21 11:06           ` Removing PLAT_ORION dependency from ARCH_MVEBU (Was Re: [PATCH v2 14/15] watchdog: orion: Allow to build on any Orion platform) Ezequiel Garcia
2014-01-21 11:44             ` Sebastian Hesselbarth
2014-01-21  9:12   ` [PATCH v2 15/15] ARM: mvebu: Enable watchdog support in defconfig Ezequiel Garcia
     [not found]     ` <1390295561-3466-16-git-send-email-ezequiel.garcia-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
2014-01-21 12:47       ` Jason Cooper
     [not found]         ` <20140121124746.GZ29184-u4khhh1J0LxI1Ri9qeTfzeTW4wlIGRCZ@public.gmane.org>
2014-01-21 12:53           ` Andrew Lunn
     [not found]             ` <20140121125339.GH13396-g2DYL2Zd6BY@public.gmane.org>
2014-01-21 12:57               ` Jason Cooper

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=52DE4491.2000505@linaro.org \
    --to=daniel.lezcano-qsej5fyqhm4dnm+yrofe0a@public.gmane.org \
    --cc=alior-eYqpPyKDWXRBDgjK7y7TUQ@public.gmane.org \
    --cc=andrew-g2DYL2Zd6BY@public.gmane.org \
    --cc=devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=ezequiel.garcia-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org \
    --cc=gregory.clement-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org \
    --cc=jason-NLaQJdtUoK4Be96aLqz0jA@public.gmane.org \
    --cc=jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org \
    --cc=linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
    --cc=linux-watchdog-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=sebastian.hesselbarth-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=tawfik-eYqpPyKDWXRBDgjK7y7TUQ@public.gmane.org \
    --cc=thomas.petazzoni-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org \
    --cc=wim-IQzOog9fTRqzQB+pC5nmwQ@public.gmane.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 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).