mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Roman Yeryomin <roman@advem.lv>
To: Arnd Bergmann <arnd@arndb.de>
Cc: linux-arm-kernel@lists.infradead.org,
	Felix Fietkau <nbd@openwrt.org>,
	rtc-linux@googlegroups.com,
	Linus Walleij <linus.walleij@linaro.org>,
	linux-kernel@vger.kernel.org,
	Alexandre Belloni <alexandre.belloni@free-electrons.com>,
	Russell King <rmk+kernel@arm.linux.org.uk>,
	Hans Ulli Kroll <ulli.kroll@googlemail.com>
Subject: Re: [1/2] RTC: Add core rtc support for Gemini Soc devices
Date: Thu, 09 Jul 2015 01:29:39 +0300	[thread overview]
Message-ID: <f22e65faa7d86074cda27973f83d7a52@advem.lv> (raw)
In-Reply-To: <2131951.l0j0CIttAZ@wuerfel>

[-- Attachment #1: Type: text/plain, Size: 1332 bytes --]

On 2015-05-08 19:08, Arnd Bergmann wrote:
> On Thursday 07 May 2015 12:03:25 Roman Yeryomin wrote:
>> On 2015-05-06 22:22, Arnd Bergmann wrote:
>> > On Wednesday 06 May 2015 19:21:21 Roman Yeryomin wrote:
>> >>
>> >> > Thanks to point that, I'll merge that one which seems clean enough:
>> >> > http://git.openwrt.org/?p=openwrt.git;a=blob;f=target/linux/gemini/files/drivers/rtc/rtc-gemini.c;h=587d8122b2fbb1230437eadcce4789a53aa60ee5;hb=4c637410a2a1ab45988e8ca6202554a502102039
>> >>
>> >> For 3.18 (and up) to work on gemini 160-gemini-timers.patch is vital.
>> >> Without that timers are broken and cpu is super slow.
>> >
>> > Do you know what part of the patch is the actual bug fix? We should
>> > probably
>> > merge that separately and mark it for stable backports, while the bulk
>> > of that
>> > patch seems to just rearrange code.
>> >
>> >       Arnd
>> 
>> Sorry, didn't try to extract the exact lines it but I guess it's that
>> part which touches the scheduler clock code.
>> Because without that patch sched clock runs at 100Hz instead of 25MHz.
>> I can dive into this deeper if you want, I just didn't see the need.
> 
> I think that would be helpful, yes.
> 

OK, here are the minimal changes required (see attachment). Tested on 
4.1.1
Let me know if you want me to submit it in some other way.

Regards,
Roman

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 160-gemini-timers.patch --]
[-- Type: text/x-diff; name=160-gemini-timers.patch, Size: 1986 bytes --]

--- a/arch/arm/mach-gemini/time.c
+++ b/arch/arm/mach-gemini/time.c
@@ -15,6 +15,7 @@
 #include <asm/mach/time.h>
 #include <linux/clockchips.h>
 #include <linux/clocksource.h>
+#include <linux/sched_clock.h>
 
 /*
  * Register definitions for the timers
@@ -34,9 +35,17 @@
 #define TIMER_3_CR_ENABLE		(1 << 6)
 #define TIMER_3_CR_CLOCK		(1 << 7)
 #define TIMER_3_CR_INT			(1 << 8)
+#define TIMER_1_CR_UPDOWN		(1 << 9)
+#define TIMER_2_CR_UPDOWN		(1 << 10)
+#define TIMER_3_CR_UPDOWN		(1 << 11)
 
 static unsigned int tick_rate;
 
+static u64 notrace gemini_read_sched_clock(void)
+{
+	return readl(TIMER_COUNT(IO_ADDRESS(GEMINI_TIMER3_BASE)));
+}
+
 static int gemini_timer_set_next_event(unsigned long cycles,
 				       struct clock_event_device *evt)
 {
@@ -155,14 +164,18 @@ void __init gemini_timer_init(void)
 	 */
 	setup_irq(IRQ_TIMER2, &gemini_timer_irq);
 
