All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3 00/12] ARM: samsung-time: Prepare for multiplatform support
@ 2013-03-09 20:23 ` Tomasz Figa
  0 siblings, 0 replies; 34+ messages in thread
From: Tomasz Figa @ 2013-03-09 20:23 UTC (permalink / raw)
  To: linux-arm-kernel
  Cc: linux-samsung-soc, Kukjin Kim, kyungmin.park, linux, broonie,
	kwangwoo.lee, jacmet, augulis.darius, mcuelenaere, linux,
	Sylwester Nawrocki, buserror, christer, jekhor, ghcstop,
	Mark Rutland, Tomasz Figa, Heiko Stübner, Rob Herring

This series is an attempt to make the samsung-time clocksource driver ready
for multiplatform kernels. It moves the driver to drivers/clocksource, cleans
it up from uses of static platform-specific definitions, simplifies timer
interrupt handling and adds Device Tree support.

Tested on a Tiny6410 board (Mini6410-compatible) both with and without Devicee
Tree (with my DT patches for S3C64xx). Compile tested for other related SoCs.

Changes since v2:
(http://thread.gmane.org/gmane.linux.kernel.samsung-soc/16158)
 - Addressed comments from Rob Herring and Mark Rutland
 - Removed unused register definitions
 - Replaced samsung,source-timer and samsung,event-timer properties
   with samsung,pwm-outputs property that defines which PWM channels
   are reserved for PWM outputs on particular platform
 - Split non-DT and DT initialization into two functions
 - Fixed a copy paste error

Changes since v1:
(http://thread.gmane.org/gmane.linux.kernel.samsung-soc/16005)
 - Addressed comments from Mark Rutland
 - Documented struct samsung_timer_variant
 - Dropped inactive mail addresses from CC

Tomasz Figa (12):
  ARM: SAMSUNG: Move samsung-time to drivers/clocksource
  clocksource: samsung-time: Set platform-specific parameters at runtime
  clocksource: samsung-time: Drop useless defines from public header
  ARM: SAMSUNG: Move samsung-time.h header to inlude/clocksource
  clocksource: samsung-time: Use local register definitions
  clocksource: samsung-time: Remove use of static register mapping
  clocksource: samsung-time: Use clk_get_sys for getting clocks
  ARM: SAMSUNG: devs: Drop unnecessary IRQ resources of timer devices
  clocksource: samsung-time: Do not use static IRQ definition
  clocksource: samsung-time: Move IRQ mask/ack handling to the driver
  ARM: SAMSUNG: Remove unused PWM timer IRQ chip code
  clocksource: samsung-time: Add Device Tree support

 .../devicetree/bindings/timer/samsung-pwm.txt      |  33 ++
 arch/arm/Kconfig                                   |   1 -
 arch/arm/mach-exynos/include/mach/irqs.h           |   3 +-
 arch/arm/mach-exynos/mach-universal_c210.c         |  15 +-
 arch/arm/mach-s3c24xx/common.c                     |  14 +
 arch/arm/mach-s3c24xx/mach-amlm5900.c              |   2 +-
 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              |   2 +-
 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                 |   2 +-
 arch/arm/mach-s3c64xx/common.c                     |  19 +-
 arch/arm/mach-s3c64xx/include/mach/irqs.h          |   8 -
 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               |   2 +-
 arch/arm/mach-s3c64xx/mach-smartq7.c               |   2 +-
 arch/arm/mach-s3c64xx/mach-smdk6400.c              |   2 +-
 arch/arm/mach-s3c64xx/mach-smdk6410.c              |   2 +-
 arch/arm/mach-s5p64x0/common.c                     |  15 +
 arch/arm/mach-s5p64x0/include/mach/irqs.h          |   2 -
 arch/arm/mach-s5p64x0/mach-smdk6440.c              |   2 +-
 arch/arm/mach-s5p64x0/mach-smdk6450.c              |   2 +-
 arch/arm/mach-s5pc100/common.c                     |  15 +
 arch/arm/mach-s5pc100/include/mach/irqs.h          |   2 -
 arch/arm/mach-s5pc100/mach-smdkc100.c              |   2 +-
 arch/arm/mach-s5pv210/common.c                     |  15 +
 arch/arm/mach-s5pv210/include/mach/irqs.h          |   2 -
 arch/arm/mach-s5pv210/mach-aquila.c                |   2 +-
 arch/arm/mach-s5pv210/mach-goni.c                  |   2 +-
 arch/arm/mach-s5pv210/mach-smdkc110.c              |   2 +-
 arch/arm/mach-s5pv210/mach-smdkv210.c              |   2 +-
 arch/arm/mach-s5pv210/mach-torbreck.c              |   2 +-
 arch/arm/plat-samsung/Kconfig                      |  14 -
 arch/arm/plat-samsung/Makefile                     |   2 -
 arch/arm/plat-samsung/devs.c                       |  28 +-
 arch/arm/plat-samsung/include/plat/irq-vic-timer.h |  13 -
 arch/arm/plat-samsung/include/plat/irqs.h          |   9 -
 arch/arm/plat-samsung/include/plat/samsung-time.h  |  53 --
 arch/arm/plat-samsung/irq-vic-timer.c              |  98 ----
 arch/arm/plat-samsung/s5p-irq.c                    |   3 -
 arch/arm/plat-samsung/samsung-time.c               | 394 --------------
 drivers/clocksource/Kconfig                        |   7 +
 drivers/clocksource/Makefile                       |   1 +
 drivers/clocksource/samsung-time.c                 | 571 +++++++++++++++++++++
 include/clocksource/samsung-time.h                 |  57 ++
 68 files changed, 808 insertions(+), 670 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/timer/samsung-pwm.txt
 delete mode 100644 arch/arm/plat-samsung/include/plat/irq-vic-timer.h
 delete mode 100644 arch/arm/plat-samsung/include/plat/samsung-time.h
 delete mode 100644 arch/arm/plat-samsung/irq-vic-timer.c
 delete mode 100644 arch/arm/plat-samsung/samsung-time.c
 create mode 100644 drivers/clocksource/samsung-time.c
 create mode 100644 include/clocksource/samsung-time.h

-- 
1.8.1.5

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

* [PATCH v3 00/12] ARM: samsung-time: Prepare for multiplatform support
@ 2013-03-09 20:23 ` Tomasz Figa
  0 siblings, 0 replies; 34+ messages in thread
From: Tomasz Figa @ 2013-03-09 20:23 UTC (permalink / raw)
  To: linux-arm-kernel

This series is an attempt to make the samsung-time clocksource driver ready
for multiplatform kernels. It moves the driver to drivers/clocksource, cleans
it up from uses of static platform-specific definitions, simplifies timer
interrupt handling and adds Device Tree support.

Tested on a Tiny6410 board (Mini6410-compatible) both with and without Devicee
Tree (with my DT patches for S3C64xx). Compile tested for other related SoCs.

Changes since v2:
(http://thread.gmane.org/gmane.linux.kernel.samsung-soc/16158)
 - Addressed comments from Rob Herring and Mark Rutland
 - Removed unused register definitions
 - Replaced samsung,source-timer and samsung,event-timer properties
   with samsung,pwm-outputs property that defines which PWM channels
   are reserved for PWM outputs on particular platform
 - Split non-DT and DT initialization into two functions
 - Fixed a copy paste error

Changes since v1:
(http://thread.gmane.org/gmane.linux.kernel.samsung-soc/16005)
 - Addressed comments from Mark Rutland
 - Documented struct samsung_timer_variant
 - Dropped inactive mail addresses from CC

Tomasz Figa (12):
  ARM: SAMSUNG: Move samsung-time to drivers/clocksource
  clocksource: samsung-time: Set platform-specific parameters at runtime
  clocksource: samsung-time: Drop useless defines from public header
  ARM: SAMSUNG: Move samsung-time.h header to inlude/clocksource
  clocksource: samsung-time: Use local register definitions
  clocksource: samsung-time: Remove use of static register mapping
  clocksource: samsung-time: Use clk_get_sys for getting clocks
  ARM: SAMSUNG: devs: Drop unnecessary IRQ resources of timer devices
  clocksource: samsung-time: Do not use static IRQ definition
  clocksource: samsung-time: Move IRQ mask/ack handling to the driver
  ARM: SAMSUNG: Remove unused PWM timer IRQ chip code
  clocksource: samsung-time: Add Device Tree support

 .../devicetree/bindings/timer/samsung-pwm.txt      |  33 ++
 arch/arm/Kconfig                                   |   1 -
 arch/arm/mach-exynos/include/mach/irqs.h           |   3 +-
 arch/arm/mach-exynos/mach-universal_c210.c         |  15 +-
 arch/arm/mach-s3c24xx/common.c                     |  14 +
 arch/arm/mach-s3c24xx/mach-amlm5900.c              |   2 +-
 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              |   2 +-
 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                 |   2 +-
 arch/arm/mach-s3c64xx/common.c                     |  19 +-
 arch/arm/mach-s3c64xx/include/mach/irqs.h          |   8 -
 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               |   2 +-
 arch/arm/mach-s3c64xx/mach-smartq7.c               |   2 +-
 arch/arm/mach-s3c64xx/mach-smdk6400.c              |   2 +-
 arch/arm/mach-s3c64xx/mach-smdk6410.c              |   2 +-
 arch/arm/mach-s5p64x0/common.c                     |  15 +
 arch/arm/mach-s5p64x0/include/mach/irqs.h          |   2 -
 arch/arm/mach-s5p64x0/mach-smdk6440.c              |   2 +-
 arch/arm/mach-s5p64x0/mach-smdk6450.c              |   2 +-
 arch/arm/mach-s5pc100/common.c                     |  15 +
 arch/arm/mach-s5pc100/include/mach/irqs.h          |   2 -
 arch/arm/mach-s5pc100/mach-smdkc100.c              |   2 +-
 arch/arm/mach-s5pv210/common.c                     |  15 +
 arch/arm/mach-s5pv210/include/mach/irqs.h          |   2 -
 arch/arm/mach-s5pv210/mach-aquila.c                |   2 +-
 arch/arm/mach-s5pv210/mach-goni.c                  |   2 +-
 arch/arm/mach-s5pv210/mach-smdkc110.c              |   2 +-
 arch/arm/mach-s5pv210/mach-smdkv210.c              |   2 +-
 arch/arm/mach-s5pv210/mach-torbreck.c              |   2 +-
 arch/arm/plat-samsung/Kconfig                      |  14 -
 arch/arm/plat-samsung/Makefile                     |   2 -
 arch/arm/plat-samsung/devs.c                       |  28 +-
 arch/arm/plat-samsung/include/plat/irq-vic-timer.h |  13 -
 arch/arm/plat-samsung/include/plat/irqs.h          |   9 -
 arch/arm/plat-samsung/include/plat/samsung-time.h  |  53 --
 arch/arm/plat-samsung/irq-vic-timer.c              |  98 ----
 arch/arm/plat-samsung/s5p-irq.c                    |   3 -
 arch/arm/plat-samsung/samsung-time.c               | 394 --------------
 drivers/clocksource/Kconfig                        |   7 +
 drivers/clocksource/Makefile                       |   1 +
 drivers/clocksource/samsung-time.c                 | 571 +++++++++++++++++++++
 include/clocksource/samsung-time.h                 |  57 ++
 68 files changed, 808 insertions(+), 670 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/timer/samsung-pwm.txt
 delete mode 100644 arch/arm/plat-samsung/include/plat/irq-vic-timer.h
 delete mode 100644 arch/arm/plat-samsung/include/plat/samsung-time.h
 delete mode 100644 arch/arm/plat-samsung/irq-vic-timer.c
 delete mode 100644 arch/arm/plat-samsung/samsung-time.c
 create mode 100644 drivers/clocksource/samsung-time.c
 create mode 100644 include/clocksource/samsung-time.h

-- 
1.8.1.5

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

* [PATCH v3 01/12] ARM: SAMSUNG: Move samsung-time to drivers/clocksource
  2013-03-09 20:23 ` Tomasz Figa
@ 2013-03-09 20:23   ` Tomasz Figa
  -1 siblings, 0 replies; 34+ messages in thread
From: Tomasz Figa @ 2013-03-09 20:23 UTC (permalink / raw)
  To: linux-arm-kernel
  Cc: linux-samsung-soc, Kukjin Kim, kyungmin.park, linux, broonie,
	kwangwoo.lee, jacmet, augulis.darius, mcuelenaere, linux,
	Sylwester Nawrocki, buserror, christer, jekhor, ghcstop,
	Mark Rutland, Tomasz Figa, Heiko Stübner, Rob Herring

This patch moves the Samsung PWM-based high resolution timer support
code from arch/arm/plat-samsung to drivers/clocksource.

This is a prerequisite for further work on making the driver more
multiplatform and Device Tree friendly.

Signed-off-by: Tomasz Figa <tomasz.figa@gmail.com>
---
 arch/arm/plat-samsung/Kconfig        |   8 -
 arch/arm/plat-samsung/Makefile       |   1 -
 arch/arm/plat-samsung/samsung-time.c | 394 -----------------------------------
 drivers/clocksource/Kconfig          |   7 +
 drivers/clocksource/Makefile         |   1 +
 drivers/clocksource/samsung-time.c   | 394 +++++++++++++++++++++++++++++++++++
 6 files changed, 402 insertions(+), 403 deletions(-)
 delete mode 100644 arch/arm/plat-samsung/samsung-time.c
 create mode 100644 drivers/clocksource/samsung-time.c

diff --git a/arch/arm/plat-samsung/Kconfig b/arch/arm/plat-samsung/Kconfig
index 6cb19c6..ebfbf1d 100644
--- a/arch/arm/plat-samsung/Kconfig
+++ b/arch/arm/plat-samsung/Kconfig
@@ -68,14 +68,6 @@ config S3C_LOWLEVEL_UART_PORT
 	  this configuration should be between zero and two. The port
 	  must have been initialised by the boot-loader before use.
 
-# timer options
-
-config SAMSUNG_HRT
-	bool
-	select SAMSUNG_DEV_PWM
-	help
-	  Use the High Resolution timer support
-
 # clock options
 
 config SAMSUNG_CLOCK
diff --git a/arch/arm/plat-samsung/Makefile b/arch/arm/plat-samsung/Makefile
index a23c460..87494e1 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_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/samsung-time.c b/arch/arm/plat-samsung/samsung-time.c
deleted file mode 100644
index f899cbc..0000000
--- a/arch/arm/plat-samsung/samsung-time.c
+++ /dev/null
@@ -1,394 +0,0 @@
-/*
- * 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;
-
-	time_event_device.cpumask = cpumask_of(0);
-	clockevents_config_and_register(&time_event_device, clock_rate, 1, -1);
-
-	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);
-}
-
-void __init samsung_timer_init(void)
-{
-	samsung_timer_resources();
-	samsung_clockevent_init();
-	samsung_clocksource_init();
-}
diff --git a/drivers/clocksource/Kconfig b/drivers/clocksource/Kconfig
index e8c4532..dd20f6a 100644
--- a/drivers/clocksource/Kconfig
+++ b/drivers/clocksource/Kconfig
@@ -25,6 +25,13 @@ config DW_APB_TIMER_OF
 config ARMADA_370_XP_TIMER
 	bool
 
+config SAMSUNG_HRT
+	bool
+	depends on PLAT_SAMSUNG
+	select SAMSUNG_DEV_PWM
+	help
+	  Use the high resolution timer support on Samsung platforms.
+
 config SUNXI_TIMER
 	bool
 
diff --git a/drivers/clocksource/Makefile b/drivers/clocksource/Makefile
index 1c1b15d..0d68580 100644
--- a/drivers/clocksource/Makefile
+++ b/drivers/clocksource/Makefile
@@ -16,6 +16,7 @@ obj-$(CONFIG_CLKSRC_NOMADIK_MTU)	+= nomadik-mtu.o
 obj-$(CONFIG_CLKSRC_DBX500_PRCMU)	+= clksrc-dbx500-prcmu.o
 obj-$(CONFIG_ARMADA_370_XP_TIMER)	+= time-armada-370-xp.o
 obj-$(CONFIG_ARCH_BCM2835)	+= bcm2835_timer.o
+obj-$(CONFIG_SAMSUNG_HRT) 	+= samsung-time.o
 obj-$(CONFIG_SUNXI_TIMER)	+= sunxi_timer.o
 obj-$(CONFIG_ARCH_TEGRA)	+= tegra20_timer.o
 obj-$(CONFIG_VT8500_TIMER)	+= vt8500_timer.o
diff --git a/drivers/clocksource/samsung-time.c b/drivers/clocksource/samsung-time.c
new file mode 100644
index 0000000..f899cbc
--- /dev/null
+++ b/drivers/clocksource/samsung-time.c
@@ -0,0 +1,394 @@
+/*
+ * 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;
+
+	time_event_device.cpumask = cpumask_of(0);
+	clockevents_config_and_register(&time_event_device, clock_rate, 1, -1);
+
+	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);
+}
+
+void __init samsung_timer_init(void)
+{
+	samsung_timer_resources();
+	samsung_clockevent_init();
+	samsung_clocksource_init();
+}
-- 
1.8.1.5

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

* [PATCH v3 01/12] ARM: SAMSUNG: Move samsung-time to drivers/clocksource
@ 2013-03-09 20:23   ` Tomasz Figa
  0 siblings, 0 replies; 34+ messages in thread
From: Tomasz Figa @ 2013-03-09 20:23 UTC (permalink / raw)
  To: linux-arm-kernel

This patch moves the Samsung PWM-based high resolution timer support
code from arch/arm/plat-samsung to drivers/clocksource.

This is a prerequisite for further work on making the driver more
multiplatform and Device Tree friendly.

Signed-off-by: Tomasz Figa <tomasz.figa@gmail.com>
---
 arch/arm/plat-samsung/Kconfig        |   8 -
 arch/arm/plat-samsung/Makefile       |   1 -
 arch/arm/plat-samsung/samsung-time.c | 394 -----------------------------------
 drivers/clocksource/Kconfig          |   7 +
 drivers/clocksource/Makefile         |   1 +
 drivers/clocksource/samsung-time.c   | 394 +++++++++++++++++++++++++++++++++++
 6 files changed, 402 insertions(+), 403 deletions(-)
 delete mode 100644 arch/arm/plat-samsung/samsung-time.c
 create mode 100644 drivers/clocksource/samsung-time.c

diff --git a/arch/arm/plat-samsung/Kconfig b/arch/arm/plat-samsung/Kconfig
index 6cb19c6..ebfbf1d 100644
--- a/arch/arm/plat-samsung/Kconfig
+++ b/arch/arm/plat-samsung/Kconfig
@@ -68,14 +68,6 @@ config S3C_LOWLEVEL_UART_PORT
 	  this configuration should be between zero and two. The port
 	  must have been initialised by the boot-loader before use.
 
-# timer options
-
-config SAMSUNG_HRT
-	bool
-	select SAMSUNG_DEV_PWM
-	help
-	  Use the High Resolution timer support
-
 # clock options
 
 config SAMSUNG_CLOCK
diff --git a/arch/arm/plat-samsung/Makefile b/arch/arm/plat-samsung/Makefile
index a23c460..87494e1 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_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/samsung-time.c b/arch/arm/plat-samsung/samsung-time.c
deleted file mode 100644
index f899cbc..0000000
--- a/arch/arm/plat-samsung/samsung-time.c
+++ /dev/null
@@ -1,394 +0,0 @@
-/*
- * 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;
-
-	time_event_device.cpumask = cpumask_of(0);
-	clockevents_config_and_register(&time_event_device, clock_rate, 1, -1);
-
-	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);
-}
-
-void __init samsung_timer_init(void)
-{
-	samsung_timer_resources();
-	samsung_clockevent_init();
-	samsung_clocksource_init();
-}
diff --git a/drivers/clocksource/Kconfig b/drivers/clocksource/Kconfig
index e8c4532..dd20f6a 100644
--- a/drivers/clocksource/Kconfig
+++ b/drivers/clocksource/Kconfig
@@ -25,6 +25,13 @@ config DW_APB_TIMER_OF
 config ARMADA_370_XP_TIMER
 	bool
 
+config SAMSUNG_HRT
+	bool
+	depends on PLAT_SAMSUNG
+	select SAMSUNG_DEV_PWM
+	help
+	  Use the high resolution timer support on Samsung platforms.
+
 config SUNXI_TIMER
 	bool
 
diff --git a/drivers/clocksource/Makefile b/drivers/clocksource/Makefile
index 1c1b15d..0d68580 100644
--- a/drivers/clocksource/Makefile
+++ b/drivers/clocksource/Makefile
@@ -16,6 +16,7 @@ obj-$(CONFIG_CLKSRC_NOMADIK_MTU)	+= nomadik-mtu.o
 obj-$(CONFIG_CLKSRC_DBX500_PRCMU)	+= clksrc-dbx500-prcmu.o
 obj-$(CONFIG_ARMADA_370_XP_TIMER)	+= time-armada-370-xp.o
 obj-$(CONFIG_ARCH_BCM2835)	+= bcm2835_timer.o
+obj-$(CONFIG_SAMSUNG_HRT) 	+= samsung-time.o
 obj-$(CONFIG_SUNXI_TIMER)	+= sunxi_timer.o
 obj-$(CONFIG_ARCH_TEGRA)	+= tegra20_timer.o
 obj-$(CONFIG_VT8500_TIMER)	+= vt8500_timer.o
diff --git a/drivers/clocksource/samsung-time.c b/drivers/clocksource/samsung-time.c
new file mode 100644
index 0000000..f899cbc
--- /dev/null
+++ b/drivers/clocksource/samsung-time.c
@@ -0,0 +1,394 @@
+/*
+ * 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;
+
+	time_event_device.cpumask = cpumask_of(0);
+	clockevents_config_and_register(&time_event_device, clock_rate, 1, -1);
+
+	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);
+}
+
+void __init samsung_timer_init(void)
+{
+	samsung_timer_resources();
+	samsung_clockevent_init();
+	samsung_clocksource_init();
+}
-- 
1.8.1.5

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

* [PATCH v3 02/12] clocksource: samsung-time: Set platform-specific parameters at runtime
  2013-03-09 20:23 ` Tomasz Figa
@ 2013-03-09 20:23   ` Tomasz Figa
  -1 siblings, 0 replies; 34+ messages in thread
From: Tomasz Figa @ 2013-03-09 20:23 UTC (permalink / raw)
  To: linux-arm-kernel
  Cc: linux-samsung-soc, Kukjin Kim, kyungmin.park, linux, broonie,
	kwangwoo.lee, jacmet, augulis.darius, mcuelenaere, linux,
	Sylwester Nawrocki, buserror, christer, jekhor, ghcstop,
	Mark Rutland, Tomasz Figa, Heiko Stübner, Rob Herring

This patch removes static platform-specific defines from samsung-time
implementation and introduces an interface to configure
platform-specific timer parameters from platform code.

Signed-off-by: Tomasz Figa <tomasz.figa@gmail.com>
---
 arch/arm/mach-exynos/mach-universal_c210.c        |  7 ++++
 arch/arm/mach-s3c24xx/common.c                    |  9 +++++
 arch/arm/mach-s3c64xx/common.c                    |  9 +++++
 arch/arm/mach-s5p64x0/common.c                    |  9 +++++
 arch/arm/mach-s5pc100/common.c                    |  9 +++++
 arch/arm/mach-s5pv210/common.c                    |  9 +++++
 arch/arm/plat-samsung/include/plat/samsung-time.h | 28 ++++++++-------
 drivers/clocksource/samsung-time.c                | 42 ++++++++++++++++++-----
 8 files changed, 101 insertions(+), 21 deletions(-)

diff --git a/arch/arm/mach-exynos/mach-universal_c210.c b/arch/arm/mach-exynos/mach-universal_c210.c
index 72f08fd..00554fe 100644
--- a/arch/arm/mach-exynos/mach-universal_c210.c
+++ b/arch/arm/mach-exynos/mach-universal_c210.c
@@ -1089,10 +1089,17 @@ static struct platform_device *universal_devices[] __initdata = {
 	&s5p_device_fimc_md,
 };
 
+static const struct samsung_timer_variant universal_timer_variant = {
+	.bits = 32,
+	.prescale = 2,
+	.divisor = 1,
+};
+
 static void __init universal_map_io(void)
 {
 	exynos_init_io(NULL, 0);
 	s3c24xx_init_uarts(universal_uartcfgs, ARRAY_SIZE(universal_uartcfgs));
+	samsung_timer_set_variant(&universal_timer_variant);
 	samsung_set_timer_source(SAMSUNG_PWM2, SAMSUNG_PWM4);
 	xxti_f = 0;
 	xusbxti_f = 24000000;
diff --git a/arch/arm/mach-s3c24xx/common.c b/arch/arm/mach-s3c24xx/common.c
index d97533d..816428f 100644
--- a/arch/arm/mach-s3c24xx/common.c
+++ b/arch/arm/mach-s3c24xx/common.c
@@ -49,6 +49,7 @@
 #include <plat/clock.h>
 #include <plat/cpu-freq.h>
 #include <plat/pll.h>
+#include <plat/samsung-time.h>
 
 #include "common.h"
 
@@ -216,6 +217,12 @@ static void s3c24xx_default_idle(void)
 		     S3C2410_CLKCON);
 }
 
+static const struct samsung_timer_variant s3c24xx_timer_variant = {
+	.bits = 16,
+	.prescale = 25,
+	.divisor = 2,
+};
+
 void __init s3c24xx_init_io(struct map_desc *mach_desc, int size)
 {
 	arm_pm_idle = s3c24xx_default_idle;
@@ -232,6 +239,8 @@ void __init s3c24xx_init_io(struct map_desc *mach_desc, int size)
 	s3c24xx_init_cpu();
 
 	s3c_init_cpu(samsung_cpu_id, cpu_ids, ARRAY_SIZE(cpu_ids));
+
+	samsung_timer_set_variant(&s3c24xx_timer_variant);
 }
 
 /* Serial port registrations */
diff --git a/arch/arm/mach-s3c64xx/common.c b/arch/arm/mach-s3c64xx/common.c
index 0b9c0ba..b6aa36d 100644
--- a/arch/arm/mach-s3c64xx/common.c
+++ b/arch/arm/mach-s3c64xx/common.c
@@ -44,6 +44,7 @@
 #include <plat/irq-vic-timer.h>
 #include <plat/regs-irqtype.h>
 #include <plat/regs-serial.h>
+#include <plat/samsung-time.h>
 #include <plat/watchdog-reset.h>
 
 #include "common.h"
@@ -148,6 +149,12 @@ static struct device s3c64xx_dev = {
 	.bus	= &s3c64xx_subsys,
 };
 
+static const struct samsung_timer_variant s3c64xx_timer_variant = {
+	.bits = 32,
+	.prescale = 2,
+	.divisor = 1,
+};
+
 /* read cpu identification code */
 
 void __init s3c64xx_init_io(struct map_desc *mach_desc, int size)
@@ -160,6 +167,8 @@ void __init s3c64xx_init_io(struct map_desc *mach_desc, int size)
 	s3c64xx_init_cpu();
 
 	s3c_init_cpu(samsung_cpu_id, cpu_ids, ARRAY_SIZE(cpu_ids));
+
+	samsung_timer_set_variant(&s3c64xx_timer_variant);
 }
 
 static __init int s3c64xx_dev_init(void)
diff --git a/arch/arm/mach-s5p64x0/common.c b/arch/arm/mach-s5p64x0/common.c
index 8ae5800..a339fbb 100644
--- a/arch/arm/mach-s5p64x0/common.c
+++ b/arch/arm/mach-s5p64x0/common.c
@@ -48,6 +48,7 @@
 #include <plat/gpio-cfg.h>
 #include <plat/regs-irqtype.h>
 #include <plat/regs-serial.h>
+#include <plat/samsung-time.h>
 #include <plat/watchdog-reset.h>
 
 #include "common.h"
@@ -156,6 +157,12 @@ static void s5p64x0_idle(void)
 	cpu_do_idle();
 }
 
+static const struct samsung_timer_variant s5p64x0_timer_variant = {
+	.bits = 32,
+	.prescale = 2,
+	.divisor = 1,
+};
+
 /*
  * s5p64x0_map_io
  *
@@ -173,6 +180,8 @@ void __init s5p64x0_init_io(struct map_desc *mach_desc, int size)
 	s5p_init_cpu(S5P64X0_SYS_ID);
 
 	s3c_init_cpu(samsung_cpu_id, cpu_ids, ARRAY_SIZE(cpu_ids));
+
+	samsung_timer_set_variant(&s5p64x0_timer_variant);
 }
 
 void __init s5p6440_map_io(void)
diff --git a/arch/arm/mach-s5pc100/common.c b/arch/arm/mach-s5pc100/common.c
index cc6e561..09e76d4 100644
--- a/arch/arm/mach-s5pc100/common.c
+++ b/arch/arm/mach-s5pc100/common.c
@@ -47,6 +47,7 @@
 #include <plat/onenand-core.h>
 #include <plat/spi-core.h>
 #include <plat/regs-serial.h>
+#include <plat/samsung-time.h>
 #include <plat/watchdog-reset.h>
 
 #include "common.h"
@@ -131,6 +132,12 @@ static struct map_desc s5pc100_iodesc[] __initdata = {
 	}
 };
 
+static const struct samsung_timer_variant s5pc100_timer_variant = {
+	.bits = 32,
+	.prescale = 2,
+	.divisor = 1,
+};
+
 /*
  * s5pc100_map_io
  *
@@ -148,6 +155,8 @@ void __init s5pc100_init_io(struct map_desc *mach_desc, int size)
 	s5p_init_cpu(S5P_VA_CHIPID);
 
 	s3c_init_cpu(samsung_cpu_id, cpu_ids, ARRAY_SIZE(cpu_ids));
+
+	samsung_timer_set_variant(&s5pc100_timer_variant);
 }
 
 void __init s5pc100_map_io(void)
diff --git a/arch/arm/mach-s5pv210/common.c b/arch/arm/mach-s5pv210/common.c
index 9dfe93e..44d3a5c 100644
--- a/arch/arm/mach-s5pv210/common.c
+++ b/arch/arm/mach-s5pv210/common.c
@@ -42,6 +42,7 @@
 #include <plat/fimc-core.h>
 #include <plat/iic-core.h>
 #include <plat/keypad-core.h>
+#include <plat/samsung-time.h>
 #include <plat/tv-core.h>
 #include <plat/spi-core.h>
 #include <plat/regs-serial.h>
@@ -148,6 +149,12 @@ void s5pv210_restart(char mode, const char *cmd)
 	__raw_writel(0x1, S5P_SWRESET);
 }
 
+static const struct samsung_timer_variant s5pv210_timer_variant = {
+	.bits = 32,
+	.prescale = 2,
+	.divisor = 1,
+};
+
 /*
  * s5pv210_map_io
  *
@@ -165,6 +172,8 @@ void __init s5pv210_init_io(struct map_desc *mach_desc, int size)
 	s5p_init_cpu(S5P_VA_CHIPID);
 
 	s3c_init_cpu(samsung_cpu_id, cpu_ids, ARRAY_SIZE(cpu_ids));
+
+	samsung_timer_set_variant(&s5pv210_timer_variant);
 }
 
 void __init s5pv210_map_io(void)
diff --git a/arch/arm/plat-samsung/include/plat/samsung-time.h b/arch/arm/plat-samsung/include/plat/samsung-time.h
index 4cc99bb..09077f4 100644
--- a/arch/arm/plat-samsung/include/plat/samsung-time.h
+++ b/arch/arm/plat-samsung/include/plat/samsung-time.h
@@ -27,26 +27,28 @@ struct samsung_timer_source {
 	unsigned int source_id;
 };
 
+/**
+ * struct samsung_timer_variant - SoC-specific parameters of Samsung PWM timers
+ * @bits:	bit width of time counters
+ * @prescale:	prescaler divisor
+ * @divisor:	main divisor
+ */
+struct samsung_timer_variant {
+	int bits;
+	u16 prescale;
+	u16 divisor;
+};
+
 /* Be able to sleep for atleast 4 seconds (usually more) */
 #define SAMSUNG_TIMER_MIN_RANGE	4
 
