All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mattias Wallin <mattias.wallin@stericsson.com>
To: Thomas Gleixner <tglx@linutronix.de>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"linux-arm-kernel@lists.infradead.org" 
	<linux-arm-kernel@lists.infradead.org>,
	Lee Jones <lee.jones@linaro.org>
Subject: Re: [PATCH 2/3] clocksource: add DB8500 PRCMU Timer support
Date: Tue, 31 May 2011 19:00:39 +0200	[thread overview]
Message-ID: <4DE51EB7.7010606@stericsson.com> (raw)
In-Reply-To: <alpine.LFD.2.02.1105311236250.3078@ionos>

On 05/31/2011 12:38 PM, Thomas Gleixner wrote:
> On Tue, 31 May 2011, Mattias Wallin wrote:
>> +static cycle_t clksrc_db8500_prcmu_read(struct clocksource *cs)
>> +{
>> +	u32 count, count2;
>> +
>> +	do {
>> +		count = readl(PRCMU_TIMER_4_DOWNCOUNT);
>> +		count2 = readl(PRCMU_TIMER_4_DOWNCOUNT);
>> +	} while (count2 != count);
>
> What's the point of this exercise ?
It is a software workaround for a HW bug. If the timer is read exactly 
when the logic is in the process of flipping over to a new value you 
will get wrong value (large deviations). The problem was found running 
LTP tests reporting "Timer going backwards". Reading it two times will 
take long enough for the timer to stabilise according to our HW guys 
measurements.
I agree with you that it is odd enough to deserve a comment in the code. 
I will comment it in next version.
>
>> +	clocksource_calc_mult_shift(&clocksource_db8500_prcmu,
>> +		RATE_32K, SCHED_CLOCK_MIN_WRAP);
>> +	clocksource_register(&clocksource_db8500_prcmu);
>
> Please use clocksource_register_hz()
Ok.
>
>> diff --git a/include/linux/clksrc-db8500-prcmu.h b/include/linux/clksrc-db8500-prcmu.h
>> new file mode 100644
>> index 0000000..42b8587
>> --- /dev/null
>> +++ b/include/linux/clksrc-db8500-prcmu.h
>
> Huch, why needs this to be a separate head in include/linux ?
I will move the header file to mach-ux500/include/mach/. Ok?

(I have long time ago been thought to avoid include mach headers from 
the drivers. But if I understand it correct it is not true any more and 
in this case it certainly makes no sense since I break that rule myself.)
>
>> @@ -0,0 +1,17 @@
>> +/*
>> + * Copyright (C) ST-Ericsson SA 2011
>> + *
>> + * License Terms: GNU General Public License v2
>> + * Author: Mattias Wallin<mattias.wallin@stericsson.com>
>> + *
>> + */
>> +#ifndef __CLKSRC_DB8500_PRCMU_H
>> +#define __CLKSRC_DB8500_PRCMU_H
>> +
>> +#ifdef CONFIG_CLKSRC_DB8500_PRCMU
>> +void __init clksrc_db8500_prcmu_init(void);
>> +#else
>> +void __init clksrc_db8500_prcmu_init(void) {}
>> +#endif
>> +
>> +#endif
>> --
>> 1.7.4.3
>>
>>


WARNING: multiple messages have this Message-ID (diff)
From: mattias.wallin@stericsson.com (Mattias Wallin)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 2/3] clocksource: add DB8500 PRCMU Timer support
Date: Tue, 31 May 2011 19:00:39 +0200	[thread overview]
Message-ID: <4DE51EB7.7010606@stericsson.com> (raw)
In-Reply-To: <alpine.LFD.2.02.1105311236250.3078@ionos>

