All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] S3C24XX: add clockevent/clocksource support
@ 2012-10-24 20:56 Romain Naour
  2012-10-25 20:39 ` Tomasz Figa
  0 siblings, 1 reply; 39+ messages in thread
From: Romain Naour @ 2012-10-24 20:56 UTC (permalink / raw)
  To: linux-samsung-soc; +Cc: kgene.kim, ben-linux

Hi,

This patch converts the s3c24xx timer driver to the clocksource/clockevent API.
I made some test on a mini2440 board and I had to reduce timers frequency to 1MHz in order to produce a timer's overflow every 64ms.
Initial timer's frequency (8,45MHz) provide only 7ms between each overflow. It is not enough.
As timers were previously used to produce an IRQ at 200Hz, some board (Osiris, Anubis board) use an external 12MHz signal to clock the timers (tclk1).
So, I changed their configuration to select internal pclk clock instead, but I can't test it.
Also, I created a new file (s3c24xx_time.c) to avoid impacting the s3c64xx.
Kernel rev v3.7-rc1

Do you have any comments on this patch ?

Signed-off-by: Naour Romain <romain.naour@openwide.fr>
---
 arch/arm/Kconfig                     |   3 +-
 arch/arm/plat-s3c24xx/Makefile       |   1 +
 arch/arm/plat-s3c24xx/s3c24xx_time.c | 374 +++++++++++++++++++++++++++++++++++
 3 files changed, 377 insertions(+), 1 deletion(-)
 create mode 100644 arch/arm/plat-s3c24xx/s3c24xx_time.c

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 73067ef..80f989b 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -737,7 +737,8 @@ config ARCH_SA1100
 config ARCH_S3C24XX
 	bool "Samsung S3C24XX SoCs"
 	select ARCH_HAS_CPUFREQ
-	select ARCH_USES_GETTIMEOFFSET
+	select GENERIC_CLOCKEVENTS
+	select CLKSRC_MMIO
 	select CLKDEV_LOOKUP
 	select GENERIC_GPIO
 	select HAVE_CLK
diff --git a/arch/arm/plat-s3c24xx/Makefile b/arch/arm/plat-s3c24xx/Makefile
index 9f60549c..a0c4830 100644
--- a/arch/arm/plat-s3c24xx/Makefile
+++ b/arch/arm/plat-s3c24xx/Makefile
@@ -14,6 +14,7 @@ obj-				:=
 
 obj-y				+= irq.o
 obj-$(CONFIG_S3C24XX_DCLK)	+= clock-dclk.o
+obj-$(CONFIG_GENERIC_CLOCKEVENTS)   += s3c24xx_time.o
 
 obj-$(CONFIG_CPU_FREQ_S3C24XX)	+= cpu-freq.o
 obj-$(CONFIG_CPU_FREQ_S3C24XX_DEBUGFS) += cpu-freq-debugfs.o
diff --git a/arch/arm/plat-s3c24xx/s3c24xx_time.c b/arch/arm/plat-s3c24xx/s3c24xx_time.c
new file mode 100644
index 0000000..00cad36
--- /dev/null
+++ b/arch/arm/plat-s3c24xx/s3c24xx_time.c
@@ -0,0 +1,374 @@
+/* linux/arch/arm/plat-s3c24xx/s3c24xx_time.c
+ *
+ * Copyright (C) 2012, Romain Naour <romain.naour@openwide.fr>
+ * 
+ * Adapted from linux/arch/arm/plat-samsung/s5p-time.c
+ * 
+ * Copyright (C) 2003-2005 Simtec Electronics
+ *	Ben Dooks, <ben@simtec.co.uk>
+ *
+ * Copyright (C) 2006, 2007 Sebastian Smolorz <ssmolorz@emlix.com>, emlix GmbH
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+#include <linux/sched.h>
+#include <linux/interrupt.h>
+#include <linux/irq.h>
+#include <linux/err.h>
+#include <linux/clk.h>
+#include <linux/clockchips.h>
+#include <linux/platform_device.h>
+
+#include <asm/mach/time.h>
+#include <asm/mach/arch.h>
+#include <asm/mach/map.h>
+#include <asm/sched_clock.h>
+#include <asm/mach-types.h>
+
+#include <mach/map.h>
+#include <plat/devs.h>
+#include <plat/regs-timer.h>
+#include <mach/regs-irq.h>
+
+#define S3C24XX_PWM3 3
+#define S3C24XX_PWM4 4
+
+/* Be able to sleep for atleast 4 seconds (usually more) */
+#define S3C24XXTIMER_MIN_RANGE	4
+
+#define TCNT_MAX		0xffff
+#define NON_PERIODIC		0
+#define PERIODIC		1
+
+static struct clk *tin_event;
+static struct clk *tin_source;
+static struct clk *tdiv_event;
+static struct clk *tdiv_source;
+
+static struct clk *timerclk;
+static unsigned long clock_count_per_tick;
+static void s3c24xx_timer_resume(void);
+
+static void s3c24xx_time_stop(unsigned int mode)
+{
+	unsigned long tcon;
+
+	tcon = __raw_readl(S3C2410_TCON);
+
+	switch (mode) {
+	case S3C24XX_PWM3:
+		tcon &= ~S3C2410_TCON_T3START;
+		break;
+
+	case S3C24XX_PWM4:
+		tcon &= ~S3C2410_TCON_T4START;
+		break;
+
+	default:
+		pr_err("Invalid Timer %d\n", mode);
+		break;
+	}
+	__raw_writel(tcon, S3C2410_TCON);
+}
+
+static void s3c24xx_time_start(unsigned int mode, unsigned long tcnt,
+			       bool periodic)
+{
+	unsigned long tcon;
+
+	tcon  = __raw_readl(S3C2410_TCON);
+
+	switch (mode) {
+	case S3C24XX_PWM3:
+
+		__raw_writel(tcnt, S3C2410_TCNTB(S3C24XX_PWM3));
+
+		tcon &= ~(0x0f << 16);
+		tcon |= S3C2410_TCON_T3MANUALUPD;
+
+		/* Manual update */
+		__raw_writel(tcon, S3C2410_TCON);
+
+		tcon |= S3C2410_TCON_T3START;
+		tcon &= ~S3C2410_TCON_T3MANUALUPD;
+
+		if (periodic)
+			tcon |= S3C2410_TCON_T3RELOAD;
+		else
+			tcon &= ~S3C2410_TCON_T3RELOAD;
+		break;
+
+	case S3C24XX_PWM4:
+
+		__raw_writel(tcnt, S3C2410_TCNTB(S3C24XX_PWM4));
+
+		tcon &= ~(0x07 << 20);
+		tcon |= S3C2410_TCON_T4MANUALUPD;
+
+		/* Manual update */
+		__raw_writel(tcon, S3C2410_TCON);
+
+		tcon |= S3C2410_TCON_T4START;
+		tcon &= ~S3C2410_TCON_T4MANUALUPD;
+
+		if (periodic)
+			tcon |= S3C2410_TCON_T4RELOAD;
+		else
+			tcon &= ~S3C2410_TCON_T4RELOAD;
+		break;
+
+	default:
+		pr_err("Invalid Timer %d\n", mode);
+	break;
+	}
+
+	/* Start timers.*/
+	__raw_writel(tcon, S3C2410_TCON);
+}
+
+static int s3c24xx_set_next_event(unsigned long cycles,
+				struct clock_event_device *evt)
+{
+	s3c24xx_time_start(S3C24XX_PWM4, cycles, NON_PERIODIC);
+	return 0;
+}
+
+static void s3c24xx_set_mode(enum clock_event_mode mode,
+				struct clock_event_device *evt)
+{
+	/* Disable timer */
+	s3c24xx_time_stop(S3C24XX_PWM4);
+
+	switch (mode) {
+	case CLOCK_EVT_MODE_PERIODIC:
+		/* Enable the timer and start the periodic tick */
+		s3c24xx_time_start(S3C24XX_PWM4, clock_count_per_tick,
+				   PERIODIC);
+		break;
+
+	case CLOCK_EVT_MODE_ONESHOT:
+		/* Leave the timer disabled, .set_next_event will enable it */
+		break;
+
+	case CLOCK_EVT_MODE_UNUSED:
+	case CLOCK_EVT_MODE_SHUTDOWN:
+		break;
+
+	case CLOCK_EVT_MODE_RESUME:
+		s3c24xx_timer_resume();
+		break;
+	default:
+		/* Just leave in disabled state */
+	break;
+	}
+}
+
+static void s3c24xx_timer_resume(void)
+{
+	/* event timer restart */
+	s3c24xx_time_start(S3C24XX_PWM4, clock_count_per_tick, PERIODIC);
+
+	/* source timer restart */
+	s3c24xx_time_start(S3C24XX_PWM3, TCNT_MAX, PERIODIC);
+}
+
+static struct clock_event_device time_event_device = {
+	.name		= "s3c24xx_event_timer",
+	.features	= CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT,
+	.rating		= 200,
+	.set_next_event	= s3c24xx_set_next_event,
+	.set_mode	= s3c24xx_set_mode,
+	.irq = IRQ_TIMER4,
+};
+
+static irqreturn_t s3c24xx_clock_event_isr(int irq, void *dev_id)
+{
+	struct clock_event_device *evt = dev_id;
+
+	evt->event_handler(evt);
+
+	return IRQ_HANDLED;
+}
+
+static struct irqaction s3c24xx_clock_event_irq = {
+	.name		= "s3c24xx_time_irq",
+	.flags		= IRQF_DISABLED | IRQF_TIMER | IRQF_IRQPOLL,
+	.handler	= s3c24xx_clock_event_isr,
+	.dev_id		= &time_event_device,
+};
+
+static void __init s3c24xx_clockevent_init(void)
+{
+	unsigned long pclk;
+	unsigned long clock_rate;
+	unsigned int irq_number;
+	struct clk *tscaler;
+
+	/* Don't use tclk1 (12MHz) clock for timers (Anubis, Osiris...)
+	* use pclk instead.
+	*/
+
+	/* for the h1940 (and others), we use the pclk from the core
+	* to generate the timer values. since values around 50 to
+	* 70MHz are not values we can directly generate the timer
+	* value from, we need to pre-scale and divide before using it.
+	*/
+
+	pclk = clk_get_rate(timerclk);
+
+	tscaler = clk_get_parent(tdiv_event);
+
+	/* 50.7MHz dividing by 50 give 1MHz
+	*  (1 tick per usec)
+	*/
+
+	clk_set_rate(tscaler, pclk / 25);
+	clk_set_rate(tdiv_event, pclk / 50);
+
+	clk_set_parent(tin_event, tdiv_event);
+
+	clock_rate = clk_get_rate(tin_event);
+	clock_count_per_tick = clock_rate / HZ;
+
+	clockevents_calc_mult_shift(&time_event_device,
+				    clock_rate, S3C24XXTIMER_MIN_RANGE);
+	time_event_device.max_delta_ns =
+		clockevent_delta2ns(0xffff, &time_event_device);
+	time_event_device.min_delta_ns =
+		clockevent_delta2ns(0x1, &time_event_device);
+
+	time_event_device.cpumask = cpumask_of(0);
+
+	clockevents_register_device(&time_event_device);
+
+	pr_info("S3C244X: tin_event(%d) %ld.%03ld MHz\n", S3C24XX_PWM4,
+		       clock_rate / 1000000, (clock_rate % 1000000) / 1000);
+
+	irq_number = S3C24XX_PWM4 + IRQ_TIMER0;
+
+	setup_irq(irq_number, &s3c24xx_clock_event_irq);
+}
+
+/*
+ * Override the global weak sched_clock symbol with this
+ * local implementation which uses the clocksource to get some
+ * better resolution when scheduling the kernel. We accept that
+ * this wraps around for now, since it is just a relative time
+ * stamp. (Inspired by U300 implementation.)
+ */
+static u32 notrace s3c24xx_read_sched_clock(void)
+{
+	void __iomem *reg = S3C2410_TCNTO(S3C24XX_PWM3);
+
+	if (!reg)
+		return 0;
+
+	return ~__raw_readl(reg);
+}
+
+static void __init s3c24xx_clocksource_init(void)
+{
+	unsigned long pclk;
+	unsigned long clock_rate;
+	unsigned long intmask;
+	void __iomem *reg = S3C2410_TCNTO(S3C24XX_PWM3);
+	struct clk *tscaler;
+
+	pclk = clk_get_rate(timerclk);
+
+	tscaler = clk_get_parent(tdiv_source);
+
+	/* 50.7MHz dividing by 50 give 1MHz
+	*  (1 tick per usec) => timer wrap every 64,7usec
+	*/
+
+	clk_set_rate(tscaler, pclk / 25);
+	clk_set_rate(tdiv_event, pclk / 50);
+
+	clk_set_parent(tin_source, tdiv_source);
+
+	clock_rate = clk_get_rate(tin_source);
+
+	s3c24xx_time_start(S3C24XX_PWM3, TCNT_MAX, PERIODIC);
+
+	__raw_writel(0xffff, S3C2410_TCMPB(S3C24XX_PWM3));
+
+	/* Mask timer3 interrupt. */
+	intmask = __raw_readl(S3C2410_INTMSK);
+	intmask |= 1UL << (IRQ_TIMER3 - IRQ_EINT0);
+	__raw_writel(intmask, S3C2410_INTMSK);
+
+	pr_info("S3C244X: tin_source(%d) %ld.%03ld MHz\n", S3C24XX_PWM3,
+		       clock_rate / 1000000, (clock_rate % 1000000) / 1000);
+
+	setup_sched_clock(s3c24xx_read_sched_clock, 16, clock_rate);
+
+	if (clocksource_mmio_init(reg, "s3c24xx_clocksource_timer",
+			clock_rate, 200, 16, clocksource_mmio_readl_down))
+		panic("s3c24xx_clocksource_timer: can't register clocksource\n");
+}
+
+static void __init s3c24xx_timer_resources(void)
+{
+	char devname[15];
+
+	s3c_device_timer[S3C24XX_PWM4].dev.bus = &platform_bus_type;
+	s3c_device_timer[S3C24XX_PWM3].dev.bus = &platform_bus_type;
+
+	timerclk = clk_get(NULL, "timers");
+	if (IS_ERR(timerclk))
+		panic("failed to get clock for system timer");
+
+	clk_enable(timerclk);
+
+	sprintf(devname, "s3c24xx-pwm.%d", S3C24XX_PWM4);
+	s3c_device_timer[S3C24XX_PWM4].id = S3C24XX_PWM4;
+	s3c_device_timer[S3C24XX_PWM4].dev.init_name = devname;
+
+	tin_event = clk_get(&s3c_device_timer[S3C24XX_PWM4].dev, "pwm-tin");
+	if (IS_ERR(tin_event))
+		panic("failed to get pwm-tin clock for event timer");
+
+	tdiv_event = clk_get(&s3c_device_timer[S3C24XX_PWM4].dev, "pwm-tdiv");
+	if (IS_ERR(tdiv_event))
+		panic("failed to get pwm-tdiv clock for event timer");
+
+	sprintf(devname, "s3c24xx-pwm.%d", S3C24XX_PWM3);
+	s3c_device_timer[S3C24XX_PWM3].id = S3C24XX_PWM3;
+	s3c_device_timer[S3C24XX_PWM3].dev.init_name = devname;
+
+	tin_source = clk_get(&s3c_device_timer[S3C24XX_PWM3].dev, "pwm-tin");
+	if (IS_ERR(tin_source))
+		panic("failed to get pwm-tin clock for source timer");
+
+	tdiv_source = clk_get(&s3c_device_timer[S3C24XX_PWM3].dev, "pwm-tdiv");
+	if (IS_ERR(tdiv_source))
+		panic("failed to get pwm-tdiv clock for source timer");
+
+	clk_enable(tin_event);
+	clk_enable(tin_source);
+}
+
+static void __init s3c24xx_timer_init(void)
+{
+	s3c24xx_timer_resources();
+	s3c24xx_clocksource_init();
+	s3c24xx_clockevent_init();
+}
+
+struct sys_timer s3c24xx_timer = {
+	.init		= s3c24xx_timer_init,
+};
-- 
1.8.0

^ permalink raw reply related	[flat|nested] 39+ messages in thread

* Re: [PATCH] S3C24XX: add clockevent/clocksource support
  2012-10-24 20:56 [PATCH] S3C24XX: add clockevent/clocksource support Romain Naour
@ 2012-10-25 20:39 ` Tomasz Figa
  2012-10-26 10:51   ` Romain Naour
  0 siblings, 1 reply; 39+ messages in thread
From: Tomasz Figa @ 2012-10-25 20:39 UTC (permalink / raw)
  To: Romain Naour
  Cc: linux-samsung-soc, kgene.kim, ben-linux, Heiko Stübner,
	Sylwester Nawrocki

Hi Romain,

On Wednesday 24 of October 2012 22:56:40 Romain Naour wrote:
> Hi,
> 
> This patch converts the s3c24xx timer driver to the
> clocksource/clockevent API. I made some test on a mini2440 board and I
> had to reduce timers frequency to 1MHz in order to produce a timer's
> overflow every 64ms. Initial timer's frequency (8,45MHz) provide only
> 7ms between each overflow. It is not enough. As timers were previously
> used to produce an IRQ at 200Hz, some board (Osiris, Anubis board) use
> an external 12MHz signal to clock the timers (tclk1). So, I changed
> their configuration to select internal pclk clock instead, but I can't
> test it. Also, I created a new file (s3c24xx_time.c) to avoid impacting
> the s3c64xx. Kernel rev v3.7-rc1
> 
> Do you have any comments on this patch ?

Generally looks fine, but I have some doubts:

- Isn't 64ms still way too little for overflow period? Someone who is more 
into Linux time keeping should comment on this.

- Much of the code is duplicated from s5p-time, maybe s5p-time could be 
made a generic samsung-time instead? It could be also used for S3C64xx.

CC'ing Heiko and Sylwester, as they might find this patch interesting.

Best regards,
Tomasz Figa

^ permalink raw reply	[flat|nested] 39+ messages in thread

* Re: [PATCH] S3C24XX: add clockevent/clocksource support
  2012-10-25 20:39 ` Tomasz Figa
@ 2012-10-26 10:51   ` Romain Naour
  2012-11-23  2:30     ` Kukjin Kim
  0 siblings, 1 reply; 39+ messages in thread
From: Romain Naour @ 2012-10-26 10:51 UTC (permalink / raw)
  To: Tomasz Figa
  Cc: linux-samsung-soc, kgene.kim, ben-linux, Heiko Stübner,
	Sylwester Nawrocki

Hi Tomasz,

Thank you for your reply.

Le 25/10/2012 22:39, Tomasz Figa a écrit :
> Hi Romain,
> 
> On Wednesday 24 of October 2012 22:56:40 Romain Naour wrote:
>> Hi,
>>
>> This patch converts the s3c24xx timer driver to the
>> clocksource/clockevent API. I made some test on a mini2440 board and I
>> had to reduce timers frequency to 1MHz in order to produce a timer's
>> overflow every 64ms. Initial timer's frequency (8,45MHz) provide only
>> 7ms between each overflow. It is not enough. As timers were previously
>> used to produce an IRQ at 200Hz, some board (Osiris, Anubis board) use
>> an external 12MHz signal to clock the timers (tclk1). So, I changed
>> their configuration to select internal pclk clock instead, but I can't
>> test it. Also, I created a new file (s3c24xx_time.c) to avoid impacting
>> the s3c64xx. Kernel rev v3.7-rc1
>>
>> Do you have any comments on this patch ?
> 
> Generally looks fine, but I have some doubts:
> 
> - Isn't 64ms still way too little for overflow period? Someone who is more 
> into Linux time keeping should comment on this.

It seems to work correctly with 64ms.
Actually, it start to work with 15,5ms (timer's frequency = 4,21MHz)

> 
> - Much of the code is duplicated from s5p-time, maybe s5p-time could be 
> made a generic samsung-time instead? It could be also used for S3C64xx.

I'm agree, It would be great if we can use hrtimer on s3c64xx too :)
I made another patch following your advice, but I'm not sure if we really need to rename sp5-time.c and s5p_* functions.
I tested this patch with and without hrtimer enabled on my mini2440.
But, I need a confirmation for the frequency of pclk for each cpu.
Normally it is between 70MHz and 50MHz.
Also, we may need to define specific TSCALER_DIV TDIV value for s3c64xx. (samsung-time.h)

> 
> CC'ing Heiko and Sylwester, as they might find this patch interesting.
> 
> Best regards,
> Tomasz Figa
> 

Regards,
Romain Naour

Here is the new patch:

---
 arch/arm/Kconfig                                  |   6 +-
 arch/arm/mach-exynos/mach-universal_c210.c        |   4 +-
 arch/arm/mach-s3c24xx/Kconfig                     |   6 +
 arch/arm/mach-s3c24xx/mach-amlm5900.c             |   3 +
 arch/arm/mach-s3c24xx/mach-anubis.c               |   2 +
 arch/arm/mach-s3c24xx/mach-at2440evb.c            |   2 +
 arch/arm/mach-s3c24xx/mach-bast.c                 |   2 +
 arch/arm/mach-s3c24xx/mach-gta02.c                |   2 +
 arch/arm/mach-s3c24xx/mach-h1940.c                |   2 +
 arch/arm/mach-s3c24xx/mach-jive.c                 |   2 +
 arch/arm/mach-s3c24xx/mach-mini2440.c             |   4 +-
 arch/arm/mach-s3c24xx/mach-n30.c                  |   2 +
 arch/arm/mach-s3c24xx/mach-nexcoder.c             |   2 +
 arch/arm/mach-s3c24xx/mach-osiris.c               |   2 +
 arch/arm/mach-s3c24xx/mach-otom.c                 |   2 +
 arch/arm/mach-s3c24xx/mach-qt2410.c               |   2 +
 arch/arm/mach-s3c24xx/mach-rx1950.c               |   2 +
 arch/arm/mach-s3c24xx/mach-rx3715.c               |   2 +
 arch/arm/mach-s3c24xx/mach-smdk2410.c             |   2 +
 arch/arm/mach-s3c24xx/mach-smdk2413.c             |   2 +
 arch/arm/mach-s3c24xx/mach-smdk2416.c             |   2 +
 arch/arm/mach-s3c24xx/mach-smdk2440.c             |   2 +
 arch/arm/mach-s3c24xx/mach-smdk2443.c             |   2 +
 arch/arm/mach-s3c24xx/mach-tct_hammer.c           |   2 +
 arch/arm/mach-s3c24xx/mach-vr1000.c               |   2 +
 arch/arm/mach-s3c24xx/mach-vstms.c                |   3 +-
 arch/arm/mach-s3c64xx/mach-anw6410.c              |   2 +
 arch/arm/mach-s3c64xx/mach-crag6410.c             |   2 +
 arch/arm/mach-s3c64xx/mach-hmt.c                  |   2 +
 arch/arm/mach-s3c64xx/mach-mini6410.c             |   2 +
 arch/arm/mach-s3c64xx/mach-ncp.c                  |   2 +
 arch/arm/mach-s3c64xx/mach-real6410.c             |   2 +
 arch/arm/mach-s3c64xx/mach-smartq.c               |   2 +
 arch/arm/mach-s3c64xx/mach-smartq5.c              |   1 +
 arch/arm/mach-s3c64xx/mach-smartq7.c              |   1 +
 arch/arm/mach-s3c64xx/mach-smdk6400.c             |   2 +
 arch/arm/mach-s3c64xx/mach-smdk6410.c             |   2 +
 arch/arm/mach-s5p64x0/Kconfig                     |   4 +-
 arch/arm/mach-s5p64x0/mach-smdk6440.c             |   4 +-
 arch/arm/mach-s5p64x0/mach-smdk6450.c             |   4 +-
 arch/arm/mach-s5pv210/Kconfig                     |   2 +-
 arch/arm/mach-s5pv210/mach-aquila.c               |   4 +-
 arch/arm/mach-s5pv210/mach-goni.c                 |   4 +-
 arch/arm/mach-s5pv210/mach-smdkc110.c             |   4 +-
 arch/arm/mach-s5pv210/mach-smdkv210.c             |   4 +-
 arch/arm/mach-s5pv210/mach-torbreck.c             |   4 +-
 arch/arm/plat-samsung/Kconfig                     |   2 +-
 arch/arm/plat-samsung/Makefile                    |   2 +-
 arch/arm/plat-samsung/include/plat/s5p-time.h     |  40 ---
 arch/arm/plat-samsung/include/plat/samsung-time.h |  51 +++
 arch/arm/plat-samsung/s5p-time.c                  | 405 ----------------------
 arch/arm/plat-samsung/samsung-time.c              | 405 ++++++++++++++++++++++
 52 files changed, 555 insertions(+), 470 deletions(-)
 delete mode 100644 arch/arm/plat-samsung/include/plat/s5p-time.h
 create mode 100644 arch/arm/plat-samsung/include/plat/samsung-time.h
 delete mode 100644 arch/arm/plat-samsung/s5p-time.c
 create mode 100644 arch/arm/plat-samsung/samsung-time.c

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 73067ef..c1ac8a5 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -737,7 +737,8 @@ config ARCH_SA1100
 config ARCH_S3C24XX
 	bool "Samsung S3C24XX SoCs"
 	select ARCH_HAS_CPUFREQ
-	select ARCH_USES_GETTIMEOFFSET
+	select GENERIC_CLOCKEVENTS
+	select CLKSRC_MMIO
 	select CLKDEV_LOOKUP
 	select GENERIC_GPIO
 	select HAVE_CLK
@@ -756,7 +757,8 @@ config ARCH_S3C64XX
 	bool "Samsung S3C64XX"
 	select ARCH_HAS_CPUFREQ
 	select ARCH_REQUIRE_GPIOLIB
-	select ARCH_USES_GETTIMEOFFSET
+	select GENERIC_CLOCKEVENTS
+	select CLKSRC_MMIO
 	select ARM_VIC
 	select CLKDEV_LOOKUP
 	select CPU_V6
diff --git a/arch/arm/mach-exynos/mach-universal_c210.c b/arch/arm/mach-exynos/mach-universal_c210.c
index ebc9dd3..3b9ec1c 100644
--- a/arch/arm/mach-exynos/mach-universal_c210.c
+++ b/arch/arm/mach-exynos/mach-universal_c210.c
@@ -41,7 +41,7 @@
 #include <plat/mfc.h>
 #include <plat/sdhci.h>
 #include <plat/fimc-core.h>
-#include <plat/s5p-time.h>
+#include <plat/samsung-time.h>
 #include <plat/camport.h>
 #include <linux/platform_data/mipi-csis.h>
 
@@ -1099,7 +1099,7 @@ static void __init universal_map_io(void)
 	exynos_init_io(NULL, 0);
 	s3c24xx_init_clocks(clk_xusbxti.rate);
 	s3c24xx_init_uarts(universal_uartcfgs, ARRAY_SIZE(universal_uartcfgs));
-	s5p_set_timer_source(S5P_PWM2, S5P_PWM4);
+	samsung_set_timer_source(S5P_PWM2, S5P_PWM4);
 }
 
 static void s5p_tv_setup(void)
diff --git a/arch/arm/mach-s3c24xx/Kconfig b/arch/arm/mach-s3c24xx/Kconfig
index 2b6cb5f..be2c482 100644
--- a/arch/arm/mach-s3c24xx/Kconfig
+++ b/arch/arm/mach-s3c24xx/Kconfig
@@ -21,6 +21,7 @@ config CPU_S3C2410
 	select S3C2410_CLOCK
 	select S3C2410_CPUFREQ if CPU_FREQ_S3C24XX
 	select S3C2410_PM if PM
+	select SAMSUNG_HRT
 	help
 	  Support for S3C2410 and S3C2410A family from the S3C24XX line
 	  of Samsung Mobile CPUs.
@@ -32,6 +33,7 @@ config CPU_S3C2412
 	select CPU_LLSERIAL_S3C2440
 	select S3C2412_DMA if S3C24XX_DMA
 	select S3C2412_PM if PM
+	select SAMSUNG_HRT
 	help
 	  Support for the S3C2412 and S3C2413 SoCs from the S3C24XX line
 
@@ -44,6 +46,7 @@ config CPU_S3C2416
 	select S3C2443_COMMON
 	select S3C2443_DMA if S3C24XX_DMA
 	select SAMSUNG_CLKSRC
+	select SAMSUNG_HRT
 	help
 	  Support for the S3C2416 SoC from the S3C24XX line
 
@@ -54,6 +57,7 @@ config CPU_S3C2440
 	select S3C2410_CLOCK
 	select S3C2410_PM if PM
 	select S3C2440_DMA if S3C24XX_DMA
+	select SAMSUNG_HRT
 	help
 	  Support for S3C2440 Samsung Mobile CPU based systems.
 
@@ -63,6 +67,7 @@ config CPU_S3C2442
 	select CPU_LLSERIAL_S3C2440
 	select S3C2410_CLOCK
 	select S3C2410_PM if PM
+	select SAMSUNG_HRT
 	help
 	  Support for S3C2442 Samsung Mobile CPU based systems.
 
@@ -78,6 +83,7 @@ config CPU_S3C2443
 	select S3C2443_COMMON
 	select S3C2443_DMA if S3C24XX_DMA
 	select SAMSUNG_CLKSRC
+	select SAMSUNG_HRT
 	help
 	  Support for the S3C2443 SoC from the S3C24XX line
 
diff --git a/arch/arm/mach-s3c24xx/mach-amlm5900.c b/arch/arm/mach-s3c24xx/mach-amlm5900.c
index f4ad99c..5d5a07c 100644
--- a/arch/arm/mach-s3c24xx/mach-amlm5900.c
+++ b/arch/arm/mach-s3c24xx/mach-amlm5900.c
@@ -63,6 +63,8 @@
 #include <linux/mtd/map.h>
 #include <linux/mtd/physmap.h>
 
+#include <plat/samsung-time.h>
+
 #include "common.h"
 
 static struct resource amlm5900_nor_resource =
@@ -160,6 +162,7 @@ static void __init amlm5900_map_io(void)
 	s3c24xx_init_io(amlm5900_iodesc, ARRAY_SIZE(amlm5900_iodesc));
 	s3c24xx_init_clocks(0);
 	s3c24xx_init_uarts(amlm5900_uartcfgs, ARRAY_SIZE(amlm5900_uartcfgs));
+	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
 }
 
 #ifdef CONFIG_FB_S3C2410
diff --git a/arch/arm/mach-s3c24xx/mach-anubis.c b/arch/arm/mach-s3c24xx/mach-anubis.c
index 1ee8c46..7d323ed 100644
--- a/arch/arm/mach-s3c24xx/mach-anubis.c
+++ b/arch/arm/mach-s3c24xx/mach-anubis.c
@@ -54,6 +54,7 @@
 #include <plat/devs.h>
 #include <plat/cpu.h>
 #include <linux/platform_data/asoc-s3c24xx_simtec.h>
+#include <plat/samsung-time.h>
 
 #include "simtec.h"
 #include "common.h"
@@ -414,6 +415,7 @@ static void __init anubis_map_io(void)
 	s3c24xx_init_io(anubis_iodesc, ARRAY_SIZE(anubis_iodesc));
 	s3c24xx_init_clocks(0);
 	s3c24xx_init_uarts(anubis_uartcfgs, ARRAY_SIZE(anubis_uartcfgs));
+	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
 
 	/* check for the newer revision boards with large page nand */
 
diff --git a/arch/arm/mach-s3c24xx/mach-at2440evb.c b/arch/arm/mach-s3c24xx/mach-at2440evb.c
index 00381fe..1e93cb3 100644
--- a/arch/arm/mach-s3c24xx/mach-at2440evb.c
+++ b/arch/arm/mach-s3c24xx/mach-at2440evb.c
@@ -48,6 +48,7 @@
 #include <plat/devs.h>
 #include <plat/cpu.h>
 #include <linux/platform_data/mmc-s3cmci.h>
+#include <plat/samsung-time.h>
 
 #include "common.h"
 
@@ -192,6 +193,7 @@ static void __init at2440evb_map_io(void)
 	s3c24xx_init_io(at2440evb_iodesc, ARRAY_SIZE(at2440evb_iodesc));
 	s3c24xx_init_clocks(16934400);
 	s3c24xx_init_uarts(at2440evb_uartcfgs, ARRAY_SIZE(at2440evb_uartcfgs));
+	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
 }
 
 static void __init at2440evb_init(void)
diff --git a/arch/arm/mach-s3c24xx/mach-bast.c b/arch/arm/mach-s3c24xx/mach-bast.c
index 6a30ce7..be3cc7a 100644
--- a/arch/arm/mach-s3c24xx/mach-bast.c
+++ b/arch/arm/mach-s3c24xx/mach-bast.c
@@ -63,6 +63,7 @@
 #include <plat/cpu-freq.h>
 #include <plat/gpio-cfg.h>
 #include <linux/platform_data/asoc-s3c24xx_simtec.h>
+#include <plat/samsung-time.h>
 
 #include "simtec.h"
 #include "common.h"
@@ -583,6 +584,7 @@ static void __init bast_map_io(void)
 	s3c24xx_init_io(bast_iodesc, ARRAY_SIZE(bast_iodesc));
 	s3c24xx_init_clocks(0);
 	s3c24xx_init_uarts(bast_uartcfgs, ARRAY_SIZE(bast_uartcfgs));
+	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
 }
 
 static void __init bast_init(void)
diff --git a/arch/arm/mach-s3c24xx/mach-gta02.c b/arch/arm/mach-s3c24xx/mach-gta02.c
index 4a96346..3f83412 100644
--- a/arch/arm/mach-s3c24xx/mach-gta02.c
+++ b/arch/arm/mach-s3c24xx/mach-gta02.c
@@ -88,6 +88,7 @@
 #include <plat/gpio-cfg.h>
 #include <linux/platform_data/i2c-s3c2410.h>
 #include <linux/platform_data/touchscreen-s3c2410.h>
+#include <plat/samsung-time.h>
 
 #include "common.h"
 
@@ -507,6 +508,7 @@ static void __init gta02_map_io(void)
 	s3c24xx_init_io(gta02_iodesc, ARRAY_SIZE(gta02_iodesc));
 	s3c24xx_init_clocks(12000000);
 	s3c24xx_init_uarts(gta02_uartcfgs, ARRAY_SIZE(gta02_uartcfgs));
+	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
 }
 
 
diff --git a/arch/arm/mach-s3c24xx/mach-h1940.c b/arch/arm/mach-s3c24xx/mach-h1940.c
index 63aaf07..1455779 100644
--- a/arch/arm/mach-s3c24xx/mach-h1940.c
+++ b/arch/arm/mach-s3c24xx/mach-h1940.c
@@ -67,6 +67,7 @@
 #include <plat/pm.h>
 #include <linux/platform_data/mmc-s3cmci.h>
 #include <linux/platform_data/touchscreen-s3c2410.h>
+#include <plat/samsung-time.h>
 
 #include <sound/uda1380.h>
 
@@ -652,6 +653,7 @@ static void __init h1940_map_io(void)
 	s3c24xx_init_io(h1940_iodesc, ARRAY_SIZE(h1940_iodesc));
 	s3c24xx_init_clocks(0);
 	s3c24xx_init_uarts(h1940_uartcfgs, ARRAY_SIZE(h1940_uartcfgs));
+	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
 
 	/* setup PM */
 
diff --git a/arch/arm/mach-s3c24xx/mach-jive.c b/arch/arm/mach-s3c24xx/mach-jive.c
index c9954e2..9671c42 100644
--- a/arch/arm/mach-s3c24xx/mach-jive.c
+++ b/arch/arm/mach-s3c24xx/mach-jive.c
@@ -55,6 +55,7 @@
 #include <plat/cpu.h>
 #include <plat/pm.h>
 #include <linux/platform_data/usb-s3c2410_udc.h>
+#include <plat/samsung-time.h>
 
 static struct map_desc jive_iodesc[] __initdata = {
 };
@@ -506,6 +507,7 @@ static void __init jive_map_io(void)
 	s3c24xx_init_io(jive_iodesc, ARRAY_SIZE(jive_iodesc));
 	s3c24xx_init_clocks(12000000);
 	s3c24xx_init_uarts(jive_uartcfgs, ARRAY_SIZE(jive_uartcfgs));
+	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
 }
 
 static void jive_power_off(void)
diff --git a/arch/arm/mach-s3c24xx/mach-mini2440.c b/arch/arm/mach-s3c24xx/mach-mini2440.c
index 393c0f1..a96efcd 100644
--- a/arch/arm/mach-s3c24xx/mach-mini2440.c
+++ b/arch/arm/mach-s3c24xx/mach-mini2440.c
@@ -57,6 +57,7 @@
 #include <plat/clock.h>
 #include <plat/devs.h>
 #include <plat/cpu.h>
+#include <plat/samsung-time.h>
 
 #include <sound/s3c24xx_uda134x.h>
 
@@ -527,6 +528,7 @@ static void __init mini2440_map_io(void)
 	s3c24xx_init_io(mini2440_iodesc, ARRAY_SIZE(mini2440_iodesc));
 	s3c24xx_init_clocks(12000000);
 	s3c24xx_init_uarts(mini2440_uartcfgs, ARRAY_SIZE(mini2440_uartcfgs));
+	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
 }
 
 /*
@@ -689,6 +691,6 @@ MACHINE_START(MINI2440, "MINI2440")
 	.map_io		= mini2440_map_io,
 	.init_machine	= mini2440_init,
 	.init_irq	= s3c24xx_init_irq,
-	.timer		= &s3c24xx_timer,
+	.timer		= &samsung_timer,
 	.restart	= s3c244x_restart,
 MACHINE_END
diff --git a/arch/arm/mach-s3c24xx/mach-n30.c b/arch/arm/mach-s3c24xx/mach-n30.c
index c53a9bf..ea80658 100644
--- a/arch/arm/mach-s3c24xx/mach-n30.c
+++ b/arch/arm/mach-s3c24xx/mach-n30.c
@@ -50,6 +50,7 @@
 #include <linux/platform_data/mmc-s3cmci.h>
 #include <plat/s3c2410.h>
 #include <linux/platform_data/usb-s3c2410_udc.h>
+#include <plat/samsung-time.h>
 
 #include "common.h"
 
@@ -536,6 +537,7 @@ static void __init n30_map_io(void)
 	n30_hwinit();
 	s3c24xx_init_clocks(0);
 	s3c24xx_init_uarts(n30_uartcfgs, ARRAY_SIZE(n30_uartcfgs));
+	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
 }
 
 /* GPB3 is the line that controls the pull-up for the USB D+ line */
diff --git a/arch/arm/mach-s3c24xx/mach-nexcoder.c b/arch/arm/mach-s3c24xx/mach-nexcoder.c
index a2b92b0..76acb5a 100644
--- a/arch/arm/mach-s3c24xx/mach-nexcoder.c
+++ b/arch/arm/mach-s3c24xx/mach-nexcoder.c
@@ -46,6 +46,7 @@
 #include <plat/clock.h>
 #include <plat/devs.h>
 #include <plat/cpu.h>
+#include <plat/samsung-time.h>
 
 #include "common.h"
 
@@ -137,6 +138,7 @@ static void __init nexcoder_map_io(void)
 	s3c24xx_init_io(nexcoder_iodesc, ARRAY_SIZE(nexcoder_iodesc));
 	s3c24xx_init_clocks(0);
 	s3c24xx_init_uarts(nexcoder_uartcfgs, ARRAY_SIZE(nexcoder_uartcfgs));
+	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
 
 	nexcoder_sensorboard_init();
 }
diff --git a/arch/arm/mach-s3c24xx/mach-osiris.c b/arch/arm/mach-s3c24xx/mach-osiris.c
index bb36d83..60a5f92 100644
--- a/arch/arm/mach-s3c24xx/mach-osiris.c
+++ b/arch/arm/mach-s3c24xx/mach-osiris.c
@@ -53,6 +53,7 @@
 #include <plat/clock.h>
 #include <plat/devs.h>
 #include <plat/cpu.h>
+#include <plat/samsung-time.h>
 
 #include "common.h"
 
@@ -386,6 +387,7 @@ static void __init osiris_map_io(void)
 	s3c24xx_init_io(osiris_iodesc, ARRAY_SIZE(osiris_iodesc));
 	s3c24xx_init_clocks(0);
 	s3c24xx_init_uarts(osiris_uartcfgs, ARRAY_SIZE(osiris_uartcfgs));
+	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
 
 	/* check for the newer revision boards with large page nand */
 
diff --git a/arch/arm/mach-s3c24xx/mach-otom.c b/arch/arm/mach-s3c24xx/mach-otom.c
index bca39f0..24e7d70 100644
--- a/arch/arm/mach-s3c24xx/mach-otom.c
+++ b/arch/arm/mach-s3c24xx/mach-otom.c
@@ -37,6 +37,7 @@
 #include <plat/devs.h>
 #include <linux/platform_data/i2c-s3c2410.h>
 #include <plat/cpu.h>
+#include <plat/samsung-time.h>
 
 #include "common.h"
 
@@ -104,6 +105,7 @@ static void __init otom11_map_io(void)
 	s3c24xx_init_io(otom11_iodesc, ARRAY_SIZE(otom11_iodesc));
 	s3c24xx_init_clocks(0);
 	s3c24xx_init_uarts(otom11_uartcfgs, ARRAY_SIZE(otom11_uartcfgs));
+	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
 }
 
 static void __init otom11_init(void)
diff --git a/arch/arm/mach-s3c24xx/mach-qt2410.c b/arch/arm/mach-s3c24xx/mach-qt2410.c
index 7b6ba13..b68ff2a 100644
--- a/arch/arm/mach-s3c24xx/mach-qt2410.c
+++ b/arch/arm/mach-s3c24xx/mach-qt2410.c
@@ -60,6 +60,7 @@
 #include <plat/devs.h>
 #include <plat/cpu.h>
 #include <plat/pm.h>
+#include <plat/samsung-time.h>
 
 #include "common.h"
 
@@ -304,6 +305,7 @@ static void __init qt2410_map_io(void)
 	s3c24xx_init_io(qt2410_iodesc, ARRAY_SIZE(qt2410_iodesc));
 	s3c24xx_init_clocks(12*1000*1000);
 	s3c24xx_init_uarts(smdk2410_uartcfgs, ARRAY_SIZE(smdk2410_uartcfgs));
+	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
 }
 
 static void __init qt2410_machine_init(void)
diff --git a/arch/arm/mach-s3c24xx/mach-rx1950.c b/arch/arm/mach-s3c24xx/mach-rx1950.c
index 379fde5..fc03bb80 100644
--- a/arch/arm/mach-s3c24xx/mach-rx1950.c
+++ b/arch/arm/mach-s3c24xx/mach-rx1950.c
@@ -58,6 +58,7 @@
 #include <plat/pm.h>
 #include <plat/irq.h>
 #include <linux/platform_data/touchscreen-s3c2410.h>
+#include <plat/samsung-time.h>
 
 #include <sound/uda1380.h>
 
@@ -743,6 +744,7 @@ static void __init rx1950_map_io(void)
 	s3c24xx_init_io(rx1950_iodesc, ARRAY_SIZE(rx1950_iodesc));
 	s3c24xx_init_clocks(16934000);
 	s3c24xx_init_uarts(rx1950_uartcfgs, ARRAY_SIZE(rx1950_uartcfgs));
+	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
 
 	/* setup PM */
 
diff --git a/arch/arm/mach-s3c24xx/mach-rx3715.c b/arch/arm/mach-s3c24xx/mach-rx3715.c
index dacbb9a..772e275 100644
--- a/arch/arm/mach-s3c24xx/mach-rx3715.c
+++ b/arch/arm/mach-s3c24xx/mach-rx3715.c
@@ -50,6 +50,7 @@
 #include <plat/devs.h>
 #include <plat/cpu.h>
 #include <plat/pm.h>
+#include <plat/samsung-time.h>
 
 #include "common.h"
 
@@ -179,6 +180,7 @@ static void __init rx3715_map_io(void)
 	s3c24xx_init_io(rx3715_iodesc, ARRAY_SIZE(rx3715_iodesc));
 	s3c24xx_init_clocks(16934000);
 	s3c24xx_init_uarts(rx3715_uartcfgs, ARRAY_SIZE(rx3715_uartcfgs));
+	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
 }
 
 /* H1940 and RX3715 need to reserve this for suspend */
diff --git a/arch/arm/mach-s3c24xx/mach-smdk2410.c b/arch/arm/mach-s3c24xx/mach-smdk2410.c
index 82796b9..76aa704 100644
--- a/arch/arm/mach-s3c24xx/mach-smdk2410.c
+++ b/arch/arm/mach-s3c24xx/mach-smdk2410.c
@@ -53,6 +53,7 @@
 #include <plat/cpu.h>
 
 #include <plat/common-smdk.h>
+#include <plat/samsung-time.h>
 
 #include "common.h"
 
@@ -101,6 +102,7 @@ static void __init smdk2410_map_io(void)
 	s3c24xx_init_io(smdk2410_iodesc, ARRAY_SIZE(smdk2410_iodesc));
 	s3c24xx_init_clocks(0);
 	s3c24xx_init_uarts(smdk2410_uartcfgs, ARRAY_SIZE(smdk2410_uartcfgs));
+	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
 }
 
 static void __init smdk2410_init(void)
diff --git a/arch/arm/mach-s3c24xx/mach-smdk2413.c b/arch/arm/mach-s3c24xx/mach-smdk2413.c
index ce99fd8..128dc88 100644
--- a/arch/arm/mach-s3c24xx/mach-smdk2413.c
+++ b/arch/arm/mach-s3c24xx/mach-smdk2413.c
@@ -47,6 +47,7 @@
 #include <plat/clock.h>
 #include <plat/devs.h>
 #include <plat/cpu.h>
+#include <plat/samsung-time.h>
 
 #include <plat/common-smdk.h>
 
@@ -107,6 +108,7 @@ static void __init smdk2413_map_io(void)
 	s3c24xx_init_io(smdk2413_iodesc, ARRAY_SIZE(smdk2413_iodesc));
 	s3c24xx_init_clocks(12000000);
 	s3c24xx_init_uarts(smdk2413_uartcfgs, ARRAY_SIZE(smdk2413_uartcfgs));
+	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
 }
 
 static void __init smdk2413_machine_init(void)
diff --git a/arch/arm/mach-s3c24xx/mach-smdk2416.c b/arch/arm/mach-s3c24xx/mach-smdk2416.c
index f30d7fc..ee5fcaf 100644
--- a/arch/arm/mach-s3c24xx/mach-smdk2416.c
+++ b/arch/arm/mach-s3c24xx/mach-smdk2416.c
@@ -52,6 +52,7 @@
 #include <plat/sdhci.h>
 #include <linux/platform_data/usb-s3c2410_udc.h>
 #include <linux/platform_data/s3c-hsudc.h>
+#include <plat/samsung-time.h>
 
 #include <plat/fb.h>
 
@@ -222,6 +223,7 @@ static void __init smdk2416_map_io(void)
 	s3c24xx_init_io(smdk2416_iodesc, ARRAY_SIZE(smdk2416_iodesc));
 	s3c24xx_init_clocks(12000000);
 	s3c24xx_init_uarts(smdk2416_uartcfgs, ARRAY_SIZE(smdk2416_uartcfgs));
+	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
 }
 
 static void __init smdk2416_machine_init(void)
diff --git a/arch/arm/mach-s3c24xx/mach-smdk2440.c b/arch/arm/mach-s3c24xx/mach-smdk2440.c
index b7ff882..bc443da 100644
--- a/arch/arm/mach-s3c24xx/mach-smdk2440.c
+++ b/arch/arm/mach-s3c24xx/mach-smdk2440.c
@@ -44,6 +44,7 @@
 #include <plat/clock.h>
 #include <plat/devs.h>
 #include <plat/cpu.h>
+#include <plat/samsung-time.h>
 
 #include <plat/common-smdk.h>
 
@@ -164,6 +165,7 @@ static void __init smdk2440_map_io(void)
 	s3c24xx_init_io(smdk2440_iodesc, ARRAY_SIZE(smdk2440_iodesc));
 	s3c24xx_init_clocks(16934400);
 	s3c24xx_init_uarts(smdk2440_uartcfgs, ARRAY_SIZE(smdk2440_uartcfgs));
+	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
 }
 
 static void __init smdk2440_machine_init(void)
diff --git a/arch/arm/mach-s3c24xx/mach-smdk2443.c b/arch/arm/mach-s3c24xx/mach-smdk2443.c
index 2568656..b5b128f 100644
--- a/arch/arm/mach-s3c24xx/mach-smdk2443.c
+++ b/arch/arm/mach-s3c24xx/mach-smdk2443.c
@@ -44,6 +44,7 @@
 #include <plat/clock.h>
 #include <plat/devs.h>
 #include <plat/cpu.h>
+#include <plat/samsung-time.h>
 
 #include <plat/common-smdk.h>
 
@@ -123,6 +124,7 @@ static void __init smdk2443_map_io(void)
 	s3c24xx_init_io(smdk2443_iodesc, ARRAY_SIZE(smdk2443_iodesc));
 	s3c24xx_init_clocks(12000000);
 	s3c24xx_init_uarts(smdk2443_uartcfgs, ARRAY_SIZE(smdk2443_uartcfgs));
+	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
 }
 
 static void __init smdk2443_machine_init(void)
diff --git a/arch/arm/mach-s3c24xx/mach-tct_hammer.c b/arch/arm/mach-s3c24xx/mach-tct_hammer.c
index 495bf5c..c6351a8 100644
--- a/arch/arm/mach-s3c24xx/mach-tct_hammer.c
+++ b/arch/arm/mach-s3c24xx/mach-tct_hammer.c
@@ -53,6 +53,7 @@
 #include <linux/mtd/partitions.h>
 #include <linux/mtd/map.h>
 #include <linux/mtd/physmap.h>
+#include <plat/samsung-time.h>
 
 #include "common.h"
 
@@ -136,6 +137,7 @@ static void __init tct_hammer_map_io(void)
 	s3c24xx_init_io(tct_hammer_iodesc, ARRAY_SIZE(tct_hammer_iodesc));
 	s3c24xx_init_clocks(0);
 	s3c24xx_init_uarts(tct_hammer_uartcfgs, ARRAY_SIZE(tct_hammer_uartcfgs));
+	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
 }
 
 static void __init tct_hammer_init(void)
diff --git a/arch/arm/mach-s3c24xx/mach-vr1000.c b/arch/arm/mach-s3c24xx/mach-vr1000.c
index 14d5b12..0c3d863 100644
--- a/arch/arm/mach-s3c24xx/mach-vr1000.c
+++ b/arch/arm/mach-s3c24xx/mach-vr1000.c
@@ -50,6 +50,7 @@
 #include <plat/cpu.h>
 #include <linux/platform_data/i2c-s3c2410.h>
 #include <linux/platform_data/asoc-s3c24xx_simtec.h>
+#include <plat/samsung-time.h>
 
 #include "simtec.h"
 #include "common.h"
@@ -335,6 +336,7 @@ static void __init vr1000_map_io(void)
 	s3c24xx_init_io(vr1000_iodesc, ARRAY_SIZE(vr1000_iodesc));
 	s3c24xx_init_clocks(0);
 	s3c24xx_init_uarts(vr1000_uartcfgs, ARRAY_SIZE(vr1000_uartcfgs));
+	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
 }
 
 static void __init vr1000_init(void)
diff --git a/arch/arm/mach-s3c24xx/mach-vstms.c b/arch/arm/mach-s3c24xx/mach-vstms.c
index f1d44ae..1741d00 100644
--- a/arch/arm/mach-s3c24xx/mach-vstms.c
+++ b/arch/arm/mach-s3c24xx/mach-vstms.c
@@ -47,7 +47,7 @@
 #include <plat/clock.h>
 #include <plat/devs.h>
 #include <plat/cpu.h>
-
+#include <plat/samsung-time.h>
 
 static struct map_desc vstms_iodesc[] __initdata = {
 };
@@ -144,6 +144,7 @@ static void __init vstms_map_io(void)
 	s3c24xx_init_io(vstms_iodesc, ARRAY_SIZE(vstms_iodesc));
 	s3c24xx_init_clocks(12000000);
 	s3c24xx_init_uarts(vstms_uartcfgs, ARRAY_SIZE(vstms_uartcfgs));
+	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
 }
 
 static void __init vstms_init(void)
diff --git a/arch/arm/mach-s3c64xx/mach-anw6410.c b/arch/arm/mach-s3c64xx/mach-anw6410.c
index 99e82ac..717daaa 100644
--- a/arch/arm/mach-s3c64xx/mach-anw6410.c
+++ b/arch/arm/mach-s3c64xx/mach-anw6410.c
@@ -51,6 +51,7 @@
 #include <plat/cpu.h>
 #include <mach/regs-gpio.h>
 #include <mach/regs-modem.h>
+#include <plat/samsung-time.h>
 
 #include "common.h"
 
@@ -209,6 +210,7 @@ static void __init anw6410_map_io(void)
 	s3c64xx_init_io(anw6410_iodesc, ARRAY_SIZE(anw6410_iodesc));
 	s3c24xx_init_clocks(12000000);
 	s3c24xx_init_uarts(anw6410_uartcfgs, ARRAY_SIZE(anw6410_uartcfgs));
+	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
 
 	anw6410_lcd_mode_set();
 }
diff --git a/arch/arm/mach-s3c64xx/mach-crag6410.c b/arch/arm/mach-s3c64xx/mach-crag6410.c
index 13b7eaa..0d41166 100644
--- a/arch/arm/mach-s3c64xx/mach-crag6410.c
+++ b/arch/arm/mach-s3c64xx/mach-crag6410.c
@@ -70,6 +70,7 @@
 #include <plat/adc.h>
 #include <linux/platform_data/i2c-s3c2410.h>
 #include <plat/pm.h>
+#include <plat/samsung-time.h>
 
 #include "common.h"
 
@@ -704,6 +705,7 @@ static void __init crag6410_map_io(void)
 	s3c64xx_init_io(NULL, 0);
 	s3c24xx_init_clocks(12000000);
 	s3c24xx_init_uarts(crag6410_uartcfgs, ARRAY_SIZE(crag6410_uartcfgs));
+	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
 
 	/* LCD type and Bypass set by bootloader */
 }
diff --git a/arch/arm/mach-s3c64xx/mach-hmt.c b/arch/arm/mach-s3c64xx/mach-hmt.c
index 2b14489..30c0424 100644
--- a/arch/arm/mach-s3c64xx/mach-hmt.c
+++ b/arch/arm/mach-s3c64xx/mach-hmt.c
@@ -42,6 +42,7 @@
 #include <plat/clock.h>
 #include <plat/devs.h>
 #include <plat/cpu.h>
+#include <plat/samsung-time.h>
 
 #include "common.h"
 
@@ -249,6 +250,7 @@ static void __init hmt_map_io(void)
 	s3c64xx_init_io(hmt_iodesc, ARRAY_SIZE(hmt_iodesc));
 	s3c24xx_init_clocks(12000000);
 	s3c24xx_init_uarts(hmt_uartcfgs, ARRAY_SIZE(hmt_uartcfgs));
+	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
 }
 
 static void __init hmt_machine_init(void)
diff --git a/arch/arm/mach-s3c64xx/mach-mini6410.c b/arch/arm/mach-s3c64xx/mach-mini6410.c
index 07c349c..758f5708 100644
--- a/arch/arm/mach-s3c64xx/mach-mini6410.c
+++ b/arch/arm/mach-s3c64xx/mach-mini6410.c
@@ -44,6 +44,7 @@
 
 #include <video/platform_lcd.h>
 #include <video/samsung_fimd.h>
+#include <plat/samsung-time.h>
 
 #include "common.h"
 
@@ -233,6 +234,7 @@ static void __init mini6410_map_io(void)
 	s3c64xx_init_io(NULL, 0);
 	s3c24xx_init_clocks(12000000);
 	s3c24xx_init_uarts(mini6410_uartcfgs, ARRAY_SIZE(mini6410_uartcfgs));
+	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
 
 	/* set the LCD type */
 	tmp = __raw_readl(S3C64XX_SPCON);
diff --git a/arch/arm/mach-s3c64xx/mach-ncp.c b/arch/arm/mach-s3c64xx/mach-ncp.c
index e5f9a79..edfdd9f 100644
--- a/arch/arm/mach-s3c64xx/mach-ncp.c
+++ b/arch/arm/mach-s3c64xx/mach-ncp.c
@@ -44,6 +44,7 @@
 #include <plat/clock.h>
 #include <plat/devs.h>
 #include <plat/cpu.h>
+#include <plat/samsung-time.h>
 
 #include "common.h"
 
@@ -88,6 +89,7 @@ static void __init ncp_map_io(void)
 	s3c64xx_init_io(ncp_iodesc, ARRAY_SIZE(ncp_iodesc));
 	s3c24xx_init_clocks(12000000);
 	s3c24xx_init_uarts(ncp_uartcfgs, ARRAY_SIZE(ncp_uartcfgs));
+	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
 }
 
 static void __init ncp_machine_init(void)
diff --git a/arch/arm/mach-s3c64xx/mach-real6410.c b/arch/arm/mach-s3c64xx/mach-real6410.c
index 7476f7c..dd9980d 100644
--- a/arch/arm/mach-s3c64xx/mach-real6410.c
+++ b/arch/arm/mach-s3c64xx/mach-real6410.c
@@ -45,6 +45,7 @@
 
 #include <video/platform_lcd.h>
 #include <video/samsung_fimd.h>
+#include <plat/samsung-time.h>
 
 #include "common.h"
 
@@ -212,6 +213,7 @@ static void __init real6410_map_io(void)
 	s3c64xx_init_io(NULL, 0);
 	s3c24xx_init_clocks(12000000);
 	s3c24xx_init_uarts(real6410_uartcfgs, ARRAY_SIZE(real6410_uartcfgs));
+	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
 
 	/* set the LCD type */
 	tmp = __raw_readl(S3C64XX_SPCON);
diff --git a/arch/arm/mach-s3c64xx/mach-smartq.c b/arch/arm/mach-s3c64xx/mach-smartq.c
index c6d7390..df314f1 100644
--- a/arch/arm/mach-s3c64xx/mach-smartq.c
+++ b/arch/arm/mach-s3c64xx/mach-smartq.c
@@ -39,6 +39,7 @@
 #include <linux/platform_data/touchscreen-s3c2410.h>
 
 #include <video/platform_lcd.h>
+#include <plat/samsung-time.h>
 
 #include "common.h"
 
@@ -378,6 +379,7 @@ void __init smartq_map_io(void)
 	s3c64xx_init_io(smartq_iodesc, ARRAY_SIZE(smartq_iodesc));
 	s3c24xx_init_clocks(12000000);
 	s3c24xx_init_uarts(smartq_uartcfgs, ARRAY_SIZE(smartq_uartcfgs));
+	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
 
 	smartq_lcd_mode_set();
 }
diff --git a/arch/arm/mach-s3c64xx/mach-smartq5.c b/arch/arm/mach-s3c64xx/mach-smartq5.c
index 96d6da2..1a6baf2 100644
--- a/arch/arm/mach-s3c64xx/mach-smartq5.c
+++ b/arch/arm/mach-s3c64xx/mach-smartq5.c
@@ -29,6 +29,7 @@
 #include <plat/devs.h>
 #include <plat/fb.h>
 #include <plat/gpio-cfg.h>
+#include <plat/samsung-time.h>
 
 #include "common.h"
 #include "mach-smartq.h"
diff --git a/arch/arm/mach-s3c64xx/mach-smartq7.c b/arch/arm/mach-s3c64xx/mach-smartq7.c
index 7d1167b..e193866 100644
--- a/arch/arm/mach-s3c64xx/mach-smartq7.c
+++ b/arch/arm/mach-s3c64xx/mach-smartq7.c
@@ -29,6 +29,7 @@
 #include <plat/devs.h>
 #include <plat/fb.h>
 #include <plat/gpio-cfg.h>
+#include <plat/samsung-time.h>
 
 #include "common.h"
 #include "mach-smartq.h"
diff --git a/arch/arm/mach-s3c64xx/mach-smdk6400.c b/arch/arm/mach-s3c64xx/mach-smdk6400.c
index a928fae..b2bac82 100644
--- a/arch/arm/mach-s3c64xx/mach-smdk6400.c
+++ b/arch/arm/mach-s3c64xx/mach-smdk6400.c
@@ -36,6 +36,7 @@
 #include <plat/devs.h>
 #include <plat/cpu.h>
 #include <linux/platform_data/i2c-s3c2410.h>
+#include <plat/samsung-time.h>
 
 #include "common.h"
 
@@ -67,6 +68,7 @@ static void __init smdk6400_map_io(void)
 	s3c64xx_init_io(smdk6400_iodesc, ARRAY_SIZE(smdk6400_iodesc));
 	s3c24xx_init_clocks(12000000);
 	s3c24xx_init_uarts(smdk6400_uartcfgs, ARRAY_SIZE(smdk6400_uartcfgs));
+	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
 }
 
 static struct platform_device *smdk6400_devices[] __initdata = {
diff --git a/arch/arm/mach-s3c64xx/mach-smdk6410.c b/arch/arm/mach-s3c64xx/mach-smdk6410.c
index da1a771..d8fe796 100644
--- a/arch/arm/mach-s3c64xx/mach-smdk6410.c
+++ b/arch/arm/mach-s3c64xx/mach-smdk6410.c
@@ -73,6 +73,7 @@
 #include <linux/platform_data/touchscreen-s3c2410.h>
 #include <plat/keypad.h>
 #include <plat/backlight.h>
+#include <plat/samsung-time.h>
 
 #include "common.h"
 
@@ -636,6 +637,7 @@ static void __init smdk6410_map_io(void)
 	s3c64xx_init_io(smdk6410_iodesc, ARRAY_SIZE(smdk6410_iodesc));
 	s3c24xx_init_clocks(12000000);
 	s3c24xx_init_uarts(smdk6410_uartcfgs, ARRAY_SIZE(smdk6410_uartcfgs));
+	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
 
 	/* set the LCD type */
 
diff --git a/arch/arm/mach-s5p64x0/Kconfig b/arch/arm/mach-s5p64x0/Kconfig
index e8742cb..f0ec535 100644
--- a/arch/arm/mach-s5p64x0/Kconfig
+++ b/arch/arm/mach-s5p64x0/Kconfig
@@ -9,7 +9,7 @@ if ARCH_S5P64X0
 
 config CPU_S5P6440
 	bool
-	select S5P_HRT
+	select SAMSUNG_HRT
 	select S5P_SLEEP if PM
 	select SAMSUNG_DMADEV
 	select SAMSUNG_WAKEMASK if PM
@@ -18,7 +18,7 @@ config CPU_S5P6440
 
 config CPU_S5P6450
 	bool
-	select S5P_HRT
+	select SAMSUNG_HRT
 	select S5P_SLEEP if PM
 	select SAMSUNG_DMADEV
 	select SAMSUNG_WAKEMASK if PM
diff --git a/arch/arm/mach-s5p64x0/mach-smdk6440.c b/arch/arm/mach-s5p64x0/mach-smdk6440.c
index 96ea1fe..35c3fd3 100644
--- a/arch/arm/mach-s5p64x0/mach-smdk6440.c
+++ b/arch/arm/mach-s5p64x0/mach-smdk6440.c
@@ -50,7 +50,7 @@
 #include <plat/pll.h>
 #include <plat/adc.h>
 #include <linux/platform_data/touchscreen-s3c2410.h>
-#include <plat/s5p-time.h>
+#include <plat/samsung-time.h>
 #include <plat/backlight.h>
 #include <plat/fb.h>
 #include <plat/sdhci.h>
@@ -231,7 +231,7 @@ static void __init smdk6440_map_io(void)
 	s5p64x0_init_io(NULL, 0);
 	s3c24xx_init_clocks(12000000);
 	s3c24xx_init_uarts(smdk6440_uartcfgs, ARRAY_SIZE(smdk6440_uartcfgs));
-	s5p_set_timer_source(S5P_PWM3, S5P_PWM4);
+	samsung_set_timer_source(S5P_PWM3, S5P_PWM4);
 }
 
 static void s5p6440_set_lcd_interface(void)
diff --git a/arch/arm/mach-s5p64x0/mach-smdk6450.c b/arch/arm/mach-s5p64x0/mach-smdk6450.c
index 12748b6..b06fa83 100644
--- a/arch/arm/mach-s5p64x0/mach-smdk6450.c
+++ b/arch/arm/mach-s5p64x0/mach-smdk6450.c
@@ -50,7 +50,7 @@
 #include <plat/pll.h>
 #include <plat/adc.h>
 #include <linux/platform_data/touchscreen-s3c2410.h>
-#include <plat/s5p-time.h>
+#include <plat/samsung-time.h>
 #include <plat/backlight.h>
 #include <plat/fb.h>
 #include <plat/sdhci.h>
@@ -250,7 +250,7 @@ static void __init smdk6450_map_io(void)
 	s5p64x0_init_io(NULL, 0);
 	s3c24xx_init_clocks(19200000);
 	s3c24xx_init_uarts(smdk6450_uartcfgs, ARRAY_SIZE(smdk6450_uartcfgs));
-	s5p_set_timer_source(S5P_PWM3, S5P_PWM4);
+	samsung_set_timer_source(S5P_PWM3, S5P_PWM4);
 }
 
 static void s5p6450_set_lcd_interface(void)
diff --git a/arch/arm/mach-s5pv210/Kconfig b/arch/arm/mach-s5pv210/Kconfig
index 92ad72f..01018ef 100644
--- a/arch/arm/mach-s5pv210/Kconfig
+++ b/arch/arm/mach-s5pv210/Kconfig
@@ -12,7 +12,7 @@ if ARCH_S5PV210
 config CPU_S5PV210
 	bool
 	select S5P_EXT_INT
-	select S5P_HRT
+	select SAMSUNG_HRT
 	select S5P_PM if PM
 	select S5P_SLEEP if PM
 	select SAMSUNG_DMADEV
diff --git a/arch/arm/mach-s5pv210/mach-aquila.c b/arch/arm/mach-s5pv210/mach-aquila.c
index ee9fa5c..46b2842 100644
--- a/arch/arm/mach-s5pv210/mach-aquila.c
+++ b/arch/arm/mach-s5pv210/mach-aquila.c
@@ -39,7 +39,7 @@
 #include <plat/fb.h>
 #include <plat/fimc-core.h>
 #include <plat/sdhci.h>
-#include <plat/s5p-time.h>
+#include <plat/samsung-time.h>
 
 #include "common.h"
 
@@ -652,7 +652,7 @@ static void __init aquila_map_io(void)
 	s5pv210_init_io(NULL, 0);
 	s3c24xx_init_clocks(24000000);
 	s3c24xx_init_uarts(aquila_uartcfgs, ARRAY_SIZE(aquila_uartcfgs));
-	s5p_set_timer_source(S5P_PWM3, S5P_PWM4);
+	samsung_set_timer_source(S5P_PWM3, S5P_PWM4);
 }
 
 static void __init aquila_machine_init(void)
diff --git a/arch/arm/mach-s5pv210/mach-goni.c b/arch/arm/mach-s5pv210/mach-goni.c
index 55e1dba..6efcc19 100644
--- a/arch/arm/mach-s5pv210/mach-goni.c
+++ b/arch/arm/mach-s5pv210/mach-goni.c
@@ -48,7 +48,7 @@
 #include <plat/keypad.h>
 #include <plat/sdhci.h>
 #include <plat/clock.h>
-#include <plat/s5p-time.h>
+#include <plat/samsung-time.h>
 #include <plat/mfc.h>
 #include <plat/camport.h>
 
@@ -910,7 +910,7 @@ static void __init goni_map_io(void)
 	s5pv210_init_io(NULL, 0);
 	s3c24xx_init_clocks(clk_xusbxti.rate);
 	s3c24xx_init_uarts(goni_uartcfgs, ARRAY_SIZE(goni_uartcfgs));
-	s5p_set_timer_source(S5P_PWM3, S5P_PWM4);
+	samsung_set_timer_source(S5P_PWM3, S5P_PWM4);
 }
 
 static void __init goni_reserve(void)
diff --git a/arch/arm/mach-s5pv210/mach-smdkc110.c b/arch/arm/mach-s5pv210/mach-smdkc110.c
index d9c99fc..213b3a3 100644
--- a/arch/arm/mach-s5pv210/mach-smdkc110.c
+++ b/arch/arm/mach-s5pv210/mach-smdkc110.c
@@ -30,7 +30,7 @@
 #include <linux/platform_data/ata-samsung_cf.h>
 #include <linux/platform_data/i2c-s3c2410.h>
 #include <plat/pm.h>
-#include <plat/s5p-time.h>
+#include <plat/samsung-time.h>
 #include <plat/mfc.h>
 
 #include "common.h"
@@ -122,7 +122,7 @@ static void __init smdkc110_map_io(void)
 	s5pv210_init_io(NULL, 0);
 	s3c24xx_init_clocks(24000000);
 	s3c24xx_init_uarts(smdkv210_uartcfgs, ARRAY_SIZE(smdkv210_uartcfgs));
-	s5p_set_timer_source(S5P_PWM3, S5P_PWM4);
+	samsung_set_timer_source(S5P_PWM3, S5P_PWM4);
 }
 
 static void __init smdkc110_reserve(void)
diff --git a/arch/arm/mach-s5pv210/mach-smdkv210.c b/arch/arm/mach-s5pv210/mach-smdkv210.c
index 4cdb5bb..00806de 100644
--- a/arch/arm/mach-s5pv210/mach-smdkv210.c
+++ b/arch/arm/mach-s5pv210/mach-smdkv210.c
@@ -45,7 +45,7 @@
 #include <plat/keypad.h>
 #include <plat/pm.h>
 #include <plat/fb.h>
-#include <plat/s5p-time.h>
+#include <plat/samsung-time.h>
 #include <plat/backlight.h>
 #include <plat/mfc.h>
 #include <plat/clock.h>
@@ -287,7 +287,7 @@ static void __init smdkv210_map_io(void)
 	s5pv210_init_io(NULL, 0);
 	s3c24xx_init_clocks(clk_xusbxti.rate);
 	s3c24xx_init_uarts(smdkv210_uartcfgs, ARRAY_SIZE(smdkv210_uartcfgs));
-	s5p_set_timer_source(S5P_PWM2, S5P_PWM4);
+	samsung_set_timer_source(S5P_PWM2, S5P_PWM4);
 }
 
 static void __init smdkv210_reserve(void)
diff --git a/arch/arm/mach-s5pv210/mach-torbreck.c b/arch/arm/mach-s5pv210/mach-torbreck.c
index 18785cb..1b01f05 100644
--- a/arch/arm/mach-s5pv210/mach-torbreck.c
+++ b/arch/arm/mach-s5pv210/mach-torbreck.c
@@ -27,7 +27,7 @@
 #include <plat/devs.h>
 #include <plat/cpu.h>
 #include <linux/platform_data/i2c-s3c2410.h>
-#include <plat/s5p-time.h>
+#include <plat/samsung-time.h>
 
 #include "common.h"
 
@@ -107,7 +107,7 @@ static void __init torbreck_map_io(void)
 	s5pv210_init_io(NULL, 0);
 	s3c24xx_init_clocks(24000000);
 	s3c24xx_init_uarts(torbreck_uartcfgs, ARRAY_SIZE(torbreck_uartcfgs));
-	s5p_set_timer_source(S5P_PWM3, S5P_PWM4);
+	samsung_set_timer_source(S5P_PWM3, S5P_PWM4);
 }
 
 static void __init torbreck_machine_init(void)
diff --git a/arch/arm/plat-samsung/Kconfig b/arch/arm/plat-samsung/Kconfig
index 59401e1..5278795 100644
--- a/arch/arm/plat-samsung/Kconfig
+++ b/arch/arm/plat-samsung/Kconfig
@@ -70,7 +70,7 @@ config S3C_LOWLEVEL_UART_PORT
 
 # timer options
 
-config S5P_HRT
+config SAMSUNG_HRT
 	bool
 	select SAMSUNG_DEV_PWM
 	help
diff --git a/arch/arm/plat-samsung/Makefile b/arch/arm/plat-samsung/Makefile
index 9e40e8d..06f2312 100644
--- a/arch/arm/plat-samsung/Makefile
+++ b/arch/arm/plat-samsung/Makefile
@@ -13,7 +13,7 @@ obj-				:=
 
 obj-y				+= init.o cpu.o
 obj-$(CONFIG_ARCH_USES_GETTIMEOFFSET)   += time.o
-obj-$(CONFIG_S5P_HRT) 		+= s5p-time.o
+obj-$(CONFIG_SAMSUNG_HRT) 		+= samsung-time.o
 
 obj-$(CONFIG_SAMSUNG_CLOCK)	+= clock.o
 obj-$(CONFIG_SAMSUNG_CLOCK)	+= pwm-clock.o
diff --git a/arch/arm/plat-samsung/include/plat/s5p-time.h b/arch/arm/plat-samsung/include/plat/s5p-time.h
deleted file mode 100644
index 3a70aeb..0000000
--- a/arch/arm/plat-samsung/include/plat/s5p-time.h
+++ /dev/null
@@ -1,40 +0,0 @@
-/* linux/arch/arm/plat-samsung/include/plat/s5p-time.h
- *
- * Copyright 2011 Samsung Electronics Co., Ltd.
- *		http://www.samsung.com/
- *
- * Header file for s5p time support
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
-*/
-
-#ifndef __ASM_PLAT_S5P_TIME_H
-#define __ASM_PLAT_S5P_TIME_H __FILE__
-
-/* S5P HR-Timer Clock mode */
-enum s5p_timer_mode {
-	S5P_PWM0,
-	S5P_PWM1,
-	S5P_PWM2,
-	S5P_PWM3,
-	S5P_PWM4,
-};
-
-struct s5p_timer_source {
-	unsigned int event_id;
-	unsigned int source_id;
-};
-
-/* Be able to sleep for atleast 4 seconds (usually more) */
-#define S5PTIMER_MIN_RANGE	4
-
-#define TCNT_MAX		0xffffffff
-#define NON_PERIODIC		0
-#define PERIODIC		1
-
-extern void __init s5p_set_timer_source(enum s5p_timer_mode event,
-					enum s5p_timer_mode source);
-extern	struct sys_timer s5p_timer;
-#endif /* __ASM_PLAT_S5P_TIME_H */
diff --git a/arch/arm/plat-samsung/include/plat/samsung-time.h b/arch/arm/plat-samsung/include/plat/samsung-time.h
new file mode 100644
index 0000000..d3d1c81
--- /dev/null
+++ b/arch/arm/plat-samsung/include/plat/samsung-time.h
@@ -0,0 +1,51 @@
+/* linux/arch/arm/plat-samsung/include/plat/samsung-time.h
+ *
+ * Copyright 2011 Samsung Electronics Co., Ltd.
+ *		http://www.samsung.com/
+ *
+ * Header file for samsung time support
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+*/
+
+#ifndef __ASM_PLAT_SAMSUNG_TIME_H
+#define __ASM_PLAT_SAMSUNG_TIME_H __FILE__
+
+/* SAMSUNG HR-Timer Clock mode */
+enum samsung_timer_mode {
+	SAMSUNG_PWM0,
+	SAMSUNG_PWM1,
+	SAMSUNG_PWM2,
+	SAMSUNG_PWM3,
+	SAMSUNG_PWM4,
+};
+
+struct samsung_timer_source {
+	unsigned int event_id;
+	unsigned int source_id;
+};
+
+/* Be able to sleep for atleast 4 seconds (usually more) */
+#define SAMSUNG_TIMER_MIN_RANGE	4
+
+#ifdef CONFIG_ARCH_S3C24XX
+#define TCNT_MAX		0xffff
+#define TSCALER_DIV		25
+#define TDIV			50
+#define TSIZE			16
+#else
+#define TCNT_MAX		0xffffffff
+#define TSCALER_DIV		2
+#define TDIV			2
+#define TSIZE			32
+#endif
+
+#define NON_PERIODIC		0
+#define PERIODIC		1
+
+extern void __init samsung_set_timer_source(enum samsung_timer_mode event,
+					enum samsung_timer_mode source);
+extern	struct sys_timer samsung_timer;
+#endif /* __ASM_PLAT_SAMSUNG_TIME_H */
diff --git a/arch/arm/plat-samsung/s5p-time.c b/arch/arm/plat-samsung/s5p-time.c
deleted file mode 100644
index 028b6e8..0000000
--- a/arch/arm/plat-samsung/s5p-time.c
+++ /dev/null
@@ -1,405 +0,0 @@
-/*
- * Copyright (c) 2011 Samsung Electronics Co., Ltd.
- *		http://www.samsung.com/
- *
- * S5P - Common hr-timer support
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
-*/
-
-#include <linux/interrupt.h>
-#include <linux/irq.h>
-#include <linux/err.h>
-#include <linux/clk.h>
-#include <linux/clockchips.h>
-#include <linux/platform_device.h>
-
-#include <asm/smp_twd.h>
-#include <asm/mach/time.h>
-#include <asm/mach/arch.h>
-#include <asm/mach/map.h>
-#include <asm/sched_clock.h>
-
-#include <mach/map.h>
-#include <plat/devs.h>
-#include <plat/regs-timer.h>
-#include <plat/s5p-time.h>
-
-static struct clk *tin_event;
-static struct clk *tin_source;
-static struct clk *tdiv_event;
-static struct clk *tdiv_source;
-static struct clk *timerclk;
-static struct s5p_timer_source timer_source;
-static unsigned long clock_count_per_tick;
-static void s5p_timer_resume(void);
-
-static void s5p_time_stop(enum s5p_timer_mode mode)
-{
-	unsigned long tcon;
-
-	tcon = __raw_readl(S3C2410_TCON);
-
-	switch (mode) {
-	case S5P_PWM0:
-		tcon &= ~S3C2410_TCON_T0START;
-		break;
-
-	case S5P_PWM1:
-		tcon &= ~S3C2410_TCON_T1START;
-		break;
-
-	case S5P_PWM2:
-		tcon &= ~S3C2410_TCON_T2START;
-		break;
-
-	case S5P_PWM3:
-		tcon &= ~S3C2410_TCON_T3START;
-		break;
-
-	case S5P_PWM4:
-		tcon &= ~S3C2410_TCON_T4START;
-		break;
-
-	default:
-		printk(KERN_ERR "Invalid Timer %d\n", mode);
-		break;
-	}
-	__raw_writel(tcon, S3C2410_TCON);
-}
-
-static void s5p_time_setup(enum s5p_timer_mode mode, unsigned long tcnt)
-{
-	unsigned long tcon;
-
-	tcon = __raw_readl(S3C2410_TCON);
-
-	tcnt--;
-
-	switch (mode) {
-	case S5P_PWM0:
-		tcon &= ~(0x0f << 0);
-		tcon |= S3C2410_TCON_T0MANUALUPD;
-		break;
-
-	case S5P_PWM1:
-		tcon &= ~(0x0f << 8);
-		tcon |= S3C2410_TCON_T1MANUALUPD;
-		break;
-
-	case S5P_PWM2:
-		tcon &= ~(0x0f << 12);
-		tcon |= S3C2410_TCON_T2MANUALUPD;
-		break;
-
-	case S5P_PWM3:
-		tcon &= ~(0x0f << 16);
-		tcon |= S3C2410_TCON_T3MANUALUPD;
-		break;
-
-	case S5P_PWM4:
-		tcon &= ~(0x07 << 20);
-		tcon |= S3C2410_TCON_T4MANUALUPD;
-		break;
-
-	default:
-		printk(KERN_ERR "Invalid Timer %d\n", mode);
-		break;
-	}
-
-	__raw_writel(tcnt, S3C2410_TCNTB(mode));
-	__raw_writel(tcnt, S3C2410_TCMPB(mode));
-	__raw_writel(tcon, S3C2410_TCON);
-}
-
-static void s5p_time_start(enum s5p_timer_mode mode, bool periodic)
-{
-	unsigned long tcon;
-
-	tcon  = __raw_readl(S3C2410_TCON);
-
-	switch (mode) {
-	case S5P_PWM0:
-		tcon |= S3C2410_TCON_T0START;
-		tcon &= ~S3C2410_TCON_T0MANUALUPD;
-
-		if (periodic)
-			tcon |= S3C2410_TCON_T0RELOAD;
-		else
-			tcon &= ~S3C2410_TCON_T0RELOAD;
-		break;
-
-	case S5P_PWM1:
-		tcon |= S3C2410_TCON_T1START;
-		tcon &= ~S3C2410_TCON_T1MANUALUPD;
-
-		if (periodic)
-			tcon |= S3C2410_TCON_T1RELOAD;
-		else
-			tcon &= ~S3C2410_TCON_T1RELOAD;
-		break;
-
-	case S5P_PWM2:
-		tcon |= S3C2410_TCON_T2START;
-		tcon &= ~S3C2410_TCON_T2MANUALUPD;
-
-		if (periodic)
-			tcon |= S3C2410_TCON_T2RELOAD;
-		else
-			tcon &= ~S3C2410_TCON_T2RELOAD;
-		break;
-
-	case S5P_PWM3:
-		tcon |= S3C2410_TCON_T3START;
-		tcon &= ~S3C2410_TCON_T3MANUALUPD;
-
-		if (periodic)
-			tcon |= S3C2410_TCON_T3RELOAD;
-		else
-			tcon &= ~S3C2410_TCON_T3RELOAD;
-		break;
-
-	case S5P_PWM4:
-		tcon |= S3C2410_TCON_T4START;
-		tcon &= ~S3C2410_TCON_T4MANUALUPD;
-
-		if (periodic)
-			tcon |= S3C2410_TCON_T4RELOAD;
-		else
-			tcon &= ~S3C2410_TCON_T4RELOAD;
-		break;
-
-	default:
-		printk(KERN_ERR "Invalid Timer %d\n", mode);
-		break;
-	}
-	__raw_writel(tcon, S3C2410_TCON);
-}
-
-static int s5p_set_next_event(unsigned long cycles,
-				struct clock_event_device *evt)
-{
-	s5p_time_setup(timer_source.event_id, cycles);
-	s5p_time_start(timer_source.event_id, NON_PERIODIC);
-
-	return 0;
-}
-
-static void s5p_set_mode(enum clock_event_mode mode,
-				struct clock_event_device *evt)
-{
-	s5p_time_stop(timer_source.event_id);
-
-	switch (mode) {
-	case CLOCK_EVT_MODE_PERIODIC:
-		s5p_time_setup(timer_source.event_id, clock_count_per_tick);
-		s5p_time_start(timer_source.event_id, PERIODIC);
-		break;
-
-	case CLOCK_EVT_MODE_ONESHOT:
-		break;
-
-	case CLOCK_EVT_MODE_UNUSED:
-	case CLOCK_EVT_MODE_SHUTDOWN:
-		break;
-
-	case CLOCK_EVT_MODE_RESUME:
-		s5p_timer_resume();
-		break;
-	}
-}
-
-static void s5p_timer_resume(void)
-{
-	/* event timer restart */
-	s5p_time_setup(timer_source.event_id, clock_count_per_tick);
-	s5p_time_start(timer_source.event_id, PERIODIC);
-
-	/* source timer restart */
-	s5p_time_setup(timer_source.source_id, TCNT_MAX);
-	s5p_time_start(timer_source.source_id, PERIODIC);
-}
-
-void __init s5p_set_timer_source(enum s5p_timer_mode event,
-				 enum s5p_timer_mode source)
-{
-	s3c_device_timer[event].dev.bus = &platform_bus_type;
-	s3c_device_timer[source].dev.bus = &platform_bus_type;
-
-	timer_source.event_id = event;
-	timer_source.source_id = source;
-}
-
-static struct clock_event_device time_event_device = {
-	.name		= "s5p_event_timer",
-	.features	= CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT,
-	.rating		= 200,
-	.set_next_event	= s5p_set_next_event,
-	.set_mode	= s5p_set_mode,
-};
-
-static irqreturn_t s5p_clock_event_isr(int irq, void *dev_id)
-{
-	struct clock_event_device *evt = dev_id;
-
-	evt->event_handler(evt);
-
-	return IRQ_HANDLED;
-}
-
-static struct irqaction s5p_clock_event_irq = {
-	.name		= "s5p_time_irq",
-	.flags		= IRQF_DISABLED | IRQF_TIMER | IRQF_IRQPOLL,
-	.handler	= s5p_clock_event_isr,
-	.dev_id		= &time_event_device,
-};
-
-static void __init s5p_clockevent_init(void)
-{
-	unsigned long pclk;
-	unsigned long clock_rate;
-	unsigned int irq_number;
-	struct clk *tscaler;
-
-	pclk = clk_get_rate(timerclk);
-
-	tscaler = clk_get_parent(tdiv_event);
-
-	clk_set_rate(tscaler, pclk / 2);
-	clk_set_rate(tdiv_event, pclk / 2);
-	clk_set_parent(tin_event, tdiv_event);
-
-	clock_rate = clk_get_rate(tin_event);
-	clock_count_per_tick = clock_rate / HZ;
-
-	clockevents_calc_mult_shift(&time_event_device,
-				    clock_rate, S5PTIMER_MIN_RANGE);
-	time_event_device.max_delta_ns =
-		clockevent_delta2ns(-1, &time_event_device);
-	time_event_device.min_delta_ns =
-		clockevent_delta2ns(1, &time_event_device);
-
-	time_event_device.cpumask = cpumask_of(0);
-	clockevents_register_device(&time_event_device);
-
-	irq_number = timer_source.event_id + IRQ_TIMER0;
-	setup_irq(irq_number, &s5p_clock_event_irq);
-}
-
-static void __iomem *s5p_timer_reg(void)
-{
-	unsigned long offset = 0;
-
-	switch (timer_source.source_id) {
-	case S5P_PWM0:
-	case S5P_PWM1:
-	case S5P_PWM2:
-	case S5P_PWM3:
-		offset = (timer_source.source_id * 0x0c) + 0x14;
-		break;
-
-	case S5P_PWM4:
-		offset = 0x40;
-		break;
-
-	default:
-		printk(KERN_ERR "Invalid Timer %d\n", timer_source.source_id);
-		return NULL;
-	}
-
-	return S3C_TIMERREG(offset);
-}
-
-/*
- * Override the global weak sched_clock symbol with this
- * local implementation which uses the clocksource to get some
- * better resolution when scheduling the kernel. We accept that
- * this wraps around for now, since it is just a relative time
- * stamp. (Inspired by U300 implementation.)
- */
-static u32 notrace s5p_read_sched_clock(void)
-{
-	void __iomem *reg = s5p_timer_reg();
-
-	if (!reg)
-		return 0;
-
-	return ~__raw_readl(reg);
-}
-
-static void __init s5p_clocksource_init(void)
-{
-	unsigned long pclk;
-	unsigned long clock_rate;
-
-	pclk = clk_get_rate(timerclk);
-
-	clk_set_rate(tdiv_source, pclk / 2);
-	clk_set_parent(tin_source, tdiv_source);
-
-	clock_rate = clk_get_rate(tin_source);
-
-	s5p_time_setup(timer_source.source_id, TCNT_MAX);
-	s5p_time_start(timer_source.source_id, PERIODIC);
-
-	setup_sched_clock(s5p_read_sched_clock, 32, clock_rate);
-
-	if (clocksource_mmio_init(s5p_timer_reg(), "s5p_clocksource_timer",
-			clock_rate, 250, 32, clocksource_mmio_readl_down))
-		panic("s5p_clocksource_timer: can't register clocksource\n");
-}
-
-static void __init s5p_timer_resources(void)
-{
-
-	unsigned long event_id = timer_source.event_id;
-	unsigned long source_id = timer_source.source_id;
-	char devname[15];
-
-	timerclk = clk_get(NULL, "timers");
-	if (IS_ERR(timerclk))
-		panic("failed to get timers clock for timer");
-
-	clk_enable(timerclk);
-
-	sprintf(devname, "s3c24xx-pwm.%lu", event_id);
-	s3c_device_timer[event_id].id = event_id;
-	s3c_device_timer[event_id].dev.init_name = devname;
-
-	tin_event = clk_get(&s3c_device_timer[event_id].dev, "pwm-tin");
-	if (IS_ERR(tin_event))
-		panic("failed to get pwm-tin clock for event timer");
-
-	tdiv_event = clk_get(&s3c_device_timer[event_id].dev, "pwm-tdiv");
-	if (IS_ERR(tdiv_event))
-		panic("failed to get pwm-tdiv clock for event timer");
-
-	clk_enable(tin_event);
-
-	sprintf(devname, "s3c24xx-pwm.%lu", source_id);
-	s3c_device_timer[source_id].id = source_id;
-	s3c_device_timer[source_id].dev.init_name = devname;
-
-	tin_source = clk_get(&s3c_device_timer[source_id].dev, "pwm-tin");
-	if (IS_ERR(tin_source))
-		panic("failed to get pwm-tin clock for source timer");
-
-	tdiv_source = clk_get(&s3c_device_timer[source_id].dev, "pwm-tdiv");
-	if (IS_ERR(tdiv_source))
-		panic("failed to get pwm-tdiv clock for source timer");
-
-	clk_enable(tin_source);
-}
-
-static void __init s5p_timer_init(void)
-{
-	s5p_timer_resources();
-	s5p_clockevent_init();
-	s5p_clocksource_init();
-}
-
-struct sys_timer s5p_timer = {
-	.init		= s5p_timer_init,
-};
diff --git a/arch/arm/plat-samsung/samsung-time.c b/arch/arm/plat-samsung/samsung-time.c
new file mode 100644
index 0000000..6d63fca
--- /dev/null
+++ b/arch/arm/plat-samsung/samsung-time.c
@@ -0,0 +1,405 @@
+/*
+ * Copyright (c) 2011 Samsung Electronics Co., Ltd.
+ *		http://www.samsung.com/
+ *
+ * samsung - Common hr-timer support (s3c and s5p)
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+*/
+
+#include <linux/interrupt.h>
+#include <linux/irq.h>
+#include <linux/err.h>
+#include <linux/clk.h>
+#include <linux/clockchips.h>
+#include <linux/platform_device.h>
+
+#include <asm/smp_twd.h>
+#include <asm/mach/time.h>
+#include <asm/mach/arch.h>
+#include <asm/mach/map.h>
+#include <asm/sched_clock.h>
+
+#include <mach/map.h>
+#include <plat/devs.h>
+#include <plat/regs-timer.h>
+#include <plat/samsung-time.h>
+
+static struct clk *tin_event;
+static struct clk *tin_source;
+static struct clk *tdiv_event;
+static struct clk *tdiv_source;
+static struct clk *timerclk;
+static struct samsung_timer_source timer_source;
+static unsigned long clock_count_per_tick;
+static void samsung_timer_resume(void);
+
+static void samsung_time_stop(enum samsung_timer_mode mode)
+{
+	unsigned long tcon;
+
+	tcon = __raw_readl(S3C2410_TCON);
+
+	switch (mode) {
+	case SAMSUNG_PWM0:
+		tcon &= ~S3C2410_TCON_T0START;
+		break;
+
+	case SAMSUNG_PWM1:
+		tcon &= ~S3C2410_TCON_T1START;
+		break;
+
+	case SAMSUNG_PWM2:
+		tcon &= ~S3C2410_TCON_T2START;
+		break;
+
+	case SAMSUNG_PWM3:
+		tcon &= ~S3C2410_TCON_T3START;
+		break;
+
+	case SAMSUNG_PWM4:
+		tcon &= ~S3C2410_TCON_T4START;
+		break;
+
+	default:
+		printk(KERN_ERR "Invalid Timer %d\n", mode);
+		break;
+	}
+	__raw_writel(tcon, S3C2410_TCON);
+}
+
+static void samsung_time_setup(enum samsung_timer_mode mode, unsigned long tcnt)
+{
+	unsigned long tcon;
+
+	tcon = __raw_readl(S3C2410_TCON);
+
+	tcnt--;
+
+	switch (mode) {
+	case SAMSUNG_PWM0:
+		tcon &= ~(0x0f << 0);
+		tcon |= S3C2410_TCON_T0MANUALUPD;
+		break;
+
+	case SAMSUNG_PWM1:
+		tcon &= ~(0x0f << 8);
+		tcon |= S3C2410_TCON_T1MANUALUPD;
+		break;
+
+	case SAMSUNG_PWM2:
+		tcon &= ~(0x0f << 12);
+		tcon |= S3C2410_TCON_T2MANUALUPD;
+		break;
+
+	case SAMSUNG_PWM3:
+		tcon &= ~(0x0f << 16);
+		tcon |= S3C2410_TCON_T3MANUALUPD;
+		break;
+
+	case SAMSUNG_PWM4:
+		tcon &= ~(0x07 << 20);
+		tcon |= S3C2410_TCON_T4MANUALUPD;
+		break;
+
+	default:
+		printk(KERN_ERR "Invalid Timer %d\n", mode);
+		break;
+	}
+
+	__raw_writel(tcnt, S3C2410_TCNTB(mode));
+	__raw_writel(tcnt, S3C2410_TCMPB(mode));
+	__raw_writel(tcon, S3C2410_TCON);
+}
+
+static void samsung_time_start(enum samsung_timer_mode mode, bool periodic)
+{
+	unsigned long tcon;
+
+	tcon  = __raw_readl(S3C2410_TCON);
+
+	switch (mode) {
+	case SAMSUNG_PWM0:
+		tcon |= S3C2410_TCON_T0START;
+		tcon &= ~S3C2410_TCON_T0MANUALUPD;
+
+		if (periodic)
+			tcon |= S3C2410_TCON_T0RELOAD;
+		else
+			tcon &= ~S3C2410_TCON_T0RELOAD;
+		break;
+
+	case SAMSUNG_PWM1:
+		tcon |= S3C2410_TCON_T1START;
+		tcon &= ~S3C2410_TCON_T1MANUALUPD;
+
+		if (periodic)
+			tcon |= S3C2410_TCON_T1RELOAD;
+		else
+			tcon &= ~S3C2410_TCON_T1RELOAD;
+		break;
+
+	case SAMSUNG_PWM2:
+		tcon |= S3C2410_TCON_T2START;
+		tcon &= ~S3C2410_TCON_T2MANUALUPD;
+
+		if (periodic)
+			tcon |= S3C2410_TCON_T2RELOAD;
+		else
+			tcon &= ~S3C2410_TCON_T2RELOAD;
+		break;
+
+	case SAMSUNG_PWM3:
+		tcon |= S3C2410_TCON_T3START;
+		tcon &= ~S3C2410_TCON_T3MANUALUPD;
+
+		if (periodic)
+			tcon |= S3C2410_TCON_T3RELOAD;
+		else
+			tcon &= ~S3C2410_TCON_T3RELOAD;
+		break;
+
+	case SAMSUNG_PWM4:
+		tcon |= S3C2410_TCON_T4START;
+		tcon &= ~S3C2410_TCON_T4MANUALUPD;
+
+		if (periodic)
+			tcon |= S3C2410_TCON_T4RELOAD;
+		else
+			tcon &= ~S3C2410_TCON_T4RELOAD;
+		break;
+
+	default:
+		printk(KERN_ERR "Invalid Timer %d\n", mode);
+		break;
+	}
+	__raw_writel(tcon, S3C2410_TCON);
+}
+
+static int samsung_set_next_event(unsigned long cycles,
+				struct clock_event_device *evt)
+{
+	samsung_time_setup(timer_source.event_id, cycles);
+	samsung_time_start(timer_source.event_id, NON_PERIODIC);
+
+	return 0;
+}
+
+static void samsung_set_mode(enum clock_event_mode mode,
+				struct clock_event_device *evt)
+{
+	samsung_time_stop(timer_source.event_id);
+
+	switch (mode) {
+	case CLOCK_EVT_MODE_PERIODIC:
+		samsung_time_setup(timer_source.event_id, clock_count_per_tick);
+		samsung_time_start(timer_source.event_id, PERIODIC);
+		break;
+
+	case CLOCK_EVT_MODE_ONESHOT:
+		break;
+
+	case CLOCK_EVT_MODE_UNUSED:
+	case CLOCK_EVT_MODE_SHUTDOWN:
+		break;
+
+	case CLOCK_EVT_MODE_RESUME:
+		samsung_timer_resume();
+		break;
+	}
+}
+
+static void samsung_timer_resume(void)
+{
+	/* event timer restart */
+	samsung_time_setup(timer_source.event_id, clock_count_per_tick);
+	samsung_time_start(timer_source.event_id, PERIODIC);
+
+	/* source timer restart */
+	samsung_time_setup(timer_source.source_id, TCNT_MAX);
+	samsung_time_start(timer_source.source_id, PERIODIC);
+}
+
+void __init samsung_set_timer_source(enum samsung_timer_mode event,
+				 enum samsung_timer_mode source)
+{
+	s3c_device_timer[event].dev.bus = &platform_bus_type;
+	s3c_device_timer[source].dev.bus = &platform_bus_type;
+
+	timer_source.event_id = event;
+	timer_source.source_id = source;
+}
+
+static struct clock_event_device time_event_device = {
+	.name		= "samsung_event_timer",
+	.features	= CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT,
+	.rating		= 200,
+	.set_next_event	= samsung_set_next_event,
+	.set_mode	= samsung_set_mode,
+};
+
+static irqreturn_t samsung_clock_event_isr(int irq, void *dev_id)
+{
+	struct clock_event_device *evt = dev_id;
+
+	evt->event_handler(evt);
+
+	return IRQ_HANDLED;
+}
+
+static struct irqaction samsung_clock_event_irq = {
+	.name		= "samsung_time_irq",
+	.flags		= IRQF_DISABLED | IRQF_TIMER | IRQF_IRQPOLL,
+	.handler	= samsung_clock_event_isr,
+	.dev_id		= &time_event_device,
+};
+
+static void __init samsung_clockevent_init(void)
+{
+	unsigned long pclk;
+	unsigned long clock_rate;
+	unsigned int irq_number;
+	struct clk *tscaler;
+
+	pclk = clk_get_rate(timerclk);
+
+	tscaler = clk_get_parent(tdiv_event);
+
+	clk_set_rate(tscaler, pclk / TSCALER_DIV);
+	clk_set_rate(tdiv_event, pclk / TDIV);
+	clk_set_parent(tin_event, tdiv_event);
+
+	clock_rate = clk_get_rate(tin_event);
+	clock_count_per_tick = clock_rate / HZ;
+
+	clockevents_calc_mult_shift(&time_event_device,
+				    clock_rate, SAMSUNG_TIMER_MIN_RANGE);
+	time_event_device.max_delta_ns =
+		clockevent_delta2ns(-1, &time_event_device);
+	time_event_device.min_delta_ns =
+		clockevent_delta2ns(1, &time_event_device);
+
+	time_event_device.cpumask = cpumask_of(0);
+	clockevents_register_device(&time_event_device);
+
+	irq_number = timer_source.event_id + IRQ_TIMER0;
+	setup_irq(irq_number, &samsung_clock_event_irq);
+}
+
+static void __iomem *samsung_timer_reg(void)
+{
+	unsigned long offset = 0;
+
+	switch (timer_source.source_id) {
+	case SAMSUNG_PWM0:
+	case SAMSUNG_PWM1:
+	case SAMSUNG_PWM2:
+	case SAMSUNG_PWM3:
+		offset = (timer_source.source_id * 0x0c) + 0x14;
+		break;
+
+	case SAMSUNG_PWM4:
+		offset = 0x40;
+		break;
+
+	default:
+		printk(KERN_ERR "Invalid Timer %d\n", timer_source.source_id);
+		return NULL;
+	}
+
+	return S3C_TIMERREG(offset);
+}
+
+/*
+ * Override the global weak sched_clock symbol with this
+ * local implementation which uses the clocksource to get some
+ * better resolution when scheduling the kernel. We accept that
+ * this wraps around for now, since it is just a relative time
+ * stamp. (Inspired by U300 implementation.)
+ */
+static u32 notrace samsung_read_sched_clock(void)
+{
+	void __iomem *reg = samsung_timer_reg();
+
+	if (!reg)
+		return 0;
+
+	return ~__raw_readl(reg);
+}
+
+static void __init samsung_clocksource_init(void)
+{
+	unsigned long pclk;
+	unsigned long clock_rate;
+
+	pclk = clk_get_rate(timerclk);
+
+	clk_set_rate(tdiv_source, pclk / TDIV);
+	clk_set_parent(tin_source, tdiv_source);
+
+	clock_rate = clk_get_rate(tin_source);
+
+	samsung_time_setup(timer_source.source_id, TCNT_MAX);
+	samsung_time_start(timer_source.source_id, PERIODIC);
+
+	setup_sched_clock(samsung_read_sched_clock, TSIZE, clock_rate);
+
+	if (clocksource_mmio_init(samsung_timer_reg(), "samsung_clocksource_timer",
+			clock_rate, 250, TSIZE, clocksource_mmio_readl_down))
+		panic("samsung_clocksource_timer: can't register clocksource\n");
+}
+
+static void __init samsung_timer_resources(void)
+{
+
+	unsigned long event_id = timer_source.event_id;
+	unsigned long source_id = timer_source.source_id;
+	char devname[15];
+
+	timerclk = clk_get(NULL, "timers");
+	if (IS_ERR(timerclk))
+		panic("failed to get timers clock for timer");
+
+	clk_enable(timerclk);
+
+	sprintf(devname, "s3c24xx-pwm.%lu", event_id);
+	s3c_device_timer[event_id].id = event_id;
+	s3c_device_timer[event_id].dev.init_name = devname;
+
+	tin_event = clk_get(&s3c_device_timer[event_id].dev, "pwm-tin");
+	if (IS_ERR(tin_event))
+		panic("failed to get pwm-tin clock for event timer");
+
+	tdiv_event = clk_get(&s3c_device_timer[event_id].dev, "pwm-tdiv");
+	if (IS_ERR(tdiv_event))
+		panic("failed to get pwm-tdiv clock for event timer");
+
+	clk_enable(tin_event);
+
+	sprintf(devname, "s3c24xx-pwm.%lu", source_id);
+	s3c_device_timer[source_id].id = source_id;
+	s3c_device_timer[source_id].dev.init_name = devname;
+
+	tin_source = clk_get(&s3c_device_timer[source_id].dev, "pwm-tin");
+	if (IS_ERR(tin_source))
+		panic("failed to get pwm-tin clock for source timer");
+
+	tdiv_source = clk_get(&s3c_device_timer[source_id].dev, "pwm-tdiv");
+	if (IS_ERR(tdiv_source))
+		panic("failed to get pwm-tdiv clock for source timer");
+
+	clk_enable(tin_source);
+}
+
+static void __init samsung_timer_init(void)
+{
+	samsung_timer_resources();
+	samsung_clockevent_init();
+	samsung_clocksource_init();
+}
+
+struct sys_timer samsung_timer = {
+	.init		= samsung_timer_init,
+};
-- 
1.8.0

^ permalink raw reply related	[flat|nested] 39+ messages in thread

* RE: [PATCH] S3C24XX: add clockevent/clocksource support
  2012-10-26 10:51   ` Romain Naour
@ 2012-11-23  2:30     ` Kukjin Kim
  2012-11-25  2:54       ` Romain Naour
  0 siblings, 1 reply; 39+ messages in thread
From: Kukjin Kim @ 2012-11-23  2:30 UTC (permalink / raw)
  To: 'Romain Naour', 'Tomasz Figa'
  Cc: linux-samsung-soc, ben-linux, 'Heiko Stübner',
	'Sylwester Nawrocki'

Romain Naour wrote:
> 

[...]

Basically, looks good to me but need to edit commit message :-)

And since this touches many files so would be better if this could be
applied early -rc not now. It can provide more time to test for many boards.
Is it ok to you?

Thanks.

Best regards,
Kgene.
--
Kukjin Kim <kgene.kim@samsung.com>, Senior Engineer,
SW Solution Development Team, Samsung Electronics Co., Ltd.

> Here is the new patch:
> 
> ---
>  arch/arm/Kconfig                                  |   6 +-
>  arch/arm/mach-exynos/mach-universal_c210.c        |   4 +-
>  arch/arm/mach-s3c24xx/Kconfig                     |   6 +
>  arch/arm/mach-s3c24xx/mach-amlm5900.c             |   3 +
>  arch/arm/mach-s3c24xx/mach-anubis.c               |   2 +
>  arch/arm/mach-s3c24xx/mach-at2440evb.c            |   2 +
>  arch/arm/mach-s3c24xx/mach-bast.c                 |   2 +
>  arch/arm/mach-s3c24xx/mach-gta02.c                |   2 +
>  arch/arm/mach-s3c24xx/mach-h1940.c                |   2 +
>  arch/arm/mach-s3c24xx/mach-jive.c                 |   2 +
>  arch/arm/mach-s3c24xx/mach-mini2440.c             |   4 +-
>  arch/arm/mach-s3c24xx/mach-n30.c                  |   2 +
>  arch/arm/mach-s3c24xx/mach-nexcoder.c             |   2 +
>  arch/arm/mach-s3c24xx/mach-osiris.c               |   2 +
>  arch/arm/mach-s3c24xx/mach-otom.c                 |   2 +
>  arch/arm/mach-s3c24xx/mach-qt2410.c               |   2 +
>  arch/arm/mach-s3c24xx/mach-rx1950.c               |   2 +
>  arch/arm/mach-s3c24xx/mach-rx3715.c               |   2 +
>  arch/arm/mach-s3c24xx/mach-smdk2410.c             |   2 +
>  arch/arm/mach-s3c24xx/mach-smdk2413.c             |   2 +
>  arch/arm/mach-s3c24xx/mach-smdk2416.c             |   2 +
>  arch/arm/mach-s3c24xx/mach-smdk2440.c             |   2 +
>  arch/arm/mach-s3c24xx/mach-smdk2443.c             |   2 +
>  arch/arm/mach-s3c24xx/mach-tct_hammer.c           |   2 +
>  arch/arm/mach-s3c24xx/mach-vr1000.c               |   2 +
>  arch/arm/mach-s3c24xx/mach-vstms.c                |   3 +-
>  arch/arm/mach-s3c64xx/mach-anw6410.c              |   2 +
>  arch/arm/mach-s3c64xx/mach-crag6410.c             |   2 +
>  arch/arm/mach-s3c64xx/mach-hmt.c                  |   2 +
>  arch/arm/mach-s3c64xx/mach-mini6410.c             |   2 +
>  arch/arm/mach-s3c64xx/mach-ncp.c                  |   2 +
>  arch/arm/mach-s3c64xx/mach-real6410.c             |   2 +
>  arch/arm/mach-s3c64xx/mach-smartq.c               |   2 +
>  arch/arm/mach-s3c64xx/mach-smartq5.c              |   1 +
>  arch/arm/mach-s3c64xx/mach-smartq7.c              |   1 +
>  arch/arm/mach-s3c64xx/mach-smdk6400.c             |   2 +
>  arch/arm/mach-s3c64xx/mach-smdk6410.c             |   2 +
>  arch/arm/mach-s5p64x0/Kconfig                     |   4 +-
>  arch/arm/mach-s5p64x0/mach-smdk6440.c             |   4 +-
>  arch/arm/mach-s5p64x0/mach-smdk6450.c             |   4 +-
>  arch/arm/mach-s5pv210/Kconfig                     |   2 +-
>  arch/arm/mach-s5pv210/mach-aquila.c               |   4 +-
>  arch/arm/mach-s5pv210/mach-goni.c                 |   4 +-
>  arch/arm/mach-s5pv210/mach-smdkc110.c             |   4 +-
>  arch/arm/mach-s5pv210/mach-smdkv210.c             |   4 +-
>  arch/arm/mach-s5pv210/mach-torbreck.c             |   4 +-
>  arch/arm/plat-samsung/Kconfig                     |   2 +-
>  arch/arm/plat-samsung/Makefile                    |   2 +-
>  arch/arm/plat-samsung/include/plat/s5p-time.h     |  40 ---
>  arch/arm/plat-samsung/include/plat/samsung-time.h |  51 +++
>  arch/arm/plat-samsung/s5p-time.c                  | 405
---------------------
> -
>  arch/arm/plat-samsung/samsung-time.c              | 405
> ++++++++++++++++++++++
>  52 files changed, 555 insertions(+), 470 deletions(-)
>  delete mode 100644 arch/arm/plat-samsung/include/plat/s5p-time.h
>  create mode 100644 arch/arm/plat-samsung/include/plat/samsung-time.h
>  delete mode 100644 arch/arm/plat-samsung/s5p-time.c
>  create mode 100644 arch/arm/plat-samsung/samsung-time.c
> 
> diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
> index 73067ef..c1ac8a5 100644
> --- a/arch/arm/Kconfig
> +++ b/arch/arm/Kconfig
> @@ -737,7 +737,8 @@ config ARCH_SA1100
>  config ARCH_S3C24XX
>  	bool "Samsung S3C24XX SoCs"
>  	select ARCH_HAS_CPUFREQ
> -	select ARCH_USES_GETTIMEOFFSET
> +	select GENERIC_CLOCKEVENTS
> +	select CLKSRC_MMIO
>  	select CLKDEV_LOOKUP
>  	select GENERIC_GPIO
>  	select HAVE_CLK
> @@ -756,7 +757,8 @@ config ARCH_S3C64XX
>  	bool "Samsung S3C64XX"
>  	select ARCH_HAS_CPUFREQ
>  	select ARCH_REQUIRE_GPIOLIB
> -	select ARCH_USES_GETTIMEOFFSET
> +	select GENERIC_CLOCKEVENTS
> +	select CLKSRC_MMIO
>  	select ARM_VIC
>  	select CLKDEV_LOOKUP
>  	select CPU_V6
> diff --git a/arch/arm/mach-exynos/mach-universal_c210.c b/arch/arm/mach-
> exynos/mach-universal_c210.c
> index ebc9dd3..3b9ec1c 100644
> --- a/arch/arm/mach-exynos/mach-universal_c210.c
> +++ b/arch/arm/mach-exynos/mach-universal_c210.c
> @@ -41,7 +41,7 @@
>  #include <plat/mfc.h>
>  #include <plat/sdhci.h>
>  #include <plat/fimc-core.h>
> -#include <plat/s5p-time.h>
> +#include <plat/samsung-time.h>
>  #include <plat/camport.h>
>  #include <linux/platform_data/mipi-csis.h>
> 
> @@ -1099,7 +1099,7 @@ static void __init universal_map_io(void)
>  	exynos_init_io(NULL, 0);
>  	s3c24xx_init_clocks(clk_xusbxti.rate);
>  	s3c24xx_init_uarts(universal_uartcfgs,
> ARRAY_SIZE(universal_uartcfgs));
> -	s5p_set_timer_source(S5P_PWM2, S5P_PWM4);
> +	samsung_set_timer_source(S5P_PWM2, S5P_PWM4);
>  }
> 
>  static void s5p_tv_setup(void)
> diff --git a/arch/arm/mach-s3c24xx/Kconfig b/arch/arm/mach-s3c24xx/Kconfig
> index 2b6cb5f..be2c482 100644
> --- a/arch/arm/mach-s3c24xx/Kconfig
> +++ b/arch/arm/mach-s3c24xx/Kconfig
> @@ -21,6 +21,7 @@ config CPU_S3C2410
>  	select S3C2410_CLOCK
>  	select S3C2410_CPUFREQ if CPU_FREQ_S3C24XX
>  	select S3C2410_PM if PM
> +	select SAMSUNG_HRT
>  	help
>  	  Support for S3C2410 and S3C2410A family from the S3C24XX line
>  	  of Samsung Mobile CPUs.
> @@ -32,6 +33,7 @@ config CPU_S3C2412
>  	select CPU_LLSERIAL_S3C2440
>  	select S3C2412_DMA if S3C24XX_DMA
>  	select S3C2412_PM if PM
> +	select SAMSUNG_HRT
>  	help
>  	  Support for the S3C2412 and S3C2413 SoCs from the S3C24XX line
> 
> @@ -44,6 +46,7 @@ config CPU_S3C2416
>  	select S3C2443_COMMON
>  	select S3C2443_DMA if S3C24XX_DMA
>  	select SAMSUNG_CLKSRC
> +	select SAMSUNG_HRT
>  	help
>  	  Support for the S3C2416 SoC from the S3C24XX line
> 
> @@ -54,6 +57,7 @@ config CPU_S3C2440
>  	select S3C2410_CLOCK
>  	select S3C2410_PM if PM
>  	select S3C2440_DMA if S3C24XX_DMA
> +	select SAMSUNG_HRT
>  	help
>  	  Support for S3C2440 Samsung Mobile CPU based systems.
> 
> @@ -63,6 +67,7 @@ config CPU_S3C2442
>  	select CPU_LLSERIAL_S3C2440
>  	select S3C2410_CLOCK
>  	select S3C2410_PM if PM
> +	select SAMSUNG_HRT
>  	help
>  	  Support for S3C2442 Samsung Mobile CPU based systems.
> 
> @@ -78,6 +83,7 @@ config CPU_S3C2443
>  	select S3C2443_COMMON
>  	select S3C2443_DMA if S3C24XX_DMA
>  	select SAMSUNG_CLKSRC
> +	select SAMSUNG_HRT
>  	help
>  	  Support for the S3C2443 SoC from the S3C24XX line
> 
> diff --git a/arch/arm/mach-s3c24xx/mach-amlm5900.c b/arch/arm/mach-
> s3c24xx/mach-amlm5900.c
> index f4ad99c..5d5a07c 100644
> --- a/arch/arm/mach-s3c24xx/mach-amlm5900.c
> +++ b/arch/arm/mach-s3c24xx/mach-amlm5900.c
> @@ -63,6 +63,8 @@
>  #include <linux/mtd/map.h>
>  #include <linux/mtd/physmap.h>
> 
> +#include <plat/samsung-time.h>
> +
>  #include "common.h"
> 
>  static struct resource amlm5900_nor_resource =
> @@ -160,6 +162,7 @@ static void __init amlm5900_map_io(void)
>  	s3c24xx_init_io(amlm5900_iodesc, ARRAY_SIZE(amlm5900_iodesc));
>  	s3c24xx_init_clocks(0);
>  	s3c24xx_init_uarts(amlm5900_uartcfgs,
> ARRAY_SIZE(amlm5900_uartcfgs));
> +	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
>  }
> 
>  #ifdef CONFIG_FB_S3C2410
> diff --git a/arch/arm/mach-s3c24xx/mach-anubis.c b/arch/arm/mach-
> s3c24xx/mach-anubis.c
> index 1ee8c46..7d323ed 100644
> --- a/arch/arm/mach-s3c24xx/mach-anubis.c
> +++ b/arch/arm/mach-s3c24xx/mach-anubis.c
> @@ -54,6 +54,7 @@
>  #include <plat/devs.h>
>  #include <plat/cpu.h>
>  #include <linux/platform_data/asoc-s3c24xx_simtec.h>
> +#include <plat/samsung-time.h>
> 
>  #include "simtec.h"
>  #include "common.h"
> @@ -414,6 +415,7 @@ static void __init anubis_map_io(void)
>  	s3c24xx_init_io(anubis_iodesc, ARRAY_SIZE(anubis_iodesc));
>  	s3c24xx_init_clocks(0);
>  	s3c24xx_init_uarts(anubis_uartcfgs, ARRAY_SIZE(anubis_uartcfgs));
> +	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
> 
>  	/* check for the newer revision boards with large page nand */
> 
> diff --git a/arch/arm/mach-s3c24xx/mach-at2440evb.c b/arch/arm/mach-
> s3c24xx/mach-at2440evb.c
> index 00381fe..1e93cb3 100644
> --- a/arch/arm/mach-s3c24xx/mach-at2440evb.c
> +++ b/arch/arm/mach-s3c24xx/mach-at2440evb.c
> @@ -48,6 +48,7 @@
>  #include <plat/devs.h>
>  #include <plat/cpu.h>
>  #include <linux/platform_data/mmc-s3cmci.h>
> +#include <plat/samsung-time.h>
> 
>  #include "common.h"
> 
> @@ -192,6 +193,7 @@ static void __init at2440evb_map_io(void)
>  	s3c24xx_init_io(at2440evb_iodesc, ARRAY_SIZE(at2440evb_iodesc));
>  	s3c24xx_init_clocks(16934400);
>  	s3c24xx_init_uarts(at2440evb_uartcfgs,
> ARRAY_SIZE(at2440evb_uartcfgs));
> +	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
>  }
> 
>  static void __init at2440evb_init(void)
> diff --git a/arch/arm/mach-s3c24xx/mach-bast.c b/arch/arm/mach-
> s3c24xx/mach-bast.c
> index 6a30ce7..be3cc7a 100644
> --- a/arch/arm/mach-s3c24xx/mach-bast.c
> +++ b/arch/arm/mach-s3c24xx/mach-bast.c
> @@ -63,6 +63,7 @@
>  #include <plat/cpu-freq.h>
>  #include <plat/gpio-cfg.h>
>  #include <linux/platform_data/asoc-s3c24xx_simtec.h>
> +#include <plat/samsung-time.h>
> 
>  #include "simtec.h"
>  #include "common.h"
> @@ -583,6 +584,7 @@ static void __init bast_map_io(void)
>  	s3c24xx_init_io(bast_iodesc, ARRAY_SIZE(bast_iodesc));
>  	s3c24xx_init_clocks(0);
>  	s3c24xx_init_uarts(bast_uartcfgs, ARRAY_SIZE(bast_uartcfgs));
> +	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
>  }
> 
>  static void __init bast_init(void)
> diff --git a/arch/arm/mach-s3c24xx/mach-gta02.c b/arch/arm/mach-
> s3c24xx/mach-gta02.c
> index 4a96346..3f83412 100644
> --- a/arch/arm/mach-s3c24xx/mach-gta02.c
> +++ b/arch/arm/mach-s3c24xx/mach-gta02.c
> @@ -88,6 +88,7 @@
>  #include <plat/gpio-cfg.h>
>  #include <linux/platform_data/i2c-s3c2410.h>
>  #include <linux/platform_data/touchscreen-s3c2410.h>
> +#include <plat/samsung-time.h>
> 
>  #include "common.h"
> 
> @@ -507,6 +508,7 @@ static void __init gta02_map_io(void)
>  	s3c24xx_init_io(gta02_iodesc, ARRAY_SIZE(gta02_iodesc));
>  	s3c24xx_init_clocks(12000000);
>  	s3c24xx_init_uarts(gta02_uartcfgs, ARRAY_SIZE(gta02_uartcfgs));
> +	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
>  }
> 
> 
> diff --git a/arch/arm/mach-s3c24xx/mach-h1940.c b/arch/arm/mach-
> s3c24xx/mach-h1940.c
> index 63aaf07..1455779 100644
> --- a/arch/arm/mach-s3c24xx/mach-h1940.c
> +++ b/arch/arm/mach-s3c24xx/mach-h1940.c
> @@ -67,6 +67,7 @@
>  #include <plat/pm.h>
>  #include <linux/platform_data/mmc-s3cmci.h>
>  #include <linux/platform_data/touchscreen-s3c2410.h>
> +#include <plat/samsung-time.h>
> 
>  #include <sound/uda1380.h>
> 
> @@ -652,6 +653,7 @@ static void __init h1940_map_io(void)
>  	s3c24xx_init_io(h1940_iodesc, ARRAY_SIZE(h1940_iodesc));
>  	s3c24xx_init_clocks(0);
>  	s3c24xx_init_uarts(h1940_uartcfgs, ARRAY_SIZE(h1940_uartcfgs));
> +	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
> 
>  	/* setup PM */
> 
> diff --git a/arch/arm/mach-s3c24xx/mach-jive.c b/arch/arm/mach-
> s3c24xx/mach-jive.c
> index c9954e2..9671c42 100644
> --- a/arch/arm/mach-s3c24xx/mach-jive.c
> +++ b/arch/arm/mach-s3c24xx/mach-jive.c
> @@ -55,6 +55,7 @@
>  #include <plat/cpu.h>
>  #include <plat/pm.h>
>  #include <linux/platform_data/usb-s3c2410_udc.h>
> +#include <plat/samsung-time.h>
> 
>  static struct map_desc jive_iodesc[] __initdata = {
>  };
> @@ -506,6 +507,7 @@ static void __init jive_map_io(void)
>  	s3c24xx_init_io(jive_iodesc, ARRAY_SIZE(jive_iodesc));
>  	s3c24xx_init_clocks(12000000);
>  	s3c24xx_init_uarts(jive_uartcfgs, ARRAY_SIZE(jive_uartcfgs));
> +	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
>  }
> 
>  static void jive_power_off(void)
> diff --git a/arch/arm/mach-s3c24xx/mach-mini2440.c b/arch/arm/mach-
> s3c24xx/mach-mini2440.c
> index 393c0f1..a96efcd 100644
> --- a/arch/arm/mach-s3c24xx/mach-mini2440.c
> +++ b/arch/arm/mach-s3c24xx/mach-mini2440.c
> @@ -57,6 +57,7 @@
>  #include <plat/clock.h>
>  #include <plat/devs.h>
>  #include <plat/cpu.h>
> +#include <plat/samsung-time.h>
> 
>  #include <sound/s3c24xx_uda134x.h>
> 
> @@ -527,6 +528,7 @@ static void __init mini2440_map_io(void)
>  	s3c24xx_init_io(mini2440_iodesc, ARRAY_SIZE(mini2440_iodesc));
>  	s3c24xx_init_clocks(12000000);
>  	s3c24xx_init_uarts(mini2440_uartcfgs,
> ARRAY_SIZE(mini2440_uartcfgs));
> +	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
>  }
> 
>  /*
> @@ -689,6 +691,6 @@ MACHINE_START(MINI2440, "MINI2440")
>  	.map_io		= mini2440_map_io,
>  	.init_machine	= mini2440_init,
>  	.init_irq	= s3c24xx_init_irq,
> -	.timer		= &s3c24xx_timer,
> +	.timer		= &samsung_timer,
>  	.restart	= s3c244x_restart,
>  MACHINE_END
> diff --git a/arch/arm/mach-s3c24xx/mach-n30.c b/arch/arm/mach-
> s3c24xx/mach-n30.c
> index c53a9bf..ea80658 100644
> --- a/arch/arm/mach-s3c24xx/mach-n30.c
> +++ b/arch/arm/mach-s3c24xx/mach-n30.c
> @@ -50,6 +50,7 @@
>  #include <linux/platform_data/mmc-s3cmci.h>
>  #include <plat/s3c2410.h>
>  #include <linux/platform_data/usb-s3c2410_udc.h>
> +#include <plat/samsung-time.h>
> 
>  #include "common.h"
> 
> @@ -536,6 +537,7 @@ static void __init n30_map_io(void)
>  	n30_hwinit();
>  	s3c24xx_init_clocks(0);
>  	s3c24xx_init_uarts(n30_uartcfgs, ARRAY_SIZE(n30_uartcfgs));
> +	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
>  }
> 
>  /* GPB3 is the line that controls the pull-up for the USB D+ line */
> diff --git a/arch/arm/mach-s3c24xx/mach-nexcoder.c b/arch/arm/mach-
> s3c24xx/mach-nexcoder.c
> index a2b92b0..76acb5a 100644
> --- a/arch/arm/mach-s3c24xx/mach-nexcoder.c
> +++ b/arch/arm/mach-s3c24xx/mach-nexcoder.c
> @@ -46,6 +46,7 @@
>  #include <plat/clock.h>
>  #include <plat/devs.h>
>  #include <plat/cpu.h>
> +#include <plat/samsung-time.h>
> 
>  #include "common.h"
> 
> @@ -137,6 +138,7 @@ static void __init nexcoder_map_io(void)
>  	s3c24xx_init_io(nexcoder_iodesc, ARRAY_SIZE(nexcoder_iodesc));
>  	s3c24xx_init_clocks(0);
>  	s3c24xx_init_uarts(nexcoder_uartcfgs,
> ARRAY_SIZE(nexcoder_uartcfgs));
> +	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
> 
>  	nexcoder_sensorboard_init();
>  }
> diff --git a/arch/arm/mach-s3c24xx/mach-osiris.c b/arch/arm/mach-
> s3c24xx/mach-osiris.c
> index bb36d83..60a5f92 100644
> --- a/arch/arm/mach-s3c24xx/mach-osiris.c
> +++ b/arch/arm/mach-s3c24xx/mach-osiris.c
> @@ -53,6 +53,7 @@
>  #include <plat/clock.h>
>  #include <plat/devs.h>
>  #include <plat/cpu.h>
> +#include <plat/samsung-time.h>
> 
>  #include "common.h"
> 
> @@ -386,6 +387,7 @@ static void __init osiris_map_io(void)
>  	s3c24xx_init_io(osiris_iodesc, ARRAY_SIZE(osiris_iodesc));
>  	s3c24xx_init_clocks(0);
>  	s3c24xx_init_uarts(osiris_uartcfgs, ARRAY_SIZE(osiris_uartcfgs));
> +	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
> 
>  	/* check for the newer revision boards with large page nand */
> 
> diff --git a/arch/arm/mach-s3c24xx/mach-otom.c b/arch/arm/mach-
> s3c24xx/mach-otom.c
> index bca39f0..24e7d70 100644
> --- a/arch/arm/mach-s3c24xx/mach-otom.c
> +++ b/arch/arm/mach-s3c24xx/mach-otom.c
> @@ -37,6 +37,7 @@
>  #include <plat/devs.h>
>  #include <linux/platform_data/i2c-s3c2410.h>
>  #include <plat/cpu.h>
> +#include <plat/samsung-time.h>
> 
>  #include "common.h"
> 
> @@ -104,6 +105,7 @@ static void __init otom11_map_io(void)
>  	s3c24xx_init_io(otom11_iodesc, ARRAY_SIZE(otom11_iodesc));
>  	s3c24xx_init_clocks(0);
>  	s3c24xx_init_uarts(otom11_uartcfgs, ARRAY_SIZE(otom11_uartcfgs));
> +	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
>  }
> 
>  static void __init otom11_init(void)
> diff --git a/arch/arm/mach-s3c24xx/mach-qt2410.c b/arch/arm/mach-
> s3c24xx/mach-qt2410.c
> index 7b6ba13..b68ff2a 100644
> --- a/arch/arm/mach-s3c24xx/mach-qt2410.c
> +++ b/arch/arm/mach-s3c24xx/mach-qt2410.c
> @@ -60,6 +60,7 @@
>  #include <plat/devs.h>
>  #include <plat/cpu.h>
>  #include <plat/pm.h>
> +#include <plat/samsung-time.h>
> 
>  #include "common.h"
> 
> @@ -304,6 +305,7 @@ static void __init qt2410_map_io(void)
>  	s3c24xx_init_io(qt2410_iodesc, ARRAY_SIZE(qt2410_iodesc));
>  	s3c24xx_init_clocks(12*1000*1000);
>  	s3c24xx_init_uarts(smdk2410_uartcfgs,
> ARRAY_SIZE(smdk2410_uartcfgs));
> +	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
>  }
> 
>  static void __init qt2410_machine_init(void)
> diff --git a/arch/arm/mach-s3c24xx/mach-rx1950.c b/arch/arm/mach-
> s3c24xx/mach-rx1950.c
> index 379fde5..fc03bb80 100644
> --- a/arch/arm/mach-s3c24xx/mach-rx1950.c
> +++ b/arch/arm/mach-s3c24xx/mach-rx1950.c
> @@ -58,6 +58,7 @@
>  #include <plat/pm.h>
>  #include <plat/irq.h>
>  #include <linux/platform_data/touchscreen-s3c2410.h>
> +#include <plat/samsung-time.h>
> 
>  #include <sound/uda1380.h>
> 
> @@ -743,6 +744,7 @@ static void __init rx1950_map_io(void)
>  	s3c24xx_init_io(rx1950_iodesc, ARRAY_SIZE(rx1950_iodesc));
>  	s3c24xx_init_clocks(16934000);
>  	s3c24xx_init_uarts(rx1950_uartcfgs, ARRAY_SIZE(rx1950_uartcfgs));
> +	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
> 
>  	/* setup PM */
> 
> diff --git a/arch/arm/mach-s3c24xx/mach-rx3715.c b/arch/arm/mach-
> s3c24xx/mach-rx3715.c
> index dacbb9a..772e275 100644
> --- a/arch/arm/mach-s3c24xx/mach-rx3715.c
> +++ b/arch/arm/mach-s3c24xx/mach-rx3715.c
> @@ -50,6 +50,7 @@
>  #include <plat/devs.h>
>  #include <plat/cpu.h>
>  #include <plat/pm.h>
> +#include <plat/samsung-time.h>
> 
>  #include "common.h"
> 
> @@ -179,6 +180,7 @@ static void __init rx3715_map_io(void)
>  	s3c24xx_init_io(rx3715_iodesc, ARRAY_SIZE(rx3715_iodesc));
>  	s3c24xx_init_clocks(16934000);
>  	s3c24xx_init_uarts(rx3715_uartcfgs, ARRAY_SIZE(rx3715_uartcfgs));
> +	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
>  }
> 
>  /* H1940 and RX3715 need to reserve this for suspend */
> diff --git a/arch/arm/mach-s3c24xx/mach-smdk2410.c b/arch/arm/mach-
> s3c24xx/mach-smdk2410.c
> index 82796b9..76aa704 100644
> --- a/arch/arm/mach-s3c24xx/mach-smdk2410.c
> +++ b/arch/arm/mach-s3c24xx/mach-smdk2410.c
> @@ -53,6 +53,7 @@
>  #include <plat/cpu.h>
> 
>  #include <plat/common-smdk.h>
> +#include <plat/samsung-time.h>
> 
>  #include "common.h"
> 
> @@ -101,6 +102,7 @@ static void __init smdk2410_map_io(void)
>  	s3c24xx_init_io(smdk2410_iodesc, ARRAY_SIZE(smdk2410_iodesc));
>  	s3c24xx_init_clocks(0);
>  	s3c24xx_init_uarts(smdk2410_uartcfgs,
> ARRAY_SIZE(smdk2410_uartcfgs));
> +	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
>  }
> 
>  static void __init smdk2410_init(void)
> diff --git a/arch/arm/mach-s3c24xx/mach-smdk2413.c b/arch/arm/mach-
> s3c24xx/mach-smdk2413.c
> index ce99fd8..128dc88 100644
> --- a/arch/arm/mach-s3c24xx/mach-smdk2413.c
> +++ b/arch/arm/mach-s3c24xx/mach-smdk2413.c
> @@ -47,6 +47,7 @@
>  #include <plat/clock.h>
>  #include <plat/devs.h>
>  #include <plat/cpu.h>
> +#include <plat/samsung-time.h>
> 
>  #include <plat/common-smdk.h>
> 
> @@ -107,6 +108,7 @@ static void __init smdk2413_map_io(void)
>  	s3c24xx_init_io(smdk2413_iodesc, ARRAY_SIZE(smdk2413_iodesc));
>  	s3c24xx_init_clocks(12000000);
>  	s3c24xx_init_uarts(smdk2413_uartcfgs,
> ARRAY_SIZE(smdk2413_uartcfgs));
> +	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
>  }
> 
>  static void __init smdk2413_machine_init(void)
> diff --git a/arch/arm/mach-s3c24xx/mach-smdk2416.c b/arch/arm/mach-
> s3c24xx/mach-smdk2416.c
> index f30d7fc..ee5fcaf 100644
> --- a/arch/arm/mach-s3c24xx/mach-smdk2416.c
> +++ b/arch/arm/mach-s3c24xx/mach-smdk2416.c
> @@ -52,6 +52,7 @@
>  #include <plat/sdhci.h>
>  #include <linux/platform_data/usb-s3c2410_udc.h>
>  #include <linux/platform_data/s3c-hsudc.h>
> +#include <plat/samsung-time.h>
> 
>  #include <plat/fb.h>
> 
> @@ -222,6 +223,7 @@ static void __init smdk2416_map_io(void)
>  	s3c24xx_init_io(smdk2416_iodesc, ARRAY_SIZE(smdk2416_iodesc));
>  	s3c24xx_init_clocks(12000000);
>  	s3c24xx_init_uarts(smdk2416_uartcfgs,
> ARRAY_SIZE(smdk2416_uartcfgs));
> +	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
>  }
> 
>  static void __init smdk2416_machine_init(void)
> diff --git a/arch/arm/mach-s3c24xx/mach-smdk2440.c b/arch/arm/mach-
> s3c24xx/mach-smdk2440.c
> index b7ff882..bc443da 100644
> --- a/arch/arm/mach-s3c24xx/mach-smdk2440.c
> +++ b/arch/arm/mach-s3c24xx/mach-smdk2440.c
> @@ -44,6 +44,7 @@
>  #include <plat/clock.h>
>  #include <plat/devs.h>
>  #include <plat/cpu.h>
> +#include <plat/samsung-time.h>
> 
>  #include <plat/common-smdk.h>
> 
> @@ -164,6 +165,7 @@ static void __init smdk2440_map_io(void)
>  	s3c24xx_init_io(smdk2440_iodesc, ARRAY_SIZE(smdk2440_iodesc));
>  	s3c24xx_init_clocks(16934400);
>  	s3c24xx_init_uarts(smdk2440_uartcfgs,
> ARRAY_SIZE(smdk2440_uartcfgs));
> +	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
>  }
> 
>  static void __init smdk2440_machine_init(void)
> diff --git a/arch/arm/mach-s3c24xx/mach-smdk2443.c b/arch/arm/mach-
> s3c24xx/mach-smdk2443.c
> index 2568656..b5b128f 100644
> --- a/arch/arm/mach-s3c24xx/mach-smdk2443.c
> +++ b/arch/arm/mach-s3c24xx/mach-smdk2443.c
> @@ -44,6 +44,7 @@
>  #include <plat/clock.h>
>  #include <plat/devs.h>
>  #include <plat/cpu.h>
> +#include <plat/samsung-time.h>
> 
>  #include <plat/common-smdk.h>
> 
> @@ -123,6 +124,7 @@ static void __init smdk2443_map_io(void)
>  	s3c24xx_init_io(smdk2443_iodesc, ARRAY_SIZE(smdk2443_iodesc));
>  	s3c24xx_init_clocks(12000000);
>  	s3c24xx_init_uarts(smdk2443_uartcfgs,
> ARRAY_SIZE(smdk2443_uartcfgs));
> +	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
>  }
> 
>  static void __init smdk2443_machine_init(void)
> diff --git a/arch/arm/mach-s3c24xx/mach-tct_hammer.c b/arch/arm/mach-
> s3c24xx/mach-tct_hammer.c
> index 495bf5c..c6351a8 100644
> --- a/arch/arm/mach-s3c24xx/mach-tct_hammer.c
> +++ b/arch/arm/mach-s3c24xx/mach-tct_hammer.c
> @@ -53,6 +53,7 @@
>  #include <linux/mtd/partitions.h>
>  #include <linux/mtd/map.h>
>  #include <linux/mtd/physmap.h>
> +#include <plat/samsung-time.h>
> 
>  #include "common.h"
> 
> @@ -136,6 +137,7 @@ static void __init tct_hammer_map_io(void)
>  	s3c24xx_init_io(tct_hammer_iodesc, ARRAY_SIZE(tct_hammer_iodesc));
>  	s3c24xx_init_clocks(0);
>  	s3c24xx_init_uarts(tct_hammer_uartcfgs,
> ARRAY_SIZE(tct_hammer_uartcfgs));
> +	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
>  }
> 
>  static void __init tct_hammer_init(void)
> diff --git a/arch/arm/mach-s3c24xx/mach-vr1000.c b/arch/arm/mach-
> s3c24xx/mach-vr1000.c
> index 14d5b12..0c3d863 100644
> --- a/arch/arm/mach-s3c24xx/mach-vr1000.c
> +++ b/arch/arm/mach-s3c24xx/mach-vr1000.c
> @@ -50,6 +50,7 @@
>  #include <plat/cpu.h>
>  #include <linux/platform_data/i2c-s3c2410.h>
>  #include <linux/platform_data/asoc-s3c24xx_simtec.h>
> +#include <plat/samsung-time.h>
> 
>  #include "simtec.h"
>  #include "common.h"
> @@ -335,6 +336,7 @@ static void __init vr1000_map_io(void)
>  	s3c24xx_init_io(vr1000_iodesc, ARRAY_SIZE(vr1000_iodesc));
>  	s3c24xx_init_clocks(0);
>  	s3c24xx_init_uarts(vr1000_uartcfgs, ARRAY_SIZE(vr1000_uartcfgs));
> +	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
>  }
> 
>  static void __init vr1000_init(void)
> diff --git a/arch/arm/mach-s3c24xx/mach-vstms.c b/arch/arm/mach-
> s3c24xx/mach-vstms.c
> index f1d44ae..1741d00 100644
> --- a/arch/arm/mach-s3c24xx/mach-vstms.c
> +++ b/arch/arm/mach-s3c24xx/mach-vstms.c
> @@ -47,7 +47,7 @@
>  #include <plat/clock.h>
>  #include <plat/devs.h>
>  #include <plat/cpu.h>
> -
> +#include <plat/samsung-time.h>
> 
>  static struct map_desc vstms_iodesc[] __initdata = {
>  };
> @@ -144,6 +144,7 @@ static void __init vstms_map_io(void)
>  	s3c24xx_init_io(vstms_iodesc, ARRAY_SIZE(vstms_iodesc));
>  	s3c24xx_init_clocks(12000000);
>  	s3c24xx_init_uarts(vstms_uartcfgs, ARRAY_SIZE(vstms_uartcfgs));
> +	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
>  }
> 
>  static void __init vstms_init(void)
> diff --git a/arch/arm/mach-s3c64xx/mach-anw6410.c b/arch/arm/mach-
> s3c64xx/mach-anw6410.c
> index 99e82ac..717daaa 100644
> --- a/arch/arm/mach-s3c64xx/mach-anw6410.c
> +++ b/arch/arm/mach-s3c64xx/mach-anw6410.c
> @@ -51,6 +51,7 @@
>  #include <plat/cpu.h>
>  #include <mach/regs-gpio.h>
>  #include <mach/regs-modem.h>
> +#include <plat/samsung-time.h>
> 
>  #include "common.h"
> 
> @@ -209,6 +210,7 @@ static void __init anw6410_map_io(void)
>  	s3c64xx_init_io(anw6410_iodesc, ARRAY_SIZE(anw6410_iodesc));
>  	s3c24xx_init_clocks(12000000);
>  	s3c24xx_init_uarts(anw6410_uartcfgs, ARRAY_SIZE(anw6410_uartcfgs));
> +	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
> 
>  	anw6410_lcd_mode_set();
>  }
> diff --git a/arch/arm/mach-s3c64xx/mach-crag6410.c b/arch/arm/mach-
> s3c64xx/mach-crag6410.c
> index 13b7eaa..0d41166 100644
> --- a/arch/arm/mach-s3c64xx/mach-crag6410.c
> +++ b/arch/arm/mach-s3c64xx/mach-crag6410.c
> @@ -70,6 +70,7 @@
>  #include <plat/adc.h>
>  #include <linux/platform_data/i2c-s3c2410.h>
>  #include <plat/pm.h>
> +#include <plat/samsung-time.h>
> 
>  #include "common.h"
> 
> @@ -704,6 +705,7 @@ static void __init crag6410_map_io(void)
>  	s3c64xx_init_io(NULL, 0);
>  	s3c24xx_init_clocks(12000000);
>  	s3c24xx_init_uarts(crag6410_uartcfgs,
> ARRAY_SIZE(crag6410_uartcfgs));
> +	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
> 
>  	/* LCD type and Bypass set by bootloader */
>  }
> diff --git a/arch/arm/mach-s3c64xx/mach-hmt.c b/arch/arm/mach-
> s3c64xx/mach-hmt.c
> index 2b14489..30c0424 100644
> --- a/arch/arm/mach-s3c64xx/mach-hmt.c
> +++ b/arch/arm/mach-s3c64xx/mach-hmt.c
> @@ -42,6 +42,7 @@
>  #include <plat/clock.h>
>  #include <plat/devs.h>
>  #include <plat/cpu.h>
> +#include <plat/samsung-time.h>
> 
>  #include "common.h"
> 
> @@ -249,6 +250,7 @@ static void __init hmt_map_io(void)
>  	s3c64xx_init_io(hmt_iodesc, ARRAY_SIZE(hmt_iodesc));
>  	s3c24xx_init_clocks(12000000);
>  	s3c24xx_init_uarts(hmt_uartcfgs, ARRAY_SIZE(hmt_uartcfgs));
> +	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
>  }
> 
>  static void __init hmt_machine_init(void)
> diff --git a/arch/arm/mach-s3c64xx/mach-mini6410.c b/arch/arm/mach-
> s3c64xx/mach-mini6410.c
> index 07c349c..758f5708 100644
> --- a/arch/arm/mach-s3c64xx/mach-mini6410.c
> +++ b/arch/arm/mach-s3c64xx/mach-mini6410.c
> @@ -44,6 +44,7 @@
> 
>  #include <video/platform_lcd.h>
>  #include <video/samsung_fimd.h>
> +#include <plat/samsung-time.h>
> 
>  #include "common.h"
> 
> @@ -233,6 +234,7 @@ static void __init mini6410_map_io(void)
>  	s3c64xx_init_io(NULL, 0);
>  	s3c24xx_init_clocks(12000000);
>  	s3c24xx_init_uarts(mini6410_uartcfgs,
> ARRAY_SIZE(mini6410_uartcfgs));
> +	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
> 
>  	/* set the LCD type */
>  	tmp = __raw_readl(S3C64XX_SPCON);
> diff --git a/arch/arm/mach-s3c64xx/mach-ncp.c b/arch/arm/mach-
> s3c64xx/mach-ncp.c
> index e5f9a79..edfdd9f 100644
> --- a/arch/arm/mach-s3c64xx/mach-ncp.c
> +++ b/arch/arm/mach-s3c64xx/mach-ncp.c
> @@ -44,6 +44,7 @@
>  #include <plat/clock.h>
>  #include <plat/devs.h>
>  #include <plat/cpu.h>
> +#include <plat/samsung-time.h>
> 
>  #include "common.h"
> 
> @@ -88,6 +89,7 @@ static void __init ncp_map_io(void)
>  	s3c64xx_init_io(ncp_iodesc, ARRAY_SIZE(ncp_iodesc));
>  	s3c24xx_init_clocks(12000000);
>  	s3c24xx_init_uarts(ncp_uartcfgs, ARRAY_SIZE(ncp_uartcfgs));
> +	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
>  }
> 
>  static void __init ncp_machine_init(void)
> diff --git a/arch/arm/mach-s3c64xx/mach-real6410.c b/arch/arm/mach-
> s3c64xx/mach-real6410.c
> index 7476f7c..dd9980d 100644
> --- a/arch/arm/mach-s3c64xx/mach-real6410.c
> +++ b/arch/arm/mach-s3c64xx/mach-real6410.c
> @@ -45,6 +45,7 @@
> 
>  #include <video/platform_lcd.h>
>  #include <video/samsung_fimd.h>
> +#include <plat/samsung-time.h>
> 
>  #include "common.h"
> 
> @@ -212,6 +213,7 @@ static void __init real6410_map_io(void)
>  	s3c64xx_init_io(NULL, 0);
>  	s3c24xx_init_clocks(12000000);
>  	s3c24xx_init_uarts(real6410_uartcfgs,
> ARRAY_SIZE(real6410_uartcfgs));
> +	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
> 
>  	/* set the LCD type */
>  	tmp = __raw_readl(S3C64XX_SPCON);
> diff --git a/arch/arm/mach-s3c64xx/mach-smartq.c b/arch/arm/mach-
> s3c64xx/mach-smartq.c
> index c6d7390..df314f1 100644
> --- a/arch/arm/mach-s3c64xx/mach-smartq.c
> +++ b/arch/arm/mach-s3c64xx/mach-smartq.c
> @@ -39,6 +39,7 @@
>  #include <linux/platform_data/touchscreen-s3c2410.h>
> 
>  #include <video/platform_lcd.h>
> +#include <plat/samsung-time.h>
> 
>  #include "common.h"
> 
> @@ -378,6 +379,7 @@ void __init smartq_map_io(void)
>  	s3c64xx_init_io(smartq_iodesc, ARRAY_SIZE(smartq_iodesc));
>  	s3c24xx_init_clocks(12000000);
>  	s3c24xx_init_uarts(smartq_uartcfgs, ARRAY_SIZE(smartq_uartcfgs));
> +	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
> 
>  	smartq_lcd_mode_set();
>  }
> diff --git a/arch/arm/mach-s3c64xx/mach-smartq5.c b/arch/arm/mach-
> s3c64xx/mach-smartq5.c
> index 96d6da2..1a6baf2 100644
> --- a/arch/arm/mach-s3c64xx/mach-smartq5.c
> +++ b/arch/arm/mach-s3c64xx/mach-smartq5.c
> @@ -29,6 +29,7 @@
>  #include <plat/devs.h>
>  #include <plat/fb.h>
>  #include <plat/gpio-cfg.h>
> +#include <plat/samsung-time.h>
> 
>  #include "common.h"
>  #include "mach-smartq.h"
> diff --git a/arch/arm/mach-s3c64xx/mach-smartq7.c b/arch/arm/mach-
> s3c64xx/mach-smartq7.c
> index 7d1167b..e193866 100644
> --- a/arch/arm/mach-s3c64xx/mach-smartq7.c
> +++ b/arch/arm/mach-s3c64xx/mach-smartq7.c
> @@ -29,6 +29,7 @@
>  #include <plat/devs.h>
>  #include <plat/fb.h>
>  #include <plat/gpio-cfg.h>
> +#include <plat/samsung-time.h>
> 
>  #include "common.h"
>  #include "mach-smartq.h"
> diff --git a/arch/arm/mach-s3c64xx/mach-smdk6400.c b/arch/arm/mach-
> s3c64xx/mach-smdk6400.c
> index a928fae..b2bac82 100644
> --- a/arch/arm/mach-s3c64xx/mach-smdk6400.c
> +++ b/arch/arm/mach-s3c64xx/mach-smdk6400.c
> @@ -36,6 +36,7 @@
>  #include <plat/devs.h>
>  #include <plat/cpu.h>
>  #include <linux/platform_data/i2c-s3c2410.h>
> +#include <plat/samsung-time.h>
> 
>  #include "common.h"
> 
> @@ -67,6 +68,7 @@ static void __init smdk6400_map_io(void)
>  	s3c64xx_init_io(smdk6400_iodesc, ARRAY_SIZE(smdk6400_iodesc));
>  	s3c24xx_init_clocks(12000000);
>  	s3c24xx_init_uarts(smdk6400_uartcfgs,
> ARRAY_SIZE(smdk6400_uartcfgs));
> +	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
>  }
> 
>  static struct platform_device *smdk6400_devices[] __initdata = {
> diff --git a/arch/arm/mach-s3c64xx/mach-smdk6410.c b/arch/arm/mach-
> s3c64xx/mach-smdk6410.c
> index da1a771..d8fe796 100644
> --- a/arch/arm/mach-s3c64xx/mach-smdk6410.c
> +++ b/arch/arm/mach-s3c64xx/mach-smdk6410.c
> @@ -73,6 +73,7 @@
>  #include <linux/platform_data/touchscreen-s3c2410.h>
>  #include <plat/keypad.h>
>  #include <plat/backlight.h>
> +#include <plat/samsung-time.h>
> 
>  #include "common.h"
> 
> @@ -636,6 +637,7 @@ static void __init smdk6410_map_io(void)
>  	s3c64xx_init_io(smdk6410_iodesc, ARRAY_SIZE(smdk6410_iodesc));
>  	s3c24xx_init_clocks(12000000);
>  	s3c24xx_init_uarts(smdk6410_uartcfgs,
> ARRAY_SIZE(smdk6410_uartcfgs));
> +	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
> 
>  	/* set the LCD type */
> 
> diff --git a/arch/arm/mach-s5p64x0/Kconfig b/arch/arm/mach-s5p64x0/Kconfig
> index e8742cb..f0ec535 100644
> --- a/arch/arm/mach-s5p64x0/Kconfig
> +++ b/arch/arm/mach-s5p64x0/Kconfig
> @@ -9,7 +9,7 @@ if ARCH_S5P64X0
> 
>  config CPU_S5P6440
>  	bool
> -	select S5P_HRT
> +	select SAMSUNG_HRT
>  	select S5P_SLEEP if PM
>  	select SAMSUNG_DMADEV
>  	select SAMSUNG_WAKEMASK if PM
> @@ -18,7 +18,7 @@ config CPU_S5P6440
> 
>  config CPU_S5P6450
>  	bool
> -	select S5P_HRT
> +	select SAMSUNG_HRT
>  	select S5P_SLEEP if PM
>  	select SAMSUNG_DMADEV
>  	select SAMSUNG_WAKEMASK if PM
> diff --git a/arch/arm/mach-s5p64x0/mach-smdk6440.c b/arch/arm/mach-
> s5p64x0/mach-smdk6440.c
> index 96ea1fe..35c3fd3 100644
> --- a/arch/arm/mach-s5p64x0/mach-smdk6440.c
> +++ b/arch/arm/mach-s5p64x0/mach-smdk6440.c
> @@ -50,7 +50,7 @@
>  #include <plat/pll.h>
>  #include <plat/adc.h>
>  #include <linux/platform_data/touchscreen-s3c2410.h>
> -#include <plat/s5p-time.h>
> +#include <plat/samsung-time.h>
>  #include <plat/backlight.h>
>  #include <plat/fb.h>
>  #include <plat/sdhci.h>
> @@ -231,7 +231,7 @@ static void __init smdk6440_map_io(void)
>  	s5p64x0_init_io(NULL, 0);
>  	s3c24xx_init_clocks(12000000);
>  	s3c24xx_init_uarts(smdk6440_uartcfgs,
> ARRAY_SIZE(smdk6440_uartcfgs));
> -	s5p_set_timer_source(S5P_PWM3, S5P_PWM4);
> +	samsung_set_timer_source(S5P_PWM3, S5P_PWM4);
>  }
> 
>  static void s5p6440_set_lcd_interface(void)
> diff --git a/arch/arm/mach-s5p64x0/mach-smdk6450.c b/arch/arm/mach-
> s5p64x0/mach-smdk6450.c
> index 12748b6..b06fa83 100644
> --- a/arch/arm/mach-s5p64x0/mach-smdk6450.c
> +++ b/arch/arm/mach-s5p64x0/mach-smdk6450.c
> @@ -50,7 +50,7 @@
>  #include <plat/pll.h>
>  #include <plat/adc.h>
>  #include <linux/platform_data/touchscreen-s3c2410.h>
> -#include <plat/s5p-time.h>
> +#include <plat/samsung-time.h>
>  #include <plat/backlight.h>
>  #include <plat/fb.h>
>  #include <plat/sdhci.h>
> @@ -250,7 +250,7 @@ static void __init smdk6450_map_io(void)
>  	s5p64x0_init_io(NULL, 0);
>  	s3c24xx_init_clocks(19200000);
>  	s3c24xx_init_uarts(smdk6450_uartcfgs,
> ARRAY_SIZE(smdk6450_uartcfgs));
> -	s5p_set_timer_source(S5P_PWM3, S5P_PWM4);
> +	samsung_set_timer_source(S5P_PWM3, S5P_PWM4);
>  }
> 
>  static void s5p6450_set_lcd_interface(void)
> diff --git a/arch/arm/mach-s5pv210/Kconfig b/arch/arm/mach-s5pv210/Kconfig
> index 92ad72f..01018ef 100644
> --- a/arch/arm/mach-s5pv210/Kconfig
> +++ b/arch/arm/mach-s5pv210/Kconfig
> @@ -12,7 +12,7 @@ if ARCH_S5PV210
>  config CPU_S5PV210
>  	bool
>  	select S5P_EXT_INT
> -	select S5P_HRT
> +	select SAMSUNG_HRT
>  	select S5P_PM if PM
>  	select S5P_SLEEP if PM
>  	select SAMSUNG_DMADEV
> diff --git a/arch/arm/mach-s5pv210/mach-aquila.c b/arch/arm/mach-
> s5pv210/mach-aquila.c
> index ee9fa5c..46b2842 100644
> --- a/arch/arm/mach-s5pv210/mach-aquila.c
> +++ b/arch/arm/mach-s5pv210/mach-aquila.c
> @@ -39,7 +39,7 @@
>  #include <plat/fb.h>
>  #include <plat/fimc-core.h>
>  #include <plat/sdhci.h>
> -#include <plat/s5p-time.h>
> +#include <plat/samsung-time.h>
> 
>  #include "common.h"
> 
> @@ -652,7 +652,7 @@ static void __init aquila_map_io(void)
>  	s5pv210_init_io(NULL, 0);
>  	s3c24xx_init_clocks(24000000);
>  	s3c24xx_init_uarts(aquila_uartcfgs, ARRAY_SIZE(aquila_uartcfgs));
> -	s5p_set_timer_source(S5P_PWM3, S5P_PWM4);
> +	samsung_set_timer_source(S5P_PWM3, S5P_PWM4);
>  }
> 
>  static void __init aquila_machine_init(void)
> diff --git a/arch/arm/mach-s5pv210/mach-goni.c b/arch/arm/mach-
> s5pv210/mach-goni.c
> index 55e1dba..6efcc19 100644
> --- a/arch/arm/mach-s5pv210/mach-goni.c
> +++ b/arch/arm/mach-s5pv210/mach-goni.c
> @@ -48,7 +48,7 @@
>  #include <plat/keypad.h>
>  #include <plat/sdhci.h>
>  #include <plat/clock.h>
> -#include <plat/s5p-time.h>
> +#include <plat/samsung-time.h>
>  #include <plat/mfc.h>
>  #include <plat/camport.h>
> 
> @@ -910,7 +910,7 @@ static void __init goni_map_io(void)
>  	s5pv210_init_io(NULL, 0);
>  	s3c24xx_init_clocks(clk_xusbxti.rate);
>  	s3c24xx_init_uarts(goni_uartcfgs, ARRAY_SIZE(goni_uartcfgs));
> -	s5p_set_timer_source(S5P_PWM3, S5P_PWM4);
> +	samsung_set_timer_source(S5P_PWM3, S5P_PWM4);
>  }
> 
>  static void __init goni_reserve(void)
> diff --git a/arch/arm/mach-s5pv210/mach-smdkc110.c b/arch/arm/mach-
> s5pv210/mach-smdkc110.c
> index d9c99fc..213b3a3 100644
> --- a/arch/arm/mach-s5pv210/mach-smdkc110.c
> +++ b/arch/arm/mach-s5pv210/mach-smdkc110.c
> @@ -30,7 +30,7 @@
>  #include <linux/platform_data/ata-samsung_cf.h>
>  #include <linux/platform_data/i2c-s3c2410.h>
>  #include <plat/pm.h>
> -#include <plat/s5p-time.h>
> +#include <plat/samsung-time.h>
>  #include <plat/mfc.h>
> 
>  #include "common.h"
> @@ -122,7 +122,7 @@ static void __init smdkc110_map_io(void)
>  	s5pv210_init_io(NULL, 0);
>  	s3c24xx_init_clocks(24000000);
>  	s3c24xx_init_uarts(smdkv210_uartcfgs,
> ARRAY_SIZE(smdkv210_uartcfgs));
> -	s5p_set_timer_source(S5P_PWM3, S5P_PWM4);
> +	samsung_set_timer_source(S5P_PWM3, S5P_PWM4);
>  }
> 
>  static void __init smdkc110_reserve(void)
> diff --git a/arch/arm/mach-s5pv210/mach-smdkv210.c b/arch/arm/mach-
> s5pv210/mach-smdkv210.c
> index 4cdb5bb..00806de 100644
> --- a/arch/arm/mach-s5pv210/mach-smdkv210.c
> +++ b/arch/arm/mach-s5pv210/mach-smdkv210.c
> @@ -45,7 +45,7 @@
>  #include <plat/keypad.h>
>  #include <plat/pm.h>
>  #include <plat/fb.h>
> -#include <plat/s5p-time.h>
> +#include <plat/samsung-time.h>
>  #include <plat/backlight.h>
>  #include <plat/mfc.h>
>  #include <plat/clock.h>
> @@ -287,7 +287,7 @@ static void __init smdkv210_map_io(void)
>  	s5pv210_init_io(NULL, 0);
>  	s3c24xx_init_clocks(clk_xusbxti.rate);
>  	s3c24xx_init_uarts(smdkv210_uartcfgs,
> ARRAY_SIZE(smdkv210_uartcfgs));
> -	s5p_set_timer_source(S5P_PWM2, S5P_PWM4);
> +	samsung_set_timer_source(S5P_PWM2, S5P_PWM4);
>  }
> 
>  static void __init smdkv210_reserve(void)
> diff --git a/arch/arm/mach-s5pv210/mach-torbreck.c b/arch/arm/mach-
> s5pv210/mach-torbreck.c
> index 18785cb..1b01f05 100644
> --- a/arch/arm/mach-s5pv210/mach-torbreck.c
> +++ b/arch/arm/mach-s5pv210/mach-torbreck.c
> @@ -27,7 +27,7 @@
>  #include <plat/devs.h>
>  #include <plat/cpu.h>
>  #include <linux/platform_data/i2c-s3c2410.h>
> -#include <plat/s5p-time.h>
> +#include <plat/samsung-time.h>
> 
>  #include "common.h"
> 
> @@ -107,7 +107,7 @@ static void __init torbreck_map_io(void)
>  	s5pv210_init_io(NULL, 0);
>  	s3c24xx_init_clocks(24000000);
>  	s3c24xx_init_uarts(torbreck_uartcfgs,
> ARRAY_SIZE(torbreck_uartcfgs));
> -	s5p_set_timer_source(S5P_PWM3, S5P_PWM4);
> +	samsung_set_timer_source(S5P_PWM3, S5P_PWM4);
>  }
> 
>  static void __init torbreck_machine_init(void)
> diff --git a/arch/arm/plat-samsung/Kconfig b/arch/arm/plat-samsung/Kconfig
> index 59401e1..5278795 100644
> --- a/arch/arm/plat-samsung/Kconfig
> +++ b/arch/arm/plat-samsung/Kconfig
> @@ -70,7 +70,7 @@ config S3C_LOWLEVEL_UART_PORT
> 
>  # timer options
> 
> -config S5P_HRT
> +config SAMSUNG_HRT
>  	bool
>  	select SAMSUNG_DEV_PWM
>  	help
> diff --git a/arch/arm/plat-samsung/Makefile b/arch/arm/plat-
> samsung/Makefile
> index 9e40e8d..06f2312 100644
> --- a/arch/arm/plat-samsung/Makefile
> +++ b/arch/arm/plat-samsung/Makefile
> @@ -13,7 +13,7 @@ obj-				:=
> 
>  obj-y				+= init.o cpu.o
>  obj-$(CONFIG_ARCH_USES_GETTIMEOFFSET)   += time.o
> -obj-$(CONFIG_S5P_HRT) 		+= s5p-time.o
> +obj-$(CONFIG_SAMSUNG_HRT) 		+= samsung-time.o
> 
>  obj-$(CONFIG_SAMSUNG_CLOCK)	+= clock.o
>  obj-$(CONFIG_SAMSUNG_CLOCK)	+= pwm-clock.o
> diff --git a/arch/arm/plat-samsung/include/plat/s5p-time.h
> b/arch/arm/plat-samsung/include/plat/s5p-time.h
> deleted file mode 100644
> index 3a70aeb..0000000
> --- a/arch/arm/plat-samsung/include/plat/s5p-time.h
> +++ /dev/null
> @@ -1,40 +0,0 @@
> -/* linux/arch/arm/plat-samsung/include/plat/s5p-time.h
> - *
> - * Copyright 2011 Samsung Electronics Co., Ltd.
> - *		http://www.samsung.com/
> - *
> - * Header file for s5p time support
> - *
> - * This program is free software; you can redistribute it and/or modify
> - * it under the terms of the GNU General Public License version 2 as
> - * published by the Free Software Foundation.
> -*/
> -
> -#ifndef __ASM_PLAT_S5P_TIME_H
> -#define __ASM_PLAT_S5P_TIME_H __FILE__
> -
> -/* S5P HR-Timer Clock mode */
> -enum s5p_timer_mode {
> -	S5P_PWM0,
> -	S5P_PWM1,
> -	S5P_PWM2,
> -	S5P_PWM3,
> -	S5P_PWM4,
> -};
> -
> -struct s5p_timer_source {
> -	unsigned int event_id;
> -	unsigned int source_id;
> -};
> -
> -/* Be able to sleep for atleast 4 seconds (usually more) */
> -#define S5PTIMER_MIN_RANGE	4
> -
> -#define TCNT_MAX		0xffffffff
> -#define NON_PERIODIC		0
> -#define PERIODIC		1
> -
> -extern void __init s5p_set_timer_source(enum s5p_timer_mode event,
> -					enum s5p_timer_mode source);
> -extern	struct sys_timer s5p_timer;
> -#endif /* __ASM_PLAT_S5P_TIME_H */
> diff --git a/arch/arm/plat-samsung/include/plat/samsung-time.h
> b/arch/arm/plat-samsung/include/plat/samsung-time.h
> new file mode 100644
> index 0000000..d3d1c81
> --- /dev/null
> +++ b/arch/arm/plat-samsung/include/plat/samsung-time.h
> @@ -0,0 +1,51 @@
> +/* linux/arch/arm/plat-samsung/include/plat/samsung-time.h
> + *
> + * Copyright 2011 Samsung Electronics Co., Ltd.
> + *		http://www.samsung.com/
> + *
> + * Header file for samsung time support
> + *
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License version 2 as
> + * published by the Free Software Foundation.
> +*/
> +
> +#ifndef __ASM_PLAT_SAMSUNG_TIME_H
> +#define __ASM_PLAT_SAMSUNG_TIME_H __FILE__
> +
> +/* SAMSUNG HR-Timer Clock mode */
> +enum samsung_timer_mode {
> +	SAMSUNG_PWM0,
> +	SAMSUNG_PWM1,
> +	SAMSUNG_PWM2,
> +	SAMSUNG_PWM3,
> +	SAMSUNG_PWM4,
> +};
> +
> +struct samsung_timer_source {
> +	unsigned int event_id;
> +	unsigned int source_id;
> +};
> +
> +/* Be able to sleep for atleast 4 seconds (usually more) */
> +#define SAMSUNG_TIMER_MIN_RANGE	4
> +
> +#ifdef CONFIG_ARCH_S3C24XX
> +#define TCNT_MAX		0xffff
> +#define TSCALER_DIV		25
> +#define TDIV			50
> +#define TSIZE			16
> +#else
> +#define TCNT_MAX		0xffffffff
> +#define TSCALER_DIV		2
> +#define TDIV			2
> +#define TSIZE			32
> +#endif
> +
> +#define NON_PERIODIC		0
> +#define PERIODIC		1
> +
> +extern void __init samsung_set_timer_source(enum samsung_timer_mode
event,
> +					enum samsung_timer_mode source);
> +extern	struct sys_timer samsung_timer;
> +#endif /* __ASM_PLAT_SAMSUNG_TIME_H */
> diff --git a/arch/arm/plat-samsung/s5p-time.c b/arch/arm/plat-samsung/s5p-
> time.c
> deleted file mode 100644
> index 028b6e8..0000000
> --- a/arch/arm/plat-samsung/s5p-time.c
> +++ /dev/null
> @@ -1,405 +0,0 @@
> -/*
> - * Copyright (c) 2011 Samsung Electronics Co., Ltd.
> - *		http://www.samsung.com/
> - *
> - * S5P - Common hr-timer support
> - *
> - * This program is free software; you can redistribute it and/or modify
> - * it under the terms of the GNU General Public License version 2 as
> - * published by the Free Software Foundation.
> -*/
> -
> -#include <linux/interrupt.h>
> -#include <linux/irq.h>
> -#include <linux/err.h>
> -#include <linux/clk.h>
> -#include <linux/clockchips.h>
> -#include <linux/platform_device.h>
> -
> -#include <asm/smp_twd.h>
> -#include <asm/mach/time.h>
> -#include <asm/mach/arch.h>
> -#include <asm/mach/map.h>
> -#include <asm/sched_clock.h>
> -
> -#include <mach/map.h>
> -#include <plat/devs.h>
> -#include <plat/regs-timer.h>
> -#include <plat/s5p-time.h>
> -
> -static struct clk *tin_event;
> -static struct clk *tin_source;
> -static struct clk *tdiv_event;
> -static struct clk *tdiv_source;
> -static struct clk *timerclk;
> -static struct s5p_timer_source timer_source;
> -static unsigned long clock_count_per_tick;
> -static void s5p_timer_resume(void);
> -
> -static void s5p_time_stop(enum s5p_timer_mode mode)
> -{
> -	unsigned long tcon;
> -
> -	tcon = __raw_readl(S3C2410_TCON);
> -
> -	switch (mode) {
> -	case S5P_PWM0:
> -		tcon &= ~S3C2410_TCON_T0START;
> -		break;
> -
> -	case S5P_PWM1:
> -		tcon &= ~S3C2410_TCON_T1START;
> -		break;
> -
> -	case S5P_PWM2:
> -		tcon &= ~S3C2410_TCON_T2START;
> -		break;
> -
> -	case S5P_PWM3:
> -		tcon &= ~S3C2410_TCON_T3START;
> -		break;
> -
> -	case S5P_PWM4:
> -		tcon &= ~S3C2410_TCON_T4START;
> -		break;
> -
> -	default:
> -		printk(KERN_ERR "Invalid Timer %d\n", mode);
> -		break;
> -	}
> -	__raw_writel(tcon, S3C2410_TCON);
> -}
> -
> -static void s5p_time_setup(enum s5p_timer_mode mode, unsigned long tcnt)
> -{
> -	unsigned long tcon;
> -
> -	tcon = __raw_readl(S3C2410_TCON);
> -
> -	tcnt--;
> -
> -	switch (mode) {
> -	case S5P_PWM0:
> -		tcon &= ~(0x0f << 0);
> -		tcon |= S3C2410_TCON_T0MANUALUPD;
> -		break;
> -
> -	case S5P_PWM1:
> -		tcon &= ~(0x0f << 8);
> -		tcon |= S3C2410_TCON_T1MANUALUPD;
> -		break;
> -
> -	case S5P_PWM2:
> -		tcon &= ~(0x0f << 12);
> -		tcon |= S3C2410_TCON_T2MANUALUPD;
> -		break;
> -
> -	case S5P_PWM3:
> -		tcon &= ~(0x0f << 16);
> -		tcon |= S3C2410_TCON_T3MANUALUPD;
> -		break;
> -
> -	case S5P_PWM4:
> -		tcon &= ~(0x07 << 20);
> -		tcon |= S3C2410_TCON_T4MANUALUPD;
> -		break;
> -
> -	default:
> -		printk(KERN_ERR "Invalid Timer %d\n", mode);
> -		break;
> -	}
> -
> -	__raw_writel(tcnt, S3C2410_TCNTB(mode));
> -	__raw_writel(tcnt, S3C2410_TCMPB(mode));
> -	__raw_writel(tcon, S3C2410_TCON);
> -}
> -
> -static void s5p_time_start(enum s5p_timer_mode mode, bool periodic)
> -{
> -	unsigned long tcon;
> -
> -	tcon  = __raw_readl(S3C2410_TCON);
> -
> -	switch (mode) {
> -	case S5P_PWM0:
> -		tcon |= S3C2410_TCON_T0START;
> -		tcon &= ~S3C2410_TCON_T0MANUALUPD;
> -
> -		if (periodic)
> -			tcon |= S3C2410_TCON_T0RELOAD;
> -		else
> -			tcon &= ~S3C2410_TCON_T0RELOAD;
> -		break;
> -
> -	case S5P_PWM1:
> -		tcon |= S3C2410_TCON_T1START;
> -		tcon &= ~S3C2410_TCON_T1MANUALUPD;
> -
> -		if (periodic)
> -			tcon |= S3C2410_TCON_T1RELOAD;
> -		else
> -			tcon &= ~S3C2410_TCON_T1RELOAD;
> -		break;
> -
> -	case S5P_PWM2:
> -		tcon |= S3C2410_TCON_T2START;
> -		tcon &= ~S3C2410_TCON_T2MANUALUPD;
> -
> -		if (periodic)
> -			tcon |= S3C2410_TCON_T2RELOAD;
> -		else
> -			tcon &= ~S3C2410_TCON_T2RELOAD;
> -		break;
> -
> -	case S5P_PWM3:
> -		tcon |= S3C2410_TCON_T3START;
> -		tcon &= ~S3C2410_TCON_T3MANUALUPD;
> -
> -		if (periodic)
> -			tcon |= S3C2410_TCON_T3RELOAD;
> -		else
> -			tcon &= ~S3C2410_TCON_T3RELOAD;
> -		break;
> -
> -	case S5P_PWM4:
> -		tcon |= S3C2410_TCON_T4START;
> -		tcon &= ~S3C2410_TCON_T4MANUALUPD;
> -
> -		if (periodic)
> -			tcon |= S3C2410_TCON_T4RELOAD;
> -		else
> -			tcon &= ~S3C2410_TCON_T4RELOAD;
> -		break;
> -
> -	default:
> -		printk(KERN_ERR "Invalid Timer %d\n", mode);
> -		break;
> -	}
> -	__raw_writel(tcon, S3C2410_TCON);
> -}
> -
> -static int s5p_set_next_event(unsigned long cycles,
> -				struct clock_event_device *evt)
> -{
> -	s5p_time_setup(timer_source.event_id, cycles);
> -	s5p_time_start(timer_source.event_id, NON_PERIODIC);
> -
> -	return 0;
> -}
> -
> -static void s5p_set_mode(enum clock_event_mode mode,
> -				struct clock_event_device *evt)
> -{
> -	s5p_time_stop(timer_source.event_id);
> -
> -	switch (mode) {
> -	case CLOCK_EVT_MODE_PERIODIC:
> -		s5p_time_setup(timer_source.event_id, clock_count_per_tick);
> -		s5p_time_start(timer_source.event_id, PERIODIC);
> -		break;
> -
> -	case CLOCK_EVT_MODE_ONESHOT:
> -		break;
> -
> -	case CLOCK_EVT_MODE_UNUSED:
> -	case CLOCK_EVT_MODE_SHUTDOWN:
> -		break;
> -
> -	case CLOCK_EVT_MODE_RESUME:
> -		s5p_timer_resume();
> -		break;
> -	}
> -}
> -
> -static void s5p_timer_resume(void)
> -{
> -	/* event timer restart */
> -	s5p_time_setup(timer_source.event_id, clock_count_per_tick);
> -	s5p_time_start(timer_source.event_id, PERIODIC);
> -
> -	/* source timer restart */
> -	s5p_time_setup(timer_source.source_id, TCNT_MAX);
> -	s5p_time_start(timer_source.source_id, PERIODIC);
> -}
> -
> -void __init s5p_set_timer_source(enum s5p_timer_mode event,
> -				 enum s5p_timer_mode source)
> -{
> -	s3c_device_timer[event].dev.bus = &platform_bus_type;
> -	s3c_device_timer[source].dev.bus = &platform_bus_type;
> -
> -	timer_source.event_id = event;
> -	timer_source.source_id = source;
> -}
> -
> -static struct clock_event_device time_event_device = {
> -	.name		= "s5p_event_timer",
> -	.features	= CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT,
> -	.rating		= 200,
> -	.set_next_event	= s5p_set_next_event,
> -	.set_mode	= s5p_set_mode,
> -};
> -
> -static irqreturn_t s5p_clock_event_isr(int irq, void *dev_id)
> -{
> -	struct clock_event_device *evt = dev_id;
> -
> -	evt->event_handler(evt);
> -
> -	return IRQ_HANDLED;
> -}
> -
> -static struct irqaction s5p_clock_event_irq = {
> -	.name		= "s5p_time_irq",
> -	.flags		= IRQF_DISABLED | IRQF_TIMER | IRQF_IRQPOLL,
> -	.handler	= s5p_clock_event_isr,
> -	.dev_id		= &time_event_device,
> -};
> -
> -static void __init s5p_clockevent_init(void)
> -{
> -	unsigned long pclk;
> -	unsigned long clock_rate;
> -	unsigned int irq_number;
> -	struct clk *tscaler;
> -
> -	pclk = clk_get_rate(timerclk);
> -
> -	tscaler = clk_get_parent(tdiv_event);
> -
> -	clk_set_rate(tscaler, pclk / 2);
> -	clk_set_rate(tdiv_event, pclk / 2);
> -	clk_set_parent(tin_event, tdiv_event);
> -
> -	clock_rate = clk_get_rate(tin_event);
> -	clock_count_per_tick = clock_rate / HZ;
> -
> -	clockevents_calc_mult_shift(&time_event_device,
> -				    clock_rate, S5PTIMER_MIN_RANGE);
> -	time_event_device.max_delta_ns =
> -		clockevent_delta2ns(-1, &time_event_device);
> -	time_event_device.min_delta_ns =
> -		clockevent_delta2ns(1, &time_event_device);
> -
> -	time_event_device.cpumask = cpumask_of(0);
> -	clockevents_register_device(&time_event_device);
> -
> -	irq_number = timer_source.event_id + IRQ_TIMER0;
> -	setup_irq(irq_number, &s5p_clock_event_irq);
> -}
> -
> -static void __iomem *s5p_timer_reg(void)
> -{
> -	unsigned long offset = 0;
> -
> -	switch (timer_source.source_id) {
> -	case S5P_PWM0:
> -	case S5P_PWM1:
> -	case S5P_PWM2:
> -	case S5P_PWM3:
> -		offset = (timer_source.source_id * 0x0c) + 0x14;
> -		break;
> -
> -	case S5P_PWM4:
> -		offset = 0x40;
> -		break;
> -
> -	default:
> -		printk(KERN_ERR "Invalid Timer %d\n",
> timer_source.source_id);
> -		return NULL;
> -	}
> -
> -	return S3C_TIMERREG(offset);
> -}
> -
> -/*
> - * Override the global weak sched_clock symbol with this
> - * local implementation which uses the clocksource to get some
> - * better resolution when scheduling the kernel. We accept that
> - * this wraps around for now, since it is just a relative time
> - * stamp. (Inspired by U300 implementation.)
> - */
> -static u32 notrace s5p_read_sched_clock(void)
> -{
> -	void __iomem *reg = s5p_timer_reg();
> -
> -	if (!reg)
> -		return 0;
> -
> -	return ~__raw_readl(reg);
> -}
> -
> -static void __init s5p_clocksource_init(void)
> -{
> -	unsigned long pclk;
> -	unsigned long clock_rate;
> -
> -	pclk = clk_get_rate(timerclk);
> -
> -	clk_set_rate(tdiv_source, pclk / 2);
> -	clk_set_parent(tin_source, tdiv_source);
> -
> -	clock_rate = clk_get_rate(tin_source);
> -
> -	s5p_time_setup(timer_source.source_id, TCNT_MAX);
> -	s5p_time_start(timer_source.source_id, PERIODIC);
> -
> -	setup_sched_clock(s5p_read_sched_clock, 32, clock_rate);
> -
> -	if (clocksource_mmio_init(s5p_timer_reg(), "s5p_clocksource_timer",
> -			clock_rate, 250, 32, clocksource_mmio_readl_down))
> -		panic("s5p_clocksource_timer: can't register
clocksource\n");
> -}
> -
> -static void __init s5p_timer_resources(void)
> -{
> -
> -	unsigned long event_id = timer_source.event_id;
> -	unsigned long source_id = timer_source.source_id;
> -	char devname[15];
> -
> -	timerclk = clk_get(NULL, "timers");
> -	if (IS_ERR(timerclk))
> -		panic("failed to get timers clock for timer");
> -
> -	clk_enable(timerclk);
> -
> -	sprintf(devname, "s3c24xx-pwm.%lu", event_id);
> -	s3c_device_timer[event_id].id = event_id;
> -	s3c_device_timer[event_id].dev.init_name = devname;
> -
> -	tin_event = clk_get(&s3c_device_timer[event_id].dev, "pwm-tin");
> -	if (IS_ERR(tin_event))
> -		panic("failed to get pwm-tin clock for event timer");
> -
> -	tdiv_event = clk_get(&s3c_device_timer[event_id].dev, "pwm-tdiv");
> -	if (IS_ERR(tdiv_event))
> -		panic("failed to get pwm-tdiv clock for event timer");
> -
> -	clk_enable(tin_event);
> -
> -	sprintf(devname, "s3c24xx-pwm.%lu", source_id);
> -	s3c_device_timer[source_id].id = source_id;
> -	s3c_device_timer[source_id].dev.init_name = devname;
> -
> -	tin_source = clk_get(&s3c_device_timer[source_id].dev, "pwm-tin");
> -	if (IS_ERR(tin_source))
> -		panic("failed to get pwm-tin clock for source timer");
> -
> -	tdiv_source = clk_get(&s3c_device_timer[source_id].dev, "pwm-tdiv");
> -	if (IS_ERR(tdiv_source))
> -		panic("failed to get pwm-tdiv clock for source timer");
> -
> -	clk_enable(tin_source);
> -}
> -
> -static void __init s5p_timer_init(void)
> -{
> -	s5p_timer_resources();
> -	s5p_clockevent_init();
> -	s5p_clocksource_init();
> -}
> -
> -struct sys_timer s5p_timer = {
> -	.init		= s5p_timer_init,
> -};
> diff --git a/arch/arm/plat-samsung/samsung-time.c b/arch/arm/plat-
> samsung/samsung-time.c
> new file mode 100644
> index 0000000..6d63fca
> --- /dev/null
> +++ b/arch/arm/plat-samsung/samsung-time.c
> @@ -0,0 +1,405 @@
> +/*
> + * Copyright (c) 2011 Samsung Electronics Co., Ltd.
> + *		http://www.samsung.com/
> + *
> + * samsung - Common hr-timer support (s3c and s5p)
> + *
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License version 2 as
> + * published by the Free Software Foundation.
> +*/
> +
> +#include <linux/interrupt.h>
> +#include <linux/irq.h>
> +#include <linux/err.h>
> +#include <linux/clk.h>
> +#include <linux/clockchips.h>
> +#include <linux/platform_device.h>
> +
> +#include <asm/smp_twd.h>
> +#include <asm/mach/time.h>
> +#include <asm/mach/arch.h>
> +#include <asm/mach/map.h>
> +#include <asm/sched_clock.h>
> +
> +#include <mach/map.h>
> +#include <plat/devs.h>
> +#include <plat/regs-timer.h>
> +#include <plat/samsung-time.h>
> +
> +static struct clk *tin_event;
> +static struct clk *tin_source;
> +static struct clk *tdiv_event;
> +static struct clk *tdiv_source;
> +static struct clk *timerclk;
> +static struct samsung_timer_source timer_source;
> +static unsigned long clock_count_per_tick;
> +static void samsung_timer_resume(void);
> +
> +static void samsung_time_stop(enum samsung_timer_mode mode)
> +{
> +	unsigned long tcon;
> +
> +	tcon = __raw_readl(S3C2410_TCON);
> +
> +	switch (mode) {
> +	case SAMSUNG_PWM0:
> +		tcon &= ~S3C2410_TCON_T0START;
> +		break;
> +
> +	case SAMSUNG_PWM1:
> +		tcon &= ~S3C2410_TCON_T1START;
> +		break;
> +
> +	case SAMSUNG_PWM2:
> +		tcon &= ~S3C2410_TCON_T2START;
> +		break;
> +
> +	case SAMSUNG_PWM3:
> +		tcon &= ~S3C2410_TCON_T3START;
> +		break;
> +
> +	case SAMSUNG_PWM4:
> +		tcon &= ~S3C2410_TCON_T4START;
> +		break;
> +
> +	default:
> +		printk(KERN_ERR "Invalid Timer %d\n", mode);
> +		break;
> +	}
> +	__raw_writel(tcon, S3C2410_TCON);
> +}
> +
> +static void samsung_time_setup(enum samsung_timer_mode mode, unsigned
> long tcnt)
> +{
> +	unsigned long tcon;
> +
> +	tcon = __raw_readl(S3C2410_TCON);
> +
> +	tcnt--;
> +
> +	switch (mode) {
> +	case SAMSUNG_PWM0:
> +		tcon &= ~(0x0f << 0);
> +		tcon |= S3C2410_TCON_T0MANUALUPD;
> +		break;
> +
> +	case SAMSUNG_PWM1:
> +		tcon &= ~(0x0f << 8);
> +		tcon |= S3C2410_TCON_T1MANUALUPD;
> +		break;
> +
> +	case SAMSUNG_PWM2:
> +		tcon &= ~(0x0f << 12);
> +		tcon |= S3C2410_TCON_T2MANUALUPD;
> +		break;
> +
> +	case SAMSUNG_PWM3:
> +		tcon &= ~(0x0f << 16);
> +		tcon |= S3C2410_TCON_T3MANUALUPD;
> +		break;
> +
> +	case SAMSUNG_PWM4:
> +		tcon &= ~(0x07 << 20);
> +		tcon |= S3C2410_TCON_T4MANUALUPD;
> +		break;
> +
> +	default:
> +		printk(KERN_ERR "Invalid Timer %d\n", mode);
> +		break;
> +	}
> +
> +	__raw_writel(tcnt, S3C2410_TCNTB(mode));
> +	__raw_writel(tcnt, S3C2410_TCMPB(mode));
> +	__raw_writel(tcon, S3C2410_TCON);
> +}
> +
> +static void samsung_time_start(enum samsung_timer_mode mode, bool
> periodic)
> +{
> +	unsigned long tcon;
> +
> +	tcon  = __raw_readl(S3C2410_TCON);
> +
> +	switch (mode) {
> +	case SAMSUNG_PWM0:
> +		tcon |= S3C2410_TCON_T0START;
> +		tcon &= ~S3C2410_TCON_T0MANUALUPD;
> +
> +		if (periodic)
> +			tcon |= S3C2410_TCON_T0RELOAD;
> +		else
> +			tcon &= ~S3C2410_TCON_T0RELOAD;
> +		break;
> +
> +	case SAMSUNG_PWM1:
> +		tcon |= S3C2410_TCON_T1START;
> +		tcon &= ~S3C2410_TCON_T1MANUALUPD;
> +
> +		if (periodic)
> +			tcon |= S3C2410_TCON_T1RELOAD;
> +		else
> +			tcon &= ~S3C2410_TCON_T1RELOAD;
> +		break;
> +
> +	case SAMSUNG_PWM2:
> +		tcon |= S3C2410_TCON_T2START;
> +		tcon &= ~S3C2410_TCON_T2MANUALUPD;
> +
> +		if (periodic)
> +			tcon |= S3C2410_TCON_T2RELOAD;
> +		else
> +			tcon &= ~S3C2410_TCON_T2RELOAD;
> +		break;
> +
> +	case SAMSUNG_PWM3:
> +		tcon |= S3C2410_TCON_T3START;
> +		tcon &= ~S3C2410_TCON_T3MANUALUPD;
> +
> +		if (periodic)
> +			tcon |= S3C2410_TCON_T3RELOAD;
> +		else
> +			tcon &= ~S3C2410_TCON_T3RELOAD;
> +		break;
> +
> +	case SAMSUNG_PWM4:
> +		tcon |= S3C2410_TCON_T4START;
> +		tcon &= ~S3C2410_TCON_T4MANUALUPD;
> +
> +		if (periodic)
> +			tcon |= S3C2410_TCON_T4RELOAD;
> +		else
> +			tcon &= ~S3C2410_TCON_T4RELOAD;
> +		break;
> +
> +	default:
> +		printk(KERN_ERR "Invalid Timer %d\n", mode);
> +		break;
> +	}
> +	__raw_writel(tcon, S3C2410_TCON);
> +}
> +
> +static int samsung_set_next_event(unsigned long cycles,
> +				struct clock_event_device *evt)
> +{
> +	samsung_time_setup(timer_source.event_id, cycles);
> +	samsung_time_start(timer_source.event_id, NON_PERIODIC);
> +
> +	return 0;
> +}
> +
> +static void samsung_set_mode(enum clock_event_mode mode,
> +				struct clock_event_device *evt)
> +{
> +	samsung_time_stop(timer_source.event_id);
> +
> +	switch (mode) {
> +	case CLOCK_EVT_MODE_PERIODIC:
> +		samsung_time_setup(timer_source.event_id,
> clock_count_per_tick);
> +		samsung_time_start(timer_source.event_id, PERIODIC);
> +		break;
> +
> +	case CLOCK_EVT_MODE_ONESHOT:
> +		break;
> +
> +	case CLOCK_EVT_MODE_UNUSED:
> +	case CLOCK_EVT_MODE_SHUTDOWN:
> +		break;
> +
> +	case CLOCK_EVT_MODE_RESUME:
> +		samsung_timer_resume();
> +		break;
> +	}
> +}
> +
> +static void samsung_timer_resume(void)
> +{
> +	/* event timer restart */
> +	samsung_time_setup(timer_source.event_id, clock_count_per_tick);
> +	samsung_time_start(timer_source.event_id, PERIODIC);
> +
> +	/* source timer restart */
> +	samsung_time_setup(timer_source.source_id, TCNT_MAX);
> +	samsung_time_start(timer_source.source_id, PERIODIC);
> +}
> +
> +void __init samsung_set_timer_source(enum samsung_timer_mode event,
> +				 enum samsung_timer_mode source)
> +{
> +	s3c_device_timer[event].dev.bus = &platform_bus_type;
> +	s3c_device_timer[source].dev.bus = &platform_bus_type;
> +
> +	timer_source.event_id = event;
> +	timer_source.source_id = source;
> +}
> +
> +static struct clock_event_device time_event_device = {
> +	.name		= "samsung_event_timer",
> +	.features	= CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT,
> +	.rating		= 200,
> +	.set_next_event	= samsung_set_next_event,
> +	.set_mode	= samsung_set_mode,
> +};
> +
> +static irqreturn_t samsung_clock_event_isr(int irq, void *dev_id)
> +{
> +	struct clock_event_device *evt = dev_id;
> +
> +	evt->event_handler(evt);
> +
> +	return IRQ_HANDLED;
> +}
> +
> +static struct irqaction samsung_clock_event_irq = {
> +	.name		= "samsung_time_irq",
> +	.flags		= IRQF_DISABLED | IRQF_TIMER | IRQF_IRQPOLL,
> +	.handler	= samsung_clock_event_isr,
> +	.dev_id		= &time_event_device,
> +};
> +
> +static void __init samsung_clockevent_init(void)
> +{
> +	unsigned long pclk;
> +	unsigned long clock_rate;
> +	unsigned int irq_number;
> +	struct clk *tscaler;
> +
> +	pclk = clk_get_rate(timerclk);
> +
> +	tscaler = clk_get_parent(tdiv_event);
> +
> +	clk_set_rate(tscaler, pclk / TSCALER_DIV);
> +	clk_set_rate(tdiv_event, pclk / TDIV);
> +	clk_set_parent(tin_event, tdiv_event);
> +
> +	clock_rate = clk_get_rate(tin_event);
> +	clock_count_per_tick = clock_rate / HZ;
> +
> +	clockevents_calc_mult_shift(&time_event_device,
> +				    clock_rate, SAMSUNG_TIMER_MIN_RANGE);
> +	time_event_device.max_delta_ns =
> +		clockevent_delta2ns(-1, &time_event_device);
> +	time_event_device.min_delta_ns =
> +		clockevent_delta2ns(1, &time_event_device);
> +
> +	time_event_device.cpumask = cpumask_of(0);
> +	clockevents_register_device(&time_event_device);
> +
> +	irq_number = timer_source.event_id + IRQ_TIMER0;
> +	setup_irq(irq_number, &samsung_clock_event_irq);
> +}
> +
> +static void __iomem *samsung_timer_reg(void)
> +{
> +	unsigned long offset = 0;
> +
> +	switch (timer_source.source_id) {
> +	case SAMSUNG_PWM0:
> +	case SAMSUNG_PWM1:
> +	case SAMSUNG_PWM2:
> +	case SAMSUNG_PWM3:
> +		offset = (timer_source.source_id * 0x0c) + 0x14;
> +		break;
> +
> +	case SAMSUNG_PWM4:
> +		offset = 0x40;
> +		break;
> +
> +	default:
> +		printk(KERN_ERR "Invalid Timer %d\n",
> timer_source.source_id);
> +		return NULL;
> +	}
> +
> +	return S3C_TIMERREG(offset);
> +}
> +
> +/*
> + * Override the global weak sched_clock symbol with this
> + * local implementation which uses the clocksource to get some
> + * better resolution when scheduling the kernel. We accept that
> + * this wraps around for now, since it is just a relative time
> + * stamp. (Inspired by U300 implementation.)
> + */
> +static u32 notrace samsung_read_sched_clock(void)
> +{
> +	void __iomem *reg = samsung_timer_reg();
> +
> +	if (!reg)
> +		return 0;
> +
> +	return ~__raw_readl(reg);
> +}
> +
> +static void __init samsung_clocksource_init(void)
> +{
> +	unsigned long pclk;
> +	unsigned long clock_rate;
> +
> +	pclk = clk_get_rate(timerclk);
> +
> +	clk_set_rate(tdiv_source, pclk / TDIV);
> +	clk_set_parent(tin_source, tdiv_source);
> +
> +	clock_rate = clk_get_rate(tin_source);
> +
> +	samsung_time_setup(timer_source.source_id, TCNT_MAX);
> +	samsung_time_start(timer_source.source_id, PERIODIC);
> +
> +	setup_sched_clock(samsung_read_sched_clock, TSIZE, clock_rate);
> +
> +	if (clocksource_mmio_init(samsung_timer_reg(),
> "samsung_clocksource_timer",
> +			clock_rate, 250, TSIZE,
clocksource_mmio_readl_down))
> +		panic("samsung_clocksource_timer: can't register
> clocksource\n");
> +}
> +
> +static void __init samsung_timer_resources(void)
> +{
> +
> +	unsigned long event_id = timer_source.event_id;
> +	unsigned long source_id = timer_source.source_id;
> +	char devname[15];
> +
> +	timerclk = clk_get(NULL, "timers");
> +	if (IS_ERR(timerclk))
> +		panic("failed to get timers clock for timer");
> +
> +	clk_enable(timerclk);
> +
> +	sprintf(devname, "s3c24xx-pwm.%lu", event_id);
> +	s3c_device_timer[event_id].id = event_id;
> +	s3c_device_timer[event_id].dev.init_name = devname;
> +
> +	tin_event = clk_get(&s3c_device_timer[event_id].dev, "pwm-tin");
> +	if (IS_ERR(tin_event))
> +		panic("failed to get pwm-tin clock for event timer");
> +
> +	tdiv_event = clk_get(&s3c_device_timer[event_id].dev, "pwm-tdiv");
> +	if (IS_ERR(tdiv_event))
> +		panic("failed to get pwm-tdiv clock for event timer");
> +
> +	clk_enable(tin_event);
> +
> +	sprintf(devname, "s3c24xx-pwm.%lu", source_id);
> +	s3c_device_timer[source_id].id = source_id;
> +	s3c_device_timer[source_id].dev.init_name = devname;
> +
> +	tin_source = clk_get(&s3c_device_timer[source_id].dev, "pwm-tin");
> +	if (IS_ERR(tin_source))
> +		panic("failed to get pwm-tin clock for source timer");
> +
> +	tdiv_source = clk_get(&s3c_device_timer[source_id].dev, "pwm-tdiv");
> +	if (IS_ERR(tdiv_source))
> +		panic("failed to get pwm-tdiv clock for source timer");
> +
> +	clk_enable(tin_source);
> +}
> +
> +static void __init samsung_timer_init(void)
> +{
> +	samsung_timer_resources();
> +	samsung_clockevent_init();
> +	samsung_clocksource_init();
> +}
> +
> +struct sys_timer samsung_timer = {
> +	.init		= samsung_timer_init,
> +};
> --
> 1.8.0

^ permalink raw reply	[flat|nested] 39+ messages in thread

* Re: [PATCH] S3C24XX: add clockevent/clocksource support
  2012-11-23  2:30     ` Kukjin Kim
@ 2012-11-25  2:54       ` Romain Naour
  2012-11-25 11:09         ` Tomasz Figa
                           ` (3 more replies)
  0 siblings, 4 replies; 39+ messages in thread
From: Romain Naour @ 2012-11-25  2:54 UTC (permalink / raw)
  To: Kukjin Kim
  Cc: 'Tomasz Figa', linux-samsung-soc, ben-linux,
	'Heiko Stübner', 'Sylwester Nawrocki'

Le 23/11/2012 03:30, Kukjin Kim a écrit :
> 
> Basically, looks good to me but need to edit commit message :-)

I will correct that.

> And since this touches many files so would be better if this could be
> applied early -rc not now. It can provide more time to test for many boards.
> Is it ok to you?

I'm ok :-)

> Thanks.
> 
> Best regards,
> Kgene.
> --
> Kukjin Kim <kgene.kim@samsung.com>, Senior Engineer,
> SW Solution Development Team, Samsung Electronics Co., Ltd.
> 

This patch was applied to 3.7-rc1 and tested only on s3c2440 (mini2440).
I could re-apply this patch for the next 3.8-rc if you prefer.

I proposed this patch because I need to have clockevent / clocksource
support to use Xenomai or Linux-rt on mini2440.

Since API clockevent/clocksource is enabled, we can use High Resolution
Timer and Tickless mode. This can be interesting for the Linux side too.

Most of the work is already done in s5p-time.c (renamed samsung-time.c).
I add some #define for s3c24xx case.

Thank you.
Romain

^ permalink raw reply	[flat|nested] 39+ messages in thread

* Re: [PATCH] S3C24XX: add clockevent/clocksource support
  2012-11-25  2:54       ` Romain Naour
@ 2012-11-25 11:09         ` Tomasz Figa
  2012-11-27 23:27         ` [PATCH 1/3] Rename s5p-time to samsung-time Romain Naour
                           ` (2 subsequent siblings)
  3 siblings, 0 replies; 39+ messages in thread
From: Tomasz Figa @ 2012-11-25 11:09 UTC (permalink / raw)
  To: Romain Naour
  Cc: Kukjin Kim, linux-samsung-soc, ben-linux,
	'Heiko Stübner', 'Sylwester Nawrocki'

Hi Romain, Kgene,

On Sunday 25 of November 2012 03:54:51 Romain Naour wrote:
> Le 23/11/2012 03:30, Kukjin Kim a écrit :
> > Basically, looks good to me but need to edit commit message :-)
> 
> I will correct that.
> 
> > And since this touches many files so would be better if this could be
> > applied early -rc not now. It can provide more time to test for many
> > boards. Is it ok to you?
> 
> I'm ok :-)
> 
> > Thanks.
> > 
> > Best regards,
> > Kgene.
> > --
> > Kukjin Kim <kgene.kim@samsung.com>, Senior Engineer,
> > SW Solution Development Team, Samsung Electronics Co., Ltd.
> 
> This patch was applied to 3.7-rc1 and tested only on s3c2440 (mini2440).
> I could re-apply this patch for the next 3.8-rc if you prefer.
> 
> I proposed this patch because I need to have clockevent / clocksource
> support to use Xenomai or Linux-rt on mini2440.
> 
> Since API clockevent/clocksource is enabled, we can use High Resolution
> Timer and Tickless mode. This can be interesting for the Linux side too.
> 
> Most of the work is already done in s5p-time.c (renamed samsung-time.c).
> I add some #define for s3c24xx case.

I would also suggest splitting this huge patch into a series of several 
smaller, possibly:
1) Rename s5p-time to samsung-time (and correct any platforms using it 
currently)
2) Add samsung-time support for s3c24xx
3) Add samsung-time support for s3c64xx

What do you think?

Best regards,
Tomasz Figa

^ permalink raw reply	[flat|nested] 39+ messages in thread

* [PATCH 1/3] Rename s5p-time to samsung-time
  2012-11-25  2:54       ` Romain Naour
  2012-11-25 11:09         ` Tomasz Figa
@ 2012-11-27 23:27         ` Romain Naour
  2012-11-27 23:57           ` Heiko Stübner
  2012-11-27 23:27         ` [PATCH 2/3] Add samsung-time support for s3c24xx Romain Naour
  2012-11-27 23:27         ` [PATCH 3/3] Add samsung-time support for s3c64xx Romain Naour
  3 siblings, 1 reply; 39+ messages in thread
From: Romain Naour @ 2012-11-27 23:27 UTC (permalink / raw)
  To: tomasz.figa
  Cc: Kukjin Kim, linux-samsung-soc, ben-linux,
	'Heiko Stübner', 'Sylwester Nawrocki'

Hi Tomasz, Kgene

> 
> I would also suggest splitting this huge patch into a series of several 
> smaller, possibly:
> 1) Rename s5p-time to samsung-time (and correct any platforms using it 
> currently)
> 2) Add samsung-time support for s3c24xx
> 3) Add samsung-time support for s3c64xx
> 
> What do you think?
> 
> Best regards,
> Tomasz Figa
> 

I have separated the patch into three parts, as you said.
And also, I corrected some oversights ;-)

These patches are for 3.7-rc6.

Here is the first one:

This patch rename s5p-time to samsung-time.
There is no functional change.

Signed-off-by: Naour Romain <romain.naour@openwide.fr>
---
 arch/arm/mach-exynos/Kconfig                      |   2 +-
 arch/arm/mach-exynos/mach-universal_c210.c        |   6 +-
 arch/arm/mach-s5p64x0/Kconfig                     |   4 +-
 arch/arm/mach-s5p64x0/mach-smdk6440.c             |   6 +-
 arch/arm/mach-s5p64x0/mach-smdk6450.c             |   6 +-
 arch/arm/mach-s5pv210/Kconfig                     |   2 +-
 arch/arm/mach-s5pv210/mach-aquila.c               |   6 +-
 arch/arm/mach-s5pv210/mach-goni.c                 |   6 +-
 arch/arm/mach-s5pv210/mach-smdkc110.c             |   6 +-
 arch/arm/mach-s5pv210/mach-smdkv210.c             |   6 +-
 arch/arm/mach-s5pv210/mach-torbreck.c             |   6 +-
 arch/arm/plat-samsung/Kconfig                     |   2 +-
 arch/arm/plat-samsung/Makefile                    |   2 +-
 arch/arm/plat-samsung/include/plat/s5p-time.h     |  40 ---
 arch/arm/plat-samsung/include/plat/samsung-time.h |  40 +++
 arch/arm/plat-samsung/s5p-time.c                  | 405 ----------------------
 arch/arm/plat-samsung/samsung-time.c              | 405 ++++++++++++++++++++++
 17 files changed, 475 insertions(+), 475 deletions(-)
 delete mode 100644 arch/arm/plat-samsung/include/plat/s5p-time.h
 create mode 100644 arch/arm/plat-samsung/include/plat/samsung-time.h
 delete mode 100644 arch/arm/plat-samsung/s5p-time.c
 create mode 100644 arch/arm/plat-samsung/samsung-time.c

diff --git a/arch/arm/mach-exynos/Kconfig b/arch/arm/mach-exynos/Kconfig
index da55107..20edfa3 100644
--- a/arch/arm/mach-exynos/Kconfig
+++ b/arch/arm/mach-exynos/Kconfig
@@ -274,7 +274,7 @@ config MACH_UNIVERSAL_C210
 	select S5P_DEV_ONENAND
 	select S5P_DEV_TV
 	select S5P_GPIO_INT
-	select S5P_HRT
+	select SAMSUNG_HRT
 	select S5P_SETUP_MIPIPHY
 	help
 	  Machine support for Samsung Mobile Universal S5PC210 Reference
diff --git a/arch/arm/mach-exynos/mach-universal_c210.c b/arch/arm/mach-exynos/mach-universal_c210.c
index ebc9dd3..325bfe9 100644
--- a/arch/arm/mach-exynos/mach-universal_c210.c
+++ b/arch/arm/mach-exynos/mach-universal_c210.c
@@ -41,7 +41,7 @@
 #include <plat/mfc.h>
 #include <plat/sdhci.h>
 #include <plat/fimc-core.h>
-#include <plat/s5p-time.h>
+#include <plat/samsung-time.h>
 #include <plat/camport.h>
 #include <linux/platform_data/mipi-csis.h>
 
@@ -1099,7 +1099,7 @@ static void __init universal_map_io(void)
 	exynos_init_io(NULL, 0);
 	s3c24xx_init_clocks(clk_xusbxti.rate);
 	s3c24xx_init_uarts(universal_uartcfgs, ARRAY_SIZE(universal_uartcfgs));
-	s5p_set_timer_source(S5P_PWM2, S5P_PWM4);
+	samsung_set_timer_source(SAMSUNG_PWM2, SAMSUNG_PWM4);
 }
 
 static void s5p_tv_setup(void)
@@ -1158,7 +1158,7 @@ MACHINE_START(UNIVERSAL_C210, "UNIVERSAL_C210")
 	.handle_irq	= gic_handle_irq,
 	.init_machine	= universal_machine_init,
 	.init_late	= exynos_init_late,
-	.timer		= &s5p_timer,
+	.timer		= &samsung_timer,
 	.reserve        = &universal_reserve,
 	.restart	= exynos4_restart,
 MACHINE_END
diff --git a/arch/arm/mach-s5p64x0/Kconfig b/arch/arm/mach-s5p64x0/Kconfig
index e8742cb..f0ec535 100644
--- a/arch/arm/mach-s5p64x0/Kconfig
+++ b/arch/arm/mach-s5p64x0/Kconfig
@@ -9,7 +9,7 @@ if ARCH_S5P64X0
 
 config CPU_S5P6440
 	bool
-	select S5P_HRT
+	select SAMSUNG_HRT
 	select S5P_SLEEP if PM
 	select SAMSUNG_DMADEV
 	select SAMSUNG_WAKEMASK if PM
@@ -18,7 +18,7 @@ config CPU_S5P6440
 
 config CPU_S5P6450
 	bool
-	select S5P_HRT
+	select SAMSUNG_HRT
 	select S5P_SLEEP if PM
 	select SAMSUNG_DMADEV
 	select SAMSUNG_WAKEMASK if PM
diff --git a/arch/arm/mach-s5p64x0/mach-smdk6440.c b/arch/arm/mach-s5p64x0/mach-smdk6440.c
index 96ea1fe..587fec5 100644
--- a/arch/arm/mach-s5p64x0/mach-smdk6440.c
+++ b/arch/arm/mach-s5p64x0/mach-smdk6440.c
@@ -50,7 +50,7 @@
 #include <plat/pll.h>
 #include <plat/adc.h>
 #include <linux/platform_data/touchscreen-s3c2410.h>
-#include <plat/s5p-time.h>
+#include <plat/samsung-time.h>
 #include <plat/backlight.h>
 #include <plat/fb.h>
 #include <plat/sdhci.h>
@@ -231,7 +231,7 @@ static void __init smdk6440_map_io(void)
 	s5p64x0_init_io(NULL, 0);
 	s3c24xx_init_clocks(12000000);
 	s3c24xx_init_uarts(smdk6440_uartcfgs, ARRAY_SIZE(smdk6440_uartcfgs));
-	s5p_set_timer_source(S5P_PWM3, S5P_PWM4);
+	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
 }
 
 static void s5p6440_set_lcd_interface(void)
@@ -276,6 +276,6 @@ MACHINE_START(SMDK6440, "SMDK6440")
 	.handle_irq	= vic_handle_irq,
 	.map_io		= smdk6440_map_io,
 	.init_machine	= smdk6440_machine_init,
-	.timer		= &s5p_timer,
+	.timer		= &samsung_timer,
 	.restart	= s5p64x0_restart,
 MACHINE_END
diff --git a/arch/arm/mach-s5p64x0/mach-smdk6450.c b/arch/arm/mach-s5p64x0/mach-smdk6450.c
index 12748b6..714cd8a 100644
--- a/arch/arm/mach-s5p64x0/mach-smdk6450.c
+++ b/arch/arm/mach-s5p64x0/mach-smdk6450.c
@@ -50,7 +50,7 @@
 #include <plat/pll.h>
 #include <plat/adc.h>
 #include <linux/platform_data/touchscreen-s3c2410.h>
-#include <plat/s5p-time.h>
+#include <plat/samsung-time.h>
 #include <plat/backlight.h>
 #include <plat/fb.h>
 #include <plat/sdhci.h>
@@ -250,7 +250,7 @@ static void __init smdk6450_map_io(void)
 	s5p64x0_init_io(NULL, 0);
 	s3c24xx_init_clocks(19200000);
 	s3c24xx_init_uarts(smdk6450_uartcfgs, ARRAY_SIZE(smdk6450_uartcfgs));
-	s5p_set_timer_source(S5P_PWM3, S5P_PWM4);
+	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
 }
 
 static void s5p6450_set_lcd_interface(void)
@@ -295,6 +295,6 @@ MACHINE_START(SMDK6450, "SMDK6450")
 	.handle_irq	= vic_handle_irq,
 	.map_io		= smdk6450_map_io,
 	.init_machine	= smdk6450_machine_init,
-	.timer		= &s5p_timer,
+	.timer		= &samsung_timer,
 	.restart	= s5p64x0_restart,
 MACHINE_END
diff --git a/arch/arm/mach-s5pv210/Kconfig b/arch/arm/mach-s5pv210/Kconfig
index 92ad72f..01018ef 100644
--- a/arch/arm/mach-s5pv210/Kconfig
+++ b/arch/arm/mach-s5pv210/Kconfig
@@ -12,7 +12,7 @@ if ARCH_S5PV210
 config CPU_S5PV210
 	bool
 	select S5P_EXT_INT
-	select S5P_HRT
+	select SAMSUNG_HRT
 	select S5P_PM if PM
 	select S5P_SLEEP if PM
 	select SAMSUNG_DMADEV
diff --git a/arch/arm/mach-s5pv210/mach-aquila.c b/arch/arm/mach-s5pv210/mach-aquila.c
index ee9fa5c..7c7d89b 100644
--- a/arch/arm/mach-s5pv210/mach-aquila.c
+++ b/arch/arm/mach-s5pv210/mach-aquila.c
@@ -39,7 +39,7 @@
 #include <plat/fb.h>
 #include <plat/fimc-core.h>
 #include <plat/sdhci.h>
-#include <plat/s5p-time.h>
+#include <plat/samsung-time.h>
 
 #include "common.h"
 
@@ -652,7 +652,7 @@ static void __init aquila_map_io(void)
 	s5pv210_init_io(NULL, 0);
 	s3c24xx_init_clocks(24000000);
 	s3c24xx_init_uarts(aquila_uartcfgs, ARRAY_SIZE(aquila_uartcfgs));
-	s5p_set_timer_source(S5P_PWM3, S5P_PWM4);
+	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
 }
 
 static void __init aquila_machine_init(void)
@@ -688,6 +688,6 @@ MACHINE_START(AQUILA, "Aquila")
 	.handle_irq	= vic_handle_irq,
 	.map_io		= aquila_map_io,
 	.init_machine	= aquila_machine_init,
-	.timer		= &s5p_timer,
+	.timer		= &samsung_timer,
 	.restart	= s5pv210_restart,
 MACHINE_END
diff --git a/arch/arm/mach-s5pv210/mach-goni.c b/arch/arm/mach-s5pv210/mach-goni.c
index 55e1dba..2740001 100644
--- a/arch/arm/mach-s5pv210/mach-goni.c
+++ b/arch/arm/mach-s5pv210/mach-goni.c
@@ -48,7 +48,7 @@
 #include <plat/keypad.h>
 #include <plat/sdhci.h>
 #include <plat/clock.h>
-#include <plat/s5p-time.h>
+#include <plat/samsung-time.h>
 #include <plat/mfc.h>
 #include <plat/camport.h>
 
@@ -910,7 +910,7 @@ static void __init goni_map_io(void)
 	s5pv210_init_io(NULL, 0);
 	s3c24xx_init_clocks(clk_xusbxti.rate);
 	s3c24xx_init_uarts(goni_uartcfgs, ARRAY_SIZE(goni_uartcfgs));
-	s5p_set_timer_source(S5P_PWM3, S5P_PWM4);
+	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
 }
 
 static void __init goni_reserve(void)
@@ -976,7 +976,7 @@ MACHINE_START(GONI, "GONI")
 	.handle_irq	= vic_handle_irq,
 	.map_io		= goni_map_io,
 	.init_machine	= goni_machine_init,
-	.timer		= &s5p_timer,
+	.timer		= &samsung_timer,
 	.reserve	= &goni_reserve,
 	.restart	= s5pv210_restart,
 MACHINE_END
diff --git a/arch/arm/mach-s5pv210/mach-smdkc110.c b/arch/arm/mach-s5pv210/mach-smdkc110.c
index d9c99fc..d2e93b7 100644
--- a/arch/arm/mach-s5pv210/mach-smdkc110.c
+++ b/arch/arm/mach-s5pv210/mach-smdkc110.c
@@ -30,7 +30,7 @@
 #include <linux/platform_data/ata-samsung_cf.h>
 #include <linux/platform_data/i2c-s3c2410.h>
 #include <plat/pm.h>
-#include <plat/s5p-time.h>
+#include <plat/samsung-time.h>
 #include <plat/mfc.h>
 
 #include "common.h"
@@ -122,7 +122,7 @@ static void __init smdkc110_map_io(void)
 	s5pv210_init_io(NULL, 0);
 	s3c24xx_init_clocks(24000000);
 	s3c24xx_init_uarts(smdkv210_uartcfgs, ARRAY_SIZE(smdkv210_uartcfgs));
-	s5p_set_timer_source(S5P_PWM3, S5P_PWM4);
+	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
 }
 
 static void __init smdkc110_reserve(void)
@@ -156,7 +156,7 @@ MACHINE_START(SMDKC110, "SMDKC110")
 	.handle_irq	= vic_handle_irq,
 	.map_io		= smdkc110_map_io,
 	.init_machine	= smdkc110_machine_init,
-	.timer		= &s5p_timer,
+	.timer		= &samsung_timer,
 	.restart	= s5pv210_restart,
 	.reserve	= &smdkc110_reserve,
 MACHINE_END
diff --git a/arch/arm/mach-s5pv210/mach-smdkv210.c b/arch/arm/mach-s5pv210/mach-smdkv210.c
index 4cdb5bb..cd28725 100644
--- a/arch/arm/mach-s5pv210/mach-smdkv210.c
+++ b/arch/arm/mach-s5pv210/mach-smdkv210.c
@@ -45,7 +45,7 @@
 #include <plat/keypad.h>
 #include <plat/pm.h>
 #include <plat/fb.h>
-#include <plat/s5p-time.h>
+#include <plat/samsung-time.h>
 #include <plat/backlight.h>
 #include <plat/mfc.h>
 #include <plat/clock.h>
@@ -287,7 +287,7 @@ static void __init smdkv210_map_io(void)
 	s5pv210_init_io(NULL, 0);
 	s3c24xx_init_clocks(clk_xusbxti.rate);
 	s3c24xx_init_uarts(smdkv210_uartcfgs, ARRAY_SIZE(smdkv210_uartcfgs));
-	s5p_set_timer_source(S5P_PWM2, S5P_PWM4);
+	samsung_set_timer_source(SAMSUNG_PWM2, SAMSUNG_PWM4);
 }
 
 static void __init smdkv210_reserve(void)
@@ -332,7 +332,7 @@ MACHINE_START(SMDKV210, "SMDKV210")
 	.handle_irq	= vic_handle_irq,
 	.map_io		= smdkv210_map_io,
 	.init_machine	= smdkv210_machine_init,
-	.timer		= &s5p_timer,
+	.timer		= &samsung_timer,
 	.restart	= s5pv210_restart,
 	.reserve	= &smdkv210_reserve,
 MACHINE_END
diff --git a/arch/arm/mach-s5pv210/mach-torbreck.c b/arch/arm/mach-s5pv210/mach-torbreck.c
index 18785cb..aec668c 100644
--- a/arch/arm/mach-s5pv210/mach-torbreck.c
+++ b/arch/arm/mach-s5pv210/mach-torbreck.c
@@ -27,7 +27,7 @@
 #include <plat/devs.h>
 #include <plat/cpu.h>
 #include <linux/platform_data/i2c-s3c2410.h>
-#include <plat/s5p-time.h>
+#include <plat/samsung-time.h>
 
 #include "common.h"
 
@@ -107,7 +107,7 @@ static void __init torbreck_map_io(void)
 	s5pv210_init_io(NULL, 0);
 	s3c24xx_init_clocks(24000000);
 	s3c24xx_init_uarts(torbreck_uartcfgs, ARRAY_SIZE(torbreck_uartcfgs));
-	s5p_set_timer_source(S5P_PWM3, S5P_PWM4);
+	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
 }
 
 static void __init torbreck_machine_init(void)
@@ -132,6 +132,6 @@ MACHINE_START(TORBRECK, "TORBRECK")
 	.handle_irq	= vic_handle_irq,
 	.map_io		= torbreck_map_io,
 	.init_machine	= torbreck_machine_init,
-	.timer		= &s5p_timer,
+	.timer		= &samsung_timer,
 	.restart	= s5pv210_restart,
 MACHINE_END
diff --git a/arch/arm/plat-samsung/Kconfig b/arch/arm/plat-samsung/Kconfig
index 59401e1..5278795 100644
--- a/arch/arm/plat-samsung/Kconfig
+++ b/arch/arm/plat-samsung/Kconfig
@@ -70,7 +70,7 @@ config S3C_LOWLEVEL_UART_PORT
 
 # timer options
 
-config S5P_HRT
+config SAMSUNG_HRT
 	bool
 	select SAMSUNG_DEV_PWM
 	help
diff --git a/arch/arm/plat-samsung/Makefile b/arch/arm/plat-samsung/Makefile
index 9e40e8d..06f2312 100644
--- a/arch/arm/plat-samsung/Makefile
+++ b/arch/arm/plat-samsung/Makefile
@@ -13,7 +13,7 @@ obj-				:=
 
 obj-y				+= init.o cpu.o
 obj-$(CONFIG_ARCH_USES_GETTIMEOFFSET)   += time.o
-obj-$(CONFIG_S5P_HRT) 		+= s5p-time.o
+obj-$(CONFIG_SAMSUNG_HRT) 		+= samsung-time.o
 
 obj-$(CONFIG_SAMSUNG_CLOCK)	+= clock.o
 obj-$(CONFIG_SAMSUNG_CLOCK)	+= pwm-clock.o
diff --git a/arch/arm/plat-samsung/include/plat/s5p-time.h b/arch/arm/plat-samsung/include/plat/s5p-time.h
deleted file mode 100644
index 3a70aeb..0000000
--- a/arch/arm/plat-samsung/include/plat/s5p-time.h
+++ /dev/null
@@ -1,40 +0,0 @@
-/* linux/arch/arm/plat-samsung/include/plat/s5p-time.h
- *
- * Copyright 2011 Samsung Electronics Co., Ltd.
- *		http://www.samsung.com/
- *
- * Header file for s5p time support
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
-*/
-
-#ifndef __ASM_PLAT_S5P_TIME_H
-#define __ASM_PLAT_S5P_TIME_H __FILE__
-
-/* S5P HR-Timer Clock mode */
-enum s5p_timer_mode {
-	S5P_PWM0,
-	S5P_PWM1,
-	S5P_PWM2,
-	S5P_PWM3,
-	S5P_PWM4,
-};
-
-struct s5p_timer_source {
-	unsigned int event_id;
-	unsigned int source_id;
-};
-
-/* Be able to sleep for atleast 4 seconds (usually more) */
-#define S5PTIMER_MIN_RANGE	4
-
-#define TCNT_MAX		0xffffffff
-#define NON_PERIODIC		0
-#define PERIODIC		1
-
-extern void __init s5p_set_timer_source(enum s5p_timer_mode event,
-					enum s5p_timer_mode source);
-extern	struct sys_timer s5p_timer;
-#endif /* __ASM_PLAT_S5P_TIME_H */
diff --git a/arch/arm/plat-samsung/include/plat/samsung-time.h b/arch/arm/plat-samsung/include/plat/samsung-time.h
new file mode 100644
index 0000000..9d6d622
--- /dev/null
+++ b/arch/arm/plat-samsung/include/plat/samsung-time.h
@@ -0,0 +1,40 @@
+/* linux/arch/arm/plat-samsung/include/plat/samsung-time.h
+ *
+ * Copyright 2011 Samsung Electronics Co., Ltd.
+ *		http://www.samsung.com/
+ *
+ * Header file for samsung s3c and s5p time support
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+*/
+
+#ifndef __ASM_PLAT_SAMSUNG_TIME_H
+#define __ASM_PLAT_SAMSUNG_TIME_H __FILE__
+
+/* SAMSUNG HR-Timer Clock mode */
+enum samsung_timer_mode {
+	SAMSUNG_PWM0,
+	SAMSUNG_PWM1,
+	SAMSUNG_PWM2,
+	SAMSUNG_PWM3,
+	SAMSUNG_PWM4,
+};
+
+struct samsung_timer_source {
+	unsigned int event_id;
+	unsigned int source_id;
+};
+
+/* Be able to sleep for atleast 4 seconds (usually more) */
+#define SAMSUNG_TIMER_MIN_RANGE	4
+
+#define TCNT_MAX		0xffffffff
+#define NON_PERIODIC		0
+#define PERIODIC		1
+
+extern void __init samsung_set_timer_source(enum samsung_timer_mode event,
+					enum samsung_timer_mode source);
+extern	struct sys_timer samsung_timer;
+#endif /* __ASM_PLAT_SAMSUNG_TIME_H */
diff --git a/arch/arm/plat-samsung/s5p-time.c b/arch/arm/plat-samsung/s5p-time.c
deleted file mode 100644
index 028b6e8..0000000
--- a/arch/arm/plat-samsung/s5p-time.c
+++ /dev/null
@@ -1,405 +0,0 @@
-/*
- * Copyright (c) 2011 Samsung Electronics Co., Ltd.
- *		http://www.samsung.com/
- *
- * S5P - Common hr-timer support
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
-*/
-
-#include <linux/interrupt.h>
-#include <linux/irq.h>
-#include <linux/err.h>
-#include <linux/clk.h>
-#include <linux/clockchips.h>
-#include <linux/platform_device.h>
-
-#include <asm/smp_twd.h>
-#include <asm/mach/time.h>
-#include <asm/mach/arch.h>
-#include <asm/mach/map.h>
-#include <asm/sched_clock.h>
-
-#include <mach/map.h>
-#include <plat/devs.h>
-#include <plat/regs-timer.h>
-#include <plat/s5p-time.h>
-
-static struct clk *tin_event;
-static struct clk *tin_source;
-static struct clk *tdiv_event;
-static struct clk *tdiv_source;
-static struct clk *timerclk;
-static struct s5p_timer_source timer_source;
-static unsigned long clock_count_per_tick;
-static void s5p_timer_resume(void);
-
-static void s5p_time_stop(enum s5p_timer_mode mode)
-{
-	unsigned long tcon;
-
-	tcon = __raw_readl(S3C2410_TCON);
-
-	switch (mode) {
-	case S5P_PWM0:
-		tcon &= ~S3C2410_TCON_T0START;
-		break;
-
-	case S5P_PWM1:
-		tcon &= ~S3C2410_TCON_T1START;
-		break;
-
-	case S5P_PWM2:
-		tcon &= ~S3C2410_TCON_T2START;
-		break;
-
-	case S5P_PWM3:
-		tcon &= ~S3C2410_TCON_T3START;
-		break;
-
-	case S5P_PWM4:
-		tcon &= ~S3C2410_TCON_T4START;
-		break;
-
-	default:
-		printk(KERN_ERR "Invalid Timer %d\n", mode);
-		break;
-	}
-	__raw_writel(tcon, S3C2410_TCON);
-}
-
-static void s5p_time_setup(enum s5p_timer_mode mode, unsigned long tcnt)
-{
-	unsigned long tcon;
-
-	tcon = __raw_readl(S3C2410_TCON);
-
-	tcnt--;
-
-	switch (mode) {
-	case S5P_PWM0:
-		tcon &= ~(0x0f << 0);
-		tcon |= S3C2410_TCON_T0MANUALUPD;
-		break;
-
-	case S5P_PWM1:
-		tcon &= ~(0x0f << 8);
-		tcon |= S3C2410_TCON_T1MANUALUPD;
-		break;
-
-	case S5P_PWM2:
-		tcon &= ~(0x0f << 12);
-		tcon |= S3C2410_TCON_T2MANUALUPD;
-		break;
-
-	case S5P_PWM3:
-		tcon &= ~(0x0f << 16);
-		tcon |= S3C2410_TCON_T3MANUALUPD;
-		break;
-
-	case S5P_PWM4:
-		tcon &= ~(0x07 << 20);
-		tcon |= S3C2410_TCON_T4MANUALUPD;
-		break;
-
-	default:
-		printk(KERN_ERR "Invalid Timer %d\n", mode);
-		break;
-	}
-
-	__raw_writel(tcnt, S3C2410_TCNTB(mode));
-	__raw_writel(tcnt, S3C2410_TCMPB(mode));
-	__raw_writel(tcon, S3C2410_TCON);
-}
-
-static void s5p_time_start(enum s5p_timer_mode mode, bool periodic)
-{
-	unsigned long tcon;
-
-	tcon  = __raw_readl(S3C2410_TCON);
-
-	switch (mode) {
-	case S5P_PWM0:
-		tcon |= S3C2410_TCON_T0START;
-		tcon &= ~S3C2410_TCON_T0MANUALUPD;
-
-		if (periodic)
-			tcon |= S3C2410_TCON_T0RELOAD;
-		else
-			tcon &= ~S3C2410_TCON_T0RELOAD;
-		break;
-
-	case S5P_PWM1:
-		tcon |= S3C2410_TCON_T1START;
-		tcon &= ~S3C2410_TCON_T1MANUALUPD;
-
-		if (periodic)
-			tcon |= S3C2410_TCON_T1RELOAD;
-		else
-			tcon &= ~S3C2410_TCON_T1RELOAD;
-		break;
-
-	case S5P_PWM2:
-		tcon |= S3C2410_TCON_T2START;
-		tcon &= ~S3C2410_TCON_T2MANUALUPD;
-
-		if (periodic)
-			tcon |= S3C2410_TCON_T2RELOAD;
-		else
-			tcon &= ~S3C2410_TCON_T2RELOAD;
-		break;
-
-	case S5P_PWM3:
-		tcon |= S3C2410_TCON_T3START;
-		tcon &= ~S3C2410_TCON_T3MANUALUPD;
-
-		if (periodic)
-			tcon |= S3C2410_TCON_T3RELOAD;
-		else
-			tcon &= ~S3C2410_TCON_T3RELOAD;
-		break;
-
-	case S5P_PWM4:
-		tcon |= S3C2410_TCON_T4START;
-		tcon &= ~S3C2410_TCON_T4MANUALUPD;
-
-		if (periodic)
-			tcon |= S3C2410_TCON_T4RELOAD;
-		else
-			tcon &= ~S3C2410_TCON_T4RELOAD;
-		break;
-
-	default:
-		printk(KERN_ERR "Invalid Timer %d\n", mode);
-		break;
-	}
-	__raw_writel(tcon, S3C2410_TCON);
-}
-
-static int s5p_set_next_event(unsigned long cycles,
-				struct clock_event_device *evt)
-{
-	s5p_time_setup(timer_source.event_id, cycles);
-	s5p_time_start(timer_source.event_id, NON_PERIODIC);
-
-	return 0;
-}
-
-static void s5p_set_mode(enum clock_event_mode mode,
-				struct clock_event_device *evt)
-{
-	s5p_time_stop(timer_source.event_id);
-
-	switch (mode) {
-	case CLOCK_EVT_MODE_PERIODIC:
-		s5p_time_setup(timer_source.event_id, clock_count_per_tick);
-		s5p_time_start(timer_source.event_id, PERIODIC);
-		break;
-
-	case CLOCK_EVT_MODE_ONESHOT:
-		break;
-
-	case CLOCK_EVT_MODE_UNUSED:
-	case CLOCK_EVT_MODE_SHUTDOWN:
-		break;
-
-	case CLOCK_EVT_MODE_RESUME:
-		s5p_timer_resume();
-		break;
-	}
-}
-
-static void s5p_timer_resume(void)
-{
-	/* event timer restart */
-	s5p_time_setup(timer_source.event_id, clock_count_per_tick);
-	s5p_time_start(timer_source.event_id, PERIODIC);
-
-	/* source timer restart */
-	s5p_time_setup(timer_source.source_id, TCNT_MAX);
-	s5p_time_start(timer_source.source_id, PERIODIC);
-}
-
-void __init s5p_set_timer_source(enum s5p_timer_mode event,
-				 enum s5p_timer_mode source)
-{
-	s3c_device_timer[event].dev.bus = &platform_bus_type;
-	s3c_device_timer[source].dev.bus = &platform_bus_type;
-
-	timer_source.event_id = event;
-	timer_source.source_id = source;
-}
-
-static struct clock_event_device time_event_device = {
-	.name		= "s5p_event_timer",
-	.features	= CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT,
-	.rating		= 200,
-	.set_next_event	= s5p_set_next_event,
-	.set_mode	= s5p_set_mode,
-};
-
-static irqreturn_t s5p_clock_event_isr(int irq, void *dev_id)
-{
-	struct clock_event_device *evt = dev_id;
-
-	evt->event_handler(evt);
-
-	return IRQ_HANDLED;
-}
-
-static struct irqaction s5p_clock_event_irq = {
-	.name		= "s5p_time_irq",
-	.flags		= IRQF_DISABLED | IRQF_TIMER | IRQF_IRQPOLL,
-	.handler	= s5p_clock_event_isr,
-	.dev_id		= &time_event_device,
-};
-
-static void __init s5p_clockevent_init(void)
-{
-	unsigned long pclk;
-	unsigned long clock_rate;
-	unsigned int irq_number;
-	struct clk *tscaler;
-
-	pclk = clk_get_rate(timerclk);
-
-	tscaler = clk_get_parent(tdiv_event);
-
-	clk_set_rate(tscaler, pclk / 2);
-	clk_set_rate(tdiv_event, pclk / 2);
-	clk_set_parent(tin_event, tdiv_event);
-
-	clock_rate = clk_get_rate(tin_event);
-	clock_count_per_tick = clock_rate / HZ;
-
-	clockevents_calc_mult_shift(&time_event_device,
-				    clock_rate, S5PTIMER_MIN_RANGE);
-	time_event_device.max_delta_ns =
-		clockevent_delta2ns(-1, &time_event_device);
-	time_event_device.min_delta_ns =
-		clockevent_delta2ns(1, &time_event_device);
-
-	time_event_device.cpumask = cpumask_of(0);
-	clockevents_register_device(&time_event_device);
-
-	irq_number = timer_source.event_id + IRQ_TIMER0;
-	setup_irq(irq_number, &s5p_clock_event_irq);
-}
-
-static void __iomem *s5p_timer_reg(void)
-{
-	unsigned long offset = 0;
-
-	switch (timer_source.source_id) {
-	case S5P_PWM0:
-	case S5P_PWM1:
-	case S5P_PWM2:
-	case S5P_PWM3:
-		offset = (timer_source.source_id * 0x0c) + 0x14;
-		break;
-
-	case S5P_PWM4:
-		offset = 0x40;
-		break;
-
-	default:
-		printk(KERN_ERR "Invalid Timer %d\n", timer_source.source_id);
-		return NULL;
-	}
-
-	return S3C_TIMERREG(offset);
-}
-
-/*
- * Override the global weak sched_clock symbol with this
- * local implementation which uses the clocksource to get some
- * better resolution when scheduling the kernel. We accept that
- * this wraps around for now, since it is just a relative time
- * stamp. (Inspired by U300 implementation.)
- */
-static u32 notrace s5p_read_sched_clock(void)
-{
-	void __iomem *reg = s5p_timer_reg();
-
-	if (!reg)
-		return 0;
-
-	return ~__raw_readl(reg);
-}
-
-static void __init s5p_clocksource_init(void)
-{
-	unsigned long pclk;
-	unsigned long clock_rate;
-
-	pclk = clk_get_rate(timerclk);
-
-	clk_set_rate(tdiv_source, pclk / 2);
-	clk_set_parent(tin_source, tdiv_source);
-
-	clock_rate = clk_get_rate(tin_source);
-
-	s5p_time_setup(timer_source.source_id, TCNT_MAX);
-	s5p_time_start(timer_source.source_id, PERIODIC);
-
-	setup_sched_clock(s5p_read_sched_clock, 32, clock_rate);
-
-	if (clocksource_mmio_init(s5p_timer_reg(), "s5p_clocksource_timer",
-			clock_rate, 250, 32, clocksource_mmio_readl_down))
-		panic("s5p_clocksource_timer: can't register clocksource\n");
-}
-
-static void __init s5p_timer_resources(void)
-{
-
-	unsigned long event_id = timer_source.event_id;
-	unsigned long source_id = timer_source.source_id;
-	char devname[15];
-
-	timerclk = clk_get(NULL, "timers");
-	if (IS_ERR(timerclk))
-		panic("failed to get timers clock for timer");
-
-	clk_enable(timerclk);
-
-	sprintf(devname, "s3c24xx-pwm.%lu", event_id);
-	s3c_device_timer[event_id].id = event_id;
-	s3c_device_timer[event_id].dev.init_name = devname;
-
-	tin_event = clk_get(&s3c_device_timer[event_id].dev, "pwm-tin");
-	if (IS_ERR(tin_event))
-		panic("failed to get pwm-tin clock for event timer");
-
-	tdiv_event = clk_get(&s3c_device_timer[event_id].dev, "pwm-tdiv");
-	if (IS_ERR(tdiv_event))
-		panic("failed to get pwm-tdiv clock for event timer");
-
-	clk_enable(tin_event);
-
-	sprintf(devname, "s3c24xx-pwm.%lu", source_id);
-	s3c_device_timer[source_id].id = source_id;
-	s3c_device_timer[source_id].dev.init_name = devname;
-
-	tin_source = clk_get(&s3c_device_timer[source_id].dev, "pwm-tin");
-	if (IS_ERR(tin_source))
-		panic("failed to get pwm-tin clock for source timer");
-
-	tdiv_source = clk_get(&s3c_device_timer[source_id].dev, "pwm-tdiv");
-	if (IS_ERR(tdiv_source))
-		panic("failed to get pwm-tdiv clock for source timer");
-
-	clk_enable(tin_source);
-}
-
-static void __init s5p_timer_init(void)
-{
-	s5p_timer_resources();
-	s5p_clockevent_init();
-	s5p_clocksource_init();
-}
-
-struct sys_timer s5p_timer = {
-	.init		= s5p_timer_init,
-};
diff --git a/arch/arm/plat-samsung/samsung-time.c b/arch/arm/plat-samsung/samsung-time.c
new file mode 100644
index 0000000..91773bf
--- /dev/null
+++ b/arch/arm/plat-samsung/samsung-time.c
@@ -0,0 +1,405 @@
+/*
+ * Copyright (c) 2011 Samsung Electronics Co., Ltd.
+ *		http://www.samsung.com/
+ *
+ * SAMSUNG - Common hr-timer support
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+*/
+
+#include <linux/interrupt.h>
+#include <linux/irq.h>
+#include <linux/err.h>
+#include <linux/clk.h>
+#include <linux/clockchips.h>
+#include <linux/platform_device.h>
+
+#include <asm/smp_twd.h>
+#include <asm/mach/time.h>
+#include <asm/mach/arch.h>
+#include <asm/mach/map.h>
+#include <asm/sched_clock.h>
+
+#include <mach/map.h>
+#include <plat/devs.h>
+#include <plat/regs-timer.h>
+#include <plat/samsung-time.h>
+
+static struct clk *tin_event;
+static struct clk *tin_source;
+static struct clk *tdiv_event;
+static struct clk *tdiv_source;
+static struct clk *timerclk;
+static struct samsung_timer_source timer_source;
+static unsigned long clock_count_per_tick;
+static void samsung_timer_resume(void);
+
+static void samsung_time_stop(enum samsung_timer_mode mode)
+{
+	unsigned long tcon;
+
+	tcon = __raw_readl(S3C2410_TCON);
+
+	switch (mode) {
+	case SAMSUNG_PWM0:
+		tcon &= ~S3C2410_TCON_T0START;
+		break;
+
+	case SAMSUNG_PWM1:
+		tcon &= ~S3C2410_TCON_T1START;
+		break;
+
+	case SAMSUNG_PWM2:
+		tcon &= ~S3C2410_TCON_T2START;
+		break;
+
+	case SAMSUNG_PWM3:
+		tcon &= ~S3C2410_TCON_T3START;
+		break;
+
+	case SAMSUNG_PWM4:
+		tcon &= ~S3C2410_TCON_T4START;
+		break;
+
+	default:
+		printk(KERN_ERR "Invalid Timer %d\n", mode);
+		break;
+	}
+	__raw_writel(tcon, S3C2410_TCON);
+}
+
+static void samsung_time_setup(enum samsung_timer_mode mode, unsigned long tcnt)
+{
+	unsigned long tcon;
+
+	tcon = __raw_readl(S3C2410_TCON);
+
+	tcnt--;
+
+	switch (mode) {
+	case SAMSUNG_PWM0:
+		tcon &= ~(0x0f << 0);
+		tcon |= S3C2410_TCON_T0MANUALUPD;
+		break;
+
+	case SAMSUNG_PWM1:
+		tcon &= ~(0x0f << 8);
+		tcon |= S3C2410_TCON_T1MANUALUPD;
+		break;
+
+	case SAMSUNG_PWM2:
+		tcon &= ~(0x0f << 12);
+		tcon |= S3C2410_TCON_T2MANUALUPD;
+		break;
+
+	case SAMSUNG_PWM3:
+		tcon &= ~(0x0f << 16);
+		tcon |= S3C2410_TCON_T3MANUALUPD;
+		break;
+
+	case SAMSUNG_PWM4:
+		tcon &= ~(0x07 << 20);
+		tcon |= S3C2410_TCON_T4MANUALUPD;
+		break;
+
+	default:
+		printk(KERN_ERR "Invalid Timer %d\n", mode);
+		break;
+	}
+
+	__raw_writel(tcnt, S3C2410_TCNTB(mode));
+	__raw_writel(tcnt, S3C2410_TCMPB(mode));
+	__raw_writel(tcon, S3C2410_TCON);
+}
+
+static void samsung_time_start(enum samsung_timer_mode mode, bool periodic)
+{
+	unsigned long tcon;
+
+	tcon  = __raw_readl(S3C2410_TCON);
+
+	switch (mode) {
+	case SAMSUNG_PWM0:
+		tcon |= S3C2410_TCON_T0START;
+		tcon &= ~S3C2410_TCON_T0MANUALUPD;
+
+		if (periodic)
+			tcon |= S3C2410_TCON_T0RELOAD;
+		else
+			tcon &= ~S3C2410_TCON_T0RELOAD;
+		break;
+
+	case SAMSUNG_PWM1:
+		tcon |= S3C2410_TCON_T1START;
+		tcon &= ~S3C2410_TCON_T1MANUALUPD;
+
+		if (periodic)
+			tcon |= S3C2410_TCON_T1RELOAD;
+		else
+			tcon &= ~S3C2410_TCON_T1RELOAD;
+		break;
+
+	case SAMSUNG_PWM2:
+		tcon |= S3C2410_TCON_T2START;
+		tcon &= ~S3C2410_TCON_T2MANUALUPD;
+
+		if (periodic)
+			tcon |= S3C2410_TCON_T2RELOAD;
+		else
+			tcon &= ~S3C2410_TCON_T2RELOAD;
+		break;
+
+	case SAMSUNG_PWM3:
+		tcon |= S3C2410_TCON_T3START;
+		tcon &= ~S3C2410_TCON_T3MANUALUPD;
+
+		if (periodic)
+			tcon |= S3C2410_TCON_T3RELOAD;
+		else
+			tcon &= ~S3C2410_TCON_T3RELOAD;
+		break;
+
+	case SAMSUNG_PWM4:
+		tcon |= S3C2410_TCON_T4START;
+		tcon &= ~S3C2410_TCON_T4MANUALUPD;
+
+		if (periodic)
+			tcon |= S3C2410_TCON_T4RELOAD;
+		else
+			tcon &= ~S3C2410_TCON_T4RELOAD;
+		break;
+
+	default:
+		printk(KERN_ERR "Invalid Timer %d\n", mode);
+		break;
+	}
+	__raw_writel(tcon, S3C2410_TCON);
+}
+
+static int samsung_set_next_event(unsigned long cycles,
+				struct clock_event_device *evt)
+{
+	samsung_time_setup(timer_source.event_id, cycles);
+	samsung_time_start(timer_source.event_id, NON_PERIODIC);
+
+	return 0;
+}
+
+static void samsung_set_mode(enum clock_event_mode mode,
+				struct clock_event_device *evt)
+{
+	samsung_time_stop(timer_source.event_id);
+
+	switch (mode) {
+	case CLOCK_EVT_MODE_PERIODIC:
+		samsung_time_setup(timer_source.event_id, clock_count_per_tick);
+		samsung_time_start(timer_source.event_id, PERIODIC);
+		break;
+
+	case CLOCK_EVT_MODE_ONESHOT:
+		break;
+
+	case CLOCK_EVT_MODE_UNUSED:
+	case CLOCK_EVT_MODE_SHUTDOWN:
+		break;
+
+	case CLOCK_EVT_MODE_RESUME:
+		samsung_timer_resume();
+		break;
+	}
+}
+
+static void samsung_timer_resume(void)
+{
+	/* event timer restart */
+	samsung_time_setup(timer_source.event_id, clock_count_per_tick);
+	samsung_time_start(timer_source.event_id, PERIODIC);
+
+	/* source timer restart */
+	samsung_time_setup(timer_source.source_id, TCNT_MAX);
+	samsung_time_start(timer_source.source_id, PERIODIC);
+}
+
+void __init samsung_set_timer_source(enum samsung_timer_mode event,
+				 enum samsung_timer_mode source)
+{
+	s3c_device_timer[event].dev.bus = &platform_bus_type;
+	s3c_device_timer[source].dev.bus = &platform_bus_type;
+
+	timer_source.event_id = event;
+	timer_source.source_id = source;
+}
+
+static struct clock_event_device time_event_device = {
+	.name		= "samsung_event_timer",
+	.features	= CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT,
+	.rating		= 200,
+	.set_next_event	= samsung_set_next_event,
+	.set_mode	= samsung_set_mode,
+};
+
+static irqreturn_t samsung_clock_event_isr(int irq, void *dev_id)
+{
+	struct clock_event_device *evt = dev_id;
+
+	evt->event_handler(evt);
+
+	return IRQ_HANDLED;
+}
+
+static struct irqaction samsung_clock_event_irq = {
+	.name		= "samsung_time_irq",
+	.flags		= IRQF_DISABLED | IRQF_TIMER | IRQF_IRQPOLL,
+	.handler	= samsung_clock_event_isr,
+	.dev_id		= &time_event_device,
+};
+
+static void __init samsung_clockevent_init(void)
+{
+	unsigned long pclk;
+	unsigned long clock_rate;
+	unsigned int irq_number;
+	struct clk *tscaler;
+
+	pclk = clk_get_rate(timerclk);
+
+	tscaler = clk_get_parent(tdiv_event);
+
+	clk_set_rate(tscaler, pclk / 2);
+	clk_set_rate(tdiv_event, pclk / 2);
+	clk_set_parent(tin_event, tdiv_event);
+
+	clock_rate = clk_get_rate(tin_event);
+	clock_count_per_tick = clock_rate / HZ;
+
+	clockevents_calc_mult_shift(&time_event_device,
+				    clock_rate, SAMSUNG_TIMER_MIN_RANGE);
+	time_event_device.max_delta_ns =
+		clockevent_delta2ns(-1, &time_event_device);
+	time_event_device.min_delta_ns =
+		clockevent_delta2ns(1, &time_event_device);
+
+	time_event_device.cpumask = cpumask_of(0);
+	clockevents_register_device(&time_event_device);
+
+	irq_number = timer_source.event_id + IRQ_TIMER0;
+	setup_irq(irq_number, &samsung_clock_event_irq);
+}
+
+static void __iomem *samsung_timer_reg(void)
+{
+	unsigned long offset = 0;
+
+	switch (timer_source.source_id) {
+	case SAMSUNG_PWM0:
+	case SAMSUNG_PWM1:
+	case SAMSUNG_PWM2:
+	case SAMSUNG_PWM3:
+		offset = (timer_source.source_id * 0x0c) + 0x14;
+		break;
+
+	case SAMSUNG_PWM4:
+		offset = 0x40;
+		break;
+
+	default:
+		printk(KERN_ERR "Invalid Timer %d\n", timer_source.source_id);
+		return NULL;
+	}
+
+	return S3C_TIMERREG(offset);
+}
+
+/*
+ * Override the global weak sched_clock symbol with this
+ * local implementation which uses the clocksource to get some
+ * better resolution when scheduling the kernel. We accept that
+ * this wraps around for now, since it is just a relative time
+ * stamp. (Inspired by U300 implementation.)
+ */
+static u32 notrace samsung_read_sched_clock(void)
+{
+	void __iomem *reg = samsung_timer_reg();
+
+	if (!reg)
+		return 0;
+
+	return ~__raw_readl(reg);
+}
+
+static void __init samsung_clocksource_init(void)
+{
+	unsigned long pclk;
+	unsigned long clock_rate;
+
+	pclk = clk_get_rate(timerclk);
+
+	clk_set_rate(tdiv_source, pclk / 2);
+	clk_set_parent(tin_source, tdiv_source);
+
+	clock_rate = clk_get_rate(tin_source);
+
+	samsung_time_setup(timer_source.source_id, TCNT_MAX);
+	samsung_time_start(timer_source.source_id, PERIODIC);
+
+	setup_sched_clock(samsung_read_sched_clock, 32, clock_rate);
+
+	if (clocksource_mmio_init(samsung_timer_reg(), "samsung_clocksource_timer",
+			clock_rate, 250, 32, clocksource_mmio_readl_down))
+		panic("samsung_clocksource_timer: can't register clocksource\n");
+}
+
+static void __init samsung_timer_resources(void)
+{
+
+	unsigned long event_id = timer_source.event_id;
+	unsigned long source_id = timer_source.source_id;
+	char devname[15];
+
+	timerclk = clk_get(NULL, "timers");
+	if (IS_ERR(timerclk))
+		panic("failed to get timers clock for timer");
+
+	clk_enable(timerclk);
+
+	sprintf(devname, "s3c24xx-pwm.%lu", event_id);
+	s3c_device_timer[event_id].id = event_id;
+	s3c_device_timer[event_id].dev.init_name = devname;
+
+	tin_event = clk_get(&s3c_device_timer[event_id].dev, "pwm-tin");
+	if (IS_ERR(tin_event))
+		panic("failed to get pwm-tin clock for event timer");
+
+	tdiv_event = clk_get(&s3c_device_timer[event_id].dev, "pwm-tdiv");
+	if (IS_ERR(tdiv_event))
+		panic("failed to get pwm-tdiv clock for event timer");
+
+	clk_enable(tin_event);
+
+	sprintf(devname, "s3c24xx-pwm.%lu", source_id);
+	s3c_device_timer[source_id].id = source_id;
+	s3c_device_timer[source_id].dev.init_name = devname;
+
+	tin_source = clk_get(&s3c_device_timer[source_id].dev, "pwm-tin");
+	if (IS_ERR(tin_source))
+		panic("failed to get pwm-tin clock for source timer");
+
+	tdiv_source = clk_get(&s3c_device_timer[source_id].dev, "pwm-tdiv");
+	if (IS_ERR(tdiv_source))
+		panic("failed to get pwm-tdiv clock for source timer");
+
+	clk_enable(tin_source);
+}
+
+static void __init samsung_timer_init(void)
+{
+	samsung_timer_resources();
+	samsung_clockevent_init();
+	samsung_clocksource_init();
+}
+
+struct sys_timer samsung_timer = {
+	.init		= samsung_timer_init,
+};
-- 

^ permalink raw reply related	[flat|nested] 39+ messages in thread

* [PATCH 2/3] Add samsung-time support for s3c24xx
  2012-11-25  2:54       ` Romain Naour
  2012-11-25 11:09         ` Tomasz Figa
  2012-11-27 23:27         ` [PATCH 1/3] Rename s5p-time to samsung-time Romain Naour
@ 2012-11-27 23:27         ` Romain Naour
  2012-11-27 23:27         ` [PATCH 3/3] Add samsung-time support for s3c64xx Romain Naour
  3 siblings, 0 replies; 39+ messages in thread
From: Romain Naour @ 2012-11-27 23:27 UTC (permalink / raw)
  To: tomasz.figa
  Cc: Kukjin Kim, linux-samsung-soc, ben-linux,
	'Heiko Stübner', 'Sylwester Nawrocki'

This patch replace ARCH_USES_GETTIMEOFFSET by GENERIC_CLOCKEVENTS for s3c24xx devices.
It becomes possible to use the high-resolution timer and dynamic ticks.

Signed-off-by: Naour Romain <romain.naour@openwide.fr>
---
 arch/arm/Kconfig                                  |  3 ++-
 arch/arm/mach-s3c24xx/Kconfig                     |  6 ++++++
 arch/arm/mach-s3c24xx/mach-amlm5900.c             |  5 ++++-
 arch/arm/mach-s3c24xx/mach-anubis.c               |  4 +++-
 arch/arm/mach-s3c24xx/mach-at2440evb.c            |  4 +++-
 arch/arm/mach-s3c24xx/mach-bast.c                 |  4 +++-
 arch/arm/mach-s3c24xx/mach-gta02.c                |  4 +++-
 arch/arm/mach-s3c24xx/mach-h1940.c                |  4 +++-
 arch/arm/mach-s3c24xx/mach-jive.c                 |  4 +++-
 arch/arm/mach-s3c24xx/mach-mini2440.c             |  4 +++-
 arch/arm/mach-s3c24xx/mach-n30.c                  |  6 ++++--
 arch/arm/mach-s3c24xx/mach-nexcoder.c             |  4 +++-
 arch/arm/mach-s3c24xx/mach-osiris.c               |  4 +++-
 arch/arm/mach-s3c24xx/mach-otom.c                 |  4 +++-
 arch/arm/mach-s3c24xx/mach-qt2410.c               |  4 +++-
 arch/arm/mach-s3c24xx/mach-rx1950.c               |  4 +++-
 arch/arm/mach-s3c24xx/mach-rx3715.c               |  4 +++-
 arch/arm/mach-s3c24xx/mach-smdk2410.c             |  4 +++-
 arch/arm/mach-s3c24xx/mach-smdk2413.c             |  8 +++++---
 arch/arm/mach-s3c24xx/mach-smdk2416.c             |  4 +++-
 arch/arm/mach-s3c24xx/mach-smdk2440.c             |  4 +++-
 arch/arm/mach-s3c24xx/mach-smdk2443.c             |  4 +++-
 arch/arm/mach-s3c24xx/mach-tct_hammer.c           |  4 +++-
 arch/arm/mach-s3c24xx/mach-vr1000.c               |  4 +++-
 arch/arm/mach-s3c24xx/mach-vstms.c                |  5 +++--
 arch/arm/plat-samsung/include/plat/cpu.h          |  2 +-
 arch/arm/plat-samsung/include/plat/samsung-time.h | 11 +++++++++++
 arch/arm/plat-samsung/samsung-time.c              | 12 ++++++------
 28 files changed, 99 insertions(+), 35 deletions(-)

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index ade7e92..6563476 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -737,7 +737,8 @@ config ARCH_SA1100
 config ARCH_S3C24XX
 	bool "Samsung S3C24XX SoCs"
 	select ARCH_HAS_CPUFREQ
-	select ARCH_USES_GETTIMEOFFSET
+	select GENERIC_CLOCKEVENTS
+	select CLKSRC_MMIO
 	select CLKDEV_LOOKUP
 	select GENERIC_GPIO
 	select HAVE_CLK
diff --git a/arch/arm/mach-s3c24xx/Kconfig b/arch/arm/mach-s3c24xx/Kconfig
index 2b6cb5f..be2c482 100644
--- a/arch/arm/mach-s3c24xx/Kconfig
+++ b/arch/arm/mach-s3c24xx/Kconfig
@@ -21,6 +21,7 @@ config CPU_S3C2410
 	select S3C2410_CLOCK
 	select S3C2410_CPUFREQ if CPU_FREQ_S3C24XX
 	select S3C2410_PM if PM
+	select SAMSUNG_HRT
 	help
 	  Support for S3C2410 and S3C2410A family from the S3C24XX line
 	  of Samsung Mobile CPUs.
@@ -32,6 +33,7 @@ config CPU_S3C2412
 	select CPU_LLSERIAL_S3C2440
 	select S3C2412_DMA if S3C24XX_DMA
 	select S3C2412_PM if PM
+	select SAMSUNG_HRT
 	help
 	  Support for the S3C2412 and S3C2413 SoCs from the S3C24XX line
 
@@ -44,6 +46,7 @@ config CPU_S3C2416
 	select S3C2443_COMMON
 	select S3C2443_DMA if S3C24XX_DMA
 	select SAMSUNG_CLKSRC
+	select SAMSUNG_HRT
 	help
 	  Support for the S3C2416 SoC from the S3C24XX line
 
@@ -54,6 +57,7 @@ config CPU_S3C2440
 	select S3C2410_CLOCK
 	select S3C2410_PM if PM
 	select S3C2440_DMA if S3C24XX_DMA
+	select SAMSUNG_HRT
 	help
 	  Support for S3C2440 Samsung Mobile CPU based systems.
 
@@ -63,6 +67,7 @@ config CPU_S3C2442
 	select CPU_LLSERIAL_S3C2440
 	select S3C2410_CLOCK
 	select S3C2410_PM if PM
+	select SAMSUNG_HRT
 	help
 	  Support for S3C2442 Samsung Mobile CPU based systems.
 
@@ -78,6 +83,7 @@ config CPU_S3C2443
 	select S3C2443_COMMON
 	select S3C2443_DMA if S3C24XX_DMA
 	select SAMSUNG_CLKSRC
+	select SAMSUNG_HRT
 	help
 	  Support for the S3C2443 SoC from the S3C24XX line
 
diff --git a/arch/arm/mach-s3c24xx/mach-amlm5900.c b/arch/arm/mach-s3c24xx/mach-amlm5900.c
index f4ad99c..84c9bb0 100644
--- a/arch/arm/mach-s3c24xx/mach-amlm5900.c
+++ b/arch/arm/mach-s3c24xx/mach-amlm5900.c
@@ -63,6 +63,8 @@
 #include <linux/mtd/map.h>
 #include <linux/mtd/physmap.h>
 
+#include <plat/samsung-time.h>
+
 #include "common.h"
 
 static struct resource amlm5900_nor_resource =
@@ -160,6 +162,7 @@ static void __init amlm5900_map_io(void)
 	s3c24xx_init_io(amlm5900_iodesc, ARRAY_SIZE(amlm5900_iodesc));
 	s3c24xx_init_clocks(0);
 	s3c24xx_init_uarts(amlm5900_uartcfgs, ARRAY_SIZE(amlm5900_uartcfgs));
+	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
 }
 
 #ifdef CONFIG_FB_S3C2410
@@ -237,6 +240,6 @@ MACHINE_START(AML_M5900, "AML_M5900")
 	.map_io		= amlm5900_map_io,
 	.init_irq	= s3c24xx_init_irq,
 	.init_machine	= amlm5900_init,
-	.timer		= &s3c24xx_timer,
+	.timer		= &samsung_timer,
 	.restart	= s3c2410_restart,
 MACHINE_END
diff --git a/arch/arm/mach-s3c24xx/mach-anubis.c b/arch/arm/mach-s3c24xx/mach-anubis.c
index 1ee8c46..65ba844 100644
--- a/arch/arm/mach-s3c24xx/mach-anubis.c
+++ b/arch/arm/mach-s3c24xx/mach-anubis.c
@@ -54,6 +54,7 @@
 #include <plat/devs.h>
 #include <plat/cpu.h>
 #include <linux/platform_data/asoc-s3c24xx_simtec.h>
+#include <plat/samsung-time.h>
 
 #include "simtec.h"
 #include "common.h"
@@ -414,6 +415,7 @@ static void __init anubis_map_io(void)
 	s3c24xx_init_io(anubis_iodesc, ARRAY_SIZE(anubis_iodesc));
 	s3c24xx_init_clocks(0);
 	s3c24xx_init_uarts(anubis_uartcfgs, ARRAY_SIZE(anubis_uartcfgs));
+	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
 
 	/* check for the newer revision boards with large page nand */
 
@@ -448,6 +450,6 @@ MACHINE_START(ANUBIS, "Simtec-Anubis")
 	.map_io		= anubis_map_io,
 	.init_machine	= anubis_init,
 	.init_irq	= s3c24xx_init_irq,
-	.timer		= &s3c24xx_timer,
+	.timer		= &samsung_timer,
 	.restart	= s3c244x_restart,
 MACHINE_END
diff --git a/arch/arm/mach-s3c24xx/mach-at2440evb.c b/arch/arm/mach-s3c24xx/mach-at2440evb.c
index 00381fe..d7eb641 100644
--- a/arch/arm/mach-s3c24xx/mach-at2440evb.c
+++ b/arch/arm/mach-s3c24xx/mach-at2440evb.c
@@ -48,6 +48,7 @@
 #include <plat/devs.h>
 #include <plat/cpu.h>
 #include <linux/platform_data/mmc-s3cmci.h>
+#include <plat/samsung-time.h>
 
 #include "common.h"
 
@@ -192,6 +193,7 @@ static void __init at2440evb_map_io(void)
 	s3c24xx_init_io(at2440evb_iodesc, ARRAY_SIZE(at2440evb_iodesc));
 	s3c24xx_init_clocks(16934400);
 	s3c24xx_init_uarts(at2440evb_uartcfgs, ARRAY_SIZE(at2440evb_uartcfgs));
+	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
 }
 
 static void __init at2440evb_init(void)
@@ -210,6 +212,6 @@ MACHINE_START(AT2440EVB, "AT2440EVB")
 	.map_io		= at2440evb_map_io,
 	.init_machine	= at2440evb_init,
 	.init_irq	= s3c24xx_init_irq,
-	.timer		= &s3c24xx_timer,
+	.timer		= &samsung_timer,
 	.restart	= s3c244x_restart,
 MACHINE_END
diff --git a/arch/arm/mach-s3c24xx/mach-bast.c b/arch/arm/mach-s3c24xx/mach-bast.c
index 6a30ce7..a9c442e 100644
--- a/arch/arm/mach-s3c24xx/mach-bast.c
+++ b/arch/arm/mach-s3c24xx/mach-bast.c
@@ -63,6 +63,7 @@
 #include <plat/cpu-freq.h>
 #include <plat/gpio-cfg.h>
 #include <linux/platform_data/asoc-s3c24xx_simtec.h>
+#include <plat/samsung-time.h>
 
 #include "simtec.h"
 #include "common.h"
@@ -583,6 +584,7 @@ static void __init bast_map_io(void)
 	s3c24xx_init_io(bast_iodesc, ARRAY_SIZE(bast_iodesc));
 	s3c24xx_init_clocks(0);
 	s3c24xx_init_uarts(bast_uartcfgs, ARRAY_SIZE(bast_uartcfgs));
+	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
 }
 
 static void __init bast_init(void)
@@ -612,6 +614,6 @@ MACHINE_START(BAST, "Simtec-BAST")
 	.map_io		= bast_map_io,
 	.init_irq	= s3c24xx_init_irq,
 	.init_machine	= bast_init,
-	.timer		= &s3c24xx_timer,
+	.timer		= &samsung_timer,
 	.restart	= s3c2410_restart,
 MACHINE_END
diff --git a/arch/arm/mach-s3c24xx/mach-gta02.c b/arch/arm/mach-s3c24xx/mach-gta02.c
index 4a96346..02c6c6a 100644
--- a/arch/arm/mach-s3c24xx/mach-gta02.c
+++ b/arch/arm/mach-s3c24xx/mach-gta02.c
@@ -88,6 +88,7 @@
 #include <plat/gpio-cfg.h>
 #include <linux/platform_data/i2c-s3c2410.h>
 #include <linux/platform_data/touchscreen-s3c2410.h>
+#include <plat/samsung-time.h>
 
 #include "common.h"
 
@@ -507,6 +508,7 @@ static void __init gta02_map_io(void)
 	s3c24xx_init_io(gta02_iodesc, ARRAY_SIZE(gta02_iodesc));
 	s3c24xx_init_clocks(12000000);
 	s3c24xx_init_uarts(gta02_uartcfgs, ARRAY_SIZE(gta02_uartcfgs));
+	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
 }
 
 
@@ -596,6 +598,6 @@ MACHINE_START(NEO1973_GTA02, "GTA02")
 	.map_io		= gta02_map_io,
 	.init_irq	= s3c24xx_init_irq,
 	.init_machine	= gta02_machine_init,
-	.timer		= &s3c24xx_timer,
+	.timer		= &samsung_timer,
 	.restart	= s3c244x_restart,
 MACHINE_END
diff --git a/arch/arm/mach-s3c24xx/mach-h1940.c b/arch/arm/mach-s3c24xx/mach-h1940.c
index 63aaf07..f5d3578 100644
--- a/arch/arm/mach-s3c24xx/mach-h1940.c
+++ b/arch/arm/mach-s3c24xx/mach-h1940.c
@@ -67,6 +67,7 @@
 #include <plat/pm.h>
 #include <linux/platform_data/mmc-s3cmci.h>
 #include <linux/platform_data/touchscreen-s3c2410.h>
+#include <plat/samsung-time.h>
 
 #include <sound/uda1380.h>
 
@@ -652,6 +653,7 @@ static void __init h1940_map_io(void)
 	s3c24xx_init_io(h1940_iodesc, ARRAY_SIZE(h1940_iodesc));
 	s3c24xx_init_clocks(0);
 	s3c24xx_init_uarts(h1940_uartcfgs, ARRAY_SIZE(h1940_uartcfgs));
+	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
 
 	/* setup PM */
 
@@ -747,6 +749,6 @@ MACHINE_START(H1940, "IPAQ-H1940")
 	.reserve	= h1940_reserve,
 	.init_irq	= h1940_init_irq,
 	.init_machine	= h1940_init,
-	.timer		= &s3c24xx_timer,
+	.timer		= &samsung_timer,
 	.restart	= s3c2410_restart,
 MACHINE_END
diff --git a/arch/arm/mach-s3c24xx/mach-jive.c b/arch/arm/mach-s3c24xx/mach-jive.c
index c9954e2..01a894d 100644
--- a/arch/arm/mach-s3c24xx/mach-jive.c
+++ b/arch/arm/mach-s3c24xx/mach-jive.c
@@ -55,6 +55,7 @@
 #include <plat/cpu.h>
 #include <plat/pm.h>
 #include <linux/platform_data/usb-s3c2410_udc.h>
+#include <plat/samsung-time.h>
 
 static struct map_desc jive_iodesc[] __initdata = {
 };
@@ -506,6 +507,7 @@ static void __init jive_map_io(void)
 	s3c24xx_init_io(jive_iodesc, ARRAY_SIZE(jive_iodesc));
 	s3c24xx_init_clocks(12000000);
 	s3c24xx_init_uarts(jive_uartcfgs, ARRAY_SIZE(jive_uartcfgs));
+	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
 }
 
 static void jive_power_off(void)
@@ -661,6 +663,6 @@ MACHINE_START(JIVE, "JIVE")
 	.init_irq	= s3c24xx_init_irq,
 	.map_io		= jive_map_io,
 	.init_machine	= jive_machine_init,
-	.timer		= &s3c24xx_timer,
+	.timer		= &samsung_timer,
 	.restart	= s3c2412_restart,
 MACHINE_END
diff --git a/arch/arm/mach-s3c24xx/mach-mini2440.c b/arch/arm/mach-s3c24xx/mach-mini2440.c
index 393c0f1..a96efcd 100644
--- a/arch/arm/mach-s3c24xx/mach-mini2440.c
+++ b/arch/arm/mach-s3c24xx/mach-mini2440.c
@@ -57,6 +57,7 @@
 #include <plat/clock.h>
 #include <plat/devs.h>
 #include <plat/cpu.h>
+#include <plat/samsung-time.h>
 
 #include <sound/s3c24xx_uda134x.h>
 
@@ -527,6 +528,7 @@ static void __init mini2440_map_io(void)
 	s3c24xx_init_io(mini2440_iodesc, ARRAY_SIZE(mini2440_iodesc));
 	s3c24xx_init_clocks(12000000);
 	s3c24xx_init_uarts(mini2440_uartcfgs, ARRAY_SIZE(mini2440_uartcfgs));
+	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
 }
 
 /*
@@ -689,6 +691,6 @@ MACHINE_START(MINI2440, "MINI2440")
 	.map_io		= mini2440_map_io,
 	.init_machine	= mini2440_init,
 	.init_irq	= s3c24xx_init_irq,
-	.timer		= &s3c24xx_timer,
+	.timer		= &samsung_timer,
 	.restart	= s3c244x_restart,
 MACHINE_END
diff --git a/arch/arm/mach-s3c24xx/mach-n30.c b/arch/arm/mach-s3c24xx/mach-n30.c
index c53a9bf..f6cea03 100644
--- a/arch/arm/mach-s3c24xx/mach-n30.c
+++ b/arch/arm/mach-s3c24xx/mach-n30.c
@@ -50,6 +50,7 @@
 #include <linux/platform_data/mmc-s3cmci.h>
 #include <plat/s3c2410.h>
 #include <linux/platform_data/usb-s3c2410_udc.h>
+#include <plat/samsung-time.h>
 
 #include "common.h"
 
@@ -536,6 +537,7 @@ static void __init n30_map_io(void)
 	n30_hwinit();
 	s3c24xx_init_clocks(0);
 	s3c24xx_init_uarts(n30_uartcfgs, ARRAY_SIZE(n30_uartcfgs));
+	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
 }
 
 /* GPB3 is the line that controls the pull-up for the USB D+ line */
@@ -589,7 +591,7 @@ MACHINE_START(N30, "Acer-N30")
 				Ben Dooks <ben-linux@fluff.org>
 	*/
 	.atag_offset	= 0x100,
-	.timer		= &s3c24xx_timer,
+	.timer		= &samsung_timer,
 	.init_machine	= n30_init,
 	.init_irq	= s3c24xx_init_irq,
 	.map_io		= n30_map_io,
@@ -600,7 +602,7 @@ MACHINE_START(N35, "Acer-N35")
 	/* Maintainer: Christer Weinigel <christer@weinigel.se>
 	*/
 	.atag_offset	= 0x100,
-	.timer		= &s3c24xx_timer,
+	.timer		= &samsung_timer,
 	.init_machine	= n30_init,
 	.init_irq	= s3c24xx_init_irq,
 	.map_io		= n30_map_io,
diff --git a/arch/arm/mach-s3c24xx/mach-nexcoder.c b/arch/arm/mach-s3c24xx/mach-nexcoder.c
index a2b92b0..4db6fb3 100644
--- a/arch/arm/mach-s3c24xx/mach-nexcoder.c
+++ b/arch/arm/mach-s3c24xx/mach-nexcoder.c
@@ -46,6 +46,7 @@
 #include <plat/clock.h>
 #include <plat/devs.h>
 #include <plat/cpu.h>
+#include <plat/samsung-time.h>
 
 #include "common.h"
 
@@ -137,6 +138,7 @@ static void __init nexcoder_map_io(void)
 	s3c24xx_init_io(nexcoder_iodesc, ARRAY_SIZE(nexcoder_iodesc));
 	s3c24xx_init_clocks(0);
 	s3c24xx_init_uarts(nexcoder_uartcfgs, ARRAY_SIZE(nexcoder_uartcfgs));
+	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
 
 	nexcoder_sensorboard_init();
 }
@@ -153,6 +155,6 @@ MACHINE_START(NEXCODER_2440, "NexVision - Nexcoder 2440")
 	.map_io		= nexcoder_map_io,
 	.init_machine	= nexcoder_init,
 	.init_irq	= s3c24xx_init_irq,
-	.timer		= &s3c24xx_timer,
+	.timer		= &samsung_timer,
 	.restart	= s3c244x_restart,
 MACHINE_END
diff --git a/arch/arm/mach-s3c24xx/mach-osiris.c b/arch/arm/mach-s3c24xx/mach-osiris.c
index bb36d83..e85144e 100644
--- a/arch/arm/mach-s3c24xx/mach-osiris.c
+++ b/arch/arm/mach-s3c24xx/mach-osiris.c
@@ -53,6 +53,7 @@
 #include <plat/clock.h>
 #include <plat/devs.h>
 #include <plat/cpu.h>
+#include <plat/samsung-time.h>
 
 #include "common.h"
 
@@ -386,6 +387,7 @@ static void __init osiris_map_io(void)
 	s3c24xx_init_io(osiris_iodesc, ARRAY_SIZE(osiris_iodesc));
 	s3c24xx_init_clocks(0);
 	s3c24xx_init_uarts(osiris_uartcfgs, ARRAY_SIZE(osiris_uartcfgs));
+	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
 
 	/* check for the newer revision boards with large page nand */
 
@@ -428,6 +430,6 @@ MACHINE_START(OSIRIS, "Simtec-OSIRIS")
 	.map_io		= osiris_map_io,
 	.init_irq	= s3c24xx_init_irq,
 	.init_machine	= osiris_init,
-	.timer		= &s3c24xx_timer,
+	.timer		= &samsung_timer,
 	.restart	= s3c244x_restart,
 MACHINE_END
diff --git a/arch/arm/mach-s3c24xx/mach-otom.c b/arch/arm/mach-s3c24xx/mach-otom.c
index bca39f0..ab5f353 100644
--- a/arch/arm/mach-s3c24xx/mach-otom.c
+++ b/arch/arm/mach-s3c24xx/mach-otom.c
@@ -37,6 +37,7 @@
 #include <plat/devs.h>
 #include <linux/platform_data/i2c-s3c2410.h>
 #include <plat/cpu.h>
+#include <plat/samsung-time.h>
 
 #include "common.h"
 
@@ -104,6 +105,7 @@ static void __init otom11_map_io(void)
 	s3c24xx_init_io(otom11_iodesc, ARRAY_SIZE(otom11_iodesc));
 	s3c24xx_init_clocks(0);
 	s3c24xx_init_uarts(otom11_uartcfgs, ARRAY_SIZE(otom11_uartcfgs));
+	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
 }
 
 static void __init otom11_init(void)
@@ -118,6 +120,6 @@ MACHINE_START(OTOM, "Nex Vision - Otom 1.1")
 	.map_io		= otom11_map_io,
 	.init_machine	= otom11_init,
 	.init_irq	= s3c24xx_init_irq,
-	.timer		= &s3c24xx_timer,
+	.timer		= &samsung_timer,
 	.restart	= s3c2410_restart,
 MACHINE_END
diff --git a/arch/arm/mach-s3c24xx/mach-qt2410.c b/arch/arm/mach-s3c24xx/mach-qt2410.c
index 7b6ba13..e725554 100644
--- a/arch/arm/mach-s3c24xx/mach-qt2410.c
+++ b/arch/arm/mach-s3c24xx/mach-qt2410.c
@@ -60,6 +60,7 @@
 #include <plat/devs.h>
 #include <plat/cpu.h>
 #include <plat/pm.h>
+#include <plat/samsung-time.h>
 
 #include "common.h"
 
@@ -304,6 +305,7 @@ static void __init qt2410_map_io(void)
 	s3c24xx_init_io(qt2410_iodesc, ARRAY_SIZE(qt2410_iodesc));
 	s3c24xx_init_clocks(12*1000*1000);
 	s3c24xx_init_uarts(smdk2410_uartcfgs, ARRAY_SIZE(smdk2410_uartcfgs));
+	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
 }
 
 static void __init qt2410_machine_init(void)
@@ -343,6 +345,6 @@ MACHINE_START(QT2410, "QT2410")
 	.map_io		= qt2410_map_io,
 	.init_irq	= s3c24xx_init_irq,
 	.init_machine	= qt2410_machine_init,
-	.timer		= &s3c24xx_timer,
+	.timer		= &samsung_timer,
 	.restart	= s3c2410_restart,
 MACHINE_END
diff --git a/arch/arm/mach-s3c24xx/mach-rx1950.c b/arch/arm/mach-s3c24xx/mach-rx1950.c
index 379fde5..63fbeb1 100644
--- a/arch/arm/mach-s3c24xx/mach-rx1950.c
+++ b/arch/arm/mach-s3c24xx/mach-rx1950.c
@@ -58,6 +58,7 @@
 #include <plat/pm.h>
 #include <plat/irq.h>
 #include <linux/platform_data/touchscreen-s3c2410.h>
+#include <plat/samsung-time.h>
 
 #include <sound/uda1380.h>
 
@@ -743,6 +744,7 @@ static void __init rx1950_map_io(void)
 	s3c24xx_init_io(rx1950_iodesc, ARRAY_SIZE(rx1950_iodesc));
 	s3c24xx_init_clocks(16934000);
 	s3c24xx_init_uarts(rx1950_uartcfgs, ARRAY_SIZE(rx1950_uartcfgs));
+	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
 
 	/* setup PM */
 
@@ -815,6 +817,6 @@ MACHINE_START(RX1950, "HP iPAQ RX1950")
 	.reserve	= rx1950_reserve,
 	.init_irq = s3c24xx_init_irq,
 	.init_machine = rx1950_init_machine,
-	.timer = &s3c24xx_timer,
+	.timer = &samsung_timer,
 	.restart	= s3c244x_restart,
 MACHINE_END
diff --git a/arch/arm/mach-s3c24xx/mach-rx3715.c b/arch/arm/mach-s3c24xx/mach-rx3715.c
index dacbb9a..1b358a1 100644
--- a/arch/arm/mach-s3c24xx/mach-rx3715.c
+++ b/arch/arm/mach-s3c24xx/mach-rx3715.c
@@ -50,6 +50,7 @@
 #include <plat/devs.h>
 #include <plat/cpu.h>
 #include <plat/pm.h>
+#include <plat/samsung-time.h>
 
 #include "common.h"
 
@@ -179,6 +180,7 @@ static void __init rx3715_map_io(void)
 	s3c24xx_init_io(rx3715_iodesc, ARRAY_SIZE(rx3715_iodesc));
 	s3c24xx_init_clocks(16934000);
 	s3c24xx_init_uarts(rx3715_uartcfgs, ARRAY_SIZE(rx3715_uartcfgs));
+	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
 }
 
 /* H1940 and RX3715 need to reserve this for suspend */
@@ -212,6 +214,6 @@ MACHINE_START(RX3715, "IPAQ-RX3715")
 	.reserve	= rx3715_reserve,
 	.init_irq	= rx3715_init_irq,
 	.init_machine	= rx3715_init_machine,
-	.timer		= &s3c24xx_timer,
+	.timer		= &samsung_timer,
 	.restart	= s3c244x_restart,
 MACHINE_END
diff --git a/arch/arm/mach-s3c24xx/mach-smdk2410.c b/arch/arm/mach-s3c24xx/mach-smdk2410.c
index 82796b9..c7a18bc 100644
--- a/arch/arm/mach-s3c24xx/mach-smdk2410.c
+++ b/arch/arm/mach-s3c24xx/mach-smdk2410.c
@@ -53,6 +53,7 @@
 #include <plat/cpu.h>
 
 #include <plat/common-smdk.h>
+#include <plat/samsung-time.h>
 
 #include "common.h"
 
@@ -101,6 +102,7 @@ static void __init smdk2410_map_io(void)
 	s3c24xx_init_io(smdk2410_iodesc, ARRAY_SIZE(smdk2410_iodesc));
 	s3c24xx_init_clocks(0);
 	s3c24xx_init_uarts(smdk2410_uartcfgs, ARRAY_SIZE(smdk2410_uartcfgs));
+	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
 }
 
 static void __init smdk2410_init(void)
@@ -117,6 +119,6 @@ MACHINE_START(SMDK2410, "SMDK2410") /* @TODO: request a new identifier and switc
 	.map_io		= smdk2410_map_io,
 	.init_irq	= s3c24xx_init_irq,
 	.init_machine	= smdk2410_init,
-	.timer		= &s3c24xx_timer,
+	.timer		= &samsung_timer,
 	.restart	= s3c2410_restart,
 MACHINE_END
diff --git a/arch/arm/mach-s3c24xx/mach-smdk2413.c b/arch/arm/mach-s3c24xx/mach-smdk2413.c
index ce99fd8..c29c067 100644
--- a/arch/arm/mach-s3c24xx/mach-smdk2413.c
+++ b/arch/arm/mach-s3c24xx/mach-smdk2413.c
@@ -47,6 +47,7 @@
 #include <plat/clock.h>
 #include <plat/devs.h>
 #include <plat/cpu.h>
+#include <plat/samsung-time.h>
 
 #include <plat/common-smdk.h>
 
@@ -107,6 +108,7 @@ static void __init smdk2413_map_io(void)
 	s3c24xx_init_io(smdk2413_iodesc, ARRAY_SIZE(smdk2413_iodesc));
 	s3c24xx_init_clocks(12000000);
 	s3c24xx_init_uarts(smdk2413_uartcfgs, ARRAY_SIZE(smdk2413_uartcfgs));
+	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
 }
 
 static void __init smdk2413_machine_init(void)
@@ -133,7 +135,7 @@ MACHINE_START(S3C2413, "S3C2413")
 	.init_irq	= s3c24xx_init_irq,
 	.map_io		= smdk2413_map_io,
 	.init_machine	= smdk2413_machine_init,
-	.timer		= &s3c24xx_timer,
+	.timer		= &samsung_timer,
 	.restart	= s3c2412_restart,
 MACHINE_END
 
@@ -145,7 +147,7 @@ MACHINE_START(SMDK2412, "SMDK2412")
 	.init_irq	= s3c24xx_init_irq,
 	.map_io		= smdk2413_map_io,
 	.init_machine	= smdk2413_machine_init,
-	.timer		= &s3c24xx_timer,
+	.timer		= &samsung_timer,
 	.restart	= s3c2412_restart,
 MACHINE_END
 
@@ -157,6 +159,6 @@ MACHINE_START(SMDK2413, "SMDK2413")
 	.init_irq	= s3c24xx_init_irq,
 	.map_io		= smdk2413_map_io,
 	.init_machine	= smdk2413_machine_init,
-	.timer		= &s3c24xx_timer,
+	.timer		= &samsung_timer,
 	.restart	= s3c2412_restart,
 MACHINE_END
diff --git a/arch/arm/mach-s3c24xx/mach-smdk2416.c b/arch/arm/mach-s3c24xx/mach-smdk2416.c
index f30d7fc..2c0b7a1 100644
--- a/arch/arm/mach-s3c24xx/mach-smdk2416.c
+++ b/arch/arm/mach-s3c24xx/mach-smdk2416.c
@@ -52,6 +52,7 @@
 #include <plat/sdhci.h>
 #include <linux/platform_data/usb-s3c2410_udc.h>
 #include <linux/platform_data/s3c-hsudc.h>
+#include <plat/samsung-time.h>
 
 #include <plat/fb.h>
 
@@ -222,6 +223,7 @@ static void __init smdk2416_map_io(void)
 	s3c24xx_init_io(smdk2416_iodesc, ARRAY_SIZE(smdk2416_iodesc));
 	s3c24xx_init_clocks(12000000);
 	s3c24xx_init_uarts(smdk2416_uartcfgs, ARRAY_SIZE(smdk2416_uartcfgs));
+	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
 }
 
 static void __init smdk2416_machine_init(void)
@@ -254,6 +256,6 @@ MACHINE_START(SMDK2416, "SMDK2416")
 	.init_irq	= s3c24xx_init_irq,
 	.map_io		= smdk2416_map_io,
 	.init_machine	= smdk2416_machine_init,
-	.timer		= &s3c24xx_timer,
+	.timer		= &samsung_timer,
 	.restart	= s3c2416_restart,
 MACHINE_END
diff --git a/arch/arm/mach-s3c24xx/mach-smdk2440.c b/arch/arm/mach-s3c24xx/mach-smdk2440.c
index b7ff882..caf5c04 100644
--- a/arch/arm/mach-s3c24xx/mach-smdk2440.c
+++ b/arch/arm/mach-s3c24xx/mach-smdk2440.c
@@ -44,6 +44,7 @@
 #include <plat/clock.h>
 #include <plat/devs.h>
 #include <plat/cpu.h>
+#include <plat/samsung-time.h>
 
 #include <plat/common-smdk.h>
 
@@ -164,6 +165,7 @@ static void __init smdk2440_map_io(void)
 	s3c24xx_init_io(smdk2440_iodesc, ARRAY_SIZE(smdk2440_iodesc));
 	s3c24xx_init_clocks(16934400);
 	s3c24xx_init_uarts(smdk2440_uartcfgs, ARRAY_SIZE(smdk2440_uartcfgs));
+	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
 }
 
 static void __init smdk2440_machine_init(void)
@@ -182,6 +184,6 @@ MACHINE_START(S3C2440, "SMDK2440")
 	.init_irq	= s3c24xx_init_irq,
 	.map_io		= smdk2440_map_io,
 	.init_machine	= smdk2440_machine_init,
-	.timer		= &s3c24xx_timer,
+	.timer		= &samsung_timer,
 	.restart	= s3c244x_restart,
 MACHINE_END
diff --git a/arch/arm/mach-s3c24xx/mach-smdk2443.c b/arch/arm/mach-s3c24xx/mach-smdk2443.c
index 2568656..02fcd27 100644
--- a/arch/arm/mach-s3c24xx/mach-smdk2443.c
+++ b/arch/arm/mach-s3c24xx/mach-smdk2443.c
@@ -44,6 +44,7 @@
 #include <plat/clock.h>
 #include <plat/devs.h>
 #include <plat/cpu.h>
+#include <plat/samsung-time.h>
 
 #include <plat/common-smdk.h>
 
@@ -123,6 +124,7 @@ static void __init smdk2443_map_io(void)
 	s3c24xx_init_io(smdk2443_iodesc, ARRAY_SIZE(smdk2443_iodesc));
 	s3c24xx_init_clocks(12000000);
 	s3c24xx_init_uarts(smdk2443_uartcfgs, ARRAY_SIZE(smdk2443_uartcfgs));
+	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
 }
 
 static void __init smdk2443_machine_init(void)
@@ -144,6 +146,6 @@ MACHINE_START(SMDK2443, "SMDK2443")
 	.init_irq	= s3c24xx_init_irq,
 	.map_io		= smdk2443_map_io,
 	.init_machine	= smdk2443_machine_init,
-	.timer		= &s3c24xx_timer,
+	.timer		= &samsung_timer,
 	.restart	= s3c2443_restart,
 MACHINE_END
diff --git a/arch/arm/mach-s3c24xx/mach-tct_hammer.c b/arch/arm/mach-s3c24xx/mach-tct_hammer.c
index 495bf5c..90f43c9 100644
--- a/arch/arm/mach-s3c24xx/mach-tct_hammer.c
+++ b/arch/arm/mach-s3c24xx/mach-tct_hammer.c
@@ -53,6 +53,7 @@
 #include <linux/mtd/partitions.h>
 #include <linux/mtd/map.h>
 #include <linux/mtd/physmap.h>
+#include <plat/samsung-time.h>
 
 #include "common.h"
 
@@ -136,6 +137,7 @@ static void __init tct_hammer_map_io(void)
 	s3c24xx_init_io(tct_hammer_iodesc, ARRAY_SIZE(tct_hammer_iodesc));
 	s3c24xx_init_clocks(0);
 	s3c24xx_init_uarts(tct_hammer_uartcfgs, ARRAY_SIZE(tct_hammer_uartcfgs));
+	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
 }
 
 static void __init tct_hammer_init(void)
@@ -149,6 +151,6 @@ MACHINE_START(TCT_HAMMER, "TCT_HAMMER")
 	.map_io		= tct_hammer_map_io,
 	.init_irq	= s3c24xx_init_irq,
 	.init_machine	= tct_hammer_init,
-	.timer		= &s3c24xx_timer,
+	.timer		= &samsung_timer,
 	.restart	= s3c2410_restart,
 MACHINE_END
diff --git a/arch/arm/mach-s3c24xx/mach-vr1000.c b/arch/arm/mach-s3c24xx/mach-vr1000.c
index 14d5b12..4366c6f 100644
--- a/arch/arm/mach-s3c24xx/mach-vr1000.c
+++ b/arch/arm/mach-s3c24xx/mach-vr1000.c
@@ -50,6 +50,7 @@
 #include <plat/cpu.h>
 #include <linux/platform_data/i2c-s3c2410.h>
 #include <linux/platform_data/asoc-s3c24xx_simtec.h>
+#include <plat/samsung-time.h>
 
 #include "simtec.h"
 #include "common.h"
@@ -335,6 +336,7 @@ static void __init vr1000_map_io(void)
 	s3c24xx_init_io(vr1000_iodesc, ARRAY_SIZE(vr1000_iodesc));
 	s3c24xx_init_clocks(0);
 	s3c24xx_init_uarts(vr1000_uartcfgs, ARRAY_SIZE(vr1000_uartcfgs));
+	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
 }
 
 static void __init vr1000_init(void)
@@ -357,6 +359,6 @@ MACHINE_START(VR1000, "Thorcom-VR1000")
 	.map_io		= vr1000_map_io,
 	.init_machine	= vr1000_init,
 	.init_irq	= s3c24xx_init_irq,
-	.timer		= &s3c24xx_timer,
+	.timer		= &samsung_timer,
 	.restart	= s3c2410_restart,
 MACHINE_END
diff --git a/arch/arm/mach-s3c24xx/mach-vstms.c b/arch/arm/mach-s3c24xx/mach-vstms.c
index f1d44ae..412d858 100644
--- a/arch/arm/mach-s3c24xx/mach-vstms.c
+++ b/arch/arm/mach-s3c24xx/mach-vstms.c
@@ -47,7 +47,7 @@
 #include <plat/clock.h>
 #include <plat/devs.h>
 #include <plat/cpu.h>
-
+#include <plat/samsung-time.h>
 
 static struct map_desc vstms_iodesc[] __initdata = {
 };
@@ -144,6 +144,7 @@ static void __init vstms_map_io(void)
 	s3c24xx_init_io(vstms_iodesc, ARRAY_SIZE(vstms_iodesc));
 	s3c24xx_init_clocks(12000000);
 	s3c24xx_init_uarts(vstms_uartcfgs, ARRAY_SIZE(vstms_uartcfgs));
+	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
 }
 
 static void __init vstms_init(void)
@@ -161,6 +162,6 @@ MACHINE_START(VSTMS, "VSTMS")
 	.init_irq	= s3c24xx_init_irq,
 	.init_machine	= vstms_init,
 	.map_io		= vstms_map_io,
-	.timer		= &s3c24xx_timer,
+	.timer		= &samsung_timer,
 	.restart	= s3c2412_restart,
 MACHINE_END
diff --git a/arch/arm/plat-samsung/include/plat/cpu.h b/arch/arm/plat-samsung/include/plat/cpu.h
index ace4451..86fb5f3 100644
--- a/arch/arm/plat-samsung/include/plat/cpu.h
+++ b/arch/arm/plat-samsung/include/plat/cpu.h
@@ -184,7 +184,7 @@ extern void s3c24xx_init_uartdevs(char *name,
 				  struct s3c24xx_uart_resources *res,
 				  struct s3c2410_uartcfg *cfg, int no);
 
-/* timer for 2410/2440 */
+/* timer for s5pc100 only */
 
 struct sys_timer;
 extern struct sys_timer s3c24xx_timer;
diff --git a/arch/arm/plat-samsung/include/plat/samsung-time.h b/arch/arm/plat-samsung/include/plat/samsung-time.h
index 9d6d622..13ae4b9 100644
--- a/arch/arm/plat-samsung/include/plat/samsung-time.h
+++ b/arch/arm/plat-samsung/include/plat/samsung-time.h
@@ -30,7 +30,18 @@ struct samsung_timer_source {
 /* Be able to sleep for atleast 4 seconds (usually more) */
 #define SAMSUNG_TIMER_MIN_RANGE	4
 
+#ifdef CONFIG_ARCH_S3C24XX
+#define TCNT_MAX		0xffff
+#define TSCALER_DIV		25
+#define TDIV			50
+#define TSIZE			16
+#else
 #define TCNT_MAX		0xffffffff
+#define TSCALER_DIV		2
+#define TDIV			2
+#define TSIZE			32
+#endif
+
 #define NON_PERIODIC		0
 #define PERIODIC		1
 
diff --git a/arch/arm/plat-samsung/samsung-time.c b/arch/arm/plat-samsung/samsung-time.c
index 91773bf..6d63fca 100644
--- a/arch/arm/plat-samsung/samsung-time.c
+++ b/arch/arm/plat-samsung/samsung-time.c
@@ -2,7 +2,7 @@
  * Copyright (c) 2011 Samsung Electronics Co., Ltd.
  *		http://www.samsung.com/
  *
- * SAMSUNG - Common hr-timer support
+ * samsung - Common hr-timer support (s3c and s5p)
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License version 2 as
@@ -267,8 +267,8 @@ static void __init samsung_clockevent_init(void)
 
 	tscaler = clk_get_parent(tdiv_event);
 
-	clk_set_rate(tscaler, pclk / 2);
-	clk_set_rate(tdiv_event, pclk / 2);
+	clk_set_rate(tscaler, pclk / TSCALER_DIV);
+	clk_set_rate(tdiv_event, pclk / TDIV);
 	clk_set_parent(tin_event, tdiv_event);
 
 	clock_rate = clk_get_rate(tin_event);
@@ -336,7 +336,7 @@ static void __init samsung_clocksource_init(void)
 
 	pclk = clk_get_rate(timerclk);
 
-	clk_set_rate(tdiv_source, pclk / 2);
+	clk_set_rate(tdiv_source, pclk / TDIV);
 	clk_set_parent(tin_source, tdiv_source);
 
 	clock_rate = clk_get_rate(tin_source);
@@ -344,10 +344,10 @@ static void __init samsung_clocksource_init(void)
 	samsung_time_setup(timer_source.source_id, TCNT_MAX);
 	samsung_time_start(timer_source.source_id, PERIODIC);
 
-	setup_sched_clock(samsung_read_sched_clock, 32, clock_rate);
+	setup_sched_clock(samsung_read_sched_clock, TSIZE, clock_rate);
 
 	if (clocksource_mmio_init(samsung_timer_reg(), "samsung_clocksource_timer",
-			clock_rate, 250, 32, clocksource_mmio_readl_down))
+			clock_rate, 250, TSIZE, clocksource_mmio_readl_down))
 		panic("samsung_clocksource_timer: can't register clocksource\n");
 }
 
-- 

^ permalink raw reply related	[flat|nested] 39+ messages in thread

* [PATCH 3/3] Add samsung-time support for s3c64xx
  2012-11-25  2:54       ` Romain Naour
                           ` (2 preceding siblings ...)
  2012-11-27 23:27         ` [PATCH 2/3] Add samsung-time support for s3c24xx Romain Naour
@ 2012-11-27 23:27         ` Romain Naour
  3 siblings, 0 replies; 39+ messages in thread
From: Romain Naour @ 2012-11-27 23:27 UTC (permalink / raw)
  To: tomasz.figa
  Cc: Kukjin Kim, linux-samsung-soc, ben-linux,
	'Heiko Stübner', 'Sylwester Nawrocki'

This patch replace ARCH_USES_GETTIMEOFFSET by GENERIC_CLOCKEVENTS for s3c64xx devices.
It becomes possible to use the high-resolution timer and dynamic ticks.

Signed-off-by: Naour Romain <romain.naour@openwide.fr>
---
 arch/arm/Kconfig                      | 3 ++-
 arch/arm/mach-s3c64xx/Kconfig         | 2 ++
 arch/arm/mach-s3c64xx/mach-anw6410.c  | 4 +++-
 arch/arm/mach-s3c64xx/mach-crag6410.c | 4 +++-
 arch/arm/mach-s3c64xx/mach-hmt.c      | 4 +++-
 arch/arm/mach-s3c64xx/mach-mini6410.c | 4 +++-
 arch/arm/mach-s3c64xx/mach-ncp.c      | 4 +++-
 arch/arm/mach-s3c64xx/mach-real6410.c | 4 +++-
 arch/arm/mach-s3c64xx/mach-smartq.c   | 2 ++
 arch/arm/mach-s3c64xx/mach-smartq5.c  | 3 ++-
 arch/arm/mach-s3c64xx/mach-smartq7.c  | 3 ++-
 arch/arm/mach-s3c64xx/mach-smdk6400.c | 4 +++-
 arch/arm/mach-s3c64xx/mach-smdk6410.c | 4 +++-
 13 files changed, 34 insertions(+), 11 deletions(-)

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 6563476..6e00aea 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -757,7 +757,8 @@ config ARCH_S3C64XX
 	bool "Samsung S3C64XX"
 	select ARCH_HAS_CPUFREQ
 	select ARCH_REQUIRE_GPIOLIB
-	select ARCH_USES_GETTIMEOFFSET
+	select GENERIC_CLOCKEVENTS
+	select CLKSRC_MMIO
 	select ARM_VIC
 	select CLKDEV_LOOKUP
 	select CPU_V6
diff --git a/arch/arm/mach-s3c64xx/Kconfig b/arch/arm/mach-s3c64xx/Kconfig
index 63e7ae3..7b0dbbf3 100644
--- a/arch/arm/mach-s3c64xx/Kconfig
+++ b/arch/arm/mach-s3c64xx/Kconfig
@@ -17,11 +17,13 @@ config PLAT_S3C64XX
 # Configuration options for the S3C6410 CPU
 
 config CPU_S3C6400
+	select SAMSUNG_HRT
 	bool
 	help
 	  Enable S3C6400 CPU support
 
 config CPU_S3C6410
+	select SAMSUNG_HRT
 	bool
 	help
 	  Enable S3C6410 CPU support
diff --git a/arch/arm/mach-s3c64xx/mach-anw6410.c b/arch/arm/mach-s3c64xx/mach-anw6410.c
index 99e82ac..cfe8315 100644
--- a/arch/arm/mach-s3c64xx/mach-anw6410.c
+++ b/arch/arm/mach-s3c64xx/mach-anw6410.c
@@ -51,6 +51,7 @@
 #include <plat/cpu.h>
 #include <mach/regs-gpio.h>
 #include <mach/regs-modem.h>
+#include <plat/samsung-time.h>
 
 #include "common.h"
 
@@ -209,6 +210,7 @@ static void __init anw6410_map_io(void)
 	s3c64xx_init_io(anw6410_iodesc, ARRAY_SIZE(anw6410_iodesc));
 	s3c24xx_init_clocks(12000000);
 	s3c24xx_init_uarts(anw6410_uartcfgs, ARRAY_SIZE(anw6410_uartcfgs));
+	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
 
 	anw6410_lcd_mode_set();
 }
@@ -234,6 +236,6 @@ MACHINE_START(ANW6410, "A&W6410")
 	.map_io		= anw6410_map_io,
 	.init_machine	= anw6410_machine_init,
 	.init_late	= s3c64xx_init_late,
-	.timer		= &s3c24xx_timer,
+	.timer		= &samsung_timer,
 	.restart	= s3c64xx_restart,
 MACHINE_END
diff --git a/arch/arm/mach-s3c64xx/mach-crag6410.c b/arch/arm/mach-s3c64xx/mach-crag6410.c
index 13b7eaa..59c94a6 100644
--- a/arch/arm/mach-s3c64xx/mach-crag6410.c
+++ b/arch/arm/mach-s3c64xx/mach-crag6410.c
@@ -70,6 +70,7 @@
 #include <plat/adc.h>
 #include <linux/platform_data/i2c-s3c2410.h>
 #include <plat/pm.h>
+#include <plat/samsung-time.h>
 
 #include "common.h"
 
@@ -704,6 +705,7 @@ static void __init crag6410_map_io(void)
 	s3c64xx_init_io(NULL, 0);
 	s3c24xx_init_clocks(12000000);
 	s3c24xx_init_uarts(crag6410_uartcfgs, ARRAY_SIZE(crag6410_uartcfgs));
+	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
 
 	/* LCD type and Bypass set by bootloader */
 }
@@ -829,6 +831,6 @@ MACHINE_START(WLF_CRAGG_6410, "Wolfson Cragganmore 6410")
 	.map_io		= crag6410_map_io,
 	.init_machine	= crag6410_machine_init,
 	.init_late	= s3c64xx_init_late,
-	.timer		= &s3c24xx_timer,
+	.timer		= &samsung_timer,
 	.restart	= s3c64xx_restart,
 MACHINE_END
diff --git a/arch/arm/mach-s3c64xx/mach-hmt.c b/arch/arm/mach-s3c64xx/mach-hmt.c
index 2b14489..39f733b 100644
--- a/arch/arm/mach-s3c64xx/mach-hmt.c
+++ b/arch/arm/mach-s3c64xx/mach-hmt.c
@@ -42,6 +42,7 @@
 #include <plat/clock.h>
 #include <plat/devs.h>
 #include <plat/cpu.h>
+#include <plat/samsung-time.h>
 
 #include "common.h"
 
@@ -249,6 +250,7 @@ static void __init hmt_map_io(void)
 	s3c64xx_init_io(hmt_iodesc, ARRAY_SIZE(hmt_iodesc));
 	s3c24xx_init_clocks(12000000);
 	s3c24xx_init_uarts(hmt_uartcfgs, ARRAY_SIZE(hmt_uartcfgs));
+	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
 }
 
 static void __init hmt_machine_init(void)
@@ -277,6 +279,6 @@ MACHINE_START(HMT, "Airgoo-HMT")
 	.map_io		= hmt_map_io,
 	.init_machine	= hmt_machine_init,
 	.init_late	= s3c64xx_init_late,
-	.timer		= &s3c24xx_timer,
+	.timer		= &samsung_timer,
 	.restart	= s3c64xx_restart,
 MACHINE_END
diff --git a/arch/arm/mach-s3c64xx/mach-mini6410.c b/arch/arm/mach-s3c64xx/mach-mini6410.c
index 07c349c..579f303 100644
--- a/arch/arm/mach-s3c64xx/mach-mini6410.c
+++ b/arch/arm/mach-s3c64xx/mach-mini6410.c
@@ -44,6 +44,7 @@
 
 #include <video/platform_lcd.h>
 #include <video/samsung_fimd.h>
+#include <plat/samsung-time.h>
 
 #include "common.h"
 
@@ -233,6 +234,7 @@ static void __init mini6410_map_io(void)
 	s3c64xx_init_io(NULL, 0);
 	s3c24xx_init_clocks(12000000);
 	s3c24xx_init_uarts(mini6410_uartcfgs, ARRAY_SIZE(mini6410_uartcfgs));
+	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
 
 	/* set the LCD type */
 	tmp = __raw_readl(S3C64XX_SPCON);
@@ -356,6 +358,6 @@ MACHINE_START(MINI6410, "MINI6410")
 	.map_io		= mini6410_map_io,
 	.init_machine	= mini6410_machine_init,
 	.init_late	= s3c64xx_init_late,
-	.timer		= &s3c24xx_timer,
+	.timer		= &samsung_timer,
 	.restart	= s3c64xx_restart,
 MACHINE_END
diff --git a/arch/arm/mach-s3c64xx/mach-ncp.c b/arch/arm/mach-s3c64xx/mach-ncp.c
index e5f9a79..16a09e0 100644
--- a/arch/arm/mach-s3c64xx/mach-ncp.c
+++ b/arch/arm/mach-s3c64xx/mach-ncp.c
@@ -44,6 +44,7 @@
 #include <plat/clock.h>
 #include <plat/devs.h>
 #include <plat/cpu.h>
+#include <plat/samsung-time.h>
 
 #include "common.h"
 
@@ -88,6 +89,7 @@ static void __init ncp_map_io(void)
 	s3c64xx_init_io(ncp_iodesc, ARRAY_SIZE(ncp_iodesc));
 	s3c24xx_init_clocks(12000000);
 	s3c24xx_init_uarts(ncp_uartcfgs, ARRAY_SIZE(ncp_uartcfgs));
+	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
 }
 
 static void __init ncp_machine_init(void)
@@ -105,6 +107,6 @@ MACHINE_START(NCP, "NCP")
 	.map_io		= ncp_map_io,
 	.init_machine	= ncp_machine_init,
 	.init_late	= s3c64xx_init_late,
-	.timer		= &s3c24xx_timer,
+	.timer		= &samsung_timer,
 	.restart	= s3c64xx_restart,
 MACHINE_END
diff --git a/arch/arm/mach-s3c64xx/mach-real6410.c b/arch/arm/mach-s3c64xx/mach-real6410.c
index 7476f7c..831a27c 100644
--- a/arch/arm/mach-s3c64xx/mach-real6410.c
+++ b/arch/arm/mach-s3c64xx/mach-real6410.c
@@ -45,6 +45,7 @@
 
 #include <video/platform_lcd.h>
 #include <video/samsung_fimd.h>
+#include <plat/samsung-time.h>
 
 #include "common.h"
 
@@ -212,6 +213,7 @@ static void __init real6410_map_io(void)
 	s3c64xx_init_io(NULL, 0);
 	s3c24xx_init_clocks(12000000);
 	s3c24xx_init_uarts(real6410_uartcfgs, ARRAY_SIZE(real6410_uartcfgs));
+	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
 
 	/* set the LCD type */
 	tmp = __raw_readl(S3C64XX_SPCON);
@@ -335,6 +337,6 @@ MACHINE_START(REAL6410, "REAL6410")
 	.map_io		= real6410_map_io,
 	.init_machine	= real6410_machine_init,
 	.init_late	= s3c64xx_init_late,
-	.timer		= &s3c24xx_timer,
+	.timer		= &samsung_timer,
 	.restart	= s3c64xx_restart,
 MACHINE_END
diff --git a/arch/arm/mach-s3c64xx/mach-smartq.c b/arch/arm/mach-s3c64xx/mach-smartq.c
index c6d7390..df314f1 100644
--- a/arch/arm/mach-s3c64xx/mach-smartq.c
+++ b/arch/arm/mach-s3c64xx/mach-smartq.c
@@ -39,6 +39,7 @@
 #include <linux/platform_data/touchscreen-s3c2410.h>
 
 #include <video/platform_lcd.h>
+#include <plat/samsung-time.h>
 
 #include "common.h"
 
@@ -378,6 +379,7 @@ void __init smartq_map_io(void)
 	s3c64xx_init_io(smartq_iodesc, ARRAY_SIZE(smartq_iodesc));
 	s3c24xx_init_clocks(12000000);
 	s3c24xx_init_uarts(smartq_uartcfgs, ARRAY_SIZE(smartq_uartcfgs));
+	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
 
 	smartq_lcd_mode_set();
 }
diff --git a/arch/arm/mach-s3c64xx/mach-smartq5.c b/arch/arm/mach-s3c64xx/mach-smartq5.c
index 96d6da2..d6c0a11 100644
--- a/arch/arm/mach-s3c64xx/mach-smartq5.c
+++ b/arch/arm/mach-s3c64xx/mach-smartq5.c
@@ -29,6 +29,7 @@
 #include <plat/devs.h>
 #include <plat/fb.h>
 #include <plat/gpio-cfg.h>
+#include <plat/samsung-time.h>
 
 #include "common.h"
 #include "mach-smartq.h"
@@ -157,6 +158,6 @@ MACHINE_START(SMARTQ5, "SmartQ 5")
 	.map_io		= smartq_map_io,
 	.init_machine	= smartq5_machine_init,
 	.init_late	= s3c64xx_init_late,
-	.timer		= &s3c24xx_timer,
+	.timer		= &samsung_timer,
 	.restart	= s3c64xx_restart,
 MACHINE_END
diff --git a/arch/arm/mach-s3c64xx/mach-smartq7.c b/arch/arm/mach-s3c64xx/mach-smartq7.c
index 7d1167b..00ec516 100644
--- a/arch/arm/mach-s3c64xx/mach-smartq7.c
+++ b/arch/arm/mach-s3c64xx/mach-smartq7.c
@@ -29,6 +29,7 @@
 #include <plat/devs.h>
 #include <plat/fb.h>
 #include <plat/gpio-cfg.h>
+#include <plat/samsung-time.h>
 
 #include "common.h"
 #include "mach-smartq.h"
@@ -173,6 +174,6 @@ MACHINE_START(SMARTQ7, "SmartQ 7")
 	.map_io		= smartq_map_io,
 	.init_machine	= smartq7_machine_init,
 	.init_late	= s3c64xx_init_late,
-	.timer		= &s3c24xx_timer,
+	.timer		= &samsung_timer,
 	.restart	= s3c64xx_restart,
 MACHINE_END
diff --git a/arch/arm/mach-s3c64xx/mach-smdk6400.c b/arch/arm/mach-s3c64xx/mach-smdk6400.c
index a928fae..4382417 100644
--- a/arch/arm/mach-s3c64xx/mach-smdk6400.c
+++ b/arch/arm/mach-s3c64xx/mach-smdk6400.c
@@ -36,6 +36,7 @@
 #include <plat/devs.h>
 #include <plat/cpu.h>
 #include <linux/platform_data/i2c-s3c2410.h>
+#include <plat/samsung-time.h>
 
 #include "common.h"
 
@@ -67,6 +68,7 @@ static void __init smdk6400_map_io(void)
 	s3c64xx_init_io(smdk6400_iodesc, ARRAY_SIZE(smdk6400_iodesc));
 	s3c24xx_init_clocks(12000000);
 	s3c24xx_init_uarts(smdk6400_uartcfgs, ARRAY_SIZE(smdk6400_uartcfgs));
+	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
 }
 
 static struct platform_device *smdk6400_devices[] __initdata = {
@@ -94,6 +96,6 @@ MACHINE_START(SMDK6400, "SMDK6400")
 	.map_io		= smdk6400_map_io,
 	.init_machine	= smdk6400_machine_init,
 	.init_late	= s3c64xx_init_late,
-	.timer		= &s3c24xx_timer,
+	.timer		= &samsung_timer,
 	.restart	= s3c64xx_restart,
 MACHINE_END
diff --git a/arch/arm/mach-s3c64xx/mach-smdk6410.c b/arch/arm/mach-s3c64xx/mach-smdk6410.c
index da1a771..ab52008 100644
--- a/arch/arm/mach-s3c64xx/mach-smdk6410.c
+++ b/arch/arm/mach-s3c64xx/mach-smdk6410.c
@@ -73,6 +73,7 @@
 #include <linux/platform_data/touchscreen-s3c2410.h>
 #include <plat/keypad.h>
 #include <plat/backlight.h>
+#include <plat/samsung-time.h>
 
 #include "common.h"
 
@@ -636,6 +637,7 @@ static void __init smdk6410_map_io(void)
 	s3c64xx_init_io(smdk6410_iodesc, ARRAY_SIZE(smdk6410_iodesc));
 	s3c24xx_init_clocks(12000000);
 	s3c24xx_init_uarts(smdk6410_uartcfgs, ARRAY_SIZE(smdk6410_uartcfgs));
+	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
 
 	/* set the LCD type */
 
@@ -705,6 +707,6 @@ MACHINE_START(SMDK6410, "SMDK6410")
 	.map_io		= smdk6410_map_io,
 	.init_machine	= smdk6410_machine_init,
 	.init_late	= s3c64xx_init_late,
-	.timer		= &s3c24xx_timer,
+	.timer		= &samsung_timer,
 	.restart	= s3c64xx_restart,
 MACHINE_END
-- 

^ permalink raw reply related	[flat|nested] 39+ messages in thread

* Re: [PATCH 1/3] Rename s5p-time to samsung-time
  2012-11-27 23:27         ` [PATCH 1/3] Rename s5p-time to samsung-time Romain Naour
@ 2012-11-27 23:57           ` Heiko Stübner
  2012-11-29 23:18             ` Romain Naour
                               ` (6 more replies)
  0 siblings, 7 replies; 39+ messages in thread
From: Heiko Stübner @ 2012-11-27 23:57 UTC (permalink / raw)
  To: Romain Naour
  Cc: tomasz.figa, Kukjin Kim, linux-samsung-soc, ben-linux,
	'Sylwester Nawrocki'

Hi Romain,

Am Mittwoch, 28. November 2012, 00:27:36 schrieb Romain Naour:
> Hi Tomasz, Kgene
> 
> > I would also suggest splitting this huge patch into a series of several
> > smaller, possibly:
> > 1) Rename s5p-time to samsung-time (and correct any platforms using it
> > currently)
> > 2) Add samsung-time support for s3c24xx
> > 3) Add samsung-time support for s3c64xx
> > 
> > What do you think?
> > 
> > Best regards,
> > Tomasz Figa
> 
> I have separated the patch into three parts, as you said.
> And also, I corrected some oversights ;-)
> 
> These patches are for 3.7-rc6.
> 
> Here is the first one:

Comments like this should either be in the comment section (below the three 
dashes) or in a cover-letter (git format-patch --cover-letter), but not in the 
commit message of the patch itself.

Otherwise the patches look very cool. Hopefully I'll find a bit of time to 
test them tomorrow.


But I do have some quick comments:

What happens to s3c24xx_timer? It seems you changed every user of it but did 
not remove the old timer code. Might be interesting as a 4th patch, or is it 
still used somewhere?

Please use the -M option to "git format-patch" which minimizes the impact of 
moved files in the patch itself.


Thanks for doing this change
Heiko


> This patch rename s5p-time to samsung-time.
> There is no functional change.
> 
> Signed-off-by: Naour Romain <romain.naour@openwide.fr>
> ---
>  arch/arm/mach-exynos/Kconfig                      |   2 +-
>  arch/arm/mach-exynos/mach-universal_c210.c        |   6 +-
>  arch/arm/mach-s5p64x0/Kconfig                     |   4 +-
>  arch/arm/mach-s5p64x0/mach-smdk6440.c             |   6 +-
>  arch/arm/mach-s5p64x0/mach-smdk6450.c             |   6 +-
>  arch/arm/mach-s5pv210/Kconfig                     |   2 +-
>  arch/arm/mach-s5pv210/mach-aquila.c               |   6 +-
>  arch/arm/mach-s5pv210/mach-goni.c                 |   6 +-
>  arch/arm/mach-s5pv210/mach-smdkc110.c             |   6 +-
>  arch/arm/mach-s5pv210/mach-smdkv210.c             |   6 +-
>  arch/arm/mach-s5pv210/mach-torbreck.c             |   6 +-
>  arch/arm/plat-samsung/Kconfig                     |   2 +-
>  arch/arm/plat-samsung/Makefile                    |   2 +-
>  arch/arm/plat-samsung/include/plat/s5p-time.h     |  40 ---
>  arch/arm/plat-samsung/include/plat/samsung-time.h |  40 +++
>  arch/arm/plat-samsung/s5p-time.c                  | 405
> ---------------------- arch/arm/plat-samsung/samsung-time.c              |
> 405 ++++++++++++++++++++++ 17 files changed, 475 insertions(+), 475
> deletions(-)
>  delete mode 100644 arch/arm/plat-samsung/include/plat/s5p-time.h
>  create mode 100644 arch/arm/plat-samsung/include/plat/samsung-time.h
>  delete mode 100644 arch/arm/plat-samsung/s5p-time.c
>  create mode 100644 arch/arm/plat-samsung/samsung-time.c
> 
> diff --git a/arch/arm/mach-exynos/Kconfig b/arch/arm/mach-exynos/Kconfig
> index da55107..20edfa3 100644
> --- a/arch/arm/mach-exynos/Kconfig
> +++ b/arch/arm/mach-exynos/Kconfig
> @@ -274,7 +274,7 @@ config MACH_UNIVERSAL_C210
>  	select S5P_DEV_ONENAND
>  	select S5P_DEV_TV
>  	select S5P_GPIO_INT
> -	select S5P_HRT
> +	select SAMSUNG_HRT
>  	select S5P_SETUP_MIPIPHY
>  	help
>  	  Machine support for Samsung Mobile Universal S5PC210 Reference
> diff --git a/arch/arm/mach-exynos/mach-universal_c210.c
> b/arch/arm/mach-exynos/mach-universal_c210.c index ebc9dd3..325bfe9 100644
> --- a/arch/arm/mach-exynos/mach-universal_c210.c
> +++ b/arch/arm/mach-exynos/mach-universal_c210.c
> @@ -41,7 +41,7 @@
>  #include <plat/mfc.h>
>  #include <plat/sdhci.h>
>  #include <plat/fimc-core.h>
> -#include <plat/s5p-time.h>
> +#include <plat/samsung-time.h>
>  #include <plat/camport.h>
>  #include <linux/platform_data/mipi-csis.h>
> 
> @@ -1099,7 +1099,7 @@ static void __init universal_map_io(void)
>  	exynos_init_io(NULL, 0);
>  	s3c24xx_init_clocks(clk_xusbxti.rate);
>  	s3c24xx_init_uarts(universal_uartcfgs, ARRAY_SIZE(universal_uartcfgs));
> -	s5p_set_timer_source(S5P_PWM2, S5P_PWM4);
> +	samsung_set_timer_source(SAMSUNG_PWM2, SAMSUNG_PWM4);
>  }
> 
>  static void s5p_tv_setup(void)
> @@ -1158,7 +1158,7 @@ MACHINE_START(UNIVERSAL_C210, "UNIVERSAL_C210")
>  	.handle_irq	= gic_handle_irq,
>  	.init_machine	= universal_machine_init,
>  	.init_late	= exynos_init_late,
> -	.timer		= &s5p_timer,
> +	.timer		= &samsung_timer,
>  	.reserve        = &universal_reserve,
>  	.restart	= exynos4_restart,
>  MACHINE_END
> diff --git a/arch/arm/mach-s5p64x0/Kconfig b/arch/arm/mach-s5p64x0/Kconfig
> index e8742cb..f0ec535 100644
> --- a/arch/arm/mach-s5p64x0/Kconfig
> +++ b/arch/arm/mach-s5p64x0/Kconfig
> @@ -9,7 +9,7 @@ if ARCH_S5P64X0
> 
>  config CPU_S5P6440
>  	bool
> -	select S5P_HRT
> +	select SAMSUNG_HRT
>  	select S5P_SLEEP if PM
>  	select SAMSUNG_DMADEV
>  	select SAMSUNG_WAKEMASK if PM
> @@ -18,7 +18,7 @@ config CPU_S5P6440
> 
>  config CPU_S5P6450
>  	bool
> -	select S5P_HRT
> +	select SAMSUNG_HRT
>  	select S5P_SLEEP if PM
>  	select SAMSUNG_DMADEV
>  	select SAMSUNG_WAKEMASK if PM
> diff --git a/arch/arm/mach-s5p64x0/mach-smdk6440.c
> b/arch/arm/mach-s5p64x0/mach-smdk6440.c index 96ea1fe..587fec5 100644
> --- a/arch/arm/mach-s5p64x0/mach-smdk6440.c
> +++ b/arch/arm/mach-s5p64x0/mach-smdk6440.c
> @@ -50,7 +50,7 @@
>  #include <plat/pll.h>
>  #include <plat/adc.h>
>  #include <linux/platform_data/touchscreen-s3c2410.h>
> -#include <plat/s5p-time.h>
> +#include <plat/samsung-time.h>
>  #include <plat/backlight.h>
>  #include <plat/fb.h>
>  #include <plat/sdhci.h>
> @@ -231,7 +231,7 @@ static void __init smdk6440_map_io(void)
>  	s5p64x0_init_io(NULL, 0);
>  	s3c24xx_init_clocks(12000000);
>  	s3c24xx_init_uarts(smdk6440_uartcfgs, ARRAY_SIZE(smdk6440_uartcfgs));
> -	s5p_set_timer_source(S5P_PWM3, S5P_PWM4);
> +	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
>  }
> 
>  static void s5p6440_set_lcd_interface(void)
> @@ -276,6 +276,6 @@ MACHINE_START(SMDK6440, "SMDK6440")
>  	.handle_irq	= vic_handle_irq,
>  	.map_io		= smdk6440_map_io,
>  	.init_machine	= smdk6440_machine_init,
> -	.timer		= &s5p_timer,
> +	.timer		= &samsung_timer,
>  	.restart	= s5p64x0_restart,
>  MACHINE_END
> diff --git a/arch/arm/mach-s5p64x0/mach-smdk6450.c
> b/arch/arm/mach-s5p64x0/mach-smdk6450.c index 12748b6..714cd8a 100644
> --- a/arch/arm/mach-s5p64x0/mach-smdk6450.c
> +++ b/arch/arm/mach-s5p64x0/mach-smdk6450.c
> @@ -50,7 +50,7 @@
>  #include <plat/pll.h>
>  #include <plat/adc.h>
>  #include <linux/platform_data/touchscreen-s3c2410.h>
> -#include <plat/s5p-time.h>
> +#include <plat/samsung-time.h>
>  #include <plat/backlight.h>
>  #include <plat/fb.h>
>  #include <plat/sdhci.h>
> @@ -250,7 +250,7 @@ static void __init smdk6450_map_io(void)
>  	s5p64x0_init_io(NULL, 0);
>  	s3c24xx_init_clocks(19200000);
>  	s3c24xx_init_uarts(smdk6450_uartcfgs, ARRAY_SIZE(smdk6450_uartcfgs));
> -	s5p_set_timer_source(S5P_PWM3, S5P_PWM4);
> +	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
>  }
> 
>  static void s5p6450_set_lcd_interface(void)
> @@ -295,6 +295,6 @@ MACHINE_START(SMDK6450, "SMDK6450")
>  	.handle_irq	= vic_handle_irq,
>  	.map_io		= smdk6450_map_io,
>  	.init_machine	= smdk6450_machine_init,
> -	.timer		= &s5p_timer,
> +	.timer		= &samsung_timer,
>  	.restart	= s5p64x0_restart,
>  MACHINE_END
> diff --git a/arch/arm/mach-s5pv210/Kconfig b/arch/arm/mach-s5pv210/Kconfig
> index 92ad72f..01018ef 100644
> --- a/arch/arm/mach-s5pv210/Kconfig
> +++ b/arch/arm/mach-s5pv210/Kconfig
> @@ -12,7 +12,7 @@ if ARCH_S5PV210
>  config CPU_S5PV210
>  	bool
>  	select S5P_EXT_INT
> -	select S5P_HRT
> +	select SAMSUNG_HRT
>  	select S5P_PM if PM
>  	select S5P_SLEEP if PM
>  	select SAMSUNG_DMADEV
> diff --git a/arch/arm/mach-s5pv210/mach-aquila.c
> b/arch/arm/mach-s5pv210/mach-aquila.c index ee9fa5c..7c7d89b 100644
> --- a/arch/arm/mach-s5pv210/mach-aquila.c
> +++ b/arch/arm/mach-s5pv210/mach-aquila.c
> @@ -39,7 +39,7 @@
>  #include <plat/fb.h>
>  #include <plat/fimc-core.h>
>  #include <plat/sdhci.h>
> -#include <plat/s5p-time.h>
> +#include <plat/samsung-time.h>
> 
>  #include "common.h"
> 
> @@ -652,7 +652,7 @@ static void __init aquila_map_io(void)
>  	s5pv210_init_io(NULL, 0);
>  	s3c24xx_init_clocks(24000000);
>  	s3c24xx_init_uarts(aquila_uartcfgs, ARRAY_SIZE(aquila_uartcfgs));
> -	s5p_set_timer_source(S5P_PWM3, S5P_PWM4);
> +	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
>  }
> 
>  static void __init aquila_machine_init(void)
> @@ -688,6 +688,6 @@ MACHINE_START(AQUILA, "Aquila")
>  	.handle_irq	= vic_handle_irq,
>  	.map_io		= aquila_map_io,
>  	.init_machine	= aquila_machine_init,
> -	.timer		= &s5p_timer,
> +	.timer		= &samsung_timer,
>  	.restart	= s5pv210_restart,
>  MACHINE_END
> diff --git a/arch/arm/mach-s5pv210/mach-goni.c
> b/arch/arm/mach-s5pv210/mach-goni.c index 55e1dba..2740001 100644
> --- a/arch/arm/mach-s5pv210/mach-goni.c
> +++ b/arch/arm/mach-s5pv210/mach-goni.c
> @@ -48,7 +48,7 @@
>  #include <plat/keypad.h>
>  #include <plat/sdhci.h>
>  #include <plat/clock.h>
> -#include <plat/s5p-time.h>
> +#include <plat/samsung-time.h>
>  #include <plat/mfc.h>
>  #include <plat/camport.h>
> 
> @@ -910,7 +910,7 @@ static void __init goni_map_io(void)
>  	s5pv210_init_io(NULL, 0);
>  	s3c24xx_init_clocks(clk_xusbxti.rate);
>  	s3c24xx_init_uarts(goni_uartcfgs, ARRAY_SIZE(goni_uartcfgs));
> -	s5p_set_timer_source(S5P_PWM3, S5P_PWM4);
> +	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
>  }
> 
>  static void __init goni_reserve(void)
> @@ -976,7 +976,7 @@ MACHINE_START(GONI, "GONI")
>  	.handle_irq	= vic_handle_irq,
>  	.map_io		= goni_map_io,
>  	.init_machine	= goni_machine_init,
> -	.timer		= &s5p_timer,
> +	.timer		= &samsung_timer,
>  	.reserve	= &goni_reserve,
>  	.restart	= s5pv210_restart,
>  MACHINE_END
> diff --git a/arch/arm/mach-s5pv210/mach-smdkc110.c
> b/arch/arm/mach-s5pv210/mach-smdkc110.c index d9c99fc..d2e93b7 100644
> --- a/arch/arm/mach-s5pv210/mach-smdkc110.c
> +++ b/arch/arm/mach-s5pv210/mach-smdkc110.c
> @@ -30,7 +30,7 @@
>  #include <linux/platform_data/ata-samsung_cf.h>
>  #include <linux/platform_data/i2c-s3c2410.h>
>  #include <plat/pm.h>
> -#include <plat/s5p-time.h>
> +#include <plat/samsung-time.h>
>  #include <plat/mfc.h>
> 
>  #include "common.h"
> @@ -122,7 +122,7 @@ static void __init smdkc110_map_io(void)
>  	s5pv210_init_io(NULL, 0);
>  	s3c24xx_init_clocks(24000000);
>  	s3c24xx_init_uarts(smdkv210_uartcfgs, ARRAY_SIZE(smdkv210_uartcfgs));
> -	s5p_set_timer_source(S5P_PWM3, S5P_PWM4);
> +	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
>  }
> 
>  static void __init smdkc110_reserve(void)
> @@ -156,7 +156,7 @@ MACHINE_START(SMDKC110, "SMDKC110")
>  	.handle_irq	= vic_handle_irq,
>  	.map_io		= smdkc110_map_io,
>  	.init_machine	= smdkc110_machine_init,
> -	.timer		= &s5p_timer,
> +	.timer		= &samsung_timer,
>  	.restart	= s5pv210_restart,
>  	.reserve	= &smdkc110_reserve,
>  MACHINE_END
> diff --git a/arch/arm/mach-s5pv210/mach-smdkv210.c
> b/arch/arm/mach-s5pv210/mach-smdkv210.c index 4cdb5bb..cd28725 100644
> --- a/arch/arm/mach-s5pv210/mach-smdkv210.c
> +++ b/arch/arm/mach-s5pv210/mach-smdkv210.c
> @@ -45,7 +45,7 @@
>  #include <plat/keypad.h>
>  #include <plat/pm.h>
>  #include <plat/fb.h>
> -#include <plat/s5p-time.h>
> +#include <plat/samsung-time.h>
>  #include <plat/backlight.h>
>  #include <plat/mfc.h>
>  #include <plat/clock.h>
> @@ -287,7 +287,7 @@ static void __init smdkv210_map_io(void)
>  	s5pv210_init_io(NULL, 0);
>  	s3c24xx_init_clocks(clk_xusbxti.rate);
>  	s3c24xx_init_uarts(smdkv210_uartcfgs, ARRAY_SIZE(smdkv210_uartcfgs));
> -	s5p_set_timer_source(S5P_PWM2, S5P_PWM4);
> +	samsung_set_timer_source(SAMSUNG_PWM2, SAMSUNG_PWM4);
>  }
> 
>  static void __init smdkv210_reserve(void)
> @@ -332,7 +332,7 @@ MACHINE_START(SMDKV210, "SMDKV210")
>  	.handle_irq	= vic_handle_irq,
>  	.map_io		= smdkv210_map_io,
>  	.init_machine	= smdkv210_machine_init,
> -	.timer		= &s5p_timer,
> +	.timer		= &samsung_timer,
>  	.restart	= s5pv210_restart,
>  	.reserve	= &smdkv210_reserve,
>  MACHINE_END
> diff --git a/arch/arm/mach-s5pv210/mach-torbreck.c
> b/arch/arm/mach-s5pv210/mach-torbreck.c index 18785cb..aec668c 100644
> --- a/arch/arm/mach-s5pv210/mach-torbreck.c
> +++ b/arch/arm/mach-s5pv210/mach-torbreck.c
> @@ -27,7 +27,7 @@
>  #include <plat/devs.h>
>  #include <plat/cpu.h>
>  #include <linux/platform_data/i2c-s3c2410.h>
> -#include <plat/s5p-time.h>
> +#include <plat/samsung-time.h>
> 
>  #include "common.h"
> 
> @@ -107,7 +107,7 @@ static void __init torbreck_map_io(void)
>  	s5pv210_init_io(NULL, 0);
>  	s3c24xx_init_clocks(24000000);
>  	s3c24xx_init_uarts(torbreck_uartcfgs, ARRAY_SIZE(torbreck_uartcfgs));
> -	s5p_set_timer_source(S5P_PWM3, S5P_PWM4);
> +	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
>  }
> 
>  static void __init torbreck_machine_init(void)
> @@ -132,6 +132,6 @@ MACHINE_START(TORBRECK, "TORBRECK")
>  	.handle_irq	= vic_handle_irq,
>  	.map_io		= torbreck_map_io,
>  	.init_machine	= torbreck_machine_init,
> -	.timer		= &s5p_timer,
> +	.timer		= &samsung_timer,
>  	.restart	= s5pv210_restart,
>  MACHINE_END
> diff --git a/arch/arm/plat-samsung/Kconfig b/arch/arm/plat-samsung/Kconfig
> index 59401e1..5278795 100644
> --- a/arch/arm/plat-samsung/Kconfig
> +++ b/arch/arm/plat-samsung/Kconfig
> @@ -70,7 +70,7 @@ config S3C_LOWLEVEL_UART_PORT
> 
>  # timer options
> 
> -config S5P_HRT
> +config SAMSUNG_HRT
>  	bool
>  	select SAMSUNG_DEV_PWM
>  	help
> diff --git a/arch/arm/plat-samsung/Makefile
> b/arch/arm/plat-samsung/Makefile index 9e40e8d..06f2312 100644
> --- a/arch/arm/plat-samsung/Makefile
> +++ b/arch/arm/plat-samsung/Makefile
> @@ -13,7 +13,7 @@ obj-				:=
> 
>  obj-y				+= init.o cpu.o
>  obj-$(CONFIG_ARCH_USES_GETTIMEOFFSET)   += time.o
> -obj-$(CONFIG_S5P_HRT) 		+= s5p-time.o
> +obj-$(CONFIG_SAMSUNG_HRT) 		+= samsung-time.o
> 
>  obj-$(CONFIG_SAMSUNG_CLOCK)	+= clock.o
>  obj-$(CONFIG_SAMSUNG_CLOCK)	+= pwm-clock.o
> diff --git a/arch/arm/plat-samsung/include/plat/s5p-time.h
> b/arch/arm/plat-samsung/include/plat/s5p-time.h deleted file mode 100644
> index 3a70aeb..0000000
> --- a/arch/arm/plat-samsung/include/plat/s5p-time.h
> +++ /dev/null
> @@ -1,40 +0,0 @@
> -/* linux/arch/arm/plat-samsung/include/plat/s5p-time.h
> - *
> - * Copyright 2011 Samsung Electronics Co., Ltd.
> - *		http://www.samsung.com/
> - *
> - * Header file for s5p time support
> - *
> - * This program is free software; you can redistribute it and/or modify
> - * it under the terms of the GNU General Public License version 2 as
> - * published by the Free Software Foundation.
> -*/
> -
> -#ifndef __ASM_PLAT_S5P_TIME_H
> -#define __ASM_PLAT_S5P_TIME_H __FILE__
> -
> -/* S5P HR-Timer Clock mode */
> -enum s5p_timer_mode {
> -	S5P_PWM0,
> -	S5P_PWM1,
> -	S5P_PWM2,
> -	S5P_PWM3,
> -	S5P_PWM4,
> -};
> -
> -struct s5p_timer_source {
> -	unsigned int event_id;
> -	unsigned int source_id;
> -};
> -
> -/* Be able to sleep for atleast 4 seconds (usually more) */
> -#define S5PTIMER_MIN_RANGE	4
> -
> -#define TCNT_MAX		0xffffffff
> -#define NON_PERIODIC		0
> -#define PERIODIC		1
> -
> -extern void __init s5p_set_timer_source(enum s5p_timer_mode event,
> -					enum s5p_timer_mode source);
> -extern	struct sys_timer s5p_timer;
> -#endif /* __ASM_PLAT_S5P_TIME_H */
> diff --git a/arch/arm/plat-samsung/include/plat/samsung-time.h
> b/arch/arm/plat-samsung/include/plat/samsung-time.h new file mode 100644
> index 0000000..9d6d622
> --- /dev/null
> +++ b/arch/arm/plat-samsung/include/plat/samsung-time.h
> @@ -0,0 +1,40 @@
> +/* linux/arch/arm/plat-samsung/include/plat/samsung-time.h
> + *
> + * Copyright 2011 Samsung Electronics Co., Ltd.
> + *		http://www.samsung.com/
> + *
> + * Header file for samsung s3c and s5p time support
> + *
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License version 2 as
> + * published by the Free Software Foundation.
> +*/
> +
> +#ifndef __ASM_PLAT_SAMSUNG_TIME_H
> +#define __ASM_PLAT_SAMSUNG_TIME_H __FILE__
> +
> +/* SAMSUNG HR-Timer Clock mode */
> +enum samsung_timer_mode {
> +	SAMSUNG_PWM0,
> +	SAMSUNG_PWM1,
> +	SAMSUNG_PWM2,
> +	SAMSUNG_PWM3,
> +	SAMSUNG_PWM4,
> +};
> +
> +struct samsung_timer_source {
> +	unsigned int event_id;
> +	unsigned int source_id;
> +};
> +
> +/* Be able to sleep for atleast 4 seconds (usually more) */
> +#define SAMSUNG_TIMER_MIN_RANGE	4
> +
> +#define TCNT_MAX		0xffffffff
> +#define NON_PERIODIC		0
> +#define PERIODIC		1
> +
> +extern void __init samsung_set_timer_source(enum samsung_timer_mode event,
> +					enum samsung_timer_mode source);
> +extern	struct sys_timer samsung_timer;
> +#endif /* __ASM_PLAT_SAMSUNG_TIME_H */
> diff --git a/arch/arm/plat-samsung/s5p-time.c
> b/arch/arm/plat-samsung/s5p-time.c deleted file mode 100644
> index 028b6e8..0000000
> --- a/arch/arm/plat-samsung/s5p-time.c
> +++ /dev/null
> @@ -1,405 +0,0 @@
> -/*
> - * Copyright (c) 2011 Samsung Electronics Co., Ltd.
> - *		http://www.samsung.com/
> - *
> - * S5P - Common hr-timer support
> - *
> - * This program is free software; you can redistribute it and/or modify
> - * it under the terms of the GNU General Public License version 2 as
> - * published by the Free Software Foundation.
> -*/
> -
> -#include <linux/interrupt.h>
> -#include <linux/irq.h>
> -#include <linux/err.h>
> -#include <linux/clk.h>
> -#include <linux/clockchips.h>
> -#include <linux/platform_device.h>
> -
> -#include <asm/smp_twd.h>
> -#include <asm/mach/time.h>
> -#include <asm/mach/arch.h>
> -#include <asm/mach/map.h>
> -#include <asm/sched_clock.h>
> -
> -#include <mach/map.h>
> -#include <plat/devs.h>
> -#include <plat/regs-timer.h>
> -#include <plat/s5p-time.h>
> -
> -static struct clk *tin_event;
> -static struct clk *tin_source;
> -static struct clk *tdiv_event;
> -static struct clk *tdiv_source;
> -static struct clk *timerclk;
> -static struct s5p_timer_source timer_source;
> -static unsigned long clock_count_per_tick;
> -static void s5p_timer_resume(void);
> -
> -static void s5p_time_stop(enum s5p_timer_mode mode)
> -{
> -	unsigned long tcon;
> -
> -	tcon = __raw_readl(S3C2410_TCON);
> -
> -	switch (mode) {
> -	case S5P_PWM0:
> -		tcon &= ~S3C2410_TCON_T0START;
> -		break;
> -
> -	case S5P_PWM1:
> -		tcon &= ~S3C2410_TCON_T1START;
> -		break;
> -
> -	case S5P_PWM2:
> -		tcon &= ~S3C2410_TCON_T2START;
> -		break;
> -
> -	case S5P_PWM3:
> -		tcon &= ~S3C2410_TCON_T3START;
> -		break;
> -
> -	case S5P_PWM4:
> -		tcon &= ~S3C2410_TCON_T4START;
> -		break;
> -
> -	default:
> -		printk(KERN_ERR "Invalid Timer %d\n", mode);
> -		break;
> -	}
> -	__raw_writel(tcon, S3C2410_TCON);
> -}
> -
> -static void s5p_time_setup(enum s5p_timer_mode mode, unsigned long tcnt)
> -{
> -	unsigned long tcon;
> -
> -	tcon = __raw_readl(S3C2410_TCON);
> -
> -	tcnt--;
> -
> -	switch (mode) {
> -	case S5P_PWM0:
> -		tcon &= ~(0x0f << 0);
> -		tcon |= S3C2410_TCON_T0MANUALUPD;
> -		break;
> -
> -	case S5P_PWM1:
> -		tcon &= ~(0x0f << 8);
> -		tcon |= S3C2410_TCON_T1MANUALUPD;
> -		break;
> -
> -	case S5P_PWM2:
> -		tcon &= ~(0x0f << 12);
> -		tcon |= S3C2410_TCON_T2MANUALUPD;
> -		break;
> -
> -	case S5P_PWM3:
> -		tcon &= ~(0x0f << 16);
> -		tcon |= S3C2410_TCON_T3MANUALUPD;
> -		break;
> -
> -	case S5P_PWM4:
> -		tcon &= ~(0x07 << 20);
> -		tcon |= S3C2410_TCON_T4MANUALUPD;
> -		break;
> -
> -	default:
> -		printk(KERN_ERR "Invalid Timer %d\n", mode);
> -		break;
> -	}
> -
> -	__raw_writel(tcnt, S3C2410_TCNTB(mode));
> -	__raw_writel(tcnt, S3C2410_TCMPB(mode));
> -	__raw_writel(tcon, S3C2410_TCON);
> -}
> -
> -static void s5p_time_start(enum s5p_timer_mode mode, bool periodic)
> -{
> -	unsigned long tcon;
> -
> -	tcon  = __raw_readl(S3C2410_TCON);
> -
> -	switch (mode) {
> -	case S5P_PWM0:
> -		tcon |= S3C2410_TCON_T0START;
> -		tcon &= ~S3C2410_TCON_T0MANUALUPD;
> -
> -		if (periodic)
> -			tcon |= S3C2410_TCON_T0RELOAD;
> -		else
> -			tcon &= ~S3C2410_TCON_T0RELOAD;
> -		break;
> -
> -	case S5P_PWM1:
> -		tcon |= S3C2410_TCON_T1START;
> -		tcon &= ~S3C2410_TCON_T1MANUALUPD;
> -
> -		if (periodic)
> -			tcon |= S3C2410_TCON_T1RELOAD;
> -		else
> -			tcon &= ~S3C2410_TCON_T1RELOAD;
> -		break;
> -
> -	case S5P_PWM2:
> -		tcon |= S3C2410_TCON_T2START;
> -		tcon &= ~S3C2410_TCON_T2MANUALUPD;
> -
> -		if (periodic)
> -			tcon |= S3C2410_TCON_T2RELOAD;
> -		else
> -			tcon &= ~S3C2410_TCON_T2RELOAD;
> -		break;
> -
> -	case S5P_PWM3:
> -		tcon |= S3C2410_TCON_T3START;
> -		tcon &= ~S3C2410_TCON_T3MANUALUPD;
> -
> -		if (periodic)
> -			tcon |= S3C2410_TCON_T3RELOAD;
> -		else
> -			tcon &= ~S3C2410_TCON_T3RELOAD;
> -		break;
> -
> -	case S5P_PWM4:
> -		tcon |= S3C2410_TCON_T4START;
> -		tcon &= ~S3C2410_TCON_T4MANUALUPD;
> -
> -		if (periodic)
> -			tcon |= S3C2410_TCON_T4RELOAD;
> -		else
> -			tcon &= ~S3C2410_TCON_T4RELOAD;
> -		break;
> -
> -	default:
> -		printk(KERN_ERR "Invalid Timer %d\n", mode);
> -		break;
> -	}
> -	__raw_writel(tcon, S3C2410_TCON);
> -}
> -
> -static int s5p_set_next_event(unsigned long cycles,
> -				struct clock_event_device *evt)
> -{
> -	s5p_time_setup(timer_source.event_id, cycles);
> -	s5p_time_start(timer_source.event_id, NON_PERIODIC);
> -
> -	return 0;
> -}
> -
> -static void s5p_set_mode(enum clock_event_mode mode,
> -				struct clock_event_device *evt)
> -{
> -	s5p_time_stop(timer_source.event_id);
> -
> -	switch (mode) {
> -	case CLOCK_EVT_MODE_PERIODIC:
> -		s5p_time_setup(timer_source.event_id, clock_count_per_tick);
> -		s5p_time_start(timer_source.event_id, PERIODIC);
> -		break;
> -
> -	case CLOCK_EVT_MODE_ONESHOT:
> -		break;
> -
> -	case CLOCK_EVT_MODE_UNUSED:
> -	case CLOCK_EVT_MODE_SHUTDOWN:
> -		break;
> -
> -	case CLOCK_EVT_MODE_RESUME:
> -		s5p_timer_resume();
> -		break;
> -	}
> -}
> -
> -static void s5p_timer_resume(void)
> -{
> -	/* event timer restart */
> -	s5p_time_setup(timer_source.event_id, clock_count_per_tick);
> -	s5p_time_start(timer_source.event_id, PERIODIC);
> -
> -	/* source timer restart */
> -	s5p_time_setup(timer_source.source_id, TCNT_MAX);
> -	s5p_time_start(timer_source.source_id, PERIODIC);
> -}
> -
> -void __init s5p_set_timer_source(enum s5p_timer_mode event,
> -				 enum s5p_timer_mode source)
> -{
> -	s3c_device_timer[event].dev.bus = &platform_bus_type;
> -	s3c_device_timer[source].dev.bus = &platform_bus_type;
> -
> -	timer_source.event_id = event;
> -	timer_source.source_id = source;
> -}
> -
> -static struct clock_event_device time_event_device = {
> -	.name		= "s5p_event_timer",
> -	.features	= CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT,
> -	.rating		= 200,
> -	.set_next_event	= s5p_set_next_event,
> -	.set_mode	= s5p_set_mode,
> -};
> -
> -static irqreturn_t s5p_clock_event_isr(int irq, void *dev_id)
> -{
> -	struct clock_event_device *evt = dev_id;
> -
> -	evt->event_handler(evt);
> -
> -	return IRQ_HANDLED;
> -}
> -
> -static struct irqaction s5p_clock_event_irq = {
> -	.name		= "s5p_time_irq",
> -	.flags		= IRQF_DISABLED | IRQF_TIMER | IRQF_IRQPOLL,
> -	.handler	= s5p_clock_event_isr,
> -	.dev_id		= &time_event_device,
> -};
> -
> -static void __init s5p_clockevent_init(void)
> -{
> -	unsigned long pclk;
> -	unsigned long clock_rate;
> -	unsigned int irq_number;
> -	struct clk *tscaler;
> -
> -	pclk = clk_get_rate(timerclk);
> -
> -	tscaler = clk_get_parent(tdiv_event);
> -
> -	clk_set_rate(tscaler, pclk / 2);
> -	clk_set_rate(tdiv_event, pclk / 2);
> -	clk_set_parent(tin_event, tdiv_event);
> -
> -	clock_rate = clk_get_rate(tin_event);
> -	clock_count_per_tick = clock_rate / HZ;
> -
> -	clockevents_calc_mult_shift(&time_event_device,
> -				    clock_rate, S5PTIMER_MIN_RANGE);
> -	time_event_device.max_delta_ns =
> -		clockevent_delta2ns(-1, &time_event_device);
> -	time_event_device.min_delta_ns =
> -		clockevent_delta2ns(1, &time_event_device);
> -
> -	time_event_device.cpumask = cpumask_of(0);
> -	clockevents_register_device(&time_event_device);
> -
> -	irq_number = timer_source.event_id + IRQ_TIMER0;
> -	setup_irq(irq_number, &s5p_clock_event_irq);
> -}
> -
> -static void __iomem *s5p_timer_reg(void)
> -{
> -	unsigned long offset = 0;
> -
> -	switch (timer_source.source_id) {
> -	case S5P_PWM0:
> -	case S5P_PWM1:
> -	case S5P_PWM2:
> -	case S5P_PWM3:
> -		offset = (timer_source.source_id * 0x0c) + 0x14;
> -		break;
> -
> -	case S5P_PWM4:
> -		offset = 0x40;
> -		break;
> -
> -	default:
> -		printk(KERN_ERR "Invalid Timer %d\n", timer_source.source_id);
> -		return NULL;
> -	}
> -
> -	return S3C_TIMERREG(offset);
> -}
> -
> -/*
> - * Override the global weak sched_clock symbol with this
> - * local implementation which uses the clocksource to get some
> - * better resolution when scheduling the kernel. We accept that
> - * this wraps around for now, since it is just a relative time
> - * stamp. (Inspired by U300 implementation.)
> - */
> -static u32 notrace s5p_read_sched_clock(void)
> -{
> -	void __iomem *reg = s5p_timer_reg();
> -
> -	if (!reg)
> -		return 0;
> -
> -	return ~__raw_readl(reg);
> -}
> -
> -static void __init s5p_clocksource_init(void)
> -{
> -	unsigned long pclk;
> -	unsigned long clock_rate;
> -
> -	pclk = clk_get_rate(timerclk);
> -
> -	clk_set_rate(tdiv_source, pclk / 2);
> -	clk_set_parent(tin_source, tdiv_source);
> -
> -	clock_rate = clk_get_rate(tin_source);
> -
> -	s5p_time_setup(timer_source.source_id, TCNT_MAX);
> -	s5p_time_start(timer_source.source_id, PERIODIC);
> -
> -	setup_sched_clock(s5p_read_sched_clock, 32, clock_rate);
> -
> -	if (clocksource_mmio_init(s5p_timer_reg(), "s5p_clocksource_timer",
> -			clock_rate, 250, 32, clocksource_mmio_readl_down))
> -		panic("s5p_clocksource_timer: can't register clocksource\n");
> -}
> -
> -static void __init s5p_timer_resources(void)
> -{
> -
> -	unsigned long event_id = timer_source.event_id;
> -	unsigned long source_id = timer_source.source_id;
> -	char devname[15];
> -
> -	timerclk = clk_get(NULL, "timers");
> -	if (IS_ERR(timerclk))
> -		panic("failed to get timers clock for timer");
> -
> -	clk_enable(timerclk);
> -
> -	sprintf(devname, "s3c24xx-pwm.%lu", event_id);
> -	s3c_device_timer[event_id].id = event_id;
> -	s3c_device_timer[event_id].dev.init_name = devname;
> -
> -	tin_event = clk_get(&s3c_device_timer[event_id].dev, "pwm-tin");
> -	if (IS_ERR(tin_event))
> -		panic("failed to get pwm-tin clock for event timer");
> -
> -	tdiv_event = clk_get(&s3c_device_timer[event_id].dev, "pwm-tdiv");
> -	if (IS_ERR(tdiv_event))
> -		panic("failed to get pwm-tdiv clock for event timer");
> -
> -	clk_enable(tin_event);
> -
> -	sprintf(devname, "s3c24xx-pwm.%lu", source_id);
> -	s3c_device_timer[source_id].id = source_id;
> -	s3c_device_timer[source_id].dev.init_name = devname;
> -
> -	tin_source = clk_get(&s3c_device_timer[source_id].dev, "pwm-tin");
> -	if (IS_ERR(tin_source))
> -		panic("failed to get pwm-tin clock for source timer");
> -
> -	tdiv_source = clk_get(&s3c_device_timer[source_id].dev, "pwm-tdiv");
> -	if (IS_ERR(tdiv_source))
> -		panic("failed to get pwm-tdiv clock for source timer");
> -
> -	clk_enable(tin_source);
> -}
> -
> -static void __init s5p_timer_init(void)
> -{
> -	s5p_timer_resources();
> -	s5p_clockevent_init();
> -	s5p_clocksource_init();
> -}
> -
> -struct sys_timer s5p_timer = {
> -	.init		= s5p_timer_init,
> -};
> diff --git a/arch/arm/plat-samsung/samsung-time.c
> b/arch/arm/plat-samsung/samsung-time.c new file mode 100644
> index 0000000..91773bf
> --- /dev/null
> +++ b/arch/arm/plat-samsung/samsung-time.c
> @@ -0,0 +1,405 @@
> +/*
> + * Copyright (c) 2011 Samsung Electronics Co., Ltd.
> + *		http://www.samsung.com/
> + *
> + * SAMSUNG - Common hr-timer support
> + *
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License version 2 as
> + * published by the Free Software Foundation.
> +*/
> +
> +#include <linux/interrupt.h>
> +#include <linux/irq.h>
> +#include <linux/err.h>
> +#include <linux/clk.h>
> +#include <linux/clockchips.h>
> +#include <linux/platform_device.h>
> +
> +#include <asm/smp_twd.h>
> +#include <asm/mach/time.h>
> +#include <asm/mach/arch.h>
> +#include <asm/mach/map.h>
> +#include <asm/sched_clock.h>
> +
> +#include <mach/map.h>
> +#include <plat/devs.h>
> +#include <plat/regs-timer.h>
> +#include <plat/samsung-time.h>
> +
> +static struct clk *tin_event;
> +static struct clk *tin_source;
> +static struct clk *tdiv_event;
> +static struct clk *tdiv_source;
> +static struct clk *timerclk;
> +static struct samsung_timer_source timer_source;
> +static unsigned long clock_count_per_tick;
> +static void samsung_timer_resume(void);
> +
> +static void samsung_time_stop(enum samsung_timer_mode mode)
> +{
> +	unsigned long tcon;
> +
> +	tcon = __raw_readl(S3C2410_TCON);
> +
> +	switch (mode) {
> +	case SAMSUNG_PWM0:
> +		tcon &= ~S3C2410_TCON_T0START;
> +		break;
> +
> +	case SAMSUNG_PWM1:
> +		tcon &= ~S3C2410_TCON_T1START;
> +		break;
> +
> +	case SAMSUNG_PWM2:
> +		tcon &= ~S3C2410_TCON_T2START;
> +		break;
> +
> +	case SAMSUNG_PWM3:
> +		tcon &= ~S3C2410_TCON_T3START;
> +		break;
> +
> +	case SAMSUNG_PWM4:
> +		tcon &= ~S3C2410_TCON_T4START;
> +		break;
> +
> +	default:
> +		printk(KERN_ERR "Invalid Timer %d\n", mode);
> +		break;
> +	}
> +	__raw_writel(tcon, S3C2410_TCON);
> +}
> +
> +static void samsung_time_setup(enum samsung_timer_mode mode, unsigned long
> tcnt) +{
> +	unsigned long tcon;
> +
> +	tcon = __raw_readl(S3C2410_TCON);
> +
> +	tcnt--;
> +
> +	switch (mode) {
> +	case SAMSUNG_PWM0:
> +		tcon &= ~(0x0f << 0);
> +		tcon |= S3C2410_TCON_T0MANUALUPD;
> +		break;
> +
> +	case SAMSUNG_PWM1:
> +		tcon &= ~(0x0f << 8);
> +		tcon |= S3C2410_TCON_T1MANUALUPD;
> +		break;
> +
> +	case SAMSUNG_PWM2:
> +		tcon &= ~(0x0f << 12);
> +		tcon |= S3C2410_TCON_T2MANUALUPD;
> +		break;
> +
> +	case SAMSUNG_PWM3:
> +		tcon &= ~(0x0f << 16);
> +		tcon |= S3C2410_TCON_T3MANUALUPD;
> +		break;
> +
> +	case SAMSUNG_PWM4:
> +		tcon &= ~(0x07 << 20);
> +		tcon |= S3C2410_TCON_T4MANUALUPD;
> +		break;
> +
> +	default:
> +		printk(KERN_ERR "Invalid Timer %d\n", mode);
> +		break;
> +	}
> +
> +	__raw_writel(tcnt, S3C2410_TCNTB(mode));
> +	__raw_writel(tcnt, S3C2410_TCMPB(mode));
> +	__raw_writel(tcon, S3C2410_TCON);
> +}
> +
> +static void samsung_time_start(enum samsung_timer_mode mode, bool
> periodic) +{
> +	unsigned long tcon;
> +
> +	tcon  = __raw_readl(S3C2410_TCON);
> +
> +	switch (mode) {
> +	case SAMSUNG_PWM0:
> +		tcon |= S3C2410_TCON_T0START;
> +		tcon &= ~S3C2410_TCON_T0MANUALUPD;
> +
> +		if (periodic)
> +			tcon |= S3C2410_TCON_T0RELOAD;
> +		else
> +			tcon &= ~S3C2410_TCON_T0RELOAD;
> +		break;
> +
> +	case SAMSUNG_PWM1:
> +		tcon |= S3C2410_TCON_T1START;
> +		tcon &= ~S3C2410_TCON_T1MANUALUPD;
> +
> +		if (periodic)
> +			tcon |= S3C2410_TCON_T1RELOAD;
> +		else
> +			tcon &= ~S3C2410_TCON_T1RELOAD;
> +		break;
> +
> +	case SAMSUNG_PWM2:
> +		tcon |= S3C2410_TCON_T2START;
> +		tcon &= ~S3C2410_TCON_T2MANUALUPD;
> +
> +		if (periodic)
> +			tcon |= S3C2410_TCON_T2RELOAD;
> +		else
> +			tcon &= ~S3C2410_TCON_T2RELOAD;
> +		break;
> +
> +	case SAMSUNG_PWM3:
> +		tcon |= S3C2410_TCON_T3START;
> +		tcon &= ~S3C2410_TCON_T3MANUALUPD;
> +
> +		if (periodic)
> +			tcon |= S3C2410_TCON_T3RELOAD;
> +		else
> +			tcon &= ~S3C2410_TCON_T3RELOAD;
> +		break;
> +
> +	case SAMSUNG_PWM4:
> +		tcon |= S3C2410_TCON_T4START;
> +		tcon &= ~S3C2410_TCON_T4MANUALUPD;
> +
> +		if (periodic)
> +			tcon |= S3C2410_TCON_T4RELOAD;
> +		else
> +			tcon &= ~S3C2410_TCON_T4RELOAD;
> +		break;
> +
> +	default:
> +		printk(KERN_ERR "Invalid Timer %d\n", mode);
> +		break;
> +	}
> +	__raw_writel(tcon, S3C2410_TCON);
> +}
> +
> +static int samsung_set_next_event(unsigned long cycles,
> +				struct clock_event_device *evt)
> +{
> +	samsung_time_setup(timer_source.event_id, cycles);
> +	samsung_time_start(timer_source.event_id, NON_PERIODIC);
> +
> +	return 0;
> +}
> +
> +static void samsung_set_mode(enum clock_event_mode mode,
> +				struct clock_event_device *evt)
> +{
> +	samsung_time_stop(timer_source.event_id);
> +
> +	switch (mode) {
> +	case CLOCK_EVT_MODE_PERIODIC:
> +		samsung_time_setup(timer_source.event_id, clock_count_per_tick);
> +		samsung_time_start(timer_source.event_id, PERIODIC);
> +		break;
> +
> +	case CLOCK_EVT_MODE_ONESHOT:
> +		break;
> +
> +	case CLOCK_EVT_MODE_UNUSED:
> +	case CLOCK_EVT_MODE_SHUTDOWN:
> +		break;
> +
> +	case CLOCK_EVT_MODE_RESUME:
> +		samsung_timer_resume();
> +		break;
> +	}
> +}
> +
> +static void samsung_timer_resume(void)
> +{
> +	/* event timer restart */
> +	samsung_time_setup(timer_source.event_id, clock_count_per_tick);
> +	samsung_time_start(timer_source.event_id, PERIODIC);
> +
> +	/* source timer restart */
> +	samsung_time_setup(timer_source.source_id, TCNT_MAX);
> +	samsung_time_start(timer_source.source_id, PERIODIC);
> +}
> +
> +void __init samsung_set_timer_source(enum samsung_timer_mode event,
> +				 enum samsung_timer_mode source)
> +{
> +	s3c_device_timer[event].dev.bus = &platform_bus_type;
> +	s3c_device_timer[source].dev.bus = &platform_bus_type;
> +
> +	timer_source.event_id = event;
> +	timer_source.source_id = source;
> +}
> +
> +static struct clock_event_device time_event_device = {
> +	.name		= "samsung_event_timer",
> +	.features	= CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT,
> +	.rating		= 200,
> +	.set_next_event	= samsung_set_next_event,
> +	.set_mode	= samsung_set_mode,
> +};
> +
> +static irqreturn_t samsung_clock_event_isr(int irq, void *dev_id)
> +{
> +	struct clock_event_device *evt = dev_id;
> +
> +	evt->event_handler(evt);
> +
> +	return IRQ_HANDLED;
> +}
> +
> +static struct irqaction samsung_clock_event_irq = {
> +	.name		= "samsung_time_irq",
> +	.flags		= IRQF_DISABLED | IRQF_TIMER | IRQF_IRQPOLL,
> +	.handler	= samsung_clock_event_isr,
> +	.dev_id		= &time_event_device,
> +};
> +
> +static void __init samsung_clockevent_init(void)
> +{
> +	unsigned long pclk;
> +	unsigned long clock_rate;
> +	unsigned int irq_number;
> +	struct clk *tscaler;
> +
> +	pclk = clk_get_rate(timerclk);
> +
> +	tscaler = clk_get_parent(tdiv_event);
> +
> +	clk_set_rate(tscaler, pclk / 2);
> +	clk_set_rate(tdiv_event, pclk / 2);
> +	clk_set_parent(tin_event, tdiv_event);
> +
> +	clock_rate = clk_get_rate(tin_event);
> +	clock_count_per_tick = clock_rate / HZ;
> +
> +	clockevents_calc_mult_shift(&time_event_device,
> +				    clock_rate, SAMSUNG_TIMER_MIN_RANGE);
> +	time_event_device.max_delta_ns =
> +		clockevent_delta2ns(-1, &time_event_device);
> +	time_event_device.min_delta_ns =
> +		clockevent_delta2ns(1, &time_event_device);
> +
> +	time_event_device.cpumask = cpumask_of(0);
> +	clockevents_register_device(&time_event_device);
> +
> +	irq_number = timer_source.event_id + IRQ_TIMER0;
> +	setup_irq(irq_number, &samsung_clock_event_irq);
> +}
> +
> +static void __iomem *samsung_timer_reg(void)
> +{
> +	unsigned long offset = 0;
> +
> +	switch (timer_source.source_id) {
> +	case SAMSUNG_PWM0:
> +	case SAMSUNG_PWM1:
> +	case SAMSUNG_PWM2:
> +	case SAMSUNG_PWM3:
> +		offset = (timer_source.source_id * 0x0c) + 0x14;
> +		break;
> +
> +	case SAMSUNG_PWM4:
> +		offset = 0x40;
> +		break;
> +
> +	default:
> +		printk(KERN_ERR "Invalid Timer %d\n", timer_source.source_id);
> +		return NULL;
> +	}
> +
> +	return S3C_TIMERREG(offset);
> +}
> +
> +/*
> + * Override the global weak sched_clock symbol with this
> + * local implementation which uses the clocksource to get some
> + * better resolution when scheduling the kernel. We accept that
> + * this wraps around for now, since it is just a relative time
> + * stamp. (Inspired by U300 implementation.)
> + */
> +static u32 notrace samsung_read_sched_clock(void)
> +{
> +	void __iomem *reg = samsung_timer_reg();
> +
> +	if (!reg)
> +		return 0;
> +
> +	return ~__raw_readl(reg);
> +}
> +
> +static void __init samsung_clocksource_init(void)
> +{
> +	unsigned long pclk;
> +	unsigned long clock_rate;
> +
> +	pclk = clk_get_rate(timerclk);
> +
> +	clk_set_rate(tdiv_source, pclk / 2);
> +	clk_set_parent(tin_source, tdiv_source);
> +
> +	clock_rate = clk_get_rate(tin_source);
> +
> +	samsung_time_setup(timer_source.source_id, TCNT_MAX);
> +	samsung_time_start(timer_source.source_id, PERIODIC);
> +
> +	setup_sched_clock(samsung_read_sched_clock, 32, clock_rate);
> +
> +	if (clocksource_mmio_init(samsung_timer_reg(),
> "samsung_clocksource_timer", +			clock_rate, 250, 32,
> clocksource_mmio_readl_down))
> +		panic("samsung_clocksource_timer: can't register clocksource\n");
> +}
> +
> +static void __init samsung_timer_resources(void)
> +{
> +
> +	unsigned long event_id = timer_source.event_id;
> +	unsigned long source_id = timer_source.source_id;
> +	char devname[15];
> +
> +	timerclk = clk_get(NULL, "timers");
> +	if (IS_ERR(timerclk))
> +		panic("failed to get timers clock for timer");
> +
> +	clk_enable(timerclk);
> +
> +	sprintf(devname, "s3c24xx-pwm.%lu", event_id);
> +	s3c_device_timer[event_id].id = event_id;
> +	s3c_device_timer[event_id].dev.init_name = devname;
> +
> +	tin_event = clk_get(&s3c_device_timer[event_id].dev, "pwm-tin");
> +	if (IS_ERR(tin_event))
> +		panic("failed to get pwm-tin clock for event timer");
> +
> +	tdiv_event = clk_get(&s3c_device_timer[event_id].dev, "pwm-tdiv");
> +	if (IS_ERR(tdiv_event))
> +		panic("failed to get pwm-tdiv clock for event timer");
> +
> +	clk_enable(tin_event);
> +
> +	sprintf(devname, "s3c24xx-pwm.%lu", source_id);
> +	s3c_device_timer[source_id].id = source_id;
> +	s3c_device_timer[source_id].dev.init_name = devname;
> +
> +	tin_source = clk_get(&s3c_device_timer[source_id].dev, "pwm-tin");
> +	if (IS_ERR(tin_source))
> +		panic("failed to get pwm-tin clock for source timer");
> +
> +	tdiv_source = clk_get(&s3c_device_timer[source_id].dev, "pwm-tdiv");
> +	if (IS_ERR(tdiv_source))
> +		panic("failed to get pwm-tdiv clock for source timer");
> +
> +	clk_enable(tin_source);
> +}
> +
> +static void __init samsung_timer_init(void)
> +{
> +	samsung_timer_resources();
> +	samsung_clockevent_init();
> +	samsung_clocksource_init();
> +}
> +
> +struct sys_timer samsung_timer = {
> +	.init		= samsung_timer_init,
> +};

^ permalink raw reply	[flat|nested] 39+ messages in thread

* Re: [PATCH 1/3] Rename s5p-time to samsung-time
  2012-11-27 23:57           ` Heiko Stübner
@ 2012-11-29 23:18             ` Romain Naour
  2012-11-29 23:59               ` Heiko Stübner
  2012-12-02 19:43               ` [PATCH 0/5 v2] S3C / S5PC100: add clockevent/clocksource support Romain Naour
  2012-12-02 19:44             ` [PATCH 1/5 v2] Rename s5p-time to samsung-time Romain Naour
                               ` (5 subsequent siblings)
  6 siblings, 2 replies; 39+ messages in thread
From: Romain Naour @ 2012-11-29 23:18 UTC (permalink / raw)
  To: Heiko Stübner
  Cc: tomasz.figa, Kukjin Kim, linux-samsung-soc, ben-linux,
	'Sylwester Nawrocki'

Hi Heiko,

Le 28/11/2012 00:57, Heiko Stübner a écrit :
> Hi Romain,
> 
> Am Mittwoch, 28. November 2012, 00:27:36 schrieb Romain Naour:
>> Hi Tomasz, Kgene
>>
>>> I would also suggest splitting this huge patch into a series of several
>>> smaller, possibly:
>>> 1) Rename s5p-time to samsung-time (and correct any platforms using it
>>> currently)
>>> 2) Add samsung-time support for s3c24xx
>>> 3) Add samsung-time support for s3c64xx
>>>
>>> What do you think?
>>>
>>> Best regards,
>>> Tomasz Figa
>>
>> I have separated the patch into three parts, as you said.
>> And also, I corrected some oversights ;-)
>>
>> These patches are for 3.7-rc6.
>>
>> Here is the first one:
> 
> Comments like this should either be in the comment section (below the three 
> dashes) or in a cover-letter (git format-patch --cover-letter), but not in the 
> commit message of the patch itself.
> 

Thank you for your advice :)

> Otherwise the patches look very cool. Hopefully I'll find a bit of time to 
> test them tomorrow.
> 

On which processor can you test these patches ?

> 
> But I do have some quick comments:
> 
> What happens to s3c24xx_timer? It seems you changed every user of it but did 
> not remove the old timer code. Might be interesting as a 4th patch, or is it 
> still used somewhere?

s3c24xx_timer is still used by s5pc100 CPUs. 
That's why I didn't remove plat-samsung/time.c
I do not have the datasheet, but s5pc100 timers seem to be similar to s3c24xx timers. (16bis)
Can someone test on a processor s5pc100 ?

> 
> Please use the -M option to "git format-patch" which minimizes the impact of 
> moved files in the patch itself.
> 
Do you want I resends these patches, plus one for s5pc100 ?

> 
> Thanks for doing this change
> Heiko
> 

Thank you for your comments :)
Romain

> 
>> This patch rename s5p-time to samsung-time.
>> There is no functional change.
>>
>> Signed-off-by: Naour Romain <romain.naour@openwide.fr>
>> ---
>>  arch/arm/mach-exynos/Kconfig                      |   2 +-
>>  arch/arm/mach-exynos/mach-universal_c210.c        |   6 +-
>>  arch/arm/mach-s5p64x0/Kconfig                     |   4 +-
>>  arch/arm/mach-s5p64x0/mach-smdk6440.c             |   6 +-
>>  arch/arm/mach-s5p64x0/mach-smdk6450.c             |   6 +-
>>  arch/arm/mach-s5pv210/Kconfig                     |   2 +-
>>  arch/arm/mach-s5pv210/mach-aquila.c               |   6 +-
>>  arch/arm/mach-s5pv210/mach-goni.c                 |   6 +-
>>  arch/arm/mach-s5pv210/mach-smdkc110.c             |   6 +-
>>  arch/arm/mach-s5pv210/mach-smdkv210.c             |   6 +-
>>  arch/arm/mach-s5pv210/mach-torbreck.c             |   6 +-
>>  arch/arm/plat-samsung/Kconfig                     |   2 +-
>>  arch/arm/plat-samsung/Makefile                    |   2 +-
>>  arch/arm/plat-samsung/include/plat/s5p-time.h     |  40 ---
>>  arch/arm/plat-samsung/include/plat/samsung-time.h |  40 +++
>>  arch/arm/plat-samsung/s5p-time.c                  | 405
>> ---------------------- arch/arm/plat-samsung/samsung-time.c              |
>> 405 ++++++++++++++++++++++ 17 files changed, 475 insertions(+), 475
>> deletions(-)
>>  delete mode 100644 arch/arm/plat-samsung/include/plat/s5p-time.h
>>  create mode 100644 arch/arm/plat-samsung/include/plat/samsung-time.h
>>  delete mode 100644 arch/arm/plat-samsung/s5p-time.c
>>  create mode 100644 arch/arm/plat-samsung/samsung-time.c
>>
>> diff --git a/arch/arm/mach-exynos/Kconfig b/arch/arm/mach-exynos/Kconfig
>> index da55107..20edfa3 100644
>> --- a/arch/arm/mach-exynos/Kconfig
>> +++ b/arch/arm/mach-exynos/Kconfig
>> @@ -274,7 +274,7 @@ config MACH_UNIVERSAL_C210
>>  	select S5P_DEV_ONENAND
>>  	select S5P_DEV_TV
>>  	select S5P_GPIO_INT
>> -	select S5P_HRT
>> +	select SAMSUNG_HRT
>>  	select S5P_SETUP_MIPIPHY
>>  	help
>>  	  Machine support for Samsung Mobile Universal S5PC210 Reference
>> diff --git a/arch/arm/mach-exynos/mach-universal_c210.c
>> b/arch/arm/mach-exynos/mach-universal_c210.c index ebc9dd3..325bfe9 100644
>> --- a/arch/arm/mach-exynos/mach-universal_c210.c
>> +++ b/arch/arm/mach-exynos/mach-universal_c210.c
>> @@ -41,7 +41,7 @@
>>  #include <plat/mfc.h>
>>  #include <plat/sdhci.h>
>>  #include <plat/fimc-core.h>
>> -#include <plat/s5p-time.h>
>> +#include <plat/samsung-time.h>
>>  #include <plat/camport.h>
>>  #include <linux/platform_data/mipi-csis.h>
>>
>> @@ -1099,7 +1099,7 @@ static void __init universal_map_io(void)
>>  	exynos_init_io(NULL, 0);
>>  	s3c24xx_init_clocks(clk_xusbxti.rate);
>>  	s3c24xx_init_uarts(universal_uartcfgs, ARRAY_SIZE(universal_uartcfgs));
>> -	s5p_set_timer_source(S5P_PWM2, S5P_PWM4);
>> +	samsung_set_timer_source(SAMSUNG_PWM2, SAMSUNG_PWM4);
>>  }
>>
>>  static void s5p_tv_setup(void)
>> @@ -1158,7 +1158,7 @@ MACHINE_START(UNIVERSAL_C210, "UNIVERSAL_C210")
>>  	.handle_irq	= gic_handle_irq,
>>  	.init_machine	= universal_machine_init,
>>  	.init_late	= exynos_init_late,
>> -	.timer		= &s5p_timer,
>> +	.timer		= &samsung_timer,
>>  	.reserve        = &universal_reserve,
>>  	.restart	= exynos4_restart,
>>  MACHINE_END
>> diff --git a/arch/arm/mach-s5p64x0/Kconfig b/arch/arm/mach-s5p64x0/Kconfig
>> index e8742cb..f0ec535 100644
>> --- a/arch/arm/mach-s5p64x0/Kconfig
>> +++ b/arch/arm/mach-s5p64x0/Kconfig
>> @@ -9,7 +9,7 @@ if ARCH_S5P64X0
>>
>>  config CPU_S5P6440
>>  	bool
>> -	select S5P_HRT
>> +	select SAMSUNG_HRT
>>  	select S5P_SLEEP if PM
>>  	select SAMSUNG_DMADEV
>>  	select SAMSUNG_WAKEMASK if PM
>> @@ -18,7 +18,7 @@ config CPU_S5P6440
>>
>>  config CPU_S5P6450
>>  	bool
>> -	select S5P_HRT
>> +	select SAMSUNG_HRT
>>  	select S5P_SLEEP if PM
>>  	select SAMSUNG_DMADEV
>>  	select SAMSUNG_WAKEMASK if PM
>> diff --git a/arch/arm/mach-s5p64x0/mach-smdk6440.c
>> b/arch/arm/mach-s5p64x0/mach-smdk6440.c index 96ea1fe..587fec5 100644
>> --- a/arch/arm/mach-s5p64x0/mach-smdk6440.c
>> +++ b/arch/arm/mach-s5p64x0/mach-smdk6440.c
>> @@ -50,7 +50,7 @@
>>  #include <plat/pll.h>
>>  #include <plat/adc.h>
>>  #include <linux/platform_data/touchscreen-s3c2410.h>
>> -#include <plat/s5p-time.h>
>> +#include <plat/samsung-time.h>
>>  #include <plat/backlight.h>
>>  #include <plat/fb.h>
>>  #include <plat/sdhci.h>
>> @@ -231,7 +231,7 @@ static void __init smdk6440_map_io(void)
>>  	s5p64x0_init_io(NULL, 0);
>>  	s3c24xx_init_clocks(12000000);
>>  	s3c24xx_init_uarts(smdk6440_uartcfgs, ARRAY_SIZE(smdk6440_uartcfgs));
>> -	s5p_set_timer_source(S5P_PWM3, S5P_PWM4);
>> +	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
>>  }
>>
>>  static void s5p6440_set_lcd_interface(void)
>> @@ -276,6 +276,6 @@ MACHINE_START(SMDK6440, "SMDK6440")
>>  	.handle_irq	= vic_handle_irq,
>>  	.map_io		= smdk6440_map_io,
>>  	.init_machine	= smdk6440_machine_init,
>> -	.timer		= &s5p_timer,
>> +	.timer		= &samsung_timer,
>>  	.restart	= s5p64x0_restart,
>>  MACHINE_END
>> diff --git a/arch/arm/mach-s5p64x0/mach-smdk6450.c
>> b/arch/arm/mach-s5p64x0/mach-smdk6450.c index 12748b6..714cd8a 100644
>> --- a/arch/arm/mach-s5p64x0/mach-smdk6450.c
>> +++ b/arch/arm/mach-s5p64x0/mach-smdk6450.c
>> @@ -50,7 +50,7 @@
>>  #include <plat/pll.h>
>>  #include <plat/adc.h>
>>  #include <linux/platform_data/touchscreen-s3c2410.h>
>> -#include <plat/s5p-time.h>
>> +#include <plat/samsung-time.h>
>>  #include <plat/backlight.h>
>>  #include <plat/fb.h>
>>  #include <plat/sdhci.h>
>> @@ -250,7 +250,7 @@ static void __init smdk6450_map_io(void)
>>  	s5p64x0_init_io(NULL, 0);
>>  	s3c24xx_init_clocks(19200000);
>>  	s3c24xx_init_uarts(smdk6450_uartcfgs, ARRAY_SIZE(smdk6450_uartcfgs));
>> -	s5p_set_timer_source(S5P_PWM3, S5P_PWM4);
>> +	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
>>  }
>>
>>  static void s5p6450_set_lcd_interface(void)
>> @@ -295,6 +295,6 @@ MACHINE_START(SMDK6450, "SMDK6450")
>>  	.handle_irq	= vic_handle_irq,
>>  	.map_io		= smdk6450_map_io,
>>  	.init_machine	= smdk6450_machine_init,
>> -	.timer		= &s5p_timer,
>> +	.timer		= &samsung_timer,
>>  	.restart	= s5p64x0_restart,
>>  MACHINE_END
>> diff --git a/arch/arm/mach-s5pv210/Kconfig b/arch/arm/mach-s5pv210/Kconfig
>> index 92ad72f..01018ef 100644
>> --- a/arch/arm/mach-s5pv210/Kconfig
>> +++ b/arch/arm/mach-s5pv210/Kconfig
>> @@ -12,7 +12,7 @@ if ARCH_S5PV210
>>  config CPU_S5PV210
>>  	bool
>>  	select S5P_EXT_INT
>> -	select S5P_HRT
>> +	select SAMSUNG_HRT
>>  	select S5P_PM if PM
>>  	select S5P_SLEEP if PM
>>  	select SAMSUNG_DMADEV
>> diff --git a/arch/arm/mach-s5pv210/mach-aquila.c
>> b/arch/arm/mach-s5pv210/mach-aquila.c index ee9fa5c..7c7d89b 100644
>> --- a/arch/arm/mach-s5pv210/mach-aquila.c
>> +++ b/arch/arm/mach-s5pv210/mach-aquila.c
>> @@ -39,7 +39,7 @@
>>  #include <plat/fb.h>
>>  #include <plat/fimc-core.h>
>>  #include <plat/sdhci.h>
>> -#include <plat/s5p-time.h>
>> +#include <plat/samsung-time.h>
>>
>>  #include "common.h"
>>
>> @@ -652,7 +652,7 @@ static void __init aquila_map_io(void)
>>  	s5pv210_init_io(NULL, 0);
>>  	s3c24xx_init_clocks(24000000);
>>  	s3c24xx_init_uarts(aquila_uartcfgs, ARRAY_SIZE(aquila_uartcfgs));
>> -	s5p_set_timer_source(S5P_PWM3, S5P_PWM4);
>> +	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
>>  }
>>
>>  static void __init aquila_machine_init(void)
>> @@ -688,6 +688,6 @@ MACHINE_START(AQUILA, "Aquila")
>>  	.handle_irq	= vic_handle_irq,
>>  	.map_io		= aquila_map_io,
>>  	.init_machine	= aquila_machine_init,
>> -	.timer		= &s5p_timer,
>> +	.timer		= &samsung_timer,
>>  	.restart	= s5pv210_restart,
>>  MACHINE_END
>> diff --git a/arch/arm/mach-s5pv210/mach-goni.c
>> b/arch/arm/mach-s5pv210/mach-goni.c index 55e1dba..2740001 100644
>> --- a/arch/arm/mach-s5pv210/mach-goni.c
>> +++ b/arch/arm/mach-s5pv210/mach-goni.c
>> @@ -48,7 +48,7 @@
>>  #include <plat/keypad.h>
>>  #include <plat/sdhci.h>
>>  #include <plat/clock.h>
>> -#include <plat/s5p-time.h>
>> +#include <plat/samsung-time.h>
>>  #include <plat/mfc.h>
>>  #include <plat/camport.h>
>>
>> @@ -910,7 +910,7 @@ static void __init goni_map_io(void)
>>  	s5pv210_init_io(NULL, 0);
>>  	s3c24xx_init_clocks(clk_xusbxti.rate);
>>  	s3c24xx_init_uarts(goni_uartcfgs, ARRAY_SIZE(goni_uartcfgs));
>> -	s5p_set_timer_source(S5P_PWM3, S5P_PWM4);
>> +	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
>>  }
>>
>>  static void __init goni_reserve(void)
>> @@ -976,7 +976,7 @@ MACHINE_START(GONI, "GONI")
>>  	.handle_irq	= vic_handle_irq,
>>  	.map_io		= goni_map_io,
>>  	.init_machine	= goni_machine_init,
>> -	.timer		= &s5p_timer,
>> +	.timer		= &samsung_timer,
>>  	.reserve	= &goni_reserve,
>>  	.restart	= s5pv210_restart,
>>  MACHINE_END
>> diff --git a/arch/arm/mach-s5pv210/mach-smdkc110.c
>> b/arch/arm/mach-s5pv210/mach-smdkc110.c index d9c99fc..d2e93b7 100644
>> --- a/arch/arm/mach-s5pv210/mach-smdkc110.c
>> +++ b/arch/arm/mach-s5pv210/mach-smdkc110.c
>> @@ -30,7 +30,7 @@
>>  #include <linux/platform_data/ata-samsung_cf.h>
>>  #include <linux/platform_data/i2c-s3c2410.h>
>>  #include <plat/pm.h>
>> -#include <plat/s5p-time.h>
>> +#include <plat/samsung-time.h>
>>  #include <plat/mfc.h>
>>
>>  #include "common.h"
>> @@ -122,7 +122,7 @@ static void __init smdkc110_map_io(void)
>>  	s5pv210_init_io(NULL, 0);
>>  	s3c24xx_init_clocks(24000000);
>>  	s3c24xx_init_uarts(smdkv210_uartcfgs, ARRAY_SIZE(smdkv210_uartcfgs));
>> -	s5p_set_timer_source(S5P_PWM3, S5P_PWM4);
>> +	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
>>  }
>>
>>  static void __init smdkc110_reserve(void)
>> @@ -156,7 +156,7 @@ MACHINE_START(SMDKC110, "SMDKC110")
>>  	.handle_irq	= vic_handle_irq,
>>  	.map_io		= smdkc110_map_io,
>>  	.init_machine	= smdkc110_machine_init,
>> -	.timer		= &s5p_timer,
>> +	.timer		= &samsung_timer,
>>  	.restart	= s5pv210_restart,
>>  	.reserve	= &smdkc110_reserve,
>>  MACHINE_END
>> diff --git a/arch/arm/mach-s5pv210/mach-smdkv210.c
>> b/arch/arm/mach-s5pv210/mach-smdkv210.c index 4cdb5bb..cd28725 100644
>> --- a/arch/arm/mach-s5pv210/mach-smdkv210.c
>> +++ b/arch/arm/mach-s5pv210/mach-smdkv210.c
>> @@ -45,7 +45,7 @@
>>  #include <plat/keypad.h>
>>  #include <plat/pm.h>
>>  #include <plat/fb.h>
>> -#include <plat/s5p-time.h>
>> +#include <plat/samsung-time.h>
>>  #include <plat/backlight.h>
>>  #include <plat/mfc.h>
>>  #include <plat/clock.h>
>> @@ -287,7 +287,7 @@ static void __init smdkv210_map_io(void)
>>  	s5pv210_init_io(NULL, 0);
>>  	s3c24xx_init_clocks(clk_xusbxti.rate);
>>  	s3c24xx_init_uarts(smdkv210_uartcfgs, ARRAY_SIZE(smdkv210_uartcfgs));
>> -	s5p_set_timer_source(S5P_PWM2, S5P_PWM4);
>> +	samsung_set_timer_source(SAMSUNG_PWM2, SAMSUNG_PWM4);
>>  }
>>
>>  static void __init smdkv210_reserve(void)
>> @@ -332,7 +332,7 @@ MACHINE_START(SMDKV210, "SMDKV210")
>>  	.handle_irq	= vic_handle_irq,
>>  	.map_io		= smdkv210_map_io,
>>  	.init_machine	= smdkv210_machine_init,
>> -	.timer		= &s5p_timer,
>> +	.timer		= &samsung_timer,
>>  	.restart	= s5pv210_restart,
>>  	.reserve	= &smdkv210_reserve,
>>  MACHINE_END
>> diff --git a/arch/arm/mach-s5pv210/mach-torbreck.c
>> b/arch/arm/mach-s5pv210/mach-torbreck.c index 18785cb..aec668c 100644
>> --- a/arch/arm/mach-s5pv210/mach-torbreck.c
>> +++ b/arch/arm/mach-s5pv210/mach-torbreck.c
>> @@ -27,7 +27,7 @@
>>  #include <plat/devs.h>
>>  #include <plat/cpu.h>
>>  #include <linux/platform_data/i2c-s3c2410.h>
>> -#include <plat/s5p-time.h>
>> +#include <plat/samsung-time.h>
>>
>>  #include "common.h"
>>
>> @@ -107,7 +107,7 @@ static void __init torbreck_map_io(void)
>>  	s5pv210_init_io(NULL, 0);
>>  	s3c24xx_init_clocks(24000000);
>>  	s3c24xx_init_uarts(torbreck_uartcfgs, ARRAY_SIZE(torbreck_uartcfgs));
>> -	s5p_set_timer_source(S5P_PWM3, S5P_PWM4);
>> +	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
>>  }
>>
>>  static void __init torbreck_machine_init(void)
>> @@ -132,6 +132,6 @@ MACHINE_START(TORBRECK, "TORBRECK")
>>  	.handle_irq	= vic_handle_irq,
>>  	.map_io		= torbreck_map_io,
>>  	.init_machine	= torbreck_machine_init,
>> -	.timer		= &s5p_timer,
>> +	.timer		= &samsung_timer,
>>  	.restart	= s5pv210_restart,
>>  MACHINE_END
>> diff --git a/arch/arm/plat-samsung/Kconfig b/arch/arm/plat-samsung/Kconfig
>> index 59401e1..5278795 100644
>> --- a/arch/arm/plat-samsung/Kconfig
>> +++ b/arch/arm/plat-samsung/Kconfig
>> @@ -70,7 +70,7 @@ config S3C_LOWLEVEL_UART_PORT
>>
>>  # timer options
>>
>> -config S5P_HRT
>> +config SAMSUNG_HRT
>>  	bool
>>  	select SAMSUNG_DEV_PWM
>>  	help
>> diff --git a/arch/arm/plat-samsung/Makefile
>> b/arch/arm/plat-samsung/Makefile index 9e40e8d..06f2312 100644
>> --- a/arch/arm/plat-samsung/Makefile
>> +++ b/arch/arm/plat-samsung/Makefile
>> @@ -13,7 +13,7 @@ obj-				:=
>>
>>  obj-y				+= init.o cpu.o
>>  obj-$(CONFIG_ARCH_USES_GETTIMEOFFSET)   += time.o
>> -obj-$(CONFIG_S5P_HRT) 		+= s5p-time.o
>> +obj-$(CONFIG_SAMSUNG_HRT) 		+= samsung-time.o
>>
>>  obj-$(CONFIG_SAMSUNG_CLOCK)	+= clock.o
>>  obj-$(CONFIG_SAMSUNG_CLOCK)	+= pwm-clock.o
>> diff --git a/arch/arm/plat-samsung/include/plat/s5p-time.h
>> b/arch/arm/plat-samsung/include/plat/s5p-time.h deleted file mode 100644
>> index 3a70aeb..0000000
>> --- a/arch/arm/plat-samsung/include/plat/s5p-time.h
>> +++ /dev/null
>> @@ -1,40 +0,0 @@
>> -/* linux/arch/arm/plat-samsung/include/plat/s5p-time.h
>> - *
>> - * Copyright 2011 Samsung Electronics Co., Ltd.
>> - *		http://www.samsung.com/
>> - *
>> - * Header file for s5p time support
>> - *
>> - * This program is free software; you can redistribute it and/or modify
>> - * it under the terms of the GNU General Public License version 2 as
>> - * published by the Free Software Foundation.
>> -*/
>> -
>> -#ifndef __ASM_PLAT_S5P_TIME_H
>> -#define __ASM_PLAT_S5P_TIME_H __FILE__
>> -
>> -/* S5P HR-Timer Clock mode */
>> -enum s5p_timer_mode {
>> -	S5P_PWM0,
>> -	S5P_PWM1,
>> -	S5P_PWM2,
>> -	S5P_PWM3,
>> -	S5P_PWM4,
>> -};
>> -
>> -struct s5p_timer_source {
>> -	unsigned int event_id;
>> -	unsigned int source_id;
>> -};
>> -
>> -/* Be able to sleep for atleast 4 seconds (usually more) */
>> -#define S5PTIMER_MIN_RANGE	4
>> -
>> -#define TCNT_MAX		0xffffffff
>> -#define NON_PERIODIC		0
>> -#define PERIODIC		1
>> -
>> -extern void __init s5p_set_timer_source(enum s5p_timer_mode event,
>> -					enum s5p_timer_mode source);
>> -extern	struct sys_timer s5p_timer;
>> -#endif /* __ASM_PLAT_S5P_TIME_H */
>> diff --git a/arch/arm/plat-samsung/include/plat/samsung-time.h
>> b/arch/arm/plat-samsung/include/plat/samsung-time.h new file mode 100644
>> index 0000000..9d6d622
>> --- /dev/null
>> +++ b/arch/arm/plat-samsung/include/plat/samsung-time.h
>> @@ -0,0 +1,40 @@
>> +/* linux/arch/arm/plat-samsung/include/plat/samsung-time.h
>> + *
>> + * Copyright 2011 Samsung Electronics Co., Ltd.
>> + *		http://www.samsung.com/
>> + *
>> + * Header file for samsung s3c and s5p time support
>> + *
>> + * This program is free software; you can redistribute it and/or modify
>> + * it under the terms of the GNU General Public License version 2 as
>> + * published by the Free Software Foundation.
>> +*/
>> +
>> +#ifndef __ASM_PLAT_SAMSUNG_TIME_H
>> +#define __ASM_PLAT_SAMSUNG_TIME_H __FILE__
>> +
>> +/* SAMSUNG HR-Timer Clock mode */
>> +enum samsung_timer_mode {
>> +	SAMSUNG_PWM0,
>> +	SAMSUNG_PWM1,
>> +	SAMSUNG_PWM2,
>> +	SAMSUNG_PWM3,
>> +	SAMSUNG_PWM4,
>> +};
>> +
>> +struct samsung_timer_source {
>> +	unsigned int event_id;
>> +	unsigned int source_id;
>> +};
>> +
>> +/* Be able to sleep for atleast 4 seconds (usually more) */
>> +#define SAMSUNG_TIMER_MIN_RANGE	4
>> +
>> +#define TCNT_MAX		0xffffffff
>> +#define NON_PERIODIC		0
>> +#define PERIODIC		1
>> +
>> +extern void __init samsung_set_timer_source(enum samsung_timer_mode event,
>> +					enum samsung_timer_mode source);
>> +extern	struct sys_timer samsung_timer;
>> +#endif /* __ASM_PLAT_SAMSUNG_TIME_H */
>> diff --git a/arch/arm/plat-samsung/s5p-time.c
>> b/arch/arm/plat-samsung/s5p-time.c deleted file mode 100644
>> index 028b6e8..0000000
>> --- a/arch/arm/plat-samsung/s5p-time.c
>> +++ /dev/null
>> @@ -1,405 +0,0 @@
>> -/*
>> - * Copyright (c) 2011 Samsung Electronics Co., Ltd.
>> - *		http://www.samsung.com/
>> - *
>> - * S5P - Common hr-timer support
>> - *
>> - * This program is free software; you can redistribute it and/or modify
>> - * it under the terms of the GNU General Public License version 2 as
>> - * published by the Free Software Foundation.
>> -*/
>> -
>> -#include <linux/interrupt.h>
>> -#include <linux/irq.h>
>> -#include <linux/err.h>
>> -#include <linux/clk.h>
>> -#include <linux/clockchips.h>
>> -#include <linux/platform_device.h>
>> -
>> -#include <asm/smp_twd.h>
>> -#include <asm/mach/time.h>
>> -#include <asm/mach/arch.h>
>> -#include <asm/mach/map.h>
>> -#include <asm/sched_clock.h>
>> -
>> -#include <mach/map.h>
>> -#include <plat/devs.h>
>> -#include <plat/regs-timer.h>
>> -#include <plat/s5p-time.h>
>> -
>> -static struct clk *tin_event;
>> -static struct clk *tin_source;
>> -static struct clk *tdiv_event;
>> -static struct clk *tdiv_source;
>> -static struct clk *timerclk;
>> -static struct s5p_timer_source timer_source;
>> -static unsigned long clock_count_per_tick;
>> -static void s5p_timer_resume(void);
>> -
>> -static void s5p_time_stop(enum s5p_timer_mode mode)
>> -{
>> -	unsigned long tcon;
>> -
>> -	tcon = __raw_readl(S3C2410_TCON);
>> -
>> -	switch (mode) {
>> -	case S5P_PWM0:
>> -		tcon &= ~S3C2410_TCON_T0START;
>> -		break;
>> -
>> -	case S5P_PWM1:
>> -		tcon &= ~S3C2410_TCON_T1START;
>> -		break;
>> -
>> -	case S5P_PWM2:
>> -		tcon &= ~S3C2410_TCON_T2START;
>> -		break;
>> -
>> -	case S5P_PWM3:
>> -		tcon &= ~S3C2410_TCON_T3START;
>> -		break;
>> -
>> -	case S5P_PWM4:
>> -		tcon &= ~S3C2410_TCON_T4START;
>> -		break;
>> -
>> -	default:
>> -		printk(KERN_ERR "Invalid Timer %d\n", mode);
>> -		break;
>> -	}
>> -	__raw_writel(tcon, S3C2410_TCON);
>> -}
>> -
>> -static void s5p_time_setup(enum s5p_timer_mode mode, unsigned long tcnt)
>> -{
>> -	unsigned long tcon;
>> -
>> -	tcon = __raw_readl(S3C2410_TCON);
>> -
>> -	tcnt--;
>> -
>> -	switch (mode) {
>> -	case S5P_PWM0:
>> -		tcon &= ~(0x0f << 0);
>> -		tcon |= S3C2410_TCON_T0MANUALUPD;
>> -		break;
>> -
>> -	case S5P_PWM1:
>> -		tcon &= ~(0x0f << 8);
>> -		tcon |= S3C2410_TCON_T1MANUALUPD;
>> -		break;
>> -
>> -	case S5P_PWM2:
>> -		tcon &= ~(0x0f << 12);
>> -		tcon |= S3C2410_TCON_T2MANUALUPD;
>> -		break;
>> -
>> -	case S5P_PWM3:
>> -		tcon &= ~(0x0f << 16);
>> -		tcon |= S3C2410_TCON_T3MANUALUPD;
>> -		break;
>> -
>> -	case S5P_PWM4:
>> -		tcon &= ~(0x07 << 20);
>> -		tcon |= S3C2410_TCON_T4MANUALUPD;
>> -		break;
>> -
>> -	default:
>> -		printk(KERN_ERR "Invalid Timer %d\n", mode);
>> -		break;
>> -	}
>> -
>> -	__raw_writel(tcnt, S3C2410_TCNTB(mode));
>> -	__raw_writel(tcnt, S3C2410_TCMPB(mode));
>> -	__raw_writel(tcon, S3C2410_TCON);
>> -}
>> -
>> -static void s5p_time_start(enum s5p_timer_mode mode, bool periodic)
>> -{
>> -	unsigned long tcon;
>> -
>> -	tcon  = __raw_readl(S3C2410_TCON);
>> -
>> -	switch (mode) {
>> -	case S5P_PWM0:
>> -		tcon |= S3C2410_TCON_T0START;
>> -		tcon &= ~S3C2410_TCON_T0MANUALUPD;
>> -
>> -		if (periodic)
>> -			tcon |= S3C2410_TCON_T0RELOAD;
>> -		else
>> -			tcon &= ~S3C2410_TCON_T0RELOAD;
>> -		break;
>> -
>> -	case S5P_PWM1:
>> -		tcon |= S3C2410_TCON_T1START;
>> -		tcon &= ~S3C2410_TCON_T1MANUALUPD;
>> -
>> -		if (periodic)
>> -			tcon |= S3C2410_TCON_T1RELOAD;
>> -		else
>> -			tcon &= ~S3C2410_TCON_T1RELOAD;
>> -		break;
>> -
>> -	case S5P_PWM2:
>> -		tcon |= S3C2410_TCON_T2START;
>> -		tcon &= ~S3C2410_TCON_T2MANUALUPD;
>> -
>> -		if (periodic)
>> -			tcon |= S3C2410_TCON_T2RELOAD;
>> -		else
>> -			tcon &= ~S3C2410_TCON_T2RELOAD;
>> -		break;
>> -
>> -	case S5P_PWM3:
>> -		tcon |= S3C2410_TCON_T3START;
>> -		tcon &= ~S3C2410_TCON_T3MANUALUPD;
>> -
>> -		if (periodic)
>> -			tcon |= S3C2410_TCON_T3RELOAD;
>> -		else
>> -			tcon &= ~S3C2410_TCON_T3RELOAD;
>> -		break;
>> -
>> -	case S5P_PWM4:
>> -		tcon |= S3C2410_TCON_T4START;
>> -		tcon &= ~S3C2410_TCON_T4MANUALUPD;
>> -
>> -		if (periodic)
>> -			tcon |= S3C2410_TCON_T4RELOAD;
>> -		else
>> -			tcon &= ~S3C2410_TCON_T4RELOAD;
>> -		break;
>> -
>> -	default:
>> -		printk(KERN_ERR "Invalid Timer %d\n", mode);
>> -		break;
>> -	}
>> -	__raw_writel(tcon, S3C2410_TCON);
>> -}
>> -
>> -static int s5p_set_next_event(unsigned long cycles,
>> -				struct clock_event_device *evt)
>> -{
>> -	s5p_time_setup(timer_source.event_id, cycles);
>> -	s5p_time_start(timer_source.event_id, NON_PERIODIC);
>> -
>> -	return 0;
>> -}
>> -
>> -static void s5p_set_mode(enum clock_event_mode mode,
>> -				struct clock_event_device *evt)
>> -{
>> -	s5p_time_stop(timer_source.event_id);
>> -
>> -	switch (mode) {
>> -	case CLOCK_EVT_MODE_PERIODIC:
>> -		s5p_time_setup(timer_source.event_id, clock_count_per_tick);
>> -		s5p_time_start(timer_source.event_id, PERIODIC);
>> -		break;
>> -
>> -	case CLOCK_EVT_MODE_ONESHOT:
>> -		break;
>> -
>> -	case CLOCK_EVT_MODE_UNUSED:
>> -	case CLOCK_EVT_MODE_SHUTDOWN:
>> -		break;
>> -
>> -	case CLOCK_EVT_MODE_RESUME:
>> -		s5p_timer_resume();
>> -		break;
>> -	}
>> -}
>> -
>> -static void s5p_timer_resume(void)
>> -{
>> -	/* event timer restart */
>> -	s5p_time_setup(timer_source.event_id, clock_count_per_tick);
>> -	s5p_time_start(timer_source.event_id, PERIODIC);
>> -
>> -	/* source timer restart */
>> -	s5p_time_setup(timer_source.source_id, TCNT_MAX);
>> -	s5p_time_start(timer_source.source_id, PERIODIC);
>> -}
>> -
>> -void __init s5p_set_timer_source(enum s5p_timer_mode event,
>> -				 enum s5p_timer_mode source)
>> -{
>> -	s3c_device_timer[event].dev.bus = &platform_bus_type;
>> -	s3c_device_timer[source].dev.bus = &platform_bus_type;
>> -
>> -	timer_source.event_id = event;
>> -	timer_source.source_id = source;
>> -}
>> -
>> -static struct clock_event_device time_event_device = {
>> -	.name		= "s5p_event_timer",
>> -	.features	= CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT,
>> -	.rating		= 200,
>> -	.set_next_event	= s5p_set_next_event,
>> -	.set_mode	= s5p_set_mode,
>> -};
>> -
>> -static irqreturn_t s5p_clock_event_isr(int irq, void *dev_id)
>> -{
>> -	struct clock_event_device *evt = dev_id;
>> -
>> -	evt->event_handler(evt);
>> -
>> -	return IRQ_HANDLED;
>> -}
>> -
>> -static struct irqaction s5p_clock_event_irq = {
>> -	.name		= "s5p_time_irq",
>> -	.flags		= IRQF_DISABLED | IRQF_TIMER | IRQF_IRQPOLL,
>> -	.handler	= s5p_clock_event_isr,
>> -	.dev_id		= &time_event_device,
>> -};
>> -
>> -static void __init s5p_clockevent_init(void)
>> -{
>> -	unsigned long pclk;
>> -	unsigned long clock_rate;
>> -	unsigned int irq_number;
>> -	struct clk *tscaler;
>> -
>> -	pclk = clk_get_rate(timerclk);
>> -
>> -	tscaler = clk_get_parent(tdiv_event);
>> -
>> -	clk_set_rate(tscaler, pclk / 2);
>> -	clk_set_rate(tdiv_event, pclk / 2);
>> -	clk_set_parent(tin_event, tdiv_event);
>> -
>> -	clock_rate = clk_get_rate(tin_event);
>> -	clock_count_per_tick = clock_rate / HZ;
>> -
>> -	clockevents_calc_mult_shift(&time_event_device,
>> -				    clock_rate, S5PTIMER_MIN_RANGE);
>> -	time_event_device.max_delta_ns =
>> -		clockevent_delta2ns(-1, &time_event_device);
>> -	time_event_device.min_delta_ns =
>> -		clockevent_delta2ns(1, &time_event_device);
>> -
>> -	time_event_device.cpumask = cpumask_of(0);
>> -	clockevents_register_device(&time_event_device);
>> -
>> -	irq_number = timer_source.event_id + IRQ_TIMER0;
>> -	setup_irq(irq_number, &s5p_clock_event_irq);
>> -}
>> -
>> -static void __iomem *s5p_timer_reg(void)
>> -{
>> -	unsigned long offset = 0;
>> -
>> -	switch (timer_source.source_id) {
>> -	case S5P_PWM0:
>> -	case S5P_PWM1:
>> -	case S5P_PWM2:
>> -	case S5P_PWM3:
>> -		offset = (timer_source.source_id * 0x0c) + 0x14;
>> -		break;
>> -
>> -	case S5P_PWM4:
>> -		offset = 0x40;
>> -		break;
>> -
>> -	default:
>> -		printk(KERN_ERR "Invalid Timer %d\n", timer_source.source_id);
>> -		return NULL;
>> -	}
>> -
>> -	return S3C_TIMERREG(offset);
>> -}
>> -
>> -/*
>> - * Override the global weak sched_clock symbol with this
>> - * local implementation which uses the clocksource to get some
>> - * better resolution when scheduling the kernel. We accept that
>> - * this wraps around for now, since it is just a relative time
>> - * stamp. (Inspired by U300 implementation.)
>> - */
>> -static u32 notrace s5p_read_sched_clock(void)
>> -{
>> -	void __iomem *reg = s5p_timer_reg();
>> -
>> -	if (!reg)
>> -		return 0;
>> -
>> -	return ~__raw_readl(reg);
>> -}
>> -
>> -static void __init s5p_clocksource_init(void)
>> -{
>> -	unsigned long pclk;
>> -	unsigned long clock_rate;
>> -
>> -	pclk = clk_get_rate(timerclk);
>> -
>> -	clk_set_rate(tdiv_source, pclk / 2);
>> -	clk_set_parent(tin_source, tdiv_source);
>> -
>> -	clock_rate = clk_get_rate(tin_source);
>> -
>> -	s5p_time_setup(timer_source.source_id, TCNT_MAX);
>> -	s5p_time_start(timer_source.source_id, PERIODIC);
>> -
>> -	setup_sched_clock(s5p_read_sched_clock, 32, clock_rate);
>> -
>> -	if (clocksource_mmio_init(s5p_timer_reg(), "s5p_clocksource_timer",
>> -			clock_rate, 250, 32, clocksource_mmio_readl_down))
>> -		panic("s5p_clocksource_timer: can't register clocksource\n");
>> -}
>> -
>> -static void __init s5p_timer_resources(void)
>> -{
>> -
>> -	unsigned long event_id = timer_source.event_id;
>> -	unsigned long source_id = timer_source.source_id;
>> -	char devname[15];
>> -
>> -	timerclk = clk_get(NULL, "timers");
>> -	if (IS_ERR(timerclk))
>> -		panic("failed to get timers clock for timer");
>> -
>> -	clk_enable(timerclk);
>> -
>> -	sprintf(devname, "s3c24xx-pwm.%lu", event_id);
>> -	s3c_device_timer[event_id].id = event_id;
>> -	s3c_device_timer[event_id].dev.init_name = devname;
>> -
>> -	tin_event = clk_get(&s3c_device_timer[event_id].dev, "pwm-tin");
>> -	if (IS_ERR(tin_event))
>> -		panic("failed to get pwm-tin clock for event timer");
>> -
>> -	tdiv_event = clk_get(&s3c_device_timer[event_id].dev, "pwm-tdiv");
>> -	if (IS_ERR(tdiv_event))
>> -		panic("failed to get pwm-tdiv clock for event timer");
>> -
>> -	clk_enable(tin_event);
>> -
>> -	sprintf(devname, "s3c24xx-pwm.%lu", source_id);
>> -	s3c_device_timer[source_id].id = source_id;
>> -	s3c_device_timer[source_id].dev.init_name = devname;
>> -
>> -	tin_source = clk_get(&s3c_device_timer[source_id].dev, "pwm-tin");
>> -	if (IS_ERR(tin_source))
>> -		panic("failed to get pwm-tin clock for source timer");
>> -
>> -	tdiv_source = clk_get(&s3c_device_timer[source_id].dev, "pwm-tdiv");
>> -	if (IS_ERR(tdiv_source))
>> -		panic("failed to get pwm-tdiv clock for source timer");
>> -
>> -	clk_enable(tin_source);
>> -}
>> -
>> -static void __init s5p_timer_init(void)
>> -{
>> -	s5p_timer_resources();
>> -	s5p_clockevent_init();
>> -	s5p_clocksource_init();
>> -}
>> -
>> -struct sys_timer s5p_timer = {
>> -	.init		= s5p_timer_init,
>> -};
>> diff --git a/arch/arm/plat-samsung/samsung-time.c
>> b/arch/arm/plat-samsung/samsung-time.c new file mode 100644
>> index 0000000..91773bf
>> --- /dev/null
>> +++ b/arch/arm/plat-samsung/samsung-time.c
>> @@ -0,0 +1,405 @@
>> +/*
>> + * Copyright (c) 2011 Samsung Electronics Co., Ltd.
>> + *		http://www.samsung.com/
>> + *
>> + * SAMSUNG - Common hr-timer support
>> + *
>> + * This program is free software; you can redistribute it and/or modify
>> + * it under the terms of the GNU General Public License version 2 as
>> + * published by the Free Software Foundation.
>> +*/
>> +
>> +#include <linux/interrupt.h>
>> +#include <linux/irq.h>
>> +#include <linux/err.h>
>> +#include <linux/clk.h>
>> +#include <linux/clockchips.h>
>> +#include <linux/platform_device.h>
>> +
>> +#include <asm/smp_twd.h>
>> +#include <asm/mach/time.h>
>> +#include <asm/mach/arch.h>
>> +#include <asm/mach/map.h>
>> +#include <asm/sched_clock.h>
>> +
>> +#include <mach/map.h>
>> +#include <plat/devs.h>
>> +#include <plat/regs-timer.h>
>> +#include <plat/samsung-time.h>
>> +
>> +static struct clk *tin_event;
>> +static struct clk *tin_source;
>> +static struct clk *tdiv_event;
>> +static struct clk *tdiv_source;
>> +static struct clk *timerclk;
>> +static struct samsung_timer_source timer_source;
>> +static unsigned long clock_count_per_tick;
>> +static void samsung_timer_resume(void);
>> +
>> +static void samsung_time_stop(enum samsung_timer_mode mode)
>> +{
>> +	unsigned long tcon;
>> +
>> +	tcon = __raw_readl(S3C2410_TCON);
>> +
>> +	switch (mode) {
>> +	case SAMSUNG_PWM0:
>> +		tcon &= ~S3C2410_TCON_T0START;
>> +		break;
>> +
>> +	case SAMSUNG_PWM1:
>> +		tcon &= ~S3C2410_TCON_T1START;
>> +		break;
>> +
>> +	case SAMSUNG_PWM2:
>> +		tcon &= ~S3C2410_TCON_T2START;
>> +		break;
>> +
>> +	case SAMSUNG_PWM3:
>> +		tcon &= ~S3C2410_TCON_T3START;
>> +		break;
>> +
>> +	case SAMSUNG_PWM4:
>> +		tcon &= ~S3C2410_TCON_T4START;
>> +		break;
>> +
>> +	default:
>> +		printk(KERN_ERR "Invalid Timer %d\n", mode);
>> +		break;
>> +	}
>> +	__raw_writel(tcon, S3C2410_TCON);
>> +}
>> +
>> +static void samsung_time_setup(enum samsung_timer_mode mode, unsigned long
>> tcnt) +{
>> +	unsigned long tcon;
>> +
>> +	tcon = __raw_readl(S3C2410_TCON);
>> +
>> +	tcnt--;
>> +
>> +	switch (mode) {
>> +	case SAMSUNG_PWM0:
>> +		tcon &= ~(0x0f << 0);
>> +		tcon |= S3C2410_TCON_T0MANUALUPD;
>> +		break;
>> +
>> +	case SAMSUNG_PWM1:
>> +		tcon &= ~(0x0f << 8);
>> +		tcon |= S3C2410_TCON_T1MANUALUPD;
>> +		break;
>> +
>> +	case SAMSUNG_PWM2:
>> +		tcon &= ~(0x0f << 12);
>> +		tcon |= S3C2410_TCON_T2MANUALUPD;
>> +		break;
>> +
>> +	case SAMSUNG_PWM3:
>> +		tcon &= ~(0x0f << 16);
>> +		tcon |= S3C2410_TCON_T3MANUALUPD;
>> +		break;
>> +
>> +	case SAMSUNG_PWM4:
>> +		tcon &= ~(0x07 << 20);
>> +		tcon |= S3C2410_TCON_T4MANUALUPD;
>> +		break;
>> +
>> +	default:
>> +		printk(KERN_ERR "Invalid Timer %d\n", mode);
>> +		break;
>> +	}
>> +
>> +	__raw_writel(tcnt, S3C2410_TCNTB(mode));
>> +	__raw_writel(tcnt, S3C2410_TCMPB(mode));
>> +	__raw_writel(tcon, S3C2410_TCON);
>> +}
>> +
>> +static void samsung_time_start(enum samsung_timer_mode mode, bool
>> periodic) +{
>> +	unsigned long tcon;
>> +
>> +	tcon  = __raw_readl(S3C2410_TCON);
>> +
>> +	switch (mode) {
>> +	case SAMSUNG_PWM0:
>> +		tcon |= S3C2410_TCON_T0START;
>> +		tcon &= ~S3C2410_TCON_T0MANUALUPD;
>> +
>> +		if (periodic)
>> +			tcon |= S3C2410_TCON_T0RELOAD;
>> +		else
>> +			tcon &= ~S3C2410_TCON_T0RELOAD;
>> +		break;
>> +
>> +	case SAMSUNG_PWM1:
>> +		tcon |= S3C2410_TCON_T1START;
>> +		tcon &= ~S3C2410_TCON_T1MANUALUPD;
>> +
>> +		if (periodic)
>> +			tcon |= S3C2410_TCON_T1RELOAD;
>> +		else
>> +			tcon &= ~S3C2410_TCON_T1RELOAD;
>> +		break;
>> +
>> +	case SAMSUNG_PWM2:
>> +		tcon |= S3C2410_TCON_T2START;
>> +		tcon &= ~S3C2410_TCON_T2MANUALUPD;
>> +
>> +		if (periodic)
>> +			tcon |= S3C2410_TCON_T2RELOAD;
>> +		else
>> +			tcon &= ~S3C2410_TCON_T2RELOAD;
>> +		break;
>> +
>> +	case SAMSUNG_PWM3:
>> +		tcon |= S3C2410_TCON_T3START;
>> +		tcon &= ~S3C2410_TCON_T3MANUALUPD;
>> +
>> +		if (periodic)
>> +			tcon |= S3C2410_TCON_T3RELOAD;
>> +		else
>> +			tcon &= ~S3C2410_TCON_T3RELOAD;
>> +		break;
>> +
>> +	case SAMSUNG_PWM4:
>> +		tcon |= S3C2410_TCON_T4START;
>> +		tcon &= ~S3C2410_TCON_T4MANUALUPD;
>> +
>> +		if (periodic)
>> +			tcon |= S3C2410_TCON_T4RELOAD;
>> +		else
>> +			tcon &= ~S3C2410_TCON_T4RELOAD;
>> +		break;
>> +
>> +	default:
>> +		printk(KERN_ERR "Invalid Timer %d\n", mode);
>> +		break;
>> +	}
>> +	__raw_writel(tcon, S3C2410_TCON);
>> +}
>> +
>> +static int samsung_set_next_event(unsigned long cycles,
>> +				struct clock_event_device *evt)
>> +{
>> +	samsung_time_setup(timer_source.event_id, cycles);
>> +	samsung_time_start(timer_source.event_id, NON_PERIODIC);
>> +
>> +	return 0;
>> +}
>> +
>> +static void samsung_set_mode(enum clock_event_mode mode,
>> +				struct clock_event_device *evt)
>> +{
>> +	samsung_time_stop(timer_source.event_id);
>> +
>> +	switch (mode) {
>> +	case CLOCK_EVT_MODE_PERIODIC:
>> +		samsung_time_setup(timer_source.event_id, clock_count_per_tick);
>> +		samsung_time_start(timer_source.event_id, PERIODIC);
>> +		break;
>> +
>> +	case CLOCK_EVT_MODE_ONESHOT:
>> +		break;
>> +
>> +	case CLOCK_EVT_MODE_UNUSED:
>> +	case CLOCK_EVT_MODE_SHUTDOWN:
>> +		break;
>> +
>> +	case CLOCK_EVT_MODE_RESUME:
>> +		samsung_timer_resume();
>> +		break;
>> +	}
>> +}
>> +
>> +static void samsung_timer_resume(void)
>> +{
>> +	/* event timer restart */
>> +	samsung_time_setup(timer_source.event_id, clock_count_per_tick);
>> +	samsung_time_start(timer_source.event_id, PERIODIC);
>> +
>> +	/* source timer restart */
>> +	samsung_time_setup(timer_source.source_id, TCNT_MAX);
>> +	samsung_time_start(timer_source.source_id, PERIODIC);
>> +}
>> +
>> +void __init samsung_set_timer_source(enum samsung_timer_mode event,
>> +				 enum samsung_timer_mode source)
>> +{
>> +	s3c_device_timer[event].dev.bus = &platform_bus_type;
>> +	s3c_device_timer[source].dev.bus = &platform_bus_type;
>> +
>> +	timer_source.event_id = event;
>> +	timer_source.source_id = source;
>> +}
>> +
>> +static struct clock_event_device time_event_device = {
>> +	.name		= "samsung_event_timer",
>> +	.features	= CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT,
>> +	.rating		= 200,
>> +	.set_next_event	= samsung_set_next_event,
>> +	.set_mode	= samsung_set_mode,
>> +};
>> +
>> +static irqreturn_t samsung_clock_event_isr(int irq, void *dev_id)
>> +{
>> +	struct clock_event_device *evt = dev_id;
>> +
>> +	evt->event_handler(evt);
>> +
>> +	return IRQ_HANDLED;
>> +}
>> +
>> +static struct irqaction samsung_clock_event_irq = {
>> +	.name		= "samsung_time_irq",
>> +	.flags		= IRQF_DISABLED | IRQF_TIMER | IRQF_IRQPOLL,
>> +	.handler	= samsung_clock_event_isr,
>> +	.dev_id		= &time_event_device,
>> +};
>> +
>> +static void __init samsung_clockevent_init(void)
>> +{
>> +	unsigned long pclk;
>> +	unsigned long clock_rate;
>> +	unsigned int irq_number;
>> +	struct clk *tscaler;
>> +
>> +	pclk = clk_get_rate(timerclk);
>> +
>> +	tscaler = clk_get_parent(tdiv_event);
>> +
>> +	clk_set_rate(tscaler, pclk / 2);
>> +	clk_set_rate(tdiv_event, pclk / 2);
>> +	clk_set_parent(tin_event, tdiv_event);
>> +
>> +	clock_rate = clk_get_rate(tin_event);
>> +	clock_count_per_tick = clock_rate / HZ;
>> +
>> +	clockevents_calc_mult_shift(&time_event_device,
>> +				    clock_rate, SAMSUNG_TIMER_MIN_RANGE);
>> +	time_event_device.max_delta_ns =
>> +		clockevent_delta2ns(-1, &time_event_device);
>> +	time_event_device.min_delta_ns =
>> +		clockevent_delta2ns(1, &time_event_device);
>> +
>> +	time_event_device.cpumask = cpumask_of(0);
>> +	clockevents_register_device(&time_event_device);
>> +
>> +	irq_number = timer_source.event_id + IRQ_TIMER0;
>> +	setup_irq(irq_number, &samsung_clock_event_irq);
>> +}
>> +
>> +static void __iomem *samsung_timer_reg(void)
>> +{
>> +	unsigned long offset = 0;
>> +
>> +	switch (timer_source.source_id) {
>> +	case SAMSUNG_PWM0:
>> +	case SAMSUNG_PWM1:
>> +	case SAMSUNG_PWM2:
>> +	case SAMSUNG_PWM3:
>> +		offset = (timer_source.source_id * 0x0c) + 0x14;
>> +		break;
>> +
>> +	case SAMSUNG_PWM4:
>> +		offset = 0x40;
>> +		break;
>> +
>> +	default:
>> +		printk(KERN_ERR "Invalid Timer %d\n", timer_source.source_id);
>> +		return NULL;
>> +	}
>> +
>> +	return S3C_TIMERREG(offset);
>> +}
>> +
>> +/*
>> + * Override the global weak sched_clock symbol with this
>> + * local implementation which uses the clocksource to get some
>> + * better resolution when scheduling the kernel. We accept that
>> + * this wraps around for now, since it is just a relative time
>> + * stamp. (Inspired by U300 implementation.)
>> + */
>> +static u32 notrace samsung_read_sched_clock(void)
>> +{
>> +	void __iomem *reg = samsung_timer_reg();
>> +
>> +	if (!reg)
>> +		return 0;
>> +
>> +	return ~__raw_readl(reg);
>> +}
>> +
>> +static void __init samsung_clocksource_init(void)
>> +{
>> +	unsigned long pclk;
>> +	unsigned long clock_rate;
>> +
>> +	pclk = clk_get_rate(timerclk);
>> +
>> +	clk_set_rate(tdiv_source, pclk / 2);
>> +	clk_set_parent(tin_source, tdiv_source);
>> +
>> +	clock_rate = clk_get_rate(tin_source);
>> +
>> +	samsung_time_setup(timer_source.source_id, TCNT_MAX);
>> +	samsung_time_start(timer_source.source_id, PERIODIC);
>> +
>> +	setup_sched_clock(samsung_read_sched_clock, 32, clock_rate);
>> +
>> +	if (clocksource_mmio_init(samsung_timer_reg(),
>> "samsung_clocksource_timer", +			clock_rate, 250, 32,
>> clocksource_mmio_readl_down))
>> +		panic("samsung_clocksource_timer: can't register clocksource\n");
>> +}
>> +
>> +static void __init samsung_timer_resources(void)
>> +{
>> +
>> +	unsigned long event_id = timer_source.event_id;
>> +	unsigned long source_id = timer_source.source_id;
>> +	char devname[15];
>> +
>> +	timerclk = clk_get(NULL, "timers");
>> +	if (IS_ERR(timerclk))
>> +		panic("failed to get timers clock for timer");
>> +
>> +	clk_enable(timerclk);
>> +
>> +	sprintf(devname, "s3c24xx-pwm.%lu", event_id);
>> +	s3c_device_timer[event_id].id = event_id;
>> +	s3c_device_timer[event_id].dev.init_name = devname;
>> +
>> +	tin_event = clk_get(&s3c_device_timer[event_id].dev, "pwm-tin");
>> +	if (IS_ERR(tin_event))
>> +		panic("failed to get pwm-tin clock for event timer");
>> +
>> +	tdiv_event = clk_get(&s3c_device_timer[event_id].dev, "pwm-tdiv");
>> +	if (IS_ERR(tdiv_event))
>> +		panic("failed to get pwm-tdiv clock for event timer");
>> +
>> +	clk_enable(tin_event);
>> +
>> +	sprintf(devname, "s3c24xx-pwm.%lu", source_id);
>> +	s3c_device_timer[source_id].id = source_id;
>> +	s3c_device_timer[source_id].dev.init_name = devname;
>> +
>> +	tin_source = clk_get(&s3c_device_timer[source_id].dev, "pwm-tin");
>> +	if (IS_ERR(tin_source))
>> +		panic("failed to get pwm-tin clock for source timer");
>> +
>> +	tdiv_source = clk_get(&s3c_device_timer[source_id].dev, "pwm-tdiv");
>> +	if (IS_ERR(tdiv_source))
>> +		panic("failed to get pwm-tdiv clock for source timer");
>> +
>> +	clk_enable(tin_source);
>> +}
>> +
>> +static void __init samsung_timer_init(void)
>> +{
>> +	samsung_timer_resources();
>> +	samsung_clockevent_init();
>> +	samsung_clocksource_init();
>> +}
>> +
>> +struct sys_timer samsung_timer = {
>> +	.init		= samsung_timer_init,
>> +};
> 

^ permalink raw reply	[flat|nested] 39+ messages in thread

* Re: [PATCH 1/3] Rename s5p-time to samsung-time
  2012-11-29 23:18             ` Romain Naour
@ 2012-11-29 23:59               ` Heiko Stübner
  2012-12-02 19:43               ` [PATCH 0/5 v2] S3C / S5PC100: add clockevent/clocksource support Romain Naour
  1 sibling, 0 replies; 39+ messages in thread
From: Heiko Stübner @ 2012-11-29 23:59 UTC (permalink / raw)
  To: Romain Naour
  Cc: tomasz.figa, Kukjin Kim, linux-samsung-soc, ben-linux,
	'Sylwester Nawrocki'

Hi Romain,

Am Freitag, 30. November 2012, 00:18:08 schrieb Romain Naour:
> Hi Heiko,
> 
> Le 28/11/2012 00:57, Heiko Stübner a écrit :
> > Hi Romain,
> > 
> > Am Mittwoch, 28. November 2012, 00:27:36 schrieb Romain Naour:
> >> Hi Tomasz, Kgene
> >> 
> >>> I would also suggest splitting this huge patch into a series of several
> >>> smaller, possibly:
> >>> 1) Rename s5p-time to samsung-time (and correct any platforms using it
> >>> currently)
> >>> 2) Add samsung-time support for s3c24xx
> >>> 3) Add samsung-time support for s3c64xx
> >>> 
> >>> What do you think?
> >>> 
> >>> Best regards,
> >>> Tomasz Figa
> >> 
> >> I have separated the patch into three parts, as you said.
> >> And also, I corrected some oversights ;-)
> >> 
> >> These patches are for 3.7-rc6.
> > 
> >> Here is the first one:
> > Comments like this should either be in the comment section (below the
> > three dashes) or in a cover-letter (git format-patch --cover-letter),
> > but not in the commit message of the patch itself.
> 
> Thank you for your advice :)
> 
> > Otherwise the patches look very cool. Hopefully I'll find a bit of time
> > to test them tomorrow.
> 
> On which processor can you test these patches ?

A S3C2416. It should just work, but I'm very curious to see a tick-less kernel 
on it ;-)

> > But I do have some quick comments:
> > 
> > What happens to s3c24xx_timer? It seems you changed every user of it but
> > did not remove the old timer code. Might be interesting as a 4th patch,
> > or is it still used somewhere?
> 
> s3c24xx_timer is still used by s5pc100 CPUs.
> That's why I didn't remove plat-samsung/time.c
> I do not have the datasheet, but s5pc100 timers seem to be similar to
> s3c24xx timers. (16bis) Can someone test on a processor s5pc100 ?
> 
> > Please use the -M option to "git format-patch" which minimizes the impact
> > of moved files in the patch itself.
> 
> Do you want I resends these patches, plus one for s5pc100 ?

That might be helpful. Especially to get tests on the s5pc100. If you provide 
a test-ready patch, chances are a lot higher someone finds the time to test 
it.

So, as you wrote you could resend the series with
- the three original patches
- a 4th converting s5pc100
- a 5th removing the then unused s3c24xx-timer


Heiko

> > Thanks for doing this change
> > Heiko
> 
> Thank you for your comments :)
> Romain
> 
> >> This patch rename s5p-time to samsung-time.
> >> There is no functional change.
> >> 
> >> Signed-off-by: Naour Romain <romain.naour@openwide.fr>
> >> ---
> >> 
> >>  arch/arm/mach-exynos/Kconfig                      |   2 +-
> >>  arch/arm/mach-exynos/mach-universal_c210.c        |   6 +-
> >>  arch/arm/mach-s5p64x0/Kconfig                     |   4 +-
> >>  arch/arm/mach-s5p64x0/mach-smdk6440.c             |   6 +-
> >>  arch/arm/mach-s5p64x0/mach-smdk6450.c             |   6 +-
> >>  arch/arm/mach-s5pv210/Kconfig                     |   2 +-
> >>  arch/arm/mach-s5pv210/mach-aquila.c               |   6 +-
> >>  arch/arm/mach-s5pv210/mach-goni.c                 |   6 +-
> >>  arch/arm/mach-s5pv210/mach-smdkc110.c             |   6 +-
> >>  arch/arm/mach-s5pv210/mach-smdkv210.c             |   6 +-
> >>  arch/arm/mach-s5pv210/mach-torbreck.c             |   6 +-
> >>  arch/arm/plat-samsung/Kconfig                     |   2 +-
> >>  arch/arm/plat-samsung/Makefile                    |   2 +-
> >>  arch/arm/plat-samsung/include/plat/s5p-time.h     |  40 ---
> >>  arch/arm/plat-samsung/include/plat/samsung-time.h |  40 +++
> >>  arch/arm/plat-samsung/s5p-time.c                  | 405
> >> 
> >> ---------------------- arch/arm/plat-samsung/samsung-time.c             
> >> | 405 ++++++++++++++++++++++ 17 files changed, 475 insertions(+), 475
> >> deletions(-)
> >> 
> >>  delete mode 100644 arch/arm/plat-samsung/include/plat/s5p-time.h
> >>  create mode 100644 arch/arm/plat-samsung/include/plat/samsung-time.h
> >>  delete mode 100644 arch/arm/plat-samsung/s5p-time.c
> >>  create mode 100644 arch/arm/plat-samsung/samsung-time.c
> >> 
> >> diff --git a/arch/arm/mach-exynos/Kconfig b/arch/arm/mach-exynos/Kconfig
> >> index da55107..20edfa3 100644
> >> --- a/arch/arm/mach-exynos/Kconfig
> >> +++ b/arch/arm/mach-exynos/Kconfig
> >> @@ -274,7 +274,7 @@ config MACH_UNIVERSAL_C210
> >> 
> >>  	select S5P_DEV_ONENAND
> >>  	select S5P_DEV_TV
> >>  	select S5P_GPIO_INT
> >> 
> >> -	select S5P_HRT
> >> +	select SAMSUNG_HRT
> >> 
> >>  	select S5P_SETUP_MIPIPHY
> >>  	help
> >>  	
> >>  	  Machine support for Samsung Mobile Universal S5PC210 Reference
> >> 
> >> diff --git a/arch/arm/mach-exynos/mach-universal_c210.c
> >> b/arch/arm/mach-exynos/mach-universal_c210.c index ebc9dd3..325bfe9
> >> 100644 --- a/arch/arm/mach-exynos/mach-universal_c210.c
> >> +++ b/arch/arm/mach-exynos/mach-universal_c210.c
> >> @@ -41,7 +41,7 @@
> >> 
> >>  #include <plat/mfc.h>
> >>  #include <plat/sdhci.h>
> >>  #include <plat/fimc-core.h>
> >> 
> >> -#include <plat/s5p-time.h>
> >> +#include <plat/samsung-time.h>
> >> 
> >>  #include <plat/camport.h>
> >>  #include <linux/platform_data/mipi-csis.h>
> >> 
> >> @@ -1099,7 +1099,7 @@ static void __init universal_map_io(void)
> >> 
> >>  	exynos_init_io(NULL, 0);
> >>  	s3c24xx_init_clocks(clk_xusbxti.rate);
> >>  	s3c24xx_init_uarts(universal_uartcfgs,
> >>  	ARRAY_SIZE(universal_uartcfgs));
> >> 
> >> -	s5p_set_timer_source(S5P_PWM2, S5P_PWM4);
> >> +	samsung_set_timer_source(SAMSUNG_PWM2, SAMSUNG_PWM4);
> >> 
> >>  }
> >>  
> >>  static void s5p_tv_setup(void)
> >> 
> >> @@ -1158,7 +1158,7 @@ MACHINE_START(UNIVERSAL_C210, "UNIVERSAL_C210")
> >> 
> >>  	.handle_irq	= gic_handle_irq,
> >>  	.init_machine	= universal_machine_init,
> >>  	.init_late	= exynos_init_late,
> >> 
> >> -	.timer		= &s5p_timer,
> >> +	.timer		= &samsung_timer,
> >> 
> >>  	.reserve        = &universal_reserve,
> >>  	.restart	= exynos4_restart,
> >>  
> >>  MACHINE_END
> >> 
> >> diff --git a/arch/arm/mach-s5p64x0/Kconfig
> >> b/arch/arm/mach-s5p64x0/Kconfig index e8742cb..f0ec535 100644
> >> --- a/arch/arm/mach-s5p64x0/Kconfig
> >> +++ b/arch/arm/mach-s5p64x0/Kconfig
> >> @@ -9,7 +9,7 @@ if ARCH_S5P64X0
> >> 
> >>  config CPU_S5P6440
> >>  
> >>  	bool
> >> 
> >> -	select S5P_HRT
> >> +	select SAMSUNG_HRT
> >> 
> >>  	select S5P_SLEEP if PM
> >>  	select SAMSUNG_DMADEV
> >>  	select SAMSUNG_WAKEMASK if PM
> >> 
> >> @@ -18,7 +18,7 @@ config CPU_S5P6440
> >> 
> >>  config CPU_S5P6450
> >>  
> >>  	bool
> >> 
> >> -	select S5P_HRT
> >> +	select SAMSUNG_HRT
> >> 
> >>  	select S5P_SLEEP if PM
> >>  	select SAMSUNG_DMADEV
> >>  	select SAMSUNG_WAKEMASK if PM
> >> 
> >> diff --git a/arch/arm/mach-s5p64x0/mach-smdk6440.c
> >> b/arch/arm/mach-s5p64x0/mach-smdk6440.c index 96ea1fe..587fec5 100644
> >> --- a/arch/arm/mach-s5p64x0/mach-smdk6440.c
> >> +++ b/arch/arm/mach-s5p64x0/mach-smdk6440.c
> >> @@ -50,7 +50,7 @@
> >> 
> >>  #include <plat/pll.h>
> >>  #include <plat/adc.h>
> >>  #include <linux/platform_data/touchscreen-s3c2410.h>
> >> 
> >> -#include <plat/s5p-time.h>
> >> +#include <plat/samsung-time.h>
> >> 
> >>  #include <plat/backlight.h>
> >>  #include <plat/fb.h>
> >>  #include <plat/sdhci.h>
> >> 
> >> @@ -231,7 +231,7 @@ static void __init smdk6440_map_io(void)
> >> 
> >>  	s5p64x0_init_io(NULL, 0);
> >>  	s3c24xx_init_clocks(12000000);
> >>  	s3c24xx_init_uarts(smdk6440_uartcfgs, ARRAY_SIZE(smdk6440_uartcfgs));
> >> 
> >> -	s5p_set_timer_source(S5P_PWM3, S5P_PWM4);
> >> +	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
> >> 
> >>  }
> >>  
> >>  static void s5p6440_set_lcd_interface(void)
> >> 
> >> @@ -276,6 +276,6 @@ MACHINE_START(SMDK6440, "SMDK6440")
> >> 
> >>  	.handle_irq	= vic_handle_irq,
> >>  	.map_io		= smdk6440_map_io,
> >>  	.init_machine	= smdk6440_machine_init,
> >> 
> >> -	.timer		= &s5p_timer,
> >> +	.timer		= &samsung_timer,
> >> 
> >>  	.restart	= s5p64x0_restart,
> >>  
> >>  MACHINE_END
> >> 
> >> diff --git a/arch/arm/mach-s5p64x0/mach-smdk6450.c
> >> b/arch/arm/mach-s5p64x0/mach-smdk6450.c index 12748b6..714cd8a 100644
> >> --- a/arch/arm/mach-s5p64x0/mach-smdk6450.c
> >> +++ b/arch/arm/mach-s5p64x0/mach-smdk6450.c
> >> @@ -50,7 +50,7 @@
> >> 
> >>  #include <plat/pll.h>
> >>  #include <plat/adc.h>
> >>  #include <linux/platform_data/touchscreen-s3c2410.h>
> >> 
> >> -#include <plat/s5p-time.h>
> >> +#include <plat/samsung-time.h>
> >> 
> >>  #include <plat/backlight.h>
> >>  #include <plat/fb.h>
> >>  #include <plat/sdhci.h>
> >> 
> >> @@ -250,7 +250,7 @@ static void __init smdk6450_map_io(void)
> >> 
> >>  	s5p64x0_init_io(NULL, 0);
> >>  	s3c24xx_init_clocks(19200000);
> >>  	s3c24xx_init_uarts(smdk6450_uartcfgs, ARRAY_SIZE(smdk6450_uartcfgs));
> >> 
> >> -	s5p_set_timer_source(S5P_PWM3, S5P_PWM4);
> >> +	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
> >> 
> >>  }
> >>  
> >>  static void s5p6450_set_lcd_interface(void)
> >> 
> >> @@ -295,6 +295,6 @@ MACHINE_START(SMDK6450, "SMDK6450")
> >> 
> >>  	.handle_irq	= vic_handle_irq,
> >>  	.map_io		= smdk6450_map_io,
> >>  	.init_machine	= smdk6450_machine_init,
> >> 
> >> -	.timer		= &s5p_timer,
> >> +	.timer		= &samsung_timer,
> >> 
> >>  	.restart	= s5p64x0_restart,
> >>  
> >>  MACHINE_END
> >> 
> >> diff --git a/arch/arm/mach-s5pv210/Kconfig
> >> b/arch/arm/mach-s5pv210/Kconfig index 92ad72f..01018ef 100644
> >> --- a/arch/arm/mach-s5pv210/Kconfig
> >> +++ b/arch/arm/mach-s5pv210/Kconfig
> >> @@ -12,7 +12,7 @@ if ARCH_S5PV210
> >> 
> >>  config CPU_S5PV210
> >>  
> >>  	bool
> >>  	select S5P_EXT_INT
> >> 
> >> -	select S5P_HRT
> >> +	select SAMSUNG_HRT
> >> 
> >>  	select S5P_PM if PM
> >>  	select S5P_SLEEP if PM
> >>  	select SAMSUNG_DMADEV
> >> 
> >> diff --git a/arch/arm/mach-s5pv210/mach-aquila.c
> >> b/arch/arm/mach-s5pv210/mach-aquila.c index ee9fa5c..7c7d89b 100644
> >> --- a/arch/arm/mach-s5pv210/mach-aquila.c
> >> +++ b/arch/arm/mach-s5pv210/mach-aquila.c
> >> @@ -39,7 +39,7 @@
> >> 
> >>  #include <plat/fb.h>
> >>  #include <plat/fimc-core.h>
> >>  #include <plat/sdhci.h>
> >> 
> >> -#include <plat/s5p-time.h>
> >> +#include <plat/samsung-time.h>
> >> 
> >>  #include "common.h"
> >> 
> >> @@ -652,7 +652,7 @@ static void __init aquila_map_io(void)
> >> 
> >>  	s5pv210_init_io(NULL, 0);
> >>  	s3c24xx_init_clocks(24000000);
> >>  	s3c24xx_init_uarts(aquila_uartcfgs, ARRAY_SIZE(aquila_uartcfgs));
> >> 
> >> -	s5p_set_timer_source(S5P_PWM3, S5P_PWM4);
> >> +	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
> >> 
> >>  }
> >>  
> >>  static void __init aquila_machine_init(void)
> >> 
> >> @@ -688,6 +688,6 @@ MACHINE_START(AQUILA, "Aquila")
> >> 
> >>  	.handle_irq	= vic_handle_irq,
> >>  	.map_io		= aquila_map_io,
> >>  	.init_machine	= aquila_machine_init,
> >> 
> >> -	.timer		= &s5p_timer,
> >> +	.timer		= &samsung_timer,
> >> 
> >>  	.restart	= s5pv210_restart,
> >>  
> >>  MACHINE_END
> >> 
> >> diff --git a/arch/arm/mach-s5pv210/mach-goni.c
> >> b/arch/arm/mach-s5pv210/mach-goni.c index 55e1dba..2740001 100644
> >> --- a/arch/arm/mach-s5pv210/mach-goni.c
> >> +++ b/arch/arm/mach-s5pv210/mach-goni.c
> >> @@ -48,7 +48,7 @@
> >> 
> >>  #include <plat/keypad.h>
> >>  #include <plat/sdhci.h>
> >>  #include <plat/clock.h>
> >> 
> >> -#include <plat/s5p-time.h>
> >> +#include <plat/samsung-time.h>
> >> 
> >>  #include <plat/mfc.h>
> >>  #include <plat/camport.h>
> >> 
> >> @@ -910,7 +910,7 @@ static void __init goni_map_io(void)
> >> 
> >>  	s5pv210_init_io(NULL, 0);
> >>  	s3c24xx_init_clocks(clk_xusbxti.rate);
> >>  	s3c24xx_init_uarts(goni_uartcfgs, ARRAY_SIZE(goni_uartcfgs));
> >> 
> >> -	s5p_set_timer_source(S5P_PWM3, S5P_PWM4);
> >> +	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
> >> 
> >>  }
> >>  
> >>  static void __init goni_reserve(void)
> >> 
> >> @@ -976,7 +976,7 @@ MACHINE_START(GONI, "GONI")
> >> 
> >>  	.handle_irq	= vic_handle_irq,
> >>  	.map_io		= goni_map_io,
> >>  	.init_machine	= goni_machine_init,
> >> 
> >> -	.timer		= &s5p_timer,
> >> +	.timer		= &samsung_timer,
> >> 
> >>  	.reserve	= &goni_reserve,
> >>  	.restart	= s5pv210_restart,
> >>  
> >>  MACHINE_END
> >> 
> >> diff --git a/arch/arm/mach-s5pv210/mach-smdkc110.c
> >> b/arch/arm/mach-s5pv210/mach-smdkc110.c index d9c99fc..d2e93b7 100644
> >> --- a/arch/arm/mach-s5pv210/mach-smdkc110.c
> >> +++ b/arch/arm/mach-s5pv210/mach-smdkc110.c
> >> @@ -30,7 +30,7 @@
> >> 
> >>  #include <linux/platform_data/ata-samsung_cf.h>
> >>  #include <linux/platform_data/i2c-s3c2410.h>
> >>  #include <plat/pm.h>
> >> 
> >> -#include <plat/s5p-time.h>
> >> +#include <plat/samsung-time.h>
> >> 
> >>  #include <plat/mfc.h>
> >>  
> >>  #include "common.h"
> >> 
> >> @@ -122,7 +122,7 @@ static void __init smdkc110_map_io(void)
> >> 
> >>  	s5pv210_init_io(NULL, 0);
> >>  	s3c24xx_init_clocks(24000000);
> >>  	s3c24xx_init_uarts(smdkv210_uartcfgs, ARRAY_SIZE(smdkv210_uartcfgs));
> >> 
> >> -	s5p_set_timer_source(S5P_PWM3, S5P_PWM4);
> >> +	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
> >> 
> >>  }
> >>  
> >>  static void __init smdkc110_reserve(void)
> >> 
> >> @@ -156,7 +156,7 @@ MACHINE_START(SMDKC110, "SMDKC110")
> >> 
> >>  	.handle_irq	= vic_handle_irq,
> >>  	.map_io		= smdkc110_map_io,
> >>  	.init_machine	= smdkc110_machine_init,
> >> 
> >> -	.timer		= &s5p_timer,
> >> +	.timer		= &samsung_timer,
> >> 
> >>  	.restart	= s5pv210_restart,
> >>  	.reserve	= &smdkc110_reserve,
> >>  
> >>  MACHINE_END
> >> 
> >> diff --git a/arch/arm/mach-s5pv210/mach-smdkv210.c
> >> b/arch/arm/mach-s5pv210/mach-smdkv210.c index 4cdb5bb..cd28725 100644
> >> --- a/arch/arm/mach-s5pv210/mach-smdkv210.c
> >> +++ b/arch/arm/mach-s5pv210/mach-smdkv210.c
> >> @@ -45,7 +45,7 @@
> >> 
> >>  #include <plat/keypad.h>
> >>  #include <plat/pm.h>
> >>  #include <plat/fb.h>
> >> 
> >> -#include <plat/s5p-time.h>
> >> +#include <plat/samsung-time.h>
> >> 
> >>  #include <plat/backlight.h>
> >>  #include <plat/mfc.h>
> >>  #include <plat/clock.h>
> >> 
> >> @@ -287,7 +287,7 @@ static void __init smdkv210_map_io(void)
> >> 
> >>  	s5pv210_init_io(NULL, 0);
> >>  	s3c24xx_init_clocks(clk_xusbxti.rate);
> >>  	s3c24xx_init_uarts(smdkv210_uartcfgs, ARRAY_SIZE(smdkv210_uartcfgs));
> >> 
> >> -	s5p_set_timer_source(S5P_PWM2, S5P_PWM4);
> >> +	samsung_set_timer_source(SAMSUNG_PWM2, SAMSUNG_PWM4);
> >> 
> >>  }
> >>  
> >>  static void __init smdkv210_reserve(void)
> >> 
> >> @@ -332,7 +332,7 @@ MACHINE_START(SMDKV210, "SMDKV210")
> >> 
> >>  	.handle_irq	= vic_handle_irq,
> >>  	.map_io		= smdkv210_map_io,
> >>  	.init_machine	= smdkv210_machine_init,
> >> 
> >> -	.timer		= &s5p_timer,
> >> +	.timer		= &samsung_timer,
> >> 
> >>  	.restart	= s5pv210_restart,
> >>  	.reserve	= &smdkv210_reserve,
> >>  
> >>  MACHINE_END
> >> 
> >> diff --git a/arch/arm/mach-s5pv210/mach-torbreck.c
> >> b/arch/arm/mach-s5pv210/mach-torbreck.c index 18785cb..aec668c 100644
> >> --- a/arch/arm/mach-s5pv210/mach-torbreck.c
> >> +++ b/arch/arm/mach-s5pv210/mach-torbreck.c
> >> @@ -27,7 +27,7 @@
> >> 
> >>  #include <plat/devs.h>
> >>  #include <plat/cpu.h>
> >>  #include <linux/platform_data/i2c-s3c2410.h>
> >> 
> >> -#include <plat/s5p-time.h>
> >> +#include <plat/samsung-time.h>
> >> 
> >>  #include "common.h"
> >> 
> >> @@ -107,7 +107,7 @@ static void __init torbreck_map_io(void)
> >> 
> >>  	s5pv210_init_io(NULL, 0);
> >>  	s3c24xx_init_clocks(24000000);
> >>  	s3c24xx_init_uarts(torbreck_uartcfgs, ARRAY_SIZE(torbreck_uartcfgs));
> >> 
> >> -	s5p_set_timer_source(S5P_PWM3, S5P_PWM4);
> >> +	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
> >> 
> >>  }
> >>  
> >>  static void __init torbreck_machine_init(void)
> >> 
> >> @@ -132,6 +132,6 @@ MACHINE_START(TORBRECK, "TORBRECK")
> >> 
> >>  	.handle_irq	= vic_handle_irq,
> >>  	.map_io		= torbreck_map_io,
> >>  	.init_machine	= torbreck_machine_init,
> >> 
> >> -	.timer		= &s5p_timer,
> >> +	.timer		= &samsung_timer,
> >> 
> >>  	.restart	= s5pv210_restart,
> >>  
> >>  MACHINE_END
> >> 
> >> diff --git a/arch/arm/plat-samsung/Kconfig
> >> b/arch/arm/plat-samsung/Kconfig index 59401e1..5278795 100644
> >> --- a/arch/arm/plat-samsung/Kconfig
> >> +++ b/arch/arm/plat-samsung/Kconfig
> >> @@ -70,7 +70,7 @@ config S3C_LOWLEVEL_UART_PORT
> >> 
> >>  # timer options
> >> 
> >> -config S5P_HRT
> >> +config SAMSUNG_HRT
> >> 
> >>  	bool
> >>  	select SAMSUNG_DEV_PWM
> >>  	help
> >> 
> >> diff --git a/arch/arm/plat-samsung/Makefile
> >> b/arch/arm/plat-samsung/Makefile index 9e40e8d..06f2312 100644
> >> --- a/arch/arm/plat-samsung/Makefile
> >> +++ b/arch/arm/plat-samsung/Makefile
> >> @@ -13,7 +13,7 @@ obj-				:=
> >> 
> >>  obj-y				+= init.o cpu.o
> >>  obj-$(CONFIG_ARCH_USES_GETTIMEOFFSET)   += time.o
> >> 
> >> -obj-$(CONFIG_S5P_HRT) 		+= s5p-time.o
> >> +obj-$(CONFIG_SAMSUNG_HRT) 		+= samsung-time.o
> >> 
> >>  obj-$(CONFIG_SAMSUNG_CLOCK)	+= clock.o
> >>  obj-$(CONFIG_SAMSUNG_CLOCK)	+= pwm-clock.o
> >> 
> >> diff --git a/arch/arm/plat-samsung/include/plat/s5p-time.h
> >> b/arch/arm/plat-samsung/include/plat/s5p-time.h deleted file mode 100644
> >> index 3a70aeb..0000000
> >> --- a/arch/arm/plat-samsung/include/plat/s5p-time.h
> >> +++ /dev/null
> >> @@ -1,40 +0,0 @@
> >> -/* linux/arch/arm/plat-samsung/include/plat/s5p-time.h
> >> - *
> >> - * Copyright 2011 Samsung Electronics Co., Ltd.
> >> - *		http://www.samsung.com/
> >> - *
> >> - * Header file for s5p time support
> >> - *
> >> - * This program is free software; you can redistribute it and/or modify
> >> - * it under the terms of the GNU General Public License version 2 as
> >> - * published by the Free Software Foundation.
> >> -*/
> >> -
> >> -#ifndef __ASM_PLAT_S5P_TIME_H
> >> -#define __ASM_PLAT_S5P_TIME_H __FILE__
> >> -
> >> -/* S5P HR-Timer Clock mode */
> >> -enum s5p_timer_mode {
> >> -	S5P_PWM0,
> >> -	S5P_PWM1,
> >> -	S5P_PWM2,
> >> -	S5P_PWM3,
> >> -	S5P_PWM4,
> >> -};
> >> -
> >> -struct s5p_timer_source {
> >> -	unsigned int event_id;
> >> -	unsigned int source_id;
> >> -};
> >> -
> >> -/* Be able to sleep for atleast 4 seconds (usually more) */
> >> -#define S5PTIMER_MIN_RANGE	4
> >> -
> >> -#define TCNT_MAX		0xffffffff
> >> -#define NON_PERIODIC		0
> >> -#define PERIODIC		1
> >> -
> >> -extern void __init s5p_set_timer_source(enum s5p_timer_mode event,
> >> -					enum s5p_timer_mode source);
> >> -extern	struct sys_timer s5p_timer;
> >> -#endif /* __ASM_PLAT_S5P_TIME_H */
> >> diff --git a/arch/arm/plat-samsung/include/plat/samsung-time.h
> >> b/arch/arm/plat-samsung/include/plat/samsung-time.h new file mode 100644
> >> index 0000000..9d6d622
> >> --- /dev/null
> >> +++ b/arch/arm/plat-samsung/include/plat/samsung-time.h
> >> @@ -0,0 +1,40 @@
> >> +/* linux/arch/arm/plat-samsung/include/plat/samsung-time.h
> >> + *
> >> + * Copyright 2011 Samsung Electronics Co., Ltd.
> >> + *		http://www.samsung.com/
> >> + *
> >> + * Header file for samsung s3c and s5p time support
> >> + *
> >> + * This program is free software; you can redistribute it and/or modify
> >> + * it under the terms of the GNU General Public License version 2 as
> >> + * published by the Free Software Foundation.
> >> +*/
> >> +
> >> +#ifndef __ASM_PLAT_SAMSUNG_TIME_H
> >> +#define __ASM_PLAT_SAMSUNG_TIME_H __FILE__
> >> +
> >> +/* SAMSUNG HR-Timer Clock mode */
> >> +enum samsung_timer_mode {
> >> +	SAMSUNG_PWM0,
> >> +	SAMSUNG_PWM1,
> >> +	SAMSUNG_PWM2,
> >> +	SAMSUNG_PWM3,
> >> +	SAMSUNG_PWM4,
> >> +};
> >> +
> >> +struct samsung_timer_source {
> >> +	unsigned int event_id;
> >> +	unsigned int source_id;
> >> +};
> >> +
> >> +/* Be able to sleep for atleast 4 seconds (usually more) */
> >> +#define SAMSUNG_TIMER_MIN_RANGE	4
> >> +
> >> +#define TCNT_MAX		0xffffffff
> >> +#define NON_PERIODIC		0
> >> +#define PERIODIC		1
> >> +
> >> +extern void __init samsung_set_timer_source(enum samsung_timer_mode
> >> event, +					enum samsung_timer_mode source);
> >> +extern	struct sys_timer samsung_timer;
> >> +#endif /* __ASM_PLAT_SAMSUNG_TIME_H */
> >> diff --git a/arch/arm/plat-samsung/s5p-time.c
> >> b/arch/arm/plat-samsung/s5p-time.c deleted file mode 100644
> >> index 028b6e8..0000000
> >> --- a/arch/arm/plat-samsung/s5p-time.c
> >> +++ /dev/null
> >> @@ -1,405 +0,0 @@
> >> -/*
> >> - * Copyright (c) 2011 Samsung Electronics Co., Ltd.
> >> - *		http://www.samsung.com/
> >> - *
> >> - * S5P - Common hr-timer support
> >> - *
> >> - * This program is free software; you can redistribute it and/or modify
> >> - * it under the terms of the GNU General Public License version 2 as
> >> - * published by the Free Software Foundation.
> >> -*/
> >> -
> >> -#include <linux/interrupt.h>
> >> -#include <linux/irq.h>
> >> -#include <linux/err.h>
> >> -#include <linux/clk.h>
> >> -#include <linux/clockchips.h>
> >> -#include <linux/platform_device.h>
> >> -
> >> -#include <asm/smp_twd.h>
> >> -#include <asm/mach/time.h>
> >> -#include <asm/mach/arch.h>
> >> -#include <asm/mach/map.h>
> >> -#include <asm/sched_clock.h>
> >> -
> >> -#include <mach/map.h>
> >> -#include <plat/devs.h>
> >> -#include <plat/regs-timer.h>
> >> -#include <plat/s5p-time.h>
> >> -
> >> -static struct clk *tin_event;
> >> -static struct clk *tin_source;
> >> -static struct clk *tdiv_event;
> >> -static struct clk *tdiv_source;
> >> -static struct clk *timerclk;
> >> -static struct s5p_timer_source timer_source;
> >> -static unsigned long clock_count_per_tick;
> >> -static void s5p_timer_resume(void);
> >> -
> >> -static void s5p_time_stop(enum s5p_timer_mode mode)
> >> -{
> >> -	unsigned long tcon;
> >> -
> >> -	tcon = __raw_readl(S3C2410_TCON);
> >> -
> >> -	switch (mode) {
> >> -	case S5P_PWM0:
> >> -		tcon &= ~S3C2410_TCON_T0START;
> >> -		break;
> >> -
> >> -	case S5P_PWM1:
> >> -		tcon &= ~S3C2410_TCON_T1START;
> >> -		break;
> >> -
> >> -	case S5P_PWM2:
> >> -		tcon &= ~S3C2410_TCON_T2START;
> >> -		break;
> >> -
> >> -	case S5P_PWM3:
> >> -		tcon &= ~S3C2410_TCON_T3START;
> >> -		break;
> >> -
> >> -	case S5P_PWM4:
> >> -		tcon &= ~S3C2410_TCON_T4START;
> >> -		break;
> >> -
> >> -	default:
> >> -		printk(KERN_ERR "Invalid Timer %d\n", mode);
> >> -		break;
> >> -	}
> >> -	__raw_writel(tcon, S3C2410_TCON);
> >> -}
> >> -
> >> -static void s5p_time_setup(enum s5p_timer_mode mode, unsigned long
> >> tcnt) -{
> >> -	unsigned long tcon;
> >> -
> >> -	tcon = __raw_readl(S3C2410_TCON);
> >> -
> >> -	tcnt--;
> >> -
> >> -	switch (mode) {
> >> -	case S5P_PWM0:
> >> -		tcon &= ~(0x0f << 0);
> >> -		tcon |= S3C2410_TCON_T0MANUALUPD;
> >> -		break;
> >> -
> >> -	case S5P_PWM1:
> >> -		tcon &= ~(0x0f << 8);
> >> -		tcon |= S3C2410_TCON_T1MANUALUPD;
> >> -		break;
> >> -
> >> -	case S5P_PWM2:
> >> -		tcon &= ~(0x0f << 12);
> >> -		tcon |= S3C2410_TCON_T2MANUALUPD;
> >> -		break;
> >> -
> >> -	case S5P_PWM3:
> >> -		tcon &= ~(0x0f << 16);
> >> -		tcon |= S3C2410_TCON_T3MANUALUPD;
> >> -		break;
> >> -
> >> -	case S5P_PWM4:
> >> -		tcon &= ~(0x07 << 20);
> >> -		tcon |= S3C2410_TCON_T4MANUALUPD;
> >> -		break;
> >> -
> >> -	default:
> >> -		printk(KERN_ERR "Invalid Timer %d\n", mode);
> >> -		break;
> >> -	}
> >> -
> >> -	__raw_writel(tcnt, S3C2410_TCNTB(mode));
> >> -	__raw_writel(tcnt, S3C2410_TCMPB(mode));
> >> -	__raw_writel(tcon, S3C2410_TCON);
> >> -}
> >> -
> >> -static void s5p_time_start(enum s5p_timer_mode mode, bool periodic)
> >> -{
> >> -	unsigned long tcon;
> >> -
> >> -	tcon  = __raw_readl(S3C2410_TCON);
> >> -
> >> -	switch (mode) {
> >> -	case S5P_PWM0:
> >> -		tcon |= S3C2410_TCON_T0START;
> >> -		tcon &= ~S3C2410_TCON_T0MANUALUPD;
> >> -
> >> -		if (periodic)
> >> -			tcon |= S3C2410_TCON_T0RELOAD;
> >> -		else
> >> -			tcon &= ~S3C2410_TCON_T0RELOAD;
> >> -		break;
> >> -
> >> -	case S5P_PWM1:
> >> -		tcon |= S3C2410_TCON_T1START;
> >> -		tcon &= ~S3C2410_TCON_T1MANUALUPD;
> >> -
> >> -		if (periodic)
> >> -			tcon |= S3C2410_TCON_T1RELOAD;
> >> -		else
> >> -			tcon &= ~S3C2410_TCON_T1RELOAD;
> >> -		break;
> >> -
> >> -	case S5P_PWM2:
> >> -		tcon |= S3C2410_TCON_T2START;
> >> -		tcon &= ~S3C2410_TCON_T2MANUALUPD;
> >> -
> >> -		if (periodic)
> >> -			tcon |= S3C2410_TCON_T2RELOAD;
> >> -		else
> >> -			tcon &= ~S3C2410_TCON_T2RELOAD;
> >> -		break;
> >> -
> >> -	case S5P_PWM3:
> >> -		tcon |= S3C2410_TCON_T3START;
> >> -		tcon &= ~S3C2410_TCON_T3MANUALUPD;
> >> -
> >> -		if (periodic)
> >> -			tcon |= S3C2410_TCON_T3RELOAD;
> >> -		else
> >> -			tcon &= ~S3C2410_TCON_T3RELOAD;
> >> -		break;
> >> -
> >> -	case S5P_PWM4:
> >> -		tcon |= S3C2410_TCON_T4START;
> >> -		tcon &= ~S3C2410_TCON_T4MANUALUPD;
> >> -
> >> -		if (periodic)
> >> -			tcon |= S3C2410_TCON_T4RELOAD;
> >> -		else
> >> -			tcon &= ~S3C2410_TCON_T4RELOAD;
> >> -		break;
> >> -
> >> -	default:
> >> -		printk(KERN_ERR "Invalid Timer %d\n", mode);
> >> -		break;
> >> -	}
> >> -	__raw_writel(tcon, S3C2410_TCON);
> >> -}
> >> -
> >> -static int s5p_set_next_event(unsigned long cycles,
> >> -				struct clock_event_device *evt)
> >> -{
> >> -	s5p_time_setup(timer_source.event_id, cycles);
> >> -	s5p_time_start(timer_source.event_id, NON_PERIODIC);
> >> -
> >> -	return 0;
> >> -}
> >> -
> >> -static void s5p_set_mode(enum clock_event_mode mode,
> >> -				struct clock_event_device *evt)
> >> -{
> >> -	s5p_time_stop(timer_source.event_id);
> >> -
> >> -	switch (mode) {
> >> -	case CLOCK_EVT_MODE_PERIODIC:
> >> -		s5p_time_setup(timer_source.event_id, clock_count_per_tick);
> >> -		s5p_time_start(timer_source.event_id, PERIODIC);
> >> -		break;
> >> -
> >> -	case CLOCK_EVT_MODE_ONESHOT:
> >> -		break;
> >> -
> >> -	case CLOCK_EVT_MODE_UNUSED:
> >> -	case CLOCK_EVT_MODE_SHUTDOWN:
> >> -		break;
> >> -
> >> -	case CLOCK_EVT_MODE_RESUME:
> >> -		s5p_timer_resume();
> >> -		break;
> >> -	}
> >> -}
> >> -
> >> -static void s5p_timer_resume(void)
> >> -{
> >> -	/* event timer restart */
> >> -	s5p_time_setup(timer_source.event_id, clock_count_per_tick);
> >> -	s5p_time_start(timer_source.event_id, PERIODIC);
> >> -
> >> -	/* source timer restart */
> >> -	s5p_time_setup(timer_source.source_id, TCNT_MAX);
> >> -	s5p_time_start(timer_source.source_id, PERIODIC);
> >> -}
> >> -
> >> -void __init s5p_set_timer_source(enum s5p_timer_mode event,
> >> -				 enum s5p_timer_mode source)
> >> -{
> >> -	s3c_device_timer[event].dev.bus = &platform_bus_type;
> >> -	s3c_device_timer[source].dev.bus = &platform_bus_type;
> >> -
> >> -	timer_source.event_id = event;
> >> -	timer_source.source_id = source;
> >> -}
> >> -
> >> -static struct clock_event_device time_event_device = {
> >> -	.name		= "s5p_event_timer",
> >> -	.features	= CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT,
> >> -	.rating		= 200,
> >> -	.set_next_event	= s5p_set_next_event,
> >> -	.set_mode	= s5p_set_mode,
> >> -};
> >> -
> >> -static irqreturn_t s5p_clock_event_isr(int irq, void *dev_id)
> >> -{
> >> -	struct clock_event_device *evt = dev_id;
> >> -
> >> -	evt->event_handler(evt);
> >> -
> >> -	return IRQ_HANDLED;
> >> -}
> >> -
> >> -static struct irqaction s5p_clock_event_irq = {
> >> -	.name		= "s5p_time_irq",
> >> -	.flags		= IRQF_DISABLED | IRQF_TIMER | IRQF_IRQPOLL,
> >> -	.handler	= s5p_clock_event_isr,
> >> -	.dev_id		= &time_event_device,
> >> -};
> >> -
> >> -static void __init s5p_clockevent_init(void)
> >> -{
> >> -	unsigned long pclk;
> >> -	unsigned long clock_rate;
> >> -	unsigned int irq_number;
> >> -	struct clk *tscaler;
> >> -
> >> -	pclk = clk_get_rate(timerclk);
> >> -
> >> -	tscaler = clk_get_parent(tdiv_event);
> >> -
> >> -	clk_set_rate(tscaler, pclk / 2);
> >> -	clk_set_rate(tdiv_event, pclk / 2);
> >> -	clk_set_parent(tin_event, tdiv_event);
> >> -
> >> -	clock_rate = clk_get_rate(tin_event);
> >> -	clock_count_per_tick = clock_rate / HZ;
> >> -
> >> -	clockevents_calc_mult_shift(&time_event_device,
> >> -				    clock_rate, S5PTIMER_MIN_RANGE);
> >> -	time_event_device.max_delta_ns =
> >> -		clockevent_delta2ns(-1, &time_event_device);
> >> -	time_event_device.min_delta_ns =
> >> -		clockevent_delta2ns(1, &time_event_device);
> >> -
> >> -	time_event_device.cpumask = cpumask_of(0);
> >> -	clockevents_register_device(&time_event_device);
> >> -
> >> -	irq_number = timer_source.event_id + IRQ_TIMER0;
> >> -	setup_irq(irq_number, &s5p_clock_event_irq);
> >> -}
> >> -
> >> -static void __iomem *s5p_timer_reg(void)
> >> -{
> >> -	unsigned long offset = 0;
> >> -
> >> -	switch (timer_source.source_id) {
> >> -	case S5P_PWM0:
> >> -	case S5P_PWM1:
> >> -	case S5P_PWM2:
> >> -	case S5P_PWM3:
> >> -		offset = (timer_source.source_id * 0x0c) + 0x14;
> >> -		break;
> >> -
> >> -	case S5P_PWM4:
> >> -		offset = 0x40;
> >> -		break;
> >> -
> >> -	default:
> >> -		printk(KERN_ERR "Invalid Timer %d\n", timer_source.source_id);
> >> -		return NULL;
> >> -	}
> >> -
> >> -	return S3C_TIMERREG(offset);
> >> -}
> >> -
> >> -/*
> >> - * Override the global weak sched_clock symbol with this
> >> - * local implementation which uses the clocksource to get some
> >> - * better resolution when scheduling the kernel. We accept that
> >> - * this wraps around for now, since it is just a relative time
> >> - * stamp. (Inspired by U300 implementation.)
> >> - */
> >> -static u32 notrace s5p_read_sched_clock(void)
> >> -{
> >> -	void __iomem *reg = s5p_timer_reg();
> >> -
> >> -	if (!reg)
> >> -		return 0;
> >> -
> >> -	return ~__raw_readl(reg);
> >> -}
> >> -
> >> -static void __init s5p_clocksource_init(void)
> >> -{
> >> -	unsigned long pclk;
> >> -	unsigned long clock_rate;
> >> -
> >> -	pclk = clk_get_rate(timerclk);
> >> -
> >> -	clk_set_rate(tdiv_source, pclk / 2);
> >> -	clk_set_parent(tin_source, tdiv_source);
> >> -
> >> -	clock_rate = clk_get_rate(tin_source);
> >> -
> >> -	s5p_time_setup(timer_source.source_id, TCNT_MAX);
> >> -	s5p_time_start(timer_source.source_id, PERIODIC);
> >> -
> >> -	setup_sched_clock(s5p_read_sched_clock, 32, clock_rate);
> >> -
> >> -	if (clocksource_mmio_init(s5p_timer_reg(), "s5p_clocksource_timer",
> >> -			clock_rate, 250, 32, clocksource_mmio_readl_down))
> >> -		panic("s5p_clocksource_timer: can't register clocksource\n");
> >> -}
> >> -
> >> -static void __init s5p_timer_resources(void)
> >> -{
> >> -
> >> -	unsigned long event_id = timer_source.event_id;
> >> -	unsigned long source_id = timer_source.source_id;
> >> -	char devname[15];
> >> -
> >> -	timerclk = clk_get(NULL, "timers");
> >> -	if (IS_ERR(timerclk))
> >> -		panic("failed to get timers clock for timer");
> >> -
> >> -	clk_enable(timerclk);
> >> -
> >> -	sprintf(devname, "s3c24xx-pwm.%lu", event_id);
> >> -	s3c_device_timer[event_id].id = event_id;
> >> -	s3c_device_timer[event_id].dev.init_name = devname;
> >> -
> >> -	tin_event = clk_get(&s3c_device_timer[event_id].dev, "pwm-tin");
> >> -	if (IS_ERR(tin_event))
> >> -		panic("failed to get pwm-tin clock for event timer");
> >> -
> >> -	tdiv_event = clk_get(&s3c_device_timer[event_id].dev, "pwm-tdiv");
> >> -	if (IS_ERR(tdiv_event))
> >> -		panic("failed to get pwm-tdiv clock for event timer");
> >> -
> >> -	clk_enable(tin_event);
> >> -
> >> -	sprintf(devname, "s3c24xx-pwm.%lu", source_id);
> >> -	s3c_device_timer[source_id].id = source_id;
> >> -	s3c_device_timer[source_id].dev.init_name = devname;
> >> -
> >> -	tin_source = clk_get(&s3c_device_timer[source_id].dev, "pwm-tin");
> >> -	if (IS_ERR(tin_source))
> >> -		panic("failed to get pwm-tin clock for source timer");
> >> -
> >> -	tdiv_source = clk_get(&s3c_device_timer[source_id].dev, "pwm-tdiv");
> >> -	if (IS_ERR(tdiv_source))
> >> -		panic("failed to get pwm-tdiv clock for source timer");
> >> -
> >> -	clk_enable(tin_source);
> >> -}
> >> -
> >> -static void __init s5p_timer_init(void)
> >> -{
> >> -	s5p_timer_resources();
> >> -	s5p_clockevent_init();
> >> -	s5p_clocksource_init();
> >> -}
> >> -
> >> -struct sys_timer s5p_timer = {
> >> -	.init		= s5p_timer_init,
> >> -};
> >> diff --git a/arch/arm/plat-samsung/samsung-time.c
> >> b/arch/arm/plat-samsung/samsung-time.c new file mode 100644
> >> index 0000000..91773bf
> >> --- /dev/null
> >> +++ b/arch/arm/plat-samsung/samsung-time.c
> >> @@ -0,0 +1,405 @@
> >> +/*
> >> + * Copyright (c) 2011 Samsung Electronics Co., Ltd.
> >> + *		http://www.samsung.com/
> >> + *
> >> + * SAMSUNG - Common hr-timer support
> >> + *
> >> + * This program is free software; you can redistribute it and/or modify
> >> + * it under the terms of the GNU General Public License version 2 as
> >> + * published by the Free Software Foundation.
> >> +*/
> >> +
> >> +#include <linux/interrupt.h>
> >> +#include <linux/irq.h>
> >> +#include <linux/err.h>
> >> +#include <linux/clk.h>
> >> +#include <linux/clockchips.h>
> >> +#include <linux/platform_device.h>
> >> +
> >> +#include <asm/smp_twd.h>
> >> +#include <asm/mach/time.h>
> >> +#include <asm/mach/arch.h>
> >> +#include <asm/mach/map.h>
> >> +#include <asm/sched_clock.h>
> >> +
> >> +#include <mach/map.h>
> >> +#include <plat/devs.h>
> >> +#include <plat/regs-timer.h>
> >> +#include <plat/samsung-time.h>
> >> +
> >> +static struct clk *tin_event;
> >> +static struct clk *tin_source;
> >> +static struct clk *tdiv_event;
> >> +static struct clk *tdiv_source;
> >> +static struct clk *timerclk;
> >> +static struct samsung_timer_source timer_source;
> >> +static unsigned long clock_count_per_tick;
> >> +static void samsung_timer_resume(void);
> >> +
> >> +static void samsung_time_stop(enum samsung_timer_mode mode)
> >> +{
> >> +	unsigned long tcon;
> >> +
> >> +	tcon = __raw_readl(S3C2410_TCON);
> >> +
> >> +	switch (mode) {
> >> +	case SAMSUNG_PWM0:
> >> +		tcon &= ~S3C2410_TCON_T0START;
> >> +		break;
> >> +
> >> +	case SAMSUNG_PWM1:
> >> +		tcon &= ~S3C2410_TCON_T1START;
> >> +		break;
> >> +
> >> +	case SAMSUNG_PWM2:
> >> +		tcon &= ~S3C2410_TCON_T2START;
> >> +		break;
> >> +
> >> +	case SAMSUNG_PWM3:
> >> +		tcon &= ~S3C2410_TCON_T3START;
> >> +		break;
> >> +
> >> +	case SAMSUNG_PWM4:
> >> +		tcon &= ~S3C2410_TCON_T4START;
> >> +		break;
> >> +
> >> +	default:
> >> +		printk(KERN_ERR "Invalid Timer %d\n", mode);
> >> +		break;
> >> +	}
> >> +	__raw_writel(tcon, S3C2410_TCON);
> >> +}
> >> +
> >> +static void samsung_time_setup(enum samsung_timer_mode mode, unsigned
> >> long tcnt) +{
> >> +	unsigned long tcon;
> >> +
> >> +	tcon = __raw_readl(S3C2410_TCON);
> >> +
> >> +	tcnt--;
> >> +
> >> +	switch (mode) {
> >> +	case SAMSUNG_PWM0:
> >> +		tcon &= ~(0x0f << 0);
> >> +		tcon |= S3C2410_TCON_T0MANUALUPD;
> >> +		break;
> >> +
> >> +	case SAMSUNG_PWM1:
> >> +		tcon &= ~(0x0f << 8);
> >> +		tcon |= S3C2410_TCON_T1MANUALUPD;
> >> +		break;
> >> +
> >> +	case SAMSUNG_PWM2:
> >> +		tcon &= ~(0x0f << 12);
> >> +		tcon |= S3C2410_TCON_T2MANUALUPD;
> >> +		break;
> >> +
> >> +	case SAMSUNG_PWM3:
> >> +		tcon &= ~(0x0f << 16);
> >> +		tcon |= S3C2410_TCON_T3MANUALUPD;
> >> +		break;
> >> +
> >> +	case SAMSUNG_PWM4:
> >> +		tcon &= ~(0x07 << 20);
> >> +		tcon |= S3C2410_TCON_T4MANUALUPD;
> >> +		break;
> >> +
> >> +	default:
> >> +		printk(KERN_ERR "Invalid Timer %d\n", mode);
> >> +		break;
> >> +	}
> >> +
> >> +	__raw_writel(tcnt, S3C2410_TCNTB(mode));
> >> +	__raw_writel(tcnt, S3C2410_TCMPB(mode));
> >> +	__raw_writel(tcon, S3C2410_TCON);
> >> +}
> >> +
> >> +static void samsung_time_start(enum samsung_timer_mode mode, bool
> >> periodic) +{
> >> +	unsigned long tcon;
> >> +
> >> +	tcon  = __raw_readl(S3C2410_TCON);
> >> +
> >> +	switch (mode) {
> >> +	case SAMSUNG_PWM0:
> >> +		tcon |= S3C2410_TCON_T0START;
> >> +		tcon &= ~S3C2410_TCON_T0MANUALUPD;
> >> +
> >> +		if (periodic)
> >> +			tcon |= S3C2410_TCON_T0RELOAD;
> >> +		else
> >> +			tcon &= ~S3C2410_TCON_T0RELOAD;
> >> +		break;
> >> +
> >> +	case SAMSUNG_PWM1:
> >> +		tcon |= S3C2410_TCON_T1START;
> >> +		tcon &= ~S3C2410_TCON_T1MANUALUPD;
> >> +
> >> +		if (periodic)
> >> +			tcon |= S3C2410_TCON_T1RELOAD;
> >> +		else
> >> +			tcon &= ~S3C2410_TCON_T1RELOAD;
> >> +		break;
> >> +
> >> +	case SAMSUNG_PWM2:
> >> +		tcon |= S3C2410_TCON_T2START;
> >> +		tcon &= ~S3C2410_TCON_T2MANUALUPD;
> >> +
> >> +		if (periodic)
> >> +			tcon |= S3C2410_TCON_T2RELOAD;
> >> +		else
> >> +			tcon &= ~S3C2410_TCON_T2RELOAD;
> >> +		break;
> >> +
> >> +	case SAMSUNG_PWM3:
> >> +		tcon |= S3C2410_TCON_T3START;
> >> +		tcon &= ~S3C2410_TCON_T3MANUALUPD;
> >> +
> >> +		if (periodic)
> >> +			tcon |= S3C2410_TCON_T3RELOAD;
> >> +		else
> >> +			tcon &= ~S3C2410_TCON_T3RELOAD;
> >> +		break;
> >> +
> >> +	case SAMSUNG_PWM4:
> >> +		tcon |= S3C2410_TCON_T4START;
> >> +		tcon &= ~S3C2410_TCON_T4MANUALUPD;
> >> +
> >> +		if (periodic)
> >> +			tcon |= S3C2410_TCON_T4RELOAD;
> >> +		else
> >> +			tcon &= ~S3C2410_TCON_T4RELOAD;
> >> +		break;
> >> +
> >> +	default:
> >> +		printk(KERN_ERR "Invalid Timer %d\n", mode);
> >> +		break;
> >> +	}
> >> +	__raw_writel(tcon, S3C2410_TCON);
> >> +}
> >> +
> >> +static int samsung_set_next_event(unsigned long cycles,
> >> +				struct clock_event_device *evt)
> >> +{
> >> +	samsung_time_setup(timer_source.event_id, cycles);
> >> +	samsung_time_start(timer_source.event_id, NON_PERIODIC);
> >> +
> >> +	return 0;
> >> +}
> >> +
> >> +static void samsung_set_mode(enum clock_event_mode mode,
> >> +				struct clock_event_device *evt)
> >> +{
> >> +	samsung_time_stop(timer_source.event_id);
> >> +
> >> +	switch (mode) {
> >> +	case CLOCK_EVT_MODE_PERIODIC:
> >> +		samsung_time_setup(timer_source.event_id, clock_count_per_tick);
> >> +		samsung_time_start(timer_source.event_id, PERIODIC);
> >> +		break;
> >> +
> >> +	case CLOCK_EVT_MODE_ONESHOT:
> >> +		break;
> >> +
> >> +	case CLOCK_EVT_MODE_UNUSED:
> >> +	case CLOCK_EVT_MODE_SHUTDOWN:
> >> +		break;
> >> +
> >> +	case CLOCK_EVT_MODE_RESUME:
> >> +		samsung_timer_resume();
> >> +		break;
> >> +	}
> >> +}
> >> +
> >> +static void samsung_timer_resume(void)
> >> +{
> >> +	/* event timer restart */
> >> +	samsung_time_setup(timer_source.event_id, clock_count_per_tick);
> >> +	samsung_time_start(timer_source.event_id, PERIODIC);
> >> +
> >> +	/* source timer restart */
> >> +	samsung_time_setup(timer_source.source_id, TCNT_MAX);
> >> +	samsung_time_start(timer_source.source_id, PERIODIC);
> >> +}
> >> +
> >> +void __init samsung_set_timer_source(enum samsung_timer_mode event,
> >> +				 enum samsung_timer_mode source)
> >> +{
> >> +	s3c_device_timer[event].dev.bus = &platform_bus_type;
> >> +	s3c_device_timer[source].dev.bus = &platform_bus_type;
> >> +
> >> +	timer_source.event_id = event;
> >> +	timer_source.source_id = source;
> >> +}
> >> +
> >> +static struct clock_event_device time_event_device = {
> >> +	.name		= "samsung_event_timer",
> >> +	.features	= CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT,
> >> +	.rating		= 200,
> >> +	.set_next_event	= samsung_set_next_event,
> >> +	.set_mode	= samsung_set_mode,
> >> +};
> >> +
> >> +static irqreturn_t samsung_clock_event_isr(int irq, void *dev_id)
> >> +{
> >> +	struct clock_event_device *evt = dev_id;
> >> +
> >> +	evt->event_handler(evt);
> >> +
> >> +	return IRQ_HANDLED;
> >> +}
> >> +
> >> +static struct irqaction samsung_clock_event_irq = {
> >> +	.name		= "samsung_time_irq",
> >> +	.flags		= IRQF_DISABLED | IRQF_TIMER | IRQF_IRQPOLL,
> >> +	.handler	= samsung_clock_event_isr,
> >> +	.dev_id		= &time_event_device,
> >> +};
> >> +
> >> +static void __init samsung_clockevent_init(void)
> >> +{
> >> +	unsigned long pclk;
> >> +	unsigned long clock_rate;
> >> +	unsigned int irq_number;
> >> +	struct clk *tscaler;
> >> +
> >> +	pclk = clk_get_rate(timerclk);
> >> +
> >> +	tscaler = clk_get_parent(tdiv_event);
> >> +
> >> +	clk_set_rate(tscaler, pclk / 2);
> >> +	clk_set_rate(tdiv_event, pclk / 2);
> >> +	clk_set_parent(tin_event, tdiv_event);
> >> +
> >> +	clock_rate = clk_get_rate(tin_event);
> >> +	clock_count_per_tick = clock_rate / HZ;
> >> +
> >> +	clockevents_calc_mult_shift(&time_event_device,
> >> +				    clock_rate, SAMSUNG_TIMER_MIN_RANGE);
> >> +	time_event_device.max_delta_ns =
> >> +		clockevent_delta2ns(-1, &time_event_device);
> >> +	time_event_device.min_delta_ns =
> >> +		clockevent_delta2ns(1, &time_event_device);
> >> +
> >> +	time_event_device.cpumask = cpumask_of(0);
> >> +	clockevents_register_device(&time_event_device);
> >> +
> >> +	irq_number = timer_source.event_id + IRQ_TIMER0;
> >> +	setup_irq(irq_number, &samsung_clock_event_irq);
> >> +}
> >> +
> >> +static void __iomem *samsung_timer_reg(void)
> >> +{
> >> +	unsigned long offset = 0;
> >> +
> >> +	switch (timer_source.source_id) {
> >> +	case SAMSUNG_PWM0:
> >> +	case SAMSUNG_PWM1:
> >> +	case SAMSUNG_PWM2:
> >> +	case SAMSUNG_PWM3:
> >> +		offset = (timer_source.source_id * 0x0c) + 0x14;
> >> +		break;
> >> +
> >> +	case SAMSUNG_PWM4:
> >> +		offset = 0x40;
> >> +		break;
> >> +
> >> +	default:
> >> +		printk(KERN_ERR "Invalid Timer %d\n", timer_source.source_id);
> >> +		return NULL;
> >> +	}
> >> +
> >> +	return S3C_TIMERREG(offset);
> >> +}
> >> +
> >> +/*
> >> + * Override the global weak sched_clock symbol with this
> >> + * local implementation which uses the clocksource to get some
> >> + * better resolution when scheduling the kernel. We accept that
> >> + * this wraps around for now, since it is just a relative time
> >> + * stamp. (Inspired by U300 implementation.)
> >> + */
> >> +static u32 notrace samsung_read_sched_clock(void)
> >> +{
> >> +	void __iomem *reg = samsung_timer_reg();
> >> +
> >> +	if (!reg)
> >> +		return 0;
> >> +
> >> +	return ~__raw_readl(reg);
> >> +}
> >> +
> >> +static void __init samsung_clocksource_init(void)
> >> +{
> >> +	unsigned long pclk;
> >> +	unsigned long clock_rate;
> >> +
> >> +	pclk = clk_get_rate(timerclk);
> >> +
> >> +	clk_set_rate(tdiv_source, pclk / 2);
> >> +	clk_set_parent(tin_source, tdiv_source);
> >> +
> >> +	clock_rate = clk_get_rate(tin_source);
> >> +
> >> +	samsung_time_setup(timer_source.source_id, TCNT_MAX);
> >> +	samsung_time_start(timer_source.source_id, PERIODIC);
> >> +
> >> +	setup_sched_clock(samsung_read_sched_clock, 32, clock_rate);
> >> +
> >> +	if (clocksource_mmio_init(samsung_timer_reg(),
> >> "samsung_clocksource_timer", +			clock_rate, 250, 32,
> >> clocksource_mmio_readl_down))
> >> +		panic("samsung_clocksource_timer: can't register clocksource\n");
> >> +}
> >> +
> >> +static void __init samsung_timer_resources(void)
> >> +{
> >> +
> >> +	unsigned long event_id = timer_source.event_id;
> >> +	unsigned long source_id = timer_source.source_id;
> >> +	char devname[15];
> >> +
> >> +	timerclk = clk_get(NULL, "timers");
> >> +	if (IS_ERR(timerclk))
> >> +		panic("failed to get timers clock for timer");
> >> +
> >> +	clk_enable(timerclk);
> >> +
> >> +	sprintf(devname, "s3c24xx-pwm.%lu", event_id);
> >> +	s3c_device_timer[event_id].id = event_id;
> >> +	s3c_device_timer[event_id].dev.init_name = devname;
> >> +
> >> +	tin_event = clk_get(&s3c_device_timer[event_id].dev, "pwm-tin");
> >> +	if (IS_ERR(tin_event))
> >> +		panic("failed to get pwm-tin clock for event timer");
> >> +
> >> +	tdiv_event = clk_get(&s3c_device_timer[event_id].dev, "pwm-tdiv");
> >> +	if (IS_ERR(tdiv_event))
> >> +		panic("failed to get pwm-tdiv clock for event timer");
> >> +
> >> +	clk_enable(tin_event);
> >> +
> >> +	sprintf(devname, "s3c24xx-pwm.%lu", source_id);
> >> +	s3c_device_timer[source_id].id = source_id;
> >> +	s3c_device_timer[source_id].dev.init_name = devname;
> >> +
> >> +	tin_source = clk_get(&s3c_device_timer[source_id].dev, "pwm-tin");
> >> +	if (IS_ERR(tin_source))
> >> +		panic("failed to get pwm-tin clock for source timer");
> >> +
> >> +	tdiv_source = clk_get(&s3c_device_timer[source_id].dev, "pwm-tdiv");
> >> +	if (IS_ERR(tdiv_source))
> >> +		panic("failed to get pwm-tdiv clock for source timer");
> >> +
> >> +	clk_enable(tin_source);
> >> +}
> >> +
> >> +static void __init samsung_timer_init(void)
> >> +{
> >> +	samsung_timer_resources();
> >> +	samsung_clockevent_init();
> >> +	samsung_clocksource_init();
> >> +}
> >> +
> >> +struct sys_timer samsung_timer = {
> >> +	.init		= samsung_timer_init,
> >> +};

^ permalink raw reply	[flat|nested] 39+ messages in thread

* [PATCH 0/5 v2] S3C / S5PC100: add clockevent/clocksource support
  2012-11-29 23:18             ` Romain Naour
  2012-11-29 23:59               ` Heiko Stübner
@ 2012-12-02 19:43               ` Romain Naour
  1 sibling, 0 replies; 39+ messages in thread
From: Romain Naour @ 2012-12-02 19:43 UTC (permalink / raw)
  To: heiko
  Cc: tomasz.figa, Kukjin Kim, linux-samsung-soc, ben-linux,
	'Sylwester Nawrocki'

This series of patches converts the s3c and s5pc100 timer driver to the clocksource/clockevent API.
I made some test on a mini2440 board and I had to reduce timers frequency to 1MHz in order to produce a timer's overflow every 64ms.
Initial timer's frequency (8,45MHz) provide only 7ms between each overflow. It is not enough.
As timers were previously used to produce an IRQ at 200Hz, some board (Osiris, Anubis board) use an external 12MHz signal to clock the timers (tclk1).
So, I changed their configuration to select internal pclk clock instead, but I can't test it.

Since clockevent/clocksource API becomes available, we can use High Resolution Timer and Tickless mode.

Most of the work is already done in s5p-time.c (renamed samsung-time.c).
I added some #define for s3c24xx and s5pc100 case.

Kernel rev v3.7-rc6

Naour Romain (5):
  Rename s5p-time to samsung-time
  Add samsung-time support for s3c24xx
  Add samsung-time support for s3c64xx
  Add samsung-time support for s5pc100
  Remove unused plat-samsung/time.c

 arch/arm/Kconfig                                   |   9 +-
 arch/arm/mach-exynos/Kconfig                       |   2 +-
 arch/arm/mach-exynos/mach-universal_c210.c         |   6 +-
 arch/arm/mach-s3c24xx/Kconfig                      |   6 +
 arch/arm/mach-s3c24xx/mach-amlm5900.c              |   5 +-
 arch/arm/mach-s3c24xx/mach-anubis.c                |   4 +-
 arch/arm/mach-s3c24xx/mach-at2440evb.c             |   4 +-
 arch/arm/mach-s3c24xx/mach-bast.c                  |   4 +-
 arch/arm/mach-s3c24xx/mach-gta02.c                 |   4 +-
 arch/arm/mach-s3c24xx/mach-h1940.c                 |   4 +-
 arch/arm/mach-s3c24xx/mach-jive.c                  |   4 +-
 arch/arm/mach-s3c24xx/mach-mini2440.c              |   4 +-
 arch/arm/mach-s3c24xx/mach-n30.c                   |   6 +-
 arch/arm/mach-s3c24xx/mach-nexcoder.c              |   4 +-
 arch/arm/mach-s3c24xx/mach-osiris.c                |   4 +-
 arch/arm/mach-s3c24xx/mach-otom.c                  |   4 +-
 arch/arm/mach-s3c24xx/mach-qt2410.c                |   4 +-
 arch/arm/mach-s3c24xx/mach-rx1950.c                |   4 +-
 arch/arm/mach-s3c24xx/mach-rx3715.c                |   4 +-
 arch/arm/mach-s3c24xx/mach-smdk2410.c              |   4 +-
 arch/arm/mach-s3c24xx/mach-smdk2413.c              |   8 +-
 arch/arm/mach-s3c24xx/mach-smdk2416.c              |   4 +-
 arch/arm/mach-s3c24xx/mach-smdk2440.c              |   4 +-
 arch/arm/mach-s3c24xx/mach-smdk2443.c              |   4 +-
 arch/arm/mach-s3c24xx/mach-tct_hammer.c            |   4 +-
 arch/arm/mach-s3c24xx/mach-vr1000.c                |   4 +-
 arch/arm/mach-s3c24xx/mach-vstms.c                 |   5 +-
 arch/arm/mach-s3c64xx/Kconfig                      |   2 +
 arch/arm/mach-s3c64xx/mach-anw6410.c               |   4 +-
 arch/arm/mach-s3c64xx/mach-crag6410.c              |   4 +-
 arch/arm/mach-s3c64xx/mach-hmt.c                   |   4 +-
 arch/arm/mach-s3c64xx/mach-mini6410.c              |   4 +-
 arch/arm/mach-s3c64xx/mach-ncp.c                   |   4 +-
 arch/arm/mach-s3c64xx/mach-real6410.c              |   4 +-
 arch/arm/mach-s3c64xx/mach-smartq.c                |   2 +
 arch/arm/mach-s3c64xx/mach-smartq5.c               |   3 +-
 arch/arm/mach-s3c64xx/mach-smartq7.c               |   3 +-
 arch/arm/mach-s3c64xx/mach-smdk6400.c              |   4 +-
 arch/arm/mach-s3c64xx/mach-smdk6410.c              |   4 +-
 arch/arm/mach-s5p64x0/Kconfig                      |   4 +-
 arch/arm/mach-s5p64x0/mach-smdk6440.c              |   6 +-
 arch/arm/mach-s5p64x0/mach-smdk6450.c              |   6 +-
 arch/arm/mach-s5pc100/Kconfig                      |   1 +
 arch/arm/mach-s5pc100/mach-smdkc100.c              |   4 +-
 arch/arm/mach-s5pv210/Kconfig                      |   2 +-
 arch/arm/mach-s5pv210/mach-aquila.c                |   6 +-
 arch/arm/mach-s5pv210/mach-goni.c                  |   6 +-
 arch/arm/mach-s5pv210/mach-smdkc110.c              |   6 +-
 arch/arm/mach-s5pv210/mach-smdkv210.c              |   6 +-
 arch/arm/mach-s5pv210/mach-torbreck.c              |   6 +-
 arch/arm/plat-samsung/Kconfig                      |   2 +-
 arch/arm/plat-samsung/Makefile                     |   3 +-
 arch/arm/plat-samsung/include/plat/cpu.h           |   5 -
 arch/arm/plat-samsung/include/plat/s5p-time.h      |  40 ---
 arch/arm/plat-samsung/include/plat/samsung-time.h  |  51 ++++
 .../plat-samsung/{s5p-time.c => samsung-time.c}    | 144 +++++------
 arch/arm/plat-samsung/time.c                       | 285 ---------------------
 57 files changed, 274 insertions(+), 474 deletions(-)
 delete mode 100644 arch/arm/plat-samsung/include/plat/s5p-time.h
 create mode 100644 arch/arm/plat-samsung/include/plat/samsung-time.h
 rename arch/arm/plat-samsung/{s5p-time.c => samsung-time.c} (68%)
 delete mode 100644 arch/arm/plat-samsung/time.c

-- 

^ permalink raw reply	[flat|nested] 39+ messages in thread

* [PATCH 1/5 v2] Rename s5p-time to samsung-time
  2012-11-27 23:57           ` Heiko Stübner
  2012-11-29 23:18             ` Romain Naour
@ 2012-12-02 19:44             ` Romain Naour
  2012-12-10 12:59               ` Heiko Stübner
  2012-12-02 19:44             ` [PATCH 2/5 v2] Add samsung-time support for s3c24xx Romain Naour
                               ` (4 subsequent siblings)
  6 siblings, 1 reply; 39+ messages in thread
From: Romain Naour @ 2012-12-02 19:44 UTC (permalink / raw)
  To: heiko
  Cc: tomasz.figa, Kukjin Kim, linux-samsung-soc, ben-linux,
	'Sylwester Nawrocki'

This patch rename s5p-time to samsung-time.
There is no functional change.


Signed-off-by: Naour Romain <romain.naour@openwide.fr>

 delete mode 100644 arch/arm/plat-samsung/include/plat/s5p-time.h
 create mode 100644 arch/arm/plat-samsung/include/plat/samsung-time.h
 rename arch/arm/plat-samsung/{s5p-time.c => samsung-time.c} (70%)

diff --git a/arch/arm/mach-exynos/Kconfig b/arch/arm/mach-exynos/Kconfig
index da55107..20edfa3 100644
--- a/arch/arm/mach-exynos/Kconfig
+++ b/arch/arm/mach-exynos/Kconfig
@@ -274,7 +274,7 @@ config MACH_UNIVERSAL_C210
 	select S5P_DEV_ONENAND
 	select S5P_DEV_TV
 	select S5P_GPIO_INT
-	select S5P_HRT
+	select SAMSUNG_HRT
 	select S5P_SETUP_MIPIPHY
 	help
 	  Machine support for Samsung Mobile Universal S5PC210 Reference
diff --git a/arch/arm/mach-exynos/mach-universal_c210.c b/arch/arm/mach-exynos/mach-universal_c210.c
index ebc9dd3..325bfe9 100644
--- a/arch/arm/mach-exynos/mach-universal_c210.c
+++ b/arch/arm/mach-exynos/mach-universal_c210.c
@@ -41,7 +41,7 @@
 #include <plat/mfc.h>
 #include <plat/sdhci.h>
 #include <plat/fimc-core.h>
-#include <plat/s5p-time.h>
+#include <plat/samsung-time.h>
 #include <plat/camport.h>
 #include <linux/platform_data/mipi-csis.h>
 
@@ -1099,7 +1099,7 @@ static void __init universal_map_io(void)
 	exynos_init_io(NULL, 0);
 	s3c24xx_init_clocks(clk_xusbxti.rate);
 	s3c24xx_init_uarts(universal_uartcfgs, ARRAY_SIZE(universal_uartcfgs));
-	s5p_set_timer_source(S5P_PWM2, S5P_PWM4);
+	samsung_set_timer_source(SAMSUNG_PWM2, SAMSUNG_PWM4);
 }
 
 static void s5p_tv_setup(void)
@@ -1158,7 +1158,7 @@ MACHINE_START(UNIVERSAL_C210, "UNIVERSAL_C210")
 	.handle_irq	= gic_handle_irq,
 	.init_machine	= universal_machine_init,
 	.init_late	= exynos_init_late,
-	.timer		= &s5p_timer,
+	.timer		= &samsung_timer,
 	.reserve        = &universal_reserve,
 	.restart	= exynos4_restart,
 MACHINE_END
diff --git a/arch/arm/mach-s5p64x0/Kconfig b/arch/arm/mach-s5p64x0/Kconfig
index e8742cb..f0ec535 100644
--- a/arch/arm/mach-s5p64x0/Kconfig
+++ b/arch/arm/mach-s5p64x0/Kconfig
@@ -9,7 +9,7 @@ if ARCH_S5P64X0
 
 config CPU_S5P6440
 	bool
-	select S5P_HRT
+	select SAMSUNG_HRT
 	select S5P_SLEEP if PM
 	select SAMSUNG_DMADEV
 	select SAMSUNG_WAKEMASK if PM
@@ -18,7 +18,7 @@ config CPU_S5P6440
 
 config CPU_S5P6450
 	bool
-	select S5P_HRT
+	select SAMSUNG_HRT
 	select S5P_SLEEP if PM
 	select SAMSUNG_DMADEV
 	select SAMSUNG_WAKEMASK if PM
diff --git a/arch/arm/mach-s5p64x0/mach-smdk6440.c b/arch/arm/mach-s5p64x0/mach-smdk6440.c
index 96ea1fe..587fec5 100644
--- a/arch/arm/mach-s5p64x0/mach-smdk6440.c
+++ b/arch/arm/mach-s5p64x0/mach-smdk6440.c
@@ -50,7 +50,7 @@
 #include <plat/pll.h>
 #include <plat/adc.h>
 #include <linux/platform_data/touchscreen-s3c2410.h>
-#include <plat/s5p-time.h>
+#include <plat/samsung-time.h>
 #include <plat/backlight.h>
 #include <plat/fb.h>
 #include <plat/sdhci.h>
@@ -231,7 +231,7 @@ static void __init smdk6440_map_io(void)
 	s5p64x0_init_io(NULL, 0);
 	s3c24xx_init_clocks(12000000);
 	s3c24xx_init_uarts(smdk6440_uartcfgs, ARRAY_SIZE(smdk6440_uartcfgs));
-	s5p_set_timer_source(S5P_PWM3, S5P_PWM4);
+	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
 }
 
 static void s5p6440_set_lcd_interface(void)
@@ -276,6 +276,6 @@ MACHINE_START(SMDK6440, "SMDK6440")
 	.handle_irq	= vic_handle_irq,
 	.map_io		= smdk6440_map_io,
 	.init_machine	= smdk6440_machine_init,
-	.timer		= &s5p_timer,
+	.timer		= &samsung_timer,
 	.restart	= s5p64x0_restart,
 MACHINE_END
diff --git a/arch/arm/mach-s5p64x0/mach-smdk6450.c b/arch/arm/mach-s5p64x0/mach-smdk6450.c
index 12748b6..714cd8a 100644
--- a/arch/arm/mach-s5p64x0/mach-smdk6450.c
+++ b/arch/arm/mach-s5p64x0/mach-smdk6450.c
@@ -50,7 +50,7 @@
 #include <plat/pll.h>
 #include <plat/adc.h>
 #include <linux/platform_data/touchscreen-s3c2410.h>
-#include <plat/s5p-time.h>
+#include <plat/samsung-time.h>
 #include <plat/backlight.h>
 #include <plat/fb.h>
 #include <plat/sdhci.h>
@@ -250,7 +250,7 @@ static void __init smdk6450_map_io(void)
 	s5p64x0_init_io(NULL, 0);
 	s3c24xx_init_clocks(19200000);
 	s3c24xx_init_uarts(smdk6450_uartcfgs, ARRAY_SIZE(smdk6450_uartcfgs));
-	s5p_set_timer_source(S5P_PWM3, S5P_PWM4);
+	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
 }
 
 static void s5p6450_set_lcd_interface(void)
@@ -295,6 +295,6 @@ MACHINE_START(SMDK6450, "SMDK6450")
 	.handle_irq	= vic_handle_irq,
 	.map_io		= smdk6450_map_io,
 	.init_machine	= smdk6450_machine_init,
-	.timer		= &s5p_timer,
+	.timer		= &samsung_timer,
 	.restart	= s5p64x0_restart,
 MACHINE_END
diff --git a/arch/arm/mach-s5pv210/Kconfig b/arch/arm/mach-s5pv210/Kconfig
index 92ad72f..01018ef 100644
--- a/arch/arm/mach-s5pv210/Kconfig
+++ b/arch/arm/mach-s5pv210/Kconfig
@@ -12,7 +12,7 @@ if ARCH_S5PV210
 config CPU_S5PV210
 	bool
 	select S5P_EXT_INT
-	select S5P_HRT
+	select SAMSUNG_HRT
 	select S5P_PM if PM
 	select S5P_SLEEP if PM
 	select SAMSUNG_DMADEV
diff --git a/arch/arm/mach-s5pv210/mach-aquila.c b/arch/arm/mach-s5pv210/mach-aquila.c
index ee9fa5c..7c7d89b 100644
--- a/arch/arm/mach-s5pv210/mach-aquila.c
+++ b/arch/arm/mach-s5pv210/mach-aquila.c
@@ -39,7 +39,7 @@
 #include <plat/fb.h>
 #include <plat/fimc-core.h>
 #include <plat/sdhci.h>
-#include <plat/s5p-time.h>
+#include <plat/samsung-time.h>
 
 #include "common.h"
 
@@ -652,7 +652,7 @@ static void __init aquila_map_io(void)
 	s5pv210_init_io(NULL, 0);
 	s3c24xx_init_clocks(24000000);
 	s3c24xx_init_uarts(aquila_uartcfgs, ARRAY_SIZE(aquila_uartcfgs));
-	s5p_set_timer_source(S5P_PWM3, S5P_PWM4);
+	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
 }
 
 static void __init aquila_machine_init(void)
@@ -688,6 +688,6 @@ MACHINE_START(AQUILA, "Aquila")
 	.handle_irq	= vic_handle_irq,
 	.map_io		= aquila_map_io,
 	.init_machine	= aquila_machine_init,
-	.timer		= &s5p_timer,
+	.timer		= &samsung_timer,
 	.restart	= s5pv210_restart,
 MACHINE_END
diff --git a/arch/arm/mach-s5pv210/mach-goni.c b/arch/arm/mach-s5pv210/mach-goni.c
index 55e1dba..2740001 100644
--- a/arch/arm/mach-s5pv210/mach-goni.c
+++ b/arch/arm/mach-s5pv210/mach-goni.c
@@ -48,7 +48,7 @@
 #include <plat/keypad.h>
 #include <plat/sdhci.h>
 #include <plat/clock.h>
-#include <plat/s5p-time.h>
+#include <plat/samsung-time.h>
 #include <plat/mfc.h>
 #include <plat/camport.h>
 
@@ -910,7 +910,7 @@ static void __init goni_map_io(void)
 	s5pv210_init_io(NULL, 0);
 	s3c24xx_init_clocks(clk_xusbxti.rate);
 	s3c24xx_init_uarts(goni_uartcfgs, ARRAY_SIZE(goni_uartcfgs));
-	s5p_set_timer_source(S5P_PWM3, S5P_PWM4);
+	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
 }
 
 static void __init goni_reserve(void)
@@ -976,7 +976,7 @@ MACHINE_START(GONI, "GONI")
 	.handle_irq	= vic_handle_irq,
 	.map_io		= goni_map_io,
 	.init_machine	= goni_machine_init,
-	.timer		= &s5p_timer,
+	.timer		= &samsung_timer,
 	.reserve	= &goni_reserve,
 	.restart	= s5pv210_restart,
 MACHINE_END
diff --git a/arch/arm/mach-s5pv210/mach-smdkc110.c b/arch/arm/mach-s5pv210/mach-smdkc110.c
index d9c99fc..d2e93b7 100644
--- a/arch/arm/mach-s5pv210/mach-smdkc110.c
+++ b/arch/arm/mach-s5pv210/mach-smdkc110.c
@@ -30,7 +30,7 @@
 #include <linux/platform_data/ata-samsung_cf.h>
 #include <linux/platform_data/i2c-s3c2410.h>
 #include <plat/pm.h>
-#include <plat/s5p-time.h>
+#include <plat/samsung-time.h>
 #include <plat/mfc.h>
 
 #include "common.h"
@@ -122,7 +122,7 @@ static void __init smdkc110_map_io(void)
 	s5pv210_init_io(NULL, 0);
 	s3c24xx_init_clocks(24000000);
 	s3c24xx_init_uarts(smdkv210_uartcfgs, ARRAY_SIZE(smdkv210_uartcfgs));
-	s5p_set_timer_source(S5P_PWM3, S5P_PWM4);
+	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
 }
 
 static void __init smdkc110_reserve(void)
@@ -156,7 +156,7 @@ MACHINE_START(SMDKC110, "SMDKC110")
 	.handle_irq	= vic_handle_irq,
 	.map_io		= smdkc110_map_io,
 	.init_machine	= smdkc110_machine_init,
-	.timer		= &s5p_timer,
+	.timer		= &samsung_timer,
 	.restart	= s5pv210_restart,
 	.reserve	= &smdkc110_reserve,
 MACHINE_END
diff --git a/arch/arm/mach-s5pv210/mach-smdkv210.c b/arch/arm/mach-s5pv210/mach-smdkv210.c
index 4cdb5bb..cd28725 100644
--- a/arch/arm/mach-s5pv210/mach-smdkv210.c
+++ b/arch/arm/mach-s5pv210/mach-smdkv210.c
@@ -45,7 +45,7 @@
 #include <plat/keypad.h>
 #include <plat/pm.h>
 #include <plat/fb.h>
-#include <plat/s5p-time.h>
+#include <plat/samsung-time.h>
 #include <plat/backlight.h>
 #include <plat/mfc.h>
 #include <plat/clock.h>
@@ -287,7 +287,7 @@ static void __init smdkv210_map_io(void)
 	s5pv210_init_io(NULL, 0);
 	s3c24xx_init_clocks(clk_xusbxti.rate);
 	s3c24xx_init_uarts(smdkv210_uartcfgs, ARRAY_SIZE(smdkv210_uartcfgs));
-	s5p_set_timer_source(S5P_PWM2, S5P_PWM4);
+	samsung_set_timer_source(SAMSUNG_PWM2, SAMSUNG_PWM4);
 }
 
 static void __init smdkv210_reserve(void)
@@ -332,7 +332,7 @@ MACHINE_START(SMDKV210, "SMDKV210")
 	.handle_irq	= vic_handle_irq,
 	.map_io		= smdkv210_map_io,
 	.init_machine	= smdkv210_machine_init,
-	.timer		= &s5p_timer,
+	.timer		= &samsung_timer,
 	.restart	= s5pv210_restart,
 	.reserve	= &smdkv210_reserve,
 MACHINE_END
diff --git a/arch/arm/mach-s5pv210/mach-torbreck.c b/arch/arm/mach-s5pv210/mach-torbreck.c
index 18785cb..aec668c 100644
--- a/arch/arm/mach-s5pv210/mach-torbreck.c
+++ b/arch/arm/mach-s5pv210/mach-torbreck.c
@@ -27,7 +27,7 @@
 #include <plat/devs.h>
 #include <plat/cpu.h>
 #include <linux/platform_data/i2c-s3c2410.h>
-#include <plat/s5p-time.h>
+#include <plat/samsung-time.h>
 
 #include "common.h"
 
@@ -107,7 +107,7 @@ static void __init torbreck_map_io(void)
 	s5pv210_init_io(NULL, 0);
 	s3c24xx_init_clocks(24000000);
 	s3c24xx_init_uarts(torbreck_uartcfgs, ARRAY_SIZE(torbreck_uartcfgs));
-	s5p_set_timer_source(S5P_PWM3, S5P_PWM4);
+	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
 }
 
 static void __init torbreck_machine_init(void)
@@ -132,6 +132,6 @@ MACHINE_START(TORBRECK, "TORBRECK")
 	.handle_irq	= vic_handle_irq,
 	.map_io		= torbreck_map_io,
 	.init_machine	= torbreck_machine_init,
-	.timer		= &s5p_timer,
+	.timer		= &samsung_timer,
 	.restart	= s5pv210_restart,
 MACHINE_END
diff --git a/arch/arm/plat-samsung/Kconfig b/arch/arm/plat-samsung/Kconfig
index 59401e1..5278795 100644
--- a/arch/arm/plat-samsung/Kconfig
+++ b/arch/arm/plat-samsung/Kconfig
@@ -70,7 +70,7 @@ config S3C_LOWLEVEL_UART_PORT
 
 # timer options
 
-config S5P_HRT
+config SAMSUNG_HRT
 	bool
 	select SAMSUNG_DEV_PWM
 	help
diff --git a/arch/arm/plat-samsung/Makefile b/arch/arm/plat-samsung/Makefile
index 9e40e8d..06f2312 100644
--- a/arch/arm/plat-samsung/Makefile
+++ b/arch/arm/plat-samsung/Makefile
@@ -13,7 +13,7 @@ obj-				:=
 
 obj-y				+= init.o cpu.o
 obj-$(CONFIG_ARCH_USES_GETTIMEOFFSET)   += time.o
-obj-$(CONFIG_S5P_HRT) 		+= s5p-time.o
+obj-$(CONFIG_SAMSUNG_HRT) 		+= samsung-time.o
 
 obj-$(CONFIG_SAMSUNG_CLOCK)	+= clock.o
 obj-$(CONFIG_SAMSUNG_CLOCK)	+= pwm-clock.o
diff --git a/arch/arm/plat-samsung/include/plat/s5p-time.h b/arch/arm/plat-samsung/include/plat/s5p-time.h
deleted file mode 100644
index 3a70aeb..0000000
--- a/arch/arm/plat-samsung/include/plat/s5p-time.h
+++ /dev/null
@@ -1,40 +0,0 @@
-/* linux/arch/arm/plat-samsung/include/plat/s5p-time.h
- *
- * Copyright 2011 Samsung Electronics Co., Ltd.
- *		http://www.samsung.com/
- *
- * Header file for s5p time support
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
-*/
-
-#ifndef __ASM_PLAT_S5P_TIME_H
-#define __ASM_PLAT_S5P_TIME_H __FILE__
-
-/* S5P HR-Timer Clock mode */
-enum s5p_timer_mode {
-	S5P_PWM0,
-	S5P_PWM1,
-	S5P_PWM2,
-	S5P_PWM3,
-	S5P_PWM4,
-};
-
-struct s5p_timer_source {
-	unsigned int event_id;
-	unsigned int source_id;
-};
-
-/* Be able to sleep for atleast 4 seconds (usually more) */
-#define S5PTIMER_MIN_RANGE	4
-
-#define TCNT_MAX		0xffffffff
-#define NON_PERIODIC		0
-#define PERIODIC		1
-
-extern void __init s5p_set_timer_source(enum s5p_timer_mode event,
-					enum s5p_timer_mode source);
-extern	struct sys_timer s5p_timer;
-#endif /* __ASM_PLAT_S5P_TIME_H */
diff --git a/arch/arm/plat-samsung/include/plat/samsung-time.h b/arch/arm/plat-samsung/include/plat/samsung-time.h
new file mode 100644
index 0000000..9d6d622
--- /dev/null
+++ b/arch/arm/plat-samsung/include/plat/samsung-time.h
@@ -0,0 +1,40 @@
+/* linux/arch/arm/plat-samsung/include/plat/samsung-time.h
+ *
+ * Copyright 2011 Samsung Electronics Co., Ltd.
+ *		http://www.samsung.com/
+ *
+ * Header file for samsung s3c and s5p time support
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+*/
+
+#ifndef __ASM_PLAT_SAMSUNG_TIME_H
+#define __ASM_PLAT_SAMSUNG_TIME_H __FILE__
+
+/* SAMSUNG HR-Timer Clock mode */
+enum samsung_timer_mode {
+	SAMSUNG_PWM0,
+	SAMSUNG_PWM1,
+	SAMSUNG_PWM2,
+	SAMSUNG_PWM3,
+	SAMSUNG_PWM4,
+};
+
+struct samsung_timer_source {
+	unsigned int event_id;
+	unsigned int source_id;
+};
+
+/* Be able to sleep for atleast 4 seconds (usually more) */
+#define SAMSUNG_TIMER_MIN_RANGE	4
+
+#define TCNT_MAX		0xffffffff
+#define NON_PERIODIC		0
+#define PERIODIC		1
+
+extern void __init samsung_set_timer_source(enum samsung_timer_mode event,
+					enum samsung_timer_mode source);
+extern	struct sys_timer samsung_timer;
+#endif /* __ASM_PLAT_SAMSUNG_TIME_H */
diff --git a/arch/arm/plat-samsung/s5p-time.c b/arch/arm/plat-samsung/samsung-time.c
similarity index 70%
rename from arch/arm/plat-samsung/s5p-time.c
rename to arch/arm/plat-samsung/samsung-time.c
index 028b6e8..91773bf 100644
--- a/arch/arm/plat-samsung/s5p-time.c
+++ b/arch/arm/plat-samsung/samsung-time.c
@@ -2,7 +2,7 @@
  * Copyright (c) 2011 Samsung Electronics Co., Ltd.
  *		http://www.samsung.com/
  *
- * S5P - Common hr-timer support
+ * SAMSUNG - Common hr-timer support
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License version 2 as
@@ -25,41 +25,41 @@
 #include <mach/map.h>
 #include <plat/devs.h>
 #include <plat/regs-timer.h>
-#include <plat/s5p-time.h>
+#include <plat/samsung-time.h>
 
 static struct clk *tin_event;
 static struct clk *tin_source;
 static struct clk *tdiv_event;
 static struct clk *tdiv_source;
 static struct clk *timerclk;
-static struct s5p_timer_source timer_source;
+static struct samsung_timer_source timer_source;
 static unsigned long clock_count_per_tick;
-static void s5p_timer_resume(void);
+static void samsung_timer_resume(void);
 
-static void s5p_time_stop(enum s5p_timer_mode mode)
+static void samsung_time_stop(enum samsung_timer_mode mode)
 {
 	unsigned long tcon;
 
 	tcon = __raw_readl(S3C2410_TCON);
 
 	switch (mode) {
-	case S5P_PWM0:
+	case SAMSUNG_PWM0:
 		tcon &= ~S3C2410_TCON_T0START;
 		break;
 
-	case S5P_PWM1:
+	case SAMSUNG_PWM1:
 		tcon &= ~S3C2410_TCON_T1START;
 		break;
 
-	case S5P_PWM2:
+	case SAMSUNG_PWM2:
 		tcon &= ~S3C2410_TCON_T2START;
 		break;
 
-	case S5P_PWM3:
+	case SAMSUNG_PWM3:
 		tcon &= ~S3C2410_TCON_T3START;
 		break;
 
-	case S5P_PWM4:
+	case SAMSUNG_PWM4:
 		tcon &= ~S3C2410_TCON_T4START;
 		break;
 
@@ -70,7 +70,7 @@ static void s5p_time_stop(enum s5p_timer_mode mode)
 	__raw_writel(tcon, S3C2410_TCON);
 }
 
-static void s5p_time_setup(enum s5p_timer_mode mode, unsigned long tcnt)
+static void samsung_time_setup(enum samsung_timer_mode mode, unsigned long tcnt)
 {
 	unsigned long tcon;
 
@@ -79,27 +79,27 @@ static void s5p_time_setup(enum s5p_timer_mode mode, unsigned long tcnt)
 	tcnt--;
 
 	switch (mode) {
-	case S5P_PWM0:
+	case SAMSUNG_PWM0:
 		tcon &= ~(0x0f << 0);
 		tcon |= S3C2410_TCON_T0MANUALUPD;
 		break;
 
-	case S5P_PWM1:
+	case SAMSUNG_PWM1:
 		tcon &= ~(0x0f << 8);
 		tcon |= S3C2410_TCON_T1MANUALUPD;
 		break;
 
-	case S5P_PWM2:
+	case SAMSUNG_PWM2:
 		tcon &= ~(0x0f << 12);
 		tcon |= S3C2410_TCON_T2MANUALUPD;
 		break;
 
-	case S5P_PWM3:
+	case SAMSUNG_PWM3:
 		tcon &= ~(0x0f << 16);
 		tcon |= S3C2410_TCON_T3MANUALUPD;
 		break;
 
-	case S5P_PWM4:
+	case SAMSUNG_PWM4:
 		tcon &= ~(0x07 << 20);
 		tcon |= S3C2410_TCON_T4MANUALUPD;
 		break;
@@ -114,14 +114,14 @@ static void s5p_time_setup(enum s5p_timer_mode mode, unsigned long tcnt)
 	__raw_writel(tcon, S3C2410_TCON);
 }
 
-static void s5p_time_start(enum s5p_timer_mode mode, bool periodic)
+static void samsung_time_start(enum samsung_timer_mode mode, bool periodic)
 {
 	unsigned long tcon;
 
 	tcon  = __raw_readl(S3C2410_TCON);
 
 	switch (mode) {
-	case S5P_PWM0:
+	case SAMSUNG_PWM0:
 		tcon |= S3C2410_TCON_T0START;
 		tcon &= ~S3C2410_TCON_T0MANUALUPD;
 
@@ -131,7 +131,7 @@ static void s5p_time_start(enum s5p_timer_mode mode, bool periodic)
 			tcon &= ~S3C2410_TCON_T0RELOAD;
 		break;
 
-	case S5P_PWM1:
+	case SAMSUNG_PWM1:
 		tcon |= S3C2410_TCON_T1START;
 		tcon &= ~S3C2410_TCON_T1MANUALUPD;
 
@@ -141,7 +141,7 @@ static void s5p_time_start(enum s5p_timer_mode mode, bool periodic)
 			tcon &= ~S3C2410_TCON_T1RELOAD;
 		break;
 
-	case S5P_PWM2:
+	case SAMSUNG_PWM2:
 		tcon |= S3C2410_TCON_T2START;
 		tcon &= ~S3C2410_TCON_T2MANUALUPD;
 
@@ -151,7 +151,7 @@ static void s5p_time_start(enum s5p_timer_mode mode, bool periodic)
 			tcon &= ~S3C2410_TCON_T2RELOAD;
 		break;
 
-	case S5P_PWM3:
+	case SAMSUNG_PWM3:
 		tcon |= S3C2410_TCON_T3START;
 		tcon &= ~S3C2410_TCON_T3MANUALUPD;
 
@@ -161,7 +161,7 @@ static void s5p_time_start(enum s5p_timer_mode mode, bool periodic)
 			tcon &= ~S3C2410_TCON_T3RELOAD;
 		break;
 
-	case S5P_PWM4:
+	case SAMSUNG_PWM4:
 		tcon |= S3C2410_TCON_T4START;
 		tcon &= ~S3C2410_TCON_T4MANUALUPD;
 
@@ -178,24 +178,24 @@ static void s5p_time_start(enum s5p_timer_mode mode, bool periodic)
 	__raw_writel(tcon, S3C2410_TCON);
 }
 
-static int s5p_set_next_event(unsigned long cycles,
+static int samsung_set_next_event(unsigned long cycles,
 				struct clock_event_device *evt)
 {
-	s5p_time_setup(timer_source.event_id, cycles);
-	s5p_time_start(timer_source.event_id, NON_PERIODIC);
+	samsung_time_setup(timer_source.event_id, cycles);
+	samsung_time_start(timer_source.event_id, NON_PERIODIC);
 
 	return 0;
 }
 
-static void s5p_set_mode(enum clock_event_mode mode,
+static void samsung_set_mode(enum clock_event_mode mode,
 				struct clock_event_device *evt)
 {
-	s5p_time_stop(timer_source.event_id);
+	samsung_time_stop(timer_source.event_id);
 
 	switch (mode) {
 	case CLOCK_EVT_MODE_PERIODIC:
-		s5p_time_setup(timer_source.event_id, clock_count_per_tick);
-		s5p_time_start(timer_source.event_id, PERIODIC);
+		samsung_time_setup(timer_source.event_id, clock_count_per_tick);
+		samsung_time_start(timer_source.event_id, PERIODIC);
 		break;
 
 	case CLOCK_EVT_MODE_ONESHOT:
@@ -206,24 +206,24 @@ static void s5p_set_mode(enum clock_event_mode mode,
 		break;
 
 	case CLOCK_EVT_MODE_RESUME:
-		s5p_timer_resume();
+		samsung_timer_resume();
 		break;
 	}
 }
 
-static void s5p_timer_resume(void)
+static void samsung_timer_resume(void)
 {
 	/* event timer restart */
-	s5p_time_setup(timer_source.event_id, clock_count_per_tick);
-	s5p_time_start(timer_source.event_id, PERIODIC);
+	samsung_time_setup(timer_source.event_id, clock_count_per_tick);
+	samsung_time_start(timer_source.event_id, PERIODIC);
 
 	/* source timer restart */
-	s5p_time_setup(timer_source.source_id, TCNT_MAX);
-	s5p_time_start(timer_source.source_id, PERIODIC);
+	samsung_time_setup(timer_source.source_id, TCNT_MAX);
+	samsung_time_start(timer_source.source_id, PERIODIC);
 }
 
-void __init s5p_set_timer_source(enum s5p_timer_mode event,
-				 enum s5p_timer_mode source)
+void __init samsung_set_timer_source(enum samsung_timer_mode event,
+				 enum samsung_timer_mode source)
 {
 	s3c_device_timer[event].dev.bus = &platform_bus_type;
 	s3c_device_timer[source].dev.bus = &platform_bus_type;
@@ -233,14 +233,14 @@ void __init s5p_set_timer_source(enum s5p_timer_mode event,
 }
 
 static struct clock_event_device time_event_device = {
-	.name		= "s5p_event_timer",
+	.name		= "samsung_event_timer",
 	.features	= CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT,
 	.rating		= 200,
-	.set_next_event	= s5p_set_next_event,
-	.set_mode	= s5p_set_mode,
+	.set_next_event	= samsung_set_next_event,
+	.set_mode	= samsung_set_mode,
 };
 
-static irqreturn_t s5p_clock_event_isr(int irq, void *dev_id)
+static irqreturn_t samsung_clock_event_isr(int irq, void *dev_id)
 {
 	struct clock_event_device *evt = dev_id;
 
@@ -249,14 +249,14 @@ static irqreturn_t s5p_clock_event_isr(int irq, void *dev_id)
 	return IRQ_HANDLED;
 }
 
-static struct irqaction s5p_clock_event_irq = {
-	.name		= "s5p_time_irq",
+static struct irqaction samsung_clock_event_irq = {
+	.name		= "samsung_time_irq",
 	.flags		= IRQF_DISABLED | IRQF_TIMER | IRQF_IRQPOLL,
-	.handler	= s5p_clock_event_isr,
+	.handler	= samsung_clock_event_isr,
 	.dev_id		= &time_event_device,
 };
 
-static void __init s5p_clockevent_init(void)
+static void __init samsung_clockevent_init(void)
 {
 	unsigned long pclk;
 	unsigned long clock_rate;
@@ -275,7 +275,7 @@ static void __init s5p_clockevent_init(void)
 	clock_count_per_tick = clock_rate / HZ;
 
 	clockevents_calc_mult_shift(&time_event_device,
-				    clock_rate, S5PTIMER_MIN_RANGE);
+				    clock_rate, SAMSUNG_TIMER_MIN_RANGE);
 	time_event_device.max_delta_ns =
 		clockevent_delta2ns(-1, &time_event_device);
 	time_event_device.min_delta_ns =
@@ -285,22 +285,22 @@ static void __init s5p_clockevent_init(void)
 	clockevents_register_device(&time_event_device);
 
 	irq_number = timer_source.event_id + IRQ_TIMER0;
-	setup_irq(irq_number, &s5p_clock_event_irq);
+	setup_irq(irq_number, &samsung_clock_event_irq);
 }
 
-static void __iomem *s5p_timer_reg(void)
+static void __iomem *samsung_timer_reg(void)
 {
 	unsigned long offset = 0;
 
 	switch (timer_source.source_id) {
-	case S5P_PWM0:
-	case S5P_PWM1:
-	case S5P_PWM2:
-	case S5P_PWM3:
+	case SAMSUNG_PWM0:
+	case SAMSUNG_PWM1:
+	case SAMSUNG_PWM2:
+	case SAMSUNG_PWM3:
 		offset = (timer_source.source_id * 0x0c) + 0x14;
 		break;
 
-	case S5P_PWM4:
+	case SAMSUNG_PWM4:
 		offset = 0x40;
 		break;
 
@@ -319,9 +319,9 @@ static void __iomem *s5p_timer_reg(void)
  * this wraps around for now, since it is just a relative time
  * stamp. (Inspired by U300 implementation.)
  */
-static u32 notrace s5p_read_sched_clock(void)
+static u32 notrace samsung_read_sched_clock(void)
 {
-	void __iomem *reg = s5p_timer_reg();
+	void __iomem *reg = samsung_timer_reg();
 
 	if (!reg)
 		return 0;
@@ -329,7 +329,7 @@ static u32 notrace s5p_read_sched_clock(void)
 	return ~__raw_readl(reg);
 }
 
-static void __init s5p_clocksource_init(void)
+static void __init samsung_clocksource_init(void)
 {
 	unsigned long pclk;
 	unsigned long clock_rate;
@@ -341,17 +341,17 @@ static void __init s5p_clocksource_init(void)
 
 	clock_rate = clk_get_rate(tin_source);
 
-	s5p_time_setup(timer_source.source_id, TCNT_MAX);
-	s5p_time_start(timer_source.source_id, PERIODIC);
+	samsung_time_setup(timer_source.source_id, TCNT_MAX);
+	samsung_time_start(timer_source.source_id, PERIODIC);
 
-	setup_sched_clock(s5p_read_sched_clock, 32, clock_rate);
+	setup_sched_clock(samsung_read_sched_clock, 32, clock_rate);
 
-	if (clocksource_mmio_init(s5p_timer_reg(), "s5p_clocksource_timer",
+	if (clocksource_mmio_init(samsung_timer_reg(), "samsung_clocksource_timer",
 			clock_rate, 250, 32, clocksource_mmio_readl_down))
-		panic("s5p_clocksource_timer: can't register clocksource\n");
+		panic("samsung_clocksource_timer: can't register clocksource\n");
 }
 
-static void __init s5p_timer_resources(void)
+static void __init samsung_timer_resources(void)
 {
 
 	unsigned long event_id = timer_source.event_id;
@@ -393,13 +393,13 @@ static void __init s5p_timer_resources(void)
 	clk_enable(tin_source);
 }
 
-static void __init s5p_timer_init(void)
+static void __init samsung_timer_init(void)
 {
-	s5p_timer_resources();
-	s5p_clockevent_init();
-	s5p_clocksource_init();
+	samsung_timer_resources();
+	samsung_clockevent_init();
+	samsung_clocksource_init();
 }
 
-struct sys_timer s5p_timer = {
-	.init		= s5p_timer_init,
+struct sys_timer samsung_timer = {
+	.init		= samsung_timer_init,
 };
-- 

^ permalink raw reply related	[flat|nested] 39+ messages in thread

* [PATCH 2/5 v2] Add samsung-time support for s3c24xx
  2012-11-27 23:57           ` Heiko Stübner
  2012-11-29 23:18             ` Romain Naour
  2012-12-02 19:44             ` [PATCH 1/5 v2] Rename s5p-time to samsung-time Romain Naour
@ 2012-12-02 19:44             ` Romain Naour
  2012-12-10 13:00               ` Heiko Stübner
  2012-12-02 19:44             ` [PATCH 3/5 v2] Add samsung-time support for s3c64xx Romain Naour
                               ` (3 subsequent siblings)
  6 siblings, 1 reply; 39+ messages in thread
From: Romain Naour @ 2012-12-02 19:44 UTC (permalink / raw)
  To: Heiko Stübner
  Cc: tomasz.figa, Kukjin Kim, linux-samsung-soc, ben-linux,
	'Sylwester Nawrocki'

This patch replace ARCH_USES_GETTIMEOFFSET by GENERIC_CLOCKEVENTS for s3c24xx devices.
It becomes possible to use the high-resolution timer and dynamic ticks.


Signed-off-by: Naour Romain <romain.naour@openwide.fr>

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index ade7e92..6563476 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -737,7 +737,8 @@ config ARCH_SA1100
 config ARCH_S3C24XX
 	bool "Samsung S3C24XX SoCs"
 	select ARCH_HAS_CPUFREQ
-	select ARCH_USES_GETTIMEOFFSET
+	select GENERIC_CLOCKEVENTS
+	select CLKSRC_MMIO
 	select CLKDEV_LOOKUP
 	select GENERIC_GPIO
 	select HAVE_CLK
diff --git a/arch/arm/mach-s3c24xx/Kconfig b/arch/arm/mach-s3c24xx/Kconfig
index 2b6cb5f..be2c482 100644
--- a/arch/arm/mach-s3c24xx/Kconfig
+++ b/arch/arm/mach-s3c24xx/Kconfig
@@ -21,6 +21,7 @@ config CPU_S3C2410
 	select S3C2410_CLOCK
 	select S3C2410_CPUFREQ if CPU_FREQ_S3C24XX
 	select S3C2410_PM if PM
+	select SAMSUNG_HRT
 	help
 	  Support for S3C2410 and S3C2410A family from the S3C24XX line
 	  of Samsung Mobile CPUs.
@@ -32,6 +33,7 @@ config CPU_S3C2412
 	select CPU_LLSERIAL_S3C2440
 	select S3C2412_DMA if S3C24XX_DMA
 	select S3C2412_PM if PM
+	select SAMSUNG_HRT
 	help
 	  Support for the S3C2412 and S3C2413 SoCs from the S3C24XX line
 
@@ -44,6 +46,7 @@ config CPU_S3C2416
 	select S3C2443_COMMON
 	select S3C2443_DMA if S3C24XX_DMA
 	select SAMSUNG_CLKSRC
+	select SAMSUNG_HRT
 	help
 	  Support for the S3C2416 SoC from the S3C24XX line
 
@@ -54,6 +57,7 @@ config CPU_S3C2440
 	select S3C2410_CLOCK
 	select S3C2410_PM if PM
 	select S3C2440_DMA if S3C24XX_DMA
+	select SAMSUNG_HRT
 	help
 	  Support for S3C2440 Samsung Mobile CPU based systems.
 
@@ -63,6 +67,7 @@ config CPU_S3C2442
 	select CPU_LLSERIAL_S3C2440
 	select S3C2410_CLOCK
 	select S3C2410_PM if PM
+	select SAMSUNG_HRT
 	help
 	  Support for S3C2442 Samsung Mobile CPU based systems.
 
@@ -78,6 +83,7 @@ config CPU_S3C2443
 	select S3C2443_COMMON
 	select S3C2443_DMA if S3C24XX_DMA
 	select SAMSUNG_CLKSRC
+	select SAMSUNG_HRT
 	help
 	  Support for the S3C2443 SoC from the S3C24XX line
 
diff --git a/arch/arm/mach-s3c24xx/mach-amlm5900.c b/arch/arm/mach-s3c24xx/mach-amlm5900.c
index f4ad99c..84c9bb0 100644
--- a/arch/arm/mach-s3c24xx/mach-amlm5900.c
+++ b/arch/arm/mach-s3c24xx/mach-amlm5900.c
@@ -63,6 +63,8 @@
 #include <linux/mtd/map.h>
 #include <linux/mtd/physmap.h>
 
+#include <plat/samsung-time.h>
+
 #include "common.h"
 
 static struct resource amlm5900_nor_resource =
@@ -160,6 +162,7 @@ static void __init amlm5900_map_io(void)
 	s3c24xx_init_io(amlm5900_iodesc, ARRAY_SIZE(amlm5900_iodesc));
 	s3c24xx_init_clocks(0);
 	s3c24xx_init_uarts(amlm5900_uartcfgs, ARRAY_SIZE(amlm5900_uartcfgs));
+	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
 }
 
 #ifdef CONFIG_FB_S3C2410
@@ -237,6 +240,6 @@ MACHINE_START(AML_M5900, "AML_M5900")
 	.map_io		= amlm5900_map_io,
 	.init_irq	= s3c24xx_init_irq,
 	.init_machine	= amlm5900_init,
-	.timer		= &s3c24xx_timer,
+	.timer		= &samsung_timer,
 	.restart	= s3c2410_restart,
 MACHINE_END
diff --git a/arch/arm/mach-s3c24xx/mach-anubis.c b/arch/arm/mach-s3c24xx/mach-anubis.c
index 1ee8c46..65ba844 100644
--- a/arch/arm/mach-s3c24xx/mach-anubis.c
+++ b/arch/arm/mach-s3c24xx/mach-anubis.c
@@ -54,6 +54,7 @@
 #include <plat/devs.h>
 #include <plat/cpu.h>
 #include <linux/platform_data/asoc-s3c24xx_simtec.h>
+#include <plat/samsung-time.h>
 
 #include "simtec.h"
 #include "common.h"
@@ -414,6 +415,7 @@ static void __init anubis_map_io(void)
 	s3c24xx_init_io(anubis_iodesc, ARRAY_SIZE(anubis_iodesc));
 	s3c24xx_init_clocks(0);
 	s3c24xx_init_uarts(anubis_uartcfgs, ARRAY_SIZE(anubis_uartcfgs));
+	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
 
 	/* check for the newer revision boards with large page nand */
 
@@ -448,6 +450,6 @@ MACHINE_START(ANUBIS, "Simtec-Anubis")
 	.map_io		= anubis_map_io,
 	.init_machine	= anubis_init,
 	.init_irq	= s3c24xx_init_irq,
-	.timer		= &s3c24xx_timer,
+	.timer		= &samsung_timer,
 	.restart	= s3c244x_restart,
 MACHINE_END
diff --git a/arch/arm/mach-s3c24xx/mach-at2440evb.c b/arch/arm/mach-s3c24xx/mach-at2440evb.c
index 00381fe..d7eb641 100644
--- a/arch/arm/mach-s3c24xx/mach-at2440evb.c
+++ b/arch/arm/mach-s3c24xx/mach-at2440evb.c
@@ -48,6 +48,7 @@
 #include <plat/devs.h>
 #include <plat/cpu.h>
 #include <linux/platform_data/mmc-s3cmci.h>
+#include <plat/samsung-time.h>
 
 #include "common.h"
 
@@ -192,6 +193,7 @@ static void __init at2440evb_map_io(void)
 	s3c24xx_init_io(at2440evb_iodesc, ARRAY_SIZE(at2440evb_iodesc));
 	s3c24xx_init_clocks(16934400);
 	s3c24xx_init_uarts(at2440evb_uartcfgs, ARRAY_SIZE(at2440evb_uartcfgs));
+	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
 }
 
 static void __init at2440evb_init(void)
@@ -210,6 +212,6 @@ MACHINE_START(AT2440EVB, "AT2440EVB")
 	.map_io		= at2440evb_map_io,
 	.init_machine	= at2440evb_init,
 	.init_irq	= s3c24xx_init_irq,
-	.timer		= &s3c24xx_timer,
+	.timer		= &samsung_timer,
 	.restart	= s3c244x_restart,
 MACHINE_END
diff --git a/arch/arm/mach-s3c24xx/mach-bast.c b/arch/arm/mach-s3c24xx/mach-bast.c
index 6a30ce7..a9c442e 100644
--- a/arch/arm/mach-s3c24xx/mach-bast.c
+++ b/arch/arm/mach-s3c24xx/mach-bast.c
@@ -63,6 +63,7 @@
 #include <plat/cpu-freq.h>
 #include <plat/gpio-cfg.h>
 #include <linux/platform_data/asoc-s3c24xx_simtec.h>
+#include <plat/samsung-time.h>
 
 #include "simtec.h"
 #include "common.h"
@@ -583,6 +584,7 @@ static void __init bast_map_io(void)
 	s3c24xx_init_io(bast_iodesc, ARRAY_SIZE(bast_iodesc));
 	s3c24xx_init_clocks(0);
 	s3c24xx_init_uarts(bast_uartcfgs, ARRAY_SIZE(bast_uartcfgs));
+	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
 }
 
 static void __init bast_init(void)
@@ -612,6 +614,6 @@ MACHINE_START(BAST, "Simtec-BAST")
 	.map_io		= bast_map_io,
 	.init_irq	= s3c24xx_init_irq,
 	.init_machine	= bast_init,
-	.timer		= &s3c24xx_timer,
+	.timer		= &samsung_timer,
 	.restart	= s3c2410_restart,
 MACHINE_END
diff --git a/arch/arm/mach-s3c24xx/mach-gta02.c b/arch/arm/mach-s3c24xx/mach-gta02.c
index 4a96346..02c6c6a 100644
--- a/arch/arm/mach-s3c24xx/mach-gta02.c
+++ b/arch/arm/mach-s3c24xx/mach-gta02.c
@@ -88,6 +88,7 @@
 #include <plat/gpio-cfg.h>
 #include <linux/platform_data/i2c-s3c2410.h>
 #include <linux/platform_data/touchscreen-s3c2410.h>
+#include <plat/samsung-time.h>
 
 #include "common.h"
 
@@ -507,6 +508,7 @@ static void __init gta02_map_io(void)
 	s3c24xx_init_io(gta02_iodesc, ARRAY_SIZE(gta02_iodesc));
 	s3c24xx_init_clocks(12000000);
 	s3c24xx_init_uarts(gta02_uartcfgs, ARRAY_SIZE(gta02_uartcfgs));
+	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
 }
 
 
@@ -596,6 +598,6 @@ MACHINE_START(NEO1973_GTA02, "GTA02")
 	.map_io		= gta02_map_io,
 	.init_irq	= s3c24xx_init_irq,
 	.init_machine	= gta02_machine_init,
-	.timer		= &s3c24xx_timer,
+	.timer		= &samsung_timer,
 	.restart	= s3c244x_restart,
 MACHINE_END
diff --git a/arch/arm/mach-s3c24xx/mach-h1940.c b/arch/arm/mach-s3c24xx/mach-h1940.c
index 63aaf07..f5d3578 100644
--- a/arch/arm/mach-s3c24xx/mach-h1940.c
+++ b/arch/arm/mach-s3c24xx/mach-h1940.c
@@ -67,6 +67,7 @@
 #include <plat/pm.h>
 #include <linux/platform_data/mmc-s3cmci.h>
 #include <linux/platform_data/touchscreen-s3c2410.h>
+#include <plat/samsung-time.h>
 
 #include <sound/uda1380.h>
 
@@ -652,6 +653,7 @@ static void __init h1940_map_io(void)
 	s3c24xx_init_io(h1940_iodesc, ARRAY_SIZE(h1940_iodesc));
 	s3c24xx_init_clocks(0);
 	s3c24xx_init_uarts(h1940_uartcfgs, ARRAY_SIZE(h1940_uartcfgs));
+	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
 
 	/* setup PM */
 
@@ -747,6 +749,6 @@ MACHINE_START(H1940, "IPAQ-H1940")
 	.reserve	= h1940_reserve,
 	.init_irq	= h1940_init_irq,
 	.init_machine	= h1940_init,
-	.timer		= &s3c24xx_timer,
+	.timer		= &samsung_timer,
 	.restart	= s3c2410_restart,
 MACHINE_END
diff --git a/arch/arm/mach-s3c24xx/mach-jive.c b/arch/arm/mach-s3c24xx/mach-jive.c
index c9954e2..01a894d 100644
--- a/arch/arm/mach-s3c24xx/mach-jive.c
+++ b/arch/arm/mach-s3c24xx/mach-jive.c
@@ -55,6 +55,7 @@
 #include <plat/cpu.h>
 #include <plat/pm.h>
 #include <linux/platform_data/usb-s3c2410_udc.h>
+#include <plat/samsung-time.h>
 
 static struct map_desc jive_iodesc[] __initdata = {
 };
@@ -506,6 +507,7 @@ static void __init jive_map_io(void)
 	s3c24xx_init_io(jive_iodesc, ARRAY_SIZE(jive_iodesc));
 	s3c24xx_init_clocks(12000000);
 	s3c24xx_init_uarts(jive_uartcfgs, ARRAY_SIZE(jive_uartcfgs));
+	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
 }
 
 static void jive_power_off(void)
@@ -661,6 +663,6 @@ MACHINE_START(JIVE, "JIVE")
 	.init_irq	= s3c24xx_init_irq,
 	.map_io		= jive_map_io,
 	.init_machine	= jive_machine_init,
-	.timer		= &s3c24xx_timer,
+	.timer		= &samsung_timer,
 	.restart	= s3c2412_restart,
 MACHINE_END
diff --git a/arch/arm/mach-s3c24xx/mach-mini2440.c b/arch/arm/mach-s3c24xx/mach-mini2440.c
index 393c0f1..a96efcd 100644
--- a/arch/arm/mach-s3c24xx/mach-mini2440.c
+++ b/arch/arm/mach-s3c24xx/mach-mini2440.c
@@ -57,6 +57,7 @@
 #include <plat/clock.h>
 #include <plat/devs.h>
 #include <plat/cpu.h>
+#include <plat/samsung-time.h>
 
 #include <sound/s3c24xx_uda134x.h>
 
@@ -527,6 +528,7 @@ static void __init mini2440_map_io(void)
 	s3c24xx_init_io(mini2440_iodesc, ARRAY_SIZE(mini2440_iodesc));
 	s3c24xx_init_clocks(12000000);
 	s3c24xx_init_uarts(mini2440_uartcfgs, ARRAY_SIZE(mini2440_uartcfgs));
+	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
 }
 
 /*
@@ -689,6 +691,6 @@ MACHINE_START(MINI2440, "MINI2440")
 	.map_io		= mini2440_map_io,
 	.init_machine	= mini2440_init,
 	.init_irq	= s3c24xx_init_irq,
-	.timer		= &s3c24xx_timer,
+	.timer		= &samsung_timer,
 	.restart	= s3c244x_restart,
 MACHINE_END
diff --git a/arch/arm/mach-s3c24xx/mach-n30.c b/arch/arm/mach-s3c24xx/mach-n30.c
index c53a9bf..f6cea03 100644
--- a/arch/arm/mach-s3c24xx/mach-n30.c
+++ b/arch/arm/mach-s3c24xx/mach-n30.c
@@ -50,6 +50,7 @@
 #include <linux/platform_data/mmc-s3cmci.h>
 #include <plat/s3c2410.h>
 #include <linux/platform_data/usb-s3c2410_udc.h>
+#include <plat/samsung-time.h>
 
 #include "common.h"
 
@@ -536,6 +537,7 @@ static void __init n30_map_io(void)
 	n30_hwinit();
 	s3c24xx_init_clocks(0);
 	s3c24xx_init_uarts(n30_uartcfgs, ARRAY_SIZE(n30_uartcfgs));
+	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
 }
 
 /* GPB3 is the line that controls the pull-up for the USB D+ line */
@@ -589,7 +591,7 @@ MACHINE_START(N30, "Acer-N30")
 				Ben Dooks <ben-linux@fluff.org>
 	*/
 	.atag_offset	= 0x100,
-	.timer		= &s3c24xx_timer,
+	.timer		= &samsung_timer,
 	.init_machine	= n30_init,
 	.init_irq	= s3c24xx_init_irq,
 	.map_io		= n30_map_io,
@@ -600,7 +602,7 @@ MACHINE_START(N35, "Acer-N35")
 	/* Maintainer: Christer Weinigel <christer@weinigel.se>
 	*/
 	.atag_offset	= 0x100,
-	.timer		= &s3c24xx_timer,
+	.timer		= &samsung_timer,
 	.init_machine	= n30_init,
 	.init_irq	= s3c24xx_init_irq,
 	.map_io		= n30_map_io,
diff --git a/arch/arm/mach-s3c24xx/mach-nexcoder.c b/arch/arm/mach-s3c24xx/mach-nexcoder.c
index a2b92b0..4db6fb3 100644
--- a/arch/arm/mach-s3c24xx/mach-nexcoder.c
+++ b/arch/arm/mach-s3c24xx/mach-nexcoder.c
@@ -46,6 +46,7 @@
 #include <plat/clock.h>
 #include <plat/devs.h>
 #include <plat/cpu.h>
+#include <plat/samsung-time.h>
 
 #include "common.h"
 
@@ -137,6 +138,7 @@ static void __init nexcoder_map_io(void)
 	s3c24xx_init_io(nexcoder_iodesc, ARRAY_SIZE(nexcoder_iodesc));
 	s3c24xx_init_clocks(0);
 	s3c24xx_init_uarts(nexcoder_uartcfgs, ARRAY_SIZE(nexcoder_uartcfgs));
+	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
 
 	nexcoder_sensorboard_init();
 }
@@ -153,6 +155,6 @@ MACHINE_START(NEXCODER_2440, "NexVision - Nexcoder 2440")
 	.map_io		= nexcoder_map_io,
 	.init_machine	= nexcoder_init,
 	.init_irq	= s3c24xx_init_irq,
-	.timer		= &s3c24xx_timer,
+	.timer		= &samsung_timer,
 	.restart	= s3c244x_restart,
 MACHINE_END
diff --git a/arch/arm/mach-s3c24xx/mach-osiris.c b/arch/arm/mach-s3c24xx/mach-osiris.c
index bb36d83..e85144e 100644
--- a/arch/arm/mach-s3c24xx/mach-osiris.c
+++ b/arch/arm/mach-s3c24xx/mach-osiris.c
@@ -53,6 +53,7 @@
 #include <plat/clock.h>
 #include <plat/devs.h>
 #include <plat/cpu.h>
+#include <plat/samsung-time.h>
 
 #include "common.h"
 
@@ -386,6 +387,7 @@ static void __init osiris_map_io(void)
 	s3c24xx_init_io(osiris_iodesc, ARRAY_SIZE(osiris_iodesc));
 	s3c24xx_init_clocks(0);
 	s3c24xx_init_uarts(osiris_uartcfgs, ARRAY_SIZE(osiris_uartcfgs));
+	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
 
 	/* check for the newer revision boards with large page nand */
 
@@ -428,6 +430,6 @@ MACHINE_START(OSIRIS, "Simtec-OSIRIS")
 	.map_io		= osiris_map_io,
 	.init_irq	= s3c24xx_init_irq,
 	.init_machine	= osiris_init,
-	.timer		= &s3c24xx_timer,
+	.timer		= &samsung_timer,
 	.restart	= s3c244x_restart,
 MACHINE_END
diff --git a/arch/arm/mach-s3c24xx/mach-otom.c b/arch/arm/mach-s3c24xx/mach-otom.c
index bca39f0..ab5f353 100644
--- a/arch/arm/mach-s3c24xx/mach-otom.c
+++ b/arch/arm/mach-s3c24xx/mach-otom.c
@@ -37,6 +37,7 @@
 #include <plat/devs.h>
 #include <linux/platform_data/i2c-s3c2410.h>
 #include <plat/cpu.h>
+#include <plat/samsung-time.h>
 
 #include "common.h"
 
@@ -104,6 +105,7 @@ static void __init otom11_map_io(void)
 	s3c24xx_init_io(otom11_iodesc, ARRAY_SIZE(otom11_iodesc));
 	s3c24xx_init_clocks(0);
 	s3c24xx_init_uarts(otom11_uartcfgs, ARRAY_SIZE(otom11_uartcfgs));
+	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
 }
 
 static void __init otom11_init(void)
@@ -118,6 +120,6 @@ MACHINE_START(OTOM, "Nex Vision - Otom 1.1")
 	.map_io		= otom11_map_io,
 	.init_machine	= otom11_init,
 	.init_irq	= s3c24xx_init_irq,
-	.timer		= &s3c24xx_timer,
+	.timer		= &samsung_timer,
 	.restart	= s3c2410_restart,
 MACHINE_END
diff --git a/arch/arm/mach-s3c24xx/mach-qt2410.c b/arch/arm/mach-s3c24xx/mach-qt2410.c
index 7b6ba13..e725554 100644
--- a/arch/arm/mach-s3c24xx/mach-qt2410.c
+++ b/arch/arm/mach-s3c24xx/mach-qt2410.c
@@ -60,6 +60,7 @@
 #include <plat/devs.h>
 #include <plat/cpu.h>
 #include <plat/pm.h>
+#include <plat/samsung-time.h>
 
 #include "common.h"
 
@@ -304,6 +305,7 @@ static void __init qt2410_map_io(void)
 	s3c24xx_init_io(qt2410_iodesc, ARRAY_SIZE(qt2410_iodesc));
 	s3c24xx_init_clocks(12*1000*1000);
 	s3c24xx_init_uarts(smdk2410_uartcfgs, ARRAY_SIZE(smdk2410_uartcfgs));
+	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
 }
 
 static void __init qt2410_machine_init(void)
@@ -343,6 +345,6 @@ MACHINE_START(QT2410, "QT2410")
 	.map_io		= qt2410_map_io,
 	.init_irq	= s3c24xx_init_irq,
 	.init_machine	= qt2410_machine_init,
-	.timer		= &s3c24xx_timer,
+	.timer		= &samsung_timer,
 	.restart	= s3c2410_restart,
 MACHINE_END
diff --git a/arch/arm/mach-s3c24xx/mach-rx1950.c b/arch/arm/mach-s3c24xx/mach-rx1950.c
index 379fde5..63fbeb1 100644
--- a/arch/arm/mach-s3c24xx/mach-rx1950.c
+++ b/arch/arm/mach-s3c24xx/mach-rx1950.c
@@ -58,6 +58,7 @@
 #include <plat/pm.h>
 #include <plat/irq.h>
 #include <linux/platform_data/touchscreen-s3c2410.h>
+#include <plat/samsung-time.h>
 
 #include <sound/uda1380.h>
 
@@ -743,6 +744,7 @@ static void __init rx1950_map_io(void)
 	s3c24xx_init_io(rx1950_iodesc, ARRAY_SIZE(rx1950_iodesc));
 	s3c24xx_init_clocks(16934000);
 	s3c24xx_init_uarts(rx1950_uartcfgs, ARRAY_SIZE(rx1950_uartcfgs));
+	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
 
 	/* setup PM */
 
@@ -815,6 +817,6 @@ MACHINE_START(RX1950, "HP iPAQ RX1950")
 	.reserve	= rx1950_reserve,
 	.init_irq = s3c24xx_init_irq,
 	.init_machine = rx1950_init_machine,
-	.timer = &s3c24xx_timer,
+	.timer = &samsung_timer,
 	.restart	= s3c244x_restart,
 MACHINE_END
diff --git a/arch/arm/mach-s3c24xx/mach-rx3715.c b/arch/arm/mach-s3c24xx/mach-rx3715.c
index dacbb9a..1b358a1 100644
--- a/arch/arm/mach-s3c24xx/mach-rx3715.c
+++ b/arch/arm/mach-s3c24xx/mach-rx3715.c
@@ -50,6 +50,7 @@
 #include <plat/devs.h>
 #include <plat/cpu.h>
 #include <plat/pm.h>
+#include <plat/samsung-time.h>
 
 #include "common.h"
 
@@ -179,6 +180,7 @@ static void __init rx3715_map_io(void)
 	s3c24xx_init_io(rx3715_iodesc, ARRAY_SIZE(rx3715_iodesc));
 	s3c24xx_init_clocks(16934000);
 	s3c24xx_init_uarts(rx3715_uartcfgs, ARRAY_SIZE(rx3715_uartcfgs));
+	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
 }
 
 /* H1940 and RX3715 need to reserve this for suspend */
@@ -212,6 +214,6 @@ MACHINE_START(RX3715, "IPAQ-RX3715")
 	.reserve	= rx3715_reserve,
 	.init_irq	= rx3715_init_irq,
 	.init_machine	= rx3715_init_machine,
-	.timer		= &s3c24xx_timer,
+	.timer		= &samsung_timer,
 	.restart	= s3c244x_restart,
 MACHINE_END
diff --git a/arch/arm/mach-s3c24xx/mach-smdk2410.c b/arch/arm/mach-s3c24xx/mach-smdk2410.c
index 82796b9..c7a18bc 100644
--- a/arch/arm/mach-s3c24xx/mach-smdk2410.c
+++ b/arch/arm/mach-s3c24xx/mach-smdk2410.c
@@ -53,6 +53,7 @@
 #include <plat/cpu.h>
 
 #include <plat/common-smdk.h>
+#include <plat/samsung-time.h>
 
 #include "common.h"
 
@@ -101,6 +102,7 @@ static void __init smdk2410_map_io(void)
 	s3c24xx_init_io(smdk2410_iodesc, ARRAY_SIZE(smdk2410_iodesc));
 	s3c24xx_init_clocks(0);
 	s3c24xx_init_uarts(smdk2410_uartcfgs, ARRAY_SIZE(smdk2410_uartcfgs));
+	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
 }
 
 static void __init smdk2410_init(void)
@@ -117,6 +119,6 @@ MACHINE_START(SMDK2410, "SMDK2410") /* @TODO: request a new identifier and switc
 	.map_io		= smdk2410_map_io,
 	.init_irq	= s3c24xx_init_irq,
 	.init_machine	= smdk2410_init,
-	.timer		= &s3c24xx_timer,
+	.timer		= &samsung_timer,
 	.restart	= s3c2410_restart,
 MACHINE_END
diff --git a/arch/arm/mach-s3c24xx/mach-smdk2413.c b/arch/arm/mach-s3c24xx/mach-smdk2413.c
index ce99fd8..c29c067 100644
--- a/arch/arm/mach-s3c24xx/mach-smdk2413.c
+++ b/arch/arm/mach-s3c24xx/mach-smdk2413.c
@@ -47,6 +47,7 @@
 #include <plat/clock.h>
 #include <plat/devs.h>
 #include <plat/cpu.h>
+#include <plat/samsung-time.h>
 
 #include <plat/common-smdk.h>
 
@@ -107,6 +108,7 @@ static void __init smdk2413_map_io(void)
 	s3c24xx_init_io(smdk2413_iodesc, ARRAY_SIZE(smdk2413_iodesc));
 	s3c24xx_init_clocks(12000000);
 	s3c24xx_init_uarts(smdk2413_uartcfgs, ARRAY_SIZE(smdk2413_uartcfgs));
+	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
 }
 
 static void __init smdk2413_machine_init(void)
@@ -133,7 +135,7 @@ MACHINE_START(S3C2413, "S3C2413")
 	.init_irq	= s3c24xx_init_irq,
 	.map_io		= smdk2413_map_io,
 	.init_machine	= smdk2413_machine_init,
-	.timer		= &s3c24xx_timer,
+	.timer		= &samsung_timer,
 	.restart	= s3c2412_restart,
 MACHINE_END
 
@@ -145,7 +147,7 @@ MACHINE_START(SMDK2412, "SMDK2412")
 	.init_irq	= s3c24xx_init_irq,
 	.map_io		= smdk2413_map_io,
 	.init_machine	= smdk2413_machine_init,
-	.timer		= &s3c24xx_timer,
+	.timer		= &samsung_timer,
 	.restart	= s3c2412_restart,
 MACHINE_END
 
@@ -157,6 +159,6 @@ MACHINE_START(SMDK2413, "SMDK2413")
 	.init_irq	= s3c24xx_init_irq,
 	.map_io		= smdk2413_map_io,
 	.init_machine	= smdk2413_machine_init,
-	.timer		= &s3c24xx_timer,
+	.timer		= &samsung_timer,
 	.restart	= s3c2412_restart,
 MACHINE_END
diff --git a/arch/arm/mach-s3c24xx/mach-smdk2416.c b/arch/arm/mach-s3c24xx/mach-smdk2416.c
index f30d7fc..2c0b7a1 100644
--- a/arch/arm/mach-s3c24xx/mach-smdk2416.c
+++ b/arch/arm/mach-s3c24xx/mach-smdk2416.c
@@ -52,6 +52,7 @@
 #include <plat/sdhci.h>
 #include <linux/platform_data/usb-s3c2410_udc.h>
 #include <linux/platform_data/s3c-hsudc.h>
+#include <plat/samsung-time.h>
 
 #include <plat/fb.h>
 
@@ -222,6 +223,7 @@ static void __init smdk2416_map_io(void)
 	s3c24xx_init_io(smdk2416_iodesc, ARRAY_SIZE(smdk2416_iodesc));
 	s3c24xx_init_clocks(12000000);
 	s3c24xx_init_uarts(smdk2416_uartcfgs, ARRAY_SIZE(smdk2416_uartcfgs));
+	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
 }
 
 static void __init smdk2416_machine_init(void)
@@ -254,6 +256,6 @@ MACHINE_START(SMDK2416, "SMDK2416")
 	.init_irq	= s3c24xx_init_irq,
 	.map_io		= smdk2416_map_io,
 	.init_machine	= smdk2416_machine_init,
-	.timer		= &s3c24xx_timer,
+	.timer		= &samsung_timer,
 	.restart	= s3c2416_restart,
 MACHINE_END
diff --git a/arch/arm/mach-s3c24xx/mach-smdk2440.c b/arch/arm/mach-s3c24xx/mach-smdk2440.c
index b7ff882..caf5c04 100644
--- a/arch/arm/mach-s3c24xx/mach-smdk2440.c
+++ b/arch/arm/mach-s3c24xx/mach-smdk2440.c
@@ -44,6 +44,7 @@
 #include <plat/clock.h>
 #include <plat/devs.h>
 #include <plat/cpu.h>
+#include <plat/samsung-time.h>
 
 #include <plat/common-smdk.h>
 
@@ -164,6 +165,7 @@ static void __init smdk2440_map_io(void)
 	s3c24xx_init_io(smdk2440_iodesc, ARRAY_SIZE(smdk2440_iodesc));
 	s3c24xx_init_clocks(16934400);
 	s3c24xx_init_uarts(smdk2440_uartcfgs, ARRAY_SIZE(smdk2440_uartcfgs));
+	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
 }
 
 static void __init smdk2440_machine_init(void)
@@ -182,6 +184,6 @@ MACHINE_START(S3C2440, "SMDK2440")
 	.init_irq	= s3c24xx_init_irq,
 	.map_io		= smdk2440_map_io,
 	.init_machine	= smdk2440_machine_init,
-	.timer		= &s3c24xx_timer,
+	.timer		= &samsung_timer,
 	.restart	= s3c244x_restart,
 MACHINE_END
diff --git a/arch/arm/mach-s3c24xx/mach-smdk2443.c b/arch/arm/mach-s3c24xx/mach-smdk2443.c
index 2568656..02fcd27 100644
--- a/arch/arm/mach-s3c24xx/mach-smdk2443.c
+++ b/arch/arm/mach-s3c24xx/mach-smdk2443.c
@@ -44,6 +44,7 @@
 #include <plat/clock.h>
 #include <plat/devs.h>
 #include <plat/cpu.h>
+#include <plat/samsung-time.h>
 
 #include <plat/common-smdk.h>
 
@@ -123,6 +124,7 @@ static void __init smdk2443_map_io(void)
 	s3c24xx_init_io(smdk2443_iodesc, ARRAY_SIZE(smdk2443_iodesc));
 	s3c24xx_init_clocks(12000000);
 	s3c24xx_init_uarts(smdk2443_uartcfgs, ARRAY_SIZE(smdk2443_uartcfgs));
+	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
 }
 
 static void __init smdk2443_machine_init(void)
@@ -144,6 +146,6 @@ MACHINE_START(SMDK2443, "SMDK2443")
 	.init_irq	= s3c24xx_init_irq,
 	.map_io		= smdk2443_map_io,
 	.init_machine	= smdk2443_machine_init,
-	.timer		= &s3c24xx_timer,
+	.timer		= &samsung_timer,
 	.restart	= s3c2443_restart,
 MACHINE_END
diff --git a/arch/arm/mach-s3c24xx/mach-tct_hammer.c b/arch/arm/mach-s3c24xx/mach-tct_hammer.c
index 495bf5c..90f43c9 100644
--- a/arch/arm/mach-s3c24xx/mach-tct_hammer.c
+++ b/arch/arm/mach-s3c24xx/mach-tct_hammer.c
@@ -53,6 +53,7 @@
 #include <linux/mtd/partitions.h>
 #include <linux/mtd/map.h>
 #include <linux/mtd/physmap.h>
+#include <plat/samsung-time.h>
 
 #include "common.h"
 
@@ -136,6 +137,7 @@ static void __init tct_hammer_map_io(void)
 	s3c24xx_init_io(tct_hammer_iodesc, ARRAY_SIZE(tct_hammer_iodesc));
 	s3c24xx_init_clocks(0);
 	s3c24xx_init_uarts(tct_hammer_uartcfgs, ARRAY_SIZE(tct_hammer_uartcfgs));
+	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
 }
 
 static void __init tct_hammer_init(void)
@@ -149,6 +151,6 @@ MACHINE_START(TCT_HAMMER, "TCT_HAMMER")
 	.map_io		= tct_hammer_map_io,
 	.init_irq	= s3c24xx_init_irq,
 	.init_machine	= tct_hammer_init,
-	.timer		= &s3c24xx_timer,
+	.timer		= &samsung_timer,
 	.restart	= s3c2410_restart,
 MACHINE_END
diff --git a/arch/arm/mach-s3c24xx/mach-vr1000.c b/arch/arm/mach-s3c24xx/mach-vr1000.c
index 14d5b12..4366c6f 100644
--- a/arch/arm/mach-s3c24xx/mach-vr1000.c
+++ b/arch/arm/mach-s3c24xx/mach-vr1000.c
@@ -50,6 +50,7 @@
 #include <plat/cpu.h>
 #include <linux/platform_data/i2c-s3c2410.h>
 #include <linux/platform_data/asoc-s3c24xx_simtec.h>
+#include <plat/samsung-time.h>
 
 #include "simtec.h"
 #include "common.h"
@@ -335,6 +336,7 @@ static void __init vr1000_map_io(void)
 	s3c24xx_init_io(vr1000_iodesc, ARRAY_SIZE(vr1000_iodesc));
 	s3c24xx_init_clocks(0);
 	s3c24xx_init_uarts(vr1000_uartcfgs, ARRAY_SIZE(vr1000_uartcfgs));
+	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
 }
 
 static void __init vr1000_init(void)
@@ -357,6 +359,6 @@ MACHINE_START(VR1000, "Thorcom-VR1000")
 	.map_io		= vr1000_map_io,
 	.init_machine	= vr1000_init,
 	.init_irq	= s3c24xx_init_irq,
-	.timer		= &s3c24xx_timer,
+	.timer		= &samsung_timer,
 	.restart	= s3c2410_restart,
 MACHINE_END
diff --git a/arch/arm/mach-s3c24xx/mach-vstms.c b/arch/arm/mach-s3c24xx/mach-vstms.c
index f1d44ae..412d858 100644
--- a/arch/arm/mach-s3c24xx/mach-vstms.c
+++ b/arch/arm/mach-s3c24xx/mach-vstms.c
@@ -47,7 +47,7 @@
 #include <plat/clock.h>
 #include <plat/devs.h>
 #include <plat/cpu.h>
-
+#include <plat/samsung-time.h>
 
 static struct map_desc vstms_iodesc[] __initdata = {
 };
@@ -144,6 +144,7 @@ static void __init vstms_map_io(void)
 	s3c24xx_init_io(vstms_iodesc, ARRAY_SIZE(vstms_iodesc));
 	s3c24xx_init_clocks(12000000);
 	s3c24xx_init_uarts(vstms_uartcfgs, ARRAY_SIZE(vstms_uartcfgs));
+	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
 }
 
 static void __init vstms_init(void)
@@ -161,6 +162,6 @@ MACHINE_START(VSTMS, "VSTMS")
 	.init_irq	= s3c24xx_init_irq,
 	.init_machine	= vstms_init,
 	.map_io		= vstms_map_io,
-	.timer		= &s3c24xx_timer,
+	.timer		= &samsung_timer,
 	.restart	= s3c2412_restart,
 MACHINE_END
diff --git a/arch/arm/plat-samsung/include/plat/cpu.h b/arch/arm/plat-samsung/include/plat/cpu.h
index ace4451..86fb5f3 100644
--- a/arch/arm/plat-samsung/include/plat/cpu.h
+++ b/arch/arm/plat-samsung/include/plat/cpu.h
@@ -184,7 +184,7 @@ extern void s3c24xx_init_uartdevs(char *name,
 				  struct s3c24xx_uart_resources *res,
 				  struct s3c2410_uartcfg *cfg, int no);
 
-/* timer for 2410/2440 */
+/* timer for s5pc100 only */
 
 struct sys_timer;
 extern struct sys_timer s3c24xx_timer;
diff --git a/arch/arm/plat-samsung/include/plat/samsung-time.h b/arch/arm/plat-samsung/include/plat/samsung-time.h
index 9d6d622..13ae4b9 100644
--- a/arch/arm/plat-samsung/include/plat/samsung-time.h
+++ b/arch/arm/plat-samsung/include/plat/samsung-time.h
@@ -30,7 +30,18 @@ struct samsung_timer_source {
 /* Be able to sleep for atleast 4 seconds (usually more) */
 #define SAMSUNG_TIMER_MIN_RANGE	4
 
+#ifdef CONFIG_ARCH_S3C24XX
+#define TCNT_MAX		0xffff
+#define TSCALER_DIV		25
+#define TDIV			50
+#define TSIZE			16
+#else
 #define TCNT_MAX		0xffffffff
+#define TSCALER_DIV		2
+#define TDIV			2
+#define TSIZE			32
+#endif
+
 #define NON_PERIODIC		0
 #define PERIODIC		1
 
diff --git a/arch/arm/plat-samsung/samsung-time.c b/arch/arm/plat-samsung/samsung-time.c
index 91773bf..6d63fca 100644
--- a/arch/arm/plat-samsung/samsung-time.c
+++ b/arch/arm/plat-samsung/samsung-time.c
@@ -2,7 +2,7 @@
  * Copyright (c) 2011 Samsung Electronics Co., Ltd.
  *		http://www.samsung.com/
  *
- * SAMSUNG - Common hr-timer support
+ * samsung - Common hr-timer support (s3c and s5p)
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License version 2 as
@@ -267,8 +267,8 @@ static void __init samsung_clockevent_init(void)
 
 	tscaler = clk_get_parent(tdiv_event);
 
-	clk_set_rate(tscaler, pclk / 2);
-	clk_set_rate(tdiv_event, pclk / 2);
+	clk_set_rate(tscaler, pclk / TSCALER_DIV);
+	clk_set_rate(tdiv_event, pclk / TDIV);
 	clk_set_parent(tin_event, tdiv_event);
 
 	clock_rate = clk_get_rate(tin_event);
@@ -336,7 +336,7 @@ static void __init samsung_clocksource_init(void)
 
 	pclk = clk_get_rate(timerclk);
 
-	clk_set_rate(tdiv_source, pclk / 2);
+	clk_set_rate(tdiv_source, pclk / TDIV);
 	clk_set_parent(tin_source, tdiv_source);
 
 	clock_rate = clk_get_rate(tin_source);
@@ -344,10 +344,10 @@ static void __init samsung_clocksource_init(void)
 	samsung_time_setup(timer_source.source_id, TCNT_MAX);
 	samsung_time_start(timer_source.source_id, PERIODIC);
 
-	setup_sched_clock(samsung_read_sched_clock, 32, clock_rate);
+	setup_sched_clock(samsung_read_sched_clock, TSIZE, clock_rate);
 
 	if (clocksource_mmio_init(samsung_timer_reg(), "samsung_clocksource_timer",
-			clock_rate, 250, 32, clocksource_mmio_readl_down))
+			clock_rate, 250, TSIZE, clocksource_mmio_readl_down))
 		panic("samsung_clocksource_timer: can't register clocksource\n");
 }
 
-- 

^ permalink raw reply related	[flat|nested] 39+ messages in thread

* [PATCH 3/5 v2] Add samsung-time support for s3c64xx
  2012-11-27 23:57           ` Heiko Stübner
                               ` (2 preceding siblings ...)
  2012-12-02 19:44             ` [PATCH 2/5 v2] Add samsung-time support for s3c24xx Romain Naour
@ 2012-12-02 19:44             ` Romain Naour
  2012-12-02 19:44             ` [PATCH 4/5 v2] Add samsung-time support for s5pc100 Romain Naour
                               ` (2 subsequent siblings)
  6 siblings, 0 replies; 39+ messages in thread
From: Romain Naour @ 2012-12-02 19:44 UTC (permalink / raw)
  To: Heiko Stübner
  Cc: tomasz.figa, Kukjin Kim, linux-samsung-soc, ben-linux,
	'Sylwester Nawrocki'

This patch replace ARCH_USES_GETTIMEOFFSET by GENERIC_CLOCKEVENTS for s3c64xx devices.
It becomes possible to use the high-resolution timer and dynamic ticks.


Signed-off-by: Naour Romain <romain.naour@openwide.fr>

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 6563476..6e00aea 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -757,7 +757,8 @@ config ARCH_S3C64XX
 	bool "Samsung S3C64XX"
 	select ARCH_HAS_CPUFREQ
 	select ARCH_REQUIRE_GPIOLIB
-	select ARCH_USES_GETTIMEOFFSET
+	select GENERIC_CLOCKEVENTS
+	select CLKSRC_MMIO
 	select ARM_VIC
 	select CLKDEV_LOOKUP
 	select CPU_V6
diff --git a/arch/arm/mach-s3c64xx/Kconfig b/arch/arm/mach-s3c64xx/Kconfig
index 63e7ae3..7b0dbbf3 100644
--- a/arch/arm/mach-s3c64xx/Kconfig
+++ b/arch/arm/mach-s3c64xx/Kconfig
@@ -17,11 +17,13 @@ config PLAT_S3C64XX
 # Configuration options for the S3C6410 CPU
 
 config CPU_S3C6400
+	select SAMSUNG_HRT
 	bool
 	help
 	  Enable S3C6400 CPU support
 
 config CPU_S3C6410
+	select SAMSUNG_HRT
 	bool
 	help
 	  Enable S3C6410 CPU support
diff --git a/arch/arm/mach-s3c64xx/mach-anw6410.c b/arch/arm/mach-s3c64xx/mach-anw6410.c
index 99e82ac..cfe8315 100644
--- a/arch/arm/mach-s3c64xx/mach-anw6410.c
+++ b/arch/arm/mach-s3c64xx/mach-anw6410.c
@@ -51,6 +51,7 @@
 #include <plat/cpu.h>
 #include <mach/regs-gpio.h>
 #include <mach/regs-modem.h>
+#include <plat/samsung-time.h>
 
 #include "common.h"
 
@@ -209,6 +210,7 @@ static void __init anw6410_map_io(void)
 	s3c64xx_init_io(anw6410_iodesc, ARRAY_SIZE(anw6410_iodesc));
 	s3c24xx_init_clocks(12000000);
 	s3c24xx_init_uarts(anw6410_uartcfgs, ARRAY_SIZE(anw6410_uartcfgs));
+	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
 
 	anw6410_lcd_mode_set();
 }
@@ -234,6 +236,6 @@ MACHINE_START(ANW6410, "A&W6410")
 	.map_io		= anw6410_map_io,
 	.init_machine	= anw6410_machine_init,
 	.init_late	= s3c64xx_init_late,
-	.timer		= &s3c24xx_timer,
+	.timer		= &samsung_timer,
 	.restart	= s3c64xx_restart,
 MACHINE_END
diff --git a/arch/arm/mach-s3c64xx/mach-crag6410.c b/arch/arm/mach-s3c64xx/mach-crag6410.c
index 13b7eaa..59c94a6 100644
--- a/arch/arm/mach-s3c64xx/mach-crag6410.c
+++ b/arch/arm/mach-s3c64xx/mach-crag6410.c
@@ -70,6 +70,7 @@
 #include <plat/adc.h>
 #include <linux/platform_data/i2c-s3c2410.h>
 #include <plat/pm.h>
+#include <plat/samsung-time.h>
 
 #include "common.h"
 
@@ -704,6 +705,7 @@ static void __init crag6410_map_io(void)
 	s3c64xx_init_io(NULL, 0);
 	s3c24xx_init_clocks(12000000);
 	s3c24xx_init_uarts(crag6410_uartcfgs, ARRAY_SIZE(crag6410_uartcfgs));
+	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
 
 	/* LCD type and Bypass set by bootloader */
 }
@@ -829,6 +831,6 @@ MACHINE_START(WLF_CRAGG_6410, "Wolfson Cragganmore 6410")
 	.map_io		= crag6410_map_io,
 	.init_machine	= crag6410_machine_init,
 	.init_late	= s3c64xx_init_late,
-	.timer		= &s3c24xx_timer,
+	.timer		= &samsung_timer,
 	.restart	= s3c64xx_restart,
 MACHINE_END
diff --git a/arch/arm/mach-s3c64xx/mach-hmt.c b/arch/arm/mach-s3c64xx/mach-hmt.c
index 2b14489..39f733b 100644
--- a/arch/arm/mach-s3c64xx/mach-hmt.c
+++ b/arch/arm/mach-s3c64xx/mach-hmt.c
@@ -42,6 +42,7 @@
 #include <plat/clock.h>
 #include <plat/devs.h>
 #include <plat/cpu.h>
+#include <plat/samsung-time.h>
 
 #include "common.h"
 
@@ -249,6 +250,7 @@ static void __init hmt_map_io(void)
 	s3c64xx_init_io(hmt_iodesc, ARRAY_SIZE(hmt_iodesc));
 	s3c24xx_init_clocks(12000000);
 	s3c24xx_init_uarts(hmt_uartcfgs, ARRAY_SIZE(hmt_uartcfgs));
+	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
 }
 
 static void __init hmt_machine_init(void)
@@ -277,6 +279,6 @@ MACHINE_START(HMT, "Airgoo-HMT")
 	.map_io		= hmt_map_io,
 	.init_machine	= hmt_machine_init,
 	.init_late	= s3c64xx_init_late,
-	.timer		= &s3c24xx_timer,
+	.timer		= &samsung_timer,
 	.restart	= s3c64xx_restart,
 MACHINE_END
diff --git a/arch/arm/mach-s3c64xx/mach-mini6410.c b/arch/arm/mach-s3c64xx/mach-mini6410.c
index 07c349c..579f303 100644
--- a/arch/arm/mach-s3c64xx/mach-mini6410.c
+++ b/arch/arm/mach-s3c64xx/mach-mini6410.c
@@ -44,6 +44,7 @@
 
 #include <video/platform_lcd.h>
 #include <video/samsung_fimd.h>
+#include <plat/samsung-time.h>
 
 #include "common.h"
 
@@ -233,6 +234,7 @@ static void __init mini6410_map_io(void)
 	s3c64xx_init_io(NULL, 0);
 	s3c24xx_init_clocks(12000000);
 	s3c24xx_init_uarts(mini6410_uartcfgs, ARRAY_SIZE(mini6410_uartcfgs));
+	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
 
 	/* set the LCD type */
 	tmp = __raw_readl(S3C64XX_SPCON);
@@ -356,6 +358,6 @@ MACHINE_START(MINI6410, "MINI6410")
 	.map_io		= mini6410_map_io,
 	.init_machine	= mini6410_machine_init,
 	.init_late	= s3c64xx_init_late,
-	.timer		= &s3c24xx_timer,
+	.timer		= &samsung_timer,
 	.restart	= s3c64xx_restart,
 MACHINE_END
diff --git a/arch/arm/mach-s3c64xx/mach-ncp.c b/arch/arm/mach-s3c64xx/mach-ncp.c
index e5f9a79..16a09e0 100644
--- a/arch/arm/mach-s3c64xx/mach-ncp.c
+++ b/arch/arm/mach-s3c64xx/mach-ncp.c
@@ -44,6 +44,7 @@
 #include <plat/clock.h>
 #include <plat/devs.h>
 #include <plat/cpu.h>
+#include <plat/samsung-time.h>
 
 #include "common.h"
 
@@ -88,6 +89,7 @@ static void __init ncp_map_io(void)
 	s3c64xx_init_io(ncp_iodesc, ARRAY_SIZE(ncp_iodesc));
 	s3c24xx_init_clocks(12000000);
 	s3c24xx_init_uarts(ncp_uartcfgs, ARRAY_SIZE(ncp_uartcfgs));
+	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
 }
 
 static void __init ncp_machine_init(void)
@@ -105,6 +107,6 @@ MACHINE_START(NCP, "NCP")
 	.map_io		= ncp_map_io,
 	.init_machine	= ncp_machine_init,
 	.init_late	= s3c64xx_init_late,
-	.timer		= &s3c24xx_timer,
+	.timer		= &samsung_timer,
 	.restart	= s3c64xx_restart,
 MACHINE_END
diff --git a/arch/arm/mach-s3c64xx/mach-real6410.c b/arch/arm/mach-s3c64xx/mach-real6410.c
index 7476f7c..831a27c 100644
--- a/arch/arm/mach-s3c64xx/mach-real6410.c
+++ b/arch/arm/mach-s3c64xx/mach-real6410.c
@@ -45,6 +45,7 @@
 
 #include <video/platform_lcd.h>
 #include <video/samsung_fimd.h>
+#include <plat/samsung-time.h>
 
 #include "common.h"
 
@@ -212,6 +213,7 @@ static void __init real6410_map_io(void)
 	s3c64xx_init_io(NULL, 0);
 	s3c24xx_init_clocks(12000000);
 	s3c24xx_init_uarts(real6410_uartcfgs, ARRAY_SIZE(real6410_uartcfgs));
+	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
 
 	/* set the LCD type */
 	tmp = __raw_readl(S3C64XX_SPCON);
@@ -335,6 +337,6 @@ MACHINE_START(REAL6410, "REAL6410")
 	.map_io		= real6410_map_io,
 	.init_machine	= real6410_machine_init,
 	.init_late	= s3c64xx_init_late,
-	.timer		= &s3c24xx_timer,
+	.timer		= &samsung_timer,
 	.restart	= s3c64xx_restart,
 MACHINE_END
diff --git a/arch/arm/mach-s3c64xx/mach-smartq.c b/arch/arm/mach-s3c64xx/mach-smartq.c
index c6d7390..df314f1 100644
--- a/arch/arm/mach-s3c64xx/mach-smartq.c
+++ b/arch/arm/mach-s3c64xx/mach-smartq.c
@@ -39,6 +39,7 @@
 #include <linux/platform_data/touchscreen-s3c2410.h>
 
 #include <video/platform_lcd.h>
+#include <plat/samsung-time.h>
 
 #include "common.h"
 
@@ -378,6 +379,7 @@ void __init smartq_map_io(void)
 	s3c64xx_init_io(smartq_iodesc, ARRAY_SIZE(smartq_iodesc));
 	s3c24xx_init_clocks(12000000);
 	s3c24xx_init_uarts(smartq_uartcfgs, ARRAY_SIZE(smartq_uartcfgs));
+	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
 
 	smartq_lcd_mode_set();
 }
diff --git a/arch/arm/mach-s3c64xx/mach-smartq5.c b/arch/arm/mach-s3c64xx/mach-smartq5.c
index 96d6da2..d6c0a11 100644
--- a/arch/arm/mach-s3c64xx/mach-smartq5.c
+++ b/arch/arm/mach-s3c64xx/mach-smartq5.c
@@ -29,6 +29,7 @@
 #include <plat/devs.h>
 #include <plat/fb.h>
 #include <plat/gpio-cfg.h>
+#include <plat/samsung-time.h>
 
 #include "common.h"
 #include "mach-smartq.h"
@@ -157,6 +158,6 @@ MACHINE_START(SMARTQ5, "SmartQ 5")
 	.map_io		= smartq_map_io,
 	.init_machine	= smartq5_machine_init,
 	.init_late	= s3c64xx_init_late,
-	.timer		= &s3c24xx_timer,
+	.timer		= &samsung_timer,
 	.restart	= s3c64xx_restart,
 MACHINE_END
diff --git a/arch/arm/mach-s3c64xx/mach-smartq7.c b/arch/arm/mach-s3c64xx/mach-smartq7.c
index 7d1167b..00ec516 100644
--- a/arch/arm/mach-s3c64xx/mach-smartq7.c
+++ b/arch/arm/mach-s3c64xx/mach-smartq7.c
@@ -29,6 +29,7 @@
 #include <plat/devs.h>
 #include <plat/fb.h>
 #include <plat/gpio-cfg.h>
+#include <plat/samsung-time.h>
 
 #include "common.h"
 #include "mach-smartq.h"
@@ -173,6 +174,6 @@ MACHINE_START(SMARTQ7, "SmartQ 7")
 	.map_io		= smartq_map_io,
 	.init_machine	= smartq7_machine_init,
 	.init_late	= s3c64xx_init_late,
-	.timer		= &s3c24xx_timer,
+	.timer		= &samsung_timer,
 	.restart	= s3c64xx_restart,
 MACHINE_END
diff --git a/arch/arm/mach-s3c64xx/mach-smdk6400.c b/arch/arm/mach-s3c64xx/mach-smdk6400.c
index a928fae..4382417 100644
--- a/arch/arm/mach-s3c64xx/mach-smdk6400.c
+++ b/arch/arm/mach-s3c64xx/mach-smdk6400.c
@@ -36,6 +36,7 @@
 #include <plat/devs.h>
 #include <plat/cpu.h>
 #include <linux/platform_data/i2c-s3c2410.h>
+#include <plat/samsung-time.h>
 
 #include "common.h"
 
@@ -67,6 +68,7 @@ static void __init smdk6400_map_io(void)
 	s3c64xx_init_io(smdk6400_iodesc, ARRAY_SIZE(smdk6400_iodesc));
 	s3c24xx_init_clocks(12000000);
 	s3c24xx_init_uarts(smdk6400_uartcfgs, ARRAY_SIZE(smdk6400_uartcfgs));
+	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
 }
 
 static struct platform_device *smdk6400_devices[] __initdata = {
@@ -94,6 +96,6 @@ MACHINE_START(SMDK6400, "SMDK6400")
 	.map_io		= smdk6400_map_io,
 	.init_machine	= smdk6400_machine_init,
 	.init_late	= s3c64xx_init_late,
-	.timer		= &s3c24xx_timer,
+	.timer		= &samsung_timer,
 	.restart	= s3c64xx_restart,
 MACHINE_END
diff --git a/arch/arm/mach-s3c64xx/mach-smdk6410.c b/arch/arm/mach-s3c64xx/mach-smdk6410.c
index da1a771..ab52008 100644
--- a/arch/arm/mach-s3c64xx/mach-smdk6410.c
+++ b/arch/arm/mach-s3c64xx/mach-smdk6410.c
@@ -73,6 +73,7 @@
 #include <linux/platform_data/touchscreen-s3c2410.h>
 #include <plat/keypad.h>
 #include <plat/backlight.h>
+#include <plat/samsung-time.h>
 
 #include "common.h"
 
@@ -636,6 +637,7 @@ static void __init smdk6410_map_io(void)
 	s3c64xx_init_io(smdk6410_iodesc, ARRAY_SIZE(smdk6410_iodesc));
 	s3c24xx_init_clocks(12000000);
 	s3c24xx_init_uarts(smdk6410_uartcfgs, ARRAY_SIZE(smdk6410_uartcfgs));
+	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
 
 	/* set the LCD type */
 
@@ -705,6 +707,6 @@ MACHINE_START(SMDK6410, "SMDK6410")
 	.map_io		= smdk6410_map_io,
 	.init_machine	= smdk6410_machine_init,
 	.init_late	= s3c64xx_init_late,
-	.timer		= &s3c24xx_timer,
+	.timer		= &samsung_timer,
 	.restart	= s3c64xx_restart,
 MACHINE_END
-- 

^ permalink raw reply related	[flat|nested] 39+ messages in thread

* [PATCH 4/5 v2] Add samsung-time support for s5pc100
  2012-11-27 23:57           ` Heiko Stübner
                               ` (3 preceding siblings ...)
  2012-12-02 19:44             ` [PATCH 3/5 v2] Add samsung-time support for s3c64xx Romain Naour
@ 2012-12-02 19:44             ` Romain Naour
  2012-12-02 19:44             ` [PATCH 5/5 v2] Remove unused plat-samsung/time.c Romain Naour
  2012-12-15 21:40             ` [PATCH 5/5 v3] " Romain Naour
  6 siblings, 0 replies; 39+ messages in thread
From: Romain Naour @ 2012-12-02 19:44 UTC (permalink / raw)
  To: Heiko Stübner
  Cc: tomasz.figa, Kukjin Kim, linux-samsung-soc, ben-linux,
	'Sylwester Nawrocki'

This patch replace ARCH_USES_GETTIMEOFFSET by GENERIC_CLOCKEVENTS for s5pc100 device.
It becomes possible to use the high-resolution timer and dynamic ticks.


Signed-off-by: Naour Romain <romain.naour@openwide.fr>

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 6e00aea..a8c3115 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -796,7 +796,8 @@ config ARCH_S5P64X0
 
 config ARCH_S5PC100
 	bool "Samsung S5PC100"
-	select ARCH_USES_GETTIMEOFFSET
+	select GENERIC_CLOCKEVENTS
+	select CLKSRC_MMIO
 	select CLKDEV_LOOKUP
 	select CPU_V7
 	select GENERIC_GPIO
diff --git a/arch/arm/mach-s5pc100/Kconfig b/arch/arm/mach-s5pc100/Kconfig
index 15170be..3861d5e 100644
--- a/arch/arm/mach-s5pc100/Kconfig
+++ b/arch/arm/mach-s5pc100/Kconfig
@@ -9,6 +9,7 @@ if ARCH_S5PC100
 
 config CPU_S5PC100
 	bool
+	select SAMSUNG_HRT
 	select S5P_EXT_INT
 	select SAMSUNG_DMADEV
 	help
diff --git a/arch/arm/mach-s5pc100/mach-smdkc100.c b/arch/arm/mach-s5pc100/mach-smdkc100.c
index dba7384..c542df4 100644
--- a/arch/arm/mach-s5pc100/mach-smdkc100.c
+++ b/arch/arm/mach-s5pc100/mach-smdkc100.c
@@ -52,6 +52,7 @@
 #include <linux/platform_data/touchscreen-s3c2410.h>
 #include <linux/platform_data/asoc-s3c.h>
 #include <plat/backlight.h>
+#include <plat/samsung-time.h>
 
 #include "common.h"
 
@@ -223,6 +224,7 @@ static void __init smdkc100_map_io(void)
 	s5pc100_init_io(NULL, 0);
 	s3c24xx_init_clocks(12000000);
 	s3c24xx_init_uarts(smdkc100_uartcfgs, ARRAY_SIZE(smdkc100_uartcfgs));
+	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
 }
 
 static void __init smdkc100_machine_init(void)
@@ -258,6 +260,6 @@ MACHINE_START(SMDKC100, "SMDKC100")
 	.handle_irq	= vic_handle_irq,
 	.map_io		= smdkc100_map_io,
 	.init_machine	= smdkc100_machine_init,
-	.timer		= &s3c24xx_timer,
+	.timer		= &samsung_timer,
 	.restart	= s5pc100_restart,
 MACHINE_END
diff --git a/arch/arm/plat-samsung/include/plat/samsung-time.h b/arch/arm/plat-samsung/include/plat/samsung-time.h
index 13ae4b9..66363e8 100644
--- a/arch/arm/plat-samsung/include/plat/samsung-time.h
+++ b/arch/arm/plat-samsung/include/plat/samsung-time.h
@@ -30,7 +30,7 @@ struct samsung_timer_source {
 /* Be able to sleep for atleast 4 seconds (usually more) */
 #define SAMSUNG_TIMER_MIN_RANGE	4
 
-#ifdef CONFIG_ARCH_S3C24XX
+#if defined(CONFIG_ARCH_S3C24XX) || defined(CONFIG_ARCH_S5PC100)
 #define TCNT_MAX		0xffff
 #define TSCALER_DIV		25
 #define TDIV			50
-- 

^ permalink raw reply related	[flat|nested] 39+ messages in thread

* [PATCH 5/5 v2] Remove unused plat-samsung/time.c
  2012-11-27 23:57           ` Heiko Stübner
                               ` (4 preceding siblings ...)
  2012-12-02 19:44             ` [PATCH 4/5 v2] Add samsung-time support for s5pc100 Romain Naour
@ 2012-12-02 19:44             ` Romain Naour
  2012-12-10 12:57               ` Heiko Stübner
  2012-12-15 21:40             ` [PATCH 5/5 v3] " Romain Naour
  6 siblings, 1 reply; 39+ messages in thread
From: Romain Naour @ 2012-12-02 19:44 UTC (permalink / raw)
  To: Heiko Stübner
  Cc: tomasz.figa, Kukjin Kim, linux-samsung-soc, ben-linux,
	'Sylwester Nawrocki'

Since all Samsung devices use clocksource/clockevent API, we can remove
unused sys_timer s3c24xx-timer (plat-samsung/time.c)


Signed-off-by: Naour Romain <romain.naour@openwide.fr>

 delete mode 100644 arch/arm/plat-samsung/time.c

diff --git a/arch/arm/plat-samsung/Makefile b/arch/arm/plat-samsung/Makefile
index 06f2312..162e0df 100644
--- a/arch/arm/plat-samsung/Makefile
+++ b/arch/arm/plat-samsung/Makefile
@@ -12,7 +12,6 @@ obj-				:=
 # Objects we always build independent of SoC choice

 obj-y				+= init.o cpu.o
-obj-$(CONFIG_ARCH_USES_GETTIMEOFFSET)   += time.o
 obj-$(CONFIG_SAMSUNG_HRT) 		+= samsung-time.o

 obj-$(CONFIG_SAMSUNG_CLOCK)	+= clock.o
diff --git a/arch/arm/plat-samsung/include/plat/cpu.h
b/arch/arm/plat-samsung/include/plat/cpu.h
index 86fb5f3..84a50ee 100644
--- a/arch/arm/plat-samsung/include/plat/cpu.h
+++ b/arch/arm/plat-samsung/include/plat/cpu.h
@@ -184,11 +184,6 @@ extern void s3c24xx_init_uartdevs(char *name,
 				  struct s3c24xx_uart_resources *res,
 				  struct s3c2410_uartcfg *cfg, int no);

-/* timer for s5pc100 only */
-
-struct sys_timer;
-extern struct sys_timer s3c24xx_timer;
-
 extern struct syscore_ops s3c2410_pm_syscore_ops;
 extern struct syscore_ops s3c2412_pm_syscore_ops;
 extern struct syscore_ops s3c2416_pm_syscore_ops;
diff --git a/arch/arm/plat-samsung/time.c b/arch/arm/plat-samsung/time.c
deleted file mode 100644
index 60552e2..0000000
--- a/arch/arm/plat-samsung/time.c
+++ /dev/null
@@ -1,285 +0,0 @@
-/* linux/arch/arm/plat-samsung/time.c
- *
- * Copyright (C) 2003-2005 Simtec Electronics
- *	Ben Dooks, <ben@simtec.co.uk>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
 USA
- */
-
-#include <linux/kernel.h>
-#include <linux/sched.h>
-#include <linux/init.h>
-#include <linux/interrupt.h>
-#include <linux/irq.h>
-#include <linux/err.h>
-#include <linux/clk.h>
-#include <linux/io.h>
-#include <linux/platform_device.h>
-
-#include <asm/mach-types.h>
-
-#include <asm/irq.h>
-#include <mach/map.h>
-#include <plat/regs-timer.h>
-#include <mach/regs-irq.h>
-#include <asm/mach/time.h>
-#include <mach/tick.h>
-
-#include <plat/clock.h>
-#include <plat/cpu.h>
-
-static unsigned long timer_startval;
-static unsigned long timer_usec_ticks;
-
-#ifndef TICK_MAX
-#define TICK_MAX (0xffff)
-#endif
-
-#define TIMER_USEC_SHIFT 16
-
-/* we use the shifted arithmetic to work out the ratio of timer ticks
- * to usecs, as often the peripheral clock is not a nice even multiple
- * of 1MHz.
- *
- * shift of 14 and 15 are too low for the 12MHz, 16 seems to be ok
- * for the current HZ value of 200 without producing overflows.
- *
- * Original patch by Dimitry Andric, updated by Ben Dooks
-*/
-
-
-/* timer_mask_usec_ticks
- *
- * given a clock and divisor, make the value to pass into
timer_ticks_to_usec
- * to scale the ticks into usecs
-*/
-
-static inline unsigned long
-timer_mask_usec_ticks(unsigned long scaler, unsigned long pclk)
-{
-	unsigned long den = pclk / 1000;
-
-	return ((1000 << TIMER_USEC_SHIFT) * scaler + (den >> 1)) / den;
-}
-
-/* timer_ticks_to_usec
- *
- * convert timer ticks to usec.
-*/
-
-static inline unsigned long timer_ticks_to_usec(unsigned long ticks)
-{
-	unsigned long res;
-
-	res = ticks * timer_usec_ticks;
-	res += 1 << (TIMER_USEC_SHIFT - 4);	/* round up slightly */
-
-	return res >> TIMER_USEC_SHIFT;
-}
-
-/***
- * Returns microsecond  since last clock interrupt.  Note that interrupts
- * will have been disabled by do_gettimeoffset()
- * IRQs are disabled before entering here from do_gettimeofday()
- */
-
-static unsigned long s3c2410_gettimeoffset (void)
-{
-	unsigned long tdone;
-	unsigned long tval;
-
-	/* work out how many ticks have gone since last timer interrupt */
-
-	tval =  __raw_readl(S3C2410_TCNTO(4));
-	tdone = timer_startval - tval;
-
-	/* check to see if there is an interrupt pending */
-
-	if (s3c24xx_ostimer_pending()) {
-		/* re-read the timer, and try and fix up for the missed
-		 * interrupt. Note, the interrupt may go off before the
-		 * timer has re-loaded from wrapping.
-		 */
-
-		tval =  __raw_readl(S3C2410_TCNTO(4));
-		tdone = timer_startval - tval;
-
-		if (tval != 0)
-			tdone += timer_startval;
-	}
-
-	return timer_ticks_to_usec(tdone);
-}
-
-
-/*
- * IRQ handler for the timer
- */
-static irqreturn_t
-s3c2410_timer_interrupt(int irq, void *dev_id)
-{
-	timer_tick();
-	return IRQ_HANDLED;
-}
-
-static struct irqaction s3c2410_timer_irq = {
-	.name		= "S3C2410 Timer Tick",
-	.flags		= IRQF_DISABLED | IRQF_TIMER | IRQF_IRQPOLL,
-	.handler	= s3c2410_timer_interrupt,
-};
-
-#define use_tclk1_12() ( \
-	machine_is_bast()	|| \
-	machine_is_vr1000()	|| \
-	machine_is_anubis()	|| \
-	machine_is_osiris())
-
-static struct clk *tin;
-static struct clk *tdiv;
-static struct clk *timerclk;
-
-/*
- * Set up timer interrupt, and return the current time in seconds.
- *
- * Currently we only use timer4, as it is the only timer which has no
- * other function that can be exploited externally
- */
-static void s3c2410_timer_setup (void)
-{
-	unsigned long tcon;
-	unsigned long tcnt;
-	unsigned long tcfg1;
-	unsigned long tcfg0;
-
-	tcnt = TICK_MAX;  /* default value for tcnt */
-
-	/* configure the system for whichever machine is in use */
-
-	if (use_tclk1_12()) {
-		/* timer is at 12MHz, scaler is 1 */
-		timer_usec_ticks = timer_mask_usec_ticks(1, 12000000);
-		tcnt = 12000000 / HZ;
-
-		tcfg1 = __raw_readl(S3C2410_TCFG1);
-		tcfg1 &= ~S3C2410_TCFG1_MUX4_MASK;
-		tcfg1 |= S3C2410_TCFG1_MUX4_TCLK1;
-		__raw_writel(tcfg1, S3C2410_TCFG1);
-	} else {
-		unsigned long pclk;
-		struct clk *tscaler;
-
-		/* for the h1940 (and others), we use the pclk from the core
-		 * to generate the timer values. since values around 50 to
-		 * 70MHz are not values we can directly generate the timer
-		 * value from, we need to pre-scale and divide before using it.
-		 *
-		 * for instance, using 50.7MHz and dividing by 6 gives 8.45MHz
-		 * (8.45 ticks per usec)
-		 */
-
-		pclk = clk_get_rate(timerclk);
-
-		/* configure clock tick */
-
-		timer_usec_ticks = timer_mask_usec_ticks(6, pclk);
-
-		tscaler = clk_get_parent(tdiv);
-
-		clk_set_rate(tscaler, pclk / 3);
-		clk_set_rate(tdiv, pclk / 6);
-		clk_set_parent(tin, tdiv);
-
-		tcnt = clk_get_rate(tin) / HZ;
-	}
-
-	tcon = __raw_readl(S3C2410_TCON);
-	tcfg0 = __raw_readl(S3C2410_TCFG0);
-	tcfg1 = __raw_readl(S3C2410_TCFG1);
-
-	/* timers reload after counting zero, so reduce the count by 1 */
-
-	tcnt--;
-
-	printk(KERN_DEBUG "timer tcon=%08lx, tcnt %04lx, tcfg %08lx,%08lx,
usec %08lx\n",
-	       tcon, tcnt, tcfg0, tcfg1, timer_usec_ticks);
-
-	/* check to see if timer is within 16bit range... */
-	if (tcnt > TICK_MAX) {
-		panic("setup_timer: HZ is too small, cannot configure timer!");
-		return;
-	}
-
-	__raw_writel(tcfg1, S3C2410_TCFG1);
-	__raw_writel(tcfg0, S3C2410_TCFG0);
-
-	timer_startval = tcnt;
-	__raw_writel(tcnt, S3C2410_TCNTB(4));
-
-	/* ensure timer is stopped... */
-
-	tcon &= ~(7<<20);
-	tcon |= S3C2410_TCON_T4RELOAD;
-	tcon |= S3C2410_TCON_T4MANUALUPD;
-
-	__raw_writel(tcon, S3C2410_TCON);
-	__raw_writel(tcnt, S3C2410_TCNTB(4));
-	__raw_writel(tcnt, S3C2410_TCMPB(4));
-
-	/* start the timer running */
-	tcon |= S3C2410_TCON_T4START;
-	tcon &= ~S3C2410_TCON_T4MANUALUPD;
-	__raw_writel(tcon, S3C2410_TCON);
-}
-
-static void __init s3c2410_timer_resources(void)
-{
-	struct platform_device tmpdev;
-
-	tmpdev.dev.bus = &platform_bus_type;
-	tmpdev.id = 4;
-
-	timerclk = clk_get(NULL, "timers");
-	if (IS_ERR(timerclk))
-		panic("failed to get clock for system timer");
-
-	clk_enable(timerclk);
-
-	if (!use_tclk1_12()) {
-		tmpdev.id = 4;
-		tmpdev.dev.init_name = "s3c24xx-pwm.4";
-		tin = clk_get(&tmpdev.dev, "pwm-tin");
-		if (IS_ERR(tin))
-			panic("failed to get pwm-tin clock for system timer");
-
-		tdiv = clk_get(&tmpdev.dev, "pwm-tdiv");
-		if (IS_ERR(tdiv))
-			panic("failed to get pwm-tdiv clock for system timer");
-	}
-
-	clk_enable(tin);
-}
-
-static void __init s3c2410_timer_init(void)
-{
-	s3c2410_timer_resources();
-	s3c2410_timer_setup();
-	setup_irq(IRQ_TIMER4, &s3c2410_timer_irq);
-}
-
-struct sys_timer s3c24xx_timer = {
-	.init		= s3c2410_timer_init,
-	.offset		= s3c2410_gettimeoffset,
-	.resume		= s3c2410_timer_setup
-};
-- 

^ permalink raw reply related	[flat|nested] 39+ messages in thread

* Re: [PATCH 5/5 v2] Remove unused plat-samsung/time.c
  2012-12-02 19:44             ` [PATCH 5/5 v2] Remove unused plat-samsung/time.c Romain Naour
@ 2012-12-10 12:57               ` Heiko Stübner
  2012-12-15 21:40                 ` Romain Naour
  0 siblings, 1 reply; 39+ messages in thread
From: Heiko Stübner @ 2012-12-10 12:57 UTC (permalink / raw)
  To: Romain Naour
  Cc: tomasz.figa, Kukjin Kim, linux-samsung-soc, ben-linux,
	'Sylwester Nawrocki'

Am Sonntag, 2. Dezember 2012, 20:44:22 schrieb Romain Naour:
> Since all Samsung devices use clocksource/clockevent API, we can remove
> unused sys_timer s3c24xx-timer (plat-samsung/time.c)

The patch is corrupted, as it contains wrapped lines and does not apply 
against the current linux-next tree


> Signed-off-by: Naour Romain <romain.naour@openwide.fr>
> 
>  delete mode 100644 arch/arm/plat-samsung/time.c

and what does this line do in the patch description? It seems your mail client 
mangled the "--" parting the patch message from the stats/comment section.


> diff --git a/arch/arm/plat-samsung/Makefile
> b/arch/arm/plat-samsung/Makefile index 06f2312..162e0df 100644
> --- a/arch/arm/plat-samsung/Makefile
> +++ b/arch/arm/plat-samsung/Makefile
> @@ -12,7 +12,6 @@ obj-				:=
>  # Objects we always build independent of SoC choice
> 
>  obj-y				+= init.o cpu.o
> -obj-$(CONFIG_ARCH_USES_GETTIMEOFFSET)   += time.o
>  obj-$(CONFIG_SAMSUNG_HRT) 		+= samsung-time.o
> 
>  obj-$(CONFIG_SAMSUNG_CLOCK)	+= clock.o
> diff --git a/arch/arm/plat-samsung/include/plat/cpu.h
> b/arch/arm/plat-samsung/include/plat/cpu.h
> index 86fb5f3..84a50ee 100644
> --- a/arch/arm/plat-samsung/include/plat/cpu.h
> +++ b/arch/arm/plat-samsung/include/plat/cpu.h
> @@ -184,11 +184,6 @@ extern void s3c24xx_init_uartdevs(char *name,
>  				  struct s3c24xx_uart_resources *res,
>  				  struct s3c2410_uartcfg *cfg, int no);
> 
> -/* timer for s5pc100 only */
> -
> -struct sys_timer;
> -extern struct sys_timer s3c24xx_timer;
> -
>  extern struct syscore_ops s3c2410_pm_syscore_ops;
>  extern struct syscore_ops s3c2412_pm_syscore_ops;
>  extern struct syscore_ops s3c2416_pm_syscore_ops;
> diff --git a/arch/arm/plat-samsung/time.c b/arch/arm/plat-samsung/time.c
> deleted file mode 100644
> index 60552e2..0000000
> --- a/arch/arm/plat-samsung/time.c
> +++ /dev/null
> @@ -1,285 +0,0 @@
> -/* linux/arch/arm/plat-samsung/time.c
> - *
> - * Copyright (C) 2003-2005 Simtec Electronics
> - *	Ben Dooks, <ben@simtec.co.uk>
> - *
> - * This program is free software; you can redistribute it and/or modify
> - * it under the terms of the GNU General Public License as published by
> - * the Free Software Foundation; either version 2 of the License, or
> - * (at your option) any later version.
> - *
> - * This program is distributed in the hope that it will be useful,
> - * but WITHOUT ANY WARRANTY; without even the implied warranty of
> - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> - * GNU General Public License for more details.
> - *
> - * You should have received a copy of the GNU General Public License
> - * along with this program; if not, write to the Free Software
> - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
>  USA
> - */
> -
> -#include <linux/kernel.h>
> -#include <linux/sched.h>
> -#include <linux/init.h>
> -#include <linux/interrupt.h>
> -#include <linux/irq.h>
> -#include <linux/err.h>
> -#include <linux/clk.h>
> -#include <linux/io.h>
> -#include <linux/platform_device.h>
> -
> -#include <asm/mach-types.h>
> -
> -#include <asm/irq.h>
> -#include <mach/map.h>
> -#include <plat/regs-timer.h>
> -#include <mach/regs-irq.h>
> -#include <asm/mach/time.h>
> -#include <mach/tick.h>
> -
> -#include <plat/clock.h>
> -#include <plat/cpu.h>
> -
> -static unsigned long timer_startval;
> -static unsigned long timer_usec_ticks;
> -
> -#ifndef TICK_MAX
> -#define TICK_MAX (0xffff)
> -#endif
> -
> -#define TIMER_USEC_SHIFT 16
> -
> -/* we use the shifted arithmetic to work out the ratio of timer ticks
> - * to usecs, as often the peripheral clock is not a nice even multiple
> - * of 1MHz.
> - *
> - * shift of 14 and 15 are too low for the 12MHz, 16 seems to be ok
> - * for the current HZ value of 200 without producing overflows.
> - *
> - * Original patch by Dimitry Andric, updated by Ben Dooks
> -*/
> -
> -
> -/* timer_mask_usec_ticks
> - *
> - * given a clock and divisor, make the value to pass into
> timer_ticks_to_usec
> - * to scale the ticks into usecs
> -*/
> -
> -static inline unsigned long
> -timer_mask_usec_ticks(unsigned long scaler, unsigned long pclk)
> -{
> -	unsigned long den = pclk / 1000;
> -
> -	return ((1000 << TIMER_USEC_SHIFT) * scaler + (den >> 1)) / den;
> -}
> -
> -/* timer_ticks_to_usec
> - *
> - * convert timer ticks to usec.
> -*/
> -
> -static inline unsigned long timer_ticks_to_usec(unsigned long ticks)
> -{
> -	unsigned long res;
> -
> -	res = ticks * timer_usec_ticks;
> -	res += 1 << (TIMER_USEC_SHIFT - 4);	/* round up slightly */
> -
> -	return res >> TIMER_USEC_SHIFT;
> -}
> -
> -/***
> - * Returns microsecond  since last clock interrupt.  Note that interrupts
> - * will have been disabled by do_gettimeoffset()
> - * IRQs are disabled before entering here from do_gettimeofday()
> - */
> -
> -static unsigned long s3c2410_gettimeoffset (void)
> -{
> -	unsigned long tdone;
> -	unsigned long tval;
> -
> -	/* work out how many ticks have gone since last timer interrupt */
> -
> -	tval =  __raw_readl(S3C2410_TCNTO(4));
> -	tdone = timer_startval - tval;
> -
> -	/* check to see if there is an interrupt pending */
> -
> -	if (s3c24xx_ostimer_pending()) {
> -		/* re-read the timer, and try and fix up for the missed
> -		 * interrupt. Note, the interrupt may go off before the
> -		 * timer has re-loaded from wrapping.
> -		 */
> -
> -		tval =  __raw_readl(S3C2410_TCNTO(4));
> -		tdone = timer_startval - tval;
> -
> -		if (tval != 0)
> -			tdone += timer_startval;
> -	}
> -
> -	return timer_ticks_to_usec(tdone);
> -}
> -
> -
> -/*
> - * IRQ handler for the timer
> - */
> -static irqreturn_t
> -s3c2410_timer_interrupt(int irq, void *dev_id)
> -{
> -	timer_tick();
> -	return IRQ_HANDLED;
> -}
> -
> -static struct irqaction s3c2410_timer_irq = {
> -	.name		= "S3C2410 Timer Tick",
> -	.flags		= IRQF_DISABLED | IRQF_TIMER | IRQF_IRQPOLL,
> -	.handler	= s3c2410_timer_interrupt,
> -};
> -
> -#define use_tclk1_12() ( \
> -	machine_is_bast()	|| \
> -	machine_is_vr1000()	|| \
> -	machine_is_anubis()	|| \
> -	machine_is_osiris())
> -
> -static struct clk *tin;
> -static struct clk *tdiv;
> -static struct clk *timerclk;
> -
> -/*
> - * Set up timer interrupt, and return the current time in seconds.
> - *
> - * Currently we only use timer4, as it is the only timer which has no
> - * other function that can be exploited externally
> - */
> -static void s3c2410_timer_setup (void)
> -{
> -	unsigned long tcon;
> -	unsigned long tcnt;
> -	unsigned long tcfg1;
> -	unsigned long tcfg0;
> -
> -	tcnt = TICK_MAX;  /* default value for tcnt */
> -
> -	/* configure the system for whichever machine is in use */
> -
> -	if (use_tclk1_12()) {
> -		/* timer is at 12MHz, scaler is 1 */
> -		timer_usec_ticks = timer_mask_usec_ticks(1, 12000000);
> -		tcnt = 12000000 / HZ;
> -
> -		tcfg1 = __raw_readl(S3C2410_TCFG1);
> -		tcfg1 &= ~S3C2410_TCFG1_MUX4_MASK;
> -		tcfg1 |= S3C2410_TCFG1_MUX4_TCLK1;
> -		__raw_writel(tcfg1, S3C2410_TCFG1);
> -	} else {
> -		unsigned long pclk;
> -		struct clk *tscaler;
> -
> -		/* for the h1940 (and others), we use the pclk from the core
> -		 * to generate the timer values. since values around 50 to
> -		 * 70MHz are not values we can directly generate the timer
> -		 * value from, we need to pre-scale and divide before using it.
> -		 *
> -		 * for instance, using 50.7MHz and dividing by 6 gives 8.45MHz
> -		 * (8.45 ticks per usec)
> -		 */
> -
> -		pclk = clk_get_rate(timerclk);
> -
> -		/* configure clock tick */
> -
> -		timer_usec_ticks = timer_mask_usec_ticks(6, pclk);
> -
> -		tscaler = clk_get_parent(tdiv);
> -
> -		clk_set_rate(tscaler, pclk / 3);
> -		clk_set_rate(tdiv, pclk / 6);
> -		clk_set_parent(tin, tdiv);
> -
> -		tcnt = clk_get_rate(tin) / HZ;
> -	}
> -
> -	tcon = __raw_readl(S3C2410_TCON);
> -	tcfg0 = __raw_readl(S3C2410_TCFG0);
> -	tcfg1 = __raw_readl(S3C2410_TCFG1);
> -
> -	/* timers reload after counting zero, so reduce the count by 1 */
> -
> -	tcnt--;
> -
> -	printk(KERN_DEBUG "timer tcon=%08lx, tcnt %04lx, tcfg %08lx,%08lx,
> usec %08lx\n",
> -	       tcon, tcnt, tcfg0, tcfg1, timer_usec_ticks);
> -
> -	/* check to see if timer is within 16bit range... */
> -	if (tcnt > TICK_MAX) {
> -		panic("setup_timer: HZ is too small, cannot configure timer!");
> -		return;
> -	}
> -
> -	__raw_writel(tcfg1, S3C2410_TCFG1);
> -	__raw_writel(tcfg0, S3C2410_TCFG0);
> -
> -	timer_startval = tcnt;
> -	__raw_writel(tcnt, S3C2410_TCNTB(4));
> -
> -	/* ensure timer is stopped... */
> -
> -	tcon &= ~(7<<20);
> -	tcon |= S3C2410_TCON_T4RELOAD;
> -	tcon |= S3C2410_TCON_T4MANUALUPD;
> -
> -	__raw_writel(tcon, S3C2410_TCON);
> -	__raw_writel(tcnt, S3C2410_TCNTB(4));
> -	__raw_writel(tcnt, S3C2410_TCMPB(4));
> -
> -	/* start the timer running */
> -	tcon |= S3C2410_TCON_T4START;
> -	tcon &= ~S3C2410_TCON_T4MANUALUPD;
> -	__raw_writel(tcon, S3C2410_TCON);
> -}
> -
> -static void __init s3c2410_timer_resources(void)
> -{
> -	struct platform_device tmpdev;
> -
> -	tmpdev.dev.bus = &platform_bus_type;
> -	tmpdev.id = 4;
> -
> -	timerclk = clk_get(NULL, "timers");
> -	if (IS_ERR(timerclk))
> -		panic("failed to get clock for system timer");
> -
> -	clk_enable(timerclk);
> -
> -	if (!use_tclk1_12()) {
> -		tmpdev.id = 4;
> -		tmpdev.dev.init_name = "s3c24xx-pwm.4";
> -		tin = clk_get(&tmpdev.dev, "pwm-tin");
> -		if (IS_ERR(tin))
> -			panic("failed to get pwm-tin clock for system timer");
> -
> -		tdiv = clk_get(&tmpdev.dev, "pwm-tdiv");
> -		if (IS_ERR(tdiv))
> -			panic("failed to get pwm-tdiv clock for system timer");
> -	}
> -
> -	clk_enable(tin);
> -}
> -
> -static void __init s3c2410_timer_init(void)
> -{
> -	s3c2410_timer_resources();
> -	s3c2410_timer_setup();
> -	setup_irq(IRQ_TIMER4, &s3c2410_timer_irq);
> -}
> -
> -struct sys_timer s3c24xx_timer = {
> -	.init		= s3c2410_timer_init,
> -	.offset		= s3c2410_gettimeoffset,
> -	.resume		= s3c2410_timer_setup
> -};

4

^ permalink raw reply	[flat|nested] 39+ messages in thread

* Re: [PATCH 1/5 v2] Rename s5p-time to samsung-time
  2012-12-02 19:44             ` [PATCH 1/5 v2] Rename s5p-time to samsung-time Romain Naour
@ 2012-12-10 12:59               ` Heiko Stübner
  2012-12-15 21:43                 ` Romain Naour
  0 siblings, 1 reply; 39+ messages in thread
From: Heiko Stübner @ 2012-12-10 12:59 UTC (permalink / raw)
  To: Romain Naour
  Cc: tomasz.figa, Kukjin Kim, linux-samsung-soc, ben-linux,
	'Sylwester Nawrocki'

Am Sonntag, 2. Dezember 2012, 20:44:01 schrieb Romain Naour:
> This patch rename s5p-time to samsung-time.
> There is no functional change.
> 
> 
> Signed-off-by: Naour Romain <romain.naour@openwide.fr>

The patch does not apply to current linux-next, because it has some problem 
with the exynos-universal board. I've fixed this to test the patch, so

Acked-by: Heiko Stuebner <heiko@sntech.de>

> 
>  delete mode 100644 arch/arm/plat-samsung/include/plat/s5p-time.h
>  create mode 100644 arch/arm/plat-samsung/include/plat/samsung-time.h
>  rename arch/arm/plat-samsung/{s5p-time.c => samsung-time.c} (70%)

what does this line do in the patch description? It seems your mail client 
mangled the "--" parting the patch message from the stats/comment section.



> diff --git a/arch/arm/mach-exynos/Kconfig b/arch/arm/mach-exynos/Kconfig
> index da55107..20edfa3 100644
> --- a/arch/arm/mach-exynos/Kconfig
> +++ b/arch/arm/mach-exynos/Kconfig
> @@ -274,7 +274,7 @@ config MACH_UNIVERSAL_C210
>  	select S5P_DEV_ONENAND
>  	select S5P_DEV_TV
>  	select S5P_GPIO_INT
> -	select S5P_HRT
> +	select SAMSUNG_HRT
>  	select S5P_SETUP_MIPIPHY
>  	help
>  	  Machine support for Samsung Mobile Universal S5PC210 Reference
> diff --git a/arch/arm/mach-exynos/mach-universal_c210.c
> b/arch/arm/mach-exynos/mach-universal_c210.c index ebc9dd3..325bfe9 100644
> --- a/arch/arm/mach-exynos/mach-universal_c210.c
> +++ b/arch/arm/mach-exynos/mach-universal_c210.c
> @@ -41,7 +41,7 @@
>  #include <plat/mfc.h>
>  #include <plat/sdhci.h>
>  #include <plat/fimc-core.h>
> -#include <plat/s5p-time.h>
> +#include <plat/samsung-time.h>
>  #include <plat/camport.h>
>  #include <linux/platform_data/mipi-csis.h>
> 
> @@ -1099,7 +1099,7 @@ static void __init universal_map_io(void)
>  	exynos_init_io(NULL, 0);
>  	s3c24xx_init_clocks(clk_xusbxti.rate);
>  	s3c24xx_init_uarts(universal_uartcfgs, ARRAY_SIZE(universal_uartcfgs));
> -	s5p_set_timer_source(S5P_PWM2, S5P_PWM4);
> +	samsung_set_timer_source(SAMSUNG_PWM2, SAMSUNG_PWM4);
>  }
> 
>  static void s5p_tv_setup(void)
> @@ -1158,7 +1158,7 @@ MACHINE_START(UNIVERSAL_C210, "UNIVERSAL_C210")
>  	.handle_irq	= gic_handle_irq,
>  	.init_machine	= universal_machine_init,
>  	.init_late	= exynos_init_late,
> -	.timer		= &s5p_timer,
> +	.timer		= &samsung_timer,
>  	.reserve        = &universal_reserve,
>  	.restart	= exynos4_restart,
>  MACHINE_END
> diff --git a/arch/arm/mach-s5p64x0/Kconfig b/arch/arm/mach-s5p64x0/Kconfig
> index e8742cb..f0ec535 100644
> --- a/arch/arm/mach-s5p64x0/Kconfig
> +++ b/arch/arm/mach-s5p64x0/Kconfig
> @@ -9,7 +9,7 @@ if ARCH_S5P64X0
> 
>  config CPU_S5P6440
>  	bool
> -	select S5P_HRT
> +	select SAMSUNG_HRT
>  	select S5P_SLEEP if PM
>  	select SAMSUNG_DMADEV
>  	select SAMSUNG_WAKEMASK if PM
> @@ -18,7 +18,7 @@ config CPU_S5P6440
> 
>  config CPU_S5P6450
>  	bool
> -	select S5P_HRT
> +	select SAMSUNG_HRT
>  	select S5P_SLEEP if PM
>  	select SAMSUNG_DMADEV
>  	select SAMSUNG_WAKEMASK if PM
> diff --git a/arch/arm/mach-s5p64x0/mach-smdk6440.c
> b/arch/arm/mach-s5p64x0/mach-smdk6440.c index 96ea1fe..587fec5 100644
> --- a/arch/arm/mach-s5p64x0/mach-smdk6440.c
> +++ b/arch/arm/mach-s5p64x0/mach-smdk6440.c
> @@ -50,7 +50,7 @@
>  #include <plat/pll.h>
>  #include <plat/adc.h>
>  #include <linux/platform_data/touchscreen-s3c2410.h>
> -#include <plat/s5p-time.h>
> +#include <plat/samsung-time.h>
>  #include <plat/backlight.h>
>  #include <plat/fb.h>
>  #include <plat/sdhci.h>
> @@ -231,7 +231,7 @@ static void __init smdk6440_map_io(void)
>  	s5p64x0_init_io(NULL, 0);
>  	s3c24xx_init_clocks(12000000);
>  	s3c24xx_init_uarts(smdk6440_uartcfgs, ARRAY_SIZE(smdk6440_uartcfgs));
> -	s5p_set_timer_source(S5P_PWM3, S5P_PWM4);
> +	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
>  }
> 
>  static void s5p6440_set_lcd_interface(void)
> @@ -276,6 +276,6 @@ MACHINE_START(SMDK6440, "SMDK6440")
>  	.handle_irq	= vic_handle_irq,
>  	.map_io		= smdk6440_map_io,
>  	.init_machine	= smdk6440_machine_init,
> -	.timer		= &s5p_timer,
> +	.timer		= &samsung_timer,
>  	.restart	= s5p64x0_restart,
>  MACHINE_END
> diff --git a/arch/arm/mach-s5p64x0/mach-smdk6450.c
> b/arch/arm/mach-s5p64x0/mach-smdk6450.c index 12748b6..714cd8a 100644
> --- a/arch/arm/mach-s5p64x0/mach-smdk6450.c
> +++ b/arch/arm/mach-s5p64x0/mach-smdk6450.c
> @@ -50,7 +50,7 @@
>  #include <plat/pll.h>
>  #include <plat/adc.h>
>  #include <linux/platform_data/touchscreen-s3c2410.h>
> -#include <plat/s5p-time.h>
> +#include <plat/samsung-time.h>
>  #include <plat/backlight.h>
>  #include <plat/fb.h>
>  #include <plat/sdhci.h>
> @@ -250,7 +250,7 @@ static void __init smdk6450_map_io(void)
>  	s5p64x0_init_io(NULL, 0);
>  	s3c24xx_init_clocks(19200000);
>  	s3c24xx_init_uarts(smdk6450_uartcfgs, ARRAY_SIZE(smdk6450_uartcfgs));
> -	s5p_set_timer_source(S5P_PWM3, S5P_PWM4);
> +	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
>  }
> 
>  static void s5p6450_set_lcd_interface(void)
> @@ -295,6 +295,6 @@ MACHINE_START(SMDK6450, "SMDK6450")
>  	.handle_irq	= vic_handle_irq,
>  	.map_io		= smdk6450_map_io,
>  	.init_machine	= smdk6450_machine_init,
> -	.timer		= &s5p_timer,
> +	.timer		= &samsung_timer,
>  	.restart	= s5p64x0_restart,
>  MACHINE_END
> diff --git a/arch/arm/mach-s5pv210/Kconfig b/arch/arm/mach-s5pv210/Kconfig
> index 92ad72f..01018ef 100644
> --- a/arch/arm/mach-s5pv210/Kconfig
> +++ b/arch/arm/mach-s5pv210/Kconfig
> @@ -12,7 +12,7 @@ if ARCH_S5PV210
>  config CPU_S5PV210
>  	bool
>  	select S5P_EXT_INT
> -	select S5P_HRT
> +	select SAMSUNG_HRT
>  	select S5P_PM if PM
>  	select S5P_SLEEP if PM
>  	select SAMSUNG_DMADEV
> diff --git a/arch/arm/mach-s5pv210/mach-aquila.c
> b/arch/arm/mach-s5pv210/mach-aquila.c index ee9fa5c..7c7d89b 100644
> --- a/arch/arm/mach-s5pv210/mach-aquila.c
> +++ b/arch/arm/mach-s5pv210/mach-aquila.c
> @@ -39,7 +39,7 @@
>  #include <plat/fb.h>
>  #include <plat/fimc-core.h>
>  #include <plat/sdhci.h>
> -#include <plat/s5p-time.h>
> +#include <plat/samsung-time.h>
> 
>  #include "common.h"
> 
> @@ -652,7 +652,7 @@ static void __init aquila_map_io(void)
>  	s5pv210_init_io(NULL, 0);
>  	s3c24xx_init_clocks(24000000);
>  	s3c24xx_init_uarts(aquila_uartcfgs, ARRAY_SIZE(aquila_uartcfgs));
> -	s5p_set_timer_source(S5P_PWM3, S5P_PWM4);
> +	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
>  }
> 
>  static void __init aquila_machine_init(void)
> @@ -688,6 +688,6 @@ MACHINE_START(AQUILA, "Aquila")
>  	.handle_irq	= vic_handle_irq,
>  	.map_io		= aquila_map_io,
>  	.init_machine	= aquila_machine_init,
> -	.timer		= &s5p_timer,
> +	.timer		= &samsung_timer,
>  	.restart	= s5pv210_restart,
>  MACHINE_END
> diff --git a/arch/arm/mach-s5pv210/mach-goni.c
> b/arch/arm/mach-s5pv210/mach-goni.c index 55e1dba..2740001 100644
> --- a/arch/arm/mach-s5pv210/mach-goni.c
> +++ b/arch/arm/mach-s5pv210/mach-goni.c
> @@ -48,7 +48,7 @@
>  #include <plat/keypad.h>
>  #include <plat/sdhci.h>
>  #include <plat/clock.h>
> -#include <plat/s5p-time.h>
> +#include <plat/samsung-time.h>
>  #include <plat/mfc.h>
>  #include <plat/camport.h>
> 
> @@ -910,7 +910,7 @@ static void __init goni_map_io(void)
>  	s5pv210_init_io(NULL, 0);
>  	s3c24xx_init_clocks(clk_xusbxti.rate);
>  	s3c24xx_init_uarts(goni_uartcfgs, ARRAY_SIZE(goni_uartcfgs));
> -	s5p_set_timer_source(S5P_PWM3, S5P_PWM4);
> +	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
>  }
> 
>  static void __init goni_reserve(void)
> @@ -976,7 +976,7 @@ MACHINE_START(GONI, "GONI")
>  	.handle_irq	= vic_handle_irq,
>  	.map_io		= goni_map_io,
>  	.init_machine	= goni_machine_init,
> -	.timer		= &s5p_timer,
> +	.timer		= &samsung_timer,
>  	.reserve	= &goni_reserve,
>  	.restart	= s5pv210_restart,
>  MACHINE_END
> diff --git a/arch/arm/mach-s5pv210/mach-smdkc110.c
> b/arch/arm/mach-s5pv210/mach-smdkc110.c index d9c99fc..d2e93b7 100644
> --- a/arch/arm/mach-s5pv210/mach-smdkc110.c
> +++ b/arch/arm/mach-s5pv210/mach-smdkc110.c
> @@ -30,7 +30,7 @@
>  #include <linux/platform_data/ata-samsung_cf.h>
>  #include <linux/platform_data/i2c-s3c2410.h>
>  #include <plat/pm.h>
> -#include <plat/s5p-time.h>
> +#include <plat/samsung-time.h>
>  #include <plat/mfc.h>
> 
>  #include "common.h"
> @@ -122,7 +122,7 @@ static void __init smdkc110_map_io(void)
>  	s5pv210_init_io(NULL, 0);
>  	s3c24xx_init_clocks(24000000);
>  	s3c24xx_init_uarts(smdkv210_uartcfgs, ARRAY_SIZE(smdkv210_uartcfgs));
> -	s5p_set_timer_source(S5P_PWM3, S5P_PWM4);
> +	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
>  }
> 
>  static void __init smdkc110_reserve(void)
> @@ -156,7 +156,7 @@ MACHINE_START(SMDKC110, "SMDKC110")
>  	.handle_irq	= vic_handle_irq,
>  	.map_io		= smdkc110_map_io,
>  	.init_machine	= smdkc110_machine_init,
> -	.timer		= &s5p_timer,
> +	.timer		= &samsung_timer,
>  	.restart	= s5pv210_restart,
>  	.reserve	= &smdkc110_reserve,
>  MACHINE_END
> diff --git a/arch/arm/mach-s5pv210/mach-smdkv210.c
> b/arch/arm/mach-s5pv210/mach-smdkv210.c index 4cdb5bb..cd28725 100644
> --- a/arch/arm/mach-s5pv210/mach-smdkv210.c
> +++ b/arch/arm/mach-s5pv210/mach-smdkv210.c
> @@ -45,7 +45,7 @@
>  #include <plat/keypad.h>
>  #include <plat/pm.h>
>  #include <plat/fb.h>
> -#include <plat/s5p-time.h>
> +#include <plat/samsung-time.h>
>  #include <plat/backlight.h>
>  #include <plat/mfc.h>
>  #include <plat/clock.h>
> @@ -287,7 +287,7 @@ static void __init smdkv210_map_io(void)
>  	s5pv210_init_io(NULL, 0);
>  	s3c24xx_init_clocks(clk_xusbxti.rate);
>  	s3c24xx_init_uarts(smdkv210_uartcfgs, ARRAY_SIZE(smdkv210_uartcfgs));
> -	s5p_set_timer_source(S5P_PWM2, S5P_PWM4);
> +	samsung_set_timer_source(SAMSUNG_PWM2, SAMSUNG_PWM4);
>  }
> 
>  static void __init smdkv210_reserve(void)
> @@ -332,7 +332,7 @@ MACHINE_START(SMDKV210, "SMDKV210")
>  	.handle_irq	= vic_handle_irq,
>  	.map_io		= smdkv210_map_io,
>  	.init_machine	= smdkv210_machine_init,
> -	.timer		= &s5p_timer,
> +	.timer		= &samsung_timer,
>  	.restart	= s5pv210_restart,
>  	.reserve	= &smdkv210_reserve,
>  MACHINE_END
> diff --git a/arch/arm/mach-s5pv210/mach-torbreck.c
> b/arch/arm/mach-s5pv210/mach-torbreck.c index 18785cb..aec668c 100644
> --- a/arch/arm/mach-s5pv210/mach-torbreck.c
> +++ b/arch/arm/mach-s5pv210/mach-torbreck.c
> @@ -27,7 +27,7 @@
>  #include <plat/devs.h>
>  #include <plat/cpu.h>
>  #include <linux/platform_data/i2c-s3c2410.h>
> -#include <plat/s5p-time.h>
> +#include <plat/samsung-time.h>
> 
>  #include "common.h"
> 
> @@ -107,7 +107,7 @@ static void __init torbreck_map_io(void)
>  	s5pv210_init_io(NULL, 0);
>  	s3c24xx_init_clocks(24000000);
>  	s3c24xx_init_uarts(torbreck_uartcfgs, ARRAY_SIZE(torbreck_uartcfgs));
> -	s5p_set_timer_source(S5P_PWM3, S5P_PWM4);
> +	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
>  }
> 
>  static void __init torbreck_machine_init(void)
> @@ -132,6 +132,6 @@ MACHINE_START(TORBRECK, "TORBRECK")
>  	.handle_irq	= vic_handle_irq,
>  	.map_io		= torbreck_map_io,
>  	.init_machine	= torbreck_machine_init,
> -	.timer		= &s5p_timer,
> +	.timer		= &samsung_timer,
>  	.restart	= s5pv210_restart,
>  MACHINE_END
> diff --git a/arch/arm/plat-samsung/Kconfig b/arch/arm/plat-samsung/Kconfig
> index 59401e1..5278795 100644
> --- a/arch/arm/plat-samsung/Kconfig
> +++ b/arch/arm/plat-samsung/Kconfig
> @@ -70,7 +70,7 @@ config S3C_LOWLEVEL_UART_PORT
> 
>  # timer options
> 
> -config S5P_HRT
> +config SAMSUNG_HRT
>  	bool
>  	select SAMSUNG_DEV_PWM
>  	help
> diff --git a/arch/arm/plat-samsung/Makefile
> b/arch/arm/plat-samsung/Makefile index 9e40e8d..06f2312 100644
> --- a/arch/arm/plat-samsung/Makefile
> +++ b/arch/arm/plat-samsung/Makefile
> @@ -13,7 +13,7 @@ obj-				:=
> 
>  obj-y				+= init.o cpu.o
>  obj-$(CONFIG_ARCH_USES_GETTIMEOFFSET)   += time.o
> -obj-$(CONFIG_S5P_HRT) 		+= s5p-time.o
> +obj-$(CONFIG_SAMSUNG_HRT) 		+= samsung-time.o
> 
>  obj-$(CONFIG_SAMSUNG_CLOCK)	+= clock.o
>  obj-$(CONFIG_SAMSUNG_CLOCK)	+= pwm-clock.o
> diff --git a/arch/arm/plat-samsung/include/plat/s5p-time.h
> b/arch/arm/plat-samsung/include/plat/s5p-time.h deleted file mode 100644
> index 3a70aeb..0000000
> --- a/arch/arm/plat-samsung/include/plat/s5p-time.h
> +++ /dev/null
> @@ -1,40 +0,0 @@
> -/* linux/arch/arm/plat-samsung/include/plat/s5p-time.h
> - *
> - * Copyright 2011 Samsung Electronics Co., Ltd.
> - *		http://www.samsung.com/
> - *
> - * Header file for s5p time support
> - *
> - * This program is free software; you can redistribute it and/or modify
> - * it under the terms of the GNU General Public License version 2 as
> - * published by the Free Software Foundation.
> -*/
> -
> -#ifndef __ASM_PLAT_S5P_TIME_H
> -#define __ASM_PLAT_S5P_TIME_H __FILE__
> -
> -/* S5P HR-Timer Clock mode */
> -enum s5p_timer_mode {
> -	S5P_PWM0,
> -	S5P_PWM1,
> -	S5P_PWM2,
> -	S5P_PWM3,
> -	S5P_PWM4,
> -};
> -
> -struct s5p_timer_source {
> -	unsigned int event_id;
> -	unsigned int source_id;
> -};
> -
> -/* Be able to sleep for atleast 4 seconds (usually more) */
> -#define S5PTIMER_MIN_RANGE	4
> -
> -#define TCNT_MAX		0xffffffff
> -#define NON_PERIODIC		0
> -#define PERIODIC		1
> -
> -extern void __init s5p_set_timer_source(enum s5p_timer_mode event,
> -					enum s5p_timer_mode source);
> -extern	struct sys_timer s5p_timer;
> -#endif /* __ASM_PLAT_S5P_TIME_H */
> diff --git a/arch/arm/plat-samsung/include/plat/samsung-time.h
> b/arch/arm/plat-samsung/include/plat/samsung-time.h new file mode 100644
> index 0000000..9d6d622
> --- /dev/null
> +++ b/arch/arm/plat-samsung/include/plat/samsung-time.h
> @@ -0,0 +1,40 @@
> +/* linux/arch/arm/plat-samsung/include/plat/samsung-time.h
> + *
> + * Copyright 2011 Samsung Electronics Co., Ltd.
> + *		http://www.samsung.com/
> + *
> + * Header file for samsung s3c and s5p time support
> + *
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License version 2 as
> + * published by the Free Software Foundation.
> +*/
> +
> +#ifndef __ASM_PLAT_SAMSUNG_TIME_H
> +#define __ASM_PLAT_SAMSUNG_TIME_H __FILE__
> +
> +/* SAMSUNG HR-Timer Clock mode */
> +enum samsung_timer_mode {
> +	SAMSUNG_PWM0,
> +	SAMSUNG_PWM1,
> +	SAMSUNG_PWM2,
> +	SAMSUNG_PWM3,
> +	SAMSUNG_PWM4,
> +};
> +
> +struct samsung_timer_source {
> +	unsigned int event_id;
> +	unsigned int source_id;
> +};
> +
> +/* Be able to sleep for atleast 4 seconds (usually more) */
> +#define SAMSUNG_TIMER_MIN_RANGE	4
> +
> +#define TCNT_MAX		0xffffffff
> +#define NON_PERIODIC		0
> +#define PERIODIC		1
> +
> +extern void __init samsung_set_timer_source(enum samsung_timer_mode event,
> +					enum samsung_timer_mode source);
> +extern	struct sys_timer samsung_timer;
> +#endif /* __ASM_PLAT_SAMSUNG_TIME_H */
> diff --git a/arch/arm/plat-samsung/s5p-time.c
> b/arch/arm/plat-samsung/samsung-time.c similarity index 70%
> rename from arch/arm/plat-samsung/s5p-time.c
> rename to arch/arm/plat-samsung/samsung-time.c
> index 028b6e8..91773bf 100644
> --- a/arch/arm/plat-samsung/s5p-time.c
> +++ b/arch/arm/plat-samsung/samsung-time.c
> @@ -2,7 +2,7 @@
>   * Copyright (c) 2011 Samsung Electronics Co., Ltd.
>   *		http://www.samsung.com/
>   *
> - * S5P - Common hr-timer support
> + * SAMSUNG - Common hr-timer support
>   *
>   * This program is free software; you can redistribute it and/or modify
>   * it under the terms of the GNU General Public License version 2 as
> @@ -25,41 +25,41 @@
>  #include <mach/map.h>
>  #include <plat/devs.h>
>  #include <plat/regs-timer.h>
> -#include <plat/s5p-time.h>
> +#include <plat/samsung-time.h>
> 
>  static struct clk *tin_event;
>  static struct clk *tin_source;
>  static struct clk *tdiv_event;
>  static struct clk *tdiv_source;
>  static struct clk *timerclk;
> -static struct s5p_timer_source timer_source;
> +static struct samsung_timer_source timer_source;
>  static unsigned long clock_count_per_tick;
> -static void s5p_timer_resume(void);
> +static void samsung_timer_resume(void);
> 
> -static void s5p_time_stop(enum s5p_timer_mode mode)
> +static void samsung_time_stop(enum samsung_timer_mode mode)
>  {
>  	unsigned long tcon;
> 
>  	tcon = __raw_readl(S3C2410_TCON);
> 
>  	switch (mode) {
> -	case S5P_PWM0:
> +	case SAMSUNG_PWM0:
>  		tcon &= ~S3C2410_TCON_T0START;
>  		break;
> 
> -	case S5P_PWM1:
> +	case SAMSUNG_PWM1:
>  		tcon &= ~S3C2410_TCON_T1START;
>  		break;
> 
> -	case S5P_PWM2:
> +	case SAMSUNG_PWM2:
>  		tcon &= ~S3C2410_TCON_T2START;
>  		break;
> 
> -	case S5P_PWM3:
> +	case SAMSUNG_PWM3:
>  		tcon &= ~S3C2410_TCON_T3START;
>  		break;
> 
> -	case S5P_PWM4:
> +	case SAMSUNG_PWM4:
>  		tcon &= ~S3C2410_TCON_T4START;
>  		break;
> 
> @@ -70,7 +70,7 @@ static void s5p_time_stop(enum s5p_timer_mode mode)
>  	__raw_writel(tcon, S3C2410_TCON);
>  }
> 
> -static void s5p_time_setup(enum s5p_timer_mode mode, unsigned long tcnt)
> +static void samsung_time_setup(enum samsung_timer_mode mode, unsigned long
> tcnt) {
>  	unsigned long tcon;
> 
> @@ -79,27 +79,27 @@ static void s5p_time_setup(enum s5p_timer_mode mode,
> unsigned long tcnt) tcnt--;
> 
>  	switch (mode) {
> -	case S5P_PWM0:
> +	case SAMSUNG_PWM0:
>  		tcon &= ~(0x0f << 0);
>  		tcon |= S3C2410_TCON_T0MANUALUPD;
>  		break;
> 
> -	case S5P_PWM1:
> +	case SAMSUNG_PWM1:
>  		tcon &= ~(0x0f << 8);
>  		tcon |= S3C2410_TCON_T1MANUALUPD;
>  		break;
> 
> -	case S5P_PWM2:
> +	case SAMSUNG_PWM2:
>  		tcon &= ~(0x0f << 12);
>  		tcon |= S3C2410_TCON_T2MANUALUPD;
>  		break;
> 
> -	case S5P_PWM3:
> +	case SAMSUNG_PWM3:
>  		tcon &= ~(0x0f << 16);
>  		tcon |= S3C2410_TCON_T3MANUALUPD;
>  		break;
> 
> -	case S5P_PWM4:
> +	case SAMSUNG_PWM4:
>  		tcon &= ~(0x07 << 20);
>  		tcon |= S3C2410_TCON_T4MANUALUPD;
>  		break;
> @@ -114,14 +114,14 @@ static void s5p_time_setup(enum s5p_timer_mode mode,
> unsigned long tcnt) __raw_writel(tcon, S3C2410_TCON);
>  }
> 
> -static void s5p_time_start(enum s5p_timer_mode mode, bool periodic)
> +static void samsung_time_start(enum samsung_timer_mode mode, bool
> periodic) {
>  	unsigned long tcon;
> 
>  	tcon  = __raw_readl(S3C2410_TCON);
> 
>  	switch (mode) {
> -	case S5P_PWM0:
> +	case SAMSUNG_PWM0:
>  		tcon |= S3C2410_TCON_T0START;
>  		tcon &= ~S3C2410_TCON_T0MANUALUPD;
> 
> @@ -131,7 +131,7 @@ static void s5p_time_start(enum s5p_timer_mode mode,
> bool periodic) tcon &= ~S3C2410_TCON_T0RELOAD;
>  		break;
> 
> -	case S5P_PWM1:
> +	case SAMSUNG_PWM1:
>  		tcon |= S3C2410_TCON_T1START;
>  		tcon &= ~S3C2410_TCON_T1MANUALUPD;
> 
> @@ -141,7 +141,7 @@ static void s5p_time_start(enum s5p_timer_mode mode,
> bool periodic) tcon &= ~S3C2410_TCON_T1RELOAD;
>  		break;
> 
> -	case S5P_PWM2:
> +	case SAMSUNG_PWM2:
>  		tcon |= S3C2410_TCON_T2START;
>  		tcon &= ~S3C2410_TCON_T2MANUALUPD;
> 
> @@ -151,7 +151,7 @@ static void s5p_time_start(enum s5p_timer_mode mode,
> bool periodic) tcon &= ~S3C2410_TCON_T2RELOAD;
>  		break;
> 
> -	case S5P_PWM3:
> +	case SAMSUNG_PWM3:
>  		tcon |= S3C2410_TCON_T3START;
>  		tcon &= ~S3C2410_TCON_T3MANUALUPD;
> 
> @@ -161,7 +161,7 @@ static void s5p_time_start(enum s5p_timer_mode mode,
> bool periodic) tcon &= ~S3C2410_TCON_T3RELOAD;
>  		break;
> 
> -	case S5P_PWM4:
> +	case SAMSUNG_PWM4:
>  		tcon |= S3C2410_TCON_T4START;
>  		tcon &= ~S3C2410_TCON_T4MANUALUPD;
> 
> @@ -178,24 +178,24 @@ static void s5p_time_start(enum s5p_timer_mode mode,
> bool periodic) __raw_writel(tcon, S3C2410_TCON);
>  }
> 
> -static int s5p_set_next_event(unsigned long cycles,
> +static int samsung_set_next_event(unsigned long cycles,
>  				struct clock_event_device *evt)
>  {
> -	s5p_time_setup(timer_source.event_id, cycles);
> -	s5p_time_start(timer_source.event_id, NON_PERIODIC);
> +	samsung_time_setup(timer_source.event_id, cycles);
> +	samsung_time_start(timer_source.event_id, NON_PERIODIC);
> 
>  	return 0;
>  }
> 
> -static void s5p_set_mode(enum clock_event_mode mode,
> +static void samsung_set_mode(enum clock_event_mode mode,
>  				struct clock_event_device *evt)
>  {
> -	s5p_time_stop(timer_source.event_id);
> +	samsung_time_stop(timer_source.event_id);
> 
>  	switch (mode) {
>  	case CLOCK_EVT_MODE_PERIODIC:
> -		s5p_time_setup(timer_source.event_id, clock_count_per_tick);
> -		s5p_time_start(timer_source.event_id, PERIODIC);
> +		samsung_time_setup(timer_source.event_id, clock_count_per_tick);
> +		samsung_time_start(timer_source.event_id, PERIODIC);
>  		break;
> 
>  	case CLOCK_EVT_MODE_ONESHOT:
> @@ -206,24 +206,24 @@ static void s5p_set_mode(enum clock_event_mode mode,
>  		break;
> 
>  	case CLOCK_EVT_MODE_RESUME:
> -		s5p_timer_resume();
> +		samsung_timer_resume();
>  		break;
>  	}
>  }
> 
> -static void s5p_timer_resume(void)
> +static void samsung_timer_resume(void)
>  {
>  	/* event timer restart */
> -	s5p_time_setup(timer_source.event_id, clock_count_per_tick);
> -	s5p_time_start(timer_source.event_id, PERIODIC);
> +	samsung_time_setup(timer_source.event_id, clock_count_per_tick);
> +	samsung_time_start(timer_source.event_id, PERIODIC);
> 
>  	/* source timer restart */
> -	s5p_time_setup(timer_source.source_id, TCNT_MAX);
> -	s5p_time_start(timer_source.source_id, PERIODIC);
> +	samsung_time_setup(timer_source.source_id, TCNT_MAX);
> +	samsung_time_start(timer_source.source_id, PERIODIC);
>  }
> 
> -void __init s5p_set_timer_source(enum s5p_timer_mode event,
> -				 enum s5p_timer_mode source)
> +void __init samsung_set_timer_source(enum samsung_timer_mode event,
> +				 enum samsung_timer_mode source)
>  {
>  	s3c_device_timer[event].dev.bus = &platform_bus_type;
>  	s3c_device_timer[source].dev.bus = &platform_bus_type;
> @@ -233,14 +233,14 @@ void __init s5p_set_timer_source(enum s5p_timer_mode
> event, }
> 
>  static struct clock_event_device time_event_device = {
> -	.name		= "s5p_event_timer",
> +	.name		= "samsung_event_timer",
>  	.features	= CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT,
>  	.rating		= 200,
> -	.set_next_event	= s5p_set_next_event,
> -	.set_mode	= s5p_set_mode,
> +	.set_next_event	= samsung_set_next_event,
> +	.set_mode	= samsung_set_mode,
>  };
> 
> -static irqreturn_t s5p_clock_event_isr(int irq, void *dev_id)
> +static irqreturn_t samsung_clock_event_isr(int irq, void *dev_id)
>  {
>  	struct clock_event_device *evt = dev_id;
> 
> @@ -249,14 +249,14 @@ static irqreturn_t s5p_clock_event_isr(int irq, void
> *dev_id) return IRQ_HANDLED;
>  }
> 
> -static struct irqaction s5p_clock_event_irq = {
> -	.name		= "s5p_time_irq",
> +static struct irqaction samsung_clock_event_irq = {
> +	.name		= "samsung_time_irq",
>  	.flags		= IRQF_DISABLED | IRQF_TIMER | IRQF_IRQPOLL,
> -	.handler	= s5p_clock_event_isr,
> +	.handler	= samsung_clock_event_isr,
>  	.dev_id		= &time_event_device,
>  };
> 
> -static void __init s5p_clockevent_init(void)
> +static void __init samsung_clockevent_init(void)
>  {
>  	unsigned long pclk;
>  	unsigned long clock_rate;
> @@ -275,7 +275,7 @@ static void __init s5p_clockevent_init(void)
>  	clock_count_per_tick = clock_rate / HZ;
> 
>  	clockevents_calc_mult_shift(&time_event_device,
> -				    clock_rate, S5PTIMER_MIN_RANGE);
> +				    clock_rate, SAMSUNG_TIMER_MIN_RANGE);
>  	time_event_device.max_delta_ns =
>  		clockevent_delta2ns(-1, &time_event_device);
>  	time_event_device.min_delta_ns =
> @@ -285,22 +285,22 @@ static void __init s5p_clockevent_init(void)
>  	clockevents_register_device(&time_event_device);
> 
>  	irq_number = timer_source.event_id + IRQ_TIMER0;
> -	setup_irq(irq_number, &s5p_clock_event_irq);
> +	setup_irq(irq_number, &samsung_clock_event_irq);
>  }
> 
> -static void __iomem *s5p_timer_reg(void)
> +static void __iomem *samsung_timer_reg(void)
>  {
>  	unsigned long offset = 0;
> 
>  	switch (timer_source.source_id) {
> -	case S5P_PWM0:
> -	case S5P_PWM1:
> -	case S5P_PWM2:
> -	case S5P_PWM3:
> +	case SAMSUNG_PWM0:
> +	case SAMSUNG_PWM1:
> +	case SAMSUNG_PWM2:
> +	case SAMSUNG_PWM3:
>  		offset = (timer_source.source_id * 0x0c) + 0x14;
>  		break;
> 
> -	case S5P_PWM4:
> +	case SAMSUNG_PWM4:
>  		offset = 0x40;
>  		break;
> 
> @@ -319,9 +319,9 @@ static void __iomem *s5p_timer_reg(void)
>   * this wraps around for now, since it is just a relative time
>   * stamp. (Inspired by U300 implementation.)
>   */
> -static u32 notrace s5p_read_sched_clock(void)
> +static u32 notrace samsung_read_sched_clock(void)
>  {
> -	void __iomem *reg = s5p_timer_reg();
> +	void __iomem *reg = samsung_timer_reg();
> 
>  	if (!reg)
>  		return 0;
> @@ -329,7 +329,7 @@ static u32 notrace s5p_read_sched_clock(void)
>  	return ~__raw_readl(reg);
>  }
> 
> -static void __init s5p_clocksource_init(void)
> +static void __init samsung_clocksource_init(void)
>  {
>  	unsigned long pclk;
>  	unsigned long clock_rate;
> @@ -341,17 +341,17 @@ static void __init s5p_clocksource_init(void)
> 
>  	clock_rate = clk_get_rate(tin_source);
> 
> -	s5p_time_setup(timer_source.source_id, TCNT_MAX);
> -	s5p_time_start(timer_source.source_id, PERIODIC);
> +	samsung_time_setup(timer_source.source_id, TCNT_MAX);
> +	samsung_time_start(timer_source.source_id, PERIODIC);
> 
> -	setup_sched_clock(s5p_read_sched_clock, 32, clock_rate);
> +	setup_sched_clock(samsung_read_sched_clock, 32, clock_rate);
> 
> -	if (clocksource_mmio_init(s5p_timer_reg(), "s5p_clocksource_timer",
> +	if (clocksource_mmio_init(samsung_timer_reg(),
> "samsung_clocksource_timer", clock_rate, 250, 32,
> clocksource_mmio_readl_down))
> -		panic("s5p_clocksource_timer: can't register clocksource\n");
> +		panic("samsung_clocksource_timer: can't register clocksource\n");
>  }
> 
> -static void __init s5p_timer_resources(void)
> +static void __init samsung_timer_resources(void)
>  {
> 
>  	unsigned long event_id = timer_source.event_id;
> @@ -393,13 +393,13 @@ static void __init s5p_timer_resources(void)
>  	clk_enable(tin_source);
>  }
> 
> -static void __init s5p_timer_init(void)
> +static void __init samsung_timer_init(void)
>  {
> -	s5p_timer_resources();
> -	s5p_clockevent_init();
> -	s5p_clocksource_init();
> +	samsung_timer_resources();
> +	samsung_clockevent_init();
> +	samsung_clocksource_init();
>  }
> 
> -struct sys_timer s5p_timer = {
> -	.init		= s5p_timer_init,
> +struct sys_timer samsung_timer = {
> +	.init		= samsung_timer_init,
>  };

^ permalink raw reply	[flat|nested] 39+ messages in thread

* Re: [PATCH 2/5 v2] Add samsung-time support for s3c24xx
  2012-12-02 19:44             ` [PATCH 2/5 v2] Add samsung-time support for s3c24xx Romain Naour
@ 2012-12-10 13:00               ` Heiko Stübner
  2012-12-15 21:40                 ` Romain Naour
  0 siblings, 1 reply; 39+ messages in thread
From: Heiko Stübner @ 2012-12-10 13:00 UTC (permalink / raw)
  To: Romain Naour
  Cc: tomasz.figa, Kukjin Kim, linux-samsung-soc, ben-linux,
	'Sylwester Nawrocki'

Am Sonntag, 2. Dezember 2012, 20:44:09 schrieb Romain Naour:
> This patch replace ARCH_USES_GETTIMEOFFSET by GENERIC_CLOCKEVENTS for
> s3c24xx devices. It becomes possible to use the high-resolution timer and
> dynamic ticks.
> 
> 
> Signed-off-by: Naour Romain <romain.naour@openwide.fr>

Tested-by: Heiko Stuebner <heiko@sntech.de>

on a s3c2416 based board

> diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
> index ade7e92..6563476 100644
> --- a/arch/arm/Kconfig
> +++ b/arch/arm/Kconfig
> @@ -737,7 +737,8 @@ config ARCH_SA1100
>  config ARCH_S3C24XX
>  	bool "Samsung S3C24XX SoCs"
>  	select ARCH_HAS_CPUFREQ
> -	select ARCH_USES_GETTIMEOFFSET
> +	select GENERIC_CLOCKEVENTS
> +	select CLKSRC_MMIO
>  	select CLKDEV_LOOKUP
>  	select GENERIC_GPIO
>  	select HAVE_CLK
> diff --git a/arch/arm/mach-s3c24xx/Kconfig b/arch/arm/mach-s3c24xx/Kconfig
> index 2b6cb5f..be2c482 100644
> --- a/arch/arm/mach-s3c24xx/Kconfig
> +++ b/arch/arm/mach-s3c24xx/Kconfig
> @@ -21,6 +21,7 @@ config CPU_S3C2410
>  	select S3C2410_CLOCK
>  	select S3C2410_CPUFREQ if CPU_FREQ_S3C24XX
>  	select S3C2410_PM if PM
> +	select SAMSUNG_HRT
>  	help
>  	  Support for S3C2410 and S3C2410A family from the S3C24XX line
>  	  of Samsung Mobile CPUs.
> @@ -32,6 +33,7 @@ config CPU_S3C2412
>  	select CPU_LLSERIAL_S3C2440
>  	select S3C2412_DMA if S3C24XX_DMA
>  	select S3C2412_PM if PM
> +	select SAMSUNG_HRT
>  	help
>  	  Support for the S3C2412 and S3C2413 SoCs from the S3C24XX line
> 
> @@ -44,6 +46,7 @@ config CPU_S3C2416
>  	select S3C2443_COMMON
>  	select S3C2443_DMA if S3C24XX_DMA
>  	select SAMSUNG_CLKSRC
> +	select SAMSUNG_HRT
>  	help
>  	  Support for the S3C2416 SoC from the S3C24XX line
> 
> @@ -54,6 +57,7 @@ config CPU_S3C2440
>  	select S3C2410_CLOCK
>  	select S3C2410_PM if PM
>  	select S3C2440_DMA if S3C24XX_DMA
> +	select SAMSUNG_HRT
>  	help
>  	  Support for S3C2440 Samsung Mobile CPU based systems.
> 
> @@ -63,6 +67,7 @@ config CPU_S3C2442
>  	select CPU_LLSERIAL_S3C2440
>  	select S3C2410_CLOCK
>  	select S3C2410_PM if PM
> +	select SAMSUNG_HRT
>  	help
>  	  Support for S3C2442 Samsung Mobile CPU based systems.
> 
> @@ -78,6 +83,7 @@ config CPU_S3C2443
>  	select S3C2443_COMMON
>  	select S3C2443_DMA if S3C24XX_DMA
>  	select SAMSUNG_CLKSRC
> +	select SAMSUNG_HRT
>  	help
>  	  Support for the S3C2443 SoC from the S3C24XX line
> 
> diff --git a/arch/arm/mach-s3c24xx/mach-amlm5900.c
> b/arch/arm/mach-s3c24xx/mach-amlm5900.c index f4ad99c..84c9bb0 100644
> --- a/arch/arm/mach-s3c24xx/mach-amlm5900.c
> +++ b/arch/arm/mach-s3c24xx/mach-amlm5900.c
> @@ -63,6 +63,8 @@
>  #include <linux/mtd/map.h>
>  #include <linux/mtd/physmap.h>
> 
> +#include <plat/samsung-time.h>
> +
>  #include "common.h"
> 
>  static struct resource amlm5900_nor_resource =
> @@ -160,6 +162,7 @@ static void __init amlm5900_map_io(void)
>  	s3c24xx_init_io(amlm5900_iodesc, ARRAY_SIZE(amlm5900_iodesc));
>  	s3c24xx_init_clocks(0);
>  	s3c24xx_init_uarts(amlm5900_uartcfgs, ARRAY_SIZE(amlm5900_uartcfgs));
> +	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
>  }
> 
>  #ifdef CONFIG_FB_S3C2410
> @@ -237,6 +240,6 @@ MACHINE_START(AML_M5900, "AML_M5900")
>  	.map_io		= amlm5900_map_io,
>  	.init_irq	= s3c24xx_init_irq,
>  	.init_machine	= amlm5900_init,
> -	.timer		= &s3c24xx_timer,
> +	.timer		= &samsung_timer,
>  	.restart	= s3c2410_restart,
>  MACHINE_END
> diff --git a/arch/arm/mach-s3c24xx/mach-anubis.c
> b/arch/arm/mach-s3c24xx/mach-anubis.c index 1ee8c46..65ba844 100644
> --- a/arch/arm/mach-s3c24xx/mach-anubis.c
> +++ b/arch/arm/mach-s3c24xx/mach-anubis.c
> @@ -54,6 +54,7 @@
>  #include <plat/devs.h>
>  #include <plat/cpu.h>
>  #include <linux/platform_data/asoc-s3c24xx_simtec.h>
> +#include <plat/samsung-time.h>
> 
>  #include "simtec.h"
>  #include "common.h"
> @@ -414,6 +415,7 @@ static void __init anubis_map_io(void)
>  	s3c24xx_init_io(anubis_iodesc, ARRAY_SIZE(anubis_iodesc));
>  	s3c24xx_init_clocks(0);
>  	s3c24xx_init_uarts(anubis_uartcfgs, ARRAY_SIZE(anubis_uartcfgs));
> +	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
> 
>  	/* check for the newer revision boards with large page nand */
> 
> @@ -448,6 +450,6 @@ MACHINE_START(ANUBIS, "Simtec-Anubis")
>  	.map_io		= anubis_map_io,
>  	.init_machine	= anubis_init,
>  	.init_irq	= s3c24xx_init_irq,
> -	.timer		= &s3c24xx_timer,
> +	.timer		= &samsung_timer,
>  	.restart	= s3c244x_restart,
>  MACHINE_END
> diff --git a/arch/arm/mach-s3c24xx/mach-at2440evb.c
> b/arch/arm/mach-s3c24xx/mach-at2440evb.c index 00381fe..d7eb641 100644
> --- a/arch/arm/mach-s3c24xx/mach-at2440evb.c
> +++ b/arch/arm/mach-s3c24xx/mach-at2440evb.c
> @@ -48,6 +48,7 @@
>  #include <plat/devs.h>
>  #include <plat/cpu.h>
>  #include <linux/platform_data/mmc-s3cmci.h>
> +#include <plat/samsung-time.h>
> 
>  #include "common.h"
> 
> @@ -192,6 +193,7 @@ static void __init at2440evb_map_io(void)
>  	s3c24xx_init_io(at2440evb_iodesc, ARRAY_SIZE(at2440evb_iodesc));
>  	s3c24xx_init_clocks(16934400);
>  	s3c24xx_init_uarts(at2440evb_uartcfgs, ARRAY_SIZE(at2440evb_uartcfgs));
> +	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
>  }
> 
>  static void __init at2440evb_init(void)
> @@ -210,6 +212,6 @@ MACHINE_START(AT2440EVB, "AT2440EVB")
>  	.map_io		= at2440evb_map_io,
>  	.init_machine	= at2440evb_init,
>  	.init_irq	= s3c24xx_init_irq,
> -	.timer		= &s3c24xx_timer,
> +	.timer		= &samsung_timer,
>  	.restart	= s3c244x_restart,
>  MACHINE_END
> diff --git a/arch/arm/mach-s3c24xx/mach-bast.c
> b/arch/arm/mach-s3c24xx/mach-bast.c index 6a30ce7..a9c442e 100644
> --- a/arch/arm/mach-s3c24xx/mach-bast.c
> +++ b/arch/arm/mach-s3c24xx/mach-bast.c
> @@ -63,6 +63,7 @@
>  #include <plat/cpu-freq.h>
>  #include <plat/gpio-cfg.h>
>  #include <linux/platform_data/asoc-s3c24xx_simtec.h>
> +#include <plat/samsung-time.h>
> 
>  #include "simtec.h"
>  #include "common.h"
> @@ -583,6 +584,7 @@ static void __init bast_map_io(void)
>  	s3c24xx_init_io(bast_iodesc, ARRAY_SIZE(bast_iodesc));
>  	s3c24xx_init_clocks(0);
>  	s3c24xx_init_uarts(bast_uartcfgs, ARRAY_SIZE(bast_uartcfgs));
> +	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
>  }
> 
>  static void __init bast_init(void)
> @@ -612,6 +614,6 @@ MACHINE_START(BAST, "Simtec-BAST")
>  	.map_io		= bast_map_io,
>  	.init_irq	= s3c24xx_init_irq,
>  	.init_machine	= bast_init,
> -	.timer		= &s3c24xx_timer,
> +	.timer		= &samsung_timer,
>  	.restart	= s3c2410_restart,
>  MACHINE_END
> diff --git a/arch/arm/mach-s3c24xx/mach-gta02.c
> b/arch/arm/mach-s3c24xx/mach-gta02.c index 4a96346..02c6c6a 100644
> --- a/arch/arm/mach-s3c24xx/mach-gta02.c
> +++ b/arch/arm/mach-s3c24xx/mach-gta02.c
> @@ -88,6 +88,7 @@
>  #include <plat/gpio-cfg.h>
>  #include <linux/platform_data/i2c-s3c2410.h>
>  #include <linux/platform_data/touchscreen-s3c2410.h>
> +#include <plat/samsung-time.h>
> 
>  #include "common.h"
> 
> @@ -507,6 +508,7 @@ static void __init gta02_map_io(void)
>  	s3c24xx_init_io(gta02_iodesc, ARRAY_SIZE(gta02_iodesc));
>  	s3c24xx_init_clocks(12000000);
>  	s3c24xx_init_uarts(gta02_uartcfgs, ARRAY_SIZE(gta02_uartcfgs));
> +	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
>  }
> 
> 
> @@ -596,6 +598,6 @@ MACHINE_START(NEO1973_GTA02, "GTA02")
>  	.map_io		= gta02_map_io,
>  	.init_irq	= s3c24xx_init_irq,
>  	.init_machine	= gta02_machine_init,
> -	.timer		= &s3c24xx_timer,
> +	.timer		= &samsung_timer,
>  	.restart	= s3c244x_restart,
>  MACHINE_END
> diff --git a/arch/arm/mach-s3c24xx/mach-h1940.c
> b/arch/arm/mach-s3c24xx/mach-h1940.c index 63aaf07..f5d3578 100644
> --- a/arch/arm/mach-s3c24xx/mach-h1940.c
> +++ b/arch/arm/mach-s3c24xx/mach-h1940.c
> @@ -67,6 +67,7 @@
>  #include <plat/pm.h>
>  #include <linux/platform_data/mmc-s3cmci.h>
>  #include <linux/platform_data/touchscreen-s3c2410.h>
> +#include <plat/samsung-time.h>
> 
>  #include <sound/uda1380.h>
> 
> @@ -652,6 +653,7 @@ static void __init h1940_map_io(void)
>  	s3c24xx_init_io(h1940_iodesc, ARRAY_SIZE(h1940_iodesc));
>  	s3c24xx_init_clocks(0);
>  	s3c24xx_init_uarts(h1940_uartcfgs, ARRAY_SIZE(h1940_uartcfgs));
> +	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
> 
>  	/* setup PM */
> 
> @@ -747,6 +749,6 @@ MACHINE_START(H1940, "IPAQ-H1940")
>  	.reserve	= h1940_reserve,
>  	.init_irq	= h1940_init_irq,
>  	.init_machine	= h1940_init,
> -	.timer		= &s3c24xx_timer,
> +	.timer		= &samsung_timer,
>  	.restart	= s3c2410_restart,
>  MACHINE_END
> diff --git a/arch/arm/mach-s3c24xx/mach-jive.c
> b/arch/arm/mach-s3c24xx/mach-jive.c index c9954e2..01a894d 100644
> --- a/arch/arm/mach-s3c24xx/mach-jive.c
> +++ b/arch/arm/mach-s3c24xx/mach-jive.c
> @@ -55,6 +55,7 @@
>  #include <plat/cpu.h>
>  #include <plat/pm.h>
>  #include <linux/platform_data/usb-s3c2410_udc.h>
> +#include <plat/samsung-time.h>
> 
>  static struct map_desc jive_iodesc[] __initdata = {
>  };
> @@ -506,6 +507,7 @@ static void __init jive_map_io(void)
>  	s3c24xx_init_io(jive_iodesc, ARRAY_SIZE(jive_iodesc));
>  	s3c24xx_init_clocks(12000000);
>  	s3c24xx_init_uarts(jive_uartcfgs, ARRAY_SIZE(jive_uartcfgs));
> +	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
>  }
> 
>  static void jive_power_off(void)
> @@ -661,6 +663,6 @@ MACHINE_START(JIVE, "JIVE")
>  	.init_irq	= s3c24xx_init_irq,
>  	.map_io		= jive_map_io,
>  	.init_machine	= jive_machine_init,
> -	.timer		= &s3c24xx_timer,
> +	.timer		= &samsung_timer,
>  	.restart	= s3c2412_restart,
>  MACHINE_END
> diff --git a/arch/arm/mach-s3c24xx/mach-mini2440.c
> b/arch/arm/mach-s3c24xx/mach-mini2440.c index 393c0f1..a96efcd 100644
> --- a/arch/arm/mach-s3c24xx/mach-mini2440.c
> +++ b/arch/arm/mach-s3c24xx/mach-mini2440.c
> @@ -57,6 +57,7 @@
>  #include <plat/clock.h>
>  #include <plat/devs.h>
>  #include <plat/cpu.h>
> +#include <plat/samsung-time.h>
> 
>  #include <sound/s3c24xx_uda134x.h>
> 
> @@ -527,6 +528,7 @@ static void __init mini2440_map_io(void)
>  	s3c24xx_init_io(mini2440_iodesc, ARRAY_SIZE(mini2440_iodesc));
>  	s3c24xx_init_clocks(12000000);
>  	s3c24xx_init_uarts(mini2440_uartcfgs, ARRAY_SIZE(mini2440_uartcfgs));
> +	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
>  }
> 
>  /*
> @@ -689,6 +691,6 @@ MACHINE_START(MINI2440, "MINI2440")
>  	.map_io		= mini2440_map_io,
>  	.init_machine	= mini2440_init,
>  	.init_irq	= s3c24xx_init_irq,
> -	.timer		= &s3c24xx_timer,
> +	.timer		= &samsung_timer,
>  	.restart	= s3c244x_restart,
>  MACHINE_END
> diff --git a/arch/arm/mach-s3c24xx/mach-n30.c
> b/arch/arm/mach-s3c24xx/mach-n30.c index c53a9bf..f6cea03 100644
> --- a/arch/arm/mach-s3c24xx/mach-n30.c
> +++ b/arch/arm/mach-s3c24xx/mach-n30.c
> @@ -50,6 +50,7 @@
>  #include <linux/platform_data/mmc-s3cmci.h>
>  #include <plat/s3c2410.h>
>  #include <linux/platform_data/usb-s3c2410_udc.h>
> +#include <plat/samsung-time.h>
> 
>  #include "common.h"
> 
> @@ -536,6 +537,7 @@ static void __init n30_map_io(void)
>  	n30_hwinit();
>  	s3c24xx_init_clocks(0);
>  	s3c24xx_init_uarts(n30_uartcfgs, ARRAY_SIZE(n30_uartcfgs));
> +	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
>  }
> 
>  /* GPB3 is the line that controls the pull-up for the USB D+ line */
> @@ -589,7 +591,7 @@ MACHINE_START(N30, "Acer-N30")
>  				Ben Dooks <ben-linux@fluff.org>
>  	*/
>  	.atag_offset	= 0x100,
> -	.timer		= &s3c24xx_timer,
> +	.timer		= &samsung_timer,
>  	.init_machine	= n30_init,
>  	.init_irq	= s3c24xx_init_irq,
>  	.map_io		= n30_map_io,
> @@ -600,7 +602,7 @@ MACHINE_START(N35, "Acer-N35")
>  	/* Maintainer: Christer Weinigel <christer@weinigel.se>
>  	*/
>  	.atag_offset	= 0x100,
> -	.timer		= &s3c24xx_timer,
> +	.timer		= &samsung_timer,
>  	.init_machine	= n30_init,
>  	.init_irq	= s3c24xx_init_irq,
>  	.map_io		= n30_map_io,
> diff --git a/arch/arm/mach-s3c24xx/mach-nexcoder.c
> b/arch/arm/mach-s3c24xx/mach-nexcoder.c index a2b92b0..4db6fb3 100644
> --- a/arch/arm/mach-s3c24xx/mach-nexcoder.c
> +++ b/arch/arm/mach-s3c24xx/mach-nexcoder.c
> @@ -46,6 +46,7 @@
>  #include <plat/clock.h>
>  #include <plat/devs.h>
>  #include <plat/cpu.h>
> +#include <plat/samsung-time.h>
> 
>  #include "common.h"
> 
> @@ -137,6 +138,7 @@ static void __init nexcoder_map_io(void)
>  	s3c24xx_init_io(nexcoder_iodesc, ARRAY_SIZE(nexcoder_iodesc));
>  	s3c24xx_init_clocks(0);
>  	s3c24xx_init_uarts(nexcoder_uartcfgs, ARRAY_SIZE(nexcoder_uartcfgs));
> +	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
> 
>  	nexcoder_sensorboard_init();
>  }
> @@ -153,6 +155,6 @@ MACHINE_START(NEXCODER_2440, "NexVision - Nexcoder
> 2440") .map_io		= nexcoder_map_io,
>  	.init_machine	= nexcoder_init,
>  	.init_irq	= s3c24xx_init_irq,
> -	.timer		= &s3c24xx_timer,
> +	.timer		= &samsung_timer,
>  	.restart	= s3c244x_restart,
>  MACHINE_END
> diff --git a/arch/arm/mach-s3c24xx/mach-osiris.c
> b/arch/arm/mach-s3c24xx/mach-osiris.c index bb36d83..e85144e 100644
> --- a/arch/arm/mach-s3c24xx/mach-osiris.c
> +++ b/arch/arm/mach-s3c24xx/mach-osiris.c
> @@ -53,6 +53,7 @@
>  #include <plat/clock.h>
>  #include <plat/devs.h>
>  #include <plat/cpu.h>
> +#include <plat/samsung-time.h>
> 
>  #include "common.h"
> 
> @@ -386,6 +387,7 @@ static void __init osiris_map_io(void)
>  	s3c24xx_init_io(osiris_iodesc, ARRAY_SIZE(osiris_iodesc));
>  	s3c24xx_init_clocks(0);
>  	s3c24xx_init_uarts(osiris_uartcfgs, ARRAY_SIZE(osiris_uartcfgs));
> +	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
> 
>  	/* check for the newer revision boards with large page nand */
> 
> @@ -428,6 +430,6 @@ MACHINE_START(OSIRIS, "Simtec-OSIRIS")
>  	.map_io		= osiris_map_io,
>  	.init_irq	= s3c24xx_init_irq,
>  	.init_machine	= osiris_init,
> -	.timer		= &s3c24xx_timer,
> +	.timer		= &samsung_timer,
>  	.restart	= s3c244x_restart,
>  MACHINE_END
> diff --git a/arch/arm/mach-s3c24xx/mach-otom.c
> b/arch/arm/mach-s3c24xx/mach-otom.c index bca39f0..ab5f353 100644
> --- a/arch/arm/mach-s3c24xx/mach-otom.c
> +++ b/arch/arm/mach-s3c24xx/mach-otom.c
> @@ -37,6 +37,7 @@
>  #include <plat/devs.h>
>  #include <linux/platform_data/i2c-s3c2410.h>
>  #include <plat/cpu.h>
> +#include <plat/samsung-time.h>
> 
>  #include "common.h"
> 
> @@ -104,6 +105,7 @@ static void __init otom11_map_io(void)
>  	s3c24xx_init_io(otom11_iodesc, ARRAY_SIZE(otom11_iodesc));
>  	s3c24xx_init_clocks(0);
>  	s3c24xx_init_uarts(otom11_uartcfgs, ARRAY_SIZE(otom11_uartcfgs));
> +	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
>  }
> 
>  static void __init otom11_init(void)
> @@ -118,6 +120,6 @@ MACHINE_START(OTOM, "Nex Vision - Otom 1.1")
>  	.map_io		= otom11_map_io,
>  	.init_machine	= otom11_init,
>  	.init_irq	= s3c24xx_init_irq,
> -	.timer		= &s3c24xx_timer,
> +	.timer		= &samsung_timer,
>  	.restart	= s3c2410_restart,
>  MACHINE_END
> diff --git a/arch/arm/mach-s3c24xx/mach-qt2410.c
> b/arch/arm/mach-s3c24xx/mach-qt2410.c index 7b6ba13..e725554 100644
> --- a/arch/arm/mach-s3c24xx/mach-qt2410.c
> +++ b/arch/arm/mach-s3c24xx/mach-qt2410.c
> @@ -60,6 +60,7 @@
>  #include <plat/devs.h>
>  #include <plat/cpu.h>
>  #include <plat/pm.h>
> +#include <plat/samsung-time.h>
> 
>  #include "common.h"
> 
> @@ -304,6 +305,7 @@ static void __init qt2410_map_io(void)
>  	s3c24xx_init_io(qt2410_iodesc, ARRAY_SIZE(qt2410_iodesc));
>  	s3c24xx_init_clocks(12*1000*1000);
>  	s3c24xx_init_uarts(smdk2410_uartcfgs, ARRAY_SIZE(smdk2410_uartcfgs));
> +	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
>  }
> 
>  static void __init qt2410_machine_init(void)
> @@ -343,6 +345,6 @@ MACHINE_START(QT2410, "QT2410")
>  	.map_io		= qt2410_map_io,
>  	.init_irq	= s3c24xx_init_irq,
>  	.init_machine	= qt2410_machine_init,
> -	.timer		= &s3c24xx_timer,
> +	.timer		= &samsung_timer,
>  	.restart	= s3c2410_restart,
>  MACHINE_END
> diff --git a/arch/arm/mach-s3c24xx/mach-rx1950.c
> b/arch/arm/mach-s3c24xx/mach-rx1950.c index 379fde5..63fbeb1 100644
> --- a/arch/arm/mach-s3c24xx/mach-rx1950.c
> +++ b/arch/arm/mach-s3c24xx/mach-rx1950.c
> @@ -58,6 +58,7 @@
>  #include <plat/pm.h>
>  #include <plat/irq.h>
>  #include <linux/platform_data/touchscreen-s3c2410.h>
> +#include <plat/samsung-time.h>
> 
>  #include <sound/uda1380.h>
> 
> @@ -743,6 +744,7 @@ static void __init rx1950_map_io(void)
>  	s3c24xx_init_io(rx1950_iodesc, ARRAY_SIZE(rx1950_iodesc));
>  	s3c24xx_init_clocks(16934000);
>  	s3c24xx_init_uarts(rx1950_uartcfgs, ARRAY_SIZE(rx1950_uartcfgs));
> +	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
> 
>  	/* setup PM */
> 
> @@ -815,6 +817,6 @@ MACHINE_START(RX1950, "HP iPAQ RX1950")
>  	.reserve	= rx1950_reserve,
>  	.init_irq = s3c24xx_init_irq,
>  	.init_machine = rx1950_init_machine,
> -	.timer = &s3c24xx_timer,
> +	.timer = &samsung_timer,
>  	.restart	= s3c244x_restart,
>  MACHINE_END
> diff --git a/arch/arm/mach-s3c24xx/mach-rx3715.c
> b/arch/arm/mach-s3c24xx/mach-rx3715.c index dacbb9a..1b358a1 100644
> --- a/arch/arm/mach-s3c24xx/mach-rx3715.c
> +++ b/arch/arm/mach-s3c24xx/mach-rx3715.c
> @@ -50,6 +50,7 @@
>  #include <plat/devs.h>
>  #include <plat/cpu.h>
>  #include <plat/pm.h>
> +#include <plat/samsung-time.h>
> 
>  #include "common.h"
> 
> @@ -179,6 +180,7 @@ static void __init rx3715_map_io(void)
>  	s3c24xx_init_io(rx3715_iodesc, ARRAY_SIZE(rx3715_iodesc));
>  	s3c24xx_init_clocks(16934000);
>  	s3c24xx_init_uarts(rx3715_uartcfgs, ARRAY_SIZE(rx3715_uartcfgs));
> +	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
>  }
> 
>  /* H1940 and RX3715 need to reserve this for suspend */
> @@ -212,6 +214,6 @@ MACHINE_START(RX3715, "IPAQ-RX3715")
>  	.reserve	= rx3715_reserve,
>  	.init_irq	= rx3715_init_irq,
>  	.init_machine	= rx3715_init_machine,
> -	.timer		= &s3c24xx_timer,
> +	.timer		= &samsung_timer,
>  	.restart	= s3c244x_restart,
>  MACHINE_END
> diff --git a/arch/arm/mach-s3c24xx/mach-smdk2410.c
> b/arch/arm/mach-s3c24xx/mach-smdk2410.c index 82796b9..c7a18bc 100644
> --- a/arch/arm/mach-s3c24xx/mach-smdk2410.c
> +++ b/arch/arm/mach-s3c24xx/mach-smdk2410.c
> @@ -53,6 +53,7 @@
>  #include <plat/cpu.h>
> 
>  #include <plat/common-smdk.h>
> +#include <plat/samsung-time.h>
> 
>  #include "common.h"
> 
> @@ -101,6 +102,7 @@ static void __init smdk2410_map_io(void)
>  	s3c24xx_init_io(smdk2410_iodesc, ARRAY_SIZE(smdk2410_iodesc));
>  	s3c24xx_init_clocks(0);
>  	s3c24xx_init_uarts(smdk2410_uartcfgs, ARRAY_SIZE(smdk2410_uartcfgs));
> +	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
>  }
> 
>  static void __init smdk2410_init(void)
> @@ -117,6 +119,6 @@ MACHINE_START(SMDK2410, "SMDK2410") /* @TODO: request a
> new identifier and switc .map_io		= smdk2410_map_io,
>  	.init_irq	= s3c24xx_init_irq,
>  	.init_machine	= smdk2410_init,
> -	.timer		= &s3c24xx_timer,
> +	.timer		= &samsung_timer,
>  	.restart	= s3c2410_restart,
>  MACHINE_END
> diff --git a/arch/arm/mach-s3c24xx/mach-smdk2413.c
> b/arch/arm/mach-s3c24xx/mach-smdk2413.c index ce99fd8..c29c067 100644
> --- a/arch/arm/mach-s3c24xx/mach-smdk2413.c
> +++ b/arch/arm/mach-s3c24xx/mach-smdk2413.c
> @@ -47,6 +47,7 @@
>  #include <plat/clock.h>
>  #include <plat/devs.h>
>  #include <plat/cpu.h>
> +#include <plat/samsung-time.h>
> 
>  #include <plat/common-smdk.h>
> 
> @@ -107,6 +108,7 @@ static void __init smdk2413_map_io(void)
>  	s3c24xx_init_io(smdk2413_iodesc, ARRAY_SIZE(smdk2413_iodesc));
>  	s3c24xx_init_clocks(12000000);
>  	s3c24xx_init_uarts(smdk2413_uartcfgs, ARRAY_SIZE(smdk2413_uartcfgs));
> +	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
>  }
> 
>  static void __init smdk2413_machine_init(void)
> @@ -133,7 +135,7 @@ MACHINE_START(S3C2413, "S3C2413")
>  	.init_irq	= s3c24xx_init_irq,
>  	.map_io		= smdk2413_map_io,
>  	.init_machine	= smdk2413_machine_init,
> -	.timer		= &s3c24xx_timer,
> +	.timer		= &samsung_timer,
>  	.restart	= s3c2412_restart,
>  MACHINE_END
> 
> @@ -145,7 +147,7 @@ MACHINE_START(SMDK2412, "SMDK2412")
>  	.init_irq	= s3c24xx_init_irq,
>  	.map_io		= smdk2413_map_io,
>  	.init_machine	= smdk2413_machine_init,
> -	.timer		= &s3c24xx_timer,
> +	.timer		= &samsung_timer,
>  	.restart	= s3c2412_restart,
>  MACHINE_END
> 
> @@ -157,6 +159,6 @@ MACHINE_START(SMDK2413, "SMDK2413")
>  	.init_irq	= s3c24xx_init_irq,
>  	.map_io		= smdk2413_map_io,
>  	.init_machine	= smdk2413_machine_init,
> -	.timer		= &s3c24xx_timer,
> +	.timer		= &samsung_timer,
>  	.restart	= s3c2412_restart,
>  MACHINE_END
> diff --git a/arch/arm/mach-s3c24xx/mach-smdk2416.c
> b/arch/arm/mach-s3c24xx/mach-smdk2416.c index f30d7fc..2c0b7a1 100644
> --- a/arch/arm/mach-s3c24xx/mach-smdk2416.c
> +++ b/arch/arm/mach-s3c24xx/mach-smdk2416.c
> @@ -52,6 +52,7 @@
>  #include <plat/sdhci.h>
>  #include <linux/platform_data/usb-s3c2410_udc.h>
>  #include <linux/platform_data/s3c-hsudc.h>
> +#include <plat/samsung-time.h>
> 
>  #include <plat/fb.h>
> 
> @@ -222,6 +223,7 @@ static void __init smdk2416_map_io(void)
>  	s3c24xx_init_io(smdk2416_iodesc, ARRAY_SIZE(smdk2416_iodesc));
>  	s3c24xx_init_clocks(12000000);
>  	s3c24xx_init_uarts(smdk2416_uartcfgs, ARRAY_SIZE(smdk2416_uartcfgs));
> +	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
>  }
> 
>  static void __init smdk2416_machine_init(void)
> @@ -254,6 +256,6 @@ MACHINE_START(SMDK2416, "SMDK2416")
>  	.init_irq	= s3c24xx_init_irq,
>  	.map_io		= smdk2416_map_io,
>  	.init_machine	= smdk2416_machine_init,
> -	.timer		= &s3c24xx_timer,
> +	.timer		= &samsung_timer,
>  	.restart	= s3c2416_restart,
>  MACHINE_END
> diff --git a/arch/arm/mach-s3c24xx/mach-smdk2440.c
> b/arch/arm/mach-s3c24xx/mach-smdk2440.c index b7ff882..caf5c04 100644
> --- a/arch/arm/mach-s3c24xx/mach-smdk2440.c
> +++ b/arch/arm/mach-s3c24xx/mach-smdk2440.c
> @@ -44,6 +44,7 @@
>  #include <plat/clock.h>
>  #include <plat/devs.h>
>  #include <plat/cpu.h>
> +#include <plat/samsung-time.h>
> 
>  #include <plat/common-smdk.h>
> 
> @@ -164,6 +165,7 @@ static void __init smdk2440_map_io(void)
>  	s3c24xx_init_io(smdk2440_iodesc, ARRAY_SIZE(smdk2440_iodesc));
>  	s3c24xx_init_clocks(16934400);
>  	s3c24xx_init_uarts(smdk2440_uartcfgs, ARRAY_SIZE(smdk2440_uartcfgs));
> +	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
>  }
> 
>  static void __init smdk2440_machine_init(void)
> @@ -182,6 +184,6 @@ MACHINE_START(S3C2440, "SMDK2440")
>  	.init_irq	= s3c24xx_init_irq,
>  	.map_io		= smdk2440_map_io,
>  	.init_machine	= smdk2440_machine_init,
> -	.timer		= &s3c24xx_timer,
> +	.timer		= &samsung_timer,
>  	.restart	= s3c244x_restart,
>  MACHINE_END
> diff --git a/arch/arm/mach-s3c24xx/mach-smdk2443.c
> b/arch/arm/mach-s3c24xx/mach-smdk2443.c index 2568656..02fcd27 100644
> --- a/arch/arm/mach-s3c24xx/mach-smdk2443.c
> +++ b/arch/arm/mach-s3c24xx/mach-smdk2443.c
> @@ -44,6 +44,7 @@
>  #include <plat/clock.h>
>  #include <plat/devs.h>
>  #include <plat/cpu.h>
> +#include <plat/samsung-time.h>
> 
>  #include <plat/common-smdk.h>
> 
> @@ -123,6 +124,7 @@ static void __init smdk2443_map_io(void)
>  	s3c24xx_init_io(smdk2443_iodesc, ARRAY_SIZE(smdk2443_iodesc));
>  	s3c24xx_init_clocks(12000000);
>  	s3c24xx_init_uarts(smdk2443_uartcfgs, ARRAY_SIZE(smdk2443_uartcfgs));
> +	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
>  }
> 
>  static void __init smdk2443_machine_init(void)
> @@ -144,6 +146,6 @@ MACHINE_START(SMDK2443, "SMDK2443")
>  	.init_irq	= s3c24xx_init_irq,
>  	.map_io		= smdk2443_map_io,
>  	.init_machine	= smdk2443_machine_init,
> -	.timer		= &s3c24xx_timer,
> +	.timer		= &samsung_timer,
>  	.restart	= s3c2443_restart,
>  MACHINE_END
> diff --git a/arch/arm/mach-s3c24xx/mach-tct_hammer.c
> b/arch/arm/mach-s3c24xx/mach-tct_hammer.c index 495bf5c..90f43c9 100644
> --- a/arch/arm/mach-s3c24xx/mach-tct_hammer.c
> +++ b/arch/arm/mach-s3c24xx/mach-tct_hammer.c
> @@ -53,6 +53,7 @@
>  #include <linux/mtd/partitions.h>
>  #include <linux/mtd/map.h>
>  #include <linux/mtd/physmap.h>
> +#include <plat/samsung-time.h>
> 
>  #include "common.h"
> 
> @@ -136,6 +137,7 @@ static void __init tct_hammer_map_io(void)
>  	s3c24xx_init_io(tct_hammer_iodesc, ARRAY_SIZE(tct_hammer_iodesc));
>  	s3c24xx_init_clocks(0);
>  	s3c24xx_init_uarts(tct_hammer_uartcfgs, ARRAY_SIZE(tct_hammer_uartcfgs));
> +	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
>  }
> 
>  static void __init tct_hammer_init(void)
> @@ -149,6 +151,6 @@ MACHINE_START(TCT_HAMMER, "TCT_HAMMER")
>  	.map_io		= tct_hammer_map_io,
>  	.init_irq	= s3c24xx_init_irq,
>  	.init_machine	= tct_hammer_init,
> -	.timer		= &s3c24xx_timer,
> +	.timer		= &samsung_timer,
>  	.restart	= s3c2410_restart,
>  MACHINE_END
> diff --git a/arch/arm/mach-s3c24xx/mach-vr1000.c
> b/arch/arm/mach-s3c24xx/mach-vr1000.c index 14d5b12..4366c6f 100644
> --- a/arch/arm/mach-s3c24xx/mach-vr1000.c
> +++ b/arch/arm/mach-s3c24xx/mach-vr1000.c
> @@ -50,6 +50,7 @@
>  #include <plat/cpu.h>
>  #include <linux/platform_data/i2c-s3c2410.h>
>  #include <linux/platform_data/asoc-s3c24xx_simtec.h>
> +#include <plat/samsung-time.h>
> 
>  #include "simtec.h"
>  #include "common.h"
> @@ -335,6 +336,7 @@ static void __init vr1000_map_io(void)
>  	s3c24xx_init_io(vr1000_iodesc, ARRAY_SIZE(vr1000_iodesc));
>  	s3c24xx_init_clocks(0);
>  	s3c24xx_init_uarts(vr1000_uartcfgs, ARRAY_SIZE(vr1000_uartcfgs));
> +	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
>  }
> 
>  static void __init vr1000_init(void)
> @@ -357,6 +359,6 @@ MACHINE_START(VR1000, "Thorcom-VR1000")
>  	.map_io		= vr1000_map_io,
>  	.init_machine	= vr1000_init,
>  	.init_irq	= s3c24xx_init_irq,
> -	.timer		= &s3c24xx_timer,
> +	.timer		= &samsung_timer,
>  	.restart	= s3c2410_restart,
>  MACHINE_END
> diff --git a/arch/arm/mach-s3c24xx/mach-vstms.c
> b/arch/arm/mach-s3c24xx/mach-vstms.c index f1d44ae..412d858 100644
> --- a/arch/arm/mach-s3c24xx/mach-vstms.c
> +++ b/arch/arm/mach-s3c24xx/mach-vstms.c
> @@ -47,7 +47,7 @@
>  #include <plat/clock.h>
>  #include <plat/devs.h>
>  #include <plat/cpu.h>
> -
> +#include <plat/samsung-time.h>
> 
>  static struct map_desc vstms_iodesc[] __initdata = {
>  };
> @@ -144,6 +144,7 @@ static void __init vstms_map_io(void)
>  	s3c24xx_init_io(vstms_iodesc, ARRAY_SIZE(vstms_iodesc));
>  	s3c24xx_init_clocks(12000000);
>  	s3c24xx_init_uarts(vstms_uartcfgs, ARRAY_SIZE(vstms_uartcfgs));
> +	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
>  }
> 
>  static void __init vstms_init(void)
> @@ -161,6 +162,6 @@ MACHINE_START(VSTMS, "VSTMS")
>  	.init_irq	= s3c24xx_init_irq,
>  	.init_machine	= vstms_init,
>  	.map_io		= vstms_map_io,
> -	.timer		= &s3c24xx_timer,
> +	.timer		= &samsung_timer,
>  	.restart	= s3c2412_restart,
>  MACHINE_END
> diff --git a/arch/arm/plat-samsung/include/plat/cpu.h
> b/arch/arm/plat-samsung/include/plat/cpu.h index ace4451..86fb5f3 100644
> --- a/arch/arm/plat-samsung/include/plat/cpu.h
> +++ b/arch/arm/plat-samsung/include/plat/cpu.h
> @@ -184,7 +184,7 @@ extern void s3c24xx_init_uartdevs(char *name,
>  				  struct s3c24xx_uart_resources *res,
>  				  struct s3c2410_uartcfg *cfg, int no);
> 
> -/* timer for 2410/2440 */
> +/* timer for s5pc100 only */
> 
>  struct sys_timer;
>  extern struct sys_timer s3c24xx_timer;
> diff --git a/arch/arm/plat-samsung/include/plat/samsung-time.h
> b/arch/arm/plat-samsung/include/plat/samsung-time.h index 9d6d622..13ae4b9
> 100644
> --- a/arch/arm/plat-samsung/include/plat/samsung-time.h
> +++ b/arch/arm/plat-samsung/include/plat/samsung-time.h
> @@ -30,7 +30,18 @@ struct samsung_timer_source {
>  /* Be able to sleep for atleast 4 seconds (usually more) */
>  #define SAMSUNG_TIMER_MIN_RANGE	4
> 
> +#ifdef CONFIG_ARCH_S3C24XX
> +#define TCNT_MAX		0xffff
> +#define TSCALER_DIV		25
> +#define TDIV			50
> +#define TSIZE			16
> +#else
>  #define TCNT_MAX		0xffffffff
> +#define TSCALER_DIV		2
> +#define TDIV			2
> +#define TSIZE			32
> +#endif
> +
>  #define NON_PERIODIC		0
>  #define PERIODIC		1
> 
> diff --git a/arch/arm/plat-samsung/samsung-time.c
> b/arch/arm/plat-samsung/samsung-time.c index 91773bf..6d63fca 100644
> --- a/arch/arm/plat-samsung/samsung-time.c
> +++ b/arch/arm/plat-samsung/samsung-time.c
> @@ -2,7 +2,7 @@
>   * Copyright (c) 2011 Samsung Electronics Co., Ltd.
>   *		http://www.samsung.com/
>   *
> - * SAMSUNG - Common hr-timer support
> + * samsung - Common hr-timer support (s3c and s5p)
>   *
>   * This program is free software; you can redistribute it and/or modify
>   * it under the terms of the GNU General Public License version 2 as
> @@ -267,8 +267,8 @@ static void __init samsung_clockevent_init(void)
> 
>  	tscaler = clk_get_parent(tdiv_event);
> 
> -	clk_set_rate(tscaler, pclk / 2);
> -	clk_set_rate(tdiv_event, pclk / 2);
> +	clk_set_rate(tscaler, pclk / TSCALER_DIV);
> +	clk_set_rate(tdiv_event, pclk / TDIV);
>  	clk_set_parent(tin_event, tdiv_event);
> 
>  	clock_rate = clk_get_rate(tin_event);
> @@ -336,7 +336,7 @@ static void __init samsung_clocksource_init(void)
> 
>  	pclk = clk_get_rate(timerclk);
> 
> -	clk_set_rate(tdiv_source, pclk / 2);
> +	clk_set_rate(tdiv_source, pclk / TDIV);
>  	clk_set_parent(tin_source, tdiv_source);
> 
>  	clock_rate = clk_get_rate(tin_source);
> @@ -344,10 +344,10 @@ static void __init samsung_clocksource_init(void)
>  	samsung_time_setup(timer_source.source_id, TCNT_MAX);
>  	samsung_time_start(timer_source.source_id, PERIODIC);
> 
> -	setup_sched_clock(samsung_read_sched_clock, 32, clock_rate);
> +	setup_sched_clock(samsung_read_sched_clock, TSIZE, clock_rate);
> 
>  	if (clocksource_mmio_init(samsung_timer_reg(),
> "samsung_clocksource_timer", -			clock_rate, 250, 32,
> clocksource_mmio_readl_down))
> +			clock_rate, 250, TSIZE, clocksource_mmio_readl_down))
>  		panic("samsung_clocksource_timer: can't register clocksource\n");
>  }

^ permalink raw reply	[flat|nested] 39+ messages in thread

* Re: [PATCH 5/5 v2] Remove unused plat-samsung/time.c
  2012-12-10 12:57               ` Heiko Stübner
@ 2012-12-15 21:40                 ` Romain Naour
  0 siblings, 0 replies; 39+ messages in thread
From: Romain Naour @ 2012-12-15 21:40 UTC (permalink / raw)
  To: Heiko Stübner
  Cc: tomasz.figa, Kukjin Kim, linux-samsung-soc, ben-linux,
	'Sylwester Nawrocki'

Le 10/12/2012 13:57, Heiko Stübner a écrit :
> Am Sonntag, 2. Dezember 2012, 20:44:22 schrieb Romain Naour:
>> Since all Samsung devices use clocksource/clockevent API, we can remove
>> unused sys_timer s3c24xx-timer (plat-samsung/time.c)
> 
> The patch is corrupted, as it contains wrapped lines and does not apply 
> against the current linux-next tree
> 

Sorry for my late reply, I work on theses patches on my free time.
Ok, I'll resend this patch.

>> Signed-off-by: Naour Romain <romain.naour@openwide.fr>
>>
>>  delete mode 100644 arch/arm/plat-samsung/time.c
> 
> and what does this line do in the patch description? It seems your mail client 
> mangled the "--" parting the patch message from the stats/comment section.
> 

Solved.

> 
>> diff --git a/arch/arm/plat-samsung/Makefile
>> b/arch/arm/plat-samsung/Makefile index 06f2312..162e0df 100644
>> --- a/arch/arm/plat-samsung/Makefile
>> +++ b/arch/arm/plat-samsung/Makefile
>> @@ -12,7 +12,6 @@ obj-				:=
>>  # Objects we always build independent of SoC choice
>>
>>  obj-y				+= init.o cpu.o
>> -obj-$(CONFIG_ARCH_USES_GETTIMEOFFSET)   += time.o
>>  obj-$(CONFIG_SAMSUNG_HRT) 		+= samsung-time.o
>>
>>  obj-$(CONFIG_SAMSUNG_CLOCK)	+= clock.o
>> diff --git a/arch/arm/plat-samsung/include/plat/cpu.h
>> b/arch/arm/plat-samsung/include/plat/cpu.h
>> index 86fb5f3..84a50ee 100644
>> --- a/arch/arm/plat-samsung/include/plat/cpu.h
>> +++ b/arch/arm/plat-samsung/include/plat/cpu.h
>> @@ -184,11 +184,6 @@ extern void s3c24xx_init_uartdevs(char *name,
>>  				  struct s3c24xx_uart_resources *res,
>>  				  struct s3c2410_uartcfg *cfg, int no);
>>
>> -/* timer for s5pc100 only */
>> -
>> -struct sys_timer;
>> -extern struct sys_timer s3c24xx_timer;
>> -
>>  extern struct syscore_ops s3c2410_pm_syscore_ops;
>>  extern struct syscore_ops s3c2412_pm_syscore_ops;
>>  extern struct syscore_ops s3c2416_pm_syscore_ops;
>> diff --git a/arch/arm/plat-samsung/time.c b/arch/arm/plat-samsung/time.c
>> deleted file mode 100644
>> index 60552e2..0000000
>> --- a/arch/arm/plat-samsung/time.c
>> +++ /dev/null
>> @@ -1,285 +0,0 @@
>> -/* linux/arch/arm/plat-samsung/time.c
>> - *
>> - * Copyright (C) 2003-2005 Simtec Electronics
>> - *	Ben Dooks, <ben@simtec.co.uk>
>> - *
>> - * This program is free software; you can redistribute it and/or modify
>> - * it under the terms of the GNU General Public License as published by
>> - * the Free Software Foundation; either version 2 of the License, or
>> - * (at your option) any later version.
>> - *
>> - * This program is distributed in the hope that it will be useful,
>> - * but WITHOUT ANY WARRANTY; without even the implied warranty of
>> - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
>> - * GNU General Public License for more details.
>> - *
>> - * You should have received a copy of the GNU General Public License
>> - * along with this program; if not, write to the Free Software
>> - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
>>  USA
>> - */
>> -
>> -#include <linux/kernel.h>
>> -#include <linux/sched.h>
>> -#include <linux/init.h>
>> -#include <linux/interrupt.h>
>> -#include <linux/irq.h>
>> -#include <linux/err.h>
>> -#include <linux/clk.h>
>> -#include <linux/io.h>
>> -#include <linux/platform_device.h>
>> -
>> -#include <asm/mach-types.h>
>> -
>> -#include <asm/irq.h>
>> -#include <mach/map.h>
>> -#include <plat/regs-timer.h>
>> -#include <mach/regs-irq.h>
>> -#include <asm/mach/time.h>
>> -#include <mach/tick.h>
>> -
>> -#include <plat/clock.h>
>> -#include <plat/cpu.h>
>> -
>> -static unsigned long timer_startval;
>> -static unsigned long timer_usec_ticks;
>> -
>> -#ifndef TICK_MAX
>> -#define TICK_MAX (0xffff)
>> -#endif
>> -
>> -#define TIMER_USEC_SHIFT 16
>> -
>> -/* we use the shifted arithmetic to work out the ratio of timer ticks
>> - * to usecs, as often the peripheral clock is not a nice even multiple
>> - * of 1MHz.
>> - *
>> - * shift of 14 and 15 are too low for the 12MHz, 16 seems to be ok
>> - * for the current HZ value of 200 without producing overflows.
>> - *
>> - * Original patch by Dimitry Andric, updated by Ben Dooks
>> -*/
>> -
>> -
>> -/* timer_mask_usec_ticks
>> - *
>> - * given a clock and divisor, make the value to pass into
>> timer_ticks_to_usec
>> - * to scale the ticks into usecs
>> -*/
>> -
>> -static inline unsigned long
>> -timer_mask_usec_ticks(unsigned long scaler, unsigned long pclk)
>> -{
>> -	unsigned long den = pclk / 1000;
>> -
>> -	return ((1000 << TIMER_USEC_SHIFT) * scaler + (den >> 1)) / den;
>> -}
>> -
>> -/* timer_ticks_to_usec
>> - *
>> - * convert timer ticks to usec.
>> -*/
>> -
>> -static inline unsigned long timer_ticks_to_usec(unsigned long ticks)
>> -{
>> -	unsigned long res;
>> -
>> -	res = ticks * timer_usec_ticks;
>> -	res += 1 << (TIMER_USEC_SHIFT - 4);	/* round up slightly */
>> -
>> -	return res >> TIMER_USEC_SHIFT;
>> -}
>> -
>> -/***
>> - * Returns microsecond  since last clock interrupt.  Note that interrupts
>> - * will have been disabled by do_gettimeoffset()
>> - * IRQs are disabled before entering here from do_gettimeofday()
>> - */
>> -
>> -static unsigned long s3c2410_gettimeoffset (void)
>> -{
>> -	unsigned long tdone;
>> -	unsigned long tval;
>> -
>> -	/* work out how many ticks have gone since last timer interrupt */
>> -
>> -	tval =  __raw_readl(S3C2410_TCNTO(4));
>> -	tdone = timer_startval - tval;
>> -
>> -	/* check to see if there is an interrupt pending */
>> -
>> -	if (s3c24xx_ostimer_pending()) {
>> -		/* re-read the timer, and try and fix up for the missed
>> -		 * interrupt. Note, the interrupt may go off before the
>> -		 * timer has re-loaded from wrapping.
>> -		 */
>> -
>> -		tval =  __raw_readl(S3C2410_TCNTO(4));
>> -		tdone = timer_startval - tval;
>> -
>> -		if (tval != 0)
>> -			tdone += timer_startval;
>> -	}
>> -
>> -	return timer_ticks_to_usec(tdone);
>> -}
>> -
>> -
>> -/*
>> - * IRQ handler for the timer
>> - */
>> -static irqreturn_t
>> -s3c2410_timer_interrupt(int irq, void *dev_id)
>> -{
>> -	timer_tick();
>> -	return IRQ_HANDLED;
>> -}
>> -
>> -static struct irqaction s3c2410_timer_irq = {
>> -	.name		= "S3C2410 Timer Tick",
>> -	.flags		= IRQF_DISABLED | IRQF_TIMER | IRQF_IRQPOLL,
>> -	.handler	= s3c2410_timer_interrupt,
>> -};
>> -
>> -#define use_tclk1_12() ( \
>> -	machine_is_bast()	|| \
>> -	machine_is_vr1000()	|| \
>> -	machine_is_anubis()	|| \
>> -	machine_is_osiris())
>> -
>> -static struct clk *tin;
>> -static struct clk *tdiv;
>> -static struct clk *timerclk;
>> -
>> -/*
>> - * Set up timer interrupt, and return the current time in seconds.
>> - *
>> - * Currently we only use timer4, as it is the only timer which has no
>> - * other function that can be exploited externally
>> - */
>> -static void s3c2410_timer_setup (void)
>> -{
>> -	unsigned long tcon;
>> -	unsigned long tcnt;
>> -	unsigned long tcfg1;
>> -	unsigned long tcfg0;
>> -
>> -	tcnt = TICK_MAX;  /* default value for tcnt */
>> -
>> -	/* configure the system for whichever machine is in use */
>> -
>> -	if (use_tclk1_12()) {
>> -		/* timer is at 12MHz, scaler is 1 */
>> -		timer_usec_ticks = timer_mask_usec_ticks(1, 12000000);
>> -		tcnt = 12000000 / HZ;
>> -
>> -		tcfg1 = __raw_readl(S3C2410_TCFG1);
>> -		tcfg1 &= ~S3C2410_TCFG1_MUX4_MASK;
>> -		tcfg1 |= S3C2410_TCFG1_MUX4_TCLK1;
>> -		__raw_writel(tcfg1, S3C2410_TCFG1);
>> -	} else {
>> -		unsigned long pclk;
>> -		struct clk *tscaler;
>> -
>> -		/* for the h1940 (and others), we use the pclk from the core
>> -		 * to generate the timer values. since values around 50 to
>> -		 * 70MHz are not values we can directly generate the timer
>> -		 * value from, we need to pre-scale and divide before using it.
>> -		 *
>> -		 * for instance, using 50.7MHz and dividing by 6 gives 8.45MHz
>> -		 * (8.45 ticks per usec)
>> -		 */
>> -
>> -		pclk = clk_get_rate(timerclk);
>> -
>> -		/* configure clock tick */
>> -
>> -		timer_usec_ticks = timer_mask_usec_ticks(6, pclk);
>> -
>> -		tscaler = clk_get_parent(tdiv);
>> -
>> -		clk_set_rate(tscaler, pclk / 3);
>> -		clk_set_rate(tdiv, pclk / 6);
>> -		clk_set_parent(tin, tdiv);
>> -
>> -		tcnt = clk_get_rate(tin) / HZ;
>> -	}
>> -
>> -	tcon = __raw_readl(S3C2410_TCON);
>> -	tcfg0 = __raw_readl(S3C2410_TCFG0);
>> -	tcfg1 = __raw_readl(S3C2410_TCFG1);
>> -
>> -	/* timers reload after counting zero, so reduce the count by 1 */
>> -
>> -	tcnt--;
>> -
>> -	printk(KERN_DEBUG "timer tcon=%08lx, tcnt %04lx, tcfg %08lx,%08lx,
>> usec %08lx\n",
>> -	       tcon, tcnt, tcfg0, tcfg1, timer_usec_ticks);
>> -
>> -	/* check to see if timer is within 16bit range... */
>> -	if (tcnt > TICK_MAX) {
>> -		panic("setup_timer: HZ is too small, cannot configure timer!");
>> -		return;
>> -	}
>> -
>> -	__raw_writel(tcfg1, S3C2410_TCFG1);
>> -	__raw_writel(tcfg0, S3C2410_TCFG0);
>> -
>> -	timer_startval = tcnt;
>> -	__raw_writel(tcnt, S3C2410_TCNTB(4));
>> -
>> -	/* ensure timer is stopped... */
>> -
>> -	tcon &= ~(7<<20);
>> -	tcon |= S3C2410_TCON_T4RELOAD;
>> -	tcon |= S3C2410_TCON_T4MANUALUPD;
>> -
>> -	__raw_writel(tcon, S3C2410_TCON);
>> -	__raw_writel(tcnt, S3C2410_TCNTB(4));
>> -	__raw_writel(tcnt, S3C2410_TCMPB(4));
>> -
>> -	/* start the timer running */
>> -	tcon |= S3C2410_TCON_T4START;
>> -	tcon &= ~S3C2410_TCON_T4MANUALUPD;
>> -	__raw_writel(tcon, S3C2410_TCON);
>> -}
>> -
>> -static void __init s3c2410_timer_resources(void)
>> -{
>> -	struct platform_device tmpdev;
>> -
>> -	tmpdev.dev.bus = &platform_bus_type;
>> -	tmpdev.id = 4;
>> -
>> -	timerclk = clk_get(NULL, "timers");
>> -	if (IS_ERR(timerclk))
>> -		panic("failed to get clock for system timer");
>> -
>> -	clk_enable(timerclk);
>> -
>> -	if (!use_tclk1_12()) {
>> -		tmpdev.id = 4;
>> -		tmpdev.dev.init_name = "s3c24xx-pwm.4";
>> -		tin = clk_get(&tmpdev.dev, "pwm-tin");
>> -		if (IS_ERR(tin))
>> -			panic("failed to get pwm-tin clock for system timer");
>> -
>> -		tdiv = clk_get(&tmpdev.dev, "pwm-tdiv");
>> -		if (IS_ERR(tdiv))
>> -			panic("failed to get pwm-tdiv clock for system timer");
>> -	}
>> -
>> -	clk_enable(tin);
>> -}
>> -
>> -static void __init s3c2410_timer_init(void)
>> -{
>> -	s3c2410_timer_resources();
>> -	s3c2410_timer_setup();
>> -	setup_irq(IRQ_TIMER4, &s3c2410_timer_irq);
>> -}
>> -
>> -struct sys_timer s3c24xx_timer = {
>> -	.init		= s3c2410_timer_init,
>> -	.offset		= s3c2410_gettimeoffset,
>> -	.resume		= s3c2410_timer_setup
>> -};
> 
> 4
> 

^ permalink raw reply	[flat|nested] 39+ messages in thread

* [PATCH 5/5 v3] Remove unused plat-samsung/time.c
  2012-11-27 23:57           ` Heiko Stübner
                               ` (5 preceding siblings ...)
  2012-12-02 19:44             ` [PATCH 5/5 v2] Remove unused plat-samsung/time.c Romain Naour
@ 2012-12-15 21:40             ` Romain Naour
  6 siblings, 0 replies; 39+ messages in thread
From: Romain Naour @ 2012-12-15 21:40 UTC (permalink / raw)
  To: Heiko Stübner
  Cc: tomasz.figa, Kukjin Kim, linux-samsung-soc, ben-linux,
	'Sylwester Nawrocki'

Since all Samsung devices use clocksource/clockevent API, we can remove
unused sys_timer s3c24xx-timer (plat-samsung/time.c)


Signed-off-by: Naour Romain <romain.naour@openwide.fr>
---
 arch/arm/plat-samsung/Makefile           |   1 -
 arch/arm/plat-samsung/include/plat/cpu.h |   5 -
 arch/arm/plat-samsung/time.c             | 285 -------------------------------
 3 files changed, 291 deletions(-)
 delete mode 100644 arch/arm/plat-samsung/time.c

diff --git a/arch/arm/plat-samsung/Makefile b/arch/arm/plat-samsung/Makefile
index 9eb15f0..4f14df7 100644
--- a/arch/arm/plat-samsung/Makefile
+++ b/arch/arm/plat-samsung/Makefile
@@ -12,7 +12,6 @@ obj-				:=
 # Objects we always build independent of SoC choice
 
 obj-y				+= init.o cpu.o
-obj-$(CONFIG_ARCH_USES_GETTIMEOFFSET)   += time.o
 obj-$(CONFIG_SAMSUNG_HRT) 		+= samsung-time.o
 
 obj-$(CONFIG_SAMSUNG_CLOCK)	+= clock.o
diff --git a/arch/arm/plat-samsung/include/plat/cpu.h b/arch/arm/plat-samsung/include/plat/cpu.h
index ced4d8c..c8e6f09 100644
--- a/arch/arm/plat-samsung/include/plat/cpu.h
+++ b/arch/arm/plat-samsung/include/plat/cpu.h
@@ -192,11 +192,6 @@ extern void s3c24xx_init_uartdevs(char *name,
 				  struct s3c24xx_uart_resources *res,
 				  struct s3c2410_uartcfg *cfg, int no);
 
-/* timer for s5pc100 only */
-
-struct sys_timer;
-extern struct sys_timer s3c24xx_timer;
-
 extern struct syscore_ops s3c2410_pm_syscore_ops;
 extern struct syscore_ops s3c2412_pm_syscore_ops;
 extern struct syscore_ops s3c2416_pm_syscore_ops;
diff --git a/arch/arm/plat-samsung/time.c b/arch/arm/plat-samsung/time.c
deleted file mode 100644
index 60552e2..0000000
--- a/arch/arm/plat-samsung/time.c
+++ /dev/null
@@ -1,285 +0,0 @@
-/* linux/arch/arm/plat-samsung/time.c
- *
- * Copyright (C) 2003-2005 Simtec Electronics
- *	Ben Dooks, <ben@simtec.co.uk>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- */
-
-#include <linux/kernel.h>
-#include <linux/sched.h>
-#include <linux/init.h>
-#include <linux/interrupt.h>
-#include <linux/irq.h>
-#include <linux/err.h>
-#include <linux/clk.h>
-#include <linux/io.h>
-#include <linux/platform_device.h>
-
-#include <asm/mach-types.h>
-
-#include <asm/irq.h>
-#include <mach/map.h>
-#include <plat/regs-timer.h>
-#include <mach/regs-irq.h>
-#include <asm/mach/time.h>
-#include <mach/tick.h>
-
-#include <plat/clock.h>
-#include <plat/cpu.h>
-
-static unsigned long timer_startval;
-static unsigned long timer_usec_ticks;
-
-#ifndef TICK_MAX
-#define TICK_MAX (0xffff)
-#endif
-
-#define TIMER_USEC_SHIFT 16
-
-/* we use the shifted arithmetic to work out the ratio of timer ticks
- * to usecs, as often the peripheral clock is not a nice even multiple
- * of 1MHz.
- *
- * shift of 14 and 15 are too low for the 12MHz, 16 seems to be ok
- * for the current HZ value of 200 without producing overflows.
- *
- * Original patch by Dimitry Andric, updated by Ben Dooks
-*/
-
-
-/* timer_mask_usec_ticks
- *
- * given a clock and divisor, make the value to pass into timer_ticks_to_usec
- * to scale the ticks into usecs
-*/
-
-static inline unsigned long
-timer_mask_usec_ticks(unsigned long scaler, unsigned long pclk)
-{
-	unsigned long den = pclk / 1000;
-
-	return ((1000 << TIMER_USEC_SHIFT) * scaler + (den >> 1)) / den;
-}
-
-/* timer_ticks_to_usec
- *
- * convert timer ticks to usec.
-*/
-
-static inline unsigned long timer_ticks_to_usec(unsigned long ticks)
-{
-	unsigned long res;
-
-	res = ticks * timer_usec_ticks;
-	res += 1 << (TIMER_USEC_SHIFT - 4);	/* round up slightly */
-
-	return res >> TIMER_USEC_SHIFT;
-}
-
-/***
- * Returns microsecond  since last clock interrupt.  Note that interrupts
- * will have been disabled by do_gettimeoffset()
- * IRQs are disabled before entering here from do_gettimeofday()
- */
-
-static unsigned long s3c2410_gettimeoffset (void)
-{
-	unsigned long tdone;
-	unsigned long tval;
-
-	/* work out how many ticks have gone since last timer interrupt */
-
-	tval =  __raw_readl(S3C2410_TCNTO(4));
-	tdone = timer_startval - tval;
-
-	/* check to see if there is an interrupt pending */
-
-	if (s3c24xx_ostimer_pending()) {
-		/* re-read the timer, and try and fix up for the missed
-		 * interrupt. Note, the interrupt may go off before the
-		 * timer has re-loaded from wrapping.
-		 */
-
-		tval =  __raw_readl(S3C2410_TCNTO(4));
-		tdone = timer_startval - tval;
-
-		if (tval != 0)
-			tdone += timer_startval;
-	}
-
-	return timer_ticks_to_usec(tdone);
-}
-
-
-/*
- * IRQ handler for the timer
- */
-static irqreturn_t
-s3c2410_timer_interrupt(int irq, void *dev_id)
-{
-	timer_tick();
-	return IRQ_HANDLED;
-}
-
-static struct irqaction s3c2410_timer_irq = {
-	.name		= "S3C2410 Timer Tick",
-	.flags		= IRQF_DISABLED | IRQF_TIMER | IRQF_IRQPOLL,
-	.handler	= s3c2410_timer_interrupt,
-};
-
-#define use_tclk1_12() ( \
-	machine_is_bast()	|| \
-	machine_is_vr1000()	|| \
-	machine_is_anubis()	|| \
-	machine_is_osiris())
-
-static struct clk *tin;
-static struct clk *tdiv;
-static struct clk *timerclk;
-
-/*
- * Set up timer interrupt, and return the current time in seconds.
- *
- * Currently we only use timer4, as it is the only timer which has no
- * other function that can be exploited externally
- */
-static void s3c2410_timer_setup (void)
-{
-	unsigned long tcon;
-	unsigned long tcnt;
-	unsigned long tcfg1;
-	unsigned long tcfg0;
-
-	tcnt = TICK_MAX;  /* default value for tcnt */
-
-	/* configure the system for whichever machine is in use */
-
-	if (use_tclk1_12()) {
-		/* timer is at 12MHz, scaler is 1 */
-		timer_usec_ticks = timer_mask_usec_ticks(1, 12000000);
-		tcnt = 12000000 / HZ;
-
-		tcfg1 = __raw_readl(S3C2410_TCFG1);
-		tcfg1 &= ~S3C2410_TCFG1_MUX4_MASK;
-		tcfg1 |= S3C2410_TCFG1_MUX4_TCLK1;
-		__raw_writel(tcfg1, S3C2410_TCFG1);
-	} else {
-		unsigned long pclk;
-		struct clk *tscaler;
-
-		/* for the h1940 (and others), we use the pclk from the core
-		 * to generate the timer values. since values around 50 to
-		 * 70MHz are not values we can directly generate the timer
-		 * value from, we need to pre-scale and divide before using it.
-		 *
-		 * for instance, using 50.7MHz and dividing by 6 gives 8.45MHz
-		 * (8.45 ticks per usec)
-		 */
-
-		pclk = clk_get_rate(timerclk);
-
-		/* configure clock tick */
-
-		timer_usec_ticks = timer_mask_usec_ticks(6, pclk);
-
-		tscaler = clk_get_parent(tdiv);
-
-		clk_set_rate(tscaler, pclk / 3);
-		clk_set_rate(tdiv, pclk / 6);
-		clk_set_parent(tin, tdiv);
-
-		tcnt = clk_get_rate(tin) / HZ;
-	}
-
-	tcon = __raw_readl(S3C2410_TCON);
-	tcfg0 = __raw_readl(S3C2410_TCFG0);
-	tcfg1 = __raw_readl(S3C2410_TCFG1);
-
-	/* timers reload after counting zero, so reduce the count by 1 */
-
-	tcnt--;
-
-	printk(KERN_DEBUG "timer tcon=%08lx, tcnt %04lx, tcfg %08lx,%08lx, usec %08lx\n",
-	       tcon, tcnt, tcfg0, tcfg1, timer_usec_ticks);
-
-	/* check to see if timer is within 16bit range... */
-	if (tcnt > TICK_MAX) {
-		panic("setup_timer: HZ is too small, cannot configure timer!");
-		return;
-	}
-
-	__raw_writel(tcfg1, S3C2410_TCFG1);
-	__raw_writel(tcfg0, S3C2410_TCFG0);
-
-	timer_startval = tcnt;
-	__raw_writel(tcnt, S3C2410_TCNTB(4));
-
-	/* ensure timer is stopped... */
-
-	tcon &= ~(7<<20);
-	tcon |= S3C2410_TCON_T4RELOAD;
-	tcon |= S3C2410_TCON_T4MANUALUPD;
-
-	__raw_writel(tcon, S3C2410_TCON);
-	__raw_writel(tcnt, S3C2410_TCNTB(4));
-	__raw_writel(tcnt, S3C2410_TCMPB(4));
-
-	/* start the timer running */
-	tcon |= S3C2410_TCON_T4START;
-	tcon &= ~S3C2410_TCON_T4MANUALUPD;
-	__raw_writel(tcon, S3C2410_TCON);
-}
-
-static void __init s3c2410_timer_resources(void)
-{
-	struct platform_device tmpdev;
-
-	tmpdev.dev.bus = &platform_bus_type;
-	tmpdev.id = 4;
-
-	timerclk = clk_get(NULL, "timers");
-	if (IS_ERR(timerclk))
-		panic("failed to get clock for system timer");
-
-	clk_enable(timerclk);
-
-	if (!use_tclk1_12()) {
-		tmpdev.id = 4;
-		tmpdev.dev.init_name = "s3c24xx-pwm.4";
-		tin = clk_get(&tmpdev.dev, "pwm-tin");
-		if (IS_ERR(tin))
-			panic("failed to get pwm-tin clock for system timer");
-
-		tdiv = clk_get(&tmpdev.dev, "pwm-tdiv");
-		if (IS_ERR(tdiv))
-			panic("failed to get pwm-tdiv clock for system timer");
-	}
-
-	clk_enable(tin);
-}
-
-static void __init s3c2410_timer_init(void)
-{
-	s3c2410_timer_resources();
-	s3c2410_timer_setup();
-	setup_irq(IRQ_TIMER4, &s3c2410_timer_irq);
-}
-
-struct sys_timer s3c24xx_timer = {
-	.init		= s3c2410_timer_init,
-	.offset		= s3c2410_gettimeoffset,
-	.resume		= s3c2410_timer_setup
-};
-- 

^ permalink raw reply related	[flat|nested] 39+ messages in thread

* Re: [PATCH 2/5 v2] Add samsung-time support for s3c24xx
  2012-12-10 13:00               ` Heiko Stübner
@ 2012-12-15 21:40                 ` Romain Naour
  0 siblings, 0 replies; 39+ messages in thread
From: Romain Naour @ 2012-12-15 21:40 UTC (permalink / raw)
  To: Heiko Stübner
  Cc: tomasz.figa, Kukjin Kim, linux-samsung-soc, ben-linux,
	'Sylwester Nawrocki'

Le 10/12/2012 14:00, Heiko Stübner a écrit :
> Am Sonntag, 2. Dezember 2012, 20:44:09 schrieb Romain Naour:
>> This patch replace ARCH_USES_GETTIMEOFFSET by GENERIC_CLOCKEVENTS for
>> s3c24xx devices. It becomes possible to use the high-resolution timer and
>> dynamic ticks.
>>
>>
>> Signed-off-by: Naour Romain <romain.naour@openwide.fr>
> 
> Tested-by: Heiko Stuebner <heiko@sntech.de>
> 
> on a s3c2416 based board
> 

Thank you to have tested.

>> diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
>> index ade7e92..6563476 100644
>> --- a/arch/arm/Kconfig
>> +++ b/arch/arm/Kconfig
>> @@ -737,7 +737,8 @@ config ARCH_SA1100
>>  config ARCH_S3C24XX
>>  	bool "Samsung S3C24XX SoCs"
>>  	select ARCH_HAS_CPUFREQ
>> -	select ARCH_USES_GETTIMEOFFSET
>> +	select GENERIC_CLOCKEVENTS
>> +	select CLKSRC_MMIO
>>  	select CLKDEV_LOOKUP
>>  	select GENERIC_GPIO
>>  	select HAVE_CLK
>> diff --git a/arch/arm/mach-s3c24xx/Kconfig b/arch/arm/mach-s3c24xx/Kconfig
>> index 2b6cb5f..be2c482 100644
>> --- a/arch/arm/mach-s3c24xx/Kconfig
>> +++ b/arch/arm/mach-s3c24xx/Kconfig
>> @@ -21,6 +21,7 @@ config CPU_S3C2410
>>  	select S3C2410_CLOCK
>>  	select S3C2410_CPUFREQ if CPU_FREQ_S3C24XX
>>  	select S3C2410_PM if PM
>> +	select SAMSUNG_HRT
>>  	help
>>  	  Support for S3C2410 and S3C2410A family from the S3C24XX line
>>  	  of Samsung Mobile CPUs.
>> @@ -32,6 +33,7 @@ config CPU_S3C2412
>>  	select CPU_LLSERIAL_S3C2440
>>  	select S3C2412_DMA if S3C24XX_DMA
>>  	select S3C2412_PM if PM
>> +	select SAMSUNG_HRT
>>  	help
>>  	  Support for the S3C2412 and S3C2413 SoCs from the S3C24XX line
>>
>> @@ -44,6 +46,7 @@ config CPU_S3C2416
>>  	select S3C2443_COMMON
>>  	select S3C2443_DMA if S3C24XX_DMA
>>  	select SAMSUNG_CLKSRC
>> +	select SAMSUNG_HRT
>>  	help
>>  	  Support for the S3C2416 SoC from the S3C24XX line
>>
>> @@ -54,6 +57,7 @@ config CPU_S3C2440
>>  	select S3C2410_CLOCK
>>  	select S3C2410_PM if PM
>>  	select S3C2440_DMA if S3C24XX_DMA
>> +	select SAMSUNG_HRT
>>  	help
>>  	  Support for S3C2440 Samsung Mobile CPU based systems.
>>
>> @@ -63,6 +67,7 @@ config CPU_S3C2442
>>  	select CPU_LLSERIAL_S3C2440
>>  	select S3C2410_CLOCK
>>  	select S3C2410_PM if PM
>> +	select SAMSUNG_HRT
>>  	help
>>  	  Support for S3C2442 Samsung Mobile CPU based systems.
>>
>> @@ -78,6 +83,7 @@ config CPU_S3C2443
>>  	select S3C2443_COMMON
>>  	select S3C2443_DMA if S3C24XX_DMA
>>  	select SAMSUNG_CLKSRC
>> +	select SAMSUNG_HRT
>>  	help
>>  	  Support for the S3C2443 SoC from the S3C24XX line
>>
>> diff --git a/arch/arm/mach-s3c24xx/mach-amlm5900.c
>> b/arch/arm/mach-s3c24xx/mach-amlm5900.c index f4ad99c..84c9bb0 100644
>> --- a/arch/arm/mach-s3c24xx/mach-amlm5900.c
>> +++ b/arch/arm/mach-s3c24xx/mach-amlm5900.c
>> @@ -63,6 +63,8 @@
>>  #include <linux/mtd/map.h>
>>  #include <linux/mtd/physmap.h>
>>
>> +#include <plat/samsung-time.h>
>> +
>>  #include "common.h"
>>
>>  static struct resource amlm5900_nor_resource =
>> @@ -160,6 +162,7 @@ static void __init amlm5900_map_io(void)
>>  	s3c24xx_init_io(amlm5900_iodesc, ARRAY_SIZE(amlm5900_iodesc));
>>  	s3c24xx_init_clocks(0);
>>  	s3c24xx_init_uarts(amlm5900_uartcfgs, ARRAY_SIZE(amlm5900_uartcfgs));
>> +	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
>>  }
>>
>>  #ifdef CONFIG_FB_S3C2410
>> @@ -237,6 +240,6 @@ MACHINE_START(AML_M5900, "AML_M5900")
>>  	.map_io		= amlm5900_map_io,
>>  	.init_irq	= s3c24xx_init_irq,
>>  	.init_machine	= amlm5900_init,
>> -	.timer		= &s3c24xx_timer,
>> +	.timer		= &samsung_timer,
>>  	.restart	= s3c2410_restart,
>>  MACHINE_END
>> diff --git a/arch/arm/mach-s3c24xx/mach-anubis.c
>> b/arch/arm/mach-s3c24xx/mach-anubis.c index 1ee8c46..65ba844 100644
>> --- a/arch/arm/mach-s3c24xx/mach-anubis.c
>> +++ b/arch/arm/mach-s3c24xx/mach-anubis.c
>> @@ -54,6 +54,7 @@
>>  #include <plat/devs.h>
>>  #include <plat/cpu.h>
>>  #include <linux/platform_data/asoc-s3c24xx_simtec.h>
>> +#include <plat/samsung-time.h>
>>
>>  #include "simtec.h"
>>  #include "common.h"
>> @@ -414,6 +415,7 @@ static void __init anubis_map_io(void)
>>  	s3c24xx_init_io(anubis_iodesc, ARRAY_SIZE(anubis_iodesc));
>>  	s3c24xx_init_clocks(0);
>>  	s3c24xx_init_uarts(anubis_uartcfgs, ARRAY_SIZE(anubis_uartcfgs));
>> +	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
>>
>>  	/* check for the newer revision boards with large page nand */
>>
>> @@ -448,6 +450,6 @@ MACHINE_START(ANUBIS, "Simtec-Anubis")
>>  	.map_io		= anubis_map_io,
>>  	.init_machine	= anubis_init,
>>  	.init_irq	= s3c24xx_init_irq,
>> -	.timer		= &s3c24xx_timer,
>> +	.timer		= &samsung_timer,
>>  	.restart	= s3c244x_restart,
>>  MACHINE_END
>> diff --git a/arch/arm/mach-s3c24xx/mach-at2440evb.c
>> b/arch/arm/mach-s3c24xx/mach-at2440evb.c index 00381fe..d7eb641 100644
>> --- a/arch/arm/mach-s3c24xx/mach-at2440evb.c
>> +++ b/arch/arm/mach-s3c24xx/mach-at2440evb.c
>> @@ -48,6 +48,7 @@
>>  #include <plat/devs.h>
>>  #include <plat/cpu.h>
>>  #include <linux/platform_data/mmc-s3cmci.h>
>> +#include <plat/samsung-time.h>
>>
>>  #include "common.h"
>>
>> @@ -192,6 +193,7 @@ static void __init at2440evb_map_io(void)
>>  	s3c24xx_init_io(at2440evb_iodesc, ARRAY_SIZE(at2440evb_iodesc));
>>  	s3c24xx_init_clocks(16934400);
>>  	s3c24xx_init_uarts(at2440evb_uartcfgs, ARRAY_SIZE(at2440evb_uartcfgs));
>> +	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
>>  }
>>
>>  static void __init at2440evb_init(void)
>> @@ -210,6 +212,6 @@ MACHINE_START(AT2440EVB, "AT2440EVB")
>>  	.map_io		= at2440evb_map_io,
>>  	.init_machine	= at2440evb_init,
>>  	.init_irq	= s3c24xx_init_irq,
>> -	.timer		= &s3c24xx_timer,
>> +	.timer		= &samsung_timer,
>>  	.restart	= s3c244x_restart,
>>  MACHINE_END
>> diff --git a/arch/arm/mach-s3c24xx/mach-bast.c
>> b/arch/arm/mach-s3c24xx/mach-bast.c index 6a30ce7..a9c442e 100644
>> --- a/arch/arm/mach-s3c24xx/mach-bast.c
>> +++ b/arch/arm/mach-s3c24xx/mach-bast.c
>> @@ -63,6 +63,7 @@
>>  #include <plat/cpu-freq.h>
>>  #include <plat/gpio-cfg.h>
>>  #include <linux/platform_data/asoc-s3c24xx_simtec.h>
>> +#include <plat/samsung-time.h>
>>
>>  #include "simtec.h"
>>  #include "common.h"
>> @@ -583,6 +584,7 @@ static void __init bast_map_io(void)
>>  	s3c24xx_init_io(bast_iodesc, ARRAY_SIZE(bast_iodesc));
>>  	s3c24xx_init_clocks(0);
>>  	s3c24xx_init_uarts(bast_uartcfgs, ARRAY_SIZE(bast_uartcfgs));
>> +	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
>>  }
>>
>>  static void __init bast_init(void)
>> @@ -612,6 +614,6 @@ MACHINE_START(BAST, "Simtec-BAST")
>>  	.map_io		= bast_map_io,
>>  	.init_irq	= s3c24xx_init_irq,
>>  	.init_machine	= bast_init,
>> -	.timer		= &s3c24xx_timer,
>> +	.timer		= &samsung_timer,
>>  	.restart	= s3c2410_restart,
>>  MACHINE_END
>> diff --git a/arch/arm/mach-s3c24xx/mach-gta02.c
>> b/arch/arm/mach-s3c24xx/mach-gta02.c index 4a96346..02c6c6a 100644
>> --- a/arch/arm/mach-s3c24xx/mach-gta02.c
>> +++ b/arch/arm/mach-s3c24xx/mach-gta02.c
>> @@ -88,6 +88,7 @@
>>  #include <plat/gpio-cfg.h>
>>  #include <linux/platform_data/i2c-s3c2410.h>
>>  #include <linux/platform_data/touchscreen-s3c2410.h>
>> +#include <plat/samsung-time.h>
>>
>>  #include "common.h"
>>
>> @@ -507,6 +508,7 @@ static void __init gta02_map_io(void)
>>  	s3c24xx_init_io(gta02_iodesc, ARRAY_SIZE(gta02_iodesc));
>>  	s3c24xx_init_clocks(12000000);
>>  	s3c24xx_init_uarts(gta02_uartcfgs, ARRAY_SIZE(gta02_uartcfgs));
>> +	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
>>  }
>>
>>
>> @@ -596,6 +598,6 @@ MACHINE_START(NEO1973_GTA02, "GTA02")
>>  	.map_io		= gta02_map_io,
>>  	.init_irq	= s3c24xx_init_irq,
>>  	.init_machine	= gta02_machine_init,
>> -	.timer		= &s3c24xx_timer,
>> +	.timer		= &samsung_timer,
>>  	.restart	= s3c244x_restart,
>>  MACHINE_END
>> diff --git a/arch/arm/mach-s3c24xx/mach-h1940.c
>> b/arch/arm/mach-s3c24xx/mach-h1940.c index 63aaf07..f5d3578 100644
>> --- a/arch/arm/mach-s3c24xx/mach-h1940.c
>> +++ b/arch/arm/mach-s3c24xx/mach-h1940.c
>> @@ -67,6 +67,7 @@
>>  #include <plat/pm.h>
>>  #include <linux/platform_data/mmc-s3cmci.h>
>>  #include <linux/platform_data/touchscreen-s3c2410.h>
>> +#include <plat/samsung-time.h>
>>
>>  #include <sound/uda1380.h>
>>
>> @@ -652,6 +653,7 @@ static void __init h1940_map_io(void)
>>  	s3c24xx_init_io(h1940_iodesc, ARRAY_SIZE(h1940_iodesc));
>>  	s3c24xx_init_clocks(0);
>>  	s3c24xx_init_uarts(h1940_uartcfgs, ARRAY_SIZE(h1940_uartcfgs));
>> +	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
>>
>>  	/* setup PM */
>>
>> @@ -747,6 +749,6 @@ MACHINE_START(H1940, "IPAQ-H1940")
>>  	.reserve	= h1940_reserve,
>>  	.init_irq	= h1940_init_irq,
>>  	.init_machine	= h1940_init,
>> -	.timer		= &s3c24xx_timer,
>> +	.timer		= &samsung_timer,
>>  	.restart	= s3c2410_restart,
>>  MACHINE_END
>> diff --git a/arch/arm/mach-s3c24xx/mach-jive.c
>> b/arch/arm/mach-s3c24xx/mach-jive.c index c9954e2..01a894d 100644
>> --- a/arch/arm/mach-s3c24xx/mach-jive.c
>> +++ b/arch/arm/mach-s3c24xx/mach-jive.c
>> @@ -55,6 +55,7 @@
>>  #include <plat/cpu.h>
>>  #include <plat/pm.h>
>>  #include <linux/platform_data/usb-s3c2410_udc.h>
>> +#include <plat/samsung-time.h>
>>
>>  static struct map_desc jive_iodesc[] __initdata = {
>>  };
>> @@ -506,6 +507,7 @@ static void __init jive_map_io(void)
>>  	s3c24xx_init_io(jive_iodesc, ARRAY_SIZE(jive_iodesc));
>>  	s3c24xx_init_clocks(12000000);
>>  	s3c24xx_init_uarts(jive_uartcfgs, ARRAY_SIZE(jive_uartcfgs));
>> +	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
>>  }
>>
>>  static void jive_power_off(void)
>> @@ -661,6 +663,6 @@ MACHINE_START(JIVE, "JIVE")
>>  	.init_irq	= s3c24xx_init_irq,
>>  	.map_io		= jive_map_io,
>>  	.init_machine	= jive_machine_init,
>> -	.timer		= &s3c24xx_timer,
>> +	.timer		= &samsung_timer,
>>  	.restart	= s3c2412_restart,
>>  MACHINE_END
>> diff --git a/arch/arm/mach-s3c24xx/mach-mini2440.c
>> b/arch/arm/mach-s3c24xx/mach-mini2440.c index 393c0f1..a96efcd 100644
>> --- a/arch/arm/mach-s3c24xx/mach-mini2440.c
>> +++ b/arch/arm/mach-s3c24xx/mach-mini2440.c
>> @@ -57,6 +57,7 @@
>>  #include <plat/clock.h>
>>  #include <plat/devs.h>
>>  #include <plat/cpu.h>
>> +#include <plat/samsung-time.h>
>>
>>  #include <sound/s3c24xx_uda134x.h>
>>
>> @@ -527,6 +528,7 @@ static void __init mini2440_map_io(void)
>>  	s3c24xx_init_io(mini2440_iodesc, ARRAY_SIZE(mini2440_iodesc));
>>  	s3c24xx_init_clocks(12000000);
>>  	s3c24xx_init_uarts(mini2440_uartcfgs, ARRAY_SIZE(mini2440_uartcfgs));
>> +	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
>>  }
>>
>>  /*
>> @@ -689,6 +691,6 @@ MACHINE_START(MINI2440, "MINI2440")
>>  	.map_io		= mini2440_map_io,
>>  	.init_machine	= mini2440_init,
>>  	.init_irq	= s3c24xx_init_irq,
>> -	.timer		= &s3c24xx_timer,
>> +	.timer		= &samsung_timer,
>>  	.restart	= s3c244x_restart,
>>  MACHINE_END
>> diff --git a/arch/arm/mach-s3c24xx/mach-n30.c
>> b/arch/arm/mach-s3c24xx/mach-n30.c index c53a9bf..f6cea03 100644
>> --- a/arch/arm/mach-s3c24xx/mach-n30.c
>> +++ b/arch/arm/mach-s3c24xx/mach-n30.c
>> @@ -50,6 +50,7 @@
>>  #include <linux/platform_data/mmc-s3cmci.h>
>>  #include <plat/s3c2410.h>
>>  #include <linux/platform_data/usb-s3c2410_udc.h>
>> +#include <plat/samsung-time.h>
>>
>>  #include "common.h"
>>
>> @@ -536,6 +537,7 @@ static void __init n30_map_io(void)
>>  	n30_hwinit();
>>  	s3c24xx_init_clocks(0);
>>  	s3c24xx_init_uarts(n30_uartcfgs, ARRAY_SIZE(n30_uartcfgs));
>> +	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
>>  }
>>
>>  /* GPB3 is the line that controls the pull-up for the USB D+ line */
>> @@ -589,7 +591,7 @@ MACHINE_START(N30, "Acer-N30")
>>  				Ben Dooks <ben-linux@fluff.org>
>>  	*/
>>  	.atag_offset	= 0x100,
>> -	.timer		= &s3c24xx_timer,
>> +	.timer		= &samsung_timer,
>>  	.init_machine	= n30_init,
>>  	.init_irq	= s3c24xx_init_irq,
>>  	.map_io		= n30_map_io,
>> @@ -600,7 +602,7 @@ MACHINE_START(N35, "Acer-N35")
>>  	/* Maintainer: Christer Weinigel <christer@weinigel.se>
>>  	*/
>>  	.atag_offset	= 0x100,
>> -	.timer		= &s3c24xx_timer,
>> +	.timer		= &samsung_timer,
>>  	.init_machine	= n30_init,
>>  	.init_irq	= s3c24xx_init_irq,
>>  	.map_io		= n30_map_io,
>> diff --git a/arch/arm/mach-s3c24xx/mach-nexcoder.c
>> b/arch/arm/mach-s3c24xx/mach-nexcoder.c index a2b92b0..4db6fb3 100644
>> --- a/arch/arm/mach-s3c24xx/mach-nexcoder.c
>> +++ b/arch/arm/mach-s3c24xx/mach-nexcoder.c
>> @@ -46,6 +46,7 @@
>>  #include <plat/clock.h>
>>  #include <plat/devs.h>
>>  #include <plat/cpu.h>
>> +#include <plat/samsung-time.h>
>>
>>  #include "common.h"
>>
>> @@ -137,6 +138,7 @@ static void __init nexcoder_map_io(void)
>>  	s3c24xx_init_io(nexcoder_iodesc, ARRAY_SIZE(nexcoder_iodesc));
>>  	s3c24xx_init_clocks(0);
>>  	s3c24xx_init_uarts(nexcoder_uartcfgs, ARRAY_SIZE(nexcoder_uartcfgs));
>> +	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
>>
>>  	nexcoder_sensorboard_init();
>>  }
>> @@ -153,6 +155,6 @@ MACHINE_START(NEXCODER_2440, "NexVision - Nexcoder
>> 2440") .map_io		= nexcoder_map_io,
>>  	.init_machine	= nexcoder_init,
>>  	.init_irq	= s3c24xx_init_irq,
>> -	.timer		= &s3c24xx_timer,
>> +	.timer		= &samsung_timer,
>>  	.restart	= s3c244x_restart,
>>  MACHINE_END
>> diff --git a/arch/arm/mach-s3c24xx/mach-osiris.c
>> b/arch/arm/mach-s3c24xx/mach-osiris.c index bb36d83..e85144e 100644
>> --- a/arch/arm/mach-s3c24xx/mach-osiris.c
>> +++ b/arch/arm/mach-s3c24xx/mach-osiris.c
>> @@ -53,6 +53,7 @@
>>  #include <plat/clock.h>
>>  #include <plat/devs.h>
>>  #include <plat/cpu.h>
>> +#include <plat/samsung-time.h>
>>
>>  #include "common.h"
>>
>> @@ -386,6 +387,7 @@ static void __init osiris_map_io(void)
>>  	s3c24xx_init_io(osiris_iodesc, ARRAY_SIZE(osiris_iodesc));
>>  	s3c24xx_init_clocks(0);
>>  	s3c24xx_init_uarts(osiris_uartcfgs, ARRAY_SIZE(osiris_uartcfgs));
>> +	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
>>
>>  	/* check for the newer revision boards with large page nand */
>>
>> @@ -428,6 +430,6 @@ MACHINE_START(OSIRIS, "Simtec-OSIRIS")
>>  	.map_io		= osiris_map_io,
>>  	.init_irq	= s3c24xx_init_irq,
>>  	.init_machine	= osiris_init,
>> -	.timer		= &s3c24xx_timer,
>> +	.timer		= &samsung_timer,
>>  	.restart	= s3c244x_restart,
>>  MACHINE_END
>> diff --git a/arch/arm/mach-s3c24xx/mach-otom.c
>> b/arch/arm/mach-s3c24xx/mach-otom.c index bca39f0..ab5f353 100644
>> --- a/arch/arm/mach-s3c24xx/mach-otom.c
>> +++ b/arch/arm/mach-s3c24xx/mach-otom.c
>> @@ -37,6 +37,7 @@
>>  #include <plat/devs.h>
>>  #include <linux/platform_data/i2c-s3c2410.h>
>>  #include <plat/cpu.h>
>> +#include <plat/samsung-time.h>
>>
>>  #include "common.h"
>>
>> @@ -104,6 +105,7 @@ static void __init otom11_map_io(void)
>>  	s3c24xx_init_io(otom11_iodesc, ARRAY_SIZE(otom11_iodesc));
>>  	s3c24xx_init_clocks(0);
>>  	s3c24xx_init_uarts(otom11_uartcfgs, ARRAY_SIZE(otom11_uartcfgs));
>> +	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
>>  }
>>
>>  static void __init otom11_init(void)
>> @@ -118,6 +120,6 @@ MACHINE_START(OTOM, "Nex Vision - Otom 1.1")
>>  	.map_io		= otom11_map_io,
>>  	.init_machine	= otom11_init,
>>  	.init_irq	= s3c24xx_init_irq,
>> -	.timer		= &s3c24xx_timer,
>> +	.timer		= &samsung_timer,
>>  	.restart	= s3c2410_restart,
>>  MACHINE_END
>> diff --git a/arch/arm/mach-s3c24xx/mach-qt2410.c
>> b/arch/arm/mach-s3c24xx/mach-qt2410.c index 7b6ba13..e725554 100644
>> --- a/arch/arm/mach-s3c24xx/mach-qt2410.c
>> +++ b/arch/arm/mach-s3c24xx/mach-qt2410.c
>> @@ -60,6 +60,7 @@
>>  #include <plat/devs.h>
>>  #include <plat/cpu.h>
>>  #include <plat/pm.h>
>> +#include <plat/samsung-time.h>
>>
>>  #include "common.h"
>>
>> @@ -304,6 +305,7 @@ static void __init qt2410_map_io(void)
>>  	s3c24xx_init_io(qt2410_iodesc, ARRAY_SIZE(qt2410_iodesc));
>>  	s3c24xx_init_clocks(12*1000*1000);
>>  	s3c24xx_init_uarts(smdk2410_uartcfgs, ARRAY_SIZE(smdk2410_uartcfgs));
>> +	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
>>  }
>>
>>  static void __init qt2410_machine_init(void)
>> @@ -343,6 +345,6 @@ MACHINE_START(QT2410, "QT2410")
>>  	.map_io		= qt2410_map_io,
>>  	.init_irq	= s3c24xx_init_irq,
>>  	.init_machine	= qt2410_machine_init,
>> -	.timer		= &s3c24xx_timer,
>> +	.timer		= &samsung_timer,
>>  	.restart	= s3c2410_restart,
>>  MACHINE_END
>> diff --git a/arch/arm/mach-s3c24xx/mach-rx1950.c
>> b/arch/arm/mach-s3c24xx/mach-rx1950.c index 379fde5..63fbeb1 100644
>> --- a/arch/arm/mach-s3c24xx/mach-rx1950.c
>> +++ b/arch/arm/mach-s3c24xx/mach-rx1950.c
>> @@ -58,6 +58,7 @@
>>  #include <plat/pm.h>
>>  #include <plat/irq.h>
>>  #include <linux/platform_data/touchscreen-s3c2410.h>
>> +#include <plat/samsung-time.h>
>>
>>  #include <sound/uda1380.h>
>>
>> @@ -743,6 +744,7 @@ static void __init rx1950_map_io(void)
>>  	s3c24xx_init_io(rx1950_iodesc, ARRAY_SIZE(rx1950_iodesc));
>>  	s3c24xx_init_clocks(16934000);
>>  	s3c24xx_init_uarts(rx1950_uartcfgs, ARRAY_SIZE(rx1950_uartcfgs));
>> +	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
>>
>>  	/* setup PM */
>>
>> @@ -815,6 +817,6 @@ MACHINE_START(RX1950, "HP iPAQ RX1950")
>>  	.reserve	= rx1950_reserve,
>>  	.init_irq = s3c24xx_init_irq,
>>  	.init_machine = rx1950_init_machine,
>> -	.timer = &s3c24xx_timer,
>> +	.timer = &samsung_timer,
>>  	.restart	= s3c244x_restart,
>>  MACHINE_END
>> diff --git a/arch/arm/mach-s3c24xx/mach-rx3715.c
>> b/arch/arm/mach-s3c24xx/mach-rx3715.c index dacbb9a..1b358a1 100644
>> --- a/arch/arm/mach-s3c24xx/mach-rx3715.c
>> +++ b/arch/arm/mach-s3c24xx/mach-rx3715.c
>> @@ -50,6 +50,7 @@
>>  #include <plat/devs.h>
>>  #include <plat/cpu.h>
>>  #include <plat/pm.h>
>> +#include <plat/samsung-time.h>
>>
>>  #include "common.h"
>>
>> @@ -179,6 +180,7 @@ static void __init rx3715_map_io(void)
>>  	s3c24xx_init_io(rx3715_iodesc, ARRAY_SIZE(rx3715_iodesc));
>>  	s3c24xx_init_clocks(16934000);
>>  	s3c24xx_init_uarts(rx3715_uartcfgs, ARRAY_SIZE(rx3715_uartcfgs));
>> +	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
>>  }
>>
>>  /* H1940 and RX3715 need to reserve this for suspend */
>> @@ -212,6 +214,6 @@ MACHINE_START(RX3715, "IPAQ-RX3715")
>>  	.reserve	= rx3715_reserve,
>>  	.init_irq	= rx3715_init_irq,
>>  	.init_machine	= rx3715_init_machine,
>> -	.timer		= &s3c24xx_timer,
>> +	.timer		= &samsung_timer,
>>  	.restart	= s3c244x_restart,
>>  MACHINE_END
>> diff --git a/arch/arm/mach-s3c24xx/mach-smdk2410.c
>> b/arch/arm/mach-s3c24xx/mach-smdk2410.c index 82796b9..c7a18bc 100644
>> --- a/arch/arm/mach-s3c24xx/mach-smdk2410.c
>> +++ b/arch/arm/mach-s3c24xx/mach-smdk2410.c
>> @@ -53,6 +53,7 @@
>>  #include <plat/cpu.h>
>>
>>  #include <plat/common-smdk.h>
>> +#include <plat/samsung-time.h>
>>
>>  #include "common.h"
>>
>> @@ -101,6 +102,7 @@ static void __init smdk2410_map_io(void)
>>  	s3c24xx_init_io(smdk2410_iodesc, ARRAY_SIZE(smdk2410_iodesc));
>>  	s3c24xx_init_clocks(0);
>>  	s3c24xx_init_uarts(smdk2410_uartcfgs, ARRAY_SIZE(smdk2410_uartcfgs));
>> +	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
>>  }
>>
>>  static void __init smdk2410_init(void)
>> @@ -117,6 +119,6 @@ MACHINE_START(SMDK2410, "SMDK2410") /* @TODO: request a
>> new identifier and switc .map_io		= smdk2410_map_io,
>>  	.init_irq	= s3c24xx_init_irq,
>>  	.init_machine	= smdk2410_init,
>> -	.timer		= &s3c24xx_timer,
>> +	.timer		= &samsung_timer,
>>  	.restart	= s3c2410_restart,
>>  MACHINE_END
>> diff --git a/arch/arm/mach-s3c24xx/mach-smdk2413.c
>> b/arch/arm/mach-s3c24xx/mach-smdk2413.c index ce99fd8..c29c067 100644
>> --- a/arch/arm/mach-s3c24xx/mach-smdk2413.c
>> +++ b/arch/arm/mach-s3c24xx/mach-smdk2413.c
>> @@ -47,6 +47,7 @@
>>  #include <plat/clock.h>
>>  #include <plat/devs.h>
>>  #include <plat/cpu.h>
>> +#include <plat/samsung-time.h>
>>
>>  #include <plat/common-smdk.h>
>>
>> @@ -107,6 +108,7 @@ static void __init smdk2413_map_io(void)
>>  	s3c24xx_init_io(smdk2413_iodesc, ARRAY_SIZE(smdk2413_iodesc));
>>  	s3c24xx_init_clocks(12000000);
>>  	s3c24xx_init_uarts(smdk2413_uartcfgs, ARRAY_SIZE(smdk2413_uartcfgs));
>> +	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
>>  }
>>
>>  static void __init smdk2413_machine_init(void)
>> @@ -133,7 +135,7 @@ MACHINE_START(S3C2413, "S3C2413")
>>  	.init_irq	= s3c24xx_init_irq,
>>  	.map_io		= smdk2413_map_io,
>>  	.init_machine	= smdk2413_machine_init,
>> -	.timer		= &s3c24xx_timer,
>> +	.timer		= &samsung_timer,
>>  	.restart	= s3c2412_restart,
>>  MACHINE_END
>>
>> @@ -145,7 +147,7 @@ MACHINE_START(SMDK2412, "SMDK2412")
>>  	.init_irq	= s3c24xx_init_irq,
>>  	.map_io		= smdk2413_map_io,
>>  	.init_machine	= smdk2413_machine_init,
>> -	.timer		= &s3c24xx_timer,
>> +	.timer		= &samsung_timer,
>>  	.restart	= s3c2412_restart,
>>  MACHINE_END
>>
>> @@ -157,6 +159,6 @@ MACHINE_START(SMDK2413, "SMDK2413")
>>  	.init_irq	= s3c24xx_init_irq,
>>  	.map_io		= smdk2413_map_io,
>>  	.init_machine	= smdk2413_machine_init,
>> -	.timer		= &s3c24xx_timer,
>> +	.timer		= &samsung_timer,
>>  	.restart	= s3c2412_restart,
>>  MACHINE_END
>> diff --git a/arch/arm/mach-s3c24xx/mach-smdk2416.c
>> b/arch/arm/mach-s3c24xx/mach-smdk2416.c index f30d7fc..2c0b7a1 100644
>> --- a/arch/arm/mach-s3c24xx/mach-smdk2416.c
>> +++ b/arch/arm/mach-s3c24xx/mach-smdk2416.c
>> @@ -52,6 +52,7 @@
>>  #include <plat/sdhci.h>
>>  #include <linux/platform_data/usb-s3c2410_udc.h>
>>  #include <linux/platform_data/s3c-hsudc.h>
>> +#include <plat/samsung-time.h>
>>
>>  #include <plat/fb.h>
>>
>> @@ -222,6 +223,7 @@ static void __init smdk2416_map_io(void)
>>  	s3c24xx_init_io(smdk2416_iodesc, ARRAY_SIZE(smdk2416_iodesc));
>>  	s3c24xx_init_clocks(12000000);
>>  	s3c24xx_init_uarts(smdk2416_uartcfgs, ARRAY_SIZE(smdk2416_uartcfgs));
>> +	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
>>  }
>>
>>  static void __init smdk2416_machine_init(void)
>> @@ -254,6 +256,6 @@ MACHINE_START(SMDK2416, "SMDK2416")
>>  	.init_irq	= s3c24xx_init_irq,
>>  	.map_io		= smdk2416_map_io,
>>  	.init_machine	= smdk2416_machine_init,
>> -	.timer		= &s3c24xx_timer,
>> +	.timer		= &samsung_timer,
>>  	.restart	= s3c2416_restart,
>>  MACHINE_END
>> diff --git a/arch/arm/mach-s3c24xx/mach-smdk2440.c
>> b/arch/arm/mach-s3c24xx/mach-smdk2440.c index b7ff882..caf5c04 100644
>> --- a/arch/arm/mach-s3c24xx/mach-smdk2440.c
>> +++ b/arch/arm/mach-s3c24xx/mach-smdk2440.c
>> @@ -44,6 +44,7 @@
>>  #include <plat/clock.h>
>>  #include <plat/devs.h>
>>  #include <plat/cpu.h>
>> +#include <plat/samsung-time.h>
>>
>>  #include <plat/common-smdk.h>
>>
>> @@ -164,6 +165,7 @@ static void __init smdk2440_map_io(void)
>>  	s3c24xx_init_io(smdk2440_iodesc, ARRAY_SIZE(smdk2440_iodesc));
>>  	s3c24xx_init_clocks(16934400);
>>  	s3c24xx_init_uarts(smdk2440_uartcfgs, ARRAY_SIZE(smdk2440_uartcfgs));
>> +	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
>>  }
>>
>>  static void __init smdk2440_machine_init(void)
>> @@ -182,6 +184,6 @@ MACHINE_START(S3C2440, "SMDK2440")
>>  	.init_irq	= s3c24xx_init_irq,
>>  	.map_io		= smdk2440_map_io,
>>  	.init_machine	= smdk2440_machine_init,
>> -	.timer		= &s3c24xx_timer,
>> +	.timer		= &samsung_timer,
>>  	.restart	= s3c244x_restart,
>>  MACHINE_END
>> diff --git a/arch/arm/mach-s3c24xx/mach-smdk2443.c
>> b/arch/arm/mach-s3c24xx/mach-smdk2443.c index 2568656..02fcd27 100644
>> --- a/arch/arm/mach-s3c24xx/mach-smdk2443.c
>> +++ b/arch/arm/mach-s3c24xx/mach-smdk2443.c
>> @@ -44,6 +44,7 @@
>>  #include <plat/clock.h>
>>  #include <plat/devs.h>
>>  #include <plat/cpu.h>
>> +#include <plat/samsung-time.h>
>>
>>  #include <plat/common-smdk.h>
>>
>> @@ -123,6 +124,7 @@ static void __init smdk2443_map_io(void)
>>  	s3c24xx_init_io(smdk2443_iodesc, ARRAY_SIZE(smdk2443_iodesc));
>>  	s3c24xx_init_clocks(12000000);
>>  	s3c24xx_init_uarts(smdk2443_uartcfgs, ARRAY_SIZE(smdk2443_uartcfgs));
>> +	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
>>  }
>>
>>  static void __init smdk2443_machine_init(void)
>> @@ -144,6 +146,6 @@ MACHINE_START(SMDK2443, "SMDK2443")
>>  	.init_irq	= s3c24xx_init_irq,
>>  	.map_io		= smdk2443_map_io,
>>  	.init_machine	= smdk2443_machine_init,
>> -	.timer		= &s3c24xx_timer,
>> +	.timer		= &samsung_timer,
>>  	.restart	= s3c2443_restart,
>>  MACHINE_END
>> diff --git a/arch/arm/mach-s3c24xx/mach-tct_hammer.c
>> b/arch/arm/mach-s3c24xx/mach-tct_hammer.c index 495bf5c..90f43c9 100644
>> --- a/arch/arm/mach-s3c24xx/mach-tct_hammer.c
>> +++ b/arch/arm/mach-s3c24xx/mach-tct_hammer.c
>> @@ -53,6 +53,7 @@
>>  #include <linux/mtd/partitions.h>
>>  #include <linux/mtd/map.h>
>>  #include <linux/mtd/physmap.h>
>> +#include <plat/samsung-time.h>
>>
>>  #include "common.h"
>>
>> @@ -136,6 +137,7 @@ static void __init tct_hammer_map_io(void)
>>  	s3c24xx_init_io(tct_hammer_iodesc, ARRAY_SIZE(tct_hammer_iodesc));
>>  	s3c24xx_init_clocks(0);
>>  	s3c24xx_init_uarts(tct_hammer_uartcfgs, ARRAY_SIZE(tct_hammer_uartcfgs));
>> +	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
>>  }
>>
>>  static void __init tct_hammer_init(void)
>> @@ -149,6 +151,6 @@ MACHINE_START(TCT_HAMMER, "TCT_HAMMER")
>>  	.map_io		= tct_hammer_map_io,
>>  	.init_irq	= s3c24xx_init_irq,
>>  	.init_machine	= tct_hammer_init,
>> -	.timer		= &s3c24xx_timer,
>> +	.timer		= &samsung_timer,
>>  	.restart	= s3c2410_restart,
>>  MACHINE_END
>> diff --git a/arch/arm/mach-s3c24xx/mach-vr1000.c
>> b/arch/arm/mach-s3c24xx/mach-vr1000.c index 14d5b12..4366c6f 100644
>> --- a/arch/arm/mach-s3c24xx/mach-vr1000.c
>> +++ b/arch/arm/mach-s3c24xx/mach-vr1000.c
>> @@ -50,6 +50,7 @@
>>  #include <plat/cpu.h>
>>  #include <linux/platform_data/i2c-s3c2410.h>
>>  #include <linux/platform_data/asoc-s3c24xx_simtec.h>
>> +#include <plat/samsung-time.h>
>>
>>  #include "simtec.h"
>>  #include "common.h"
>> @@ -335,6 +336,7 @@ static void __init vr1000_map_io(void)
>>  	s3c24xx_init_io(vr1000_iodesc, ARRAY_SIZE(vr1000_iodesc));
>>  	s3c24xx_init_clocks(0);
>>  	s3c24xx_init_uarts(vr1000_uartcfgs, ARRAY_SIZE(vr1000_uartcfgs));
>> +	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
>>  }
>>
>>  static void __init vr1000_init(void)
>> @@ -357,6 +359,6 @@ MACHINE_START(VR1000, "Thorcom-VR1000")
>>  	.map_io		= vr1000_map_io,
>>  	.init_machine	= vr1000_init,
>>  	.init_irq	= s3c24xx_init_irq,
>> -	.timer		= &s3c24xx_timer,
>> +	.timer		= &samsung_timer,
>>  	.restart	= s3c2410_restart,
>>  MACHINE_END
>> diff --git a/arch/arm/mach-s3c24xx/mach-vstms.c
>> b/arch/arm/mach-s3c24xx/mach-vstms.c index f1d44ae..412d858 100644
>> --- a/arch/arm/mach-s3c24xx/mach-vstms.c
>> +++ b/arch/arm/mach-s3c24xx/mach-vstms.c
>> @@ -47,7 +47,7 @@
>>  #include <plat/clock.h>
>>  #include <plat/devs.h>
>>  #include <plat/cpu.h>
>> -
>> +#include <plat/samsung-time.h>
>>
>>  static struct map_desc vstms_iodesc[] __initdata = {
>>  };
>> @@ -144,6 +144,7 @@ static void __init vstms_map_io(void)
>>  	s3c24xx_init_io(vstms_iodesc, ARRAY_SIZE(vstms_iodesc));
>>  	s3c24xx_init_clocks(12000000);
>>  	s3c24xx_init_uarts(vstms_uartcfgs, ARRAY_SIZE(vstms_uartcfgs));
>> +	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
>>  }
>>
>>  static void __init vstms_init(void)
>> @@ -161,6 +162,6 @@ MACHINE_START(VSTMS, "VSTMS")
>>  	.init_irq	= s3c24xx_init_irq,
>>  	.init_machine	= vstms_init,
>>  	.map_io		= vstms_map_io,
>> -	.timer		= &s3c24xx_timer,
>> +	.timer		= &samsung_timer,
>>  	.restart	= s3c2412_restart,
>>  MACHINE_END
>> diff --git a/arch/arm/plat-samsung/include/plat/cpu.h
>> b/arch/arm/plat-samsung/include/plat/cpu.h index ace4451..86fb5f3 100644
>> --- a/arch/arm/plat-samsung/include/plat/cpu.h
>> +++ b/arch/arm/plat-samsung/include/plat/cpu.h
>> @@ -184,7 +184,7 @@ extern void s3c24xx_init_uartdevs(char *name,
>>  				  struct s3c24xx_uart_resources *res,
>>  				  struct s3c2410_uartcfg *cfg, int no);
>>
>> -/* timer for 2410/2440 */
>> +/* timer for s5pc100 only */
>>
>>  struct sys_timer;
>>  extern struct sys_timer s3c24xx_timer;
>> diff --git a/arch/arm/plat-samsung/include/plat/samsung-time.h
>> b/arch/arm/plat-samsung/include/plat/samsung-time.h index 9d6d622..13ae4b9
>> 100644
>> --- a/arch/arm/plat-samsung/include/plat/samsung-time.h
>> +++ b/arch/arm/plat-samsung/include/plat/samsung-time.h
>> @@ -30,7 +30,18 @@ struct samsung_timer_source {
>>  /* Be able to sleep for atleast 4 seconds (usually more) */
>>  #define SAMSUNG_TIMER_MIN_RANGE	4
>>
>> +#ifdef CONFIG_ARCH_S3C24XX
>> +#define TCNT_MAX		0xffff
>> +#define TSCALER_DIV		25
>> +#define TDIV			50
>> +#define TSIZE			16
>> +#else
>>  #define TCNT_MAX		0xffffffff
>> +#define TSCALER_DIV		2
>> +#define TDIV			2
>> +#define TSIZE			32
>> +#endif
>> +
>>  #define NON_PERIODIC		0
>>  #define PERIODIC		1
>>
>> diff --git a/arch/arm/plat-samsung/samsung-time.c
>> b/arch/arm/plat-samsung/samsung-time.c index 91773bf..6d63fca 100644
>> --- a/arch/arm/plat-samsung/samsung-time.c
>> +++ b/arch/arm/plat-samsung/samsung-time.c
>> @@ -2,7 +2,7 @@
>>   * Copyright (c) 2011 Samsung Electronics Co., Ltd.
>>   *		http://www.samsung.com/
>>   *
>> - * SAMSUNG - Common hr-timer support
>> + * samsung - Common hr-timer support (s3c and s5p)
>>   *
>>   * This program is free software; you can redistribute it and/or modify
>>   * it under the terms of the GNU General Public License version 2 as
>> @@ -267,8 +267,8 @@ static void __init samsung_clockevent_init(void)
>>
>>  	tscaler = clk_get_parent(tdiv_event);
>>
>> -	clk_set_rate(tscaler, pclk / 2);
>> -	clk_set_rate(tdiv_event, pclk / 2);
>> +	clk_set_rate(tscaler, pclk / TSCALER_DIV);
>> +	clk_set_rate(tdiv_event, pclk / TDIV);
>>  	clk_set_parent(tin_event, tdiv_event);
>>
>>  	clock_rate = clk_get_rate(tin_event);
>> @@ -336,7 +336,7 @@ static void __init samsung_clocksource_init(void)
>>
>>  	pclk = clk_get_rate(timerclk);
>>
>> -	clk_set_rate(tdiv_source, pclk / 2);
>> +	clk_set_rate(tdiv_source, pclk / TDIV);
>>  	clk_set_parent(tin_source, tdiv_source);
>>
>>  	clock_rate = clk_get_rate(tin_source);
>> @@ -344,10 +344,10 @@ static void __init samsung_clocksource_init(void)
>>  	samsung_time_setup(timer_source.source_id, TCNT_MAX);
>>  	samsung_time_start(timer_source.source_id, PERIODIC);
>>
>> -	setup_sched_clock(samsung_read_sched_clock, 32, clock_rate);
>> +	setup_sched_clock(samsung_read_sched_clock, TSIZE, clock_rate);
>>
>>  	if (clocksource_mmio_init(samsung_timer_reg(),
>> "samsung_clocksource_timer", -			clock_rate, 250, 32,
>> clocksource_mmio_readl_down))
>> +			clock_rate, 250, TSIZE, clocksource_mmio_readl_down))
>>  		panic("samsung_clocksource_timer: can't register clocksource\n");
>>  }
> 

^ permalink raw reply	[flat|nested] 39+ messages in thread

* Re: [PATCH 1/5 v2] Rename s5p-time to samsung-time
  2012-12-10 12:59               ` Heiko Stübner
@ 2012-12-15 21:43                 ` Romain Naour
  2013-01-08 21:00                   ` Tomasz Figa
  0 siblings, 1 reply; 39+ messages in thread
From: Romain Naour @ 2012-12-15 21:43 UTC (permalink / raw)
  To: Heiko Stübner
  Cc: tomasz.figa, Kukjin Kim, linux-samsung-soc, ben-linux,
	'Sylwester Nawrocki'

Le 10/12/2012 13:59, Heiko Stübner a écrit :
> Am Sonntag, 2. Dezember 2012, 20:44:01 schrieb Romain Naour:
>> This patch rename s5p-time to samsung-time.
>> There is no functional change.
>>
>>
>> Signed-off-by: Naour Romain <romain.naour@openwide.fr>
> 
> The patch does not apply to current linux-next, because it has some problem 
> with the exynos-universal board. I've fixed this to test the patch, so
> 
> Acked-by: Heiko Stuebner <heiko@sntech.de>

What's wrong with this part of the patch ?
I applied this patch today on linux-next tree, branch next-20121214. (with some hunk but no error)

Thank you for your time.
> 
>>
>>  delete mode 100644 arch/arm/plat-samsung/include/plat/s5p-time.h
>>  create mode 100644 arch/arm/plat-samsung/include/plat/samsung-time.h
>>  rename arch/arm/plat-samsung/{s5p-time.c => samsung-time.c} (70%)
> 
> what does this line do in the patch description? It seems your mail client 
> mangled the "--" parting the patch message from the stats/comment section.
> 
> 
> 
>> diff --git a/arch/arm/mach-exynos/Kconfig b/arch/arm/mach-exynos/Kconfig
>> index da55107..20edfa3 100644
>> --- a/arch/arm/mach-exynos/Kconfig
>> +++ b/arch/arm/mach-exynos/Kconfig
>> @@ -274,7 +274,7 @@ config MACH_UNIVERSAL_C210
>>  	select S5P_DEV_ONENAND
>>  	select S5P_DEV_TV
>>  	select S5P_GPIO_INT
>> -	select S5P_HRT
>> +	select SAMSUNG_HRT
>>  	select S5P_SETUP_MIPIPHY
>>  	help
>>  	  Machine support for Samsung Mobile Universal S5PC210 Reference
>> diff --git a/arch/arm/mach-exynos/mach-universal_c210.c
>> b/arch/arm/mach-exynos/mach-universal_c210.c index ebc9dd3..325bfe9 100644
>> --- a/arch/arm/mach-exynos/mach-universal_c210.c
>> +++ b/arch/arm/mach-exynos/mach-universal_c210.c
>> @@ -41,7 +41,7 @@
>>  #include <plat/mfc.h>
>>  #include <plat/sdhci.h>
>>  #include <plat/fimc-core.h>
>> -#include <plat/s5p-time.h>
>> +#include <plat/samsung-time.h>
>>  #include <plat/camport.h>
>>  #include <linux/platform_data/mipi-csis.h>
>>
>> @@ -1099,7 +1099,7 @@ static void __init universal_map_io(void)
>>  	exynos_init_io(NULL, 0);
>>  	s3c24xx_init_clocks(clk_xusbxti.rate);
>>  	s3c24xx_init_uarts(universal_uartcfgs, ARRAY_SIZE(universal_uartcfgs));
>> -	s5p_set_timer_source(S5P_PWM2, S5P_PWM4);
>> +	samsung_set_timer_source(SAMSUNG_PWM2, SAMSUNG_PWM4);
>>  }
>>
>>  static void s5p_tv_setup(void)
>> @@ -1158,7 +1158,7 @@ MACHINE_START(UNIVERSAL_C210, "UNIVERSAL_C210")
>>  	.handle_irq	= gic_handle_irq,
>>  	.init_machine	= universal_machine_init,
>>  	.init_late	= exynos_init_late,
>> -	.timer		= &s5p_timer,
>> +	.timer		= &samsung_timer,
>>  	.reserve        = &universal_reserve,
>>  	.restart	= exynos4_restart,
>>  MACHINE_END
>> diff --git a/arch/arm/mach-s5p64x0/Kconfig b/arch/arm/mach-s5p64x0/Kconfig
>> index e8742cb..f0ec535 100644
>> --- a/arch/arm/mach-s5p64x0/Kconfig
>> +++ b/arch/arm/mach-s5p64x0/Kconfig
>> @@ -9,7 +9,7 @@ if ARCH_S5P64X0
>>
>>  config CPU_S5P6440
>>  	bool
>> -	select S5P_HRT
>> +	select SAMSUNG_HRT
>>  	select S5P_SLEEP if PM
>>  	select SAMSUNG_DMADEV
>>  	select SAMSUNG_WAKEMASK if PM
>> @@ -18,7 +18,7 @@ config CPU_S5P6440
>>
>>  config CPU_S5P6450
>>  	bool
>> -	select S5P_HRT
>> +	select SAMSUNG_HRT
>>  	select S5P_SLEEP if PM
>>  	select SAMSUNG_DMADEV
>>  	select SAMSUNG_WAKEMASK if PM
>> diff --git a/arch/arm/mach-s5p64x0/mach-smdk6440.c
>> b/arch/arm/mach-s5p64x0/mach-smdk6440.c index 96ea1fe..587fec5 100644
>> --- a/arch/arm/mach-s5p64x0/mach-smdk6440.c
>> +++ b/arch/arm/mach-s5p64x0/mach-smdk6440.c
>> @@ -50,7 +50,7 @@
>>  #include <plat/pll.h>
>>  #include <plat/adc.h>
>>  #include <linux/platform_data/touchscreen-s3c2410.h>
>> -#include <plat/s5p-time.h>
>> +#include <plat/samsung-time.h>
>>  #include <plat/backlight.h>
>>  #include <plat/fb.h>
>>  #include <plat/sdhci.h>
>> @@ -231,7 +231,7 @@ static void __init smdk6440_map_io(void)
>>  	s5p64x0_init_io(NULL, 0);
>>  	s3c24xx_init_clocks(12000000);
>>  	s3c24xx_init_uarts(smdk6440_uartcfgs, ARRAY_SIZE(smdk6440_uartcfgs));
>> -	s5p_set_timer_source(S5P_PWM3, S5P_PWM4);
>> +	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
>>  }
>>
>>  static void s5p6440_set_lcd_interface(void)
>> @@ -276,6 +276,6 @@ MACHINE_START(SMDK6440, "SMDK6440")
>>  	.handle_irq	= vic_handle_irq,
>>  	.map_io		= smdk6440_map_io,
>>  	.init_machine	= smdk6440_machine_init,
>> -	.timer		= &s5p_timer,
>> +	.timer		= &samsung_timer,
>>  	.restart	= s5p64x0_restart,
>>  MACHINE_END
>> diff --git a/arch/arm/mach-s5p64x0/mach-smdk6450.c
>> b/arch/arm/mach-s5p64x0/mach-smdk6450.c index 12748b6..714cd8a 100644
>> --- a/arch/arm/mach-s5p64x0/mach-smdk6450.c
>> +++ b/arch/arm/mach-s5p64x0/mach-smdk6450.c
>> @@ -50,7 +50,7 @@
>>  #include <plat/pll.h>
>>  #include <plat/adc.h>
>>  #include <linux/platform_data/touchscreen-s3c2410.h>
>> -#include <plat/s5p-time.h>
>> +#include <plat/samsung-time.h>
>>  #include <plat/backlight.h>
>>  #include <plat/fb.h>
>>  #include <plat/sdhci.h>
>> @@ -250,7 +250,7 @@ static void __init smdk6450_map_io(void)
>>  	s5p64x0_init_io(NULL, 0);
>>  	s3c24xx_init_clocks(19200000);
>>  	s3c24xx_init_uarts(smdk6450_uartcfgs, ARRAY_SIZE(smdk6450_uartcfgs));
>> -	s5p_set_timer_source(S5P_PWM3, S5P_PWM4);
>> +	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
>>  }
>>
>>  static void s5p6450_set_lcd_interface(void)
>> @@ -295,6 +295,6 @@ MACHINE_START(SMDK6450, "SMDK6450")
>>  	.handle_irq	= vic_handle_irq,
>>  	.map_io		= smdk6450_map_io,
>>  	.init_machine	= smdk6450_machine_init,
>> -	.timer		= &s5p_timer,
>> +	.timer		= &samsung_timer,
>>  	.restart	= s5p64x0_restart,
>>  MACHINE_END
>> diff --git a/arch/arm/mach-s5pv210/Kconfig b/arch/arm/mach-s5pv210/Kconfig
>> index 92ad72f..01018ef 100644
>> --- a/arch/arm/mach-s5pv210/Kconfig
>> +++ b/arch/arm/mach-s5pv210/Kconfig
>> @@ -12,7 +12,7 @@ if ARCH_S5PV210
>>  config CPU_S5PV210
>>  	bool
>>  	select S5P_EXT_INT
>> -	select S5P_HRT
>> +	select SAMSUNG_HRT
>>  	select S5P_PM if PM
>>  	select S5P_SLEEP if PM
>>  	select SAMSUNG_DMADEV
>> diff --git a/arch/arm/mach-s5pv210/mach-aquila.c
>> b/arch/arm/mach-s5pv210/mach-aquila.c index ee9fa5c..7c7d89b 100644
>> --- a/arch/arm/mach-s5pv210/mach-aquila.c
>> +++ b/arch/arm/mach-s5pv210/mach-aquila.c
>> @@ -39,7 +39,7 @@
>>  #include <plat/fb.h>
>>  #include <plat/fimc-core.h>
>>  #include <plat/sdhci.h>
>> -#include <plat/s5p-time.h>
>> +#include <plat/samsung-time.h>
>>
>>  #include "common.h"
>>
>> @@ -652,7 +652,7 @@ static void __init aquila_map_io(void)
>>  	s5pv210_init_io(NULL, 0);
>>  	s3c24xx_init_clocks(24000000);
>>  	s3c24xx_init_uarts(aquila_uartcfgs, ARRAY_SIZE(aquila_uartcfgs));
>> -	s5p_set_timer_source(S5P_PWM3, S5P_PWM4);
>> +	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
>>  }
>>
>>  static void __init aquila_machine_init(void)
>> @@ -688,6 +688,6 @@ MACHINE_START(AQUILA, "Aquila")
>>  	.handle_irq	= vic_handle_irq,
>>  	.map_io		= aquila_map_io,
>>  	.init_machine	= aquila_machine_init,
>> -	.timer		= &s5p_timer,
>> +	.timer		= &samsung_timer,
>>  	.restart	= s5pv210_restart,
>>  MACHINE_END
>> diff --git a/arch/arm/mach-s5pv210/mach-goni.c
>> b/arch/arm/mach-s5pv210/mach-goni.c index 55e1dba..2740001 100644
>> --- a/arch/arm/mach-s5pv210/mach-goni.c
>> +++ b/arch/arm/mach-s5pv210/mach-goni.c
>> @@ -48,7 +48,7 @@
>>  #include <plat/keypad.h>
>>  #include <plat/sdhci.h>
>>  #include <plat/clock.h>
>> -#include <plat/s5p-time.h>
>> +#include <plat/samsung-time.h>
>>  #include <plat/mfc.h>
>>  #include <plat/camport.h>
>>
>> @@ -910,7 +910,7 @@ static void __init goni_map_io(void)
>>  	s5pv210_init_io(NULL, 0);
>>  	s3c24xx_init_clocks(clk_xusbxti.rate);
>>  	s3c24xx_init_uarts(goni_uartcfgs, ARRAY_SIZE(goni_uartcfgs));
>> -	s5p_set_timer_source(S5P_PWM3, S5P_PWM4);
>> +	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
>>  }
>>
>>  static void __init goni_reserve(void)
>> @@ -976,7 +976,7 @@ MACHINE_START(GONI, "GONI")
>>  	.handle_irq	= vic_handle_irq,
>>  	.map_io		= goni_map_io,
>>  	.init_machine	= goni_machine_init,
>> -	.timer		= &s5p_timer,
>> +	.timer		= &samsung_timer,
>>  	.reserve	= &goni_reserve,
>>  	.restart	= s5pv210_restart,
>>  MACHINE_END
>> diff --git a/arch/arm/mach-s5pv210/mach-smdkc110.c
>> b/arch/arm/mach-s5pv210/mach-smdkc110.c index d9c99fc..d2e93b7 100644
>> --- a/arch/arm/mach-s5pv210/mach-smdkc110.c
>> +++ b/arch/arm/mach-s5pv210/mach-smdkc110.c
>> @@ -30,7 +30,7 @@
>>  #include <linux/platform_data/ata-samsung_cf.h>
>>  #include <linux/platform_data/i2c-s3c2410.h>
>>  #include <plat/pm.h>
>> -#include <plat/s5p-time.h>
>> +#include <plat/samsung-time.h>
>>  #include <plat/mfc.h>
>>
>>  #include "common.h"
>> @@ -122,7 +122,7 @@ static void __init smdkc110_map_io(void)
>>  	s5pv210_init_io(NULL, 0);
>>  	s3c24xx_init_clocks(24000000);
>>  	s3c24xx_init_uarts(smdkv210_uartcfgs, ARRAY_SIZE(smdkv210_uartcfgs));
>> -	s5p_set_timer_source(S5P_PWM3, S5P_PWM4);
>> +	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
>>  }
>>
>>  static void __init smdkc110_reserve(void)
>> @@ -156,7 +156,7 @@ MACHINE_START(SMDKC110, "SMDKC110")
>>  	.handle_irq	= vic_handle_irq,
>>  	.map_io		= smdkc110_map_io,
>>  	.init_machine	= smdkc110_machine_init,
>> -	.timer		= &s5p_timer,
>> +	.timer		= &samsung_timer,
>>  	.restart	= s5pv210_restart,
>>  	.reserve	= &smdkc110_reserve,
>>  MACHINE_END
>> diff --git a/arch/arm/mach-s5pv210/mach-smdkv210.c
>> b/arch/arm/mach-s5pv210/mach-smdkv210.c index 4cdb5bb..cd28725 100644
>> --- a/arch/arm/mach-s5pv210/mach-smdkv210.c
>> +++ b/arch/arm/mach-s5pv210/mach-smdkv210.c
>> @@ -45,7 +45,7 @@
>>  #include <plat/keypad.h>
>>  #include <plat/pm.h>
>>  #include <plat/fb.h>
>> -#include <plat/s5p-time.h>
>> +#include <plat/samsung-time.h>
>>  #include <plat/backlight.h>
>>  #include <plat/mfc.h>
>>  #include <plat/clock.h>
>> @@ -287,7 +287,7 @@ static void __init smdkv210_map_io(void)
>>  	s5pv210_init_io(NULL, 0);
>>  	s3c24xx_init_clocks(clk_xusbxti.rate);
>>  	s3c24xx_init_uarts(smdkv210_uartcfgs, ARRAY_SIZE(smdkv210_uartcfgs));
>> -	s5p_set_timer_source(S5P_PWM2, S5P_PWM4);
>> +	samsung_set_timer_source(SAMSUNG_PWM2, SAMSUNG_PWM4);
>>  }
>>
>>  static void __init smdkv210_reserve(void)
>> @@ -332,7 +332,7 @@ MACHINE_START(SMDKV210, "SMDKV210")
>>  	.handle_irq	= vic_handle_irq,
>>  	.map_io		= smdkv210_map_io,
>>  	.init_machine	= smdkv210_machine_init,
>> -	.timer		= &s5p_timer,
>> +	.timer		= &samsung_timer,
>>  	.restart	= s5pv210_restart,
>>  	.reserve	= &smdkv210_reserve,
>>  MACHINE_END
>> diff --git a/arch/arm/mach-s5pv210/mach-torbreck.c
>> b/arch/arm/mach-s5pv210/mach-torbreck.c index 18785cb..aec668c 100644
>> --- a/arch/arm/mach-s5pv210/mach-torbreck.c
>> +++ b/arch/arm/mach-s5pv210/mach-torbreck.c
>> @@ -27,7 +27,7 @@
>>  #include <plat/devs.h>
>>  #include <plat/cpu.h>
>>  #include <linux/platform_data/i2c-s3c2410.h>
>> -#include <plat/s5p-time.h>
>> +#include <plat/samsung-time.h>
>>
>>  #include "common.h"
>>
>> @@ -107,7 +107,7 @@ static void __init torbreck_map_io(void)
>>  	s5pv210_init_io(NULL, 0);
>>  	s3c24xx_init_clocks(24000000);
>>  	s3c24xx_init_uarts(torbreck_uartcfgs, ARRAY_SIZE(torbreck_uartcfgs));
>> -	s5p_set_timer_source(S5P_PWM3, S5P_PWM4);
>> +	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
>>  }
>>
>>  static void __init torbreck_machine_init(void)
>> @@ -132,6 +132,6 @@ MACHINE_START(TORBRECK, "TORBRECK")
>>  	.handle_irq	= vic_handle_irq,
>>  	.map_io		= torbreck_map_io,
>>  	.init_machine	= torbreck_machine_init,
>> -	.timer		= &s5p_timer,
>> +	.timer		= &samsung_timer,
>>  	.restart	= s5pv210_restart,
>>  MACHINE_END
>> diff --git a/arch/arm/plat-samsung/Kconfig b/arch/arm/plat-samsung/Kconfig
>> index 59401e1..5278795 100644
>> --- a/arch/arm/plat-samsung/Kconfig
>> +++ b/arch/arm/plat-samsung/Kconfig
>> @@ -70,7 +70,7 @@ config S3C_LOWLEVEL_UART_PORT
>>
>>  # timer options
>>
>> -config S5P_HRT
>> +config SAMSUNG_HRT
>>  	bool
>>  	select SAMSUNG_DEV_PWM
>>  	help
>> diff --git a/arch/arm/plat-samsung/Makefile
>> b/arch/arm/plat-samsung/Makefile index 9e40e8d..06f2312 100644
>> --- a/arch/arm/plat-samsung/Makefile
>> +++ b/arch/arm/plat-samsung/Makefile
>> @@ -13,7 +13,7 @@ obj-				:=
>>
>>  obj-y				+= init.o cpu.o
>>  obj-$(CONFIG_ARCH_USES_GETTIMEOFFSET)   += time.o
>> -obj-$(CONFIG_S5P_HRT) 		+= s5p-time.o
>> +obj-$(CONFIG_SAMSUNG_HRT) 		+= samsung-time.o
>>
>>  obj-$(CONFIG_SAMSUNG_CLOCK)	+= clock.o
>>  obj-$(CONFIG_SAMSUNG_CLOCK)	+= pwm-clock.o
>> diff --git a/arch/arm/plat-samsung/include/plat/s5p-time.h
>> b/arch/arm/plat-samsung/include/plat/s5p-time.h deleted file mode 100644
>> index 3a70aeb..0000000
>> --- a/arch/arm/plat-samsung/include/plat/s5p-time.h
>> +++ /dev/null
>> @@ -1,40 +0,0 @@
>> -/* linux/arch/arm/plat-samsung/include/plat/s5p-time.h
>> - *
>> - * Copyright 2011 Samsung Electronics Co., Ltd.
>> - *		http://www.samsung.com/
>> - *
>> - * Header file for s5p time support
>> - *
>> - * This program is free software; you can redistribute it and/or modify
>> - * it under the terms of the GNU General Public License version 2 as
>> - * published by the Free Software Foundation.
>> -*/
>> -
>> -#ifndef __ASM_PLAT_S5P_TIME_H
>> -#define __ASM_PLAT_S5P_TIME_H __FILE__
>> -
>> -/* S5P HR-Timer Clock mode */
>> -enum s5p_timer_mode {
>> -	S5P_PWM0,
>> -	S5P_PWM1,
>> -	S5P_PWM2,
>> -	S5P_PWM3,
>> -	S5P_PWM4,
>> -};
>> -
>> -struct s5p_timer_source {
>> -	unsigned int event_id;
>> -	unsigned int source_id;
>> -};
>> -
>> -/* Be able to sleep for atleast 4 seconds (usually more) */
>> -#define S5PTIMER_MIN_RANGE	4
>> -
>> -#define TCNT_MAX		0xffffffff
>> -#define NON_PERIODIC		0
>> -#define PERIODIC		1
>> -
>> -extern void __init s5p_set_timer_source(enum s5p_timer_mode event,
>> -					enum s5p_timer_mode source);
>> -extern	struct sys_timer s5p_timer;
>> -#endif /* __ASM_PLAT_S5P_TIME_H */
>> diff --git a/arch/arm/plat-samsung/include/plat/samsung-time.h
>> b/arch/arm/plat-samsung/include/plat/samsung-time.h new file mode 100644
>> index 0000000..9d6d622
>> --- /dev/null
>> +++ b/arch/arm/plat-samsung/include/plat/samsung-time.h
>> @@ -0,0 +1,40 @@
>> +/* linux/arch/arm/plat-samsung/include/plat/samsung-time.h
>> + *
>> + * Copyright 2011 Samsung Electronics Co., Ltd.
>> + *		http://www.samsung.com/
>> + *
>> + * Header file for samsung s3c and s5p time support
>> + *
>> + * This program is free software; you can redistribute it and/or modify
>> + * it under the terms of the GNU General Public License version 2 as
>> + * published by the Free Software Foundation.
>> +*/
>> +
>> +#ifndef __ASM_PLAT_SAMSUNG_TIME_H
>> +#define __ASM_PLAT_SAMSUNG_TIME_H __FILE__
>> +
>> +/* SAMSUNG HR-Timer Clock mode */
>> +enum samsung_timer_mode {
>> +	SAMSUNG_PWM0,
>> +	SAMSUNG_PWM1,
>> +	SAMSUNG_PWM2,
>> +	SAMSUNG_PWM3,
>> +	SAMSUNG_PWM4,
>> +};
>> +
>> +struct samsung_timer_source {
>> +	unsigned int event_id;
>> +	unsigned int source_id;
>> +};
>> +
>> +/* Be able to sleep for atleast 4 seconds (usually more) */
>> +#define SAMSUNG_TIMER_MIN_RANGE	4
>> +
>> +#define TCNT_MAX		0xffffffff
>> +#define NON_PERIODIC		0
>> +#define PERIODIC		1
>> +
>> +extern void __init samsung_set_timer_source(enum samsung_timer_mode event,
>> +					enum samsung_timer_mode source);
>> +extern	struct sys_timer samsung_timer;
>> +#endif /* __ASM_PLAT_SAMSUNG_TIME_H */
>> diff --git a/arch/arm/plat-samsung/s5p-time.c
>> b/arch/arm/plat-samsung/samsung-time.c similarity index 70%
>> rename from arch/arm/plat-samsung/s5p-time.c
>> rename to arch/arm/plat-samsung/samsung-time.c
>> index 028b6e8..91773bf 100644
>> --- a/arch/arm/plat-samsung/s5p-time.c
>> +++ b/arch/arm/plat-samsung/samsung-time.c
>> @@ -2,7 +2,7 @@
>>   * Copyright (c) 2011 Samsung Electronics Co., Ltd.
>>   *		http://www.samsung.com/
>>   *
>> - * S5P - Common hr-timer support
>> + * SAMSUNG - Common hr-timer support
>>   *
>>   * This program is free software; you can redistribute it and/or modify
>>   * it under the terms of the GNU General Public License version 2 as
>> @@ -25,41 +25,41 @@
>>  #include <mach/map.h>
>>  #include <plat/devs.h>
>>  #include <plat/regs-timer.h>
>> -#include <plat/s5p-time.h>
>> +#include <plat/samsung-time.h>
>>
>>  static struct clk *tin_event;
>>  static struct clk *tin_source;
>>  static struct clk *tdiv_event;
>>  static struct clk *tdiv_source;
>>  static struct clk *timerclk;
>> -static struct s5p_timer_source timer_source;
>> +static struct samsung_timer_source timer_source;
>>  static unsigned long clock_count_per_tick;
>> -static void s5p_timer_resume(void);
>> +static void samsung_timer_resume(void);
>>
>> -static void s5p_time_stop(enum s5p_timer_mode mode)
>> +static void samsung_time_stop(enum samsung_timer_mode mode)
>>  {
>>  	unsigned long tcon;
>>
>>  	tcon = __raw_readl(S3C2410_TCON);
>>
>>  	switch (mode) {
>> -	case S5P_PWM0:
>> +	case SAMSUNG_PWM0:
>>  		tcon &= ~S3C2410_TCON_T0START;
>>  		break;
>>
>> -	case S5P_PWM1:
>> +	case SAMSUNG_PWM1:
>>  		tcon &= ~S3C2410_TCON_T1START;
>>  		break;
>>
>> -	case S5P_PWM2:
>> +	case SAMSUNG_PWM2:
>>  		tcon &= ~S3C2410_TCON_T2START;
>>  		break;
>>
>> -	case S5P_PWM3:
>> +	case SAMSUNG_PWM3:
>>  		tcon &= ~S3C2410_TCON_T3START;
>>  		break;
>>
>> -	case S5P_PWM4:
>> +	case SAMSUNG_PWM4:
>>  		tcon &= ~S3C2410_TCON_T4START;
>>  		break;
>>
>> @@ -70,7 +70,7 @@ static void s5p_time_stop(enum s5p_timer_mode mode)
>>  	__raw_writel(tcon, S3C2410_TCON);
>>  }
>>
>> -static void s5p_time_setup(enum s5p_timer_mode mode, unsigned long tcnt)
>> +static void samsung_time_setup(enum samsung_timer_mode mode, unsigned long
>> tcnt) {
>>  	unsigned long tcon;
>>
>> @@ -79,27 +79,27 @@ static void s5p_time_setup(enum s5p_timer_mode mode,
>> unsigned long tcnt) tcnt--;
>>
>>  	switch (mode) {
>> -	case S5P_PWM0:
>> +	case SAMSUNG_PWM0:
>>  		tcon &= ~(0x0f << 0);
>>  		tcon |= S3C2410_TCON_T0MANUALUPD;
>>  		break;
>>
>> -	case S5P_PWM1:
>> +	case SAMSUNG_PWM1:
>>  		tcon &= ~(0x0f << 8);
>>  		tcon |= S3C2410_TCON_T1MANUALUPD;
>>  		break;
>>
>> -	case S5P_PWM2:
>> +	case SAMSUNG_PWM2:
>>  		tcon &= ~(0x0f << 12);
>>  		tcon |= S3C2410_TCON_T2MANUALUPD;
>>  		break;
>>
>> -	case S5P_PWM3:
>> +	case SAMSUNG_PWM3:
>>  		tcon &= ~(0x0f << 16);
>>  		tcon |= S3C2410_TCON_T3MANUALUPD;
>>  		break;
>>
>> -	case S5P_PWM4:
>> +	case SAMSUNG_PWM4:
>>  		tcon &= ~(0x07 << 20);
>>  		tcon |= S3C2410_TCON_T4MANUALUPD;
>>  		break;
>> @@ -114,14 +114,14 @@ static void s5p_time_setup(enum s5p_timer_mode mode,
>> unsigned long tcnt) __raw_writel(tcon, S3C2410_TCON);
>>  }
>>
>> -static void s5p_time_start(enum s5p_timer_mode mode, bool periodic)
>> +static void samsung_time_start(enum samsung_timer_mode mode, bool
>> periodic) {
>>  	unsigned long tcon;
>>
>>  	tcon  = __raw_readl(S3C2410_TCON);
>>
>>  	switch (mode) {
>> -	case S5P_PWM0:
>> +	case SAMSUNG_PWM0:
>>  		tcon |= S3C2410_TCON_T0START;
>>  		tcon &= ~S3C2410_TCON_T0MANUALUPD;
>>
>> @@ -131,7 +131,7 @@ static void s5p_time_start(enum s5p_timer_mode mode,
>> bool periodic) tcon &= ~S3C2410_TCON_T0RELOAD;
>>  		break;
>>
>> -	case S5P_PWM1:
>> +	case SAMSUNG_PWM1:
>>  		tcon |= S3C2410_TCON_T1START;
>>  		tcon &= ~S3C2410_TCON_T1MANUALUPD;
>>
>> @@ -141,7 +141,7 @@ static void s5p_time_start(enum s5p_timer_mode mode,
>> bool periodic) tcon &= ~S3C2410_TCON_T1RELOAD;
>>  		break;
>>
>> -	case S5P_PWM2:
>> +	case SAMSUNG_PWM2:
>>  		tcon |= S3C2410_TCON_T2START;
>>  		tcon &= ~S3C2410_TCON_T2MANUALUPD;
>>
>> @@ -151,7 +151,7 @@ static void s5p_time_start(enum s5p_timer_mode mode,
>> bool periodic) tcon &= ~S3C2410_TCON_T2RELOAD;
>>  		break;
>>
>> -	case S5P_PWM3:
>> +	case SAMSUNG_PWM3:
>>  		tcon |= S3C2410_TCON_T3START;
>>  		tcon &= ~S3C2410_TCON_T3MANUALUPD;
>>
>> @@ -161,7 +161,7 @@ static void s5p_time_start(enum s5p_timer_mode mode,
>> bool periodic) tcon &= ~S3C2410_TCON_T3RELOAD;
>>  		break;
>>
>> -	case S5P_PWM4:
>> +	case SAMSUNG_PWM4:
>>  		tcon |= S3C2410_TCON_T4START;
>>  		tcon &= ~S3C2410_TCON_T4MANUALUPD;
>>
>> @@ -178,24 +178,24 @@ static void s5p_time_start(enum s5p_timer_mode mode,
>> bool periodic) __raw_writel(tcon, S3C2410_TCON);
>>  }
>>
>> -static int s5p_set_next_event(unsigned long cycles,
>> +static int samsung_set_next_event(unsigned long cycles,
>>  				struct clock_event_device *evt)
>>  {
>> -	s5p_time_setup(timer_source.event_id, cycles);
>> -	s5p_time_start(timer_source.event_id, NON_PERIODIC);
>> +	samsung_time_setup(timer_source.event_id, cycles);
>> +	samsung_time_start(timer_source.event_id, NON_PERIODIC);
>>
>>  	return 0;
>>  }
>>
>> -static void s5p_set_mode(enum clock_event_mode mode,
>> +static void samsung_set_mode(enum clock_event_mode mode,
>>  				struct clock_event_device *evt)
>>  {
>> -	s5p_time_stop(timer_source.event_id);
>> +	samsung_time_stop(timer_source.event_id);
>>
>>  	switch (mode) {
>>  	case CLOCK_EVT_MODE_PERIODIC:
>> -		s5p_time_setup(timer_source.event_id, clock_count_per_tick);
>> -		s5p_time_start(timer_source.event_id, PERIODIC);
>> +		samsung_time_setup(timer_source.event_id, clock_count_per_tick);
>> +		samsung_time_start(timer_source.event_id, PERIODIC);
>>  		break;
>>
>>  	case CLOCK_EVT_MODE_ONESHOT:
>> @@ -206,24 +206,24 @@ static void s5p_set_mode(enum clock_event_mode mode,
>>  		break;
>>
>>  	case CLOCK_EVT_MODE_RESUME:
>> -		s5p_timer_resume();
>> +		samsung_timer_resume();
>>  		break;
>>  	}
>>  }
>>
>> -static void s5p_timer_resume(void)
>> +static void samsung_timer_resume(void)
>>  {
>>  	/* event timer restart */
>> -	s5p_time_setup(timer_source.event_id, clock_count_per_tick);
>> -	s5p_time_start(timer_source.event_id, PERIODIC);
>> +	samsung_time_setup(timer_source.event_id, clock_count_per_tick);
>> +	samsung_time_start(timer_source.event_id, PERIODIC);
>>
>>  	/* source timer restart */
>> -	s5p_time_setup(timer_source.source_id, TCNT_MAX);
>> -	s5p_time_start(timer_source.source_id, PERIODIC);
>> +	samsung_time_setup(timer_source.source_id, TCNT_MAX);
>> +	samsung_time_start(timer_source.source_id, PERIODIC);
>>  }
>>
>> -void __init s5p_set_timer_source(enum s5p_timer_mode event,
>> -				 enum s5p_timer_mode source)
>> +void __init samsung_set_timer_source(enum samsung_timer_mode event,
>> +				 enum samsung_timer_mode source)
>>  {
>>  	s3c_device_timer[event].dev.bus = &platform_bus_type;
>>  	s3c_device_timer[source].dev.bus = &platform_bus_type;
>> @@ -233,14 +233,14 @@ void __init s5p_set_timer_source(enum s5p_timer_mode
>> event, }
>>
>>  static struct clock_event_device time_event_device = {
>> -	.name		= "s5p_event_timer",
>> +	.name		= "samsung_event_timer",
>>  	.features	= CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT,
>>  	.rating		= 200,
>> -	.set_next_event	= s5p_set_next_event,
>> -	.set_mode	= s5p_set_mode,
>> +	.set_next_event	= samsung_set_next_event,
>> +	.set_mode	= samsung_set_mode,
>>  };
>>
>> -static irqreturn_t s5p_clock_event_isr(int irq, void *dev_id)
>> +static irqreturn_t samsung_clock_event_isr(int irq, void *dev_id)
>>  {
>>  	struct clock_event_device *evt = dev_id;
>>
>> @@ -249,14 +249,14 @@ static irqreturn_t s5p_clock_event_isr(int irq, void
>> *dev_id) return IRQ_HANDLED;
>>  }
>>
>> -static struct irqaction s5p_clock_event_irq = {
>> -	.name		= "s5p_time_irq",
>> +static struct irqaction samsung_clock_event_irq = {
>> +	.name		= "samsung_time_irq",
>>  	.flags		= IRQF_DISABLED | IRQF_TIMER | IRQF_IRQPOLL,
>> -	.handler	= s5p_clock_event_isr,
>> +	.handler	= samsung_clock_event_isr,
>>  	.dev_id		= &time_event_device,
>>  };
>>
>> -static void __init s5p_clockevent_init(void)
>> +static void __init samsung_clockevent_init(void)
>>  {
>>  	unsigned long pclk;
>>  	unsigned long clock_rate;
>> @@ -275,7 +275,7 @@ static void __init s5p_clockevent_init(void)
>>  	clock_count_per_tick = clock_rate / HZ;
>>
>>  	clockevents_calc_mult_shift(&time_event_device,
>> -				    clock_rate, S5PTIMER_MIN_RANGE);
>> +				    clock_rate, SAMSUNG_TIMER_MIN_RANGE);
>>  	time_event_device.max_delta_ns =
>>  		clockevent_delta2ns(-1, &time_event_device);
>>  	time_event_device.min_delta_ns =
>> @@ -285,22 +285,22 @@ static void __init s5p_clockevent_init(void)
>>  	clockevents_register_device(&time_event_device);
>>
>>  	irq_number = timer_source.event_id + IRQ_TIMER0;
>> -	setup_irq(irq_number, &s5p_clock_event_irq);
>> +	setup_irq(irq_number, &samsung_clock_event_irq);
>>  }
>>
>> -static void __iomem *s5p_timer_reg(void)
>> +static void __iomem *samsung_timer_reg(void)
>>  {
>>  	unsigned long offset = 0;
>>
>>  	switch (timer_source.source_id) {
>> -	case S5P_PWM0:
>> -	case S5P_PWM1:
>> -	case S5P_PWM2:
>> -	case S5P_PWM3:
>> +	case SAMSUNG_PWM0:
>> +	case SAMSUNG_PWM1:
>> +	case SAMSUNG_PWM2:
>> +	case SAMSUNG_PWM3:
>>  		offset = (timer_source.source_id * 0x0c) + 0x14;
>>  		break;
>>
>> -	case S5P_PWM4:
>> +	case SAMSUNG_PWM4:
>>  		offset = 0x40;
>>  		break;
>>
>> @@ -319,9 +319,9 @@ static void __iomem *s5p_timer_reg(void)
>>   * this wraps around for now, since it is just a relative time
>>   * stamp. (Inspired by U300 implementation.)
>>   */
>> -static u32 notrace s5p_read_sched_clock(void)
>> +static u32 notrace samsung_read_sched_clock(void)
>>  {
>> -	void __iomem *reg = s5p_timer_reg();
>> +	void __iomem *reg = samsung_timer_reg();
>>
>>  	if (!reg)
>>  		return 0;
>> @@ -329,7 +329,7 @@ static u32 notrace s5p_read_sched_clock(void)
>>  	return ~__raw_readl(reg);
>>  }
>>
>> -static void __init s5p_clocksource_init(void)
>> +static void __init samsung_clocksource_init(void)
>>  {
>>  	unsigned long pclk;
>>  	unsigned long clock_rate;
>> @@ -341,17 +341,17 @@ static void __init s5p_clocksource_init(void)
>>
>>  	clock_rate = clk_get_rate(tin_source);
>>
>> -	s5p_time_setup(timer_source.source_id, TCNT_MAX);
>> -	s5p_time_start(timer_source.source_id, PERIODIC);
>> +	samsung_time_setup(timer_source.source_id, TCNT_MAX);
>> +	samsung_time_start(timer_source.source_id, PERIODIC);
>>
>> -	setup_sched_clock(s5p_read_sched_clock, 32, clock_rate);
>> +	setup_sched_clock(samsung_read_sched_clock, 32, clock_rate);
>>
>> -	if (clocksource_mmio_init(s5p_timer_reg(), "s5p_clocksource_timer",
>> +	if (clocksource_mmio_init(samsung_timer_reg(),
>> "samsung_clocksource_timer", clock_rate, 250, 32,
>> clocksource_mmio_readl_down))
>> -		panic("s5p_clocksource_timer: can't register clocksource\n");
>> +		panic("samsung_clocksource_timer: can't register clocksource\n");
>>  }
>>
>> -static void __init s5p_timer_resources(void)
>> +static void __init samsung_timer_resources(void)
>>  {
>>
>>  	unsigned long event_id = timer_source.event_id;
>> @@ -393,13 +393,13 @@ static void __init s5p_timer_resources(void)
>>  	clk_enable(tin_source);
>>  }
>>
>> -static void __init s5p_timer_init(void)
>> +static void __init samsung_timer_init(void)
>>  {
>> -	s5p_timer_resources();
>> -	s5p_clockevent_init();
>> -	s5p_clocksource_init();
>> +	samsung_timer_resources();
>> +	samsung_clockevent_init();
>> +	samsung_clocksource_init();
>>  }
>>
>> -struct sys_timer s5p_timer = {
>> -	.init		= s5p_timer_init,
>> +struct sys_timer samsung_timer = {
>> +	.init		= samsung_timer_init,
>>  };
> 

^ permalink raw reply	[flat|nested] 39+ messages in thread

* Re: [PATCH 1/5 v2] Rename s5p-time to samsung-time
  2012-12-15 21:43                 ` Romain Naour
@ 2013-01-08 21:00                   ` Tomasz Figa
  2013-01-09 19:26                     ` Kukjin Kim
                                       ` (6 more replies)
  0 siblings, 7 replies; 39+ messages in thread
From: Tomasz Figa @ 2013-01-08 21:00 UTC (permalink / raw)
  To: Romain Naour
  Cc: Heiko Stübner, Kukjin Kim, linux-samsung-soc, ben-linux,
	'Sylwester Nawrocki'

Hi Romain,

On Saturday 15 of December 2012 22:43:03 Romain Naour wrote:
> Le 10/12/2012 13:59, Heiko Stübner a écrit :
> > Am Sonntag, 2. Dezember 2012, 20:44:01 schrieb Romain Naour:
> >> This patch rename s5p-time to samsung-time.
> >> There is no functional change.
> >> 
> >> 
> >> Signed-off-by: Naour Romain <romain.naour@openwide.fr>
> > 
> > The patch does not apply to current linux-next, because it has some
> > problem with the exynos-universal board. I've fixed this to test the
> > patch, so
> > 
> > Acked-by: Heiko Stuebner <heiko@sntech.de>
> 
> What's wrong with this part of the patch ?
> I applied this patch today on linux-next tree, branch next-20121214.
> (with some hunk but no error)

Patches that are supposed to go through Samsung (Kgene's) tree, should be 
based on for-next branch of Samsung tree.

Do you have plans to rebase and resubmit this series again? I plan to 
submit some patches for S3C64xx (partly based on my historical work on 
this platform) and would be nice to have hrtime support already there, 
especially when all left is to just merge it.

Best regards,
Tomasz Figa

^ permalink raw reply	[flat|nested] 39+ messages in thread

* Re: [PATCH 1/5 v2] Rename s5p-time to samsung-time
  2013-01-08 21:00                   ` Tomasz Figa
@ 2013-01-09 19:26                     ` Kukjin Kim
  2013-01-09 22:43                       ` Romain Naour
  2013-01-09 22:43                     ` [PATCH 0/5 v3] S3C / S5PC100: add clockevent/clocksource support Romain Naour
                                       ` (5 subsequent siblings)
  6 siblings, 1 reply; 39+ messages in thread
From: Kukjin Kim @ 2013-01-09 19:26 UTC (permalink / raw)
  To: Tomasz Figa
  Cc: Romain Naour, Heiko Stübner, Kukjin Kim, linux-samsung-soc,
	ben-linux, 'Sylwester Nawrocki'

On 01/08/13 13:00, Tomasz Figa wrote:
> Hi Romain,

[...]

>> What's wrong with this part of the patch ?
>> I applied this patch today on linux-next tree, branch next-20121214.
>> (with some hunk but no error)
>
> Patches that are supposed to go through Samsung (Kgene's) tree, should be
> based on for-next branch of Samsung tree.
>
> Do you have plans to rebase and resubmit this series again? I plan to
> submit some patches for S3C64xx (partly based on my historical work on
> this platform) and would be nice to have hrtime support already there,
> especially when all left is to just merge it.
>
Tomasz, thanks.

As I said, this looks good to me, but, please re-submit this series 
against on latest my for-next so that I can pick up in Samsung tree. I 
couldn't apply due to too many conflicts :-(

One more note, please add config option and inclusion by alphabetical 
order rather than just replacing them.

Thanks.

- Kukjin

^ permalink raw reply	[flat|nested] 39+ messages in thread

* Re: [PATCH 1/5 v2] Rename s5p-time to samsung-time
  2013-01-09 19:26                     ` Kukjin Kim
@ 2013-01-09 22:43                       ` Romain Naour
  0 siblings, 0 replies; 39+ messages in thread
From: Romain Naour @ 2013-01-09 22:43 UTC (permalink / raw)
  To: Kukjin Kim
  Cc: Tomasz Figa, Heiko Stübner, linux-samsung-soc, ben-linux,
	'Sylwester Nawrocki'

Le 09/01/2013 20:26, Kukjin Kim a écrit :
> On 01/08/13 13:00, Tomasz Figa wrote:
>> Hi Romain,
> 
> [...]
> 
>>> What's wrong with this part of the patch ?
>>> I applied this patch today on linux-next tree, branch next-20121214.
>>> (with some hunk but no error)
>>
>> Patches that are supposed to go through Samsung (Kgene's) tree, should be
>> based on for-next branch of Samsung tree.
>>
>> Do you have plans to rebase and resubmit this series again? I plan to
>> submit some patches for S3C64xx (partly based on my historical work on
>> this platform) and would be nice to have hrtime support already there,
>> especially when all left is to just merge it.
>>
> Tomasz, thanks.
> 
> As I said, this looks good to me, but, please re-submit this series
> against on latest my for-next so that I can pick up in Samsung tree. I
> couldn't apply due to too many conflicts :-(
> 
> One more note, please add config option and inclusion by alphabetical
> order rather than just replacing them.
> 
> Thanks.
> 
> - Kukjin

Hi Kukjin and Tomasz,

I reapplied this series of patches onto for-next branch.
So, here are these patches in the following mails :)

Thank you for your help.
Romain

^ permalink raw reply	[flat|nested] 39+ messages in thread

* [PATCH 0/5 v3]  S3C / S5PC100: add clockevent/clocksource support
  2013-01-08 21:00                   ` Tomasz Figa
  2013-01-09 19:26                     ` Kukjin Kim
@ 2013-01-09 22:43                     ` Romain Naour
  2013-01-10  0:14                       ` Tomasz Figa
  2013-01-10  0:37                       ` Heiko Stübner
  2013-01-09 22:43                     ` [PATCH 1/5 v3] Rename s5p-time to samsung-time Romain Naour
                                       ` (4 subsequent siblings)
  6 siblings, 2 replies; 39+ messages in thread
From: Romain Naour @ 2013-01-09 22:43 UTC (permalink / raw)
  To: Tomasz Figa
  Cc: Heiko Stübner, Kukjin Kim, linux-samsung-soc, ben-linux,
	'Sylwester Nawrocki'

This series of patches converts the s3c and s5pc100 timer driver to the clocksource/clockevent API.
I made some test on a mini2440 board and I had to reduce timers frequency to 1MHz in order to produce a timer's overflow every 64ms.
Initial timer's frequency (8,45MHz) provide only 7ms between each overflow. It is not enough.
As timers were previously used to produce an IRQ at 200Hz, some board (Osiris, Anubis board) use an external 12MHz signal to clock the timers (tclk1).
So, I changed their configuration to select internal pclk clock instead, but I can't test it.

Since clockevent/clocksource API becomes available, we can use High Resolution Timer and Tickless mode.

Most of the work is already done in s5p-time.c (renamed samsung-time.c).
I added some #define for s3c24xx and s5pc100 case.


Naour Romain (5):
  Rename s5p-time to samsung-time
  Add samsung-time support for s3c24xx
  Add samsung-time support for s3c64xx
  Add samsung-time support for s5pc100
  Remove unused plat-samsung/time.c

 arch/arm/Kconfig                                   |   9 +-
 arch/arm/mach-exynos/Kconfig                       |   2 +-
 arch/arm/mach-exynos/mach-universal_c210.c         |   6 +-
 arch/arm/mach-s3c24xx/Kconfig                      |   6 +
 arch/arm/mach-s3c24xx/mach-amlm5900.c              |   5 +-
 arch/arm/mach-s3c24xx/mach-anubis.c                |   4 +-
 arch/arm/mach-s3c24xx/mach-at2440evb.c             |   4 +-
 arch/arm/mach-s3c24xx/mach-bast.c                  |   4 +-
 arch/arm/mach-s3c24xx/mach-gta02.c                 |   4 +-
 arch/arm/mach-s3c24xx/mach-h1940.c                 |   5 +-
 arch/arm/mach-s3c24xx/mach-jive.c                  |   4 +-
 arch/arm/mach-s3c24xx/mach-mini2440.c              |   4 +-
 arch/arm/mach-s3c24xx/mach-n30.c                   |   6 +-
 arch/arm/mach-s3c24xx/mach-nexcoder.c              |   4 +-
 arch/arm/mach-s3c24xx/mach-osiris.c                |   4 +-
 arch/arm/mach-s3c24xx/mach-otom.c                  |   4 +-
 arch/arm/mach-s3c24xx/mach-qt2410.c                |   4 +-
 arch/arm/mach-s3c24xx/mach-rx1950.c                |   4 +-
 arch/arm/mach-s3c24xx/mach-rx3715.c                |   4 +-
 arch/arm/mach-s3c24xx/mach-smdk2410.c              |   4 +-
 arch/arm/mach-s3c24xx/mach-smdk2413.c              |   8 +-
 arch/arm/mach-s3c24xx/mach-smdk2416.c              |   4 +-
 arch/arm/mach-s3c24xx/mach-smdk2440.c              |   4 +-
 arch/arm/mach-s3c24xx/mach-smdk2443.c              |   4 +-
 arch/arm/mach-s3c24xx/mach-tct_hammer.c            |   4 +-
 arch/arm/mach-s3c24xx/mach-vr1000.c                |   4 +-
 arch/arm/mach-s3c24xx/mach-vstms.c                 |   5 +-
 arch/arm/mach-s3c64xx/Kconfig                      |   2 +
 arch/arm/mach-s3c64xx/mach-anw6410.c               |   4 +-
 arch/arm/mach-s3c64xx/mach-crag6410.c              |   4 +-
 arch/arm/mach-s3c64xx/mach-hmt.c                   |   4 +-
 arch/arm/mach-s3c64xx/mach-mini6410.c              |   4 +-
 arch/arm/mach-s3c64xx/mach-ncp.c                   |   4 +-
 arch/arm/mach-s3c64xx/mach-real6410.c              |   4 +-
 arch/arm/mach-s3c64xx/mach-smartq.c                |   2 +
 arch/arm/mach-s3c64xx/mach-smartq5.c               |   3 +-
 arch/arm/mach-s3c64xx/mach-smartq7.c               |   3 +-
 arch/arm/mach-s3c64xx/mach-smdk6400.c              |   4 +-
 arch/arm/mach-s3c64xx/mach-smdk6410.c              |   4 +-
 arch/arm/mach-s5p64x0/Kconfig                      |   4 +-
 arch/arm/mach-s5p64x0/mach-smdk6440.c              |   6 +-
 arch/arm/mach-s5p64x0/mach-smdk6450.c              |   6 +-
 arch/arm/mach-s5pc100/Kconfig                      |   1 +
 arch/arm/mach-s5pc100/mach-smdkc100.c              |   4 +-
 arch/arm/mach-s5pv210/Kconfig                      |   2 +-
 arch/arm/mach-s5pv210/mach-aquila.c                |   6 +-
 arch/arm/mach-s5pv210/mach-goni.c                  |   6 +-
 arch/arm/mach-s5pv210/mach-smdkc110.c              |   6 +-
 arch/arm/mach-s5pv210/mach-smdkv210.c              |   6 +-
 arch/arm/mach-s5pv210/mach-torbreck.c              |   6 +-
 arch/arm/plat-samsung/Kconfig                      |   2 +-
 arch/arm/plat-samsung/Makefile                     |   3 +-
 arch/arm/plat-samsung/include/plat/cpu.h           |   5 -
 arch/arm/plat-samsung/include/plat/s5p-time.h      |  40 ---
 arch/arm/plat-samsung/include/plat/samsung-time.h  |  51 ++++
 .../plat-samsung/{s5p-time.c => samsung-time.c}    | 144 +++++------
 arch/arm/plat-samsung/time.c                       | 285 ---------------------
 57 files changed, 274 insertions(+), 475 deletions(-)
 delete mode 100644 arch/arm/plat-samsung/include/plat/s5p-time.h
 create mode 100644 arch/arm/plat-samsung/include/plat/samsung-time.h
 rename arch/arm/plat-samsung/{s5p-time.c => samsung-time.c} (68%)
 delete mode 100644 arch/arm/plat-samsung/time.c

-- 
1.8.0.3

^ permalink raw reply	[flat|nested] 39+ messages in thread

* [PATCH 1/5 v3] Rename s5p-time to samsung-time
  2013-01-08 21:00                   ` Tomasz Figa
  2013-01-09 19:26                     ` Kukjin Kim
  2013-01-09 22:43                     ` [PATCH 0/5 v3] S3C / S5PC100: add clockevent/clocksource support Romain Naour
@ 2013-01-09 22:43                     ` Romain Naour
  2013-01-09 22:43                     ` [PATCH 2/5 v3] Add samsung-time support for s3c24xx Romain Naour
                                       ` (3 subsequent siblings)
  6 siblings, 0 replies; 39+ messages in thread
From: Romain Naour @ 2013-01-09 22:43 UTC (permalink / raw)
  To: Tomasz Figa
  Cc: Heiko Stübner, Kukjin Kim, linux-samsung-soc, ben-linux,
	'Sylwester Nawrocki'



Signed-off-by: Naour Romain <romain.naour@openwide.fr>
---
 arch/arm/mach-exynos/Kconfig                       |   2 +-
 arch/arm/mach-exynos/mach-universal_c210.c         |   6 +-
 arch/arm/mach-s5p64x0/Kconfig                      |   4 +-
 arch/arm/mach-s5p64x0/mach-smdk6440.c              |   6 +-
 arch/arm/mach-s5p64x0/mach-smdk6450.c              |   6 +-
 arch/arm/mach-s5pv210/Kconfig                      |   2 +-
 arch/arm/mach-s5pv210/mach-aquila.c                |   6 +-
 arch/arm/mach-s5pv210/mach-goni.c                  |   6 +-
 arch/arm/mach-s5pv210/mach-smdkc110.c              |   6 +-
 arch/arm/mach-s5pv210/mach-smdkv210.c              |   6 +-
 arch/arm/mach-s5pv210/mach-torbreck.c              |   6 +-
 arch/arm/plat-samsung/Kconfig                      |   2 +-
 arch/arm/plat-samsung/Makefile                     |   2 +-
 arch/arm/plat-samsung/include/plat/s5p-time.h      |  40 ------
 arch/arm/plat-samsung/include/plat/samsung-time.h  |  40 ++++++
 .../plat-samsung/{s5p-time.c => samsung-time.c}    | 136 ++++++++++-----------
 16 files changed, 138 insertions(+), 138 deletions(-)
 delete mode 100644 arch/arm/plat-samsung/include/plat/s5p-time.h
 create mode 100644 arch/arm/plat-samsung/include/plat/samsung-time.h
 rename arch/arm/plat-samsung/{s5p-time.c => samsung-time.c} (70%)

diff --git a/arch/arm/mach-exynos/Kconfig b/arch/arm/mach-exynos/Kconfig
index e103c29..d26c9f9 100644
--- a/arch/arm/mach-exynos/Kconfig
+++ b/arch/arm/mach-exynos/Kconfig
@@ -281,8 +281,8 @@ config MACH_UNIVERSAL_C210
 	select S5P_DEV_ONENAND
 	select S5P_DEV_TV
 	select S5P_GPIO_INT
-	select S5P_HRT
 	select S5P_SETUP_MIPIPHY
+	select SAMSUNG_HRT
 	help
 	  Machine support for Samsung Mobile Universal S5PC210 Reference
 	  Board.
diff --git a/arch/arm/mach-exynos/mach-universal_c210.c b/arch/arm/mach-exynos/mach-universal_c210.c
index 9e3340f..f17fa5e 100644
--- a/arch/arm/mach-exynos/mach-universal_c210.c
+++ b/arch/arm/mach-exynos/mach-universal_c210.c
@@ -42,7 +42,7 @@
 #include <plat/mfc.h>
 #include <plat/sdhci.h>
 #include <plat/fimc-core.h>
-#include <plat/s5p-time.h>
+#include <plat/samsung-time.h>
 #include <plat/camport.h>
 
 #include <mach/map.h>
@@ -1095,7 +1095,7 @@ static void __init universal_map_io(void)
 	exynos_init_io(NULL, 0);
 	s3c24xx_init_clocks(clk_xusbxti.rate);
 	s3c24xx_init_uarts(universal_uartcfgs, ARRAY_SIZE(universal_uartcfgs));
-	s5p_set_timer_source(S5P_PWM2, S5P_PWM4);
+	samsung_set_timer_source(SAMSUNG_PWM2, SAMSUNG_PWM4);
 }
 
 static void s5p_tv_setup(void)
@@ -1154,7 +1154,7 @@ MACHINE_START(UNIVERSAL_C210, "UNIVERSAL_C210")
 	.handle_irq	= gic_handle_irq,
 	.init_machine	= universal_machine_init,
 	.init_late	= exynos_init_late,
-	.timer		= &s5p_timer,
+	.timer		= &samsung_timer,
 	.reserve        = &universal_reserve,
 	.restart	= exynos4_restart,
 MACHINE_END
diff --git a/arch/arm/mach-s5p64x0/Kconfig b/arch/arm/mach-s5p64x0/Kconfig
index e8742cb..5a707bd 100644
--- a/arch/arm/mach-s5p64x0/Kconfig
+++ b/arch/arm/mach-s5p64x0/Kconfig
@@ -9,16 +9,16 @@ if ARCH_S5P64X0
 
 config CPU_S5P6440
 	bool
-	select S5P_HRT
 	select S5P_SLEEP if PM
 	select SAMSUNG_DMADEV
+	select SAMSUNG_HRT
 	select SAMSUNG_WAKEMASK if PM
 	help
 	  Enable S5P6440 CPU support
 
 config CPU_S5P6450
 	bool
-	select S5P_HRT
+	select SAMSUNG_HRT
 	select S5P_SLEEP if PM
 	select SAMSUNG_DMADEV
 	select SAMSUNG_WAKEMASK if PM
diff --git a/arch/arm/mach-s5p64x0/mach-smdk6440.c b/arch/arm/mach-s5p64x0/mach-smdk6440.c
index 3fb4de3..ba25e7d 100644
--- a/arch/arm/mach-s5p64x0/mach-smdk6440.c
+++ b/arch/arm/mach-s5p64x0/mach-smdk6440.c
@@ -49,7 +49,7 @@
 #include <plat/pll.h>
 #include <plat/adc.h>
 #include <linux/platform_data/touchscreen-s3c2410.h>
-#include <plat/s5p-time.h>
+#include <plat/samsung-time.h>
 #include <plat/backlight.h>
 #include <plat/fb.h>
 #include <plat/sdhci.h>
@@ -230,7 +230,7 @@ static void __init smdk6440_map_io(void)
 	s5p64x0_init_io(NULL, 0);
 	s3c24xx_init_clocks(12000000);
 	s3c24xx_init_uarts(smdk6440_uartcfgs, ARRAY_SIZE(smdk6440_uartcfgs));
-	s5p_set_timer_source(S5P_PWM3, S5P_PWM4);
+	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
 }
 
 static void s5p6440_set_lcd_interface(void)
@@ -275,6 +275,6 @@ MACHINE_START(SMDK6440, "SMDK6440")
 	.handle_irq	= vic_handle_irq,
 	.map_io		= smdk6440_map_io,
 	.init_machine	= smdk6440_machine_init,
-	.timer		= &s5p_timer,
+	.timer		= &samsung_timer,
 	.restart	= s5p64x0_restart,
 MACHINE_END
diff --git a/arch/arm/mach-s5p64x0/mach-smdk6450.c b/arch/arm/mach-s5p64x0/mach-smdk6450.c
index 53a576d..f7db5a8 100644
--- a/arch/arm/mach-s5p64x0/mach-smdk6450.c
+++ b/arch/arm/mach-s5p64x0/mach-smdk6450.c
@@ -49,7 +49,7 @@
 #include <plat/pll.h>
 #include <plat/adc.h>
 #include <linux/platform_data/touchscreen-s3c2410.h>
-#include <plat/s5p-time.h>
+#include <plat/samsung-time.h>
 #include <plat/backlight.h>
 #include <plat/fb.h>
 #include <plat/sdhci.h>
@@ -249,7 +249,7 @@ static void __init smdk6450_map_io(void)
 	s5p64x0_init_io(NULL, 0);
 	s3c24xx_init_clocks(19200000);
 	s3c24xx_init_uarts(smdk6450_uartcfgs, ARRAY_SIZE(smdk6450_uartcfgs));
-	s5p_set_timer_source(S5P_PWM3, S5P_PWM4);
+	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
 }
 
 static void s5p6450_set_lcd_interface(void)
@@ -294,6 +294,6 @@ MACHINE_START(SMDK6450, "SMDK6450")
 	.handle_irq	= vic_handle_irq,
 	.map_io		= smdk6450_map_io,
 	.init_machine	= smdk6450_machine_init,
-	.timer		= &s5p_timer,
+	.timer		= &samsung_timer,
 	.restart	= s5p64x0_restart,
 MACHINE_END
diff --git a/arch/arm/mach-s5pv210/Kconfig b/arch/arm/mach-s5pv210/Kconfig
index 92ad72f..0963283 100644
--- a/arch/arm/mach-s5pv210/Kconfig
+++ b/arch/arm/mach-s5pv210/Kconfig
@@ -12,10 +12,10 @@ if ARCH_S5PV210
 config CPU_S5PV210
 	bool
 	select S5P_EXT_INT
-	select S5P_HRT
 	select S5P_PM if PM
 	select S5P_SLEEP if PM
 	select SAMSUNG_DMADEV
+	select SAMSUNG_HRT
 	help
 	  Enable S5PV210 CPU support
 
diff --git a/arch/arm/mach-s5pv210/mach-aquila.c b/arch/arm/mach-s5pv210/mach-aquila.c
index ee9fa5c..7c7d89b 100644
--- a/arch/arm/mach-s5pv210/mach-aquila.c
+++ b/arch/arm/mach-s5pv210/mach-aquila.c
@@ -39,7 +39,7 @@
 #include <plat/fb.h>
 #include <plat/fimc-core.h>
 #include <plat/sdhci.h>
-#include <plat/s5p-time.h>
+#include <plat/samsung-time.h>
 
 #include "common.h"
 
@@ -652,7 +652,7 @@ static void __init aquila_map_io(void)
 	s5pv210_init_io(NULL, 0);
 	s3c24xx_init_clocks(24000000);
 	s3c24xx_init_uarts(aquila_uartcfgs, ARRAY_SIZE(aquila_uartcfgs));
-	s5p_set_timer_source(S5P_PWM3, S5P_PWM4);
+	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
 }
 
 static void __init aquila_machine_init(void)
@@ -688,6 +688,6 @@ MACHINE_START(AQUILA, "Aquila")
 	.handle_irq	= vic_handle_irq,
 	.map_io		= aquila_map_io,
 	.init_machine	= aquila_machine_init,
-	.timer		= &s5p_timer,
+	.timer		= &samsung_timer,
 	.restart	= s5pv210_restart,
 MACHINE_END
diff --git a/arch/arm/mach-s5pv210/mach-goni.c b/arch/arm/mach-s5pv210/mach-goni.c
index c72b310..a5e738b 100644
--- a/arch/arm/mach-s5pv210/mach-goni.c
+++ b/arch/arm/mach-s5pv210/mach-goni.c
@@ -48,7 +48,7 @@
 #include <plat/keypad.h>
 #include <plat/sdhci.h>
 #include <plat/clock.h>
-#include <plat/s5p-time.h>
+#include <plat/samsung-time.h>
 #include <plat/mfc.h>
 #include <plat/camport.h>
 
@@ -909,7 +909,7 @@ static void __init goni_map_io(void)
 	s5pv210_init_io(NULL, 0);
 	s3c24xx_init_clocks(clk_xusbxti.rate);
 	s3c24xx_init_uarts(goni_uartcfgs, ARRAY_SIZE(goni_uartcfgs));
-	s5p_set_timer_source(S5P_PWM3, S5P_PWM4);
+	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
 }
 
 static void __init goni_reserve(void)
@@ -975,7 +975,7 @@ MACHINE_START(GONI, "GONI")
 	.handle_irq	= vic_handle_irq,
 	.map_io		= goni_map_io,
 	.init_machine	= goni_machine_init,
-	.timer		= &s5p_timer,
+	.timer		= &samsung_timer,
 	.reserve	= &goni_reserve,
 	.restart	= s5pv210_restart,
 MACHINE_END
diff --git a/arch/arm/mach-s5pv210/mach-smdkc110.c b/arch/arm/mach-s5pv210/mach-smdkc110.c
index f1f3bd3..817ca35 100644
--- a/arch/arm/mach-s5pv210/mach-smdkc110.c
+++ b/arch/arm/mach-s5pv210/mach-smdkc110.c
@@ -30,7 +30,7 @@
 #include <linux/platform_data/ata-samsung_cf.h>
 #include <linux/platform_data/i2c-s3c2410.h>
 #include <plat/pm.h>
-#include <plat/s5p-time.h>
+#include <plat/samsung-time.h>
 #include <plat/mfc.h>
 
 #include "common.h"
@@ -121,7 +121,7 @@ static void __init smdkc110_map_io(void)
 	s5pv210_init_io(NULL, 0);
 	s3c24xx_init_clocks(24000000);
 	s3c24xx_init_uarts(smdkv210_uartcfgs, ARRAY_SIZE(smdkv210_uartcfgs));
-	s5p_set_timer_source(S5P_PWM3, S5P_PWM4);
+	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
 }
 
 static void __init smdkc110_reserve(void)
@@ -155,7 +155,7 @@ MACHINE_START(SMDKC110, "SMDKC110")
 	.handle_irq	= vic_handle_irq,
 	.map_io		= smdkc110_map_io,
 	.init_machine	= smdkc110_machine_init,
-	.timer		= &s5p_timer,
+	.timer		= &samsung_timer,
 	.restart	= s5pv210_restart,
 	.reserve	= &smdkc110_reserve,
 MACHINE_END
diff --git a/arch/arm/mach-s5pv210/mach-smdkv210.c b/arch/arm/mach-s5pv210/mach-smdkv210.c
index 6bc8404..cbab8c5 100644
--- a/arch/arm/mach-s5pv210/mach-smdkv210.c
+++ b/arch/arm/mach-s5pv210/mach-smdkv210.c
@@ -45,7 +45,7 @@
 #include <plat/keypad.h>
 #include <plat/pm.h>
 #include <plat/fb.h>
-#include <plat/s5p-time.h>
+#include <plat/samsung-time.h>
 #include <plat/backlight.h>
 #include <plat/mfc.h>
 #include <plat/clock.h>
@@ -286,7 +286,7 @@ static void __init smdkv210_map_io(void)
 	s5pv210_init_io(NULL, 0);
 	s3c24xx_init_clocks(clk_xusbxti.rate);
 	s3c24xx_init_uarts(smdkv210_uartcfgs, ARRAY_SIZE(smdkv210_uartcfgs));
-	s5p_set_timer_source(S5P_PWM2, S5P_PWM4);
+	samsung_set_timer_source(SAMSUNG_PWM2, SAMSUNG_PWM4);
 }
 
 static void __init smdkv210_reserve(void)
@@ -331,7 +331,7 @@ MACHINE_START(SMDKV210, "SMDKV210")
 	.handle_irq	= vic_handle_irq,
 	.map_io		= smdkv210_map_io,
 	.init_machine	= smdkv210_machine_init,
-	.timer		= &s5p_timer,
+	.timer		= &samsung_timer,
 	.restart	= s5pv210_restart,
 	.reserve	= &smdkv210_reserve,
 MACHINE_END
diff --git a/arch/arm/mach-s5pv210/mach-torbreck.c b/arch/arm/mach-s5pv210/mach-torbreck.c
index 18785cb..aec668c 100644
--- a/arch/arm/mach-s5pv210/mach-torbreck.c
+++ b/arch/arm/mach-s5pv210/mach-torbreck.c
@@ -27,7 +27,7 @@
 #include <plat/devs.h>
 #include <plat/cpu.h>
 #include <linux/platform_data/i2c-s3c2410.h>
-#include <plat/s5p-time.h>
+#include <plat/samsung-time.h>
 
 #include "common.h"
 
@@ -107,7 +107,7 @@ static void __init torbreck_map_io(void)
 	s5pv210_init_io(NULL, 0);
 	s3c24xx_init_clocks(24000000);
 	s3c24xx_init_uarts(torbreck_uartcfgs, ARRAY_SIZE(torbreck_uartcfgs));
-	s5p_set_timer_source(S5P_PWM3, S5P_PWM4);
+	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
 }
 
 static void __init torbreck_machine_init(void)
@@ -132,6 +132,6 @@ MACHINE_START(TORBRECK, "TORBRECK")
 	.handle_irq	= vic_handle_irq,
 	.map_io		= torbreck_map_io,
 	.init_machine	= torbreck_machine_init,
-	.timer		= &s5p_timer,
+	.timer		= &samsung_timer,
 	.restart	= s5pv210_restart,
 MACHINE_END
diff --git a/arch/arm/plat-samsung/Kconfig b/arch/arm/plat-samsung/Kconfig
index a9d5216..b708b3e 100644
--- a/arch/arm/plat-samsung/Kconfig
+++ b/arch/arm/plat-samsung/Kconfig
@@ -70,7 +70,7 @@ config S3C_LOWLEVEL_UART_PORT
 
 # timer options
 
-config S5P_HRT
+config SAMSUNG_HRT
 	bool
 	select SAMSUNG_DEV_PWM
 	help
diff --git a/arch/arm/plat-samsung/Makefile b/arch/arm/plat-samsung/Makefile
index 3a7c64d..e1244eb 100644
--- a/arch/arm/plat-samsung/Makefile
+++ b/arch/arm/plat-samsung/Makefile
@@ -13,7 +13,7 @@ obj-				:=
 
 obj-y				+= init.o cpu.o
 obj-$(CONFIG_ARCH_USES_GETTIMEOFFSET)   += time.o
-obj-$(CONFIG_S5P_HRT) 		+= s5p-time.o
+obj-$(CONFIG_SAMSUNG_HRT) 	+= samsung-time.o
 
 obj-$(CONFIG_SAMSUNG_CLOCK)	+= clock.o
 obj-$(CONFIG_SAMSUNG_CLOCK)	+= pwm-clock.o
diff --git a/arch/arm/plat-samsung/include/plat/s5p-time.h b/arch/arm/plat-samsung/include/plat/s5p-time.h
deleted file mode 100644
index 3a70aeb..0000000
--- a/arch/arm/plat-samsung/include/plat/s5p-time.h
+++ /dev/null
@@ -1,40 +0,0 @@
-/* linux/arch/arm/plat-samsung/include/plat/s5p-time.h
- *
- * Copyright 2011 Samsung Electronics Co., Ltd.
- *		http://www.samsung.com/
- *
- * Header file for s5p time support
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
-*/
-
-#ifndef __ASM_PLAT_S5P_TIME_H
-#define __ASM_PLAT_S5P_TIME_H __FILE__
-
-/* S5P HR-Timer Clock mode */
-enum s5p_timer_mode {
-	S5P_PWM0,
-	S5P_PWM1,
-	S5P_PWM2,
-	S5P_PWM3,
-	S5P_PWM4,
-};
-
-struct s5p_timer_source {
-	unsigned int event_id;
-	unsigned int source_id;
-};
-
-/* Be able to sleep for atleast 4 seconds (usually more) */
-#define S5PTIMER_MIN_RANGE	4
-
-#define TCNT_MAX		0xffffffff
-#define NON_PERIODIC		0
-#define PERIODIC		1
-
-extern void __init s5p_set_timer_source(enum s5p_timer_mode event,
-					enum s5p_timer_mode source);
-extern	struct sys_timer s5p_timer;
-#endif /* __ASM_PLAT_S5P_TIME_H */
diff --git a/arch/arm/plat-samsung/include/plat/samsung-time.h b/arch/arm/plat-samsung/include/plat/samsung-time.h
new file mode 100644
index 0000000..9d6d622
--- /dev/null
+++ b/arch/arm/plat-samsung/include/plat/samsung-time.h
@@ -0,0 +1,40 @@
+/* linux/arch/arm/plat-samsung/include/plat/samsung-time.h
+ *
+ * Copyright 2011 Samsung Electronics Co., Ltd.
+ *		http://www.samsung.com/
+ *
+ * Header file for samsung s3c and s5p time support
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+*/
+
+#ifndef __ASM_PLAT_SAMSUNG_TIME_H
+#define __ASM_PLAT_SAMSUNG_TIME_H __FILE__
+
+/* SAMSUNG HR-Timer Clock mode */
+enum samsung_timer_mode {
+	SAMSUNG_PWM0,
+	SAMSUNG_PWM1,
+	SAMSUNG_PWM2,
+	SAMSUNG_PWM3,
+	SAMSUNG_PWM4,
+};
+
+struct samsung_timer_source {
+	unsigned int event_id;
+	unsigned int source_id;
+};
+
+/* Be able to sleep for atleast 4 seconds (usually more) */
+#define SAMSUNG_TIMER_MIN_RANGE	4
+
+#define TCNT_MAX		0xffffffff
+#define NON_PERIODIC		0
+#define PERIODIC		1
+
+extern void __init samsung_set_timer_source(enum samsung_timer_mode event,
+					enum samsung_timer_mode source);
+extern	struct sys_timer samsung_timer;
+#endif /* __ASM_PLAT_SAMSUNG_TIME_H */
diff --git a/arch/arm/plat-samsung/s5p-time.c b/arch/arm/plat-samsung/samsung-time.c
similarity index 70%
rename from arch/arm/plat-samsung/s5p-time.c
rename to arch/arm/plat-samsung/samsung-time.c
index 028b6e8..91773bf 100644
--- a/arch/arm/plat-samsung/s5p-time.c
+++ b/arch/arm/plat-samsung/samsung-time.c
@@ -2,7 +2,7 @@
  * Copyright (c) 2011 Samsung Electronics Co., Ltd.
  *		http://www.samsung.com/
  *
- * S5P - Common hr-timer support
+ * SAMSUNG - Common hr-timer support
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License version 2 as
@@ -25,41 +25,41 @@
 #include <mach/map.h>
 #include <plat/devs.h>
 #include <plat/regs-timer.h>
-#include <plat/s5p-time.h>
+#include <plat/samsung-time.h>
 
 static struct clk *tin_event;
 static struct clk *tin_source;
 static struct clk *tdiv_event;
 static struct clk *tdiv_source;
 static struct clk *timerclk;
-static struct s5p_timer_source timer_source;
+static struct samsung_timer_source timer_source;
 static unsigned long clock_count_per_tick;
-static void s5p_timer_resume(void);
+static void samsung_timer_resume(void);
 
-static void s5p_time_stop(enum s5p_timer_mode mode)
+static void samsung_time_stop(enum samsung_timer_mode mode)
 {
 	unsigned long tcon;
 
 	tcon = __raw_readl(S3C2410_TCON);
 
 	switch (mode) {
-	case S5P_PWM0:
+	case SAMSUNG_PWM0:
 		tcon &= ~S3C2410_TCON_T0START;
 		break;
 
-	case S5P_PWM1:
+	case SAMSUNG_PWM1:
 		tcon &= ~S3C2410_TCON_T1START;
 		break;
 
-	case S5P_PWM2:
+	case SAMSUNG_PWM2:
 		tcon &= ~S3C2410_TCON_T2START;
 		break;
 
-	case S5P_PWM3:
+	case SAMSUNG_PWM3:
 		tcon &= ~S3C2410_TCON_T3START;
 		break;
 
-	case S5P_PWM4:
+	case SAMSUNG_PWM4:
 		tcon &= ~S3C2410_TCON_T4START;
 		break;
 
@@ -70,7 +70,7 @@ static void s5p_time_stop(enum s5p_timer_mode mode)
 	__raw_writel(tcon, S3C2410_TCON);
 }
 
-static void s5p_time_setup(enum s5p_timer_mode mode, unsigned long tcnt)
+static void samsung_time_setup(enum samsung_timer_mode mode, unsigned long tcnt)
 {
 	unsigned long tcon;
 
@@ -79,27 +79,27 @@ static void s5p_time_setup(enum s5p_timer_mode mode, unsigned long tcnt)
 	tcnt--;
 
 	switch (mode) {
-	case S5P_PWM0:
+	case SAMSUNG_PWM0:
 		tcon &= ~(0x0f << 0);
 		tcon |= S3C2410_TCON_T0MANUALUPD;
 		break;
 
-	case S5P_PWM1:
+	case SAMSUNG_PWM1:
 		tcon &= ~(0x0f << 8);
 		tcon |= S3C2410_TCON_T1MANUALUPD;
 		break;
 
-	case S5P_PWM2:
+	case SAMSUNG_PWM2:
 		tcon &= ~(0x0f << 12);
 		tcon |= S3C2410_TCON_T2MANUALUPD;
 		break;
 
-	case S5P_PWM3:
+	case SAMSUNG_PWM3:
 		tcon &= ~(0x0f << 16);
 		tcon |= S3C2410_TCON_T3MANUALUPD;
 		break;
 
-	case S5P_PWM4:
+	case SAMSUNG_PWM4:
 		tcon &= ~(0x07 << 20);
 		tcon |= S3C2410_TCON_T4MANUALUPD;
 		break;
@@ -114,14 +114,14 @@ static void s5p_time_setup(enum s5p_timer_mode mode, unsigned long tcnt)
 	__raw_writel(tcon, S3C2410_TCON);
 }
 
-static void s5p_time_start(enum s5p_timer_mode mode, bool periodic)
+static void samsung_time_start(enum samsung_timer_mode mode, bool periodic)
 {
 	unsigned long tcon;
 
 	tcon  = __raw_readl(S3C2410_TCON);
 
 	switch (mode) {
-	case S5P_PWM0:
+	case SAMSUNG_PWM0:
 		tcon |= S3C2410_TCON_T0START;
 		tcon &= ~S3C2410_TCON_T0MANUALUPD;
 
@@ -131,7 +131,7 @@ static void s5p_time_start(enum s5p_timer_mode mode, bool periodic)
 			tcon &= ~S3C2410_TCON_T0RELOAD;
 		break;
 
-	case S5P_PWM1:
+	case SAMSUNG_PWM1:
 		tcon |= S3C2410_TCON_T1START;
 		tcon &= ~S3C2410_TCON_T1MANUALUPD;
 
@@ -141,7 +141,7 @@ static void s5p_time_start(enum s5p_timer_mode mode, bool periodic)
 			tcon &= ~S3C2410_TCON_T1RELOAD;
 		break;
 
-	case S5P_PWM2:
+	case SAMSUNG_PWM2:
 		tcon |= S3C2410_TCON_T2START;
 		tcon &= ~S3C2410_TCON_T2MANUALUPD;
 
@@ -151,7 +151,7 @@ static void s5p_time_start(enum s5p_timer_mode mode, bool periodic)
 			tcon &= ~S3C2410_TCON_T2RELOAD;
 		break;
 
-	case S5P_PWM3:
+	case SAMSUNG_PWM3:
 		tcon |= S3C2410_TCON_T3START;
 		tcon &= ~S3C2410_TCON_T3MANUALUPD;
 
@@ -161,7 +161,7 @@ static void s5p_time_start(enum s5p_timer_mode mode, bool periodic)
 			tcon &= ~S3C2410_TCON_T3RELOAD;
 		break;
 
-	case S5P_PWM4:
+	case SAMSUNG_PWM4:
 		tcon |= S3C2410_TCON_T4START;
 		tcon &= ~S3C2410_TCON_T4MANUALUPD;
 
@@ -178,24 +178,24 @@ static void s5p_time_start(enum s5p_timer_mode mode, bool periodic)
 	__raw_writel(tcon, S3C2410_TCON);
 }
 
-static int s5p_set_next_event(unsigned long cycles,
+static int samsung_set_next_event(unsigned long cycles,
 				struct clock_event_device *evt)
 {
-	s5p_time_setup(timer_source.event_id, cycles);
-	s5p_time_start(timer_source.event_id, NON_PERIODIC);
+	samsung_time_setup(timer_source.event_id, cycles);
+	samsung_time_start(timer_source.event_id, NON_PERIODIC);
 
 	return 0;
 }
 
-static void s5p_set_mode(enum clock_event_mode mode,
+static void samsung_set_mode(enum clock_event_mode mode,
 				struct clock_event_device *evt)
 {
-	s5p_time_stop(timer_source.event_id);
+	samsung_time_stop(timer_source.event_id);
 
 	switch (mode) {
 	case CLOCK_EVT_MODE_PERIODIC:
-		s5p_time_setup(timer_source.event_id, clock_count_per_tick);
-		s5p_time_start(timer_source.event_id, PERIODIC);
+		samsung_time_setup(timer_source.event_id, clock_count_per_tick);
+		samsung_time_start(timer_source.event_id, PERIODIC);
 		break;
 
 	case CLOCK_EVT_MODE_ONESHOT:
@@ -206,24 +206,24 @@ static void s5p_set_mode(enum clock_event_mode mode,
 		break;
 
 	case CLOCK_EVT_MODE_RESUME:
-		s5p_timer_resume();
+		samsung_timer_resume();
 		break;
 	}
 }
 
-static void s5p_timer_resume(void)
+static void samsung_timer_resume(void)
 {
 	/* event timer restart */
-	s5p_time_setup(timer_source.event_id, clock_count_per_tick);
-	s5p_time_start(timer_source.event_id, PERIODIC);
+	samsung_time_setup(timer_source.event_id, clock_count_per_tick);
+	samsung_time_start(timer_source.event_id, PERIODIC);
 
 	/* source timer restart */
-	s5p_time_setup(timer_source.source_id, TCNT_MAX);
-	s5p_time_start(timer_source.source_id, PERIODIC);
+	samsung_time_setup(timer_source.source_id, TCNT_MAX);
+	samsung_time_start(timer_source.source_id, PERIODIC);
 }
 
-void __init s5p_set_timer_source(enum s5p_timer_mode event,
-				 enum s5p_timer_mode source)
+void __init samsung_set_timer_source(enum samsung_timer_mode event,
+				 enum samsung_timer_mode source)
 {
 	s3c_device_timer[event].dev.bus = &platform_bus_type;
 	s3c_device_timer[source].dev.bus = &platform_bus_type;
@@ -233,14 +233,14 @@ void __init s5p_set_timer_source(enum s5p_timer_mode event,
 }
 
 static struct clock_event_device time_event_device = {
-	.name		= "s5p_event_timer",
+	.name		= "samsung_event_timer",
 	.features	= CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT,
 	.rating		= 200,
-	.set_next_event	= s5p_set_next_event,
-	.set_mode	= s5p_set_mode,
+	.set_next_event	= samsung_set_next_event,
+	.set_mode	= samsung_set_mode,
 };
 
-static irqreturn_t s5p_clock_event_isr(int irq, void *dev_id)
+static irqreturn_t samsung_clock_event_isr(int irq, void *dev_id)
 {
 	struct clock_event_device *evt = dev_id;
 
@@ -249,14 +249,14 @@ static irqreturn_t s5p_clock_event_isr(int irq, void *dev_id)
 	return IRQ_HANDLED;
 }
 
-static struct irqaction s5p_clock_event_irq = {
-	.name		= "s5p_time_irq",
+static struct irqaction samsung_clock_event_irq = {
+	.name		= "samsung_time_irq",
 	.flags		= IRQF_DISABLED | IRQF_TIMER | IRQF_IRQPOLL,
-	.handler	= s5p_clock_event_isr,
+	.handler	= samsung_clock_event_isr,
 	.dev_id		= &time_event_device,
 };
 
-static void __init s5p_clockevent_init(void)
+static void __init samsung_clockevent_init(void)
 {
 	unsigned long pclk;
 	unsigned long clock_rate;
@@ -275,7 +275,7 @@ static void __init s5p_clockevent_init(void)
 	clock_count_per_tick = clock_rate / HZ;
 
 	clockevents_calc_mult_shift(&time_event_device,
-				    clock_rate, S5PTIMER_MIN_RANGE);
+				    clock_rate, SAMSUNG_TIMER_MIN_RANGE);
 	time_event_device.max_delta_ns =
 		clockevent_delta2ns(-1, &time_event_device);
 	time_event_device.min_delta_ns =
@@ -285,22 +285,22 @@ static void __init s5p_clockevent_init(void)
 	clockevents_register_device(&time_event_device);
 
 	irq_number = timer_source.event_id + IRQ_TIMER0;
-	setup_irq(irq_number, &s5p_clock_event_irq);
+	setup_irq(irq_number, &samsung_clock_event_irq);
 }
 
-static void __iomem *s5p_timer_reg(void)
+static void __iomem *samsung_timer_reg(void)
 {
 	unsigned long offset = 0;
 
 	switch (timer_source.source_id) {
-	case S5P_PWM0:
-	case S5P_PWM1:
-	case S5P_PWM2:
-	case S5P_PWM3:
+	case SAMSUNG_PWM0:
+	case SAMSUNG_PWM1:
+	case SAMSUNG_PWM2:
+	case SAMSUNG_PWM3:
 		offset = (timer_source.source_id * 0x0c) + 0x14;
 		break;
 
-	case S5P_PWM4:
+	case SAMSUNG_PWM4:
 		offset = 0x40;
 		break;
 
@@ -319,9 +319,9 @@ static void __iomem *s5p_timer_reg(void)
  * this wraps around for now, since it is just a relative time
  * stamp. (Inspired by U300 implementation.)
  */
-static u32 notrace s5p_read_sched_clock(void)
+static u32 notrace samsung_read_sched_clock(void)
 {
-	void __iomem *reg = s5p_timer_reg();
+	void __iomem *reg = samsung_timer_reg();
 
 	if (!reg)
 		return 0;
@@ -329,7 +329,7 @@ static u32 notrace s5p_read_sched_clock(void)
 	return ~__raw_readl(reg);
 }
 
-static void __init s5p_clocksource_init(void)
+static void __init samsung_clocksource_init(void)
 {
 	unsigned long pclk;
 	unsigned long clock_rate;
@@ -341,17 +341,17 @@ static void __init s5p_clocksource_init(void)
 
 	clock_rate = clk_get_rate(tin_source);
 
-	s5p_time_setup(timer_source.source_id, TCNT_MAX);
-	s5p_time_start(timer_source.source_id, PERIODIC);
+	samsung_time_setup(timer_source.source_id, TCNT_MAX);
+	samsung_time_start(timer_source.source_id, PERIODIC);
 
-	setup_sched_clock(s5p_read_sched_clock, 32, clock_rate);
+	setup_sched_clock(samsung_read_sched_clock, 32, clock_rate);
 
-	if (clocksource_mmio_init(s5p_timer_reg(), "s5p_clocksource_timer",
+	if (clocksource_mmio_init(samsung_timer_reg(), "samsung_clocksource_timer",
 			clock_rate, 250, 32, clocksource_mmio_readl_down))
-		panic("s5p_clocksource_timer: can't register clocksource\n");
+		panic("samsung_clocksource_timer: can't register clocksource\n");
 }
 
-static void __init s5p_timer_resources(void)
+static void __init samsung_timer_resources(void)
 {
 
 	unsigned long event_id = timer_source.event_id;
@@ -393,13 +393,13 @@ static void __init s5p_timer_resources(void)
 	clk_enable(tin_source);
 }
 
-static void __init s5p_timer_init(void)
+static void __init samsung_timer_init(void)
 {
-	s5p_timer_resources();
-	s5p_clockevent_init();
-	s5p_clocksource_init();
+	samsung_timer_resources();
+	samsung_clockevent_init();
+	samsung_clocksource_init();
 }
 
-struct sys_timer s5p_timer = {
-	.init		= s5p_timer_init,
+struct sys_timer samsung_timer = {
+	.init		= samsung_timer_init,
 };
-- 
1.8.0.3

^ permalink raw reply related	[flat|nested] 39+ messages in thread

* [PATCH 2/5 v3] Add samsung-time support for s3c24xx
  2013-01-08 21:00                   ` Tomasz Figa
                                       ` (2 preceding siblings ...)
  2013-01-09 22:43                     ` [PATCH 1/5 v3] Rename s5p-time to samsung-time Romain Naour
@ 2013-01-09 22:43                     ` Romain Naour
  2013-01-10  3:03                       ` Kukjin Kim
  2013-01-09 22:44                     ` [PATCH 3/5 v3] Add samsung-time support for s3c64xx Romain Naour
                                       ` (2 subsequent siblings)
  6 siblings, 1 reply; 39+ messages in thread
From: Romain Naour @ 2013-01-09 22:43 UTC (permalink / raw)
  To: Tomasz Figa
  Cc: Heiko Stübner, Kukjin Kim, linux-samsung-soc, ben-linux,
	'Sylwester Nawrocki'



Signed-off-by: Naour Romain <romain.naour@openwide.fr>
---
 arch/arm/Kconfig                                  |  3 ++-
 arch/arm/mach-s3c24xx/Kconfig                     |  6 ++++++
 arch/arm/mach-s3c24xx/mach-amlm5900.c             |  5 ++++-
 arch/arm/mach-s3c24xx/mach-anubis.c               |  4 +++-
 arch/arm/mach-s3c24xx/mach-at2440evb.c            |  4 +++-
 arch/arm/mach-s3c24xx/mach-bast.c                 |  4 +++-
 arch/arm/mach-s3c24xx/mach-gta02.c                |  4 +++-
 arch/arm/mach-s3c24xx/mach-h1940.c                |  5 +++--
 arch/arm/mach-s3c24xx/mach-jive.c                 |  4 +++-
 arch/arm/mach-s3c24xx/mach-mini2440.c             |  4 +++-
 arch/arm/mach-s3c24xx/mach-n30.c                  |  6 ++++--
 arch/arm/mach-s3c24xx/mach-nexcoder.c             |  4 +++-
 arch/arm/mach-s3c24xx/mach-osiris.c               |  4 +++-
 arch/arm/mach-s3c24xx/mach-otom.c                 |  4 +++-
 arch/arm/mach-s3c24xx/mach-qt2410.c               |  4 +++-
 arch/arm/mach-s3c24xx/mach-rx1950.c               |  4 +++-
 arch/arm/mach-s3c24xx/mach-rx3715.c               |  4 +++-
 arch/arm/mach-s3c24xx/mach-smdk2410.c             |  4 +++-
 arch/arm/mach-s3c24xx/mach-smdk2413.c             |  8 +++++---
 arch/arm/mach-s3c24xx/mach-smdk2416.c             |  4 +++-
 arch/arm/mach-s3c24xx/mach-smdk2440.c             |  4 +++-
 arch/arm/mach-s3c24xx/mach-smdk2443.c             |  4 +++-
 arch/arm/mach-s3c24xx/mach-tct_hammer.c           |  4 +++-
 arch/arm/mach-s3c24xx/mach-vr1000.c               |  4 +++-
 arch/arm/mach-s3c24xx/mach-vstms.c                |  5 +++--
 arch/arm/plat-samsung/include/plat/cpu.h          |  2 +-
 arch/arm/plat-samsung/include/plat/samsung-time.h | 11 +++++++++++
 arch/arm/plat-samsung/samsung-time.c              | 12 ++++++------
 28 files changed, 99 insertions(+), 36 deletions(-)

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index f95ba14..2796959 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -743,8 +743,9 @@ config ARCH_SA1100
 config ARCH_S3C24XX
 	bool "Samsung S3C24XX SoCs"
 	select ARCH_HAS_CPUFREQ
-	select ARCH_USES_GETTIMEOFFSET
 	select CLKDEV_LOOKUP
+	select CLKSRC_MMIO
+	select GENERIC_CLOCKEVENTS
 	select GENERIC_GPIO
 	select HAVE_CLK
 	select HAVE_S3C2410_I2C if I2C
diff --git a/arch/arm/mach-s3c24xx/Kconfig b/arch/arm/mach-s3c24xx/Kconfig
index 25df14a..94d01c3 100644
--- a/arch/arm/mach-s3c24xx/Kconfig
+++ b/arch/arm/mach-s3c24xx/Kconfig
@@ -21,6 +21,7 @@ config CPU_S3C2410
 	select S3C2410_CLOCK
 	select S3C2410_CPUFREQ if CPU_FREQ_S3C24XX
 	select S3C2410_PM if PM
+	select SAMSUNG_HRT
 	help
 	  Support for S3C2410 and S3C2410A family from the S3C24XX line
 	  of Samsung Mobile CPUs.
@@ -32,6 +33,7 @@ config CPU_S3C2412
 	select CPU_LLSERIAL_S3C2440
 	select S3C2412_DMA if S3C24XX_DMA
 	select S3C2412_PM if PM
+	select SAMSUNG_HRT
 	help
 	  Support for the S3C2412 and S3C2413 SoCs from the S3C24XX line
 
@@ -44,6 +46,7 @@ config CPU_S3C2416
 	select S3C2443_COMMON
 	select S3C2443_DMA if S3C24XX_DMA
 	select SAMSUNG_CLKSRC
+	select SAMSUNG_HRT
 	help
 	  Support for the S3C2416 SoC from the S3C24XX line
 
@@ -54,6 +57,7 @@ config CPU_S3C2440
 	select S3C2410_CLOCK
 	select S3C2410_PM if PM
 	select S3C2440_DMA if S3C24XX_DMA
+	select SAMSUNG_HRT
 	help
 	  Support for S3C2440 Samsung Mobile CPU based systems.
 
@@ -63,6 +67,7 @@ config CPU_S3C2442
 	select CPU_LLSERIAL_S3C2440
 	select S3C2410_CLOCK
 	select S3C2410_PM if PM
+	select SAMSUNG_HRT
 	help
 	  Support for S3C2442 Samsung Mobile CPU based systems.
 
@@ -78,6 +83,7 @@ config CPU_S3C2443
 	select S3C2443_COMMON
 	select S3C2443_DMA if S3C24XX_DMA
 	select SAMSUNG_CLKSRC
+	select SAMSUNG_HRT
 	help
 	  Support for the S3C2443 SoC from the S3C24XX line
 
diff --git a/arch/arm/mach-s3c24xx/mach-amlm5900.c b/arch/arm/mach-s3c24xx/mach-amlm5900.c
index f4ad99c..84c9bb0 100644
--- a/arch/arm/mach-s3c24xx/mach-amlm5900.c
+++ b/arch/arm/mach-s3c24xx/mach-amlm5900.c
@@ -63,6 +63,8 @@
 #include <linux/mtd/map.h>
 #include <linux/mtd/physmap.h>
 
+#include <plat/samsung-time.h>
+
 #include "common.h"
 
 static struct resource amlm5900_nor_resource =
@@ -160,6 +162,7 @@ static void __init amlm5900_map_io(void)
 	s3c24xx_init_io(amlm5900_iodesc, ARRAY_SIZE(amlm5900_iodesc));
 	s3c24xx_init_clocks(0);
 	s3c24xx_init_uarts(amlm5900_uartcfgs, ARRAY_SIZE(amlm5900_uartcfgs));
+	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
 }
 
 #ifdef CONFIG_FB_S3C2410
@@ -237,6 +240,6 @@ MACHINE_START(AML_M5900, "AML_M5900")
 	.map_io		= amlm5900_map_io,
 	.init_irq	= s3c24xx_init_irq,
 	.init_machine	= amlm5900_init,
-	.timer		= &s3c24xx_timer,
+	.timer		= &samsung_timer,
 	.restart	= s3c2410_restart,
 MACHINE_END
diff --git a/arch/arm/mach-s3c24xx/mach-anubis.c b/arch/arm/mach-s3c24xx/mach-anubis.c
index 113304c..8ac052c 100644
--- a/arch/arm/mach-s3c24xx/mach-anubis.c
+++ b/arch/arm/mach-s3c24xx/mach-anubis.c
@@ -50,6 +50,7 @@
 #include <plat/devs.h>
 #include <plat/cpu.h>
 #include <linux/platform_data/asoc-s3c24xx_simtec.h>
+#include <plat/samsung-time.h>
 
 #include "anubis.h"
 #include "common.h"
@@ -411,6 +412,7 @@ static void __init anubis_map_io(void)
 	s3c24xx_init_io(anubis_iodesc, ARRAY_SIZE(anubis_iodesc));
 	s3c24xx_init_clocks(0);
 	s3c24xx_init_uarts(anubis_uartcfgs, ARRAY_SIZE(anubis_uartcfgs));
+	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
 
 	/* check for the newer revision boards with large page nand */
 
@@ -445,6 +447,6 @@ MACHINE_START(ANUBIS, "Simtec-Anubis")
 	.map_io		= anubis_map_io,
 	.init_machine	= anubis_init,
 	.init_irq	= s3c24xx_init_irq,
-	.timer		= &s3c24xx_timer,
+	.timer		= &samsung_timer,
 	.restart	= s3c244x_restart,
 MACHINE_END
diff --git a/arch/arm/mach-s3c24xx/mach-at2440evb.c b/arch/arm/mach-s3c24xx/mach-at2440evb.c
index f51bbcb..0314c89 100644
--- a/arch/arm/mach-s3c24xx/mach-at2440evb.c
+++ b/arch/arm/mach-s3c24xx/mach-at2440evb.c
@@ -49,6 +49,7 @@
 #include <plat/devs.h>
 #include <plat/cpu.h>
 #include <linux/platform_data/mmc-s3cmci.h>
+#include <plat/samsung-time.h>
 
 #include "common.h"
 
@@ -193,6 +194,7 @@ static void __init at2440evb_map_io(void)
 	s3c24xx_init_io(at2440evb_iodesc, ARRAY_SIZE(at2440evb_iodesc));
 	s3c24xx_init_clocks(16934400);
 	s3c24xx_init_uarts(at2440evb_uartcfgs, ARRAY_SIZE(at2440evb_uartcfgs));
+	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
 }
 
 static void __init at2440evb_init(void)
@@ -211,6 +213,6 @@ MACHINE_START(AT2440EVB, "AT2440EVB")
 	.map_io		= at2440evb_map_io,
 	.init_machine	= at2440evb_init,
 	.init_irq	= s3c24xx_init_irq,
-	.timer		= &s3c24xx_timer,
+	.timer		= &samsung_timer,
 	.restart	= s3c244x_restart,
 MACHINE_END
diff --git a/arch/arm/mach-s3c24xx/mach-bast.c b/arch/arm/mach-s3c24xx/mach-bast.c
index 1ed29b4..bd6cba7 100644
--- a/arch/arm/mach-s3c24xx/mach-bast.c
+++ b/arch/arm/mach-s3c24xx/mach-bast.c
@@ -56,6 +56,7 @@
 #include <plat/devs.h>
 #include <plat/gpio-cfg.h>
 #include <plat/regs-serial.h>
+#include <plat/samsung-time.h>
 
 #include "bast.h"
 #include "common.h"
@@ -577,6 +578,7 @@ static void __init bast_map_io(void)
 	s3c24xx_init_io(bast_iodesc, ARRAY_SIZE(bast_iodesc));
 	s3c24xx_init_clocks(0);
 	s3c24xx_init_uarts(bast_uartcfgs, ARRAY_SIZE(bast_uartcfgs));
+	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
 }
 
 static void __init bast_init(void)
@@ -606,6 +608,6 @@ MACHINE_START(BAST, "Simtec-BAST")
 	.map_io		= bast_map_io,
 	.init_irq	= s3c24xx_init_irq,
 	.init_machine	= bast_init,
-	.timer		= &s3c24xx_timer,
+	.timer		= &samsung_timer,
 	.restart	= s3c2410_restart,
 MACHINE_END
diff --git a/arch/arm/mach-s3c24xx/mach-gta02.c b/arch/arm/mach-s3c24xx/mach-gta02.c
index 1053706..265c7d4 100644
--- a/arch/arm/mach-s3c24xx/mach-gta02.c
+++ b/arch/arm/mach-s3c24xx/mach-gta02.c
@@ -82,6 +82,7 @@
 #include <plat/gpio-cfg.h>
 #include <plat/pm.h>
 #include <plat/regs-serial.h>
+#include <plat/samsung-time.h>
 
 #include "common.h"
 #include "gta02.h"
@@ -502,6 +503,7 @@ static void __init gta02_map_io(void)
 	s3c24xx_init_io(gta02_iodesc, ARRAY_SIZE(gta02_iodesc));
 	s3c24xx_init_clocks(12000000);
 	s3c24xx_init_uarts(gta02_uartcfgs, ARRAY_SIZE(gta02_uartcfgs));
+	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
 }
 
 
@@ -590,6 +592,6 @@ MACHINE_START(NEO1973_GTA02, "GTA02")
 	.map_io		= gta02_map_io,
 	.init_irq	= s3c24xx_init_irq,
 	.init_machine	= gta02_machine_init,
-	.timer		= &s3c24xx_timer,
+	.timer		= &samsung_timer,
 	.restart	= s3c244x_restart,
 MACHINE_END
diff --git a/arch/arm/mach-s3c24xx/mach-h1940.c b/arch/arm/mach-s3c24xx/mach-h1940.c
index afc05a7..2781a62 100644
--- a/arch/arm/mach-s3c24xx/mach-h1940.c
+++ b/arch/arm/mach-s3c24xx/mach-h1940.c
@@ -62,7 +62,7 @@
 #include <plat/pll.h>
 #include <plat/pm.h>
 #include <plat/regs-serial.h>
-
+#include <plat/samsung-time.h>
 
 #include "common.h"
 #include "h1940.h"
@@ -646,6 +646,7 @@ static void __init h1940_map_io(void)
 	s3c24xx_init_io(h1940_iodesc, ARRAY_SIZE(h1940_iodesc));
 	s3c24xx_init_clocks(0);
 	s3c24xx_init_uarts(h1940_uartcfgs, ARRAY_SIZE(h1940_uartcfgs));
+	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
 
 	/* setup PM */
 
@@ -741,6 +742,6 @@ MACHINE_START(H1940, "IPAQ-H1940")
 	.reserve	= h1940_reserve,
 	.init_irq	= h1940_init_irq,
 	.init_machine	= h1940_init,
-	.timer		= &s3c24xx_timer,
+	.timer		= &samsung_timer,
 	.restart	= s3c2410_restart,
 MACHINE_END
diff --git a/arch/arm/mach-s3c24xx/mach-jive.c b/arch/arm/mach-s3c24xx/mach-jive.c
index c9954e2..01a894d 100644
--- a/arch/arm/mach-s3c24xx/mach-jive.c
+++ b/arch/arm/mach-s3c24xx/mach-jive.c
@@ -55,6 +55,7 @@
 #include <plat/cpu.h>
 #include <plat/pm.h>
 #include <linux/platform_data/usb-s3c2410_udc.h>
+#include <plat/samsung-time.h>
 
 static struct map_desc jive_iodesc[] __initdata = {
 };
@@ -506,6 +507,7 @@ static void __init jive_map_io(void)
 	s3c24xx_init_io(jive_iodesc, ARRAY_SIZE(jive_iodesc));
 	s3c24xx_init_clocks(12000000);
 	s3c24xx_init_uarts(jive_uartcfgs, ARRAY_SIZE(jive_uartcfgs));
+	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
 }
 
 static void jive_power_off(void)
@@ -661,6 +663,6 @@ MACHINE_START(JIVE, "JIVE")
 	.init_irq	= s3c24xx_init_irq,
 	.map_io		= jive_map_io,
 	.init_machine	= jive_machine_init,
-	.timer		= &s3c24xx_timer,
+	.timer		= &samsung_timer,
 	.restart	= s3c2412_restart,
 MACHINE_END
diff --git a/arch/arm/mach-s3c24xx/mach-mini2440.c b/arch/arm/mach-s3c24xx/mach-mini2440.c
index a31d5b8..045b259 100644
--- a/arch/arm/mach-s3c24xx/mach-mini2440.c
+++ b/arch/arm/mach-s3c24xx/mach-mini2440.c
@@ -57,6 +57,7 @@
 #include <plat/clock.h>
 #include <plat/devs.h>
 #include <plat/cpu.h>
+#include <plat/samsung-time.h>
 
 #include <sound/s3c24xx_uda134x.h>
 
@@ -526,6 +527,7 @@ static void __init mini2440_map_io(void)
 	s3c24xx_init_io(mini2440_iodesc, ARRAY_SIZE(mini2440_iodesc));
 	s3c24xx_init_clocks(12000000);
 	s3c24xx_init_uarts(mini2440_uartcfgs, ARRAY_SIZE(mini2440_uartcfgs));
+	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
 }
 
 /*
@@ -688,6 +690,6 @@ MACHINE_START(MINI2440, "MINI2440")
 	.map_io		= mini2440_map_io,
 	.init_machine	= mini2440_init,
 	.init_irq	= s3c24xx_init_irq,
-	.timer		= &s3c24xx_timer,
+	.timer		= &samsung_timer,
 	.restart	= s3c244x_restart,
 MACHINE_END
diff --git a/arch/arm/mach-s3c24xx/mach-n30.c b/arch/arm/mach-s3c24xx/mach-n30.c
index c53a9bf..f6cea03 100644
--- a/arch/arm/mach-s3c24xx/mach-n30.c
+++ b/arch/arm/mach-s3c24xx/mach-n30.c
@@ -50,6 +50,7 @@
 #include <linux/platform_data/mmc-s3cmci.h>
 #include <plat/s3c2410.h>
 #include <linux/platform_data/usb-s3c2410_udc.h>
+#include <plat/samsung-time.h>
 
 #include "common.h"
 
@@ -536,6 +537,7 @@ static void __init n30_map_io(void)
 	n30_hwinit();
 	s3c24xx_init_clocks(0);
 	s3c24xx_init_uarts(n30_uartcfgs, ARRAY_SIZE(n30_uartcfgs));
+	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
 }
 
 /* GPB3 is the line that controls the pull-up for the USB D+ line */
@@ -589,7 +591,7 @@ MACHINE_START(N30, "Acer-N30")
 				Ben Dooks <ben-linux@fluff.org>
 	*/
 	.atag_offset	= 0x100,
-	.timer		= &s3c24xx_timer,
+	.timer		= &samsung_timer,
 	.init_machine	= n30_init,
 	.init_irq	= s3c24xx_init_irq,
 	.map_io		= n30_map_io,
@@ -600,7 +602,7 @@ MACHINE_START(N35, "Acer-N35")
 	/* Maintainer: Christer Weinigel <christer@weinigel.se>
 	*/
 	.atag_offset	= 0x100,
-	.timer		= &s3c24xx_timer,
+	.timer		= &samsung_timer,
 	.init_machine	= n30_init,
 	.init_irq	= s3c24xx_init_irq,
 	.map_io		= n30_map_io,
diff --git a/arch/arm/mach-s3c24xx/mach-nexcoder.c b/arch/arm/mach-s3c24xx/mach-nexcoder.c
index a2b92b0..4db6fb3 100644
--- a/arch/arm/mach-s3c24xx/mach-nexcoder.c
+++ b/arch/arm/mach-s3c24xx/mach-nexcoder.c
@@ -46,6 +46,7 @@
 #include <plat/clock.h>
 #include <plat/devs.h>
 #include <plat/cpu.h>
+#include <plat/samsung-time.h>
 
 #include "common.h"
 
@@ -137,6 +138,7 @@ static void __init nexcoder_map_io(void)
 	s3c24xx_init_io(nexcoder_iodesc, ARRAY_SIZE(nexcoder_iodesc));
 	s3c24xx_init_clocks(0);
 	s3c24xx_init_uarts(nexcoder_uartcfgs, ARRAY_SIZE(nexcoder_uartcfgs));
+	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
 
 	nexcoder_sensorboard_init();
 }
@@ -153,6 +155,6 @@ MACHINE_START(NEXCODER_2440, "NexVision - Nexcoder 2440")
 	.map_io		= nexcoder_map_io,
 	.init_machine	= nexcoder_init,
 	.init_irq	= s3c24xx_init_irq,
-	.timer		= &s3c24xx_timer,
+	.timer		= &samsung_timer,
 	.restart	= s3c244x_restart,
 MACHINE_END
diff --git a/arch/arm/mach-s3c24xx/mach-osiris.c b/arch/arm/mach-s3c24xx/mach-osiris.c
index 1eeeee4..c9bd133 100644
--- a/arch/arm/mach-s3c24xx/mach-osiris.c
+++ b/arch/arm/mach-s3c24xx/mach-osiris.c
@@ -44,6 +44,7 @@
 #include <plat/devs.h>
 #include <plat/gpio-cfg.h>
 #include <plat/regs-serial.h>
+#include <plat/samsung-timer.h>
 
 #include <mach/hardware.h>
 #include <mach/regs-gpio.h>
@@ -383,6 +384,7 @@ static void __init osiris_map_io(void)
 	s3c24xx_init_io(osiris_iodesc, ARRAY_SIZE(osiris_iodesc));
 	s3c24xx_init_clocks(0);
 	s3c24xx_init_uarts(osiris_uartcfgs, ARRAY_SIZE(osiris_uartcfgs));
+	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
 
 	/* check for the newer revision boards with large page nand */
 
@@ -425,6 +427,6 @@ MACHINE_START(OSIRIS, "Simtec-OSIRIS")
 	.map_io		= osiris_map_io,
 	.init_irq	= s3c24xx_init_irq,
 	.init_machine	= osiris_init,
-	.timer		= &s3c24xx_timer,
+	.timer		= &samsung_timer,
 	.restart	= s3c244x_restart,
 MACHINE_END
diff --git a/arch/arm/mach-s3c24xx/mach-otom.c b/arch/arm/mach-s3c24xx/mach-otom.c
index 91d8493..f92ef9b 100644
--- a/arch/arm/mach-s3c24xx/mach-otom.c
+++ b/arch/arm/mach-s3c24xx/mach-otom.c
@@ -34,6 +34,7 @@
 #include <plat/devs.h>
 #include <plat/regs-serial.h>
 #include <plat/s3c2410.h>
+#include <plat/samsung-time.h>
 
 #include "common.h"
 #include "otom.h"
@@ -102,6 +103,7 @@ static void __init otom11_map_io(void)
 	s3c24xx_init_io(otom11_iodesc, ARRAY_SIZE(otom11_iodesc));
 	s3c24xx_init_clocks(0);
 	s3c24xx_init_uarts(otom11_uartcfgs, ARRAY_SIZE(otom11_uartcfgs));
+	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
 }
 
 static void __init otom11_init(void)
@@ -116,6 +118,6 @@ MACHINE_START(OTOM, "Nex Vision - Otom 1.1")
 	.map_io		= otom11_map_io,
 	.init_machine	= otom11_init,
 	.init_irq	= s3c24xx_init_irq,
-	.timer		= &s3c24xx_timer,
+	.timer		= &samsung_timer,
 	.restart	= s3c2410_restart,
 MACHINE_END
diff --git a/arch/arm/mach-s3c24xx/mach-qt2410.c b/arch/arm/mach-s3c24xx/mach-qt2410.c
index 7b6ba13..e725554 100644
--- a/arch/arm/mach-s3c24xx/mach-qt2410.c
+++ b/arch/arm/mach-s3c24xx/mach-qt2410.c
@@ -60,6 +60,7 @@
 #include <plat/devs.h>
 #include <plat/cpu.h>
 #include <plat/pm.h>
+#include <plat/samsung-time.h>
 
 #include "common.h"
 
@@ -304,6 +305,7 @@ static void __init qt2410_map_io(void)
 	s3c24xx_init_io(qt2410_iodesc, ARRAY_SIZE(qt2410_iodesc));
 	s3c24xx_init_clocks(12*1000*1000);
 	s3c24xx_init_uarts(smdk2410_uartcfgs, ARRAY_SIZE(smdk2410_uartcfgs));
+	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
 }
 
 static void __init qt2410_machine_init(void)
@@ -343,6 +345,6 @@ MACHINE_START(QT2410, "QT2410")
 	.map_io		= qt2410_map_io,
 	.init_irq	= s3c24xx_init_irq,
 	.init_machine	= qt2410_machine_init,
-	.timer		= &s3c24xx_timer,
+	.timer		= &samsung_timer,
 	.restart	= s3c2410_restart,
 MACHINE_END
diff --git a/arch/arm/mach-s3c24xx/mach-rx1950.c b/arch/arm/mach-s3c24xx/mach-rx1950.c
index c7db767..833cfe2 100644
--- a/arch/arm/mach-s3c24xx/mach-rx1950.c
+++ b/arch/arm/mach-s3c24xx/mach-rx1950.c
@@ -58,6 +58,7 @@
 #include <plat/pm.h>
 #include <plat/regs-iic.h>
 #include <plat/regs-serial.h>
+#include <plat/samsung-time.h>
 
 #include "common.h"
 #include "h1940.h"
@@ -741,6 +742,7 @@ static void __init rx1950_map_io(void)
 	s3c24xx_init_io(rx1950_iodesc, ARRAY_SIZE(rx1950_iodesc));
 	s3c24xx_init_clocks(16934000);
 	s3c24xx_init_uarts(rx1950_uartcfgs, ARRAY_SIZE(rx1950_uartcfgs));
+	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
 
 	/* setup PM */
 
@@ -813,6 +815,6 @@ MACHINE_START(RX1950, "HP iPAQ RX1950")
 	.reserve	= rx1950_reserve,
 	.init_irq = s3c24xx_init_irq,
 	.init_machine = rx1950_init_machine,
-	.timer = &s3c24xx_timer,
+	.timer = &samsung_timer,
 	.restart	= s3c244x_restart,
 MACHINE_END
diff --git a/arch/arm/mach-s3c24xx/mach-rx3715.c b/arch/arm/mach-s3c24xx/mach-rx3715.c
index b261dd3..cf72b44 100644
--- a/arch/arm/mach-s3c24xx/mach-rx3715.c
+++ b/arch/arm/mach-s3c24xx/mach-rx3715.c
@@ -49,6 +49,7 @@
 #include <plat/devs.h>
 #include <plat/pm.h>
 #include <plat/regs-serial.h>
+#include <plat/samsung-time.h>
 
 #include "common.h"
 #include "h1940.h"
@@ -179,6 +180,7 @@ static void __init rx3715_map_io(void)
 	s3c24xx_init_io(rx3715_iodesc, ARRAY_SIZE(rx3715_iodesc));
 	s3c24xx_init_clocks(16934000);
 	s3c24xx_init_uarts(rx3715_uartcfgs, ARRAY_SIZE(rx3715_uartcfgs));
+	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
 }
 
 /* H1940 and RX3715 need to reserve this for suspend */
@@ -212,6 +214,6 @@ MACHINE_START(RX3715, "IPAQ-RX3715")
 	.reserve	= rx3715_reserve,
 	.init_irq	= rx3715_init_irq,
 	.init_machine	= rx3715_init_machine,
-	.timer		= &s3c24xx_timer,
+	.timer		= &samsung_timer,
 	.restart	= s3c244x_restart,
 MACHINE_END
diff --git a/arch/arm/mach-s3c24xx/mach-smdk2410.c b/arch/arm/mach-s3c24xx/mach-smdk2410.c
index 82796b9..c7a18bc 100644
--- a/arch/arm/mach-s3c24xx/mach-smdk2410.c
+++ b/arch/arm/mach-s3c24xx/mach-smdk2410.c
@@ -53,6 +53,7 @@
 #include <plat/cpu.h>
 
 #include <plat/common-smdk.h>
+#include <plat/samsung-time.h>
 
 #include "common.h"
 
@@ -101,6 +102,7 @@ static void __init smdk2410_map_io(void)
 	s3c24xx_init_io(smdk2410_iodesc, ARRAY_SIZE(smdk2410_iodesc));
 	s3c24xx_init_clocks(0);
 	s3c24xx_init_uarts(smdk2410_uartcfgs, ARRAY_SIZE(smdk2410_uartcfgs));
+	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
 }
 
 static void __init smdk2410_init(void)
@@ -117,6 +119,6 @@ MACHINE_START(SMDK2410, "SMDK2410") /* @TODO: request a new identifier and switc
 	.map_io		= smdk2410_map_io,
 	.init_irq	= s3c24xx_init_irq,
 	.init_machine	= smdk2410_init,
-	.timer		= &s3c24xx_timer,
+	.timer		= &samsung_timer,
 	.restart	= s3c2410_restart,
 MACHINE_END
diff --git a/arch/arm/mach-s3c24xx/mach-smdk2413.c b/arch/arm/mach-s3c24xx/mach-smdk2413.c
index b9d5703..454d51b 100644
--- a/arch/arm/mach-s3c24xx/mach-smdk2413.c
+++ b/arch/arm/mach-s3c24xx/mach-smdk2413.c
@@ -46,6 +46,7 @@
 #include <plat/clock.h>
 #include <plat/devs.h>
 #include <plat/cpu.h>
+#include <plat/samsung-time.h>
 
 #include <plat/common-smdk.h>
 
@@ -106,6 +107,7 @@ static void __init smdk2413_map_io(void)
 	s3c24xx_init_io(smdk2413_iodesc, ARRAY_SIZE(smdk2413_iodesc));
 	s3c24xx_init_clocks(12000000);
 	s3c24xx_init_uarts(smdk2413_uartcfgs, ARRAY_SIZE(smdk2413_uartcfgs));
+	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
 }
 
 static void __init smdk2413_machine_init(void)
@@ -132,7 +134,7 @@ MACHINE_START(S3C2413, "S3C2413")
 	.init_irq	= s3c24xx_init_irq,
 	.map_io		= smdk2413_map_io,
 	.init_machine	= smdk2413_machine_init,
-	.timer		= &s3c24xx_timer,
+	.timer		= &samsung_timer,
 	.restart	= s3c2412_restart,
 MACHINE_END
 
@@ -144,7 +146,7 @@ MACHINE_START(SMDK2412, "SMDK2412")
 	.init_irq	= s3c24xx_init_irq,
 	.map_io		= smdk2413_map_io,
 	.init_machine	= smdk2413_machine_init,
-	.timer		= &s3c24xx_timer,
+	.timer		= &samsung_timer,
 	.restart	= s3c2412_restart,
 MACHINE_END
 
@@ -156,6 +158,6 @@ MACHINE_START(SMDK2413, "SMDK2413")
 	.init_irq	= s3c24xx_init_irq,
 	.map_io		= smdk2413_map_io,
 	.init_machine	= smdk2413_machine_init,
-	.timer		= &s3c24xx_timer,
+	.timer		= &samsung_timer,
 	.restart	= s3c2412_restart,
 MACHINE_END
diff --git a/arch/arm/mach-s3c24xx/mach-smdk2416.c b/arch/arm/mach-s3c24xx/mach-smdk2416.c
index 7de4120..ed753e8 100644
--- a/arch/arm/mach-s3c24xx/mach-smdk2416.c
+++ b/arch/arm/mach-s3c24xx/mach-smdk2416.c
@@ -51,6 +51,7 @@
 #include <plat/sdhci.h>
 #include <linux/platform_data/usb-s3c2410_udc.h>
 #include <linux/platform_data/s3c-hsudc.h>
+#include <plat/samsung-time.h>
 
 #include <plat/fb.h>
 
@@ -221,6 +222,7 @@ static void __init smdk2416_map_io(void)
 	s3c24xx_init_io(smdk2416_iodesc, ARRAY_SIZE(smdk2416_iodesc));
 	s3c24xx_init_clocks(12000000);
 	s3c24xx_init_uarts(smdk2416_uartcfgs, ARRAY_SIZE(smdk2416_uartcfgs));
+	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
 }
 
 static void __init smdk2416_machine_init(void)
@@ -253,6 +255,6 @@ MACHINE_START(SMDK2416, "SMDK2416")
 	.init_irq	= s3c24xx_init_irq,
 	.map_io		= smdk2416_map_io,
 	.init_machine	= smdk2416_machine_init,
-	.timer		= &s3c24xx_timer,
+	.timer		= &samsung_timer,
 	.restart	= s3c2416_restart,
 MACHINE_END
diff --git a/arch/arm/mach-s3c24xx/mach-smdk2440.c b/arch/arm/mach-s3c24xx/mach-smdk2440.c
index 0bba786..2b56a4fd 100644
--- a/arch/arm/mach-s3c24xx/mach-smdk2440.c
+++ b/arch/arm/mach-s3c24xx/mach-smdk2440.c
@@ -43,6 +43,7 @@
 #include <plat/clock.h>
 #include <plat/devs.h>
 #include <plat/cpu.h>
+#include <plat/samsung-time.h>
 
 #include <plat/common-smdk.h>
 
@@ -163,6 +164,7 @@ static void __init smdk2440_map_io(void)
 	s3c24xx_init_io(smdk2440_iodesc, ARRAY_SIZE(smdk2440_iodesc));
 	s3c24xx_init_clocks(16934400);
 	s3c24xx_init_uarts(smdk2440_uartcfgs, ARRAY_SIZE(smdk2440_uartcfgs));
+	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
 }
 
 static void __init smdk2440_machine_init(void)
@@ -181,6 +183,6 @@ MACHINE_START(S3C2440, "SMDK2440")
 	.init_irq	= s3c24xx_init_irq,
 	.map_io		= smdk2440_map_io,
 	.init_machine	= smdk2440_machine_init,
-	.timer		= &s3c24xx_timer,
+	.timer		= &samsung_timer,
 	.restart	= s3c244x_restart,
 MACHINE_END
diff --git a/arch/arm/mach-s3c24xx/mach-smdk2443.c b/arch/arm/mach-s3c24xx/mach-smdk2443.c
index c6d1a03..cd50581 100644
--- a/arch/arm/mach-s3c24xx/mach-smdk2443.c
+++ b/arch/arm/mach-s3c24xx/mach-smdk2443.c
@@ -43,6 +43,7 @@
 #include <plat/clock.h>
 #include <plat/devs.h>
 #include <plat/cpu.h>
+#include <plat/samsung-time.h>
 
 #include <plat/common-smdk.h>
 
@@ -122,6 +123,7 @@ static void __init smdk2443_map_io(void)
 	s3c24xx_init_io(smdk2443_iodesc, ARRAY_SIZE(smdk2443_iodesc));
 	s3c24xx_init_clocks(12000000);
 	s3c24xx_init_uarts(smdk2443_uartcfgs, ARRAY_SIZE(smdk2443_uartcfgs));
+	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
 }
 
 static void __init smdk2443_machine_init(void)
@@ -143,6 +145,6 @@ MACHINE_START(SMDK2443, "SMDK2443")
 	.init_irq	= s3c24xx_init_irq,
 	.map_io		= smdk2443_map_io,
 	.init_machine	= smdk2443_machine_init,
-	.timer		= &s3c24xx_timer,
+	.timer		= &samsung_timer,
 	.restart	= s3c2443_restart,
 MACHINE_END
diff --git a/arch/arm/mach-s3c24xx/mach-tct_hammer.c b/arch/arm/mach-s3c24xx/mach-tct_hammer.c
index 495bf5c..90f43c9 100644
--- a/arch/arm/mach-s3c24xx/mach-tct_hammer.c
+++ b/arch/arm/mach-s3c24xx/mach-tct_hammer.c
@@ -53,6 +53,7 @@
 #include <linux/mtd/partitions.h>
 #include <linux/mtd/map.h>
 #include <linux/mtd/physmap.h>
+#include <plat/samsung-time.h>
 
 #include "common.h"
 
@@ -136,6 +137,7 @@ static void __init tct_hammer_map_io(void)
 	s3c24xx_init_io(tct_hammer_iodesc, ARRAY_SIZE(tct_hammer_iodesc));
 	s3c24xx_init_clocks(0);
 	s3c24xx_init_uarts(tct_hammer_uartcfgs, ARRAY_SIZE(tct_hammer_uartcfgs));
+	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
 }
 
 static void __init tct_hammer_init(void)
@@ -149,6 +151,6 @@ MACHINE_START(TCT_HAMMER, "TCT_HAMMER")
 	.map_io		= tct_hammer_map_io,
 	.init_irq	= s3c24xx_init_irq,
 	.init_machine	= tct_hammer_init,
-	.timer		= &s3c24xx_timer,
+	.timer		= &samsung_timer,
 	.restart	= s3c2410_restart,
 MACHINE_END
diff --git a/arch/arm/mach-s3c24xx/mach-vr1000.c b/arch/arm/mach-s3c24xx/mach-vr1000.c
index d4db385..d1fe2d1 100644
--- a/arch/arm/mach-s3c24xx/mach-vr1000.c
+++ b/arch/arm/mach-s3c24xx/mach-vr1000.c
@@ -45,6 +45,7 @@
 #include <plat/cpu.h>
 #include <plat/devs.h>
 #include <plat/regs-serial.h>
+#include <plat/samsung-time.h>
 
 #include "bast.h"
 #include "common.h"
@@ -332,6 +333,7 @@ static void __init vr1000_map_io(void)
 	s3c24xx_init_io(vr1000_iodesc, ARRAY_SIZE(vr1000_iodesc));
 	s3c24xx_init_clocks(0);
 	s3c24xx_init_uarts(vr1000_uartcfgs, ARRAY_SIZE(vr1000_uartcfgs));
+	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
 }
 
 static void __init vr1000_init(void)
@@ -354,6 +356,6 @@ MACHINE_START(VR1000, "Thorcom-VR1000")
 	.map_io		= vr1000_map_io,
 	.init_machine	= vr1000_init,
 	.init_irq	= s3c24xx_init_irq,
-	.timer		= &s3c24xx_timer,
+	.timer		= &samsung_timer,
 	.restart	= s3c2410_restart,
 MACHINE_END
diff --git a/arch/arm/mach-s3c24xx/mach-vstms.c b/arch/arm/mach-s3c24xx/mach-vstms.c
index eef559c..0ad2f74 100644
--- a/arch/arm/mach-s3c24xx/mach-vstms.c
+++ b/arch/arm/mach-s3c24xx/mach-vstms.c
@@ -46,7 +46,7 @@
 #include <plat/clock.h>
 #include <plat/devs.h>
 #include <plat/cpu.h>
-
+#include <plat/samsung-time.h>
 
 static struct map_desc vstms_iodesc[] __initdata = {
 };
@@ -143,6 +143,7 @@ static void __init vstms_map_io(void)
 	s3c24xx_init_io(vstms_iodesc, ARRAY_SIZE(vstms_iodesc));
 	s3c24xx_init_clocks(12000000);
 	s3c24xx_init_uarts(vstms_uartcfgs, ARRAY_SIZE(vstms_uartcfgs));
+	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
 }
 
 static void __init vstms_init(void)
@@ -160,6 +161,6 @@ MACHINE_START(VSTMS, "VSTMS")
 	.init_irq	= s3c24xx_init_irq,
 	.init_machine	= vstms_init,
 	.map_io		= vstms_map_io,
-	.timer		= &s3c24xx_timer,
+	.timer		= &samsung_timer,
 	.restart	= s3c2412_restart,
 MACHINE_END
diff --git a/arch/arm/plat-samsung/include/plat/cpu.h b/arch/arm/plat-samsung/include/plat/cpu.h
index b69e11d..d585e70 100644
--- a/arch/arm/plat-samsung/include/plat/cpu.h
+++ b/arch/arm/plat-samsung/include/plat/cpu.h
@@ -192,7 +192,7 @@ extern void s3c24xx_init_uartdevs(char *name,
 				  struct s3c24xx_uart_resources *res,
 				  struct s3c2410_uartcfg *cfg, int no);
 
-/* timer for 2410/2440 */
+/* timer for s5pc100 only */
 
 struct sys_timer;
 extern struct sys_timer s3c24xx_timer;
diff --git a/arch/arm/plat-samsung/include/plat/samsung-time.h b/arch/arm/plat-samsung/include/plat/samsung-time.h
index 9d6d622..13ae4b9 100644
--- a/arch/arm/plat-samsung/include/plat/samsung-time.h
+++ b/arch/arm/plat-samsung/include/plat/samsung-time.h
@@ -30,7 +30,18 @@ struct samsung_timer_source {
 /* Be able to sleep for atleast 4 seconds (usually more) */
 #define SAMSUNG_TIMER_MIN_RANGE	4
 
+#ifdef CONFIG_ARCH_S3C24XX
+#define TCNT_MAX		0xffff
+#define TSCALER_DIV		25
+#define TDIV			50
+#define TSIZE			16
+#else
 #define TCNT_MAX		0xffffffff
+#define TSCALER_DIV		2
+#define TDIV			2
+#define TSIZE			32
+#endif
+
 #define NON_PERIODIC		0
 #define PERIODIC		1
 
diff --git a/arch/arm/plat-samsung/samsung-time.c b/arch/arm/plat-samsung/samsung-time.c
index 91773bf..6d63fca 100644
--- a/arch/arm/plat-samsung/samsung-time.c
+++ b/arch/arm/plat-samsung/samsung-time.c
@@ -2,7 +2,7 @@
  * Copyright (c) 2011 Samsung Electronics Co., Ltd.
  *		http://www.samsung.com/
  *
- * SAMSUNG - Common hr-timer support
+ * samsung - Common hr-timer support (s3c and s5p)
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License version 2 as
@@ -267,8 +267,8 @@ static void __init samsung_clockevent_init(void)
 
 	tscaler = clk_get_parent(tdiv_event);
 
-	clk_set_rate(tscaler, pclk / 2);
-	clk_set_rate(tdiv_event, pclk / 2);
+	clk_set_rate(tscaler, pclk / TSCALER_DIV);
+	clk_set_rate(tdiv_event, pclk / TDIV);
 	clk_set_parent(tin_event, tdiv_event);
 
 	clock_rate = clk_get_rate(tin_event);
@@ -336,7 +336,7 @@ static void __init samsung_clocksource_init(void)
 
 	pclk = clk_get_rate(timerclk);
 
-	clk_set_rate(tdiv_source, pclk / 2);
+	clk_set_rate(tdiv_source, pclk / TDIV);
 	clk_set_parent(tin_source, tdiv_source);
 
 	clock_rate = clk_get_rate(tin_source);
@@ -344,10 +344,10 @@ static void __init samsung_clocksource_init(void)
 	samsung_time_setup(timer_source.source_id, TCNT_MAX);
 	samsung_time_start(timer_source.source_id, PERIODIC);
 
-	setup_sched_clock(samsung_read_sched_clock, 32, clock_rate);
+	setup_sched_clock(samsung_read_sched_clock, TSIZE, clock_rate);
 
 	if (clocksource_mmio_init(samsung_timer_reg(), "samsung_clocksource_timer",
-			clock_rate, 250, 32, clocksource_mmio_readl_down))
+			clock_rate, 250, TSIZE, clocksource_mmio_readl_down))
 		panic("samsung_clocksource_timer: can't register clocksource\n");
 }
 
-- 
1.8.0.3

^ permalink raw reply related	[flat|nested] 39+ messages in thread

* [PATCH 3/5 v3] Add samsung-time support for s3c64xx
  2013-01-08 21:00                   ` Tomasz Figa
                                       ` (3 preceding siblings ...)
  2013-01-09 22:43                     ` [PATCH 2/5 v3] Add samsung-time support for s3c24xx Romain Naour
@ 2013-01-09 22:44                     ` Romain Naour
  2013-01-09 22:44                     ` [PATCH 4/5 v3] Add samsung-time support for s5pc100 Romain Naour
  2013-01-09 22:44                     ` [PATCH 5/5 v3] Remove unused plat-samsung/time.c Romain Naour
  6 siblings, 0 replies; 39+ messages in thread
From: Romain Naour @ 2013-01-09 22:44 UTC (permalink / raw)
  To: Tomasz Figa
  Cc: Heiko Stübner, Kukjin Kim, linux-samsung-soc, ben-linux,
	'Sylwester Nawrocki'



Signed-off-by: Naour Romain <romain.naour@openwide.fr>
---
 arch/arm/Kconfig                      | 3 ++-
 arch/arm/mach-s3c64xx/Kconfig         | 2 ++
 arch/arm/mach-s3c64xx/mach-anw6410.c  | 4 +++-
 arch/arm/mach-s3c64xx/mach-crag6410.c | 4 +++-
 arch/arm/mach-s3c64xx/mach-hmt.c      | 4 +++-
 arch/arm/mach-s3c64xx/mach-mini6410.c | 4 +++-
 arch/arm/mach-s3c64xx/mach-ncp.c      | 4 +++-
 arch/arm/mach-s3c64xx/mach-real6410.c | 4 +++-
 arch/arm/mach-s3c64xx/mach-smartq.c   | 2 ++
 arch/arm/mach-s3c64xx/mach-smartq5.c  | 3 ++-
 arch/arm/mach-s3c64xx/mach-smartq7.c  | 3 ++-
 arch/arm/mach-s3c64xx/mach-smdk6400.c | 4 +++-
 arch/arm/mach-s3c64xx/mach-smdk6410.c | 4 +++-
 13 files changed, 34 insertions(+), 11 deletions(-)

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 2796959..7d0cf39 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -763,10 +763,11 @@ config ARCH_S3C64XX
 	bool "Samsung S3C64XX"
 	select ARCH_HAS_CPUFREQ
 	select ARCH_REQUIRE_GPIOLIB
-	select ARCH_USES_GETTIMEOFFSET
 	select ARM_VIC
 	select CLKDEV_LOOKUP
+	select CLKSRC_MMIO
 	select CPU_V6
+	select GENERIC_CLOCKEVENTS
 	select HAVE_CLK
 	select HAVE_S3C2410_I2C if I2C
 	select HAVE_S3C2410_WATCHDOG if WATCHDOG
diff --git a/arch/arm/mach-s3c64xx/Kconfig b/arch/arm/mach-s3c64xx/Kconfig
index 131c862..283cb77 100644
--- a/arch/arm/mach-s3c64xx/Kconfig
+++ b/arch/arm/mach-s3c64xx/Kconfig
@@ -17,11 +17,13 @@ config PLAT_S3C64XX
 # Configuration options for the S3C6410 CPU
 
 config CPU_S3C6400
+	select SAMSUNG_HRT
 	bool
 	help
 	  Enable S3C6400 CPU support
 
 config CPU_S3C6410
+	select SAMSUNG_HRT
 	bool
 	help
 	  Enable S3C6410 CPU support
diff --git a/arch/arm/mach-s3c64xx/mach-anw6410.c b/arch/arm/mach-s3c64xx/mach-anw6410.c
index dac03ab..be07df0 100644
--- a/arch/arm/mach-s3c64xx/mach-anw6410.c
+++ b/arch/arm/mach-s3c64xx/mach-anw6410.c
@@ -50,6 +50,7 @@
 #include <plat/devs.h>
 #include <plat/cpu.h>
 #include <mach/regs-gpio.h>
+#include <plat/samsung-time.h>
 
 #include "common.h"
 #include "regs-modem.h"
@@ -209,6 +210,7 @@ static void __init anw6410_map_io(void)
 	s3c64xx_init_io(anw6410_iodesc, ARRAY_SIZE(anw6410_iodesc));
 	s3c24xx_init_clocks(12000000);
 	s3c24xx_init_uarts(anw6410_uartcfgs, ARRAY_SIZE(anw6410_uartcfgs));
+	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
 
 	anw6410_lcd_mode_set();
 }
@@ -234,6 +236,6 @@ MACHINE_START(ANW6410, "A&W6410")
 	.map_io		= anw6410_map_io,
 	.init_machine	= anw6410_machine_init,
 	.init_late	= s3c64xx_init_late,
-	.timer		= &s3c24xx_timer,
+	.timer		= &samsung_timer,
 	.restart	= s3c64xx_restart,
 MACHINE_END
diff --git a/arch/arm/mach-s3c64xx/mach-crag6410.c b/arch/arm/mach-s3c64xx/mach-crag6410.c
index 8b89e89..5de6a12 100644
--- a/arch/arm/mach-s3c64xx/mach-crag6410.c
+++ b/arch/arm/mach-s3c64xx/mach-crag6410.c
@@ -65,6 +65,7 @@
 #include <plat/adc.h>
 #include <linux/platform_data/i2c-s3c2410.h>
 #include <plat/pm.h>
+#include <plat/samsung-time.h>
 
 #include "common.h"
 #include "crag6410.h"
@@ -745,6 +746,7 @@ static void __init crag6410_map_io(void)
 	s3c64xx_init_io(NULL, 0);
 	s3c24xx_init_clocks(12000000);
 	s3c24xx_init_uarts(crag6410_uartcfgs, ARRAY_SIZE(crag6410_uartcfgs));
+	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
 
 	/* LCD type and Bypass set by bootloader */
 }
@@ -870,6 +872,6 @@ MACHINE_START(WLF_CRAGG_6410, "Wolfson Cragganmore 6410")
 	.map_io		= crag6410_map_io,
 	.init_machine	= crag6410_machine_init,
 	.init_late	= s3c64xx_init_late,
-	.timer		= &s3c24xx_timer,
+	.timer		= &samsung_timer,
 	.restart	= s3c64xx_restart,
 MACHINE_END
diff --git a/arch/arm/mach-s3c64xx/mach-hmt.c b/arch/arm/mach-s3c64xx/mach-hmt.c
index 2b14489..39f733b 100644
--- a/arch/arm/mach-s3c64xx/mach-hmt.c
+++ b/arch/arm/mach-s3c64xx/mach-hmt.c
@@ -42,6 +42,7 @@
 #include <plat/clock.h>
 #include <plat/devs.h>
 #include <plat/cpu.h>
+#include <plat/samsung-time.h>
 
 #include "common.h"
 
@@ -249,6 +250,7 @@ static void __init hmt_map_io(void)
 	s3c64xx_init_io(hmt_iodesc, ARRAY_SIZE(hmt_iodesc));
 	s3c24xx_init_clocks(12000000);
 	s3c24xx_init_uarts(hmt_uartcfgs, ARRAY_SIZE(hmt_uartcfgs));
+	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
 }
 
 static void __init hmt_machine_init(void)
@@ -277,6 +279,6 @@ MACHINE_START(HMT, "Airgoo-HMT")
 	.map_io		= hmt_map_io,
 	.init_machine	= hmt_machine_init,
 	.init_late	= s3c64xx_init_late,
-	.timer		= &s3c24xx_timer,
+	.timer		= &samsung_timer,
 	.restart	= s3c64xx_restart,
 MACHINE_END
diff --git a/arch/arm/mach-s3c64xx/mach-mini6410.c b/arch/arm/mach-s3c64xx/mach-mini6410.c
index 7cec86c..f7d2533 100644
--- a/arch/arm/mach-s3c64xx/mach-mini6410.c
+++ b/arch/arm/mach-s3c64xx/mach-mini6410.c
@@ -42,6 +42,7 @@
 
 #include <video/platform_lcd.h>
 #include <video/samsung_fimd.h>
+#include <plat/samsung-time.h>
 
 #include "common.h"
 #include "regs-modem.h"
@@ -233,6 +234,7 @@ static void __init mini6410_map_io(void)
 	s3c64xx_init_io(NULL, 0);
 	s3c24xx_init_clocks(12000000);
 	s3c24xx_init_uarts(mini6410_uartcfgs, ARRAY_SIZE(mini6410_uartcfgs));
+	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
 
 	/* set the LCD type */
 	tmp = __raw_readl(S3C64XX_SPCON);
@@ -356,6 +358,6 @@ MACHINE_START(MINI6410, "MINI6410")
 	.map_io		= mini6410_map_io,
 	.init_machine	= mini6410_machine_init,
 	.init_late	= s3c64xx_init_late,
-	.timer		= &s3c24xx_timer,
+	.timer		= &samsung_timer,
 	.restart	= s3c64xx_restart,
 MACHINE_END
diff --git a/arch/arm/mach-s3c64xx/mach-ncp.c b/arch/arm/mach-s3c64xx/mach-ncp.c
index e5f9a79..16a09e0 100644
--- a/arch/arm/mach-s3c64xx/mach-ncp.c
+++ b/arch/arm/mach-s3c64xx/mach-ncp.c
@@ -44,6 +44,7 @@
 #include <plat/clock.h>
 #include <plat/devs.h>
 #include <plat/cpu.h>
+#include <plat/samsung-time.h>
 
 #include "common.h"
 
@@ -88,6 +89,7 @@ static void __init ncp_map_io(void)
 	s3c64xx_init_io(ncp_iodesc, ARRAY_SIZE(ncp_iodesc));
 	s3c24xx_init_clocks(12000000);
 	s3c24xx_init_uarts(ncp_uartcfgs, ARRAY_SIZE(ncp_uartcfgs));
+	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
 }
 
 static void __init ncp_machine_init(void)
@@ -105,6 +107,6 @@ MACHINE_START(NCP, "NCP")
 	.map_io		= ncp_map_io,
 	.init_machine	= ncp_machine_init,
 	.init_late	= s3c64xx_init_late,
-	.timer		= &s3c24xx_timer,
+	.timer		= &samsung_timer,
 	.restart	= s3c64xx_restart,
 MACHINE_END
diff --git a/arch/arm/mach-s3c64xx/mach-real6410.c b/arch/arm/mach-s3c64xx/mach-real6410.c
index 215693c..d353b91 100644
--- a/arch/arm/mach-s3c64xx/mach-real6410.c
+++ b/arch/arm/mach-s3c64xx/mach-real6410.c
@@ -43,6 +43,7 @@
 
 #include <video/platform_lcd.h>
 #include <video/samsung_fimd.h>
+#include <plat/samsung-time.h>
 
 #include "common.h"
 #include "regs-modem.h"
@@ -212,6 +213,7 @@ static void __init real6410_map_io(void)
 	s3c64xx_init_io(NULL, 0);
 	s3c24xx_init_clocks(12000000);
 	s3c24xx_init_uarts(real6410_uartcfgs, ARRAY_SIZE(real6410_uartcfgs));
+	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
 
 	/* set the LCD type */
 	tmp = __raw_readl(S3C64XX_SPCON);
@@ -335,6 +337,6 @@ MACHINE_START(REAL6410, "REAL6410")
 	.map_io		= real6410_map_io,
 	.init_machine	= real6410_machine_init,
 	.init_late	= s3c64xx_init_late,
-	.timer		= &s3c24xx_timer,
+	.timer		= &samsung_timer,
 	.restart	= s3c64xx_restart,
 MACHINE_END
diff --git a/arch/arm/mach-s3c64xx/mach-smartq.c b/arch/arm/mach-s3c64xx/mach-smartq.c
index fc3e9b3..58ac990 100644
--- a/arch/arm/mach-s3c64xx/mach-smartq.c
+++ b/arch/arm/mach-s3c64xx/mach-smartq.c
@@ -38,6 +38,7 @@
 #include <linux/platform_data/touchscreen-s3c2410.h>
 
 #include <video/platform_lcd.h>
+#include <plat/samsung-time.h>
 
 #include "common.h"
 #include "regs-modem.h"
@@ -378,6 +379,7 @@ void __init smartq_map_io(void)
 	s3c64xx_init_io(smartq_iodesc, ARRAY_SIZE(smartq_iodesc));
 	s3c24xx_init_clocks(12000000);
 	s3c24xx_init_uarts(smartq_uartcfgs, ARRAY_SIZE(smartq_uartcfgs));
+	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
 
 	smartq_lcd_mode_set();
 }
diff --git a/arch/arm/mach-s3c64xx/mach-smartq5.c b/arch/arm/mach-s3c64xx/mach-smartq5.c
index 96d6da2..d6c0a11 100644
--- a/arch/arm/mach-s3c64xx/mach-smartq5.c
+++ b/arch/arm/mach-s3c64xx/mach-smartq5.c
@@ -29,6 +29,7 @@
 #include <plat/devs.h>
 #include <plat/fb.h>
 #include <plat/gpio-cfg.h>
+#include <plat/samsung-time.h>
 
 #include "common.h"
 #include "mach-smartq.h"
@@ -157,6 +158,6 @@ MACHINE_START(SMARTQ5, "SmartQ 5")
 	.map_io		= smartq_map_io,
 	.init_machine	= smartq5_machine_init,
 	.init_late	= s3c64xx_init_late,
-	.timer		= &s3c24xx_timer,
+	.timer		= &samsung_timer,
 	.restart	= s3c64xx_restart,
 MACHINE_END
diff --git a/arch/arm/mach-s3c64xx/mach-smartq7.c b/arch/arm/mach-s3c64xx/mach-smartq7.c
index 7d1167b..00ec516 100644
--- a/arch/arm/mach-s3c64xx/mach-smartq7.c
+++ b/arch/arm/mach-s3c64xx/mach-smartq7.c
@@ -29,6 +29,7 @@
 #include <plat/devs.h>
 #include <plat/fb.h>
 #include <plat/gpio-cfg.h>
+#include <plat/samsung-time.h>
 
 #include "common.h"
 #include "mach-smartq.h"
@@ -173,6 +174,6 @@ MACHINE_START(SMARTQ7, "SmartQ 7")
 	.map_io		= smartq_map_io,
 	.init_machine	= smartq7_machine_init,
 	.init_late	= s3c64xx_init_late,
-	.timer		= &s3c24xx_timer,
+	.timer		= &samsung_timer,
 	.restart	= s3c64xx_restart,
 MACHINE_END
diff --git a/arch/arm/mach-s3c64xx/mach-smdk6400.c b/arch/arm/mach-s3c64xx/mach-smdk6400.c
index a928fae..4382417 100644
--- a/arch/arm/mach-s3c64xx/mach-smdk6400.c
+++ b/arch/arm/mach-s3c64xx/mach-smdk6400.c
@@ -36,6 +36,7 @@
 #include <plat/devs.h>
 #include <plat/cpu.h>
 #include <linux/platform_data/i2c-s3c2410.h>
+#include <plat/samsung-time.h>
 
 #include "common.h"
 
@@ -67,6 +68,7 @@ static void __init smdk6400_map_io(void)
 	s3c64xx_init_io(smdk6400_iodesc, ARRAY_SIZE(smdk6400_iodesc));
 	s3c24xx_init_clocks(12000000);
 	s3c24xx_init_uarts(smdk6400_uartcfgs, ARRAY_SIZE(smdk6400_uartcfgs));
+	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
 }
 
 static struct platform_device *smdk6400_devices[] __initdata = {
@@ -94,6 +96,6 @@ MACHINE_START(SMDK6400, "SMDK6400")
 	.map_io		= smdk6400_map_io,
 	.init_machine	= smdk6400_machine_init,
 	.init_late	= s3c64xx_init_late,
-	.timer		= &s3c24xx_timer,
+	.timer		= &samsung_timer,
 	.restart	= s3c64xx_restart,
 MACHINE_END
diff --git a/arch/arm/mach-s3c64xx/mach-smdk6410.c b/arch/arm/mach-s3c64xx/mach-smdk6410.c
index ddd0eb8..54fce4f 100644
--- a/arch/arm/mach-s3c64xx/mach-smdk6410.c
+++ b/arch/arm/mach-s3c64xx/mach-smdk6410.c
@@ -70,6 +70,7 @@
 #include <linux/platform_data/touchscreen-s3c2410.h>
 #include <plat/keypad.h>
 #include <plat/backlight.h>
+#include <plat/samsung-time.h>
 
 #include "common.h"
 #include "regs-modem.h"
@@ -635,6 +636,7 @@ static void __init smdk6410_map_io(void)
 	s3c64xx_init_io(smdk6410_iodesc, ARRAY_SIZE(smdk6410_iodesc));
 	s3c24xx_init_clocks(12000000);
 	s3c24xx_init_uarts(smdk6410_uartcfgs, ARRAY_SIZE(smdk6410_uartcfgs));
+	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
 
 	/* set the LCD type */
 
@@ -704,6 +706,6 @@ MACHINE_START(SMDK6410, "SMDK6410")
 	.map_io		= smdk6410_map_io,
 	.init_machine	= smdk6410_machine_init,
 	.init_late	= s3c64xx_init_late,
-	.timer		= &s3c24xx_timer,
+	.timer		= &samsung_timer,
 	.restart	= s3c64xx_restart,
 MACHINE_END
-- 
1.8.0.3

^ permalink raw reply related	[flat|nested] 39+ messages in thread

* [PATCH 4/5 v3] Add samsung-time support for s5pc100
  2013-01-08 21:00                   ` Tomasz Figa
                                       ` (4 preceding siblings ...)
  2013-01-09 22:44                     ` [PATCH 3/5 v3] Add samsung-time support for s3c64xx Romain Naour
@ 2013-01-09 22:44                     ` Romain Naour
  2013-01-09 22:44                     ` [PATCH 5/5 v3] Remove unused plat-samsung/time.c Romain Naour
  6 siblings, 0 replies; 39+ messages in thread
From: Romain Naour @ 2013-01-09 22:44 UTC (permalink / raw)
  To: Tomasz Figa
  Cc: Heiko Stübner, Kukjin Kim, linux-samsung-soc, ben-linux,
	'Sylwester Nawrocki'



Signed-off-by: Naour Romain <romain.naour@openwide.fr>
---
 arch/arm/Kconfig                                  | 3 ++-
 arch/arm/mach-s5pc100/Kconfig                     | 1 +
 arch/arm/mach-s5pc100/mach-smdkc100.c             | 4 +++-
 arch/arm/plat-samsung/include/plat/samsung-time.h | 2 +-
 4 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 7d0cf39..1fd5769 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -802,9 +802,10 @@ config ARCH_S5P64X0
 
 config ARCH_S5PC100
 	bool "Samsung S5PC100"
-	select ARCH_USES_GETTIMEOFFSET
 	select CLKDEV_LOOKUP
+	select CLKSRC_MMIO
 	select CPU_V7
+	select GENERIC_CLOCKEVENTS
 	select GENERIC_GPIO
 	select HAVE_CLK
 	select HAVE_S3C2410_I2C if I2C
diff --git a/arch/arm/mach-s5pc100/Kconfig b/arch/arm/mach-s5pc100/Kconfig
index 15170be..2f456a4 100644
--- a/arch/arm/mach-s5pc100/Kconfig
+++ b/arch/arm/mach-s5pc100/Kconfig
@@ -11,6 +11,7 @@ config CPU_S5PC100
 	bool
 	select S5P_EXT_INT
 	select SAMSUNG_DMADEV
+	select SAMSUNG_HRT
 	help
 	  Enable S5PC100 CPU support
 
diff --git a/arch/arm/mach-s5pc100/mach-smdkc100.c b/arch/arm/mach-s5pc100/mach-smdkc100.c
index 9abe95e..f4aeb23 100644
--- a/arch/arm/mach-s5pc100/mach-smdkc100.c
+++ b/arch/arm/mach-s5pc100/mach-smdkc100.c
@@ -52,6 +52,7 @@
 #include <linux/platform_data/touchscreen-s3c2410.h>
 #include <linux/platform_data/asoc-s3c.h>
 #include <plat/backlight.h>
+#include <plat/samsung-time.h>
 
 #include "common.h"
 
@@ -222,6 +223,7 @@ static void __init smdkc100_map_io(void)
 	s5pc100_init_io(NULL, 0);
 	s3c24xx_init_clocks(12000000);
 	s3c24xx_init_uarts(smdkc100_uartcfgs, ARRAY_SIZE(smdkc100_uartcfgs));
+	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
 }
 
 static void __init smdkc100_machine_init(void)
@@ -257,6 +259,6 @@ MACHINE_START(SMDKC100, "SMDKC100")
 	.handle_irq	= vic_handle_irq,
 	.map_io		= smdkc100_map_io,
 	.init_machine	= smdkc100_machine_init,
-	.timer		= &s3c24xx_timer,
+	.timer		= &samsung_timer,
 	.restart	= s5pc100_restart,
 MACHINE_END
diff --git a/arch/arm/plat-samsung/include/plat/samsung-time.h b/arch/arm/plat-samsung/include/plat/samsung-time.h
index 13ae4b9..66363e8 100644
--- a/arch/arm/plat-samsung/include/plat/samsung-time.h
+++ b/arch/arm/plat-samsung/include/plat/samsung-time.h
@@ -30,7 +30,7 @@ struct samsung_timer_source {
 /* Be able to sleep for atleast 4 seconds (usually more) */
 #define SAMSUNG_TIMER_MIN_RANGE	4
 
-#ifdef CONFIG_ARCH_S3C24XX
+#if defined(CONFIG_ARCH_S3C24XX) || defined(CONFIG_ARCH_S5PC100)
 #define TCNT_MAX		0xffff
 #define TSCALER_DIV		25
 #define TDIV			50
-- 
1.8.0.3

^ permalink raw reply related	[flat|nested] 39+ messages in thread

* [PATCH 5/5 v3] Remove unused plat-samsung/time.c
  2013-01-08 21:00                   ` Tomasz Figa
                                       ` (5 preceding siblings ...)
  2013-01-09 22:44                     ` [PATCH 4/5 v3] Add samsung-time support for s5pc100 Romain Naour
@ 2013-01-09 22:44                     ` Romain Naour
  6 siblings, 0 replies; 39+ messages in thread
From: Romain Naour @ 2013-01-09 22:44 UTC (permalink / raw)
  To: Tomasz Figa
  Cc: Heiko Stübner, Kukjin Kim, linux-samsung-soc, ben-linux,
	'Sylwester Nawrocki'



Signed-off-by: Naour Romain <romain.naour@openwide.fr>
---
 arch/arm/plat-samsung/Makefile           |   1 -
 arch/arm/plat-samsung/include/plat/cpu.h |   5 -
 arch/arm/plat-samsung/time.c             | 285 -------------------------------
 3 files changed, 291 deletions(-)
 delete mode 100644 arch/arm/plat-samsung/time.c

diff --git a/arch/arm/plat-samsung/Makefile b/arch/arm/plat-samsung/Makefile
index e1244eb..a23c460 100644
--- a/arch/arm/plat-samsung/Makefile
+++ b/arch/arm/plat-samsung/Makefile
@@ -12,7 +12,6 @@ obj-				:=
 # Objects we always build independent of SoC choice
 
 obj-y				+= init.o cpu.o
-obj-$(CONFIG_ARCH_USES_GETTIMEOFFSET)   += time.o
 obj-$(CONFIG_SAMSUNG_HRT) 	+= samsung-time.o
 
 obj-$(CONFIG_SAMSUNG_CLOCK)	+= clock.o
diff --git a/arch/arm/plat-samsung/include/plat/cpu.h b/arch/arm/plat-samsung/include/plat/cpu.h
index d585e70..e126644 100644
--- a/arch/arm/plat-samsung/include/plat/cpu.h
+++ b/arch/arm/plat-samsung/include/plat/cpu.h
@@ -192,11 +192,6 @@ extern void s3c24xx_init_uartdevs(char *name,
 				  struct s3c24xx_uart_resources *res,
 				  struct s3c2410_uartcfg *cfg, int no);
 
-/* timer for s5pc100 only */
-
-struct sys_timer;
-extern struct sys_timer s3c24xx_timer;
-
 extern struct syscore_ops s3c2410_pm_syscore_ops;
 extern struct syscore_ops s3c2412_pm_syscore_ops;
 extern struct syscore_ops s3c2416_pm_syscore_ops;
diff --git a/arch/arm/plat-samsung/time.c b/arch/arm/plat-samsung/time.c
deleted file mode 100644
index 60552e2..0000000
--- a/arch/arm/plat-samsung/time.c
+++ /dev/null
@@ -1,285 +0,0 @@
-/* linux/arch/arm/plat-samsung/time.c
- *
- * Copyright (C) 2003-2005 Simtec Electronics
- *	Ben Dooks, <ben@simtec.co.uk>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- */
-
-#include <linux/kernel.h>
-#include <linux/sched.h>
-#include <linux/init.h>
-#include <linux/interrupt.h>
-#include <linux/irq.h>
-#include <linux/err.h>
-#include <linux/clk.h>
-#include <linux/io.h>
-#include <linux/platform_device.h>
-
-#include <asm/mach-types.h>
-
-#include <asm/irq.h>
-#include <mach/map.h>
-#include <plat/regs-timer.h>
-#include <mach/regs-irq.h>
-#include <asm/mach/time.h>
-#include <mach/tick.h>
-
-#include <plat/clock.h>
-#include <plat/cpu.h>
-
-static unsigned long timer_startval;
-static unsigned long timer_usec_ticks;
-
-#ifndef TICK_MAX
-#define TICK_MAX (0xffff)
-#endif
-
-#define TIMER_USEC_SHIFT 16
-
-/* we use the shifted arithmetic to work out the ratio of timer ticks
- * to usecs, as often the peripheral clock is not a nice even multiple
- * of 1MHz.
- *
- * shift of 14 and 15 are too low for the 12MHz, 16 seems to be ok
- * for the current HZ value of 200 without producing overflows.
- *
- * Original patch by Dimitry Andric, updated by Ben Dooks
-*/
-
-
-/* timer_mask_usec_ticks
- *
- * given a clock and divisor, make the value to pass into timer_ticks_to_usec
- * to scale the ticks into usecs
-*/
-
-static inline unsigned long
-timer_mask_usec_ticks(unsigned long scaler, unsigned long pclk)
-{
-	unsigned long den = pclk / 1000;
-
-	return ((1000 << TIMER_USEC_SHIFT) * scaler + (den >> 1)) / den;
-}
-
-/* timer_ticks_to_usec
- *
- * convert timer ticks to usec.
-*/
-
-static inline unsigned long timer_ticks_to_usec(unsigned long ticks)
-{
-	unsigned long res;
-
-	res = ticks * timer_usec_ticks;
-	res += 1 << (TIMER_USEC_SHIFT - 4);	/* round up slightly */
-
-	return res >> TIMER_USEC_SHIFT;
-}
-
-/***
- * Returns microsecond  since last clock interrupt.  Note that interrupts
- * will have been disabled by do_gettimeoffset()
- * IRQs are disabled before entering here from do_gettimeofday()
- */
-
-static unsigned long s3c2410_gettimeoffset (void)
-{
-	unsigned long tdone;
-	unsigned long tval;
-
-	/* work out how many ticks have gone since last timer interrupt */
-
-	tval =  __raw_readl(S3C2410_TCNTO(4));
-	tdone = timer_startval - tval;
-
-	/* check to see if there is an interrupt pending */
-
-	if (s3c24xx_ostimer_pending()) {
-		/* re-read the timer, and try and fix up for the missed
-		 * interrupt. Note, the interrupt may go off before the
-		 * timer has re-loaded from wrapping.
-		 */
-
-		tval =  __raw_readl(S3C2410_TCNTO(4));
-		tdone = timer_startval - tval;
-
-		if (tval != 0)
-			tdone += timer_startval;
-	}
-
-	return timer_ticks_to_usec(tdone);
-}
-
-
-/*
- * IRQ handler for the timer
- */
-static irqreturn_t
-s3c2410_timer_interrupt(int irq, void *dev_id)
-{
-	timer_tick();
-	return IRQ_HANDLED;
-}
-
-static struct irqaction s3c2410_timer_irq = {
-	.name		= "S3C2410 Timer Tick",
-	.flags		= IRQF_DISABLED | IRQF_TIMER | IRQF_IRQPOLL,
-	.handler	= s3c2410_timer_interrupt,
-};
-
-#define use_tclk1_12() ( \
-	machine_is_bast()	|| \
-	machine_is_vr1000()	|| \
-	machine_is_anubis()	|| \
-	machine_is_osiris())
-
-static struct clk *tin;
-static struct clk *tdiv;
-static struct clk *timerclk;
-
-/*
- * Set up timer interrupt, and return the current time in seconds.
- *
- * Currently we only use timer4, as it is the only timer which has no
- * other function that can be exploited externally
- */
-static void s3c2410_timer_setup (void)
-{
-	unsigned long tcon;
-	unsigned long tcnt;
-	unsigned long tcfg1;
-	unsigned long tcfg0;
-
-	tcnt = TICK_MAX;  /* default value for tcnt */
-
-	/* configure the system for whichever machine is in use */
-
-	if (use_tclk1_12()) {
-		/* timer is at 12MHz, scaler is 1 */
-		timer_usec_ticks = timer_mask_usec_ticks(1, 12000000);
-		tcnt = 12000000 / HZ;
-
-		tcfg1 = __raw_readl(S3C2410_TCFG1);
-		tcfg1 &= ~S3C2410_TCFG1_MUX4_MASK;
-		tcfg1 |= S3C2410_TCFG1_MUX4_TCLK1;
-		__raw_writel(tcfg1, S3C2410_TCFG1);
-	} else {
-		unsigned long pclk;
-		struct clk *tscaler;
-
-		/* for the h1940 (and others), we use the pclk from the core
-		 * to generate the timer values. since values around 50 to
-		 * 70MHz are not values we can directly generate the timer
-		 * value from, we need to pre-scale and divide before using it.
-		 *
-		 * for instance, using 50.7MHz and dividing by 6 gives 8.45MHz
-		 * (8.45 ticks per usec)
-		 */
-
-		pclk = clk_get_rate(timerclk);
-
-		/* configure clock tick */
-
-		timer_usec_ticks = timer_mask_usec_ticks(6, pclk);
-
-		tscaler = clk_get_parent(tdiv);
-
-		clk_set_rate(tscaler, pclk / 3);
-		clk_set_rate(tdiv, pclk / 6);
-		clk_set_parent(tin, tdiv);
-
-		tcnt = clk_get_rate(tin) / HZ;
-	}
-
-	tcon = __raw_readl(S3C2410_TCON);
-	tcfg0 = __raw_readl(S3C2410_TCFG0);
-	tcfg1 = __raw_readl(S3C2410_TCFG1);
-
-	/* timers reload after counting zero, so reduce the count by 1 */
-
-	tcnt--;
-
-	printk(KERN_DEBUG "timer tcon=%08lx, tcnt %04lx, tcfg %08lx,%08lx, usec %08lx\n",
-	       tcon, tcnt, tcfg0, tcfg1, timer_usec_ticks);
-
-	/* check to see if timer is within 16bit range... */
-	if (tcnt > TICK_MAX) {
-		panic("setup_timer: HZ is too small, cannot configure timer!");
-		return;
-	}
-
-	__raw_writel(tcfg1, S3C2410_TCFG1);
-	__raw_writel(tcfg0, S3C2410_TCFG0);
-
-	timer_startval = tcnt;
-	__raw_writel(tcnt, S3C2410_TCNTB(4));
-
-	/* ensure timer is stopped... */
-
-	tcon &= ~(7<<20);
-	tcon |= S3C2410_TCON_T4RELOAD;
-	tcon |= S3C2410_TCON_T4MANUALUPD;
-
-	__raw_writel(tcon, S3C2410_TCON);
-	__raw_writel(tcnt, S3C2410_TCNTB(4));
-	__raw_writel(tcnt, S3C2410_TCMPB(4));
-
-	/* start the timer running */
-	tcon |= S3C2410_TCON_T4START;
-	tcon &= ~S3C2410_TCON_T4MANUALUPD;
-	__raw_writel(tcon, S3C2410_TCON);
-}
-
-static void __init s3c2410_timer_resources(void)
-{
-	struct platform_device tmpdev;
-
-	tmpdev.dev.bus = &platform_bus_type;
-	tmpdev.id = 4;
-
-	timerclk = clk_get(NULL, "timers");
-	if (IS_ERR(timerclk))
-		panic("failed to get clock for system timer");
-
-	clk_enable(timerclk);
-
-	if (!use_tclk1_12()) {
-		tmpdev.id = 4;
-		tmpdev.dev.init_name = "s3c24xx-pwm.4";
-		tin = clk_get(&tmpdev.dev, "pwm-tin");
-		if (IS_ERR(tin))
-			panic("failed to get pwm-tin clock for system timer");
-
-		tdiv = clk_get(&tmpdev.dev, "pwm-tdiv");
-		if (IS_ERR(tdiv))
-			panic("failed to get pwm-tdiv clock for system timer");
-	}
-
-	clk_enable(tin);
-}
-
-static void __init s3c2410_timer_init(void)
-{
-	s3c2410_timer_resources();
-	s3c2410_timer_setup();
-	setup_irq(IRQ_TIMER4, &s3c2410_timer_irq);
-}
-
-struct sys_timer s3c24xx_timer = {
-	.init		= s3c2410_timer_init,
-	.offset		= s3c2410_gettimeoffset,
-	.resume		= s3c2410_timer_setup
-};
-- 
1.8.0.3

^ permalink raw reply related	[flat|nested] 39+ messages in thread

* Re: [PATCH 0/5 v3]  S3C / S5PC100: add clockevent/clocksource support
  2013-01-09 22:43                     ` [PATCH 0/5 v3] S3C / S5PC100: add clockevent/clocksource support Romain Naour
@ 2013-01-10  0:14                       ` Tomasz Figa
  2013-01-10  0:38                         ` Kukjin Kim
  2013-01-10  0:37                       ` Heiko Stübner
  1 sibling, 1 reply; 39+ messages in thread
From: Tomasz Figa @ 2013-01-10  0:14 UTC (permalink / raw)
  To: Romain Naour
  Cc: Heiko Stübner, Kukjin Kim, linux-samsung-soc, ben-linux,
	'Sylwester Nawrocki'

Hi Romain, Kukjin,

On Wednesday 09 of January 2013 23:43:35 Romain Naour wrote:
> This series of patches converts the s3c and s5pc100 timer driver to the
> clocksource/clockevent API. I made some test on a mini2440 board and I
> had to reduce timers frequency to 1MHz in order to produce a timer's
> overflow every 64ms. Initial timer's frequency (8,45MHz) provide only
> 7ms between each overflow. It is not enough. As timers were previously
> used to produce an IRQ at 200Hz, some board (Osiris, Anubis board) use
> an external 12MHz signal to clock the timers (tclk1). So, I changed
> their configuration to select internal pclk clock instead, but I can't
> test it.
> 
> Since clockevent/clocksource API becomes available, we can use High
> Resolution Timer and Tickless mode.
> 
> Most of the work is already done in s5p-time.c (renamed samsung-time.c).
> I added some #define for s3c24xx and s5pc100 case.
> 
> 
> Naour Romain (5):
>   Rename s5p-time to samsung-time
>   Add samsung-time support for s3c24xx
>   Add samsung-time support for s3c64xx
>   Add samsung-time support for s5pc100
>   Remove unused plat-samsung/time.c
> 
>  arch/arm/Kconfig                                   |   9 +-
>  arch/arm/mach-exynos/Kconfig                       |   2 +-
>  arch/arm/mach-exynos/mach-universal_c210.c         |   6 +-
>  arch/arm/mach-s3c24xx/Kconfig                      |   6 +
>  arch/arm/mach-s3c24xx/mach-amlm5900.c              |   5 +-
>  arch/arm/mach-s3c24xx/mach-anubis.c                |   4 +-
>  arch/arm/mach-s3c24xx/mach-at2440evb.c             |   4 +-
>  arch/arm/mach-s3c24xx/mach-bast.c                  |   4 +-
>  arch/arm/mach-s3c24xx/mach-gta02.c                 |   4 +-
>  arch/arm/mach-s3c24xx/mach-h1940.c                 |   5 +-
>  arch/arm/mach-s3c24xx/mach-jive.c                  |   4 +-
>  arch/arm/mach-s3c24xx/mach-mini2440.c              |   4 +-
>  arch/arm/mach-s3c24xx/mach-n30.c                   |   6 +-
>  arch/arm/mach-s3c24xx/mach-nexcoder.c              |   4 +-
>  arch/arm/mach-s3c24xx/mach-osiris.c                |   4 +-
>  arch/arm/mach-s3c24xx/mach-otom.c                  |   4 +-
>  arch/arm/mach-s3c24xx/mach-qt2410.c                |   4 +-
>  arch/arm/mach-s3c24xx/mach-rx1950.c                |   4 +-
>  arch/arm/mach-s3c24xx/mach-rx3715.c                |   4 +-
>  arch/arm/mach-s3c24xx/mach-smdk2410.c              |   4 +-
>  arch/arm/mach-s3c24xx/mach-smdk2413.c              |   8 +-
>  arch/arm/mach-s3c24xx/mach-smdk2416.c              |   4 +-
>  arch/arm/mach-s3c24xx/mach-smdk2440.c              |   4 +-
>  arch/arm/mach-s3c24xx/mach-smdk2443.c              |   4 +-
>  arch/arm/mach-s3c24xx/mach-tct_hammer.c            |   4 +-
>  arch/arm/mach-s3c24xx/mach-vr1000.c                |   4 +-
>  arch/arm/mach-s3c24xx/mach-vstms.c                 |   5 +-
>  arch/arm/mach-s3c64xx/Kconfig                      |   2 +
>  arch/arm/mach-s3c64xx/mach-anw6410.c               |   4 +-
>  arch/arm/mach-s3c64xx/mach-crag6410.c              |   4 +-
>  arch/arm/mach-s3c64xx/mach-hmt.c                   |   4 +-
>  arch/arm/mach-s3c64xx/mach-mini6410.c              |   4 +-
>  arch/arm/mach-s3c64xx/mach-ncp.c                   |   4 +-
>  arch/arm/mach-s3c64xx/mach-real6410.c              |   4 +-
>  arch/arm/mach-s3c64xx/mach-smartq.c                |   2 +
>  arch/arm/mach-s3c64xx/mach-smartq5.c               |   3 +-
>  arch/arm/mach-s3c64xx/mach-smartq7.c               |   3 +-
>  arch/arm/mach-s3c64xx/mach-smdk6400.c              |   4 +-
>  arch/arm/mach-s3c64xx/mach-smdk6410.c              |   4 +-
>  arch/arm/mach-s5p64x0/Kconfig                      |   4 +-
>  arch/arm/mach-s5p64x0/mach-smdk6440.c              |   6 +-
>  arch/arm/mach-s5p64x0/mach-smdk6450.c              |   6 +-
>  arch/arm/mach-s5pc100/Kconfig                      |   1 +
>  arch/arm/mach-s5pc100/mach-smdkc100.c              |   4 +-
>  arch/arm/mach-s5pv210/Kconfig                      |   2 +-
>  arch/arm/mach-s5pv210/mach-aquila.c                |   6 +-
>  arch/arm/mach-s5pv210/mach-goni.c                  |   6 +-
>  arch/arm/mach-s5pv210/mach-smdkc110.c              |   6 +-
>  arch/arm/mach-s5pv210/mach-smdkv210.c              |   6 +-
>  arch/arm/mach-s5pv210/mach-torbreck.c              |   6 +-
>  arch/arm/plat-samsung/Kconfig                      |   2 +-
>  arch/arm/plat-samsung/Makefile                     |   3 +-
>  arch/arm/plat-samsung/include/plat/cpu.h           |   5 -
>  arch/arm/plat-samsung/include/plat/s5p-time.h      |  40 ---
>  arch/arm/plat-samsung/include/plat/samsung-time.h  |  51 ++++
>  .../plat-samsung/{s5p-time.c => samsung-time.c}    | 144 +++++------
>  arch/arm/plat-samsung/time.c                       | 285
> --------------------- 57 files changed, 274 insertions(+), 475
> deletions(-)
>  delete mode 100644 arch/arm/plat-samsung/include/plat/s5p-time.h
>  create mode 100644 arch/arm/plat-samsung/include/plat/samsung-time.h
>  rename arch/arm/plat-samsung/{s5p-time.c => samsung-time.c} (68%)
>  delete mode 100644 arch/arm/plat-samsung/time.c

The whole series looks good to me.

Reviewed-by: Tomasz Figa <tomasz.figa@gmail.com>

Also I tested it on a Tiny6410 (Mini6410-compatible) board.

Tested-by: Tomasz Figa <tomasz.figa@gmail.com>

Best regards,
Tomasz Figa

^ permalink raw reply	[flat|nested] 39+ messages in thread

* Re: [PATCH 0/5 v3]  S3C / S5PC100: add clockevent/clocksource support
  2013-01-09 22:43                     ` [PATCH 0/5 v3] S3C / S5PC100: add clockevent/clocksource support Romain Naour
  2013-01-10  0:14                       ` Tomasz Figa
@ 2013-01-10  0:37                       ` Heiko Stübner
  2013-01-10  0:48                         ` Kukjin Kim
  1 sibling, 1 reply; 39+ messages in thread
From: Heiko Stübner @ 2013-01-10  0:37 UTC (permalink / raw)
  To: Romain Naour
  Cc: Tomasz Figa, Kukjin Kim, linux-samsung-soc, ben-linux,
	'Sylwester Nawrocki'

Am Mittwoch, 9. Januar 2013, 23:43:35 schrieb Romain Naour:
> This series of patches converts the s3c and s5pc100 timer driver to the
> clocksource/clockevent API. I made some test on a mini2440 board and I had
> to reduce timers frequency to 1MHz in order to produce a timer's overflow
> every 64ms. Initial timer's frequency (8,45MHz) provide only 7ms between
> each overflow. It is not enough. As timers were previously used to produce
> an IRQ at 200Hz, some board (Osiris, Anubis board) use an external 12MHz
> signal to clock the timers (tclk1). So, I changed their configuration to
> select internal pclk clock instead, but I can't test it.
> 
> Since clockevent/clocksource API becomes available, we can use High
> Resolution Timer and Tickless mode.
> 
> Most of the work is already done in s5p-time.c (renamed samsung-time.c).
> I added some #define for s3c24xx and s5pc100 case.

not sure, if the ack I added to the previous patches will carry thru, so:

The whole series

Acked-by: Heiko Stuebner <heiko@sntech.de>

and tested on a s3c2416 based machine, so

Tested-by: Heiko Stuebner <heiko@sntech.de>


> 
> Naour Romain (5):
>   Rename s5p-time to samsung-time
>   Add samsung-time support for s3c24xx
>   Add samsung-time support for s3c64xx
>   Add samsung-time support for s5pc100
>   Remove unused plat-samsung/time.c
> 
>  arch/arm/Kconfig                                   |   9 +-
>  arch/arm/mach-exynos/Kconfig                       |   2 +-
>  arch/arm/mach-exynos/mach-universal_c210.c         |   6 +-
>  arch/arm/mach-s3c24xx/Kconfig                      |   6 +
>  arch/arm/mach-s3c24xx/mach-amlm5900.c              |   5 +-
>  arch/arm/mach-s3c24xx/mach-anubis.c                |   4 +-
>  arch/arm/mach-s3c24xx/mach-at2440evb.c             |   4 +-
>  arch/arm/mach-s3c24xx/mach-bast.c                  |   4 +-
>  arch/arm/mach-s3c24xx/mach-gta02.c                 |   4 +-
>  arch/arm/mach-s3c24xx/mach-h1940.c                 |   5 +-
>  arch/arm/mach-s3c24xx/mach-jive.c                  |   4 +-
>  arch/arm/mach-s3c24xx/mach-mini2440.c              |   4 +-
>  arch/arm/mach-s3c24xx/mach-n30.c                   |   6 +-
>  arch/arm/mach-s3c24xx/mach-nexcoder.c              |   4 +-
>  arch/arm/mach-s3c24xx/mach-osiris.c                |   4 +-
>  arch/arm/mach-s3c24xx/mach-otom.c                  |   4 +-
>  arch/arm/mach-s3c24xx/mach-qt2410.c                |   4 +-
>  arch/arm/mach-s3c24xx/mach-rx1950.c                |   4 +-
>  arch/arm/mach-s3c24xx/mach-rx3715.c                |   4 +-
>  arch/arm/mach-s3c24xx/mach-smdk2410.c              |   4 +-
>  arch/arm/mach-s3c24xx/mach-smdk2413.c              |   8 +-
>  arch/arm/mach-s3c24xx/mach-smdk2416.c              |   4 +-
>  arch/arm/mach-s3c24xx/mach-smdk2440.c              |   4 +-
>  arch/arm/mach-s3c24xx/mach-smdk2443.c              |   4 +-
>  arch/arm/mach-s3c24xx/mach-tct_hammer.c            |   4 +-
>  arch/arm/mach-s3c24xx/mach-vr1000.c                |   4 +-
>  arch/arm/mach-s3c24xx/mach-vstms.c                 |   5 +-
>  arch/arm/mach-s3c64xx/Kconfig                      |   2 +
>  arch/arm/mach-s3c64xx/mach-anw6410.c               |   4 +-
>  arch/arm/mach-s3c64xx/mach-crag6410.c              |   4 +-
>  arch/arm/mach-s3c64xx/mach-hmt.c                   |   4 +-
>  arch/arm/mach-s3c64xx/mach-mini6410.c              |   4 +-
>  arch/arm/mach-s3c64xx/mach-ncp.c                   |   4 +-
>  arch/arm/mach-s3c64xx/mach-real6410.c              |   4 +-
>  arch/arm/mach-s3c64xx/mach-smartq.c                |   2 +
>  arch/arm/mach-s3c64xx/mach-smartq5.c               |   3 +-
>  arch/arm/mach-s3c64xx/mach-smartq7.c               |   3 +-
>  arch/arm/mach-s3c64xx/mach-smdk6400.c              |   4 +-
>  arch/arm/mach-s3c64xx/mach-smdk6410.c              |   4 +-
>  arch/arm/mach-s5p64x0/Kconfig                      |   4 +-
>  arch/arm/mach-s5p64x0/mach-smdk6440.c              |   6 +-
>  arch/arm/mach-s5p64x0/mach-smdk6450.c              |   6 +-
>  arch/arm/mach-s5pc100/Kconfig                      |   1 +
>  arch/arm/mach-s5pc100/mach-smdkc100.c              |   4 +-
>  arch/arm/mach-s5pv210/Kconfig                      |   2 +-
>  arch/arm/mach-s5pv210/mach-aquila.c                |   6 +-
>  arch/arm/mach-s5pv210/mach-goni.c                  |   6 +-
>  arch/arm/mach-s5pv210/mach-smdkc110.c              |   6 +-
>  arch/arm/mach-s5pv210/mach-smdkv210.c              |   6 +-
>  arch/arm/mach-s5pv210/mach-torbreck.c              |   6 +-
>  arch/arm/plat-samsung/Kconfig                      |   2 +-
>  arch/arm/plat-samsung/Makefile                     |   3 +-
>  arch/arm/plat-samsung/include/plat/cpu.h           |   5 -
>  arch/arm/plat-samsung/include/plat/s5p-time.h      |  40 ---
>  arch/arm/plat-samsung/include/plat/samsung-time.h  |  51 ++++
>  .../plat-samsung/{s5p-time.c => samsung-time.c}    | 144 +++++------
>  arch/arm/plat-samsung/time.c                       | 285
> --------------------- 57 files changed, 274 insertions(+), 475
> deletions(-)
>  delete mode 100644 arch/arm/plat-samsung/include/plat/s5p-time.h
>  create mode 100644 arch/arm/plat-samsung/include/plat/samsung-time.h
>  rename arch/arm/plat-samsung/{s5p-time.c => samsung-time.c} (68%)
>  delete mode 100644 arch/arm/plat-samsung/time.c

^ permalink raw reply	[flat|nested] 39+ messages in thread

* RE: [PATCH 0/5 v3]  S3C / S5PC100: add clockevent/clocksource support
  2013-01-10  0:14                       ` Tomasz Figa
@ 2013-01-10  0:38                         ` Kukjin Kim
  0 siblings, 0 replies; 39+ messages in thread
From: Kukjin Kim @ 2013-01-10  0:38 UTC (permalink / raw)
  To: 'Tomasz Figa', 'Romain Naour'
  Cc: 'Heiko Stübner', linux-samsung-soc, ben-linux,
	'Sylwester Nawrocki'

Tomasz Figa wrote:
> 
> Hi Romain, Kukjin,
> 
> On Wednesday 09 of January 2013 23:43:35 Romain Naour wrote:
> > This series of patches converts the s3c and s5pc100 timer driver to the
> > clocksource/clockevent API. I made some test on a mini2440 board and I
> > had to reduce timers frequency to 1MHz in order to produce a timer's
> > overflow every 64ms. Initial timer's frequency (8,45MHz) provide only
> > 7ms between each overflow. It is not enough. As timers were previously
> > used to produce an IRQ at 200Hz, some board (Osiris, Anubis board) use
> > an external 12MHz signal to clock the timers (tclk1). So, I changed
> > their configuration to select internal pclk clock instead, but I can't
> > test it.
> >
> > Since clockevent/clocksource API becomes available, we can use High
> > Resolution Timer and Tickless mode.
> >
> > Most of the work is already done in s5p-time.c (renamed samsung-time.c).
> > I added some #define for s3c24xx and s5pc100 case.
> >
> >
> > Naour Romain (5):
> >   Rename s5p-time to samsung-time
> >   Add samsung-time support for s3c24xx
> >   Add samsung-time support for s3c64xx
> >   Add samsung-time support for s5pc100
> >   Remove unused plat-samsung/time.c
> >
> >  arch/arm/Kconfig                                   |   9 +-
> >  arch/arm/mach-exynos/Kconfig                       |   2 +-
> >  arch/arm/mach-exynos/mach-universal_c210.c         |   6 +-
> >  arch/arm/mach-s3c24xx/Kconfig                      |   6 +
> >  arch/arm/mach-s3c24xx/mach-amlm5900.c              |   5 +-
> >  arch/arm/mach-s3c24xx/mach-anubis.c                |   4 +-
> >  arch/arm/mach-s3c24xx/mach-at2440evb.c             |   4 +-
> >  arch/arm/mach-s3c24xx/mach-bast.c                  |   4 +-
> >  arch/arm/mach-s3c24xx/mach-gta02.c                 |   4 +-
> >  arch/arm/mach-s3c24xx/mach-h1940.c                 |   5 +-
> >  arch/arm/mach-s3c24xx/mach-jive.c                  |   4 +-
> >  arch/arm/mach-s3c24xx/mach-mini2440.c              |   4 +-
> >  arch/arm/mach-s3c24xx/mach-n30.c                   |   6 +-
> >  arch/arm/mach-s3c24xx/mach-nexcoder.c              |   4 +-
> >  arch/arm/mach-s3c24xx/mach-osiris.c                |   4 +-
> >  arch/arm/mach-s3c24xx/mach-otom.c                  |   4 +-
> >  arch/arm/mach-s3c24xx/mach-qt2410.c                |   4 +-
> >  arch/arm/mach-s3c24xx/mach-rx1950.c                |   4 +-
> >  arch/arm/mach-s3c24xx/mach-rx3715.c                |   4 +-
> >  arch/arm/mach-s3c24xx/mach-smdk2410.c              |   4 +-
> >  arch/arm/mach-s3c24xx/mach-smdk2413.c              |   8 +-
> >  arch/arm/mach-s3c24xx/mach-smdk2416.c              |   4 +-
> >  arch/arm/mach-s3c24xx/mach-smdk2440.c              |   4 +-
> >  arch/arm/mach-s3c24xx/mach-smdk2443.c              |   4 +-
> >  arch/arm/mach-s3c24xx/mach-tct_hammer.c            |   4 +-
> >  arch/arm/mach-s3c24xx/mach-vr1000.c                |   4 +-
> >  arch/arm/mach-s3c24xx/mach-vstms.c                 |   5 +-
> >  arch/arm/mach-s3c64xx/Kconfig                      |   2 +
> >  arch/arm/mach-s3c64xx/mach-anw6410.c               |   4 +-
> >  arch/arm/mach-s3c64xx/mach-crag6410.c              |   4 +-
> >  arch/arm/mach-s3c64xx/mach-hmt.c                   |   4 +-
> >  arch/arm/mach-s3c64xx/mach-mini6410.c              |   4 +-
> >  arch/arm/mach-s3c64xx/mach-ncp.c                   |   4 +-
> >  arch/arm/mach-s3c64xx/mach-real6410.c              |   4 +-
> >  arch/arm/mach-s3c64xx/mach-smartq.c                |   2 +
> >  arch/arm/mach-s3c64xx/mach-smartq5.c               |   3 +-
> >  arch/arm/mach-s3c64xx/mach-smartq7.c               |   3 +-
> >  arch/arm/mach-s3c64xx/mach-smdk6400.c              |   4 +-
> >  arch/arm/mach-s3c64xx/mach-smdk6410.c              |   4 +-
> >  arch/arm/mach-s5p64x0/Kconfig                      |   4 +-
> >  arch/arm/mach-s5p64x0/mach-smdk6440.c              |   6 +-
> >  arch/arm/mach-s5p64x0/mach-smdk6450.c              |   6 +-
> >  arch/arm/mach-s5pc100/Kconfig                      |   1 +
> >  arch/arm/mach-s5pc100/mach-smdkc100.c              |   4 +-
> >  arch/arm/mach-s5pv210/Kconfig                      |   2 +-
> >  arch/arm/mach-s5pv210/mach-aquila.c                |   6 +-
> >  arch/arm/mach-s5pv210/mach-goni.c                  |   6 +-
> >  arch/arm/mach-s5pv210/mach-smdkc110.c              |   6 +-
> >  arch/arm/mach-s5pv210/mach-smdkv210.c              |   6 +-
> >  arch/arm/mach-s5pv210/mach-torbreck.c              |   6 +-
> >  arch/arm/plat-samsung/Kconfig                      |   2 +-
> >  arch/arm/plat-samsung/Makefile                     |   3 +-
> >  arch/arm/plat-samsung/include/plat/cpu.h           |   5 -
> >  arch/arm/plat-samsung/include/plat/s5p-time.h      |  40 ---
> >  arch/arm/plat-samsung/include/plat/samsung-time.h  |  51 ++++
> >  .../plat-samsung/{s5p-time.c => samsung-time.c}    | 144 +++++------
> >  arch/arm/plat-samsung/time.c                       | 285
> > --------------------- 57 files changed, 274 insertions(+), 475
> > deletions(-)
> >  delete mode 100644 arch/arm/plat-samsung/include/plat/s5p-time.h
> >  create mode 100644 arch/arm/plat-samsung/include/plat/samsung-time.h
> >  rename arch/arm/plat-samsung/{s5p-time.c => samsung-time.c} (68%)
> >  delete mode 100644 arch/arm/plat-samsung/time.c
> 
> The whole series looks good to me.
> 
> Reviewed-by: Tomasz Figa <tomasz.figa@gmail.com>
> 
> Also I tested it on a Tiny6410 (Mini6410-compatible) board.
> 
> Tested-by: Tomasz Figa <tomasz.figa@gmail.com>
> 
Looks good to me, Romain thanks.
BTW, which one is right "Naour Romain" or "Romain Naour"?
I'm looking at your name both "From: Romain Naour..." and "Signed-off-by:
Naour Romain...".

Tomasz, thanks for your review and test on s3c64xx board.

Heiko, can you test this on your s3c24xx board?

- Kukjin

^ permalink raw reply	[flat|nested] 39+ messages in thread

* RE: [PATCH 0/5 v3]  S3C / S5PC100: add clockevent/clocksource support
  2013-01-10  0:37                       ` Heiko Stübner
@ 2013-01-10  0:48                         ` Kukjin Kim
  0 siblings, 0 replies; 39+ messages in thread
From: Kukjin Kim @ 2013-01-10  0:48 UTC (permalink / raw)
  To: 'Heiko Stübner', 'Romain Naour'
  Cc: 'Tomasz Figa', linux-samsung-soc, ben-linux,
	'Sylwester Nawrocki'

Heiko Stübner wrote:
> 
> Am Mittwoch, 9. Januar 2013, 23:43:35 schrieb Romain Naour:
> > This series of patches converts the s3c and s5pc100 timer driver to the
> > clocksource/clockevent API. I made some test on a mini2440 board and I
> had
> > to reduce timers frequency to 1MHz in order to produce a timer's
overflow
> > every 64ms. Initial timer's frequency (8,45MHz) provide only 7ms between
> > each overflow. It is not enough. As timers were previously used to
produce
> > an IRQ at 200Hz, some board (Osiris, Anubis board) use an external 12MHz
> > signal to clock the timers (tclk1). So, I changed their configuration to
> > select internal pclk clock instead, but I can't test it.
> >
> > Since clockevent/clocksource API becomes available, we can use High
> > Resolution Timer and Tickless mode.
> >
> > Most of the work is already done in s5p-time.c (renamed samsung-time.c).
> > I added some #define for s3c24xx and s5pc100 case.
> 
> not sure, if the ack I added to the previous patches will carry thru, so:
> 
> The whole series
> 
> Acked-by: Heiko Stuebner <heiko@sntech.de>
> 
> and tested on a s3c2416 based machine, so
> 
> Tested-by: Heiko Stuebner <heiko@sntech.de>
> 
Thanks for your review and test on s3c2416 board :-)

- Kukjin

^ permalink raw reply	[flat|nested] 39+ messages in thread

* RE: [PATCH 2/5 v3] Add samsung-time support for s3c24xx
  2013-01-09 22:43                     ` [PATCH 2/5 v3] Add samsung-time support for s3c24xx Romain Naour
@ 2013-01-10  3:03                       ` Kukjin Kim
  0 siblings, 0 replies; 39+ messages in thread
From: Kukjin Kim @ 2013-01-10  3:03 UTC (permalink / raw)
  To: 'Romain Naour', 'Tomasz Figa'
  Cc: 'Heiko Stübner', linux-samsung-soc, ben-linux,
	'Sylwester Nawrocki'

Romain Naour wrote:

[...]

> diff --git a/arch/arm/mach-s3c24xx/mach-osiris.c b/arch/arm/mach-
> s3c24xx/mach-osiris.c
> index 1eeeee4..c9bd133 100644
> --- a/arch/arm/mach-s3c24xx/mach-osiris.c
> +++ b/arch/arm/mach-s3c24xx/mach-osiris.c
> @@ -44,6 +44,7 @@
>  #include <plat/devs.h>
>  #include <plat/gpio-cfg.h>
>  #include <plat/regs-serial.h>
> +#include <plat/samsung-timer.h>

Just note,

Happens build error:

arch/arm/mach-s3c24xx/mach-osiris.c:47:32: fatal error:
plat/samsung-timer.h: No such file or directory
compilation terminated.
make[2]: *** [arch/arm/mach-s3c24xx/mach-osiris.o] Error 1
make[2]: *** Waiting for unfinished jobs....

So, should be
+#include <plat/samsung-time.h>

I fixed when I applied.

[...]

Thanks.

- Kukjin

^ permalink raw reply	[flat|nested] 39+ messages in thread

end of thread, other threads:[~2013-01-10  3:03 UTC | newest]

Thread overview: 39+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-10-24 20:56 [PATCH] S3C24XX: add clockevent/clocksource support Romain Naour
2012-10-25 20:39 ` Tomasz Figa
2012-10-26 10:51   ` Romain Naour
2012-11-23  2:30     ` Kukjin Kim
2012-11-25  2:54       ` Romain Naour
2012-11-25 11:09         ` Tomasz Figa
2012-11-27 23:27         ` [PATCH 1/3] Rename s5p-time to samsung-time Romain Naour
2012-11-27 23:57           ` Heiko Stübner
2012-11-29 23:18             ` Romain Naour
2012-11-29 23:59               ` Heiko Stübner
2012-12-02 19:43               ` [PATCH 0/5 v2] S3C / S5PC100: add clockevent/clocksource support Romain Naour
2012-12-02 19:44             ` [PATCH 1/5 v2] Rename s5p-time to samsung-time Romain Naour
2012-12-10 12:59               ` Heiko Stübner
2012-12-15 21:43                 ` Romain Naour
2013-01-08 21:00                   ` Tomasz Figa
2013-01-09 19:26                     ` Kukjin Kim
2013-01-09 22:43                       ` Romain Naour
2013-01-09 22:43                     ` [PATCH 0/5 v3] S3C / S5PC100: add clockevent/clocksource support Romain Naour
2013-01-10  0:14                       ` Tomasz Figa
2013-01-10  0:38                         ` Kukjin Kim
2013-01-10  0:37                       ` Heiko Stübner
2013-01-10  0:48                         ` Kukjin Kim
2013-01-09 22:43                     ` [PATCH 1/5 v3] Rename s5p-time to samsung-time Romain Naour
2013-01-09 22:43                     ` [PATCH 2/5 v3] Add samsung-time support for s3c24xx Romain Naour
2013-01-10  3:03                       ` Kukjin Kim
2013-01-09 22:44                     ` [PATCH 3/5 v3] Add samsung-time support for s3c64xx Romain Naour
2013-01-09 22:44                     ` [PATCH 4/5 v3] Add samsung-time support for s5pc100 Romain Naour
2013-01-09 22:44                     ` [PATCH 5/5 v3] Remove unused plat-samsung/time.c Romain Naour
2012-12-02 19:44             ` [PATCH 2/5 v2] Add samsung-time support for s3c24xx Romain Naour
2012-12-10 13:00               ` Heiko Stübner
2012-12-15 21:40                 ` Romain Naour
2012-12-02 19:44             ` [PATCH 3/5 v2] Add samsung-time support for s3c64xx Romain Naour
2012-12-02 19:44             ` [PATCH 4/5 v2] Add samsung-time support for s5pc100 Romain Naour
2012-12-02 19:44             ` [PATCH 5/5 v2] Remove unused plat-samsung/time.c Romain Naour
2012-12-10 12:57               ` Heiko Stübner
2012-12-15 21:40                 ` Romain Naour
2012-12-15 21:40             ` [PATCH 5/5 v3] " Romain Naour
2012-11-27 23:27         ` [PATCH 2/3] Add samsung-time support for s3c24xx Romain Naour
2012-11-27 23:27         ` [PATCH 3/3] Add samsung-time support for s3c64xx Romain Naour

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.