-#if defined(CONFIG_ARCH_S3C24XX) || defined(CONFIG_ARCH_S5PC100)
-#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,
+extern void samsung_set_timer_source(enum samsung_timer_mode event,
 					enum samsung_timer_mode source);
+extern void samsung_timer_set_variant(
+				const struct samsung_timer_variant *variant);
 
 extern void __init samsung_timer_init(void);
 
diff --git a/drivers/clocksource/samsung-time.c b/drivers/clocksource/samsung-time.c
index f899cbc..2b617c4 100644
--- a/drivers/clocksource/samsung-time.c
+++ b/drivers/clocksource/samsung-time.c
@@ -33,6 +33,7 @@ static struct clk *tdiv_event;
 static struct clk *tdiv_source;
 static struct clk *timerclk;
 static struct samsung_timer_source timer_source;
+static struct samsung_timer_variant timer_variant;
 static unsigned long clock_count_per_tick;
 static void samsung_timer_resume(void);
 
@@ -213,12 +214,16 @@ static void samsung_set_mode(enum clock_event_mode mode,
 
 static void samsung_timer_resume(void)
 {
+	u32 tcnt_max;
+
+	tcnt_max = (1UL << timer_variant.bits) - 1;
+
 	/* 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_setup(timer_source.source_id, tcnt_max);
 	samsung_time_start(timer_source.source_id, PERIODIC);
 }
 
@@ -232,6 +237,12 @@ void __init samsung_set_timer_source(enum samsung_timer_mode event,
 	timer_source.source_id = source;
 }
 
+void __init samsung_timer_set_variant(
+				const struct samsung_timer_variant *variant)
+{
+	timer_variant = *variant;
+}
+
 static struct clock_event_device time_event_device = {
 	.name		= "samsung_event_timer",
 	.features	= CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT,
@@ -267,8 +278,9 @@ static void __init samsung_clockevent_init(void)
 
 	tscaler = clk_get_parent(tdiv_event);
 
-	clk_set_rate(tscaler, pclk / TSCALER_DIV);
-	clk_set_rate(tdiv_event, pclk / TDIV);
+	clk_set_rate(tscaler, pclk / timer_variant.prescale);
+	clk_set_rate(tdiv_event, pclk /
+			(timer_variant.prescale * timer_variant.divisor));
 	clk_set_parent(tin_event, tdiv_event);
 
 	clock_rate = clk_get_rate(tin_event);
@@ -326,21 +338,29 @@ static void __init samsung_clocksource_init(void)
 {
 	unsigned long pclk;
 	unsigned long clock_rate;
+	u32 tcnt_max;
+	int ret;
+
+	tcnt_max = (1UL << timer_variant.bits) - 1;
 
 	pclk = clk_get_rate(timerclk);
 
-	clk_set_rate(tdiv_source, pclk / TDIV);
+	clk_set_rate(tdiv_source, pclk /
+			(timer_variant.prescale * timer_variant.divisor));
 	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_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);
+	setup_sched_clock(samsung_read_sched_clock,
+						timer_variant.bits, clock_rate);
 
-	if (clocksource_mmio_init(samsung_timer_reg(), "samsung_clocksource_timer",
-			clock_rate, 250, TSIZE, clocksource_mmio_readl_down))
+	ret = clocksource_mmio_init(samsung_timer_reg(),
+			"samsung_clocksource_timer", clock_rate, 250,
+			timer_variant.bits, clocksource_mmio_readl_down);
+	if (ret)
 		panic("samsung_clocksource_timer: can't register clocksource\n");
 }
 
@@ -388,6 +408,12 @@ static void __init samsung_timer_resources(void)
 
 void __init samsung_timer_init(void)
 {
+	if (!timer_source.source_id && !timer_source.event_id)
+		panic("timer sources not set (see samsung_set_timer_source)!\n");
+
+	if (!timer_variant.bits)
+		panic("timer variant not set (see samsung_timer_set_variant)!\n");
+
 	samsung_timer_resources();
 	samsung_clockevent_init();
 	samsung_clocksource_init();
-- 
1.8.1.5

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

* [PATCH v3 02/12] clocksource: samsung-time: Set platform-specific parameters at runtime
@ 2013-03-09 20:23   ` Tomasz Figa
  0 siblings, 0 replies; 34+ messages in thread
From: Tomasz Figa @ 2013-03-09 20:23 UTC (permalink / raw)
  To: linux-arm-kernel

This patch removes static platform-specific defines from samsung-time
implementation and introduces an interface to configure
platform-specific timer parameters from platform code.

Signed-off-by: Tomasz Figa <tomasz.figa@gmail.com>
---
 arch/arm/mach-exynos/mach-universal_c210.c        |  7 ++++
 arch/arm/mach-s3c24xx/common.c                    |  9 +++++
 arch/arm/mach-s3c64xx/common.c                    |  9 +++++
 arch/arm/mach-s5p64x0/common.c                    |  9 +++++
 arch/arm/mach-s5pc100/common.c                    |  9 +++++
 arch/arm/mach-s5pv210/common.c                    |  9 +++++
 arch/arm/plat-samsung/include/plat/samsung-time.h | 28 ++++++++-------
 drivers/clocksource/samsung-time.c                | 42 ++++++++++++++++++-----
 8 files changed, 101 insertions(+), 21 deletions(-)

diff --git a/arch/arm/mach-exynos/mach-universal_c210.c b/arch/arm/mach-exynos/mach-universal_c210.c
index 72f08fd..00554fe 100644
--- a/arch/arm/mach-exynos/mach-universal_c210.c
+++ b/arch/arm/mach-exynos/mach-universal_c210.c
@@ -1089,10 +1089,17 @@ static struct platform_device *universal_devices[] __initdata = {
 	&s5p_device_fimc_md,
 };
 
+static const struct samsung_timer_variant universal_timer_variant = {
+	.bits = 32,
+	.prescale = 2,
+	.divisor = 1,
+};
+
 static void __init universal_map_io(void)
 {
 	exynos_init_io(NULL, 0);
 	s3c24xx_init_uarts(universal_uartcfgs, ARRAY_SIZE(universal_uartcfgs));
+	samsung_timer_set_variant(&universal_timer_variant);
 	samsung_set_timer_source(SAMSUNG_PWM2, SAMSUNG_PWM4);
 	xxti_f = 0;
 	xusbxti_f = 24000000;
diff --git a/arch/arm/mach-s3c24xx/common.c b/arch/arm/mach-s3c24xx/common.c
index d97533d..816428f 100644
--- a/arch/arm/mach-s3c24xx/common.c
+++ b/arch/arm/mach-s3c24xx/common.c
@@ -49,6 +49,7 @@
 #include <plat/clock.h>
 #include <plat/cpu-freq.h>
 #include <plat/pll.h>
+#include <plat/samsung-time.h>
 
 #include "common.h"
 
@@ -216,6 +217,12 @@ static void s3c24xx_default_idle(void)
 		     S3C2410_CLKCON);
 }
 
+static const struct samsung_timer_variant s3c24xx_timer_variant = {
+	.bits = 16,
+	.prescale = 25,
+	.divisor = 2,
+};
+
 void __init s3c24xx_init_io(struct map_desc *mach_desc, int size)
 {
 	arm_pm_idle = s3c24xx_default_idle;
@@ -232,6 +239,8 @@ void __init s3c24xx_init_io(struct map_desc *mach_desc, int size)
 	s3c24xx_init_cpu();
 
 	s3c_init_cpu(samsung_cpu_id, cpu_ids, ARRAY_SIZE(cpu_ids));
+
+	samsung_timer_set_variant(&s3c24xx_timer_variant);
 }
 
 /* Serial port registrations */
diff --git a/arch/arm/mach-s3c64xx/common.c b/arch/arm/mach-s3c64xx/common.c
index 0b9c0ba..b6aa36d 100644
--- a/arch/arm/mach-s3c64xx/common.c
+++ b/arch/arm/mach-s3c64xx/common.c
@@ -44,6 +44,7 @@
 #include <plat/irq-vic-timer.h>
 #include <plat/regs-irqtype.h>
 #include <plat/regs-serial.h>
+#include <plat/samsung-time.h>
 #include <plat/watchdog-reset.h>
 
 #include "common.h"
@@ -148,6 +149,12 @@ static struct device s3c64xx_dev = {
 	.bus	= &s3c64xx_subsys,
 };
 
+static const struct samsung_timer_variant s3c64xx_timer_variant = {
+	.bits = 32,
+	.prescale = 2,
+	.divisor = 1,
+};
+
 /* read cpu identification code */
 
 void __init s3c64xx_init_io(struct map_desc *mach_desc, int size)
@@ -160,6 +167,8 @@ void __init s3c64xx_init_io(struct map_desc *mach_desc, int size)
 	s3c64xx_init_cpu();
 
 	s3c_init_cpu(samsung_cpu_id, cpu_ids, ARRAY_SIZE(cpu_ids));
+
+	samsung_timer_set_variant(&s3c64xx_timer_variant);
 }
 
 static __init int s3c64xx_dev_init(void)
diff --git a/arch/arm/mach-s5p64x0/common.c b/arch/arm/mach-s5p64x0/common.c
index 8ae5800..a339fbb 100644
--- a/arch/arm/mach-s5p64x0/common.c
+++ b/arch/arm/mach-s5p64x0/common.c
@@ -48,6 +48,7 @@
 #include <plat/gpio-cfg.h>
 #include <plat/regs-irqtype.h>
 #include <plat/regs-serial.h>
+#include <plat/samsung-time.h>
 #include <plat/watchdog-reset.h>
 
 #include "common.h"
@@ -156,6 +157,12 @@ static void s5p64x0_idle(void)
 	cpu_do_idle();
 }
 
+static const struct samsung_timer_variant s5p64x0_timer_variant = {
+	.bits = 32,
+	.prescale = 2,
+	.divisor = 1,
+};
+
 /*
  * s5p64x0_map_io
  *
@@ -173,6 +180,8 @@ void __init s5p64x0_init_io(struct map_desc *mach_desc, int size)
 	s5p_init_cpu(S5P64X0_SYS_ID);
 
 	s3c_init_cpu(samsung_cpu_id, cpu_ids, ARRAY_SIZE(cpu_ids));
+
+	samsung_timer_set_variant(&s5p64x0_timer_variant);
 }
 
 void __init s5p6440_map_io(void)
diff --git a/arch/arm/mach-s5pc100/common.c b/arch/arm/mach-s5pc100/common.c
index cc6e561..09e76d4 100644
--- a/arch/arm/mach-s5pc100/common.c
+++ b/arch/arm/mach-s5pc100/common.c
@@ -47,6 +47,7 @@
 #include <plat/onenand-core.h>
 #include <plat/spi-core.h>
 #include <plat/regs-serial.h>
+#include <plat/samsung-time.h>
 #include <plat/watchdog-reset.h>
 
 #include "common.h"
@@ -131,6 +132,12 @@ static struct map_desc s5pc100_iodesc[] __initdata = {
 	}
 };
 
+static const struct samsung_timer_variant s5pc100_timer_variant = {
+	.bits = 32,
+	.prescale = 2,
+	.divisor = 1,
+};
+
 /*
  * s5pc100_map_io
  *
@@ -148,6 +155,8 @@ void __init s5pc100_init_io(struct map_desc *mach_desc, int size)
 	s5p_init_cpu(S5P_VA_CHIPID);
 
 	s3c_init_cpu(samsung_cpu_id, cpu_ids, ARRAY_SIZE(cpu_ids));
+
+	samsung_timer_set_variant(&s5pc100_timer_variant);
 }
 
 void __init s5pc100_map_io(void)
diff --git a/arch/arm/mach-s5pv210/common.c b/arch/arm/mach-s5pv210/common.c
index 9dfe93e..44d3a5c 100644
--- a/arch/arm/mach-s5pv210/common.c
+++ b/arch/arm/mach-s5pv210/common.c
@@ -42,6 +42,7 @@
 #include <plat/fimc-core.h>
 #include <plat/iic-core.h>
 #include <plat/keypad-core.h>
+#include <plat/samsung-time.h>
 #include <plat/tv-core.h>
 #include <plat/spi-core.h>
 #include <plat/regs-serial.h>
@@ -148,6 +149,12 @@ void s5pv210_restart(char mode, const char *cmd)
 	__raw_writel(0x1, S5P_SWRESET);
 }
 
+static const struct samsung_timer_variant s5pv210_timer_variant = {
+	.bits = 32,
+	.prescale = 2,
+	.divisor = 1,
+};
+
 /*
  * s5pv210_map_io
  *
@@ -165,6 +172,8 @@ void __init s5pv210_init_io(struct map_desc *mach_desc, int size)
 	s5p_init_cpu(S5P_VA_CHIPID);
 
 	s3c_init_cpu(samsung_cpu_id, cpu_ids, ARRAY_SIZE(cpu_ids));
+
+	samsung_timer_set_variant(&s5pv210_timer_variant);
 }
 
 void __init s5pv210_map_io(void)
diff --git a/arch/arm/plat-samsung/include/plat/samsung-time.h b/arch/arm/plat-samsung/include/plat/samsung-time.h
index 4cc99bb..09077f4 100644
--- a/arch/arm/plat-samsung/include/plat/samsung-time.h
+++ b/arch/arm/plat-samsung/include/plat/samsung-time.h
@@ -27,26 +27,28 @@ struct samsung_timer_source {
 	unsigned int source_id;
 };
 
+/**
+ * struct samsung_timer_variant - SoC-specific parameters of Samsung PWM timers
+ * @bits:	bit width of time counters
+ * @prescale:	prescaler divisor
+ * @divisor:	main divisor
+ */
+struct samsung_timer_variant {
+	int bits;
+	u16 prescale;
+	u16 divisor;
+};
+
 /* Be able to sleep for atleast 4 seconds (usually more) */
 #define SAMSUNG_TIMER_MIN_RANGE	4
 
-#if defined(CONFIG_ARCH_S3C24XX) || defined(CONFIG_ARCH_S5PC100)
-#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,
+extern void samsung_set_timer_source(enum samsung_timer_mode event,
 					enum samsung_timer_mode source);
+extern void samsung_timer_set_variant(
+				const struct samsung_timer_variant *variant);
 
 extern void __init samsung_timer_init(void);
 
diff --git a/drivers/clocksource/samsung-time.c b/drivers/clocksource/samsung-time.c
index f899cbc..2b617c4 100644
--- a/drivers/clocksource/samsung-time.c
+++ b/drivers/clocksource/samsung-time.c
@@ -33,6 +33,7 @@ static struct clk *tdiv_event;
 static struct clk *tdiv_source;
 static struct clk *timerclk;
 static struct samsung_timer_source timer_source;
+static struct samsung_timer_variant timer_variant;
 static unsigned long clock_count_per_tick;
 static void samsung_timer_resume(void);
 
@@ -213,12 +214,16 @@ static void samsung_set_mode(enum clock_event_mode mode,
 
 static void samsung_timer_resume(void)
 {
+	u32 tcnt_max;
+
+	tcnt_max = (1UL << timer_variant.bits) - 1;
+
 	/* 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_setup(timer_source.source_id, tcnt_max);
 	samsung_time_start(timer_source.source_id, PERIODIC);
 }
 
@@ -232,6 +237,12 @@ void __init samsung_set_timer_source(enum samsung_timer_mode event,
 	timer_source.source_id = source;
 }
 
+void __init samsung_timer_set_variant(
+				const struct samsung_timer_variant *variant)
+{
+	timer_variant = *variant;
+}
+
 static struct clock_event_device time_event_device = {
 	.name		= "samsung_event_timer",
 	.features	= CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT,
@@ -267,8 +278,9 @@ static void __init samsung_clockevent_init(void)
 
 	tscaler = clk_get_parent(tdiv_event);
 
-	clk_set_rate(tscaler, pclk / TSCALER_DIV);
-	clk_set_rate(tdiv_event, pclk / TDIV);
+	clk_set_rate(tscaler, pclk / timer_variant.prescale);
+	clk_set_rate(tdiv_event, pclk /
+			(timer_variant.prescale * timer_variant.divisor));
 	clk_set_parent(tin_event, tdiv_event);
 
 	clock_rate = clk_get_rate(tin_event);
@@ -326,21 +338,29 @@ static void __init samsung_clocksource_init(void)
 {
 	unsigned long pclk;
 	unsigned long clock_rate;
+	u32 tcnt_max;
+	int ret;
+
+	tcnt_max = (1UL << timer_variant.bits) - 1;
 
 	pclk = clk_get_rate(timerclk);
 
-	clk_set_rate(tdiv_source, pclk / TDIV);
+	clk_set_rate(tdiv_source, pclk /
+			(timer_variant.prescale * timer_variant.divisor));
 	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_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);
+	setup_sched_clock(samsung_read_sched_clock,
+						timer_variant.bits, clock_rate);
 
-	if (clocksource_mmio_init(samsung_timer_reg(), "samsung_clocksource_timer",
-			clock_rate, 250, TSIZE, clocksource_mmio_readl_down))
+	ret = clocksource_mmio_init(samsung_timer_reg(),
+			"samsung_clocksource_timer", clock_rate, 250,
+			timer_variant.bits, clocksource_mmio_readl_down);
+	if (ret)
 		panic("samsung_clocksource_timer: can't register clocksource\n");
 }
 
@@ -388,6 +408,12 @@ static void __init samsung_timer_resources(void)
 
 void __init samsung_timer_init(void)
 {
+	if (!timer_source.source_id && !timer_source.event_id)
+		panic("timer sources not set (see samsung_set_timer_source)!\n");
+
+	if (!timer_variant.bits)
+		panic("timer variant not set (see samsung_timer_set_variant)!\n");
+
 	samsung_timer_resources();
 	samsung_clockevent_init();
 	samsung_clocksource_init();
-- 
1.8.1.5

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

* [PATCH v3 03/12] clocksource: samsung-time: Drop useless defines from public header
  2013-03-09 20:23 ` Tomasz Figa
@ 2013-03-09 20:23   ` Tomasz Figa
  -1 siblings, 0 replies; 34+ messages in thread
From: Tomasz Figa @ 2013-03-09 20:23 UTC (permalink / raw)
  To: linux-arm-kernel
  Cc: linux-samsung-soc, Kukjin Kim, kyungmin.park, linux, broonie,
	kwangwoo.lee, jacmet, augulis.darius, mcuelenaere, linux,
	Sylwester Nawrocki, buserror, christer, jekhor, ghcstop,
	Mark Rutland, Tomasz Figa, Heiko Stübner, Rob Herring

This patch cleans up public header from useless definitions.

Signed-off-by: Tomasz Figa <tomasz.figa@gmail.com>
---
 arch/arm/plat-samsung/include/plat/samsung-time.h |  6 ------
 drivers/clocksource/samsung-time.c                | 10 +++++-----
 2 files changed, 5 insertions(+), 11 deletions(-)

diff --git a/arch/arm/plat-samsung/include/plat/samsung-time.h b/arch/arm/plat-samsung/include/plat/samsung-time.h
index 09077f4..d64d8a2 100644
--- a/arch/arm/plat-samsung/include/plat/samsung-time.h
+++ b/arch/arm/plat-samsung/include/plat/samsung-time.h
@@ -39,12 +39,6 @@ struct samsung_timer_variant {
 	u16 divisor;
 };
 
-/* Be able to sleep for atleast 4 seconds (usually more) */
-#define SAMSUNG_TIMER_MIN_RANGE	4
-
-#define NON_PERIODIC		0
-#define PERIODIC		1
-
 extern void samsung_set_timer_source(enum samsung_timer_mode event,
 					enum samsung_timer_mode source);
 extern void samsung_timer_set_variant(
diff --git a/drivers/clocksource/samsung-time.c b/drivers/clocksource/samsung-time.c
index 2b617c4..f1eacef 100644
--- a/drivers/clocksource/samsung-time.c
+++ b/drivers/clocksource/samsung-time.c
@@ -183,7 +183,7 @@ 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);
+	samsung_time_start(timer_source.event_id, false);
 
 	return 0;
 }
@@ -196,7 +196,7 @@ static void samsung_set_mode(enum clock_event_mode mode,
 	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);
+		samsung_time_start(timer_source.event_id, true);
 		break;
 
 	case CLOCK_EVT_MODE_ONESHOT:
@@ -220,11 +220,11 @@ 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);
+	samsung_time_start(timer_source.event_id, true);
 
 	/* source timer restart */
 	samsung_time_setup(timer_source.source_id, tcnt_max);