-	/* Enable and use TIMER1 as clock source */
-	writel(0xffffffff, TIMER_COUNT(IO_ADDRESS(GEMINI_TIMER1_BASE)));
-	writel(0xffffffff, TIMER_LOAD(IO_ADDRESS(GEMINI_TIMER1_BASE)));
-	writel(TIMER_1_CR_ENABLE, TIMER_CR(IO_ADDRESS(GEMINI_TIMER_BASE)));
-	if (clocksource_mmio_init(TIMER_COUNT(IO_ADDRESS(GEMINI_TIMER1_BASE)),
-				  "TIMER1", tick_rate, 300, 32,
+	/* Enable and use TIMER3 as clock source */
+	writel(0, TIMER_COUNT(IO_ADDRESS(GEMINI_TIMER3_BASE)));
+	writel(0, TIMER_LOAD(IO_ADDRESS(GEMINI_TIMER3_BASE)));
+	writel(0, TIMER_MATCH1(IO_ADDRESS(GEMINI_TIMER3_BASE)));
+	writel(0, TIMER_MATCH2(IO_ADDRESS(GEMINI_TIMER3_BASE)));
+	writel(TIMER_3_CR_ENABLE | TIMER_3_CR_UPDOWN,
+		TIMER_CR(IO_ADDRESS(GEMINI_TIMER_BASE)));
+	if (clocksource_mmio_init(TIMER_COUNT(IO_ADDRESS(GEMINI_TIMER3_BASE)),
+				  "TIMER3", tick_rate, 300, 32,
 				  clocksource_mmio_readl_up))
 		pr_err("timer: failed to initialize gemini clock source\n");
+	sched_clock_register(gemini_read_sched_clock, 32, tick_rate);
 
 	/* Configure and register the clockevent */
 	clockevents_config_and_register(&gemini_clockevent, tick_rate,

  reply	other threads:[~2015-07-08 22:37 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-12-14 15:08 [PATCH 0/2] ARM: Gemini: add RTC support for Gemini SoC Hans Ulli Kroll
2010-12-14 15:08 ` [PATCH 1/2] RTC: Add core rtc support for Gemini Soc devices Hans Ulli Kroll
2015-05-01 23:42   ` [1/2] " Alexandre Belloni
2015-05-06  9:39     ` Arnd Bergmann
2015-05-06  9:53       ` Alexandre Belloni
2015-05-06 16:21         ` Roman Yeryomin
2015-05-06 19:22           ` Arnd Bergmann
2015-05-07  9:03             ` Roman Yeryomin
2015-05-07 17:35               ` Hans Ulli Kroll
2015-05-07 21:31                 ` Roman Yeryomin
2015-05-08 16:08               ` Arnd Bergmann
2015-07-08 22:29                 ` Roman Yeryomin [this message]
2015-07-09  8:04                   ` Arnd Bergmann
2015-07-09 11:58                     ` Hans Ulli Kroll
2015-07-09 13:02                       ` Gemini Soc timers Roman Yeryomin
2015-07-09 15:48                         ` Linus Walleij
2015-07-09 16:48                           ` Roman Yeryomin
2015-07-10  8:48                             ` Linus Walleij
2015-07-12 21:06                               ` Arnd Bergmann
2015-07-09 16:51                     ` [1/2] RTC: Add core rtc support for Gemini Soc devices Roman Yeryomin
2015-07-19 16:28                       ` Hans Ulli Kroll
2015-05-07  3:00       ` Hans Ulli Kroll
2015-05-07  7:49         ` Arnd Bergmann
2015-05-07 17:46           ` Hans Ulli Kroll
2015-05-07 21:35             ` Roman Yeryomin
2015-05-08 18:28               ` Hans Ulli Kroll
2010-12-14 15:08 ` [PATCH 2/2] ARM: Gemini: add platform support for Gemini RTC Hans Ulli Kroll
2011-01-07  9:31 ` [PATCH 0/2] ARM: Gemini: add RTC support for Gemini SoC Russell King - ARM Linux
2011-01-07 14:47   ` Hans Ulli Kroll
2011-01-19 11:07   ` Russell King - ARM Linux
2011-01-24 17:22     ` Russell King - ARM Linux

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=f22e65faa7d86074cda27973f83d7a52@advem.lv \
    --to=roman@advem.lv \
    --cc=alexandre.belloni@free-electrons.com \
    --cc=arnd@arndb.de \
    --cc=linus.walleij@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nbd@openwrt.org \
    --cc=rmk+kernel@arm.linux.org.uk \
    --cc=rtc-linux@googlegroups.com \
    --cc=ulli.kroll@googlemail.com \
    /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®