On 05/31/2011 12:38 PM, Thomas Gleixner wrote:
> On Tue, 31 May 2011, Mattias Wallin wrote:
>> +static cycle_t clksrc_db8500_prcmu_read(struct clocksource *cs)
>> +{
>> +	u32 count, count2;
>> +
>> +	do {
>> +		count = readl(PRCMU_TIMER_4_DOWNCOUNT);
>> +		count2 = readl(PRCMU_TIMER_4_DOWNCOUNT);
>> +	} while (count2 != count);
>
> What's the point of this exercise ?
It is a software workaround for a HW bug. If the timer is read exactly 
when the logic is in the process of flipping over to a new value you 
will get wrong value (large deviations). The problem was found running 
LTP tests reporting "Timer going backwards". Reading it two times will 
take long enough for the timer to stabilise according to our HW guys 
measurements.
I agree with you that it is odd enough to deserve a comment in the code. 
I will comment it in next version.
>
>> +	clocksource_calc_mult_shift(&clocksource_db8500_prcmu,
>> +		RATE_32K, SCHED_CLOCK_MIN_WRAP);
>> +	clocksource_register(&clocksource_db8500_prcmu);
>
> Please use clocksource_register_hz()
Ok.
>
>> diff --git a/include/linux/clksrc-db8500-prcmu.h b/include/linux/clksrc-db8500-prcmu.h
>> new file mode 100644
>> index 0000000..42b8587
>> --- /dev/null
>> +++ b/include/linux/clksrc-db8500-prcmu.h
>
> Huch, why needs this to be a separate head in include/linux ?
I will move the header file to mach-ux500/include/mach/. Ok?

(I have long time ago been thought to avoid include mach headers from 
the drivers. But if I understand it correct it is not true any more and 
in this case it certainly makes no sense since I break that rule myself.)
>
>> @@ -0,0 +1,17 @@
>> +/*
>> + * Copyright (C) ST-Ericsson SA 2011
>> + *
>> + * License Terms: GNU General Public License v2
>> + * Author: Mattias Wallin<mattias.wallin@stericsson.com>
>> + *
>> + */
>> +#ifndef __CLKSRC_DB8500_PRCMU_H
>> +#define __CLKSRC_DB8500_PRCMU_H
>> +
>> +#ifdef CONFIG_CLKSRC_DB8500_PRCMU
>> +void __init clksrc_db8500_prcmu_init(void);
>> +#else
>> +void __init clksrc_db8500_prcmu_init(void) {}
>> +#endif
>> +
>> +#endif
>> --
>> 1.7.4.3
>>
>>

  reply	other threads:[~2011-05-31 17:01 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-31  8:31 [PATCH 2/3] clocksource: add DB8500 PRCMU Timer support Mattias Wallin
2011-05-31  8:31 ` Mattias Wallin
2011-05-31 10:38 ` Thomas Gleixner
2011-05-31 10:38   ` Thomas Gleixner
2011-05-31 17:00   ` Mattias Wallin [this message]
2011-05-31 17:00     ` Mattias Wallin
2011-05-31 21:18     ` Linus Walleij
2011-05-31 21:18       ` Linus Walleij
2011-06-01  7:57       ` Mattias Wallin
2011-06-01  7:57         ` Mattias Wallin
2011-06-01 14:22         ` Mattias Wallin
2011-06-01 14:22           ` Mattias Wallin
2011-06-01 14:25           ` Russell King - ARM Linux
2011-06-01 14:25             ` Russell King - ARM Linux
2011-06-01 14:31             ` Mattias Wallin
2011-06-01 14:31               ` Mattias Wallin
2011-06-01 14:36               ` Mattias Wallin
2011-06-01 14:36                 ` Mattias Wallin
2011-06-01 23:35               ` Linus Walleij
2011-06-01 23:35                 ` Linus Walleij
2011-06-01  8:30       ` Russell King - ARM Linux
2011-06-01  8:30         ` Russell King - ARM Linux
2011-06-01  8:37         ` Linus Walleij
2011-06-01  8:37           ` Linus Walleij

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=4DE51EB7.7010606@stericsson.com \
    --to=mattias.wallin@stericsson.com \
    --cc=lee.jones@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.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 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.