-	samsung_time_start(timer_source.source_id, PERIODIC);
+	samsung_time_start(timer_source.source_id, true);
 }
 
 void __init samsung_set_timer_source(enum samsung_timer_mode event,
@@ -352,7 +352,7 @@ static void __init samsung_clocksource_init(void)
 	clock_rate = clk_get_rate(tin_source);
 
 	samsung_time_setup(timer_source.source_id, tcnt_max);
-	samsung_time_start(timer_source.source_id, PERIODIC);
+	samsung_time_start(timer_source.source_id, true);
 
 	setup_sched_clock(samsung_read_sched_clock,
 						timer_variant.bits, clock_rate);
-- 
1.8.1.5

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

* [PATCH v3 03/12] clocksource: samsung-time: Drop useless defines from public header
@ 2013-03-09 20:23   ` Tomasz Figa
  0 siblings, 0 replies; 34+ messages in thread
From: Tomasz Figa @ 2013-03-09 20:23 UTC (permalink / raw)
  To: linux-arm-kernel

This patch cleans up public header from useless definitions.

Signed-off-by: Tomasz Figa <tomasz.figa@gmail.com>
---
 arch/arm/plat-samsung/include/plat/samsung-time.h |  6 ------
 drivers/clocksource/samsung-time.c                | 10 +++++-----
 2 files changed, 5 insertions(+), 11 deletions(-)

diff --git a/arch/arm/plat-samsung/include/plat/samsung-time.h b/arch/arm/plat-samsung/include/plat/samsung-time.h
index 09077f4..d64d8a2 100644
--- a/arch/arm/plat-samsung/include/plat/samsung-time.h
+++ b/arch/arm/plat-samsung/include/plat/samsung-time.h
@@ -39,12 +39,6 @@ struct samsung_timer_variant {
 	u16 divisor;
 };
 
-/* Be able to sleep for atleast 4 seconds (usually more) */
-#define SAMSUNG_TIMER_MIN_RANGE	4
-
-#define NON_PERIODIC		0
-#define PERIODIC		1
-
 extern void samsung_set_timer_source(enum samsung_timer_mode event,
 					enum samsung_timer_mode source);
 extern void samsung_timer_set_variant(
diff --git a/drivers/clocksource/samsung-time.c b/drivers/clocksource/samsung-time.c
index 2b617c4..f1eacef 100644
--- a/drivers/clocksource/samsung-time.c
+++ b/drivers/clocksource/samsung-time.c
@@ -183,7 +183,7 @@ 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);
+	samsung_time_start(timer_source.event_id, false);
 
 	return 0;
 }
@@ -196,7 +196,7 @@ static void samsung_set_mode(enum clock_event_mode mode,
 	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);
+		samsung_time_start(timer_source.event_id, true);
 		break;
 
 	case CLOCK_EVT_MODE_ONESHOT:
@@ -220,11 +220,11 @@ 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);
+	samsung_time_start(timer_source.event_id, true);
 
 	/* source timer restart */
 	samsung_time_setup(timer_source.source_id, tcnt_max);
-	samsung_time_start(timer_source.source_id, PERIODIC);
+	samsung_time_start(timer_source.source_id, true);
 }
 
 void __init samsung_set_timer_source(enum samsung_timer_mode event,
@@ -352,7 +352,7 @@ static void __init samsung_clocksource_init(void)
 	clock_rate = clk_get_rate(tin_source);
 
 	samsung_time_setup(timer_source.source_id, tcnt_max);
-	samsung_time_start(timer_source.source_id, PERIODIC);
+	samsung_time_start(timer_source.source_id, true);
 
 	setup_sched_clock(samsung_read_sched_clock,
 						timer_variant.bits, clock_rate);
-- 
1.8.1.5

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

* [PATCH v3 04/12] ARM: SAMSUNG: Move samsung-time.h header to inlude/clocksource
  2013-03-09 20:23 ` Tomasz Figa
@ 2013-03-09 20:23   ` Tomasz Figa
  -1 siblings, 0 replies; 34+ messages in thread
From: Tomasz Figa @ 2013-03-09 20:23 UTC (permalink / raw)
  To: linux-arm-kernel
  Cc: linux-samsung-soc, Kukjin Kim, kyungmin.park, linux, broonie,
	kwangwoo.lee, jacmet, augulis.darius, mcuelenaere, linux,
	Sylwester Nawrocki, buserror, christer, jekhor, ghcstop,
	Mark Rutland, Tomasz Figa, Heiko Stübner, Rob Herring

This patch moves the samsung-time.h header file to include/clocksource
directory and fixes all references to it.

Signed-off-by: Tomasz Figa <tomasz.figa@gmail.com>
---
 arch/arm/mach-exynos/mach-universal_c210.c        |  2 +-
 arch/arm/mach-s3c24xx/common.c                    |  2 +-
 arch/arm/mach-s3c24xx/mach-amlm5900.c             |  2 +-
 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             |  2 +-
 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                |  2 +-
 arch/arm/mach-s3c64xx/common.c                    |  2 +-
 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              |  2 +-
 arch/arm/mach-s3c64xx/mach-smartq7.c              |  2 +-
 arch/arm/mach-s3c64xx/mach-smdk6400.c             |  2 +-
 arch/arm/mach-s3c64xx/mach-smdk6410.c             |  2 +-
 arch/arm/mach-s5p64x0/common.c                    |  2 +-
 arch/arm/mach-s5p64x0/mach-smdk6440.c             |  2 +-
 arch/arm/mach-s5p64x0/mach-smdk6450.c             |  2 +-
 arch/arm/mach-s5pc100/common.c                    |  2 +-
 arch/arm/mach-s5pc100/mach-smdkc100.c             |  2 +-
 arch/arm/mach-s5pv210/common.c                    |  2 +-
 arch/arm/mach-s5pv210/mach-aquila.c               |  2 +-
 arch/arm/mach-s5pv210/mach-goni.c                 |  2 +-
 arch/arm/mach-s5pv210/mach-smdkc110.c             |  2 +-
 arch/arm/mach-s5pv210/mach-smdkv210.c             |  2 +-
 arch/arm/mach-s5pv210/mach-torbreck.c             |  2 +-
 arch/arm/plat-samsung/include/plat/samsung-time.h | 49 -----------------------
 drivers/clocksource/samsung-time.c                |  3 +-
 include/clocksource/samsung-time.h                | 49 +++++++++++++++++++++++
 51 files changed, 99 insertions(+), 98 deletions(-)
 delete mode 100644 arch/arm/plat-samsung/include/plat/samsung-time.h
 create mode 100644 include/clocksource/samsung-time.h

diff --git a/arch/arm/mach-exynos/mach-universal_c210.c b/arch/arm/mach-exynos/mach-universal_c210.c
index 00554fe..8ce1206 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/samsung-time.h>
+#include <clocksource/samsung-time.h>
 #include <plat/camport.h>
 
 #include <mach/map.h>
diff --git a/arch/arm/mach-s3c24xx/common.c b/arch/arm/mach-s3c24xx/common.c
index 816428f..fe054d6 100644
--- a/arch/arm/mach-s3c24xx/common.c
+++ b/arch/arm/mach-s3c24xx/common.c
@@ -49,7 +49,7 @@
 #include <plat/clock.h>
 #include <plat/cpu-freq.h>
 #include <plat/pll.h>
-#include <plat/samsung-time.h>
+#include <clocksource/samsung-time.h>
 
 #include "common.h"
 
diff --git a/arch/arm/mach-s3c24xx/mach-amlm5900.c b/arch/arm/mach-s3c24xx/mach-amlm5900.c
index e27b5c9..dc720ad 100644
--- a/arch/arm/mach-s3c24xx/mach-amlm5900.c
+++ b/arch/arm/mach-s3c24xx/mach-amlm5900.c
@@ -63,7 +63,7 @@
 #include <linux/mtd/map.h>
 #include <linux/mtd/physmap.h>
 
-#include <plat/samsung-time.h>
+#include <clocksource/samsung-time.h>
 
 #include "common.h"
 
diff --git a/arch/arm/mach-s3c24xx/mach-anubis.c b/arch/arm/mach-s3c24xx/mach-anubis.c
index c1fb6c3..47a7bc3 100644
--- a/arch/arm/mach-s3c24xx/mach-anubis.c
+++ b/arch/arm/mach-s3c24xx/mach-anubis.c
@@ -49,7 +49,7 @@
 #include <plat/devs.h>
 #include <plat/cpu.h>
 #include <linux/platform_data/asoc-s3c24xx_simtec.h>
-#include <plat/samsung-time.h>
+#include <clocksource/samsung-time.h>
 
 #include "anubis.h"
 #include "common.h"
diff --git a/arch/arm/mach-s3c24xx/mach-at2440evb.c b/arch/arm/mach-s3c24xx/mach-at2440evb.c
index 6dfeeb7..756fed4 100644
--- a/arch/arm/mach-s3c24xx/mach-at2440evb.c
+++ b/arch/arm/mach-s3c24xx/mach-at2440evb.c
@@ -48,7 +48,7 @@
 #include <plat/devs.h>
 #include <plat/cpu.h>
 #include <linux/platform_data/mmc-s3cmci.h>
-#include <plat/samsung-time.h>
+#include <clocksource/samsung-time.h>
 
 #include "common.h"
 
diff --git a/arch/arm/mach-s3c24xx/mach-bast.c b/arch/arm/mach-s3c24xx/mach-bast.c
index 22d6ae9..82ed39e 100644
--- a/arch/arm/mach-s3c24xx/mach-bast.c
+++ b/arch/arm/mach-s3c24xx/mach-bast.c
@@ -55,7 +55,7 @@
 #include <plat/devs.h>
 #include <plat/gpio-cfg.h>
 #include <plat/regs-serial.h>
-#include <plat/samsung-time.h>
+#include <clocksource/samsung-time.h>
 
 #include "bast.h"
 #include "common.h"
diff --git a/arch/arm/mach-s3c24xx/mach-gta02.c b/arch/arm/mach-s3c24xx/mach-gta02.c
index 13d8d07..b3d5c89 100644
--- a/arch/arm/mach-s3c24xx/mach-gta02.c
+++ b/arch/arm/mach-s3c24xx/mach-gta02.c
@@ -81,7 +81,7 @@
 #include <plat/gpio-cfg.h>
 #include <plat/pm.h>
 #include <plat/regs-serial.h>
-#include <plat/samsung-time.h>
+#include <clocksource/samsung-time.h>
 
 #include "common.h"
 #include "gta02.h"
diff --git a/arch/arm/mach-s3c24xx/mach-h1940.c b/arch/arm/mach-s3c24xx/mach-h1940.c
index af4334d..c0c24e9 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 <clocksource/samsung-time.h>
 
 #include "common.h"
 #include "h1940.h"
diff --git a/arch/arm/mach-s3c24xx/mach-jive.c b/arch/arm/mach-s3c24xx/mach-jive.c
index a45fcd8..63b7359 100644
--- a/arch/arm/mach-s3c24xx/mach-jive.c
+++ b/arch/arm/mach-s3c24xx/mach-jive.c
@@ -52,7 +52,7 @@
 #include <plat/cpu.h>
 #include <plat/pm.h>
 #include <linux/platform_data/usb-s3c2410_udc.h>
-#include <plat/samsung-time.h>
+#include <clocksource/samsung-time.h>
 
 #include "common.h"
 #include "s3c2412-power.h"
diff --git a/arch/arm/mach-s3c24xx/mach-mini2440.c b/arch/arm/mach-s3c24xx/mach-mini2440.c
index a83db46..be78d62 100644
--- a/arch/arm/mach-s3c24xx/mach-mini2440.c
+++ b/arch/arm/mach-s3c24xx/mach-mini2440.c
@@ -56,7 +56,7 @@
 #include <plat/clock.h>
 #include <plat/devs.h>
 #include <plat/cpu.h>
-#include <plat/samsung-time.h>
+#include <clocksource/samsung-time.h>
 
 #include <sound/s3c24xx_uda134x.h>
 
diff --git a/arch/arm/mach-s3c24xx/mach-n30.c b/arch/arm/mach-s3c24xx/mach-n30.c
index 2cb46c3..c19e6a5 100644
--- a/arch/arm/mach-s3c24xx/mach-n30.c
+++ b/arch/arm/mach-s3c24xx/mach-n30.c
@@ -49,7 +49,7 @@
 #include <plat/devs.h>
 #include <linux/platform_data/mmc-s3cmci.h>
 #include <linux/platform_data/usb-s3c2410_udc.h>
-#include <plat/samsung-time.h>
+#include <clocksource/samsung-time.h>
 
 #include "common.h"
 
diff --git a/arch/arm/mach-s3c24xx/mach-nexcoder.c b/arch/arm/mach-s3c24xx/mach-nexcoder.c
index 01f4354..7ef69a7 100644
--- a/arch/arm/mach-s3c24xx/mach-nexcoder.c
+++ b/arch/arm/mach-s3c24xx/mach-nexcoder.c
@@ -44,7 +44,7 @@
 #include <plat/clock.h>
 #include <plat/devs.h>
 #include <plat/cpu.h>
-#include <plat/samsung-time.h>
+#include <clocksource/samsung-time.h>
 
 #include "common.h"
 
diff --git a/arch/arm/mach-s3c24xx/mach-osiris.c b/arch/arm/mach-s3c24xx/mach-osiris.c
index 58d6fbe..7edd42d 100644
--- a/arch/arm/mach-s3c24xx/mach-osiris.c
+++ b/arch/arm/mach-s3c24xx/mach-osiris.c
@@ -45,7 +45,7 @@
 #include <plat/devs.h>
 #include <plat/gpio-cfg.h>
 #include <plat/regs-serial.h>
-#include <plat/samsung-time.h>
+#include <clocksource/samsung-time.h>
 
 #include <mach/hardware.h>
 #include <mach/regs-gpio.h>
diff --git a/arch/arm/mach-s3c24xx/mach-otom.c b/arch/arm/mach-s3c24xx/mach-otom.c
index 7e16b07..1491c6d 100644
--- a/arch/arm/mach-s3c24xx/mach-otom.c
+++ b/arch/arm/mach-s3c24xx/mach-otom.c
@@ -33,7 +33,7 @@
 #include <plat/cpu.h>
 #include <plat/devs.h>
 #include <plat/regs-serial.h>
-#include <plat/samsung-time.h>
+#include <clocksource/samsung-time.h>
 
 #include "common.h"
 #include "otom.h"
diff --git a/arch/arm/mach-s3c24xx/mach-qt2410.c b/arch/arm/mach-s3c24xx/mach-qt2410.c
index f8feaea..ef29d6a 100644
--- a/arch/arm/mach-s3c24xx/mach-qt2410.c
+++ b/arch/arm/mach-s3c24xx/mach-qt2410.c
@@ -59,7 +59,7 @@
 #include <plat/devs.h>
 #include <plat/cpu.h>
 #include <plat/pm.h>
-#include <plat/samsung-time.h>
+#include <clocksource/samsung-time.h>
 
 #include "common.h"
 #include "common-smdk.h"
diff --git a/arch/arm/mach-s3c24xx/mach-rx1950.c b/arch/arm/mach-s3c24xx/mach-rx1950.c
index e4d67a3..6900654 100644
--- a/arch/arm/mach-s3c24xx/mach-rx1950.c
+++ b/arch/arm/mach-s3c24xx/mach-rx1950.c
@@ -58,7 +58,7 @@
 #include <plat/pm.h>
 #include <plat/regs-iic.h>
 #include <plat/regs-serial.h>
-#include <plat/samsung-time.h>
+#include <clocksource/samsung-time.h>
 
 #include "common.h"
 #include "h1940.h"
diff --git a/arch/arm/mach-s3c24xx/mach-rx3715.c b/arch/arm/mach-s3c24xx/mach-rx3715.c
index 3bc6231..922d517 100644
--- a/arch/arm/mach-s3c24xx/mach-rx3715.c
+++ b/arch/arm/mach-s3c24xx/mach-rx3715.c
@@ -49,7 +49,7 @@
 #include <plat/devs.h>
 #include <plat/pm.h>
 #include <plat/regs-serial.h>
-#include <plat/samsung-time.h>
+#include <clocksource/samsung-time.h>
 
 #include "common.h"
 #include "h1940.h"
diff --git a/arch/arm/mach-s3c24xx/mach-smdk2410.c b/arch/arm/mach-s3c24xx/mach-smdk2410.c
index a773789..048553d 100644
--- a/arch/arm/mach-s3c24xx/mach-smdk2410.c
+++ b/arch/arm/mach-s3c24xx/mach-smdk2410.c
@@ -51,7 +51,7 @@
 
 #include <plat/devs.h>
 #include <plat/cpu.h>
-#include <plat/samsung-time.h>
+#include <clocksource/samsung-time.h>
 
 #include "common.h"
 #include "common-smdk.h"
diff --git a/arch/arm/mach-s3c24xx/mach-smdk2413.c b/arch/arm/mach-s3c24xx/mach-smdk2413.c
index 8146e92..e3b3bcd 100644
--- a/arch/arm/mach-s3c24xx/mach-smdk2413.c
+++ b/arch/arm/mach-s3c24xx/mach-smdk2413.c
@@ -44,7 +44,7 @@
 #include <plat/clock.h>
 #include <plat/devs.h>
 #include <plat/cpu.h>
-#include <plat/samsung-time.h>
+#include <clocksource/samsung-time.h>
 
 #include "common.h"
 #include "common-smdk.h"
diff --git a/arch/arm/mach-s3c24xx/mach-smdk2416.c b/arch/arm/mach-s3c24xx/mach-smdk2416.c
index cb46847..b4ec1a0 100644
--- a/arch/arm/mach-s3c24xx/mach-smdk2416.c
+++ b/arch/arm/mach-s3c24xx/mach-smdk2416.c
@@ -50,7 +50,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 <clocksource/samsung-time.h>
 
 #include <plat/fb.h>
 
diff --git a/arch/arm/mach-s3c24xx/mach-smdk2440.c b/arch/arm/mach-s3c24xx/mach-smdk2440.c
index de2e5d3..81dbeee 100644
--- a/arch/arm/mach-s3c24xx/mach-smdk2440.c
+++ b/arch/arm/mach-s3c24xx/mach-smdk2440.c
@@ -41,7 +41,7 @@
 #include <plat/clock.h>
 #include <plat/devs.h>
 #include <plat/cpu.h>
-#include <plat/samsung-time.h>
+#include <clocksource/samsung-time.h>
 
 #include "common.h"
 #include "common-smdk.h"
diff --git a/arch/arm/mach-s3c24xx/mach-smdk2443.c b/arch/arm/mach-s3c24xx/mach-smdk2443.c
index 9435c3b..aff1d3e 100644
--- a/arch/arm/mach-s3c24xx/mach-smdk2443.c
+++ b/arch/arm/mach-s3c24xx/mach-smdk2443.c
@@ -41,7 +41,7 @@
 #include <plat/clock.h>
 #include <plat/devs.h>
 #include <plat/cpu.h>
-#include <plat/samsung-time.h>
+#include <clocksource/samsung-time.h>
 
 #include "common.h"
 #include "common-smdk.h"
diff --git a/arch/arm/mach-s3c24xx/mach-tct_hammer.c b/arch/arm/mach-s3c24xx/mach-tct_hammer.c
index 7fad8f0..d67c14d 100644
--- a/arch/arm/mach-s3c24xx/mach-tct_hammer.c
+++ b/arch/arm/mach-s3c24xx/mach-tct_hammer.c
@@ -53,7 +53,7 @@
 #include <linux/mtd/partitions.h>
 #include <linux/mtd/map.h>
 #include <linux/mtd/physmap.h>
-#include <plat/samsung-time.h>
+#include <clocksource/samsung-time.h>
 
 #include "common.h"
 
diff --git a/arch/arm/mach-s3c24xx/mach-vr1000.c b/arch/arm/mach-s3c24xx/mach-vr1000.c
index 42e7187..c1cdd8c 100644
--- a/arch/arm/mach-s3c24xx/mach-vr1000.c
+++ b/arch/arm/mach-s3c24xx/mach-vr1000.c
@@ -45,7 +45,7 @@
 #include <plat/cpu.h>
 #include <plat/devs.h>
 #include <plat/regs-serial.h>
-#include <plat/samsung-time.h>
+#include <clocksource/samsung-time.h>
 
 #include "bast.h"
 #include "common.h"
diff --git a/arch/arm/mach-s3c24xx/mach-vstms.c b/arch/arm/mach-s3c24xx/mach-vstms.c
index b665884..dc6a5ee 100644
--- a/arch/arm/mach-s3c24xx/mach-vstms.c
+++ b/arch/arm/mach-s3c24xx/mach-vstms.c
@@ -44,7 +44,7 @@
 #include <plat/clock.h>
 #include <plat/devs.h>
 #include <plat/cpu.h>
-#include <plat/samsung-time.h>
+#include <clocksource/samsung-time.h>
 
 #include "common.h"
 
diff --git a/arch/arm/mach-s3c64xx/common.c b/arch/arm/mach-s3c64xx/common.c
index b6aa36d..0f7df6a 100644
--- a/arch/arm/mach-s3c64xx/common.c
+++ b/arch/arm/mach-s3c64xx/common.c
@@ -44,7 +44,7 @@
 #include <plat/irq-vic-timer.h>
 #include <plat/regs-irqtype.h>
 #include <plat/regs-serial.h>
-#include <plat/samsung-time.h>
+#include <clocksource/samsung-time.h>
 #include <plat/watchdog-reset.h>
 
 #include "common.h"
diff --git a/arch/arm/mach-s3c64xx/mach-anw6410.c b/arch/arm/mach-s3c64xx/mach-anw6410.c
index 35e3f54..d2ef383 100644
--- a/arch/arm/mach-s3c64xx/mach-anw6410.c
+++ b/arch/arm/mach-s3c64xx/mach-anw6410.c
@@ -49,7 +49,7 @@
 #include <plat/devs.h>
 #include <plat/cpu.h>
 #include <mach/regs-gpio.h>
-#include <plat/samsung-time.h>
+#include <clocksource/samsung-time.h>
 
 #include "common.h"
 #include "regs-modem.h"
diff --git a/arch/arm/mach-s3c64xx/mach-crag6410.c b/arch/arm/mach-s3c64xx/mach-crag6410.c
index 8ad88ac..dc41db0 100644
--- a/arch/arm/mach-s3c64xx/mach-crag6410.c
+++ b/arch/arm/mach-s3c64xx/mach-crag6410.c
@@ -64,7 +64,7 @@
 #include <plat/adc.h>
 #include <linux/platform_data/i2c-s3c2410.h>
 #include <plat/pm.h>
-#include <plat/samsung-time.h>
+#include <clocksource/samsung-time.h>
 
 #include "common.h"
 #include "crag6410.h"
diff --git a/arch/arm/mach-s3c64xx/mach-hmt.c b/arch/arm/mach-s3c64xx/mach-hmt.c
index 5b7f357..e830ce9 100644
--- a/arch/arm/mach-s3c64xx/mach-hmt.c
+++ b/arch/arm/mach-s3c64xx/mach-hmt.c
@@ -41,7 +41,7 @@
 #include <plat/clock.h>
 #include <plat/devs.h>
 #include <plat/cpu.h>
-#include <plat/samsung-time.h>
+#include <clocksource/samsung-time.h>
 
 #include "common.h"
 
diff --git a/arch/arm/mach-s3c64xx/mach-mini6410.c b/arch/arm/mach-s3c64xx/mach-mini6410.c
index fc043e3..c78fed4 100644
--- a/arch/arm/mach-s3c64xx/mach-mini6410.c
+++ b/arch/arm/mach-s3c64xx/mach-mini6410.c
@@ -41,7 +41,7 @@
 
 #include <video/platform_lcd.h>
 #include <video/samsung_fimd.h>
-#include <plat/samsung-time.h>
+#include <clocksource/samsung-time.h>
 
 #include "common.h"
 #include "regs-modem.h"
diff --git a/arch/arm/mach-s3c64xx/mach-ncp.c b/arch/arm/mach-s3c64xx/mach-ncp.c
index 7e2c390..6d24391 100644
--- a/arch/arm/mach-s3c64xx/mach-ncp.c
+++ b/arch/arm/mach-s3c64xx/mach-ncp.c
@@ -43,7 +43,7 @@
 #include <plat/clock.h>
 #include <plat/devs.h>
 #include <plat/cpu.h>
-#include <plat/samsung-time.h>
+#include <clocksource/samsung-time.h>
 
 #include "common.h"
 
diff --git a/arch/arm/mach-s3c64xx/mach-real6410.c b/arch/arm/mach-s3c64xx/mach-real6410.c
index 8bed37b..cb105c7 100644
--- a/arch/arm/mach-s3c64xx/mach-real6410.c
+++ b/arch/arm/mach-s3c64xx/mach-real6410.c
@@ -42,7 +42,7 @@
 
 #include <video/platform_lcd.h>
 #include <video/samsung_fimd.h>
-#include <plat/samsung-time.h>
+#include <clocksource/samsung-time.h>
 
 #include "common.h"
 #include "regs-modem.h"
diff --git a/arch/arm/mach-s3c64xx/mach-smartq.c b/arch/arm/mach-s3c64xx/mach-smartq.c
index 58ac990..e76028d 100644
--- a/arch/arm/mach-s3c64xx/mach-smartq.c
+++ b/arch/arm/mach-s3c64xx/mach-smartq.c
@@ -38,7 +38,7 @@
 #include <linux/platform_data/touchscreen-s3c2410.h>
 
 #include <video/platform_lcd.h>
-#include <plat/samsung-time.h>
+#include <clocksource/samsung-time.h>
 
 #include "common.h"
 #include "regs-modem.h"
diff --git a/arch/arm/mach-s3c64xx/mach-smartq5.c b/arch/arm/mach-s3c64xx/mach-smartq5.c
index 8aca5da..2f5eb2a 100644
--- a/arch/arm/mach-s3c64xx/mach-smartq5.c
+++ b/arch/arm/mach-s3c64xx/mach-smartq5.c
@@ -28,7 +28,7 @@
 #include <plat/devs.h>
 #include <plat/fb.h>
 #include <plat/gpio-cfg.h>
-#include <plat/samsung-time.h>
+#include <clocksource/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 a052e10..3b898f6 100644
--- a/arch/arm/mach-s3c64xx/mach-smartq7.c
+++ b/arch/arm/mach-s3c64xx/mach-smartq7.c
@@ -28,7 +28,7 @@
 #include <plat/devs.h>
 #include <plat/fb.h>
 #include <plat/gpio-cfg.h>
-#include <plat/samsung-time.h>
+#include <clocksource/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 d70c084..3964e19 100644
--- a/arch/arm/mach-s3c64xx/mach-smdk6400.c
+++ b/arch/arm/mach-s3c64xx/mach-smdk6400.c
@@ -35,7 +35,7 @@
 #include <plat/devs.h>
 #include <plat/cpu.h>
 #include <linux/platform_data/i2c-s3c2410.h>
-#include <plat/samsung-time.h>
+#include <clocksource/samsung-time.h>
 
 #include "common.h"
 
diff --git a/arch/arm/mach-s3c64xx/mach-smdk6410.c b/arch/arm/mach-s3c64xx/mach-smdk6410.c
index bd3295a..c58cb54 100644
--- a/arch/arm/mach-s3c64xx/mach-smdk6410.c
+++ b/arch/arm/mach-s3c64xx/mach-smdk6410.c
@@ -69,7 +69,7 @@
 #include <linux/platform_data/touchscreen-s3c2410.h>
 #include <plat/keypad.h>
 #include <plat/backlight.h>
-#include <plat/samsung-time.h>
+#include <clocksource/samsung-time.h>
 
 #include "common.h"
 #include "regs-modem.h"
diff --git a/arch/arm/mach-s5p64x0/common.c b/arch/arm/mach-s5p64x0/common.c
index a339fbb..2839022 100644
--- a/arch/arm/mach-s5p64x0/common.c
+++ b/arch/arm/mach-s5p64x0/common.c
@@ -48,7 +48,7 @@
 #include <plat/gpio-cfg.h>
 #include <plat/regs-irqtype.h>
 #include <plat/regs-serial.h>
-#include <plat/samsung-time.h>
+#include <clocksource/samsung-time.h>
 #include <plat/watchdog-reset.h>
 
 #include "common.h"
diff --git a/arch/arm/mach-s5p64x0/mach-smdk6440.c b/arch/arm/mach-s5p64x0/mach-smdk6440.c
index 73f71a6..4f70ee7 100644
--- a/arch/arm/mach-s5p64x0/mach-smdk6440.c
+++ b/arch/arm/mach-s5p64x0/mach-smdk6440.c
@@ -48,7 +48,7 @@
 #include <plat/pll.h>
 #include <plat/adc.h>
 #include <linux/platform_data/touchscreen-s3c2410.h>
-#include <plat/samsung-time.h>
+#include <clocksource/samsung-time.h>
 #include <plat/backlight.h>
 #include <plat/fb.h>
 #include <plat/sdhci.h>
diff --git a/arch/arm/mach-s5p64x0/mach-smdk6450.c b/arch/arm/mach-s5p64x0/mach-smdk6450.c
index 18303e1..7aa9175 100644
--- a/arch/arm/mach-s5p64x0/mach-smdk6450.c
+++ b/arch/arm/mach-s5p64x0/mach-smdk6450.c
@@ -48,7 +48,7 @@
 #include <plat/pll.h>
 #include <plat/adc.h>
 #include <linux/platform_data/touchscreen-s3c2410.h>
-#include <plat/samsung-time.h>
+#include <clocksource/samsung-time.h>
 #include <plat/backlight.h>
 #include <plat/fb.h>
 #include <plat/sdhci.h>
diff --git a/arch/arm/mach-s5pc100/common.c b/arch/arm/mach-s5pc100/common.c
index 09e76d4..0df9124 100644
--- a/arch/arm/mach-s5pc100/common.c
+++ b/arch/arm/mach-s5pc100/common.c
@@ -47,7 +47,7 @@
 #include <plat/onenand-core.h>
 #include <plat/spi-core.h>
 #include <plat/regs-serial.h>
-#include <plat/samsung-time.h>
+#include <clocksource/samsung-time.h>
 #include <plat/watchdog-reset.h>
 
 #include "common.h"
diff --git a/arch/arm/mach-s5pc100/mach-smdkc100.c b/arch/arm/mach-s5pc100/mach-smdkc100.c
index 8c880f7..b19c571 100644
--- a/arch/arm/mach-s5pc100/mach-smdkc100.c
+++ b/arch/arm/mach-s5pc100/mach-smdkc100.c
@@ -51,7 +51,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 <clocksource/samsung-time.h>
 
 #include "common.h"
 
diff --git a/arch/arm/mach-s5pv210/common.c b/arch/arm/mach-s5pv210/common.c
index 44d3a5c..2d1bc6b 100644
--- a/arch/arm/mach-s5pv210/common.c
+++ b/arch/arm/mach-s5pv210/common.c
@@ -42,7 +42,7 @@
 #include <plat/fimc-core.h>
 #include <plat/iic-core.h>
 #include <plat/keypad-core.h>
-#include <plat/samsung-time.h>
+#include <clocksource/samsung-time.h>
 #include <plat/tv-core.h>
 #include <plat/spi-core.h>
 #include <plat/regs-serial.h>
diff --git a/arch/arm/mach-s5pv210/mach-aquila.c b/arch/arm/mach-s5pv210/mach-aquila.c
index ed2b854..d02665d 100644
--- a/arch/arm/mach-s5pv210/mach-aquila.c
+++ b/arch/arm/mach-s5pv210/mach-aquila.c
@@ -38,7 +38,7 @@
 #include <plat/fb.h>
 #include <plat/fimc-core.h>
 #include <plat/sdhci.h>
-#include <plat/samsung-time.h>
+#include <clocksource/samsung-time.h>
 
 #include "common.h"
 
diff --git a/arch/arm/mach-s5pv210/mach-goni.c b/arch/arm/mach-s5pv210/mach-goni.c
index 2564394..7ae9c4a 100644
--- a/arch/arm/mach-s5pv210/mach-goni.c
+++ b/arch/arm/mach-s5pv210/mach-goni.c
@@ -47,7 +47,7 @@
 #include <plat/keypad.h>
 #include <plat/sdhci.h>
 #include <plat/clock.h>
-#include <plat/samsung-time.h>
+#include <clocksource/samsung-time.h>
 #include <plat/mfc.h>
 #include <plat/camport.h>
 
diff --git a/arch/arm/mach-s5pv210/mach-smdkc110.c b/arch/arm/mach-s5pv210/mach-smdkc110.c
index 7c0ed07..1f1d588 100644
--- a/arch/arm/mach-s5pv210/mach-smdkc110.c
+++ b/arch/arm/mach-s5pv210/mach-smdkc110.c
@@ -29,7 +29,7 @@
 #include <linux/platform_data/ata-samsung_cf.h>
 #include <linux/platform_data/i2c-s3c2410.h>
 #include <plat/pm.h>
-#include <plat/samsung-time.h>
+#include <clocksource/samsung-time.h>
 #include <plat/mfc.h>
 
 #include "common.h"
diff --git a/arch/arm/mach-s5pv210/mach-smdkv210.c b/arch/arm/mach-s5pv210/mach-smdkv210.c
index d50b6f1..7d16418 100644
--- a/arch/arm/mach-s5pv210/mach-smdkv210.c
+++ b/arch/arm/mach-s5pv210/mach-smdkv210.c
@@ -44,7 +44,7 @@
 #include <plat/keypad.h>
 #include <plat/pm.h>
 #include <plat/fb.h>
-#include <plat/samsung-time.h>
+#include <clocksource/samsung-time.h>
 #include <plat/backlight.h>
 #include <plat/mfc.h>
 #include <plat/clock.h>
diff --git a/arch/arm/mach-s5pv210/mach-torbreck.c b/arch/arm/mach-s5pv210/mach-torbreck.c
index 579afe8..be08b5c 100644
--- a/arch/arm/mach-s5pv210/mach-torbreck.c
+++ b/arch/arm/mach-s5pv210/mach-torbreck.c
@@ -26,7 +26,7 @@
 #include <plat/devs.h>
 #include <plat/cpu.h>
 #include <linux/platform_data/i2c-s3c2410.h>
-#include <plat/samsung-time.h>
+#include <clocksource/samsung-time.h>
 
 #include "common.h"
 
diff --git a/arch/arm/plat-samsung/include/plat/samsung-time.h b/arch/arm/plat-samsung/include/plat/samsung-time.h
deleted file mode 100644
index d64d8a2..0000000
--- a/arch/arm/plat-samsung/include/plat/samsung-time.h
+++ /dev/null
@@ -1,49 +0,0 @@
-/* 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;
-};
-
-/**
- * struct samsung_timer_variant - SoC-specific parameters of Samsung PWM timers
- * @bits:	bit width of time counters
- * @prescale:	prescaler divisor
- * @divisor:	main divisor
- */
-struct samsung_timer_variant {
-	int bits;
-	u16 prescale;
-	u16 divisor;
-};
-
-extern void samsung_set_timer_source(enum samsung_timer_mode event,
-					enum samsung_timer_mode source);
-extern void samsung_timer_set_variant(
-				const struct samsung_timer_variant *variant);
-
-extern void __init samsung_timer_init(void);
-
-#endif /* __ASM_PLAT_SAMSUNG_TIME_H */
diff --git a/drivers/clocksource/samsung-time.c b/drivers/clocksource/samsung-time.c
index f1eacef..03955fb 100644
--- a/drivers/clocksource/samsung-time.c
+++ b/drivers/clocksource/samsung-time.c
@@ -16,6 +16,8 @@
 #include <linux/clockchips.h>
 #include <linux/platform_device.h>
 
+#include <clocksource/samsung-time.h>
+
 #include <asm/smp_twd.h>
 #include <asm/mach/time.h>
 #include <asm/mach/arch.h>
@@ -25,7 +27,6 @@
 #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;
diff --git a/include/clocksource/samsung-time.h b/include/clocksource/samsung-time.h
new file mode 100644
index 0000000..d64d8a2
--- /dev/null
+++ b/include/clocksource/samsung-time.h
@@ -0,0 +1,49 @@
+/* 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;
+};
+
+/**
+ * struct samsung_timer_variant - SoC-specific parameters of Samsung PWM timers
+ * @bits:	bit width of time counters
+ * @prescale:	prescaler divisor
+ * @divisor:	main divisor
+ */
+struct samsung_timer_variant {
+	int bits;
+	u16 prescale;
+	u16 divisor;
+};
+
+extern void samsung_set_timer_source(enum samsung_timer_mode event,
+					enum samsung_timer_mode source);
+extern void samsung_timer_set_variant(
+				const struct samsung_timer_variant *variant);
+
+extern void __init samsung_timer_init(void);
+
+#endif /* __ASM_PLAT_SAMSUNG_TIME_H */
-- 
1.8.1.5

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

* [PATCH v3 04/12] ARM: SAMSUNG: Move samsung-time.h header to inlude/clocksource
@ 2013-03-09 20:23   ` Tomasz Figa
  0 siblings, 0 replies; 34+ messages in thread
From: Tomasz Figa @ 2013-03-09 20:23 UTC (permalink / raw)
  To: linux-arm-kernel

This patch moves the samsung-time.h header file to include/clocksource
directory and fixes all references to it.

Signed-off-by: Tomasz Figa <tomasz.figa@gmail.com>
---
 arch/arm/mach-exynos/mach-universal_c210.c        |  2 +-
 arch/arm/mach-s3c24xx/common.c                    |  2 +-
 arch/arm/mach-s3c24xx/mach-amlm5900.c             |  2 +-
 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             |  2 +-
 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                |  2 +-
 arch/arm/mach-s3c64xx/common.c                    |  2 +-
 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              |  2 +-
 arch/arm/mach-s3c64xx/mach-smartq7.c              |  2 +-
 arch/arm/mach-s3c64xx/mach-smdk6400.c             |  2 +-
 arch/arm/mach-s3c64xx/mach-smdk6410.c             |  2 +-
 arch/arm/mach-s5p64x0/common.c                    |  2 +-
 arch/arm/mach-s5p64x0/mach-smdk6440.c             |  2 +-
 arch/arm/mach-s5p64x0/mach-smdk6450.c             |  2 +-
 arch/arm/mach-s5pc100/common.c                    |  2 +-
 arch/arm/mach-s5pc100/mach-smdkc100.c             |  2 +-
 arch/arm/mach-s5pv210/common.c                    |  2 +-
 arch/arm/mach-s5pv210/mach-aquila.c               |  2 +-
 arch/arm/mach-s5pv210/mach-goni.c                 |  2 +-
 arch/arm/mach-s5pv210/mach-smdkc110.c             |  2 +-
 arch/arm/mach-s5pv210/mach-smdkv210.c             |  2 +-
 arch/arm/mach-s5pv210/mach-torbreck.c             |  2 +-
 arch/arm/plat-samsung/include/plat/samsung-time.h | 49 -----------------------
 drivers/clocksource/samsung-time.c                |  3 +-
 include/clocksource/samsung-time.h                | 49 +++++++++++++++++++++++
 51 files changed, 99 insertions(+), 98 deletions(-)
 delete mode 100644 arch/arm/plat-samsung/include/plat/samsung-time.h
 create mode 100644 include/clocksource/samsung-time.h

diff --git a/arch/arm/mach-exynos/mach-universal_c210.c b/arch/arm/mach-exynos/mach-universal_c210.c
index 00554fe..8ce1206 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/samsung-time.h>
+#include <clocksource/samsung-time.h>
 #include <plat/camport.h>
 
 #include <mach/map.h>
diff --git a/arch/arm/mach-s3c24xx/common.c b/arch/arm/mach-s3c24xx/common.c
index 816428f..fe054d6 100644
--- a/arch/arm/mach-s3c24xx/common.c
+++ b/arch/arm/mach-s3c24xx/common.c
@@ -49,7 +49,7 @@
 #include <plat/clock.h>
 #include <plat/cpu-freq.h>
 #include <plat/pll.h>
-#include <plat/samsung-time.h>
+#include <clocksource/samsung-time.h>
 
 #include "common.h"
 
diff --git a/arch/arm/mach-s3c24xx/mach-amlm5900.c b/arch/arm/mach-s3c24xx/mach-amlm5900.c
index e27b5c9..dc720ad 100644
--- a/arch/arm/mach-s3c24xx/mach-amlm5900.c
+++ b/arch/arm/mach-s3c24xx/mach-amlm5900.c
@@ -63,7 +63,7 @@
 #include <linux/mtd/map.h>
 #include <linux/mtd/physmap.h>
 
-#include <plat/samsung-time.h>
+#include <clocksource/samsung-time.h>
 
 #include "common.h"
 
diff --git a/arch/arm/mach-s3c24xx/mach-anubis.c b/arch/arm/mach-s3c24xx/mach-anubis.c
index c1fb6c3..47a7bc3 100644
--- a/arch/arm/mach-s3c24xx/mach-anubis.c
+++ b/arch/arm/mach-s3c24xx/mach-anubis.c
@@ -49,7 +49,7 @@
 #include <plat/devs.h>
 #include <plat/cpu.h>
 #include <linux/platform_data/asoc-s3c24xx_simtec.h>
-#include <plat/samsung-time.h>
+#include <clocksource/samsung-time.h>
 
 #include "anubis.h"
 #include "common.h"
diff --git a/arch/arm/mach-s3c24xx/mach-at2440evb.c b/arch/arm/mach-s3c24xx/mach-at2440evb.c
index 6dfeeb7..756fed4 100644
--- a/arch/arm/mach-s3c24xx/mach-at2440evb.c
+++ b/arch/arm/mach-s3c24xx/mach-at2440evb.c
@@ -48,7 +48,7 @@
 #include <plat/devs.h>
 #include <plat/cpu.h>
 #include <linux/platform_data/mmc-s3cmci.h>
-#include <plat/samsung-time.h>
+#include <clocksource/samsung-time.h>
 
 #include "common.h"
 
diff --git a/arch/arm/mach-s3c24xx/mach-bast.c b/arch/arm/mach-s3c24xx/mach-bast.c
index 22d6ae9..82ed39e 100644
--- a/arch/arm/mach-s3c24xx/mach-bast.c
+++ b/arch/arm/mach-s3c24xx/mach-bast.c
@@ -55,7 +55,7 @@
 #include <plat/devs.h>
 #include <plat/gpio-cfg.h>
 #include <plat/regs-serial.h>
-#include <plat/samsung-time.h>
+#include <clocksource/samsung-time.h>
 
 #include "bast.h"
 #include "common.h"
diff --git a/arch/arm/mach-s3c24xx/mach-gta02.c b/arch/arm/mach-s3c24xx/mach-gta02.c
index 13d8d07..b3d5c89 100644
--- a/arch/arm/mach-s3c24xx/mach-gta02.c
+++ b/arch/arm/mach-s3c24xx/mach-gta02.c
@@ -81,7 +81,7 @@
 #include <plat/gpio-cfg.h>
 #include <plat/pm.h>
 #include <plat/regs-serial.h>
-#include <plat/samsung-time.h>
+#include <clocksource/samsung-time.h>
 
 #include "common.h"
 #include "gta02.h"
diff --git a/arch/arm/mach-s3c24xx/mach-h1940.c b/arch/arm/mach-s3c24xx/mach-h1940.c
index af4334d..c0c24e9 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 <clocksource/samsung-time.h>
 
 #include "common.h"
 #include "h1940.h"
diff --git a/arch/arm/mach-s3c24xx/mach-jive.c b/arch/arm/mach-s3c24xx/mach-jive.c
index a45fcd8..63b7359 100644
--- a/arch/arm/mach-s3c24xx/mach-jive.c
+++ b/arch/arm/mach-s3c24xx/mach-jive.c
@@ -52,7 +52,7 @@
 #include <plat/cpu.h>
 #include <plat/pm.h>
 #include <linux/platform_data/usb-s3c2410_udc.h>
-#include <plat/samsung-time.h>
+#include <clocksource/samsung-time.h>
 
 #include "common.h"
 #include "s3c2412-power.h"
diff --git a/arch/arm/mach-s3c24xx/mach-mini2440.c b/arch/arm/mach-s3c24xx/mach-mini2440.c
index a83db46..be78d62 100644
--- a/arch/arm/mach-s3c24xx/mach-mini2440.c
+++ b/arch/arm/mach-s3c24xx/mach-mini2440.c
@@ -56,7 +56,7 @@
 #include <plat/clock.h>
 #include <plat/devs.h>
 #include <plat/cpu.h>
-#include <plat/samsung-time.h>
+#include <clocksource/samsung-time.h>
 
 #include <sound/s3c24xx_uda134x.h>
 
diff --git a/arch/arm/mach-s3c24xx/mach-n30.c b/arch/arm/mach-s3c24xx/mach-n30.c
index 2cb46c3..c19e6a5 100644
--- a/arch/arm/mach-s3c24xx/mach-n30.c
+++ b/arch/arm/mach-s3c24xx/mach-n30.c
@@ -49,7 +49,7 @@
 #include <plat/devs.h>
 #include <linux/platform_data/mmc-s3cmci.h>
 #include <linux/platform_data/usb-s3c2410_udc.h>
-#include <plat/samsung-time.h>
+#include <clocksource/samsung-time.h>
 
 #include "common.h"
 
diff --git a/arch/arm/mach-s3c24xx/mach-nexcoder.c b/arch/arm/mach-s3c24xx/mach-nexcoder.c
index 01f4354..7ef69a7 100644
--- a/arch/arm/mach-s3c24xx/mach-nexcoder.c
+++ b/arch/arm/mach-s3c24xx/mach-nexcoder.c
@@ -44,7 +44,7 @@
 #include <plat/clock.h>
 #include <plat/devs.h>
 #include <plat/cpu.h>
-#include <plat/samsung-time.h>
+#include <clocksource/samsung-time.h>
 
 #include "common.h"
 
diff --git a/arch/arm/mach-s3c24xx/mach-osiris.c b/arch/arm/mach-s3c24xx/mach-osiris.c
index 58d6fbe..7edd42d 100644
--- a/arch/arm/mach-s3c24xx/mach-osiris.c
+++ b/arch/arm/mach-s3c24xx/mach-osiris.c
@@ -45,7 +45,7 @@
 #include <plat/devs.h>
 #include <plat/gpio-cfg.h>
 #include <plat/regs-serial.h>
-#include <plat/samsung-time.h>
+#include <clocksource/samsung-time.h>
 
 #include <mach/hardware.h>
 #include <mach/regs-gpio.h>
diff --git a/arch/arm/mach-s3c24xx/mach-otom.c b/arch/arm/mach-s3c24xx/mach-otom.c
index 7e16b07..1491c6d 100644
--- a/arch/arm/mach-s3c24xx/mach-otom.c
+++ b/arch/arm/mach-s3c24xx/mach-otom.c
@@ -33,7 +33,7 @@
 #include <plat/cpu.h>
 #include <plat/devs.h>
 #include <plat/regs-serial.h>
-#include <plat/samsung-time.h>
+#include <clocksource/samsung-time.h>
 
 #include "common.h"
 #include "otom.h"
diff --git a/arch/arm/mach-s3c24xx/mach-qt2410.c b/arch/arm/mach-s3c24xx/mach-qt2410.c
index f8feaea..ef29d6a 100644
--- a/arch/arm/mach-s3c24xx/mach-qt2410.c
+++ b/arch/arm/mach-s3c24xx/mach-qt2410.c
@@ -59,7 +59,7 @@
 #include <plat/devs.h>
 #include <plat/cpu.h>
 #include <plat/pm.h>
-#include <plat/samsung-time.h>
+#include <clocksource/samsung-time.h>
 
 #include "common.h"
 #include "common-smdk.h"
diff --git a/arch/arm/mach-s3c24xx/mach-rx1950.c b/arch/arm/mach-s3c24xx/mach-rx1950.c
index e4d67a3..6900654 100644
--- a/arch/arm/mach-s3c24xx/mach-rx1950.c
+++ b/arch/arm/mach-s3c24xx/mach-rx1950.c
@@ -58,7 +58,7 @@
 #include <plat/pm.h>
 #include <plat/regs-iic.h>
 #include <plat/regs-serial.h>
-#include <plat/samsung-time.h>
+#include <clocksource/samsung-time.h>
 
 #include "common.h"
 #include "h1940.h"
diff --git a/arch/arm/mach-s3c24xx/mach-rx3715.c b/arch/arm/mach-s3c24xx/mach-rx3715.c
index 3bc6231..922d517 100644
--- a/arch/arm/mach-s3c24xx/mach-rx3715.c
+++ b/arch/arm/mach-s3c24xx/mach-rx3715.c
@@ -49,7 +49,7 @@
 #include <plat/devs.h>
 #include <plat/pm.h>
 #include <plat/regs-serial.h>
-#include <plat/samsung-time.h>
+#include <clocksource/samsung-time.h>
 
 #include "common.h"
 #include "h1940.h"
diff --git a/arch/arm/mach-s3c24xx/mach-smdk2410.c b/arch/arm/mach-s3c24xx/mach-smdk2410.c
index a773789..048553d 100644
--- a/arch/arm/mach-s3c24xx/mach-smdk2410.c
+++ b/arch/arm/mach-s3c24xx/mach-smdk2410.c
@@ -51,7 +51,7 @@
 
 #include <plat/devs.h>
 #include <plat/cpu.h>
-#include <plat/samsung-time.h>
+#include <clocksource/samsung-time.h>
 
 #include "common.h"
 #include "common-smdk.h"
diff --git a/arch/arm/mach-s3c24xx/mach-smdk2413.c b/arch/arm/mach-s3c24xx/mach-smdk2413.c
index 8146e92..e3b3bcd 100644
--- a/arch/arm/mach-s3c24xx/mach-smdk2413.c
+++ b/arch/arm/mach-s3c24xx/mach-smdk2413.c
@@ -44,7 +44,7 @@
 #include <plat/clock.h>
 #include <plat/devs.h>
 #include <plat/cpu.h>
-#include <plat/samsung-time.h>
+#include <clocksource/samsung-time.h>
 
 #include "common.h"
 #include "common-smdk.h"
diff --git a/arch/arm/mach-s3c24xx/mach-smdk2416.c b/arch/arm/mach-s3c24xx/mach-smdk2416.c
index cb46847..b4ec1a0 100644
--- a/arch/arm/mach-s3c24xx/mach-smdk2416.c
+++ b/arch/arm/mach-s3c24xx/mach-smdk2416.c
@@ -50,7 +50,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 <clocksource/samsung-time.h>
 
 #include <plat/fb.h>
 
diff --git a/arch/arm/mach-s3c24xx/mach-smdk2440.c b/arch/arm/mach-s3c24xx/mach-smdk2440.c
index de2e5d3..81dbeee 100644
--- a/arch/arm/mach-s3c24xx/mach-smdk2440.c
+++ b/arch/arm/mach-s3c24xx/mach-smdk2440.c
@@ -41,7 +41,7 @@
 #include <plat/clock.h>
 #include <plat/devs.h>
 #include <plat/cpu.h>
-#include <plat/samsung-time.h>
+#include <clocksource/samsung-time.h>
 
 #include "common.h"
 #include "common-smdk.h"
diff --git a/arch/arm/mach-s3c24xx/mach-smdk2443.c b/arch/arm/mach-s3c24xx/mach-smdk2443.c
index 9435c3b..aff1d3e 100644
--- a/arch/arm/mach-s3c24xx/mach-smdk2443.c
+++ b/arch/arm/mach-s3c24xx/mach-smdk2443.c
@@ -41,7 +41,7 @@
 #include <plat/clock.h>
 #include <plat/devs.h>
 #include <plat/cpu.h>
-#include <plat/samsung-time.h>
+#include <clocksource/samsung-time.h>
 
 #include "common.h"
 #include "common-smdk.h"
diff --git a/arch/arm/mach-s3c24xx/mach-tct_hammer.c b/arch/arm/mach-s3c24xx/mach-tct_hammer.c
index 7fad8f0..d67c14d 100644
--- a/arch/arm/mach-s3c24xx/mach-tct_hammer.c
+++ b/arch/arm/mach-s3c24xx/mach-tct_hammer.c
@@ -53,7 +53,7 @@
 #include <linux/mtd/partitions.h>
 #include <linux/mtd/map.h>
 #include <linux/mtd/physmap.h>
-#include <plat/samsung-time.h>
+#include <clocksource/samsung-time.h>
 
 #include "common.h"
 
diff --git a/arch/arm/mach-s3c24xx/mach-vr1000.c b/arch/arm/mach-s3c24xx/mach-vr1000.c
index 42e7187..c1cdd8c 100644
--- a/arch/arm/mach-s3c24xx/mach-vr1000.c
+++ b/arch/arm/mach-s3c24xx/mach-vr1000.c
@@ -45,7 +45,7 @@
 #include <plat/cpu.h>
 #include <plat/devs.h>
 #include <plat/regs-serial.h>
-#include <plat/samsung-time.h>
+#include <clocksource/samsung-time.h>
 
 #include "bast.h"
 #include "common.h"
diff --git a/arch/arm/mach-s3c24xx/mach-vstms.c b/arch/arm/mach-s3c24xx/mach-vstms.c
index b665884..dc6a5ee 100644
--- a/arch/arm/mach-s3c24xx/mach-vstms.c
+++ b/arch/arm/mach-s3c24xx/mach-vstms.c
@@ -44,7 +44,7 @@
 #include <plat/clock.h>
 #include <plat/devs.h>
 #include <plat/cpu.h>
-#include <plat/samsung-time.h>
+#include <clocksource/samsung-time.h>
 
 #include "common.h"
 
diff --git a/arch/arm/mach-s3c64xx/common.c b/arch/arm/mach-s3c64xx/common.c
index b6aa36d..0f7df6a 100644
--- a/arch/arm/mach-s3c64xx/common.c
+++ b/arch/arm/mach-s3c64xx/common.c
@@ -44,7 +44,7 @@
 #include <plat/irq-vic-timer.h>
 #include <plat/regs-irqtype.h>
 #include <plat/regs-serial.h>
-#include <plat/samsung-time.h>
+#include <clocksource/samsung-time.h>
 #include <plat/watchdog-reset.h>
 
 #include "common.h"
diff --git a/arch/arm/mach-s3c64xx/mach-anw6410.c b/arch/arm/mach-s3c64xx/mach-anw6410.c
index 35e3f54..d2ef383 100644
--- a/arch/arm/mach-s3c64xx/mach-anw6410.c
+++ b/arch/arm/mach-s3c64xx/mach-anw6410.c
@@ -49,7 +49,7 @@
 #include <plat/devs.h>
 #include <plat/cpu.h>
 #include <mach/regs-gpio.h>
-#include <plat/samsung-time.h>
+#include <clocksource/samsung-time.h>
 
 #include "common.h"
 #include "regs-modem.h"
diff --git a/arch/arm/mach-s3c64xx/mach-crag6410.c b/arch/arm/mach-s3c64xx/mach-crag6410.c
index 8ad88ac..dc41db0 100644
--- a/arch/arm/mach-s3c64xx/mach-crag6410.c
+++ b/arch/arm/mach-s3c64xx/mach-crag6410.c
@@ -64,7 +64,7 @@
 #include <plat/adc.h>
 #include <linux/platform_data/i2c-s3c2410.h>
 #include <plat/pm.h>
-#include <plat/samsung-time.h>
+#include <clocksource/samsung-time.h>
 
 #include "common.h"
 #include "crag6410.h"
diff --git a/arch/arm/mach-s3c64xx/mach-hmt.c b/arch/arm/mach-s3c64xx/mach-hmt.c
index 5b7f357..e830ce9 100644
--- a/arch/arm/mach-s3c64xx/mach-hmt.c
+++ b/arch/arm/mach-s3c64xx/mach-hmt.c
@@ -41,7 +41,7 @@
 #include <plat/clock.h>
 #include <plat/devs.h>
 #include <plat/cpu.h>
-#include <plat/samsung-time.h>
+#include <clocksource/samsung-time.h>
 
 #include "common.h"
 
diff --git a/arch/arm/mach-s3c64xx/mach-mini6410.c b/arch/arm/mach-s3c64xx/mach-mini6410.c
index fc043e3..c78fed4 100644
--- a/arch/arm/mach-s3c64xx/mach-mini6410.c
+++ b/arch/arm/mach-s3c64xx/mach-mini6410.c
@@ -41,7 +41,7 @@
 
 #include <video/platform_lcd.h>
 #include <video/samsung_fimd.h>
-#include <plat/samsung-time.h>
+#include <clocksource/samsung-time.h>
 
 #include "common.h"
 #include "regs-modem.h"
diff --git a/arch/arm/mach-s3c64xx/mach-ncp.c b/arch/arm/mach-s3c64xx/mach-ncp.c
index 7e2c390..6d24391 100644
--- a/arch/arm/mach-s3c64xx/mach-ncp.c
+++ b/arch/arm/mach-s3c64xx/mach-ncp.c
@@ -43,7 +43,7 @@
 #include <plat/clock.h>
 #include <plat/devs.h>
 #include <plat/cpu.h>
-#include <plat/samsung-time.h>
+#include <clocksource/samsung-time.h>
 
 #include "common.h"
 
diff --git a/arch/arm/mach-s3c64xx/mach-real6410.c b/arch/arm/mach-s3c64xx/mach-real6410.c
index 8bed37b..cb105c7 100644
--- a/arch/arm/mach-s3c64xx/mach-real6410.c
+++ b/arch/arm/mach-s3c64xx/mach-real6410.c
@@ -42,7 +42,7 @@
 
 #include <video/platform_lcd.h>
 #include <video/samsung_fimd.h>
-#include <plat/samsung-time.h>
+#include <clocksource/samsung-time.h>
 
 #include "common.h"
 #include "regs-modem.h"
diff --git a/arch/arm/mach-s3c64xx/mach-smartq.c b/arch/arm/mach-s3c64xx/mach-smartq.c
index 58ac990..e76028d 100644
--- a/arch/arm/mach-s3c64xx/mach-smartq.c
+++ b/arch/arm/mach-s3c64xx/mach-smartq.c
@@ -38,7 +38,7 @@
 #include <linux/platform_data/touchscreen-s3c2410.h>
 
 #include <video/platform_lcd.h>
-#include <plat/samsung-time.h>
+#include <clocksource/samsung-time.h>
 
 #include "common.h"
 #include "regs-modem.h"
diff --git a/arch/arm/mach-s3c64xx/mach-smartq5.c b/arch/arm/mach-s3c64xx/mach-smartq5.c
index 8aca5da..2f5eb2a 100644
--- a/arch/arm/mach-s3c64xx/mach-smartq5.c
+++ b/arch/arm/mach-s3c64xx/mach-smartq5.c
@@ -28,7 +28,7 @@
 #include <plat/devs.h>
 #include <plat/fb.h>
 #include <plat/gpio-cfg.h>
-#include <plat/samsung-time.h>
+#include <clocksource/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 a052e10..3b898f6 100644
--- a/arch/arm/mach-s3c64xx/mach-smartq7.c
+++ b/arch/arm/mach-s3c64xx/mach-smartq7.c
@@ -28,7 +28,7 @@
 #include <plat/devs.h>
 #include <plat/fb.h>
 #include <plat/gpio-cfg.h>
-#include <plat/samsung-time.h>
+#include <clocksource/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 d70c084..3964e19 100644
--- a/arch/arm/mach-s3c64xx/mach-smdk6400.c
+++ b/arch/arm/mach-s3c64xx/mach-smdk6400.c
@@ -35,7 +35,7 @@
 #include <plat/devs.h>
 #include <plat/cpu.h>
 #include <linux/platform_data/i2c-s3c2410.h>
-#include <plat/samsung-time.h>
+#include <clocksource/samsung-time.h>
 
 #include "common.h"
 
diff --git a/arch/arm/mach-s3c64xx/mach-smdk6410.c b/arch/arm/mach-s3c64xx/mach-smdk6410.c
index bd3295a..c58cb54 100644
--- a/arch/arm/mach-s3c64xx/mach-smdk6410.c
+++ b/arch/arm/mach-s3c64xx/mach-smdk6410.c
@@ -69,7 +69,7 @@
 #include <linux/platform_data/touchscreen-s3c2410.h>
 #include <plat/keypad.h>
 #include <plat/backlight.h>
-#include <plat/samsung-time.h>
+#include <clocksource/samsung-time.h>
 
 #include "common.h"
 #include "regs-modem.h"
diff --git a/arch/arm/mach-s5p64x0/common.c b/arch/arm/mach-s5p64x0/common.c
index a339fbb..2839022 100644
--- a/arch/arm/mach-s5p64x0/common.c
+++ b/arch/arm/mach-s5p64x0/common.c
@@ -48,7 +48,7 @@
 #include <plat/gpio-cfg.h>
 #include <plat/regs-irqtype.h>
 #include <plat/regs-serial.h>
-#include <plat/samsung-time.h>
+#include <clocksource/samsung-time.h>
 #include <plat/watchdog-reset.h>
 
 #include "common.h"
diff --git a/arch/arm/mach-s5p64x0/mach-smdk6440.c b/arch/arm/mach-s5p64x0/mach-smdk6440.c
index 73f71a6..4f70ee7 100644
--- a/arch/arm/mach-s5p64x0/mach-smdk6440.c
+++ b/arch/arm/mach-s5p64x0/mach-smdk6440.c
@@ -48,7 +48,7 @@
 #include <plat/pll.h>
 #include <plat/adc.h>
 #include <linux/platform_data/touchscreen-s3c2410.h>
-#include <plat/samsung-time.h>
+#include <clocksource/samsung-time.h>
 #include <plat/backlight.h>
 #include <plat/fb.h>
 #include <plat/sdhci.h>
diff --git a/arch/arm/mach-s5p64x0/mach-smdk6450.c b/arch/arm/mach-s5p64x0/mach-smdk6450.c
index 18303e1..7aa9175 100644
--- a/arch/arm/mach-s5p64x0/mach-smdk6450.c
+++ b/arch/arm/mach-s5p64x0/mach-smdk6450.c
@@ -48,7 +48,7 @@
 #include <plat/pll.h>
 #include <plat/adc.h>
 #include <linux/platform_data/touchscreen-s3c2410.h>
-#include <plat/samsung-time.h>
+#include <clocksource/samsung-time.h>
 #include <plat/backlight.h>
 #include <plat/fb.h>
 #include <plat/sdhci.h>
diff --git a/arch/arm/mach-s5pc100/common.c b/arch/arm/mach-s5pc100/common.c
index 09e76d4..0df9124 100644
--- a/arch/arm/mach-s5pc100/common.c
+++ b/arch/arm/mach-s5pc100/common.c
@@ -47,7 +47,7 @@
 #include <plat/onenand-core.h>
 #include <plat/spi-core.h>
 #include <plat/regs-serial.h>
-#include <plat/samsung-time.h>
+#include <clocksource/samsung-time.h>
 #include <plat/watchdog-reset.h>
 
 #include "common.h"
diff --git a/arch/arm/mach-s5pc100/mach-smdkc100.c b/arch/arm/mach-s5pc100/mach-smdkc100.c
index 8c880f7..b19c571 100644
--- a/arch/arm/mach-s5pc100/mach-smdkc100.c
+++ b/arch/arm/mach-s5pc100/mach-smdkc100.c
@@ -51,7 +51,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 <clocksource/samsung-time.h>
 
 #include "common.h"
 
diff --git a/arch/arm/mach-s5pv210/common.c b/arch/arm/mach-s5pv210/common.c
index 44d3a5c..2d1bc6b 100644
--- a/arch/arm/mach-s5pv210/common.c
+++ b/arch/arm/mach-s5pv210/common.c
@@ -42,7 +42,7 @@
 #include <plat/fimc-core.h>
 #include <plat/iic-core.h>
 #include <plat/keypad-core.h>
-#include <plat/samsung-time.h>
+#include <clocksource/samsung-time.h>
 #include <plat/tv-core.h>
 #include <plat/spi-core.h>
 #include <plat/regs-serial.h>
diff --git a/arch/arm/mach-s5pv210/mach-aquila.c b/arch/arm/mach-s5pv210/mach-aquila.c
index ed2b854..d02665d 100644
--- a/arch/arm/mach-s5pv210/mach-aquila.c
+++ b/arch/arm/mach-s5pv210/mach-aquila.c
@@ -38,7 +38,7 @@
 #include <plat/fb.h>
 #include <plat/fimc-core.h>
 #include <plat/sdhci.h>
-#include <plat/samsung-time.h>
+#include <clocksource/samsung-time.h>
 
 #include "common.h"
 
diff --git a/arch/arm/mach-s5pv210/mach-goni.c b/arch/arm/mach-s5pv210/mach-goni.c
index 2564394..7ae9c4a 100644
--- a/arch/arm/mach-s5pv210/mach-goni.c
+++ b/arch/arm/mach-s5pv210/mach-goni.c
@@ -47,7 +47,7 @@
 #include <plat/keypad.h>
 #include <plat/sdhci.h>
 #include <plat/clock.h>
-#include <plat/samsung-time.h>
+#include <clocksource/samsung-time.h>
 #include <plat/mfc.h>
 #include <plat/camport.h>
 
diff --git a/arch/arm/mach-s5pv210/mach-smdkc110.c b/arch/arm/mach-s5pv210/mach-smdkc110.c
index 7c0ed07..1f1d588 100644
--- a/arch/arm/mach-s5pv210/mach-smdkc110.c
+++ b/arch/arm/mach-s5pv210/mach-smdkc110.c
@@ -29,7 +29,7 @@
 #include <linux/platform_data/ata-samsung_cf.h>
 #include <linux/platform_data/i2c-s3c2410.h>
 #include <plat/pm.h>
-#include <plat/samsung-time.h>
+#include <clocksource/samsung-time.h>
 #include <plat/mfc.h>
 
 #include "common.h"
diff --git a/arch/arm/mach-s5pv210/mach-smdkv210.c b/arch/arm/mach-s5pv210/mach-smdkv210.c
index d50b6f1..7d16418 100644
--- a/arch/arm/mach-s5pv210/mach-smdkv210.c
+++ b/arch/arm/mach-s5pv210/mach-smdkv210.c
@@ -44,7 +44,7 @@
 #include <plat/keypad.h>
 #include <plat/pm.h>
 #include <plat/fb.h>
-#include <plat/samsung-time.h>
+#include <clocksource/samsung-time.h>
 #include <plat/backlight.h>
 #include <plat/mfc.h>
 #include <plat/clock.h>
diff --git a/arch/arm/mach-s5pv210/mach-torbreck.c b/arch/arm/mach-s5pv210/mach-torbreck.c
index 579afe8..be08b5c 100644
--- a/arch/arm/mach-s5pv210/mach-torbreck.c
+++ b/arch/arm/mach-s5pv210/mach-torbreck.c
@@ -26,7 +26,7 @@
 #include <plat/devs.h>
 #include <plat/cpu.h>
 #include <linux/platform_data/i2c-s3c2410.h>
-#include <plat/samsung-time.h>
+#include <clocksource/samsung-time.h>
 
 #include "common.h"
 
diff --git a/arch/arm/plat-samsung/include/plat/samsung-time.h b/arch/arm/plat-samsung/include/plat/samsung-time.h
deleted file mode 100644
index d64d8a2..0000000
--- a/arch/arm/plat-samsung/include/plat/samsung-time.h
+++ /dev/null
@@ -1,49 +0,0 @@
-/* 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;
-};
-
-/**
- * struct samsung_timer_variant - SoC-specific parameters of Samsung PWM timers
- * @bits:	bit width of time counters
- * @prescale:	prescaler divisor
- * @divisor:	main divisor
- */
-struct samsung_timer_variant {
-	int bits;
-	u16 prescale;
-	u16 divisor;
-};
-
-extern void samsung_set_timer_source(enum samsung_timer_mode event,
-					enum samsung_timer_mode source);
-extern void samsung_timer_set_variant(
-				const struct samsung_timer_variant *variant);
-
-extern void __init samsung_timer_init(void);
-
-#endif /* __ASM_PLAT_SAMSUNG_TIME_H */
diff --git a/drivers/clocksource/samsung-time.c b/drivers/clocksource/samsung-time.c
index f1eacef..03955fb 100644
--- a/drivers/clocksource/samsung-time.c
+++ b/drivers/clocksource/samsung-time.c
@@ -16,6 +16,8 @@
 #include <linux/clockchips.h>
 #include <linux/platform_device.h>
 
+#include <clocksource/samsung-time.h>
+
 #include <asm/smp_twd.h>
 #include <asm/mach/time.h>
 #include <asm/mach/arch.h>
@@ -25,7 +27,6 @@
 #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;
diff --git a/include/clocksource/samsung-time.h b/include/clocksource/samsung-time.h
new file mode 100644
index 0000000..d64d8a2
--- /dev/null
+++ b/include/clocksource/samsung-time.h
@@ -0,0 +1,49 @@
+/* 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;
+};
+
+/**
+ * struct samsung_timer_variant - SoC-specific parameters of Samsung PWM timers
+ * @bits:	bit width of time counters
+ * @prescale:	prescaler divisor
+ * @divisor:	main divisor
+ */
+struct samsung_timer_variant {
+	int bits;
+	u16 prescale;
+	u16 divisor;
+};
+
+extern void samsung_set_timer_source(enum samsung_timer_mode event,
+					enum samsung_timer_mode source);
+extern void samsung_timer_set_variant(
+				const struct samsung_timer_variant *variant);
+
+extern void __init samsung_timer_init(void);
+
+#endif /* __ASM_PLAT_SAMSUNG_TIME_H */
-- 
1.8.1.5

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

* [PATCH v3 05/12] clocksource: samsung-time: Use local register definitions
  2013-03-09 20:23 ` Tomasz Figa
@ 2013-03-09 20:23   ` Tomasz Figa
  -1 siblings, 0 replies; 34+ messages in thread
From: Tomasz Figa @ 2013-03-09 20:23 UTC (permalink / raw)
  To: linux-arm-kernel
  Cc: linux-samsung-soc, Kukjin Kim, kyungmin.park, linux, broonie,
	kwangwoo.lee, jacmet, augulis.darius, mcuelenaere, linux,
	Sylwester Nawrocki, buserror, christer, jekhor, ghcstop,
	Mark Rutland, Tomasz Figa, Heiko Stübner, Rob Herring

This patch copies PWM timer register definitions to samsung-time.c. The
original header in plat is being kept for now, since it is also used by
other code that also needs to be reworked to be multiplatform-friendly.

Signed-off-by: Tomasz Figa <tomasz.figa@gmail.com>
---
 drivers/clocksource/samsung-time.c | 36 +++++++++++++++++++++++++++++++++++-
 1 file changed, 35 insertions(+), 1 deletion(-)

diff --git a/drivers/clocksource/samsung-time.c b/drivers/clocksource/samsung-time.c
index 03955fb..259ce25 100644
--- a/drivers/clocksource/samsung-time.c
+++ b/drivers/clocksource/samsung-time.c
@@ -26,7 +26,41 @@
 
 #include <mach/map.h>
 #include <plat/devs.h>
-#include <plat/regs-timer.h>
+
+#define S3C_TIMERREG(x) (S3C_VA_TIMER + (x))
+#define S3C_TIMERREG2(tmr,reg) S3C_TIMERREG((reg)+0x0c+((tmr)*0x0c))
+
+#define S3C2410_TCON	      S3C_TIMERREG(0x08)
+#define S3C64XX_TINT_CSTAT    S3C_TIMERREG(0x44)
+
+/* for each timer, we have an count buffer, an compare buffer and
+ * an observation buffer
+*/
+
+/* WARNING - timer 4 has no buffer reg, and it's observation is at +4 */
+
+#define S3C2410_TCNTB(tmr)    S3C_TIMERREG2(tmr, 0x00)
+#define S3C2410_TCMPB(tmr)    S3C_TIMERREG2(tmr, 0x04)
+
+#define S3C2410_TCON_T4RELOAD	  (1<<22)
+#define S3C2410_TCON_T4MANUALUPD  (1<<21)
+#define S3C2410_TCON_T4START	  (1<<20)
+
+#define S3C2410_TCON_T3RELOAD	  (1<<19)
+#define S3C2410_TCON_T3MANUALUPD  (1<<17)
+#define S3C2410_TCON_T3START	  (1<<16)
+
+#define S3C2410_TCON_T2RELOAD	  (1<<15)
+#define S3C2410_TCON_T2MANUALUPD  (1<<13)
+#define S3C2410_TCON_T2START	  (1<<12)
+
+#define S3C2410_TCON_T1RELOAD	  (1<<11)
+#define S3C2410_TCON_T1MANUALUPD  (1<<9)
+#define S3C2410_TCON_T1START	  (1<<8)
+
+#define S3C2410_TCON_T0RELOAD	  (1<<3)
+#define S3C2410_TCON_T0MANUALUPD  (1<<1)
+#define S3C2410_TCON_T0START	  (1<<0)
 
 static struct clk *tin_event;
 static struct clk *tin_source;
-- 
1.8.1.5

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

* [PATCH v3 05/12] clocksource: samsung-time: Use local register definitions
@ 2013-03-09 20:23   ` Tomasz Figa
  0 siblings, 0 replies; 34+ messages in thread
From: Tomasz Figa @ 2013-03-09 20:23 UTC (permalink / raw)
  To: linux-arm-kernel

This patch copies PWM timer register definitions to samsung-time.c. The
original header in plat is being kept for now, since it is also used by
other code that also needs to be reworked to be multiplatform-friendly.

Signed-off-by: Tomasz Figa <tomasz.figa@gmail.com>
---
 drivers/clocksource/samsung-time.c | 36 +++++++++++++++++++++++++++++++++++-
 1 file changed, 35 insertions(+), 1 deletion(-)

diff --git a/drivers/clocksource/samsung-time.c b/drivers/clocksource/samsung-time.c
index 03955fb..259ce25 100644
--- a/drivers/clocksource/samsung-time.c
+++ b/drivers/clocksource/samsung-time.c
@@ -26,7 +26,41 @@
 
 #include <mach/map.h>
 #include <plat/devs.h>
-#include <plat/regs-timer.h>
+
+#define S3C_TIMERREG(x) (S3C_VA_TIMER + (x))
+#define S3C_TIMERREG2(tmr,reg) S3C_TIMERREG((reg)+0x0c+((tmr)*0x0c))
+
+#define S3C2410_TCON	      S3C_TIMERREG(0x08)
+#define S3C64XX_TINT_CSTAT    S3C_TIMERREG(0x44)
+
+/* for each timer, we have an count buffer, an compare buffer and
+ * an observation buffer
+*/
+
+/* WARNING - timer 4 has no buffer reg, and it's observation is at +4 */
+
+#define S3C2410_TCNTB(tmr)    S3C_TIMERREG2(tmr, 0x00)
+#define S3C2410_TCMPB(tmr)    S3C_TIMERREG2(tmr, 0x04)
+
+#define S3C2410_TCON_T4RELOAD	  (1<<22)
+#define S3C2410_TCON_T4MANUALUPD  (1<<21)
+#define S3C2410_TCON_T4START	  (1<<20)
+
+#define S3C2410_TCON_T3RELOAD	  (1<<19)
+#define S3C2410_TCON_T3MANUALUPD  (1<<17)
+#define S3C2410_TCON_T3START	  (1<<16)
+
+#define S3C2410_TCON_T2RELOAD	  (1<<15)
+#define S3C2410_TCON_T2MANUALUPD  (1<<13)
+#define S3C2410_TCON_T2START	  (1<<12)
+
+#define S3C2410_TCON_T1RELOAD	  (1<<11)
+#define S3C2410_TCON_T1MANUALUPD  (1<<9)
+#define S3C2410_TCON_T1START	  (1<<8)
+
+#define S3C2410_TCON_T0RELOAD	  (1<<3)
+#define S3C2410_TCON_T0MANUALUPD  (1<<1)
+#define S3C2410_TCON_T0START	  (1<<0)
 
 static struct clk *tin_event;
 static struct clk *tin_source;
-- 
1.8.1.5

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

* [PATCH v3 06/12] clocksource: samsung-time: Remove use of static register mapping
  2013-03-09 20:23 ` Tomasz Figa
@ 2013-03-09 20:23   ` Tomasz Figa
  -1 siblings, 0 replies; 34+ messages in thread
From: Tomasz Figa @ 2013-03-09 20:23 UTC (permalink / raw)
  To: linux-arm-kernel
  Cc: linux-samsung-soc, Kukjin Kim, kyungmin.park, linux, broonie,
	kwangwoo.lee, jacmet, augulis.darius, mcuelenaere, linux,
	Sylwester Nawrocki, buserror, christer, jekhor, ghcstop,
	Mark Rutland, Tomasz Figa, Heiko Stübner, Rob Herring

This patch brings the samsung-time driver one step closer to
multiplatform by replacing references to statically mapped registers
with dynamic mapping using ioremap.

The helper struct samsung_timer_variant is extended with reg_base field,
which is used to pass platform-specific base address to the driver.

Signed-off-by: Tomasz Figa <tomasz.figa@gmail.com>
---
 arch/arm/mach-exynos/mach-universal_c210.c | 1 +
 arch/arm/mach-s3c24xx/common.c             | 1 +
 arch/arm/mach-s3c64xx/common.c             | 1 +
 arch/arm/mach-s5p64x0/common.c             | 1 +
 arch/arm/mach-s5pc100/common.c             | 1 +
 arch/arm/mach-s5pv210/common.c             | 1 +
 drivers/clocksource/samsung-time.c         | 9 +++++++--
 include/clocksource/samsung-time.h         | 2 ++
 8 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/arch/arm/mach-exynos/mach-universal_c210.c b/arch/arm/mach-exynos/mach-universal_c210.c
index 8ce1206..3ece9e0 100644
--- a/arch/arm/mach-exynos/mach-universal_c210.c
+++ b/arch/arm/mach-exynos/mach-universal_c210.c
@@ -1090,6 +1090,7 @@ static struct platform_device *universal_devices[] __initdata = {
 };
 
 static const struct samsung_timer_variant universal_timer_variant = {
+	.reg_base = EXYNOS4_PA_TIMER,
 	.bits = 32,
 	.prescale = 2,
 	.divisor = 1,
diff --git a/arch/arm/mach-s3c24xx/common.c b/arch/arm/mach-s3c24xx/common.c
index fe054d6..5f142b2 100644
--- a/arch/arm/mach-s3c24xx/common.c
+++ b/arch/arm/mach-s3c24xx/common.c
@@ -218,6 +218,7 @@ static void s3c24xx_default_idle(void)
 }
 
 static const struct samsung_timer_variant s3c24xx_timer_variant = {
+	.reg_base = S3C24XX_PA_TIMER,
 	.bits = 16,
 	.prescale = 25,
 	.divisor = 2,
diff --git a/arch/arm/mach-s3c64xx/common.c b/arch/arm/mach-s3c64xx/common.c
index 0f7df6a..a4a370e 100644
--- a/arch/arm/mach-s3c64xx/common.c
+++ b/arch/arm/mach-s3c64xx/common.c
@@ -150,6 +150,7 @@ static struct device s3c64xx_dev = {
 };
 
 static const struct samsung_timer_variant s3c64xx_timer_variant = {
+	.reg_base = S3C_PA_TIMER,
 	.bits = 32,
 	.prescale = 2,
 	.divisor = 1,
diff --git a/arch/arm/mach-s5p64x0/common.c b/arch/arm/mach-s5p64x0/common.c
index 2839022..407c5a7 100644
--- a/arch/arm/mach-s5p64x0/common.c
+++ b/arch/arm/mach-s5p64x0/common.c
@@ -158,6 +158,7 @@ static void s5p64x0_idle(void)
 }
 
 static const struct samsung_timer_variant s5p64x0_timer_variant = {
+	.reg_base = S5P_PA_TIMER,
 	.bits = 32,
 	.prescale = 2,
 	.divisor = 1,
diff --git a/arch/arm/mach-s5pc100/common.c b/arch/arm/mach-s5pc100/common.c
index 0df9124..0df734a 100644
--- a/arch/arm/mach-s5pc100/common.c
+++ b/arch/arm/mach-s5pc100/common.c
@@ -133,6 +133,7 @@ static struct map_desc s5pc100_iodesc[] __initdata = {
 };
 
 static const struct samsung_timer_variant s5pc100_timer_variant = {
+	.reg_base = S5P_PA_TIMER,
 	.bits = 32,
 	.prescale = 2,
 	.divisor = 1,
diff --git a/arch/arm/mach-s5pv210/common.c b/arch/arm/mach-s5pv210/common.c
index 2d1bc6b..42108ca 100644
--- a/arch/arm/mach-s5pv210/common.c
+++ b/arch/arm/mach-s5pv210/common.c
@@ -150,6 +150,7 @@ void s5pv210_restart(char mode, const char *cmd)
 }
 
 static const struct samsung_timer_variant s5pv210_timer_variant = {
+	.reg_base = S5P_PA_TIMER,
 	.bits = 32,
 	.prescale = 2,
 	.divisor = 1,
diff --git a/drivers/clocksource/samsung-time.c b/drivers/clocksource/samsung-time.c
index 259ce25..f14e3fa 100644
--- a/drivers/clocksource/samsung-time.c
+++ b/drivers/clocksource/samsung-time.c
@@ -24,10 +24,11 @@
 #include <asm/mach/map.h>
 #include <asm/sched_clock.h>
 
-#include <mach/map.h>
 #include <plat/devs.h>
 
-#define S3C_TIMERREG(x) (S3C_VA_TIMER + (x))
+static void __iomem *timer_base;
+
+#define S3C_TIMERREG(x) (timer_base + (x))
 #define S3C_TIMERREG2(tmr,reg) S3C_TIMERREG((reg)+0x0c+((tmr)*0x0c))
 
 #define S3C2410_TCON	      S3C_TIMERREG(0x08)
@@ -406,6 +407,10 @@ static void __init samsung_timer_resources(void)
 	unsigned long source_id = timer_source.source_id;
 	char devname[15];
 
+	timer_base = ioremap_nocache(timer_variant.reg_base, SZ_4K);
+	if (!timer_base)
+		panic("failed to map timer registers");
+
 	timerclk = clk_get(NULL, "timers");
 	if (IS_ERR(timerclk))
 		panic("failed to get timers clock for timer");
diff --git a/include/clocksource/samsung-time.h b/include/clocksource/samsung-time.h
index d64d8a2..535a334 100644
--- a/include/clocksource/samsung-time.h
+++ b/include/clocksource/samsung-time.h
@@ -29,11 +29,13 @@ struct samsung_timer_source {
 
 /**
  * struct samsung_timer_variant - SoC-specific parameters of Samsung PWM timers
+ * @reg_base:	physical base address of timer registers
  * @bits:	bit width of time counters
  * @prescale:	prescaler divisor
  * @divisor:	main divisor
  */
 struct samsung_timer_variant {
+	unsigned long reg_base;
 	int bits;
 	u16 prescale;
 	u16 divisor;
-- 
1.8.1.5

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

* [PATCH v3 06/12] clocksource: samsung-time: Remove use of static register mapping
@ 2013-03-09 20:23   ` Tomasz Figa
  0 siblings, 0 replies; 34+ messages in thread
From: Tomasz Figa @ 2013-03-09 20:23 UTC (permalink / raw)
  To: linux-arm-kernel

This patch brings the samsung-time driver one step closer to
multiplatform by replacing references to statically mapped registers
with dynamic mapping using ioremap.

The helper struct samsung_timer_variant is extended with reg_base field,
which is used to pass platform-specific base address to the driver.

Signed-off-by: Tomasz Figa <tomasz.figa@gmail.com>
---
 arch/arm/mach-exynos/mach-universal_c210.c | 1 +
 arch/arm/mach-s3c24xx/common.c             | 1 +
 arch/arm/mach-s3c64xx/common.c             | 1 +
 arch/arm/mach-s5p64x0/common.c             | 1 +
 arch/arm/mach-s5pc100/common.c             | 1 +
 arch/arm/mach-s5pv210/common.c             | 1 +
 drivers/clocksource/samsung-time.c         | 9 +++++++--
 include/clocksource/samsung-time.h         | 2 ++
 8 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/arch/arm/mach-exynos/mach-universal_c210.c b/arch/arm/mach-exynos/mach-universal_c210.c
index 8ce1206..3ece9e0 100644
--- a/arch/arm/mach-exynos/mach-universal_c210.c
+++ b/arch/arm/mach-exynos/mach-universal_c210.c
@@ -1090,6 +1090,7 @@ static struct platform_device *universal_devices[] __initdata = {
 };
 
 static const struct samsung_timer_variant universal_timer_variant = {
+	.reg_base = EXYNOS4_PA_TIMER,
 	.bits = 32,
 	.prescale = 2,
 	.divisor = 1,
diff --git a/arch/arm/mach-s3c24xx/common.c b/arch/arm/mach-s3c24xx/common.c
index fe054d6..5f142b2 100644
--- a/arch/arm/mach-s3c24xx/common.c
+++ b/arch/arm/mach-s3c24xx/common.c
@@ -218,6 +218,7 @@ static void s3c24xx_default_idle(void)
 }
 
 static const struct samsung_timer_variant s3c24xx_timer_variant = {
+	.reg_base = S3C24XX_PA_TIMER,
 	.bits = 16,
 	.prescale = 25,
 	.divisor = 2,
diff --git a/arch/arm/mach-s3c64xx/common.c b/arch/arm/mach-s3c64xx/common.c
index 0f7df6a..a4a370e 100644
--- a/arch/arm/mach-s3c64xx/common.c
+++ b/arch/arm/mach-s3c64xx/common.c
@@ -150,6 +150,7 @@ static struct device s3c64xx_dev = {
 };
 
 static const struct samsung_timer_variant s3c64xx_timer_variant = {
+	.reg_base = S3C_PA_TIMER,
 	.bits = 32,
 	.prescale = 2,
 	.divisor = 1,
diff --git a/arch/arm/mach-s5p64x0/common.c b/arch/arm/mach-s5p64x0/common.c
index 2839022..407c5a7 100644
--- a/arch/arm/mach-s5p64x0/common.c
+++ b/arch/arm/mach-s5p64x0/common.c
@@ -158,6 +158,7 @@ static void s5p64x0_idle(void)
 }
 
 static const struct samsung_timer_variant s5p64x0_timer_variant = {
+	.reg_base = S5P_PA_TIMER,
 	.bits = 32,
 	.prescale = 2,
 	.divisor = 1,
diff --git a/arch/arm/mach-s5pc100/common.c b/arch/arm/mach-s5pc100/common.c
index 0df9124..0df734a 100644
--- a/arch/arm/mach-s5pc100/common.c
+++ b/arch/arm/mach-s5pc100/common.c
@@ -133,6 +133,7 @@ static struct map_desc s5pc100_iodesc[] __initdata = {
 };
 
 static const struct samsung_timer_variant s5pc100_timer_variant = {
+	.reg_base = S5P_PA_TIMER,
 	.bits = 32,
 	.prescale = 2,
 	.divisor = 1,
diff --git a/arch/arm/mach-s5pv210/common.c b/arch/arm/mach-s5pv210/common.c
index 2d1bc6b..42108ca 100644
--- a/arch/arm/mach-s5pv210/common.c
+++ b/arch/arm/mach-s5pv210/common.c
@@ -150,6 +150,7 @@ void s5pv210_restart(char mode, const char *cmd)
 }
 
 static const struct samsung_timer_variant s5pv210_timer_variant = {
+	.reg_base = S5P_PA_TIMER,
 	.bits = 32,
 	.prescale = 2,
 	.divisor = 1,
diff --git a/drivers/clocksource/samsung-time.c b/drivers/clocksource/samsung-time.c
index 259ce25..f14e3fa 100644
--- a/drivers/clocksource/samsung-time.c
+++ b/drivers/clocksource/samsung-time.c
@@ -24,10 +24,11 @@
 #include <asm/mach/map.h>
 #include <asm/sched_clock.h>
 
-#include <mach/map.h>
 #include <plat/devs.h>
 
-#define S3C_TIMERREG(x) (S3C_VA_TIMER + (x))
+static void __iomem *timer_base;
+
+#define S3C_TIMERREG(x) (timer_base + (x))
 #define S3C_TIMERREG2(tmr,reg) S3C_TIMERREG((reg)+0x0c+((tmr)*0x0c))
 
 #define S3C2410_TCON	      S3C_TIMERREG(0x08)
@@ -406,6 +407,10 @@ static void __init samsung_timer_resources(void)
 	unsigned long source_id = timer_source.source_id;
 	char devname[15];
 
+	timer_base = ioremap_nocache(timer_variant.reg_base, SZ_4K);
+	if (!timer_base)
+		panic("failed to map timer registers");
+
 	timerclk = clk_get(NULL, "timers");
 	if (IS_ERR(timerclk))
 		panic("failed to get timers clock for timer");
diff --git a/include/clocksource/samsung-time.h b/include/clocksource/samsung-time.h
index d64d8a2..535a334 100644
--- a/include/clocksource/samsung-time.h
+++ b/include/clocksource/samsung-time.h
@@ -29,11 +29,13 @@ struct samsung_timer_source {
 
 /**
  * struct samsung_timer_variant - SoC-specific parameters of Samsung PWM timers
+ * @reg_base:	physical base address of timer registers
  * @bits:	bit width of time counters
  * @prescale:	prescaler divisor
  * @divisor:	main divisor
  */
 struct samsung_timer_variant {
+	unsigned long reg_base;
 	int bits;
 	u16 prescale;
 	u16 divisor;
-- 
1.8.1.5

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

* [PATCH v3 07/12] clocksource: samsung-time: Use clk_get_sys for getting clocks
  2013-03-09 20:23 ` Tomasz Figa
@ 2013-03-09 20:23   ` Tomasz Figa
  -1 siblings, 0 replies; 34+ messages in thread
From: Tomasz Figa @ 2013-03-09 20:23 UTC (permalink / raw)
  To: linux-arm-kernel
  Cc: linux-samsung-soc, Kukjin Kim, kyungmin.park, linux, broonie,
	kwangwoo.lee, jacmet, augulis.darius, mcuelenaere, linux,
	Sylwester Nawrocki, buserror, christer, jekhor, ghcstop,
	Mark Rutland, Tomasz Figa, Heiko Stübner, Rob Herring

This patch removes the need to reference platform_device structs defined
in platform code, by using clk_get_sys instead of clk_get for getting
necessary clocks.

Signed-off-by: Tomasz Figa <tomasz.figa@gmail.com>
---
 drivers/clocksource/samsung-time.c | 17 ++++-------------
 1 file changed, 4 insertions(+), 13 deletions(-)

diff --git a/drivers/clocksource/samsung-time.c b/drivers/clocksource/samsung-time.c
index f14e3fa..31ae97b 100644
--- a/drivers/clocksource/samsung-time.c
+++ b/drivers/clocksource/samsung-time.c
@@ -24,8 +24,6 @@
 #include <asm/mach/map.h>
 #include <asm/sched_clock.h>
 
-#include <plat/devs.h>
-
 static void __iomem *timer_base;
 
 #define S3C_TIMERREG(x) (timer_base + (x))
@@ -266,9 +264,6 @@ static void samsung_timer_resume(void)
 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;
 }
@@ -418,28 +413,24 @@ static void __init samsung_timer_resources(void)
 	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");
+	tin_event = clk_get_sys(devname, "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");
+	tdiv_event = clk_get_sys(devname, "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");
+	tin_source = clk_get_sys(devname, "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");
+	tdiv_source = clk_get_sys(devname, "pwm-tdiv");
 	if (IS_ERR(tdiv_source))
 		panic("failed to get pwm-tdiv clock for source timer");
 
-- 
1.8.1.5

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

* [PATCH v3 07/12] clocksource: samsung-time: Use clk_get_sys for getting clocks
@ 2013-03-09 20:23   ` Tomasz Figa
  0 siblings, 0 replies; 34+ messages in thread
From: Tomasz Figa @ 2013-03-09 20:23 UTC (permalink / raw)
  To: linux-arm-kernel

This patch removes the need to reference platform_device structs defined
in platform code, by using clk_get_sys instead of clk_get for getting
necessary clocks.

Signed-off-by: Tomasz Figa <tomasz.figa@gmail.com>
---
 drivers/clocksource/samsung-time.c | 17 ++++-------------
 1 file changed, 4 insertions(+), 13 deletions(-)

diff --git a/drivers/clocksource/samsung-time.c b/drivers/clocksource/samsung-time.c
index f14e3fa..31ae97b 100644
--- a/drivers/clocksource/samsung-time.c
+++ b/drivers/clocksource/samsung-time.c
@@ -24,8 +24,6 @@
 #include <asm/mach/map.h>
 #include <asm/sched_clock.h>
 
-#include <plat/devs.h>
-
 static void __iomem *timer_base;
 
 #define S3C_TIMERREG(x) (timer_base + (x))
@@ -266,9 +264,6 @@ static void samsung_timer_resume(void)
 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;
 }
@@ -418,28 +413,24 @@ static void __init samsung_timer_resources(void)
 	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");
+	tin_event = clk_get_sys(devname, "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");
+	tdiv_event = clk_get_sys(devname, "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");
+	tin_source = clk_get_sys(devname, "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");
+	tdiv_source = clk_get_sys(devname, "pwm-tdiv");
 	if (IS_ERR(tdiv_source))
 		panic("failed to get pwm-tdiv clock for source timer");
 
-- 
1.8.1.5

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

* [PATCH v3 08/12] ARM: SAMSUNG: devs: Drop unnecessary IRQ resources of timer devices
  2013-03-09 20:23 ` Tomasz Figa
@ 2013-03-09 20:23   ` Tomasz Figa
  -1 siblings, 0 replies; 34+ messages in thread
From: Tomasz Figa @ 2013-03-09 20:23 UTC (permalink / raw)
  To: linux-arm-kernel
  Cc: linux-samsung-soc, Kukjin Kim, kyungmin.park, linux, broonie,
	kwangwoo.lee, jacmet, augulis.darius, mcuelenaere, linux,
	Sylwester Nawrocki, buserror, christer, jekhor, ghcstop,
	Mark Rutland, Tomasz Figa, Heiko Stübner, Rob Herring

Devices from s3c_device_timer array are used only for PWM driver, which
does not need interrupts. This patch removes IRQ resources of those
devices.

Signed-off-by: Tomasz Figa <tomasz.figa@gmail.com>
---
 arch/arm/plat-samsung/devs.c | 28 ++++++++--------------------
 1 file changed, 8 insertions(+), 20 deletions(-)

diff --git a/arch/arm/plat-samsung/devs.c b/arch/arm/plat-samsung/devs.c
index e1124d9..196aa68 100644
--- a/arch/arm/plat-samsung/devs.c
+++ b/arch/arm/plat-samsung/devs.c
@@ -1137,34 +1137,22 @@ arch_initcall(s5p_pmu_init);
 
 #ifdef CONFIG_SAMSUNG_DEV_PWM
 
-#define TIMER_RESOURCE_SIZE (1)
-
-#define TIMER_RESOURCE(_tmr, _irq)			\
-	(struct resource [TIMER_RESOURCE_SIZE]) {	\
-		[0] = {					\
-			.start	= _irq,			\
-			.end	= _irq,			\
-			.flags	= IORESOURCE_IRQ	\
-		}					\
+#define DEFINE_S3C_TIMER(_tmr_no) {			\
+		.name		= "s3c24xx-pwm",	\
+		.id		= _tmr_no,		\
 	}
 
-#define DEFINE_S3C_TIMER(_tmr_no, _irq)			\
-	.name		= "s3c24xx-pwm",		\
-	.id		= _tmr_no,			\
-	.num_resources	= TIMER_RESOURCE_SIZE,		\
-	.resource	= TIMER_RESOURCE(_tmr_no, _irq),	\
-
 /*
  * since we already have an static mapping for the timer,
  * we do not bother setting any IO resource for the base.
  */
 
 struct platform_device s3c_device_timer[] = {
-	[0] = { DEFINE_S3C_TIMER(0, IRQ_TIMER0) },
-	[1] = { DEFINE_S3C_TIMER(1, IRQ_TIMER1) },
-	[2] = { DEFINE_S3C_TIMER(2, IRQ_TIMER2) },
-	[3] = { DEFINE_S3C_TIMER(3, IRQ_TIMER3) },
-	[4] = { DEFINE_S3C_TIMER(4, IRQ_TIMER4) },
+	[0] = DEFINE_S3C_TIMER(0),
+	[1] = DEFINE_S3C_TIMER(1),
+	[2] = DEFINE_S3C_TIMER(2),
+	[3] = DEFINE_S3C_TIMER(3),
+	[4] = DEFINE_S3C_TIMER(4),
 };
 #endif /* CONFIG_SAMSUNG_DEV_PWM */
 
-- 
1.8.1.5

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

* [PATCH v3 08/12] ARM: SAMSUNG: devs: Drop unnecessary IRQ resources of timer devices
@ 2013-03-09 20:23   ` Tomasz Figa
  0 siblings, 0 replies; 34+ messages in thread
From: Tomasz Figa @ 2013-03-09 20:23 UTC (permalink / raw)
  To: linux-arm-kernel

Devices from s3c_device_timer array are used only for PWM driver, which
does not need interrupts. This patch removes IRQ resources of those
devices.

Signed-off-by: Tomasz Figa <tomasz.figa@gmail.com>
---
 arch/arm/plat-samsung/devs.c | 28 ++++++++--------------------
 1 file changed, 8 insertions(+), 20 deletions(-)

diff --git a/arch/arm/plat-samsung/devs.c b/arch/arm/plat-samsung/devs.c
index e1124d9..196aa68 100644
--- a/arch/arm/plat-samsung/devs.c
+++ b/arch/arm/plat-samsung/devs.c
@@ -1137,34 +1137,22 @@ arch_initcall(s5p_pmu_init);
 
 #ifdef CONFIG_SAMSUNG_DEV_PWM
 
-#define TIMER_RESOURCE_SIZE (1)
-
-#define TIMER_RESOURCE(_tmr, _irq)			\
-	(struct resource [TIMER_RESOURCE_SIZE]) {	\
-		[0] = {					\
-			.start	= _irq,			\
-			.end	= _irq,			\
-			.flags	= IORESOURCE_IRQ	\
-		}					\
+#define DEFINE_S3C_TIMER(_tmr_no) {			\
+		.name		= "s3c24xx-pwm",	\
+		.id		= _tmr_no,		\
 	}
 
-#define DEFINE_S3C_TIMER(_tmr_no, _irq)			\
-	.name		= "s3c24xx-pwm",		\
-	.id		= _tmr_no,			\
-	.num_resources	= TIMER_RESOURCE_SIZE,		\
-	.resource	= TIMER_RESOURCE(_tmr_no, _irq),	\
-
 /*
  * since we already have an static mapping for the timer,
  * we do not bother setting any IO resource for the base.
  */
 
 struct platform_device s3c_device_timer[] = {
-	[0] = { DEFINE_S3C_TIMER(0, IRQ_TIMER0) },
-	[1] = { DEFINE_S3C_TIMER(1, IRQ_TIMER1) },
-	[2] = { DEFINE_S3C_TIMER(2, IRQ_TIMER2) },
-	[3] = { DEFINE_S3C_TIMER(3, IRQ_TIMER3) },
-	[4] = { DEFINE_S3C_TIMER(4, IRQ_TIMER4) },
+	[0] = DEFINE_S3C_TIMER(0),
+	[1] = DEFINE_S3C_TIMER(1),
+	[2] = DEFINE_S3C_TIMER(2),
+	[3] = DEFINE_S3C_TIMER(3),
+	[4] = DEFINE_S3C_TIMER(4),
 };
 #endif /* CONFIG_SAMSUNG_DEV_PWM */
 
-- 
1.8.1.5

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

* [PATCH v3 09/12] clocksource: samsung-time: Do not use static IRQ definition
  2013-03-09 20:23 ` Tomasz Figa
@ 2013-03-09 20:23   ` Tomasz Figa
  -1 siblings, 0 replies; 34+ messages in thread
From: Tomasz Figa @ 2013-03-09 20:23 UTC (permalink / raw)
  To: linux-arm-kernel
  Cc: linux-samsung-soc, Kukjin Kim, kyungmin.park, linux, broonie,
	kwangwoo.lee, jacmet, augulis.darius, mcuelenaere, linux,
	Sylwester Nawrocki, buserror, christer, jekhor, ghcstop,
	Mark Rutland, Tomasz Figa, Heiko Stübner, Rob Herring

As another step towards multiplatform support, this patch modifies the
samsung-time clocksource driver and its users to pass timer IRQ numbers
through the samsung_timer_variant structure.

Signed-off-by: Tomasz Figa <tomasz.figa@gmail.com>
---
 arch/arm/mach-exynos/mach-universal_c210.c | 4 ++++
 arch/arm/mach-s3c24xx/common.c             | 3 +++
 arch/arm/mach-s3c64xx/common.c             | 4 ++++
 arch/arm/mach-s5p64x0/common.c             | 4 ++++
 arch/arm/mach-s5pc100/common.c             | 4 ++++
 arch/arm/mach-s5pv210/common.c             | 4 ++++
 drivers/clocksource/samsung-time.c         | 2 +-
 include/clocksource/samsung-time.h         | 4 ++++
 8 files changed, 28 insertions(+), 1 deletion(-)

diff --git a/arch/arm/mach-exynos/mach-universal_c210.c b/arch/arm/mach-exynos/mach-universal_c210.c
index 3ece9e0..4cfc57b 100644
--- a/arch/arm/mach-exynos/mach-universal_c210.c
+++ b/arch/arm/mach-exynos/mach-universal_c210.c
@@ -1091,6 +1091,10 @@ static struct platform_device *universal_devices[] __initdata = {
 
 static const struct samsung_timer_variant universal_timer_variant = {
 	.reg_base = EXYNOS4_PA_TIMER,
+	.irqs = {
+		IRQ_TIMER0, IRQ_TIMER1, IRQ_TIMER2,
+		IRQ_TIMER3, IRQ_TIMER4
+	},
 	.bits = 32,
 	.prescale = 2,
 	.divisor = 1,
diff --git a/arch/arm/mach-s3c24xx/common.c b/arch/arm/mach-s3c24xx/common.c
index 5f142b2..82b5acf 100644
--- a/arch/arm/mach-s3c24xx/common.c
+++ b/arch/arm/mach-s3c24xx/common.c
@@ -219,6 +219,9 @@ static void s3c24xx_default_idle(void)
 
 static const struct samsung_timer_variant s3c24xx_timer_variant = {
 	.reg_base = S3C24XX_PA_TIMER,
+	.irqs = {
+		IRQ_TIMER0, IRQ_TIMER1, IRQ_TIMER2, IRQ_TIMER3, IRQ_TIMER4
+	},
 	.bits = 16,
 	.prescale = 25,
 	.divisor = 2,
diff --git a/arch/arm/mach-s3c64xx/common.c b/arch/arm/mach-s3c64xx/common.c
index a4a370e..c2cbe84 100644
--- a/arch/arm/mach-s3c64xx/common.c
+++ b/arch/arm/mach-s3c64xx/common.c
@@ -151,6 +151,10 @@ static struct device s3c64xx_dev = {
 
 static const struct samsung_timer_variant s3c64xx_timer_variant = {
 	.reg_base = S3C_PA_TIMER,
+	.irqs = {
+		IRQ_TIMER0, IRQ_TIMER1, IRQ_TIMER2,
+		IRQ_TIMER3, IRQ_TIMER4
+	},
 	.bits = 32,
 	.prescale = 2,
 	.divisor = 1,
diff --git a/arch/arm/mach-s5p64x0/common.c b/arch/arm/mach-s5p64x0/common.c
index 407c5a7..510b972 100644
--- a/arch/arm/mach-s5p64x0/common.c
+++ b/arch/arm/mach-s5p64x0/common.c
@@ -159,6 +159,10 @@ static void s5p64x0_idle(void)
 
 static const struct samsung_timer_variant s5p64x0_timer_variant = {
 	.reg_base = S5P_PA_TIMER,
+	.irqs = {
+		IRQ_TIMER0, IRQ_TIMER1, IRQ_TIMER2,
+		IRQ_TIMER3, IRQ_TIMER4
+	},
 	.bits = 32,
 	.prescale = 2,
 	.divisor = 1,
diff --git a/arch/arm/mach-s5pc100/common.c b/arch/arm/mach-s5pc100/common.c
index 0df734a..079c257 100644
--- a/arch/arm/mach-s5pc100/common.c
+++ b/arch/arm/mach-s5pc100/common.c
@@ -134,6 +134,10 @@ static struct map_desc s5pc100_iodesc[] __initdata = {
 
 static const struct samsung_timer_variant s5pc100_timer_variant = {
 	.reg_base = S5P_PA_TIMER,
+	.irqs = {
+		IRQ_TIMER0, IRQ_TIMER1, IRQ_TIMER2,
+		IRQ_TIMER3, IRQ_TIMER4
+	},
 	.bits = 32,
 	.prescale = 2,
 	.divisor = 1,
diff --git a/arch/arm/mach-s5pv210/common.c b/arch/arm/mach-s5pv210/common.c
index 42108ca..9549bb5 100644
--- a/arch/arm/mach-s5pv210/common.c
+++ b/arch/arm/mach-s5pv210/common.c
@@ -151,6 +151,10 @@ void s5pv210_restart(char mode, const char *cmd)
 
 static const struct samsung_timer_variant s5pv210_timer_variant = {
 	.reg_base = S5P_PA_TIMER,
+	.irqs = {
+		IRQ_TIMER0, IRQ_TIMER1, IRQ_TIMER2,
+		IRQ_TIMER3, IRQ_TIMER4
+	},
 	.bits = 32,
 	.prescale = 2,
 	.divisor = 1,
diff --git a/drivers/clocksource/samsung-time.c b/drivers/clocksource/samsung-time.c
index 31ae97b..336b3aa5 100644
--- a/drivers/clocksource/samsung-time.c
+++ b/drivers/clocksource/samsung-time.c
@@ -320,7 +320,7 @@ static void __init samsung_clockevent_init(void)
 	time_event_device.cpumask = cpumask_of(0);
 	clockevents_config_and_register(&time_event_device, clock_rate, 1, -1);
 
-	irq_number = timer_source.event_id + IRQ_TIMER0;
+	irq_number = timer_variant.irqs[timer_source.event_id];
 	setup_irq(irq_number, &samsung_clock_event_irq);
 }
 
diff --git a/include/clocksource/samsung-time.h b/include/clocksource/samsung-time.h
index 535a334..66de2b5 100644
--- a/include/clocksource/samsung-time.h
+++ b/include/clocksource/samsung-time.h
@@ -20,6 +20,8 @@ enum samsung_timer_mode {
 	SAMSUNG_PWM2,
 	SAMSUNG_PWM3,
 	SAMSUNG_PWM4,
+
+	SAMSUNG_PWM_NUM
 };
 
 struct samsung_timer_source {
@@ -30,12 +32,14 @@ struct samsung_timer_source {
 /**
  * struct samsung_timer_variant - SoC-specific parameters of Samsung PWM timers
  * @reg_base:	physical base address of timer registers
+ * @irqs:	interrupt numbers of all timers
  * @bits:	bit width of time counters
  * @prescale:	prescaler divisor
  * @divisor:	main divisor
  */
 struct samsung_timer_variant {
 	unsigned long reg_base;
+	unsigned int irqs[SAMSUNG_PWM_NUM];
 	int bits;
 	u16 prescale;
 	u16 divisor;
-- 
1.8.1.5

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

* [PATCH v3 09/12] clocksource: samsung-time: Do not use static IRQ definition
@ 2013-03-09 20:23   ` Tomasz Figa
  0 siblings, 0 replies; 34+ messages in thread
From: Tomasz Figa @ 2013-03-09 20:23 UTC (permalink / raw)
  To: linux-arm-kernel

As another step towards multiplatform support, this patch modifies the
samsung-time clocksource driver and its users to pass timer IRQ numbers
through the samsung_timer_variant structure.

Signed-off-by: Tomasz Figa <tomasz.figa@gmail.com>
---
 arch/arm/mach-exynos/mach-universal_c210.c | 4 ++++
 arch/arm/mach-s3c24xx/common.c             | 3 +++
 arch/arm/mach-s3c64xx/common.c             | 4 ++++
 arch/arm/mach-s5p64x0/common.c             | 4 ++++
 arch/arm/mach-s5pc100/common.c             | 4 ++++
 arch/arm/mach-s5pv210/common.c             | 4 ++++
 drivers/clocksource/samsung-time.c         | 2 +-
 include/clocksource/samsung-time.h         | 4 ++++
 8 files changed, 28 insertions(+), 1 deletion(-)

diff --git a/arch/arm/mach-exynos/mach-universal_c210.c b/arch/arm/mach-exynos/mach-universal_c210.c
index 3ece9e0..4cfc57b 100644
--- a/arch/arm/mach-exynos/mach-universal_c210.c
+++ b/arch/arm/mach-exynos/mach-universal_c210.c
@@ -1091,6 +1091,10 @@ static struct platform_device *universal_devices[] __initdata = {
 
 static const struct samsung_timer_variant universal_timer_variant = {
 	.reg_base = EXYNOS4_PA_TIMER,
+	.irqs = {
+		IRQ_TIMER0, IRQ_TIMER1, IRQ_TIMER2,
+		IRQ_TIMER3, IRQ_TIMER4
+	},
 	.bits = 32,
 	.prescale = 2,
 	.divisor = 1,
diff --git a/arch/arm/mach-s3c24xx/common.c b/arch/arm/mach-s3c24xx/common.c
index 5f142b2..82b5acf 100644
--- a/arch/arm/mach-s3c24xx/common.c
+++ b/arch/arm/mach-s3c24xx/common.c
@@ -219,6 +219,9 @@ static void s3c24xx_default_idle(void)
 
 static const struct samsung_timer_variant s3c24xx_timer_variant = {
 	.reg_base = S3C24XX_PA_TIMER,
+	.irqs = {
+		IRQ_TIMER0, IRQ_TIMER1, IRQ_TIMER2, IRQ_TIMER3, IRQ_TIMER4
+	},
 	.bits = 16,
 	.prescale = 25,
 	.divisor = 2,
diff --git a/arch/arm/mach-s3c64xx/common.c b/arch/arm/mach-s3c64xx/common.c
index a4a370e..c2cbe84 100644
--- a/arch/arm/mach-s3c64xx/common.c
+++ b/arch/arm/mach-s3c64xx/common.c
@@ -151,6 +151,10 @@ static struct device s3c64xx_dev = {
 
 static const struct samsung_timer_variant s3c64xx_timer_variant = {
 	.reg_base = S3C_PA_TIMER,
+	.irqs = {
+		IRQ_TIMER0, IRQ_TIMER1, IRQ_TIMER2,
+		IRQ_TIMER3, IRQ_TIMER4
+	},
 	.bits = 32,
 	.prescale = 2,
 	.divisor = 1,
diff --git a/arch/arm/mach-s5p64x0/common.c b/arch/arm/mach-s5p64x0/common.c
index 407c5a7..510b972 100644
--- a/arch/arm/mach-s5p64x0/common.c
+++ b/arch/arm/mach-s5p64x0/common.c
@@ -159,6 +159,10 @@ static void s5p64x0_idle(void)
 
 static const struct samsung_timer_variant s5p64x0_timer_variant = {
 	.reg_base = S5P_PA_TIMER,
+	.irqs = {
+		IRQ_TIMER0, IRQ_TIMER1, IRQ_TIMER2,
+		IRQ_TIMER3, IRQ_TIMER4
+	},
 	.bits = 32,
 	.prescale = 2,
 	.divisor = 1,
diff --git a/arch/arm/mach-s5pc100/common.c b/arch/arm/mach-s5pc100/common.c
index 0df734a..079c257 100644
--- a/arch/arm/mach-s5pc100/common.c
+++ b/arch/arm/mach-s5pc100/common.c
@@ -134,6 +134,10 @@ static struct map_desc s5pc100_iodesc[] __initdata = {
 
 static const struct samsung_timer_variant s5pc100_timer_variant = {
 	.reg_base = S5P_PA_TIMER,
+	.irqs = {
+		IRQ_TIMER0, IRQ_TIMER1, IRQ_TIMER2,
+		IRQ_TIMER3, IRQ_TIMER4
+	},
 	.bits = 32,
 	.prescale = 2,
 	.divisor = 1,
diff --git a/arch/arm/mach-s5pv210/common.c b/arch/arm/mach-s5pv210/common.c
index 42108ca..9549bb5 100644
--- a/arch/arm/mach-s5pv210/common.c
+++ b/arch/arm/mach-s5pv210/common.c
@@ -151,6 +151,10 @@ void s5pv210_restart(char mode, const char *cmd)
 
 static const struct samsung_timer_variant s5pv210_timer_variant = {
 	.reg_base = S5P_PA_TIMER,
+	.irqs = {
+		IRQ_TIMER0, IRQ_TIMER1, IRQ_TIMER2,
+		IRQ_TIMER3, IRQ_TIMER4
+	},
 	.bits = 32,
 	.prescale = 2,
 	.divisor = 1,
diff --git a/drivers/clocksource/samsung-time.c b/drivers/clocksource/samsung-time.c
index 31ae97b..336b3aa5 100644
--- a/drivers/clocksource/samsung-time.c
+++ b/drivers/clocksource/samsung-time.c
@@ -320,7 +320,7 @@ static void __init samsung_clockevent_init(void)
 	time_event_device.cpumask = cpumask_of(0);
 	clockevents_config_and_register(&time_event_device, clock_rate, 1, -1);
 
-	irq_number = timer_source.event_id + IRQ_TIMER0;
+	irq_number = timer_variant.irqs[timer_source.event_id];
 	setup_irq(irq_number, &samsung_clock_event_irq);
 }
 
diff --git a/include/clocksource/samsung-time.h b/include/clocksource/samsung-time.h
index 535a334..66de2b5 100644
--- a/include/clocksource/samsung-time.h
+++ b/include/clocksource/samsung-time.h
@@ -20,6 +20,8 @@ enum samsung_timer_mode {
 	SAMSUNG_PWM2,
 	SAMSUNG_PWM3,
 	SAMSUNG_PWM4,
+
+	SAMSUNG_PWM_NUM
 };
 
 struct samsung_timer_source {
@@ -30,12 +32,14 @@ struct samsung_timer_source {
 /**
  * struct samsung_timer_variant - SoC-specific parameters of Samsung PWM timers
  * @reg_base:	physical base address of timer registers
+ * @irqs:	interrupt numbers of all timers
  * @bits:	bit width of time counters
  * @prescale:	prescaler divisor
  * @divisor:	main divisor
  */
 struct samsung_timer_variant {
 	unsigned long reg_base;
+	unsigned int irqs[SAMSUNG_PWM_NUM];
 	int bits;
 	u16 prescale;
 	u16 divisor;
-- 
1.8.1.5

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

* [PATCH v3 10/12] clocksource: samsung-time: Move IRQ mask/ack handling to the driver
  2013-03-09 20:23 ` Tomasz Figa
@ 2013-03-09 20:23   ` Tomasz Figa
  -1 siblings, 0 replies; 34+ messages in thread
From: Tomasz Figa @ 2013-03-09 20:23 UTC (permalink / raw)
  To: linux-arm-kernel
  Cc: linux-samsung-soc, Kukjin Kim, kyungmin.park, linux, broonie,
	kwangwoo.lee, jacmet, augulis.darius, mcuelenaere, linux,
	Sylwester Nawrocki, buserror, christer, jekhor, ghcstop,
	Mark Rutland, Tomasz Figa, Heiko Stübner, Rob Herring

Since the clocksource driver is the only user of PWM timer interrupts,
there is no need to create an IRQ chip for handling them.

This patch the way of PWM timer interrupt handling to use real VIC/GIC
interrupt signals and handle PWM mask/ack register internally in
samsung-time driver.

Signed-off-by: Tomasz Figa <tomasz.figa@gmail.com>
---
 arch/arm/mach-exynos/include/mach/irqs.h   |  3 +--
 arch/arm/mach-exynos/mach-universal_c210.c |  5 +++--
 arch/arm/mach-s3c24xx/common.c             |  1 +
 arch/arm/mach-s3c64xx/common.c             |  8 +++-----
 arch/arm/mach-s3c64xx/include/mach/irqs.h  |  8 --------
 arch/arm/mach-s5p64x0/common.c             |  5 +++--
 arch/arm/mach-s5p64x0/include/mach/irqs.h  |  2 --
 arch/arm/mach-s5pc100/common.c             |  5 +++--
 arch/arm/mach-s5pc100/include/mach/irqs.h  |  2 --
 arch/arm/mach-s5pv210/common.c             |  5 +++--
 arch/arm/mach-s5pv210/include/mach/irqs.h  |  2 --
 arch/arm/plat-samsung/include/plat/irqs.h  |  9 ---------
 arch/arm/plat-samsung/s5p-irq.c            |  2 --
 drivers/clocksource/samsung-time.c         | 10 ++++++++++
 include/clocksource/samsung-time.h         |  2 ++
 15 files changed, 29 insertions(+), 40 deletions(-)

diff --git a/arch/arm/mach-exynos/include/mach/irqs.h b/arch/arm/mach-exynos/include/mach/irqs.h
index 35fe6d5..6fbe229 100644
--- a/arch/arm/mach-exynos/include/mach/irqs.h
+++ b/arch/arm/mach-exynos/include/mach/irqs.h
@@ -464,10 +464,9 @@
 #define S5P_EINT_BASE2			(S5P_EINT_BASE1 + 16)
 #define S5P_GPIOINT_BASE		(S5P_EINT_BASE1 + 32)
 #define IRQ_GPIO_END			(S5P_GPIOINT_BASE + S5P_GPIOINT_COUNT)
-#define IRQ_TIMER_BASE			(IRQ_GPIO_END + 64)
 
 /* Set the default NR_IRQS */
 
-#define NR_IRQS				(IRQ_TIMER_BASE + IRQ_TIMER_COUNT)
+#define NR_IRQS				(IRQ_GPIO_END + 64)
 
 #endif /* __ASM_ARCH_IRQS_H */
diff --git a/arch/arm/mach-exynos/mach-universal_c210.c b/arch/arm/mach-exynos/mach-universal_c210.c
index 4cfc57b..4bb1964 100644
--- a/arch/arm/mach-exynos/mach-universal_c210.c
+++ b/arch/arm/mach-exynos/mach-universal_c210.c
@@ -1092,12 +1092,13 @@ static struct platform_device *universal_devices[] __initdata = {
 static const struct samsung_timer_variant universal_timer_variant = {
 	.reg_base = EXYNOS4_PA_TIMER,
 	.irqs = {
-		IRQ_TIMER0, IRQ_TIMER1, IRQ_TIMER2,
-		IRQ_TIMER3, IRQ_TIMER4
+		IRQ_TIMER0_VIC, IRQ_TIMER1_VIC, IRQ_TIMER2_VIC,
+		IRQ_TIMER3_VIC, IRQ_TIMER4_VIC
 	},
 	.bits = 32,
 	.prescale = 2,
 	.divisor = 1,
+	.has_tint_cstat = true,
 };
 
 static void __init universal_map_io(void)
diff --git a/arch/arm/mach-s3c24xx/common.c b/arch/arm/mach-s3c24xx/common.c
index 82b5acf..c1c54dc 100644
--- a/arch/arm/mach-s3c24xx/common.c
+++ b/arch/arm/mach-s3c24xx/common.c
@@ -225,6 +225,7 @@ static const struct samsung_timer_variant s3c24xx_timer_variant = {
 	.bits = 16,
 	.prescale = 25,
 	.divisor = 2,
+	.has_tint_cstat = false,
 };
 
 void __init s3c24xx_init_io(struct map_desc *mach_desc, int size)
diff --git a/arch/arm/mach-s3c64xx/common.c b/arch/arm/mach-s3c64xx/common.c
index c2cbe84..31333fa 100644
--- a/arch/arm/mach-s3c64xx/common.c
+++ b/arch/arm/mach-s3c64xx/common.c
@@ -152,12 +152,13 @@ static struct device s3c64xx_dev = {
 static const struct samsung_timer_variant s3c64xx_timer_variant = {
 	.reg_base = S3C_PA_TIMER,
 	.irqs = {
-		IRQ_TIMER0, IRQ_TIMER1, IRQ_TIMER2,
-		IRQ_TIMER3, IRQ_TIMER4
+		IRQ_TIMER0_VIC, IRQ_TIMER1_VIC, IRQ_TIMER2_VIC,
+		IRQ_TIMER3_VIC, IRQ_TIMER4_VIC
 	},
 	.bits = 32,
 	.prescale = 2,
 	.divisor = 1,
+	.has_tint_cstat = true,
 };
 
 /* read cpu identification code */
@@ -202,9 +203,6 @@ void __init s3c64xx_init_irq(u32 vic0_valid, u32 vic1_valid)
 	/* initialise the pair of VICs */
 	vic_init(VA_VIC0, IRQ_VIC0_BASE, vic0_valid, IRQ_VIC0_RESUME);
 	vic_init(VA_VIC1, IRQ_VIC1_BASE, vic1_valid, IRQ_VIC1_RESUME);
-
-	/* add the timer sub-irqs */
-	s3c_init_vic_timer_irq(5, IRQ_TIMER0);
 }
 
 #define eint_offset(irq)	((irq) - IRQ_EINT(0))
diff --git a/arch/arm/mach-s3c64xx/include/mach/irqs.h b/arch/arm/mach-s3c64xx/include/mach/irqs.h
index 96d60e0..67bbd1d 100644
--- a/arch/arm/mach-s3c64xx/include/mach/irqs.h
+++ b/arch/arm/mach-s3c64xx/include/mach/irqs.h
@@ -107,14 +107,6 @@
 #define IRQ_TC			IRQ_PENDN
 #define IRQ_ADC			S3C64XX_IRQ_VIC1(31)
 
-#define S3C64XX_TIMER_IRQ(x)	S3C_IRQ(64 + (x))
-
-#define IRQ_TIMER0		S3C64XX_TIMER_IRQ(0)
-#define IRQ_TIMER1		S3C64XX_TIMER_IRQ(1)
-#define IRQ_TIMER2		S3C64XX_TIMER_IRQ(2)
-#define IRQ_TIMER3		S3C64XX_TIMER_IRQ(3)
-#define IRQ_TIMER4		S3C64XX_TIMER_IRQ(4)
-
 /* compatibility for device defines */
 
 #define IRQ_IIC1		IRQ_S3C6410_IIC1
diff --git a/arch/arm/mach-s5p64x0/common.c b/arch/arm/mach-s5p64x0/common.c
index 510b972..4dfbc07 100644
--- a/arch/arm/mach-s5p64x0/common.c
+++ b/arch/arm/mach-s5p64x0/common.c
@@ -160,12 +160,13 @@ static void s5p64x0_idle(void)
 static const struct samsung_timer_variant s5p64x0_timer_variant = {
 	.reg_base = S5P_PA_TIMER,
 	.irqs = {
-		IRQ_TIMER0, IRQ_TIMER1, IRQ_TIMER2,
-		IRQ_TIMER3, IRQ_TIMER4
+		IRQ_TIMER0_VIC, IRQ_TIMER1_VIC, IRQ_TIMER2_VIC,
+		IRQ_TIMER3_VIC, IRQ_TIMER4_VIC
 	},
 	.bits = 32,
 	.prescale = 2,
 	.divisor = 1,
+	.has_tint_cstat = true,
 };
 
 /*
diff --git a/arch/arm/mach-s5p64x0/include/mach/irqs.h b/arch/arm/mach-s5p64x0/include/mach/irqs.h
index 5b845e8..53982db 100644
--- a/arch/arm/mach-s5p64x0/include/mach/irqs.h
+++ b/arch/arm/mach-s5p64x0/include/mach/irqs.h
@@ -141,8 +141,6 @@
 
 #define IRQ_EINT_GROUP(grp, x)	(IRQ_EINT_GROUP##grp##_BASE + (x))
 
-#define IRQ_TIMER_BASE		(11)
-
 /* Set the default NR_IRQS */
 
 #define NR_IRQS			(IRQ_EINT_GROUP8_BASE + IRQ_EINT_GROUP8_NR + 1)
diff --git a/arch/arm/mach-s5pc100/common.c b/arch/arm/mach-s5pc100/common.c
index 079c257..fdfad42 100644
--- a/arch/arm/mach-s5pc100/common.c
+++ b/arch/arm/mach-s5pc100/common.c
@@ -135,12 +135,13 @@ static struct map_desc s5pc100_iodesc[] __initdata = {
 static const struct samsung_timer_variant s5pc100_timer_variant = {
 	.reg_base = S5P_PA_TIMER,
 	.irqs = {
-		IRQ_TIMER0, IRQ_TIMER1, IRQ_TIMER2,
-		IRQ_TIMER3, IRQ_TIMER4
+		IRQ_TIMER0_VIC, IRQ_TIMER1_VIC, IRQ_TIMER2_VIC,
+		IRQ_TIMER3_VIC, IRQ_TIMER4_VIC
 	},
 	.bits = 32,
 	.prescale = 2,
 	.divisor = 1,
+	.has_tint_cstat = true,
 };
 
 /*
diff --git a/arch/arm/mach-s5pc100/include/mach/irqs.h b/arch/arm/mach-s5pc100/include/mach/irqs.h
index 2870f12..d2eb475 100644
--- a/arch/arm/mach-s5pc100/include/mach/irqs.h
+++ b/arch/arm/mach-s5pc100/include/mach/irqs.h
@@ -97,8 +97,6 @@
 #define IRQ_SDMFIQ		S5P_IRQ_VIC2(31)
 #define IRQ_VIC_END		S5P_IRQ_VIC2(31)
 
-#define IRQ_TIMER_BASE		(11)
-
 #define S5P_EINT_BASE1		(S5P_IRQ_VIC0(0))
 #define S5P_EINT_BASE2		(IRQ_VIC_END + 1)
 
diff --git a/arch/arm/mach-s5pv210/common.c b/arch/arm/mach-s5pv210/common.c
index 9549bb5..1e390d7 100644
--- a/arch/arm/mach-s5pv210/common.c
+++ b/arch/arm/mach-s5pv210/common.c
@@ -152,12 +152,13 @@ void s5pv210_restart(char mode, const char *cmd)
 static const struct samsung_timer_variant s5pv210_timer_variant = {
 	.reg_base = S5P_PA_TIMER,
 	.irqs = {
-		IRQ_TIMER0, IRQ_TIMER1, IRQ_TIMER2,
-		IRQ_TIMER3, IRQ_TIMER4
+		IRQ_TIMER0_VIC, IRQ_TIMER1_VIC, IRQ_TIMER2_VIC,
+		IRQ_TIMER3_VIC, IRQ_TIMER4_VIC
 	},
 	.bits = 32,
 	.prescale = 2,
 	.divisor = 1,
+	.has_tint_cstat = true,
 };
 
 /*
diff --git a/arch/arm/mach-s5pv210/include/mach/irqs.h b/arch/arm/mach-s5pv210/include/mach/irqs.h
index e777e01..5e0de3a 100644
--- a/arch/arm/mach-s5pv210/include/mach/irqs.h
+++ b/arch/arm/mach-s5pv210/include/mach/irqs.h
@@ -118,8 +118,6 @@
 #define IRQ_MDNIE3		S5P_IRQ_VIC3(8)
 #define IRQ_VIC_END		S5P_IRQ_VIC3(31)
 
-#define IRQ_TIMER_BASE		(11)
-
 #define S5P_EINT_BASE1		(S5P_IRQ_VIC0(0))
 #define S5P_EINT_BASE2		(IRQ_VIC_END + 1)
 
diff --git a/arch/arm/plat-samsung/include/plat/irqs.h b/arch/arm/plat-samsung/include/plat/irqs.h
index df46b77..039001c 100644
--- a/arch/arm/plat-samsung/include/plat/irqs.h
+++ b/arch/arm/plat-samsung/include/plat/irqs.h
@@ -44,15 +44,6 @@
 #define S5P_IRQ_VIC2(x)		(S5P_VIC2_BASE + (x))
 #define S5P_IRQ_VIC3(x)		(S5P_VIC3_BASE + (x))
 
-#define S5P_TIMER_IRQ(x)	(IRQ_TIMER_BASE + (x))
-
-#define IRQ_TIMER0		S5P_TIMER_IRQ(0)
-#define IRQ_TIMER1		S5P_TIMER_IRQ(1)
-#define IRQ_TIMER2		S5P_TIMER_IRQ(2)
-#define IRQ_TIMER3		S5P_TIMER_IRQ(3)
-#define IRQ_TIMER4		S5P_TIMER_IRQ(4)
-#define IRQ_TIMER_COUNT		(5)
-
 #define IRQ_EINT(x)		((x) < 16 ? ((x) + S5P_EINT_BASE1) \
 					: ((x) - 16 + S5P_EINT_BASE2))
 
diff --git a/arch/arm/plat-samsung/s5p-irq.c b/arch/arm/plat-samsung/s5p-irq.c
index 103e371..ce8564d 100644
--- a/arch/arm/plat-samsung/s5p-irq.c
+++ b/arch/arm/plat-samsung/s5p-irq.c
@@ -29,6 +29,4 @@ void __init s5p_init_irq(u32 *vic, u32 num_vic)
 	for (irq = 0; irq < num_vic; irq++)
 		vic_init(VA_VIC(irq), VIC_BASE(irq), vic[irq], 0);
 #endif
-
-	s3c_init_vic_timer_irq(5, IRQ_TIMER0);
 }
diff --git a/drivers/clocksource/samsung-time.c b/drivers/clocksource/samsung-time.c
index 336b3aa5..5c6cfca 100644
--- a/drivers/clocksource/samsung-time.c
+++ b/drivers/clocksource/samsung-time.c
@@ -286,6 +286,11 @@ static irqreturn_t samsung_clock_event_isr(int irq, void *dev_id)
 {
 	struct clock_event_device *evt = dev_id;
 
+	if (timer_variant.has_tint_cstat) {
+		u32 mask = (1 << timer_source.event_id);
+		writel(mask | (mask << 5), S3C64XX_TINT_CSTAT);
+	}
+
 	evt->event_handler(evt);
 
 	return IRQ_HANDLED;
@@ -322,6 +327,11 @@ static void __init samsung_clockevent_init(void)
 
 	irq_number = timer_variant.irqs[timer_source.event_id];
 	setup_irq(irq_number, &samsung_clock_event_irq);
+
+	if (timer_variant.has_tint_cstat) {
+		u32 mask = (1 << timer_source.event_id);
+		writel(mask | (mask << 5), S3C64XX_TINT_CSTAT);
+	}
 }
 
 static void __iomem *samsung_timer_reg(void)
diff --git a/include/clocksource/samsung-time.h b/include/clocksource/samsung-time.h
index 66de2b5..af33bf9 100644
--- a/include/clocksource/samsung-time.h
+++ b/include/clocksource/samsung-time.h
@@ -36,6 +36,7 @@ struct samsung_timer_source {
  * @bits:	bit width of time counters
  * @prescale:	prescaler divisor
  * @divisor:	main divisor
+ * @has_tint_cstat: true if variant has TINT_CSTAT register
  */
 struct samsung_timer_variant {
 	unsigned long reg_base;
@@ -43,6 +44,7 @@ struct samsung_timer_variant {
 	int bits;
 	u16 prescale;
 	u16 divisor;
+	bool has_tint_cstat;
 };
 
 extern void samsung_set_timer_source(enum samsung_timer_mode event,
-- 
1.8.1.5

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

* [PATCH v3 10/12] clocksource: samsung-time: Move IRQ mask/ack handling to the driver
@ 2013-03-09 20:23   ` Tomasz Figa
  0 siblings, 0 replies; 34+ messages in thread
From: Tomasz Figa @ 2013-03-09 20:23 UTC (permalink / raw)
  To: linux-arm-kernel

Since the clocksource driver is the only user of PWM timer interrupts,
there is no need to create an IRQ chip for handling them.

This patch the way of PWM timer interrupt handling to use real VIC/GIC
interrupt signals and handle PWM mask/ack register internally in
samsung-time driver.

Signed-off-by: Tomasz Figa <tomasz.figa@gmail.com>
---
 arch/arm/mach-exynos/include/mach/irqs.h   |  3 +--
 arch/arm/mach-exynos/mach-universal_c210.c |  5 +++--
 arch/arm/mach-s3c24xx/common.c             |  1 +
 arch/arm/mach-s3c64xx/common.c             |  8 +++-----
 arch/arm/mach-s3c64xx/include/mach/irqs.h  |  8 --------
 arch/arm/mach-s5p64x0/common.c             |  5 +++--
 arch/arm/mach-s5p64x0/include/mach/irqs.h  |  2 --
 arch/arm/mach-s5pc100/common.c             |  5 +++--
 arch/arm/mach-s5pc100/include/mach/irqs.h  |  2 --
 arch/arm/mach-s5pv210/common.c             |  5 +++--
 arch/arm/mach-s5pv210/include/mach/irqs.h  |  2 --
 arch/arm/plat-samsung/include/plat/irqs.h  |  9 ---------
 arch/arm/plat-samsung/s5p-irq.c            |  2 --
 drivers/clocksource/samsung-time.c         | 10 ++++++++++
 include/clocksource/samsung-time.h         |  2 ++
 15 files changed, 29 insertions(+), 40 deletions(-)

diff --git a/arch/arm/mach-exynos/include/mach/irqs.h b/arch/arm/mach-exynos/include/mach/irqs.h
index 35fe6d5..6fbe229 100644
--- a/arch/arm/mach-exynos/include/mach/irqs.h
+++ b/arch/arm/mach-exynos/include/mach/irqs.h
@@ -464,10 +464,9 @@
 #define S5P_EINT_BASE2			(S5P_EINT_BASE1 + 16)
 #define S5P_GPIOINT_BASE		(S5P_EINT_BASE1 + 32)
 #define IRQ_GPIO_END			(S5P_GPIOINT_BASE + S5P_GPIOINT_COUNT)
-#define IRQ_TIMER_BASE			(IRQ_GPIO_END + 64)
 
 /* Set the default NR_IRQS */
 
-#define NR_IRQS				(IRQ_TIMER_BASE + IRQ_TIMER_COUNT)
+#define NR_IRQS				(IRQ_GPIO_END + 64)
 
 #endif /* __ASM_ARCH_IRQS_H */
diff --git a/arch/arm/mach-exynos/mach-universal_c210.c b/arch/arm/mach-exynos/mach-universal_c210.c
index 4cfc57b..4bb1964 100644
--- a/arch/arm/mach-exynos/mach-universal_c210.c
+++ b/arch/arm/mach-exynos/mach-universal_c210.c
@@ -1092,12 +1092,13 @@ static struct platform_device *universal_devices[] __initdata = {
 static const struct samsung_timer_variant universal_timer_variant = {
 	.reg_base = EXYNOS4_PA_TIMER,
 	.irqs = {
-		IRQ_TIMER0, IRQ_TIMER1, IRQ_TIMER2,
-		IRQ_TIMER3, IRQ_TIMER4
+		IRQ_TIMER0_VIC, IRQ_TIMER1_VIC, IRQ_TIMER2_VIC,
+		IRQ_TIMER3_VIC, IRQ_TIMER4_VIC
 	},
 	.bits = 32,
 	.prescale = 2,
 	.divisor = 1,
+	.has_tint_cstat = true,
 };
 
 static void __init universal_map_io(void)
diff --git a/arch/arm/mach-s3c24xx/common.c b/arch/arm/mach-s3c24xx/common.c
index 82b5acf..c1c54dc 100644
--- a/arch/arm/mach-s3c24xx/common.c
+++ b/arch/arm/mach-s3c24xx/common.c
@@ -225,6 +225,7 @@ static const struct samsung_timer_variant s3c24xx_timer_variant = {
 	.bits = 16,
 	.prescale = 25,
 	.divisor = 2,
+	.has_tint_cstat = false,
 };
 
 void __init s3c24xx_init_io(struct map_desc *mach_desc, int size)
diff --git a/arch/arm/mach-s3c64xx/common.c b/arch/arm/mach-s3c64xx/common.c
index c2cbe84..31333fa 100644
--- a/arch/arm/mach-s3c64xx/common.c
+++ b/arch/arm/mach-s3c64xx/common.c
@@ -152,12 +152,13 @@ static struct device s3c64xx_dev = {
 static const struct samsung_timer_variant s3c64xx_timer_variant = {
 	.reg_base = S3C_PA_TIMER,
 	.irqs = {
-		IRQ_TIMER0, IRQ_TIMER1, IRQ_TIMER2,
-		IRQ_TIMER3, IRQ_TIMER4
+		IRQ_TIMER0_VIC, IRQ_TIMER1_VIC, IRQ_TIMER2_VIC,
+		IRQ_TIMER3_VIC, IRQ_TIMER4_VIC
 	},
 	.bits = 32,
 	.prescale = 2,
 	.divisor = 1,
+	.has_tint_cstat = true,
 };
 
 /* read cpu identification code */
@@ -202,9 +203,6 @@ void __init s3c64xx_init_irq(u32 vic0_valid, u32 vic1_valid)
 	/* initialise the pair of VICs */
 	vic_init(VA_VIC0, IRQ_VIC0_BASE, vic0_valid, IRQ_VIC0_RESUME);
 	vic_init(VA_VIC1, IRQ_VIC1_BASE, vic1_valid, IRQ_VIC1_RESUME);
-
-	/* add the timer sub-irqs */
-	s3c_init_vic_timer_irq(5, IRQ_TIMER0);
 }
 
 #define eint_offset(irq)	((irq) - IRQ_EINT(0))
diff --git a/arch/arm/mach-s3c64xx/include/mach/irqs.h b/arch/arm/mach-s3c64xx/include/mach/irqs.h
index 96d60e0..67bbd1d 100644
--- a/arch/arm/mach-s3c64xx/include/mach/irqs.h
+++ b/arch/arm/mach-s3c64xx/include/mach/irqs.h
@@ -107,14 +107,6 @@
 #define IRQ_TC			IRQ_PENDN
 #define IRQ_ADC			S3C64XX_IRQ_VIC1(31)
 
-#define S3C64XX_TIMER_IRQ(x)	S3C_IRQ(64 + (x))
-
-#define IRQ_TIMER0		S3C64XX_TIMER_IRQ(0)
-#define IRQ_TIMER1		S3C64XX_TIMER_IRQ(1)
-#define IRQ_TIMER2		S3C64XX_TIMER_IRQ(2)
-#define IRQ_TIMER3		S3C64XX_TIMER_IRQ(3)
-#define IRQ_TIMER4		S3C64XX_TIMER_IRQ(4)
-
 /* compatibility for device defines */
 
 #define IRQ_IIC1		IRQ_S3C6410_IIC1
diff --git a/arch/arm/mach-s5p64x0/common.c b/arch/arm/mach-s5p64x0/common.c
index 510b972..4dfbc07 100644
--- a/arch/arm/mach-s5p64x0/common.c
+++ b/arch/arm/mach-s5p64x0/common.c
@@ -160,12 +160,13 @@ static void s5p64x0_idle(void)
 static const struct samsung_timer_variant s5p64x0_timer_variant = {
 	.reg_base = S5P_PA_TIMER,
 	.irqs = {
-		IRQ_TIMER0, IRQ_TIMER1, IRQ_TIMER2,
-		IRQ_TIMER3, IRQ_TIMER4
+		IRQ_TIMER0_VIC, IRQ_TIMER1_VIC, IRQ_TIMER2_VIC,
+		IRQ_TIMER3_VIC, IRQ_TIMER4_VIC
 	},
 	.bits = 32,
 	.prescale = 2,
 	.divisor = 1,
+	.has_tint_cstat = true,
 };
 
 /*
diff --git a/arch/arm/mach-s5p64x0/include/mach/irqs.h b/arch/arm/mach-s5p64x0/include/mach/irqs.h
index 5b845e8..53982db 100644
--- a/arch/arm/mach-s5p64x0/include/mach/irqs.h
+++ b/arch/arm/mach-s5p64x0/include/mach/irqs.h
@@ -141,8 +141,6 @@
 
 #define IRQ_EINT_GROUP(grp, x)	(IRQ_EINT_GROUP##grp##_BASE + (x))
 
-#define IRQ_TIMER_BASE		(11)
-
 /* Set the default NR_IRQS */
 
 #define NR_IRQS			(IRQ_EINT_GROUP8_BASE + IRQ_EINT_GROUP8_NR + 1)
diff --git a/arch/arm/mach-s5pc100/common.c b/arch/arm/mach-s5pc100/common.c
index 079c257..fdfad42 100644
--- a/arch/arm/mach-s5pc100/common.c
+++ b/arch/arm/mach-s5pc100/common.c
@@ -135,12 +135,13 @@ static struct map_desc s5pc100_iodesc[] __initdata = {
 static const struct samsung_timer_variant s5pc100_timer_variant = {
 	.reg_base = S5P_PA_TIMER,
 	.irqs = {
-		IRQ_TIMER0, IRQ_TIMER1, IRQ_TIMER2,
-		IRQ_TIMER3, IRQ_TIMER4
+		IRQ_TIMER0_VIC, IRQ_TIMER1_VIC, IRQ_TIMER2_VIC,
+		IRQ_TIMER3_VIC, IRQ_TIMER4_VIC
 	},
 	.bits = 32,
 	.prescale = 2,
 	.divisor = 1,
+	.has_tint_cstat = true,
 };
 
 /*
diff --git a/arch/arm/mach-s5pc100/include/mach/irqs.h b/arch/arm/mach-s5pc100/include/mach/irqs.h
index 2870f12..d2eb475 100644
--- a/arch/arm/mach-s5pc100/include/mach/irqs.h
+++ b/arch/arm/mach-s5pc100/include/mach/irqs.h
@@ -97,8 +97,6 @@
 #define IRQ_SDMFIQ		S5P_IRQ_VIC2(31)
 #define IRQ_VIC_END		S5P_IRQ_VIC2(31)
 
-#define IRQ_TIMER_BASE		(11)
-
 #define S5P_EINT_BASE1		(S5P_IRQ_VIC0(0))
 #define S5P_EINT_BASE2		(IRQ_VIC_END + 1)
 
diff --git a/arch/arm/mach-s5pv210/common.c b/arch/arm/mach-s5pv210/common.c
index 9549bb5..1e390d7 100644
--- a/arch/arm/mach-s5pv210/common.c
+++ b/arch/arm/mach-s5pv210/common.c
@@ -152,12 +152,13 @@ void s5pv210_restart(char mode, const char *cmd)
 static const struct samsung_timer_variant s5pv210_timer_variant = {
 	.reg_base = S5P_PA_TIMER,
 	.irqs = {
-		IRQ_TIMER0, IRQ_TIMER1, IRQ_TIMER2,
-		IRQ_TIMER3, IRQ_TIMER4
+		IRQ_TIMER0_VIC, IRQ_TIMER1_VIC, IRQ_TIMER2_VIC,
+		IRQ_TIMER3_VIC, IRQ_TIMER4_VIC
 	},
 	.bits = 32,
 	.prescale = 2,
 	.divisor = 1,
+	.has_tint_cstat = true,
 };
 
 /*
diff --git a/arch/arm/mach-s5pv210/include/mach/irqs.h b/arch/arm/mach-s5pv210/include/mach/irqs.h
index e777e01..5e0de3a 100644
--- a/arch/arm/mach-s5pv210/include/mach/irqs.h
+++ b/arch/arm/mach-s5pv210/include/mach/irqs.h
@@ -118,8 +118,6 @@
 #define IRQ_MDNIE3		S5P_IRQ_VIC3(8)
 #define IRQ_VIC_END		S5P_IRQ_VIC3(31)
 
-#define IRQ_TIMER_BASE		(11)
-
 #define S5P_EINT_BASE1		(S5P_IRQ_VIC0(0))
 #define S5P_EINT_BASE2		(IRQ_VIC_END + 1)
 
diff --git a/arch/arm/plat-samsung/include/plat/irqs.h b/arch/arm/plat-samsung/include/plat/irqs.h
index df46b77..039001c 100644
--- a/arch/arm/plat-samsung/include/plat/irqs.h
+++ b/arch/arm/plat-samsung/include/plat/irqs.h
@@ -44,15 +44,6 @@
 #define S5P_IRQ_VIC2(x)		(S5P_VIC2_BASE + (x))
 #define S5P_IRQ_VIC3(x)		(S5P_VIC3_BASE + (x))
 
-#define S5P_TIMER_IRQ(x)	(IRQ_TIMER_BASE + (x))
-
-#define IRQ_TIMER0		S5P_TIMER_IRQ(0)
-#define IRQ_TIMER1		S5P_TIMER_IRQ(1)
-#define IRQ_TIMER2		S5P_TIMER_IRQ(2)
-#define IRQ_TIMER3		S5P_TIMER_IRQ(3)
-#define IRQ_TIMER4		S5P_TIMER_IRQ(4)
-#define IRQ_TIMER_COUNT		(5)
-
 #define IRQ_EINT(x)		((x) < 16 ? ((x) + S5P_EINT_BASE1) \
 					: ((x) - 16 + S5P_EINT_BASE2))
 
diff --git a/arch/arm/plat-samsung/s5p-irq.c b/arch/arm/plat-samsung/s5p-irq.c
index 103e371..ce8564d 100644
--- a/arch/arm/plat-samsung/s5p-irq.c
+++ b/arch/arm/plat-samsung/s5p-irq.c
@@ -29,6 +29,4 @@ void __init s5p_init_irq(u32 *vic, u32 num_vic)
 	for (irq = 0; irq < num_vic; irq++)
 		vic_init(VA_VIC(irq), VIC_BASE(irq), vic[irq], 0);
 #endif
-
-	s3c_init_vic_timer_irq(5, IRQ_TIMER0);
 }
diff --git a/drivers/clocksource/samsung-time.c b/drivers/clocksource/samsung-time.c
index 336b3aa5..5c6cfca 100644
--- a/drivers/clocksource/samsung-time.c
+++ b/drivers/clocksource/samsung-time.c
@@ -286,6 +286,11 @@ static irqreturn_t samsung_clock_event_isr(int irq, void *dev_id)
 {
 	struct clock_event_device *evt = dev_id;
 
+	if (timer_variant.has_tint_cstat) {
+		u32 mask = (1 << timer_source.event_id);
+		writel(mask | (mask << 5), S3C64XX_TINT_CSTAT);
+	}
+
 	evt->event_handler(evt);
 
 	return IRQ_HANDLED;
@@ -322,6 +327,11 @@ static void __init samsung_clockevent_init(void)
 
 	irq_number = timer_variant.irqs[timer_source.event_id];
 	setup_irq(irq_number, &samsung_clock_event_irq);
+
+	if (timer_variant.has_tint_cstat) {
+		u32 mask = (1 << timer_source.event_id);
+		writel(mask | (mask << 5), S3C64XX_TINT_CSTAT);
+	}
 }
 
 static void __iomem *samsung_timer_reg(void)
diff --git a/include/clocksource/samsung-time.h b/include/clocksource/samsung-time.h
index 66de2b5..af33bf9 100644
--- a/include/clocksource/samsung-time.h
+++ b/include/clocksource/samsung-time.h
@@ -36,6 +36,7 @@ struct samsung_timer_source {
  * @bits:	bit width of time counters
  * @prescale:	prescaler divisor
  * @divisor:	main divisor
+ * @has_tint_cstat: true if variant has TINT_CSTAT register
  */
 struct samsung_timer_variant {
 	unsigned long reg_base;
@@ -43,6 +44,7 @@ struct samsung_timer_variant {
 	int bits;
 	u16 prescale;
 	u16 divisor;
+	bool has_tint_cstat;
 };
 
 extern void samsung_set_timer_source(enum samsung_timer_mode event,
-- 
1.8.1.5

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

* [PATCH v3 11/12] ARM: SAMSUNG: Remove unused PWM timer IRQ chip code
  2013-03-09 20:23 ` Tomasz Figa
@ 2013-03-09 20:23   ` Tomasz Figa
  -1 siblings, 0 replies; 34+ messages in thread
From: Tomasz Figa @ 2013-03-09 20:23 UTC (permalink / raw)
  To: linux-arm-kernel
  Cc: linux-samsung-soc, Kukjin Kim, kyungmin.park, linux, broonie,
	kwangwoo.lee, jacmet, augulis.darius, mcuelenaere, linux,
	Sylwester Nawrocki, buserror, christer, jekhor, ghcstop,
	Mark Rutland, Tomasz Figa, Heiko Stübner, Rob Herring

As the need for an IRQ chip handling PWM timer interrupt chaining is
gone now, this patch removes all the code made unnecessary.

Signed-off-by: Tomasz Figa <tomasz.figa@gmail.com>
---
 arch/arm/Kconfig                                   |  1 -
 arch/arm/mach-s3c64xx/common.c                     |  1 -
 arch/arm/plat-samsung/Kconfig                      |  6 --
 arch/arm/plat-samsung/Makefile                     |  1 -
 arch/arm/plat-samsung/include/plat/irq-vic-timer.h | 13 ---
 arch/arm/plat-samsung/irq-vic-timer.c              | 98 ----------------------
 arch/arm/plat-samsung/s5p-irq.c                    |  1 -
 7 files changed, 121 deletions(-)
 delete mode 100644 arch/arm/plat-samsung/include/plat/irq-vic-timer.h
 delete mode 100644 arch/arm/plat-samsung/irq-vic-timer.c

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 814fa8b..249faa9 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -807,7 +807,6 @@ config ARCH_S3C64XX
 	select S3C_GPIO_TRACK
 	select SAMSUNG_CLKSRC
 	select SAMSUNG_GPIOLIB_4BIT
-	select SAMSUNG_IRQ_VIC_TIMER
 	select USB_ARCH_HAS_OHCI
 	help
 	  Samsung S3C64XX series based systems
diff --git a/arch/arm/mach-s3c64xx/common.c b/arch/arm/mach-s3c64xx/common.c
index 31333fa..eba530b 100644
--- a/arch/arm/mach-s3c64xx/common.c
+++ b/arch/arm/mach-s3c64xx/common.c
@@ -41,7 +41,6 @@
 #include <plat/pm.h>
 #include <plat/gpio-cfg.h>
 #include <plat/irq-uart.h>
-#include <plat/irq-vic-timer.h>
 #include <plat/regs-irqtype.h>
 #include <plat/regs-serial.h>
 #include <clocksource/samsung-time.h>
diff --git a/arch/arm/plat-samsung/Kconfig b/arch/arm/plat-samsung/Kconfig
index ebfbf1d..b6535c7 100644
--- a/arch/arm/plat-samsung/Kconfig
+++ b/arch/arm/plat-samsung/Kconfig
@@ -27,7 +27,6 @@ config PLAT_S5P
 	select S5P_GPIO_DRVSTR
 	select SAMSUNG_CLKSRC if !COMMON_CLK
 	select SAMSUNG_GPIOLIB_4BIT
-	select SAMSUNG_IRQ_VIC_TIMER
 	help
 	  Base platform code for Samsung's S5P series SoC.
 
@@ -87,11 +86,6 @@ config S5P_CLOCK
 
 # options for IRQ support
 
-config SAMSUNG_IRQ_VIC_TIMER
-       bool
-       help
-         Internal configuration to build the VIC timer interrupt code.
-
 config S5P_IRQ
 	def_bool (ARCH_S5P64X0 || ARCH_S5PC100 || ARCH_S5PV210 || ARCH_EXYNOS)
 	help
diff --git a/arch/arm/plat-samsung/Makefile b/arch/arm/plat-samsung/Makefile
index 87494e1..ae2a0fd 100644
--- a/arch/arm/plat-samsung/Makefile
+++ b/arch/arm/plat-samsung/Makefile
@@ -19,7 +19,6 @@ obj-$(CONFIG_SAMSUNG_CLOCK)	+= pwm-clock.o
 obj-$(CONFIG_SAMSUNG_CLKSRC)	+= clock-clksrc.o
 obj-$(CONFIG_S5P_CLOCK)		+= s5p-clock.o
 
-obj-$(CONFIG_SAMSUNG_IRQ_VIC_TIMER) += irq-vic-timer.o
 obj-$(CONFIG_S5P_IRQ)		+= s5p-irq.o
 obj-$(CONFIG_S5P_EXT_INT)	+= s5p-irq-eint.o
 obj-$(CONFIG_S5P_GPIO_INT)	+= s5p-irq-gpioint.o
diff --git a/arch/arm/plat-samsung/include/plat/irq-vic-timer.h b/arch/arm/plat-samsung/include/plat/irq-vic-timer.h
deleted file mode 100644
index 5b9c42f..0000000
--- a/arch/arm/plat-samsung/include/plat/irq-vic-timer.h
+++ /dev/null
@@ -1,13 +0,0 @@
-/* arch/arm/plat-samsung/include/plat/irq-vic-timer.h
- *
- * Copyright (c) 2010 Simtec Electronics
- *	Ben Dooks <ben@simtec.co.uk>
- *
- * Header file for Samsung SoC IRQ VIC timer
- *
- * 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.
-*/
-
-extern void s3c_init_vic_timer_irq(unsigned int num, unsigned int timer_irq);
diff --git a/arch/arm/plat-samsung/irq-vic-timer.c b/arch/arm/plat-samsung/irq-vic-timer.c
deleted file mode 100644
index f980cf3..0000000
--- a/arch/arm/plat-samsung/irq-vic-timer.c
+++ /dev/null
@@ -1,98 +0,0 @@
-/* arch/arm/plat-samsung/irq-vic-timer.c
- *	originally part of arch/arm/plat-s3c64xx/irq.c
- *
- * Copyright 2008 Openmoko, Inc.
- * Copyright 2008 Simtec Electronics
- *      Ben Dooks <ben@simtec.co.uk>
- *      http://armlinux.simtec.co.uk/
- *
- * S3C64XX - Interrupt handling
- *
- * 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/kernel.h>
-#include <linux/interrupt.h>
-#include <linux/irq.h>
-#include <linux/io.h>
-
-#include <mach/map.h>
-#include <plat/cpu.h>
-#include <plat/irq-vic-timer.h>
-#include <plat/regs-timer.h>
-
-#include <asm/mach/irq.h>
-
-static void s3c_irq_demux_vic_timer(unsigned int irq, struct irq_desc *desc)
-{
-	struct irq_chip *chip = irq_get_chip(irq);
-	chained_irq_enter(chip, desc);
-	generic_handle_irq((int)desc->irq_data.handler_data);
-	chained_irq_exit(chip, desc);
-}
-
-/* We assume the IRQ_TIMER0..IRQ_TIMER4 range is continuous. */
-static void s3c_irq_timer_ack(struct irq_data *d)
-{
-	struct irq_chip_generic *gc = irq_data_get_irq_chip_data(d);
-	u32 mask = (1 << 5) << (d->irq - gc->irq_base);
-
-	irq_reg_writel(mask | gc->mask_cache, gc->reg_base);
-}
-
-/**
- * s3c_init_vic_timer_irq() - initialise timer irq chanined off VIC.\
- * @num: Number of timers to initialize
- * @timer_irq: Base IRQ number to be used for the timers.
- *
- * Register the necessary IRQ chaining and support for the timer IRQs
- * chained of the VIC.
- */
-void __init s3c_init_vic_timer_irq(unsigned int num, unsigned int timer_irq)
-{
-	unsigned int pirq[5] = { IRQ_TIMER0_VIC, IRQ_TIMER1_VIC, IRQ_TIMER2_VIC,
-				 IRQ_TIMER3_VIC, IRQ_TIMER4_VIC };
-	struct irq_chip_generic *s3c_tgc;
-	struct irq_chip_type *ct;
-	unsigned int i;
-
-#ifdef CONFIG_ARCH_EXYNOS
-	if (soc_is_exynos5250()) {
-		pirq[0] = EXYNOS5_IRQ_TIMER0_VIC;
-		pirq[1] = EXYNOS5_IRQ_TIMER1_VIC;
-		pirq[2] = EXYNOS5_IRQ_TIMER2_VIC;
-		pirq[3] = EXYNOS5_IRQ_TIMER3_VIC;
-		pirq[4] = EXYNOS5_IRQ_TIMER4_VIC;
-	} else {
-		pirq[0] = EXYNOS4_IRQ_TIMER0_VIC;
-		pirq[1] = EXYNOS4_IRQ_TIMER1_VIC;
-		pirq[2] = EXYNOS4_IRQ_TIMER2_VIC;
-		pirq[3] = EXYNOS4_IRQ_TIMER3_VIC;
-		pirq[4] = EXYNOS4_IRQ_TIMER4_VIC;
-	}
-#endif
-	s3c_tgc = irq_alloc_generic_chip("s3c-timer", 1, timer_irq,
-					 S3C64XX_TINT_CSTAT, handle_level_irq);
-
-	if (!s3c_tgc) {
-		pr_err("%s: irq_alloc_generic_chip for IRQ %d failed\n",
-		       __func__, timer_irq);
-		return;
-	}
-
-	ct = s3c_tgc->chip_types;
-	ct->chip.irq_mask = irq_gc_mask_clr_bit;
-	ct->chip.irq_unmask = irq_gc_mask_set_bit;
-	ct->chip.irq_ack = s3c_irq_timer_ack;
-	irq_setup_generic_chip(s3c_tgc, IRQ_MSK(num), IRQ_GC_INIT_MASK_CACHE,
-			       IRQ_NOREQUEST | IRQ_NOPROBE, 0);
-	/* Clear the upper bits of the mask_cache*/
-	s3c_tgc->mask_cache &= 0x1f;
-
-	for (i = 0; i < num; i++, timer_irq++) {
-		irq_set_chained_handler(pirq[i], s3c_irq_demux_vic_timer);
-		irq_set_handler_data(pirq[i], (void *)timer_irq);
-	}
-}
diff --git a/arch/arm/plat-samsung/s5p-irq.c b/arch/arm/plat-samsung/s5p-irq.c
index ce8564d..b1e2a82 100644
--- a/arch/arm/plat-samsung/s5p-irq.c
+++ b/arch/arm/plat-samsung/s5p-irq.c
@@ -18,7 +18,6 @@
 #include <mach/map.h>
 #include <plat/regs-timer.h>
 #include <plat/cpu.h>
-#include <plat/irq-vic-timer.h>
 
 void __init s5p_init_irq(u32 *vic, u32 num_vic)
 {
-- 
1.8.1.5

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

* [PATCH v3 11/12] ARM: SAMSUNG: Remove unused PWM timer IRQ chip code
@ 2013-03-09 20:23   ` Tomasz Figa
  0 siblings, 0 replies; 34+ messages in thread
From: Tomasz Figa @ 2013-03-09 20:23 UTC (permalink / raw)
  To: linux-arm-kernel

As the need for an IRQ chip handling PWM timer interrupt chaining is
gone now, this patch removes all the code made unnecessary.

Signed-off-by: Tomasz Figa <tomasz.figa@gmail.com>
---
 arch/arm/Kconfig                                   |  1 -
 arch/arm/mach-s3c64xx/common.c                     |  1 -
 arch/arm/plat-samsung/Kconfig                      |  6 --
 arch/arm/plat-samsung/Makefile                     |  1 -
 arch/arm/plat-samsung/include/plat/irq-vic-timer.h | 13 ---
 arch/arm/plat-samsung/irq-vic-timer.c              | 98 ----------------------
 arch/arm/plat-samsung/s5p-irq.c                    |  1 -
 7 files changed, 121 deletions(-)
 delete mode 100644 arch/arm/plat-samsung/include/plat/irq-vic-timer.h
 delete mode 100644 arch/arm/plat-samsung/irq-vic-timer.c

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 814fa8b..249faa9 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -807,7 +807,6 @@ config ARCH_S3C64XX
 	select S3C_GPIO_TRACK
 	select SAMSUNG_CLKSRC
 	select SAMSUNG_GPIOLIB_4BIT
-	select SAMSUNG_IRQ_VIC_TIMER
 	select USB_ARCH_HAS_OHCI
 	help
 	  Samsung S3C64XX series based systems
diff --git a/arch/arm/mach-s3c64xx/common.c b/arch/arm/mach-s3c64xx/common.c
index 31333fa..eba530b 100644
--- a/arch/arm/mach-s3c64xx/common.c
+++ b/arch/arm/mach-s3c64xx/common.c
@@ -41,7 +41,6 @@
 #include <plat/pm.h>
 #include <plat/gpio-cfg.h>
 #include <plat/irq-uart.h>
-#include <plat/irq-vic-timer.h>
 #include <plat/regs-irqtype.h>
 #include <plat/regs-serial.h>
 #include <clocksource/samsung-time.h>
diff --git a/arch/arm/plat-samsung/Kconfig b/arch/arm/plat-samsung/Kconfig
index ebfbf1d..b6535c7 100644
--- a/arch/arm/plat-samsung/Kconfig
+++ b/arch/arm/plat-samsung/Kconfig
@@ -27,7 +27,6 @@ config PLAT_S5P
 	select S5P_GPIO_DRVSTR
 	select SAMSUNG_CLKSRC if !COMMON_CLK
 	select SAMSUNG_GPIOLIB_4BIT
-	select SAMSUNG_IRQ_VIC_TIMER
 	help
 	  Base platform code for Samsung's S5P series SoC.
 
@@ -87,11 +86,6 @@ config S5P_CLOCK
 
 # options for IRQ support
 
-config SAMSUNG_IRQ_VIC_TIMER
-       bool
-       help
-         Internal configuration to build the VIC timer interrupt code.
-
 config S5P_IRQ
 	def_bool (ARCH_S5P64X0 || ARCH_S5PC100 || ARCH_S5PV210 || ARCH_EXYNOS)
 	help
diff --git a/arch/arm/plat-samsung/Makefile b/arch/arm/plat-samsung/Makefile
index 87494e1..ae2a0fd 100644
--- a/arch/arm/plat-samsung/Makefile
+++ b/arch/arm/plat-samsung/Makefile
@@ -19,7 +19,6 @@ obj-$(CONFIG_SAMSUNG_CLOCK)	+= pwm-clock.o
 obj-$(CONFIG_SAMSUNG_CLKSRC)	+= clock-clksrc.o
 obj-$(CONFIG_S5P_CLOCK)		+= s5p-clock.o
 
-obj-$(CONFIG_SAMSUNG_IRQ_VIC_TIMER) += irq-vic-timer.o
 obj-$(CONFIG_S5P_IRQ)		+= s5p-irq.o
 obj-$(CONFIG_S5P_EXT_INT)	+= s5p-irq-eint.o
 obj-$(CONFIG_S5P_GPIO_INT)	+= s5p-irq-gpioint.o
diff --git a/arch/arm/plat-samsung/include/plat/irq-vic-timer.h b/arch/arm/plat-samsung/include/plat/irq-vic-timer.h
deleted file mode 100644
index 5b9c42f..0000000
--- a/arch/arm/plat-samsung/include/plat/irq-vic-timer.h
+++ /dev/null
@@ -1,13 +0,0 @@
-/* arch/arm/plat-samsung/include/plat/irq-vic-timer.h
- *
- * Copyright (c) 2010 Simtec Electronics
- *	Ben Dooks <ben@simtec.co.uk>
- *
- * Header file for Samsung SoC IRQ VIC timer
- *
- * 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.
-*/
-
-extern void s3c_init_vic_timer_irq(unsigned int num, unsigned int timer_irq);
diff --git a/arch/arm/plat-samsung/irq-vic-timer.c b/arch/arm/plat-samsung/irq-vic-timer.c
deleted file mode 100644
index f980cf3..0000000
--- a/arch/arm/plat-samsung/irq-vic-timer.c
+++ /dev/null
@@ -1,98 +0,0 @@
-/* arch/arm/plat-samsung/irq-vic-timer.c
- *	originally part of arch/arm/plat-s3c64xx/irq.c
- *
- * Copyright 2008 Openmoko, Inc.
- * Copyright 2008 Simtec Electronics
- *      Ben Dooks <ben@simtec.co.uk>
- *      http://armlinux.simtec.co.uk/
- *
- * S3C64XX - Interrupt handling
- *
- * 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/kernel.h>
-#include <linux/interrupt.h>
-#include <linux/irq.h>
-#include <linux/io.h>
-
-#include <mach/map.h>
-#include <plat/cpu.h>
-#include <plat/irq-vic-timer.h>
-#include <plat/regs-timer.h>
-
-#include <asm/mach/irq.h>
-
-static void s3c_irq_demux_vic_timer(unsigned int irq, struct irq_desc *desc)
-{
-	struct irq_chip *chip = irq_get_chip(irq);
-	chained_irq_enter(chip, desc);
-	generic_handle_irq((int)desc->irq_data.handler_data);
-	chained_irq_exit(chip, desc);
-}
-
-/* We assume the IRQ_TIMER0..IRQ_TIMER4 range is continuous. */
-static void s3c_irq_timer_ack(struct irq_data *d)
-{
-	struct irq_chip_generic *gc = irq_data_get_irq_chip_data(d);
-	u32 mask = (1 << 5) << (d->irq - gc->irq_base);
-
-	irq_reg_writel(mask | gc->mask_cache, gc->reg_base);
-}
-
-/**
- * s3c_init_vic_timer_irq() - initialise timer irq chanined off VIC.\
- * @num: Number of timers to initialize
- * @timer_irq: Base IRQ number to be used for the timers.
- *
- * Register the necessary IRQ chaining and support for the timer IRQs
- * chained of the VIC.
- */
-void __init s3c_init_vic_timer_irq(unsigned int num, unsigned int timer_irq)
-{
-	unsigned int pirq[5] = { IRQ_TIMER0_VIC, IRQ_TIMER1_VIC, IRQ_TIMER2_VIC,
-				 IRQ_TIMER3_VIC, IRQ_TIMER4_VIC };
-	struct irq_chip_generic *s3c_tgc;
-	struct irq_chip_type *ct;
-	unsigned int i;
-
-#ifdef CONFIG_ARCH_EXYNOS
-	if (soc_is_exynos5250()) {
-		pirq[0] = EXYNOS5_IRQ_TIMER0_VIC;
-		pirq[1] = EXYNOS5_IRQ_TIMER1_VIC;
-		pirq[2] = EXYNOS5_IRQ_TIMER2_VIC;
-		pirq[3] = EXYNOS5_IRQ_TIMER3_VIC;
-		pirq[4] = EXYNOS5_IRQ_TIMER4_VIC;
-	} else {
-		pirq[0] = EXYNOS4_IRQ_TIMER0_VIC;
-		pirq[1] = EXYNOS4_IRQ_TIMER1_VIC;
-		pirq[2] = EXYNOS4_IRQ_TIMER2_VIC;
-		pirq[3] = EXYNOS4_IRQ_TIMER3_VIC;
-		pirq[4] = EXYNOS4_IRQ_TIMER4_VIC;
-	}
-#endif
-	s3c_tgc = irq_alloc_generic_chip("s3c-timer", 1, timer_irq,
-					 S3C64XX_TINT_CSTAT, handle_level_irq);
-
-	if (!s3c_tgc) {
-		pr_err("%s: irq_alloc_generic_chip for IRQ %d failed\n",
-		       __func__, timer_irq);
-		return;
-	}
-
-	ct = s3c_tgc->chip_types;
-	ct->chip.irq_mask = irq_gc_mask_clr_bit;
-	ct->chip.irq_unmask = irq_gc_mask_set_bit;
-	ct->chip.irq_ack = s3c_irq_timer_ack;
-	irq_setup_generic_chip(s3c_tgc, IRQ_MSK(num), IRQ_GC_INIT_MASK_CACHE,
-			       IRQ_NOREQUEST | IRQ_NOPROBE, 0);
-	/* Clear the upper bits of the mask_cache*/
-	s3c_tgc->mask_cache &= 0x1f;
-
-	for (i = 0; i < num; i++, timer_irq++) {
-		irq_set_chained_handler(pirq[i], s3c_irq_demux_vic_timer);
-		irq_set_handler_data(pirq[i], (void *)timer_irq);
-	}
-}
diff --git a/arch/arm/plat-samsung/s5p-irq.c b/arch/arm/plat-samsung/s5p-irq.c
index ce8564d..b1e2a82 100644
--- a/arch/arm/plat-samsung/s5p-irq.c
+++ b/arch/arm/plat-samsung/s5p-irq.c
@@ -18,7 +18,6 @@
 #include <mach/map.h>
 #include <plat/regs-timer.h>
 #include <plat/cpu.h>
-#include <plat/irq-vic-timer.h>
 
 void __init s5p_init_irq(u32 *vic, u32 num_vic)
 {
-- 
1.8.1.5

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

* [PATCH v3 12/12] clocksource: samsung-time: Add Device Tree support
  2013-03-09 20:23 ` Tomasz Figa
@ 2013-03-09 20:23   ` Tomasz Figa
  -1 siblings, 0 replies; 34+ messages in thread
From: Tomasz Figa @ 2013-03-09 20:23 UTC (permalink / raw)
  To: linux-arm-kernel
  Cc: linux-samsung-soc, Kukjin Kim, kyungmin.park, linux, broonie,
	kwangwoo.lee, jacmet, augulis.darius, mcuelenaere, linux,
	Sylwester Nawrocki, buserror, christer, jekhor, ghcstop,
	Mark Rutland, Tomasz Figa, Heiko Stübner, Rob Herring,
	devicetree-discuss

This patch adds support for parsing all platform-specific data from
Device Tree and instantiation using clocksource_of_init to samsung-time
clocksource driver.

Cc: devicetree-discuss@lists.ozlabs.org
Signed-off-by: Tomasz Figa <tomasz.figa@gmail.com>
---
 .../devicetree/bindings/timer/samsung-pwm.txt      |  33 ++++++
 drivers/clocksource/samsung-time.c                 | 116 ++++++++++++++++++++-
 2 files changed, 146 insertions(+), 3 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/timer/samsung-pwm.txt

diff --git a/Documentation/devicetree/bindings/timer/samsung-pwm.txt b/Documentation/devicetree/bindings/timer/samsung-pwm.txt
new file mode 100644
index 0000000..3aabe81
--- /dev/null
+++ b/Documentation/devicetree/bindings/timer/samsung-pwm.txt
@@ -0,0 +1,33 @@
+* Samsung PWM timers
+
+Samsung SoCs contain PWM timer blocks which can be used for system clock source
+and clock event timers.
+
+Be aware that this configuration is supported only on uniprocessor platforms.
+For SMP SoCs, SMP-aware timers should be used, like MCT.
+
+Required properties:
+- compatible : should be one of following:
+    samsung,s3c24xx-pwm - for 16-bit timers present on S3C24xx
+    samsung,s3c64xx-pwm - for 32-bit timers present on S3C64xx and newer
+- reg: base address and size of register area
+- interrupts: list of timer interrupts (one interrupt per timer, starting at
+  timer 0)
+
+Optional properties:
+- samsung,prescale-divisor: PWM prescaler divisor (from 1 to 256)
+- samsung,divisor: PWM main divider divisor (1, 2, 4, 8 or 16)
+- samsung,pwm-outputs: list of PWM channels reserved for use as PWM outputs
+    - an array of up to 5 elements being indices of PWM channels (from 0 to 4),
+    the order does not matter.
+
+Example:
+	timer@7f006000 {
+		compatible = "samsung,s3c64xx-pwm";
+		reg = <0x7f006000 0x1000>;
+		interrupt-parent = <&vic0>;
+		interrupts = <23>, <24>, <25>, <27>, <28>;
+		samsung,prescale-divisor = <2>;
+		samsung,divisor = <1>;
+		samsung,pwm-outputs = <0>, <1>;
+	};
diff --git a/drivers/clocksource/samsung-time.c b/drivers/clocksource/samsung-time.c
index 5c6cfca..dbfc5f2 100644
--- a/drivers/clocksource/samsung-time.c
+++ b/drivers/clocksource/samsung-time.c
@@ -14,6 +14,9 @@
 #include <linux/err.h>
 #include <linux/clk.h>
 #include <linux/clockchips.h>
+#include <linux/of.h>
+#include <linux/of_address.h>
+#include <linux/of_irq.h>
 #include <linux/platform_device.h>
 
 #include <clocksource/samsung-time.h>
@@ -412,9 +415,12 @@ static void __init samsung_timer_resources(void)
 	unsigned long source_id = timer_source.source_id;
 	char devname[15];
 
-	timer_base = ioremap_nocache(timer_variant.reg_base, SZ_4K);
-	if (!timer_base)
-		panic("failed to map timer registers");
+	if (!timer_base) {
+		/* Compatibility fallback for non-DT platforms */
+		timer_base = ioremap_nocache(timer_variant.reg_base, SZ_4K);
+		if (!timer_base)
+			panic("failed to map timer registers");
+	}
 
 	timerclk = clk_get(NULL, "timers");
 	if (IS_ERR(timerclk))
@@ -447,6 +453,11 @@ static void __init samsung_timer_resources(void)
 	clk_enable(tin_source);
 }
 
+enum {
+	TYPE_S3C24XX,
+	TYPE_S3C64XX,
+};
+
 void __init samsung_timer_init(void)
 {
 	if (!timer_source.source_id && !timer_source.event_id)
@@ -459,3 +470,102 @@ void __init samsung_timer_init(void)
 	samsung_clockevent_init();
 	samsung_clocksource_init();
 }
+
+#ifdef CONFIG_OF
+static const struct of_device_id samsung_timer_ids[] = {
+	{ .compatible = "samsung,s3c24xx-pwm", .data = (void *)TYPE_S3C24XX, },
+	{ .compatible = "samsung,s3c64xx-pwm", .data = (void *)TYPE_S3C64XX, },
+	{},
+};
+
+static void __init samsung_of_timer_init(void)
+{
+	const struct of_device_id *match;
+	u8 channel_mask = (1 << 5) - 1;
+	struct device_node *np;
+	struct property *prop;
+	const __be32 *cur;
+	u32 val;
+	int i;
+
+	np = of_find_matching_node_and_match(NULL,
+					samsung_timer_ids, &match);
+	if (!np)
+		panic("timer node not found");
+
+	timer_base = of_iomap(np, 0);
+	if (!timer_base)
+		panic("failed to map timer registers");
+
+	for (i = 0; i < SAMSUNG_PWM_NUM; ++i)
+		timer_variant.irqs[i] = irq_of_parse_and_map(np, i);
+
+	if (!timer_variant.irqs[timer_source.event_id])
+		panic("no clock event irq provided");
+
+	switch ((unsigned int)match->data) {
+	case TYPE_S3C24XX:
+		timer_variant.bits = 16;
+		timer_variant.prescale = 25;
+		timer_variant.divisor = 2;
+		timer_variant.has_tint_cstat = false;
+		break;
+	case TYPE_S3C64XX:
+		timer_variant.bits = 32;
+		timer_variant.prescale = 2;
+		timer_variant.divisor = 1;
+		timer_variant.has_tint_cstat = true;
+		break;
+	}
+
+	of_property_for_each_u32(np, "samsung,pwm-outputs", prop, cur, val) {
+		if (val >= SAMSUNG_PWM_NUM) {
+			pr_warning("%s: invalid channel index in samsung,pwm-outputs property\n",
+								__func__);
+			continue;
+		}
+		channel_mask &= ~(1 << val);
+	}
+
+	val = fls(channel_mask);
+	if (!val)
+		panic("failed to find PWM channel for clock source");
+	timer_source.source_id = val - 1;
+	channel_mask &= ~(1 << timer_source.source_id);
+
+	val = fls(channel_mask);
+	if (!val)
+		panic("failed to find PWM channel for clock events");
+	timer_source.event_id = val - 1;
+
+	if (!of_property_read_u32(np, "samsung,prescale-divisor", &val)) {
+		if (val < 1 || val > 256)
+			panic("samsung,prescale-divisor property out of range");
+		timer_variant.prescale = val;
+	}
+
+	if (!of_property_read_u32(np, "samsung,divisor", &val)) {
+		switch (val) {
+		case 1:
+		case 2:
+		case 4:
+		case 8:
+		case 16:
+			timer_variant.divisor = val;
+			break;
+		default:
+			panic("invalid value of samsung,divisor property");
+		}
+	}
+
+	pr_info("samsung-time: using PWM channels %d (source) and %d (event)\n",
+				timer_source.source_id, timer_source.event_id);
+
+	samsung_timer_init();
+}
+#endif /* CONFIG_OF */
+
+CLOCKSOURCE_OF_DECLARE(s3c24xx_timer,
+				"samsung,s3c24xx-pwm", samsung_of_timer_init)
+CLOCKSOURCE_OF_DECLARE(s3c64xx_timer,
+				"samsung,s3c64xx-pwm", samsung_of_timer_init)
-- 
1.8.1.5

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

* [PATCH v3 12/12] clocksource: samsung-time: Add Device Tree support
@ 2013-03-09 20:23   ` Tomasz Figa
  0 siblings, 0 replies; 34+ messages in thread
From: Tomasz Figa @ 2013-03-09 20:23 UTC (permalink / raw)
  To: linux-arm-kernel

This patch adds support for parsing all platform-specific data from
Device Tree and instantiation using clocksource_of_init to samsung-time
clocksource driver.

Cc: devicetree-discuss at lists.ozlabs.org
Signed-off-by: Tomasz Figa <tomasz.figa@gmail.com>
---
 .../devicetree/bindings/timer/samsung-pwm.txt      |  33 ++++++
 drivers/clocksource/samsung-time.c                 | 116 ++++++++++++++++++++-
 2 files changed, 146 insertions(+), 3 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/timer/samsung-pwm.txt

diff --git a/Documentation/devicetree/bindings/timer/samsung-pwm.txt b/Documentation/devicetree/bindings/timer/samsung-pwm.txt
new file mode 100644
index 0000000..3aabe81
--- /dev/null
+++ b/Documentation/devicetree/bindings/timer/samsung-pwm.txt
@@ -0,0 +1,33 @@
+* Samsung PWM timers
+
+Samsung SoCs contain PWM timer blocks which can be used for system clock source
+and clock event timers.
+
+Be aware that this configuration is supported only on uniprocessor platforms.
+For SMP SoCs, SMP-aware timers should be used, like MCT.
+
+Required properties:
+- compatible : should be one of following:
+    samsung,s3c24xx-pwm - for 16-bit timers present on S3C24xx
+    samsung,s3c64xx-pwm - for 32-bit timers present on S3C64xx and newer
+- reg: base address and size of register area
+- interrupts: list of timer interrupts (one interrupt per timer, starting at
+  timer 0)
+
+Optional properties:
+- samsung,prescale-divisor: PWM prescaler divisor (from 1 to 256)
+- samsung,divisor: PWM main divider divisor (1, 2, 4, 8 or 16)
+- samsung,pwm-outputs: list of PWM channels reserved for use as PWM outputs
+    - an array of up to 5 elements being indices of PWM channels (from 0 to 4),
+    the order does not matter.
+
+Example:
+	timer at 7f006000 {
+		compatible = "samsung,s3c64xx-pwm";
+		reg = <0x7f006000 0x1000>;
+		interrupt-parent = <&vic0>;
+		interrupts = <23>, <24>, <25>, <27>, <28>;
+		samsung,prescale-divisor = <2>;
+		samsung,divisor = <1>;
+		samsung,pwm-outputs = <0>, <1>;
+	};
diff --git a/drivers/clocksource/samsung-time.c b/drivers/clocksource/samsung-time.c
index 5c6cfca..dbfc5f2 100644
--- a/drivers/clocksource/samsung-time.c
+++ b/drivers/clocksource/samsung-time.c
@@ -14,6 +14,9 @@
 #include <linux/err.h>
 #include <linux/clk.h>
 #include <linux/clockchips.h>
+#include <linux/of.h>
+#include <linux/of_address.h>
+#include <linux/of_irq.h>
 #include <linux/platform_device.h>
 
 #include <clocksource/samsung-time.h>
@@ -412,9 +415,12 @@ static void __init samsung_timer_resources(void)
 	unsigned long source_id = timer_source.source_id;
 	char devname[15];
 
-	timer_base = ioremap_nocache(timer_variant.reg_base, SZ_4K);
-	if (!timer_base)
-		panic("failed to map timer registers");
+	if (!timer_base) {
+		/* Compatibility fallback for non-DT platforms */
+		timer_base = ioremap_nocache(timer_variant.reg_base, SZ_4K);
+		if (!timer_base)
+			panic("failed to map timer registers");
+	}
 
 	timerclk = clk_get(NULL, "timers");
 	if (IS_ERR(timerclk))
@@ -447,6 +453,11 @@ static void __init samsung_timer_resources(void)
 	clk_enable(tin_source);
 }
 
+enum {
+	TYPE_S3C24XX,
+	TYPE_S3C64XX,
+};
+
 void __init samsung_timer_init(void)
 {
 	if (!timer_source.source_id && !timer_source.event_id)
@@ -459,3 +470,102 @@ void __init samsung_timer_init(void)
 	samsung_clockevent_init();
 	samsung_clocksource_init();
 }
+
+#ifdef CONFIG_OF
+static const struct of_device_id samsung_timer_ids[] = {
+	{ .compatible = "samsung,s3c24xx-pwm", .data = (void *)TYPE_S3C24XX, },
+	{ .compatible = "samsung,s3c64xx-pwm", .data = (void *)TYPE_S3C64XX, },
+	{},
+};
+
+static void __init samsung_of_timer_init(void)
+{
+	const struct of_device_id *match;
+	u8 channel_mask = (1 << 5) - 1;
+	struct device_node *np;
+	struct property *prop;
+	const __be32 *cur;
+	u32 val;
+	int i;
+
+	np = of_find_matching_node_and_match(NULL,
+					samsung_timer_ids, &match);
+	if (!np)
+		panic("timer node not found");
+
+	timer_base = of_iomap(np, 0);
+	if (!timer_base)
+		panic("failed to map timer registers");
+
+	for (i = 0; i < SAMSUNG_PWM_NUM; ++i)
+		timer_variant.irqs[i] = irq_of_parse_and_map(np, i);
+
+	if (!timer_variant.irqs[timer_source.event_id])
+		panic("no clock event irq provided");
+
+	switch ((unsigned int)match->data) {
+	case TYPE_S3C24XX:
+		timer_variant.bits = 16;
+		timer_variant.prescale = 25;
+		timer_variant.divisor = 2;
+		timer_variant.has_tint_cstat = false;
+		break;
+	case TYPE_S3C64XX:
+		timer_variant.bits = 32;
+		timer_variant.prescale = 2;
+		timer_variant.divisor = 1;
+		timer_variant.has_tint_cstat = true;
+		break;
+	}
+
+	of_property_for_each_u32(np, "samsung,pwm-outputs", prop, cur, val) {
+		if (val >= SAMSUNG_PWM_NUM) {
+			pr_warning("%s: invalid channel index in samsung,pwm-outputs property\n",
+								__func__);
+			continue;
+		}
+		channel_mask &= ~(1 << val);
+	}
+
+	val = fls(channel_mask);
+	if (!val)
+		panic("failed to find PWM channel for clock source");
+	timer_source.source_id = val - 1;
+	channel_mask &= ~(1 << timer_source.source_id);
+
+	val = fls(channel_mask);
+	if (!val)
+		panic("failed to find PWM channel for clock events");
+	timer_source.event_id = val - 1;
+
+	if (!of_property_read_u32(np, "samsung,prescale-divisor", &val)) {
+		if (val < 1 || val > 256)
+			panic("samsung,prescale-divisor property out of range");
+		timer_variant.prescale = val;
+	}
+
+	if (!of_property_read_u32(np, "samsung,divisor", &val)) {
+		switch (val) {
+		case 1:
+		case 2:
+		case 4:
+		case 8:
+		case 16:
+			timer_variant.divisor = val;
+			break;
+		default:
+			panic("invalid value of samsung,divisor property");
+		}
+	}
+
+	pr_info("samsung-time: using PWM channels %d (source) and %d (event)\n",
+				timer_source.source_id, timer_source.event_id);
+
+	samsung_timer_init();
+}
+#endif /* CONFIG_OF */
+
+CLOCKSOURCE_OF_DECLARE(s3c24xx_timer,
+				"samsung,s3c24xx-pwm", samsung_of_timer_init)
+CLOCKSOURCE_OF_DECLARE(s3c64xx_timer,
+				"samsung,s3c64xx-pwm", samsung_of_timer_init)
-- 
1.8.1.5

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

* Re: [PATCH v3 00/12] ARM: samsung-time: Prepare for multiplatform support
  2013-03-09 20:23 ` Tomasz Figa
@ 2013-03-23 12:27   ` Tomasz Figa
  -1 siblings, 0 replies; 34+ messages in thread
From: Tomasz Figa @ 2013-03-23 12:27 UTC (permalink / raw)
  To: linux-arm-kernel
  Cc: linux-samsung-soc, Kukjin Kim, kyungmin.park, linux, broonie,
	kwangwoo.lee, jacmet, augulis.darius, mcuelenaere, linux,
	Sylwester Nawrocki, buserror, christer, jekhor, ghcstop,
	Mark Rutland, Heiko Stübner, Rob Herring

Hi,

On Saturday 09 of March 2013 21:23:09 Tomasz Figa wrote:
> This series is an attempt to make the samsung-time clocksource driver
> ready for multiplatform kernels. It moves the driver to
> drivers/clocksource, cleans it up from uses of static platform-specific
> definitions, simplifies timer interrupt handling and adds Device Tree
> support.
> 
> Tested on a Tiny6410 board (Mini6410-compatible) both with and without
> Devicee Tree (with my DT patches for S3C64xx). Compile tested for other
> related SoCs.
> 
> Changes since v2:
> (http://thread.gmane.org/gmane.linux.kernel.samsung-soc/16158)
>  - Addressed comments from Rob Herring and Mark Rutland
>  - Removed unused register definitions
>  - Replaced samsung,source-timer and samsung,event-timer properties
>    with samsung,pwm-outputs property that defines which PWM channels
>    are reserved for PWM outputs on particular platform
>  - Split non-DT and DT initialization into two functions
>  - Fixed a copy paste error
> 
> Changes since v1:
> (http://thread.gmane.org/gmane.linux.kernel.samsung-soc/16005)
>  - Addressed comments from Mark Rutland
>  - Documented struct samsung_timer_variant
>  - Dropped inactive mail addresses from CC
> 
> Tomasz Figa (12):
>   ARM: SAMSUNG: Move samsung-time to drivers/clocksource
>   clocksource: samsung-time: Set platform-specific parameters at runtime
> clocksource: samsung-time: Drop useless defines from public header ARM:
> SAMSUNG: Move samsung-time.h header to inlude/clocksource clocksource:
> samsung-time: Use local register definitions
>   clocksource: samsung-time: Remove use of static register mapping
>   clocksource: samsung-time: Use clk_get_sys for getting clocks
>   ARM: SAMSUNG: devs: Drop unnecessary IRQ resources of timer devices
>   clocksource: samsung-time: Do not use static IRQ definition
>   clocksource: samsung-time: Move IRQ mask/ack handling to the driver
>   ARM: SAMSUNG: Remove unused PWM timer IRQ chip code
>   clocksource: samsung-time: Add Device Tree support

Any comments for this series?

Best regards,
Tomasz

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

* [PATCH v3 00/12] ARM: samsung-time: Prepare for multiplatform support
@ 2013-03-23 12:27   ` Tomasz Figa
  0 siblings, 0 replies; 34+ messages in thread
From: Tomasz Figa @ 2013-03-23 12:27 UTC (permalink / raw)
  To: linux-arm-kernel

Hi,

On Saturday 09 of March 2013 21:23:09 Tomasz Figa wrote:
> This series is an attempt to make the samsung-time clocksource driver
> ready for multiplatform kernels. It moves the driver to
> drivers/clocksource, cleans it up from uses of static platform-specific
> definitions, simplifies timer interrupt handling and adds Device Tree
> support.
> 
> Tested on a Tiny6410 board (Mini6410-compatible) both with and without
> Devicee Tree (with my DT patches for S3C64xx). Compile tested for other
> related SoCs.
> 
> Changes since v2:
> (http://thread.gmane.org/gmane.linux.kernel.samsung-soc/16158)
>  - Addressed comments from Rob Herring and Mark Rutland
>  - Removed unused register definitions
>  - Replaced samsung,source-timer and samsung,event-timer properties
>    with samsung,pwm-outputs property that defines which PWM channels
>    are reserved for PWM outputs on particular platform
>  - Split non-DT and DT initialization into two functions
>  - Fixed a copy paste error
> 
> Changes since v1:
> (http://thread.gmane.org/gmane.linux.kernel.samsung-soc/16005)
>  - Addressed comments from Mark Rutland
>  - Documented struct samsung_timer_variant
>  - Dropped inactive mail addresses from CC
> 
> Tomasz Figa (12):
>   ARM: SAMSUNG: Move samsung-time to drivers/clocksource
>   clocksource: samsung-time: Set platform-specific parameters at runtime
> clocksource: samsung-time: Drop useless defines from public header ARM:
> SAMSUNG: Move samsung-time.h header to inlude/clocksource clocksource:
> samsung-time: Use local register definitions
>   clocksource: samsung-time: Remove use of static register mapping
>   clocksource: samsung-time: Use clk_get_sys for getting clocks
>   ARM: SAMSUNG: devs: Drop unnecessary IRQ resources of timer devices
>   clocksource: samsung-time: Do not use static IRQ definition
>   clocksource: samsung-time: Move IRQ mask/ack handling to the driver
>   ARM: SAMSUNG: Remove unused PWM timer IRQ chip code
>   clocksource: samsung-time: Add Device Tree support

Any comments for this series?

Best regards,
Tomasz

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

* Re: [PATCH v3 12/12] clocksource: samsung-time: Add Device Tree support
  2013-03-09 20:23   ` Tomasz Figa
@ 2013-03-28 12:30     ` Mark Brown
  -1 siblings, 0 replies; 34+ messages in thread
From: Mark Brown @ 2013-03-28 12:30 UTC (permalink / raw)
  To: Tomasz Figa
  Cc: linux-arm-kernel, linux-samsung-soc, Kukjin Kim, kyungmin.park,
	linux, kwangwoo.lee, jacmet, augulis.darius, mcuelenaere, linux,
	Sylwester Nawrocki, buserror, christer, jekhor, ghcstop,
	Mark Rutland, Heiko Stübner, Rob Herring,
	devicetree-discuss, Arnd Bergmann

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

On Sat, Mar 09, 2013 at 09:23:21PM +0100, Tomasz Figa wrote:

> +CLOCKSOURCE_OF_DECLARE(s3c24xx_timer,
> +				"samsung,s3c24xx-pwm", samsung_of_timer_init)
> +CLOCKSOURCE_OF_DECLARE(s3c64xx_timer,
> +				"samsung,s3c64xx-pwm", samsung_of_timer_init)

This doesn't build for me in a non-OF configuration, though this seems
to be something that CLOCKSOURCE_OF_DECLARE ought to fix rather than
your series - I've sent a patch for that.  

It also won't build in an OF configuration with latest -next I think
since commit 4d10f054 (clocksource: make CLOCKSOURCE_OF_DECLARE type
safe) removed the semicolon the macro provided - we need them at the end
of each line here.

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

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

* [PATCH v3 12/12] clocksource: samsung-time: Add Device Tree support
@ 2013-03-28 12:30     ` Mark Brown
  0 siblings, 0 replies; 34+ messages in thread
From: Mark Brown @ 2013-03-28 12:30 UTC (permalink / raw)
  To: linux-arm-kernel

On Sat, Mar 09, 2013 at 09:23:21PM +0100, Tomasz Figa wrote:

> +CLOCKSOURCE_OF_DECLARE(s3c24xx_timer,
> +				"samsung,s3c24xx-pwm", samsung_of_timer_init)
> +CLOCKSOURCE_OF_DECLARE(s3c64xx_timer,
> +				"samsung,s3c64xx-pwm", samsung_of_timer_init)

This doesn't build for me in a non-OF configuration, though this seems
to be something that CLOCKSOURCE_OF_DECLARE ought to fix rather than
your series - I've sent a patch for that.  

It also won't build in an OF configuration with latest -next I think
since commit 4d10f054 (clocksource: make CLOCKSOURCE_OF_DECLARE type
safe) removed the semicolon the macro provided - we need them at the end
of each line here.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20130328/3c19c7af/attachment-0001.sig>

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

* Re: [PATCH v3 00/12] ARM: samsung-time: Prepare for multiplatform support
  2013-03-09 20:23 ` Tomasz Figa
@ 2013-03-28 13:02   ` Mark Brown
  -1 siblings, 0 replies; 34+ messages in thread
From: Mark Brown @ 2013-03-28 13:02 UTC (permalink / raw)
  To: Tomasz Figa
  Cc: linux-arm-kernel, linux-samsung-soc, Kukjin Kim, kyungmin.park,
	linux, kwangwoo.lee, jacmet, augulis.darius, mcuelenaere, linux,
	Sylwester Nawrocki, buserror, christer, jekhor, ghcstop,
	Mark Rutland, Heiko Stübner, Rob Herring, Arnd Bergmann

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

On Sat, Mar 09, 2013 at 09:23:09PM +0100, Tomasz Figa wrote:
> This series is an attempt to make the samsung-time clocksource driver ready
> for multiplatform kernels. It moves the driver to drivers/clocksource, cleans
> it up from uses of static platform-specific definitions, simplifies timer
> interrupt handling and adds Device Tree support.
> 
> Tested on a Tiny6410 board (Mini6410-compatible) both with and without Devicee
> Tree (with my DT patches for S3C64xx). Compile tested for other related SoCs.

With current -next this seems to break my s3c64xx based system in a
non-DT configuration - this may be due to other work on the clocksources
in -next, I've not really made much effort to investigate.

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

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

* [PATCH v3 00/12] ARM: samsung-time: Prepare for multiplatform support
@ 2013-03-28 13:02   ` Mark Brown
  0 siblings, 0 replies; 34+ messages in thread
From: Mark Brown @ 2013-03-28 13:02 UTC (permalink / raw)
  To: linux-arm-kernel

On Sat, Mar 09, 2013 at 09:23:09PM +0100, Tomasz Figa wrote:
> This series is an attempt to make the samsung-time clocksource driver ready
> for multiplatform kernels. It moves the driver to drivers/clocksource, cleans
> it up from uses of static platform-specific definitions, simplifies timer
> interrupt handling and adds Device Tree support.
> 
> Tested on a Tiny6410 board (Mini6410-compatible) both with and without Devicee
> Tree (with my DT patches for S3C64xx). Compile tested for other related SoCs.

With current -next this seems to break my s3c64xx based system in a
non-DT configuration - this may be due to other work on the clocksources
in -next, I've not really made much effort to investigate.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20130328/c0361201/attachment-0001.sig>

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

* Re: [PATCH v3 00/12] ARM: samsung-time: Prepare for multiplatform support
  2013-03-09 20:23 ` Tomasz Figa
@ 2013-03-28 22:29   ` Tomasz Figa
  -1 siblings, 0 replies; 34+ messages in thread
From: Tomasz Figa @ 2013-03-28 22:29 UTC (permalink / raw)
  To: linux-arm-kernel
  Cc: linux-samsung-soc, Kukjin Kim, kyungmin.park, linux, broonie,
	kwangwoo.lee, jacmet, augulis.darius, mcuelenaere, linux,
	Sylwester Nawrocki, buserror, christer, jekhor, ghcstop,
	Mark Rutland, Heiko Stübner, Rob Herring

On Saturday 09 of March 2013 21:23:09 Tomasz Figa wrote:
> This series is an attempt to make the samsung-time clocksource driver
> ready for multiplatform kernels. It moves the driver to
> drivers/clocksource, cleans it up from uses of static platform-specific
> definitions, simplifies timer interrupt handling and adds Device Tree
> support.
> 
> Tested on a Tiny6410 board (Mini6410-compatible) both with and without
> Devicee Tree (with my DT patches for S3C64xx). Compile tested for other
> related SoCs.
> 
> Changes since v2:
> (http://thread.gmane.org/gmane.linux.kernel.samsung-soc/16158)
>  - Addressed comments from Rob Herring and Mark Rutland
>  - Removed unused register definitions
>  - Replaced samsung,source-timer and samsung,event-timer properties
>    with samsung,pwm-outputs property that defines which PWM channels
>    are reserved for PWM outputs on particular platform
>  - Split non-DT and DT initialization into two functions
>  - Fixed a copy paste error
> 
> Changes since v1:
> (http://thread.gmane.org/gmane.linux.kernel.samsung-soc/16005)
>  - Addressed comments from Mark Rutland
>  - Documented struct samsung_timer_variant
>  - Dropped inactive mail addresses from CC
> 
> Tomasz Figa (12):
>   ARM: SAMSUNG: Move samsung-time to drivers/clocksource
>   clocksource: samsung-time: Set platform-specific parameters at runtime
> clocksource: samsung-time: Drop useless defines from public header ARM:
> SAMSUNG: Move samsung-time.h header to inlude/clocksource clocksource:
> samsung-time: Use local register definitions
>   clocksource: samsung-time: Remove use of static register mapping
>   clocksource: samsung-time: Use clk_get_sys for getting clocks
>   ARM: SAMSUNG: devs: Drop unnecessary IRQ resources of timer devices
>   clocksource: samsung-time: Do not use static IRQ definition
>   clocksource: samsung-time: Move IRQ mask/ack handling to the driver
>   ARM: SAMSUNG: Remove unused PWM timer IRQ chip code
>   clocksource: samsung-time: Add Device Tree support

Well, since this series is not merged yet, I would suggest to refrain from 
merging this version.

By the way of my other works, I have found that the case of samsung 
pwm/timer is a bit more complex than it initially seemed and it has to be 
done in a different way, to coordinate two separate drivers accessing the 
same hardware (samsung-time and pmw-samsung).

I'm currently working on next version, which is going to rework the pwm-
samsung driver as well.

Best regards,
Tomasz

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

* [PATCH v3 00/12] ARM: samsung-time: Prepare for multiplatform support
@ 2013-03-28 22:29   ` Tomasz Figa
  0 siblings, 0 replies; 34+ messages in thread
From: Tomasz Figa @ 2013-03-28 22:29 UTC (permalink / raw)
  To: linux-arm-kernel

On Saturday 09 of March 2013 21:23:09 Tomasz Figa wrote:
> This series is an attempt to make the samsung-time clocksource driver
> ready for multiplatform kernels. It moves the driver to
> drivers/clocksource, cleans it up from uses of static platform-specific
> definitions, simplifies timer interrupt handling and adds Device Tree
> support.
> 
> Tested on a Tiny6410 board (Mini6410-compatible) both with and without
> Devicee Tree (with my DT patches for S3C64xx). Compile tested for other
> related SoCs.
> 
> Changes since v2:
> (http://thread.gmane.org/gmane.linux.kernel.samsung-soc/16158)
>  - Addressed comments from Rob Herring and Mark Rutland
>  - Removed unused register definitions
>  - Replaced samsung,source-timer and samsung,event-timer properties
>    with samsung,pwm-outputs property that defines which PWM channels
>    are reserved for PWM outputs on particular platform
>  - Split non-DT and DT initialization into two functions
>  - Fixed a copy paste error
> 
> Changes since v1:
> (http://thread.gmane.org/gmane.linux.kernel.samsung-soc/16005)
>  - Addressed comments from Mark Rutland
>  - Documented struct samsung_timer_variant
>  - Dropped inactive mail addresses from CC
> 
> Tomasz Figa (12):
>   ARM: SAMSUNG: Move samsung-time to drivers/clocksource
>   clocksource: samsung-time: Set platform-specific parameters at runtime
> clocksource: samsung-time: Drop useless defines from public header ARM:
> SAMSUNG: Move samsung-time.h header to inlude/clocksource clocksource:
> samsung-time: Use local register definitions
>   clocksource: samsung-time: Remove use of static register mapping
>   clocksource: samsung-time: Use clk_get_sys for getting clocks
>   ARM: SAMSUNG: devs: Drop unnecessary IRQ resources of timer devices
>   clocksource: samsung-time: Do not use static IRQ definition
>   clocksource: samsung-time: Move IRQ mask/ack handling to the driver
>   ARM: SAMSUNG: Remove unused PWM timer IRQ chip code
>   clocksource: samsung-time: Add Device Tree support

Well, since this series is not merged yet, I would suggest to refrain from 
merging this version.

By the way of my other works, I have found that the case of samsung 
pwm/timer is a bit more complex than it initially seemed and it has to be 
done in a different way, to coordinate two separate drivers accessing the 
same hardware (samsung-time and pmw-samsung).

I'm currently working on next version, which is going to rework the pwm-
samsung driver as well.

Best regards,
Tomasz

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

end of thread, other threads:[~2013-03-28 22:29 UTC | newest]

Thread overview: 34+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-03-09 20:23 [PATCH v3 00/12] ARM: samsung-time: Prepare for multiplatform support Tomasz Figa
2013-03-09 20:23 ` Tomasz Figa
2013-03-09 20:23 ` [PATCH v3 01/12] ARM: SAMSUNG: Move samsung-time to drivers/clocksource Tomasz Figa
2013-03-09 20:23   ` Tomasz Figa
2013-03-09 20:23 ` [PATCH v3 02/12] clocksource: samsung-time: Set platform-specific parameters at runtime Tomasz Figa
2013-03-09 20:23   ` Tomasz Figa
2013-03-09 20:23 ` [PATCH v3 03/12] clocksource: samsung-time: Drop useless defines from public header Tomasz Figa
2013-03-09 20:23   ` Tomasz Figa
2013-03-09 20:23 ` [PATCH v3 04/12] ARM: SAMSUNG: Move samsung-time.h header to inlude/clocksource Tomasz Figa
2013-03-09 20:23   ` Tomasz Figa
2013-03-09 20:23 ` [PATCH v3 05/12] clocksource: samsung-time: Use local register definitions Tomasz Figa
2013-03-09 20:23   ` Tomasz Figa
2013-03-09 20:23 ` [PATCH v3 06/12] clocksource: samsung-time: Remove use of static register mapping Tomasz Figa
2013-03-09 20:23   ` Tomasz Figa
2013-03-09 20:23 ` [PATCH v3 07/12] clocksource: samsung-time: Use clk_get_sys for getting clocks Tomasz Figa
2013-03-09 20:23   ` Tomasz Figa
2013-03-09 20:23 ` [PATCH v3 08/12] ARM: SAMSUNG: devs: Drop unnecessary IRQ resources of timer devices Tomasz Figa
2013-03-09 20:23   ` Tomasz Figa
2013-03-09 20:23 ` [PATCH v3 09/12] clocksource: samsung-time: Do not use static IRQ definition Tomasz Figa
2013-03-09 20:23   ` Tomasz Figa
2013-03-09 20:23 ` [PATCH v3 10/12] clocksource: samsung-time: Move IRQ mask/ack handling to the driver Tomasz Figa
2013-03-09 20:23   ` Tomasz Figa
2013-03-09 20:23 ` [PATCH v3 11/12] ARM: SAMSUNG: Remove unused PWM timer IRQ chip code Tomasz Figa
2013-03-09 20:23   ` Tomasz Figa
2013-03-09 20:23 ` [PATCH v3 12/12] clocksource: samsung-time: Add Device Tree support Tomasz Figa
2013-03-09 20:23   ` Tomasz Figa
2013-03-28 12:30   ` Mark Brown
2013-03-28 12:30     ` Mark Brown
2013-03-23 12:27 ` [PATCH v3 00/12] ARM: samsung-time: Prepare for multiplatform support Tomasz Figa
2013-03-23 12:27   ` Tomasz Figa
2013-03-28 13:02 ` Mark Brown
2013-03-28 13:02   ` Mark Brown
2013-03-28 22:29 ` Tomasz Figa
2013-03-28 22:29   ` Tomasz Figa

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.