ARM: samsung-time: Prepare for multiplatform support
Subsystems (6)
cover ARM: samsung-time: Prepare for multiplatform support
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 archs.
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
clocksource: samsung-time: Move samsung-time.h header to include/linux
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/arm/samsung-timer.txt | 32 ++ 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 | 51 -- 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 | 624 +++++++++++++++++++++ include/linux/samsung-time.h | 44 ++ 68 files changed, 847 insertions(+), 668 deletions(-) create mode 100644 Documentation/devicetree/bindings/arm/samsung-timer.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/linux/samsung-time.h
Signature · 1 line
1.8.1.2
PATCH 1/12 ARM: SAMSUNG: Move samsung-time to drivers/clocksource
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.
--- 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
arch/arm/plat-samsung/Kconfig +0 -8
@@ -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
arch/arm/plat-samsung/Makefile +0 -1
@@ -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
arch/arm/plat-samsung/samsung-time.c deleted +0 -394
394 lines not on this page · raw message
drivers/clocksource/Kconfig +7 -0
@@ -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
drivers/clocksource/Makefile +1 -0
@@ -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_CLKSRC_ARM_GENERIC) += arm_generic.o
drivers/clocksource/samsung-time.c new file +394 -0
394 lines not on this page · raw message
Signature · 1 line
1.8.1.2
PATCH 2/12 clocksource: samsung-time: Set platform-specific parameters at runtime
In reply to Tomasz FigaThis patch removes static platform-specific defines from samsung-time implementation and introduces an interface to configure platform-specific timer parameters from platform code.
--- 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 | 20 +++++------- drivers/clocksource/samsung-time.c | 40 ++++++++++++++++++----- 8 files changed, 92 insertions(+), 20 deletions(-)
arch/arm/mach-exynos/mach-universal_c210.c +7 -0
@@ -1090,11 +1090,18 @@ 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 =2 , +}; +static void __init universal_map_io (void ) {exynos_init_io (NULL ,0 );s3c24xx_init_clocks (clk_xusbxti.rate);s3c24xx_init_uarts (universal_uartcfgs,ARRAY_SIZE (universal_uartcfgs)); +samsung_timer_set_variant (&universal_timer_variant);samsung_set_timer_source (SAMSUNG_PWM2 ,SAMSUNG_PWM4 ); }
arch/arm/mach-s3c24xx/common.c +9 -0
@@ -54,6 +54,7 @@#include <plat/s3c2443.h> #include <plat/cpu-freq.h> #include <plat/pll.h> +#include <plat/samsung-time.h> /* table of supported CPUs */
@@ -219,6 +220,12 @@ static void s3c24xx_default_idle(void) S3C2410_CLKCON); } +static const struct samsung_timer_variant s3c24xx_timer_variant = { + .bits =16 , + .prescale =25 , + .divisor =50 , +}; +void __init s3c24xx_init_io (struct map_desc *mach_desc,int size) { arm_pm_idle = s3c24xx_default_idle;
@@ -235,6 +242,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 */
arch/arm/mach-s3c64xx/common.c +9 -0
@@ -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 =2 , +}; +/* 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 )
arch/arm/mach-s5p64x0/common.c +9 -0
@@ -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 =2 , +}; +/* * 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 )
arch/arm/mach-s5pc100/common.c +9 -0
@@ -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 =2 , +}; +/* * 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 )
arch/arm/mach-s5pv210/common.c +9 -0
@@ -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 =2 , +}; +/* * 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 )
arch/arm/plat-samsung/include/plat/samsung-time.h +8 -12
@@ -27,25 +27,21 @@ struct samsung_timer_source { unsigned int source_id; }; +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 1extern void __init samsung_set_timer_source (enum samsung_timer_mode event,enum samsung_timer_mode source); +extern void __init samsung_timer_set_variant ( +const struct samsung_timer_variant *variant);extern void samsung_timer_init (void );#endif /* __ASM_PLAT_SAMSUNG_TIME_H */
drivers/clocksource/samsung-time.c +32 -8
@@ -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,8 @@ 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.divisor);clk_set_parent (tin_event, tdiv_event); clock_rate =clk_get_rate (tin_event);
@@ -326,21 +337,28 @@ 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.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 +406,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 ();
Signature · 1 line
1.8.1.2
PATCH 3/12 clocksource: samsung-time: Drop useless defines from public header
In reply to Tomasz FigaThis patch cleans up public header from useless definitions.
--- arch/arm/plat-samsung/include/plat/samsung-time.h | 6 ------ drivers/clocksource/samsung-time.c | 10 +++++----- 2 files changed, 5 insertions(+), 11 deletions(-)
arch/arm/plat-samsung/include/plat/samsung-time.h +0 -6
@@ -33,12 +33,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 __init samsung_set_timer_source (enum samsung_timer_mode event,enum samsung_timer_mode source); extern void __init samsung_timer_set_variant(
drivers/clocksource/samsung-time.c +5 -5
@@ -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,
@@ -350,7 +350,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);
Signature · 1 line
1.8.1.2
PATCH 4/12 clocksource: samsung-time: Move samsung-time.h header to include/linux
In reply to Tomasz FigaThis patch moves the samsung-time.h header file to include/linux directory and fixes all references to it.
--- 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 | 41 ----------------------- drivers/clocksource/samsung-time.c | 2 +- include/linux/samsung-time.h | 41 +++++++++++++++++++++++ 51 files changed, 90 insertions(+), 90 deletions(-) delete mode 100644 arch/arm/plat-samsung/include/plat/samsung-time.h create mode 100644 include/linux/samsung-time.h
arch/arm/mach-exynos/mach-universal_c210.c +1 -1
@@ -42,7 +42,7 @@#include <plat/mfc.h> #include <plat/sdhci.h> #include <plat/fimc-core.h> -#include <plat/samsung-time.h> +#include <linux/samsung-time.h> #include <plat/camport.h> #include <mach/map.h>
arch/arm/mach-s3c24xx/common.c +1 -1
@@ -54,7 +54,7 @@#include <plat/s3c2443.h> #include <plat/cpu-freq.h> #include <plat/pll.h> -#include <plat/samsung-time.h> +#include <linux/samsung-time.h> /* table of supported CPUs */
arch/arm/mach-s3c24xx/mach-amlm5900.c +1 -1
@@ -63,7 +63,7 @@#include <linux/mtd/map.h> #include <linux/mtd/physmap.h> -#include <plat/samsung-time.h> +#include <linux/samsung-time.h> #include "common.h"
arch/arm/mach-s3c24xx/mach-anubis.c +1 -1
@@ -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 <linux/samsung-time.h> #include "anubis.h" #include "common.h"
arch/arm/mach-s3c24xx/mach-at2440evb.c +1 -1
@@ -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 <linux/samsung-time.h> #include "common.h"
arch/arm/mach-s3c24xx/mach-bast.c +1 -1
@@ -55,7 +55,7 @@#include <plat/devs.h> #include <plat/gpio-cfg.h> #include <plat/regs-serial.h> -#include <plat/samsung-time.h> +#include <linux/samsung-time.h> #include "bast.h" #include "common.h"
arch/arm/mach-s3c24xx/mach-gta02.c +1 -1
@@ -81,7 +81,7 @@#include <plat/gpio-cfg.h> #include <plat/pm.h> #include <plat/regs-serial.h> -#include <plat/samsung-time.h> +#include <linux/samsung-time.h> #include "common.h" #include "gta02.h"
arch/arm/mach-s3c24xx/mach-h1940.c +1 -1
@@ -62,7 +62,7 @@#include <plat/pll.h> #include <plat/pm.h> #include <plat/regs-serial.h> -#include <plat/samsung-time.h> +#include <linux/samsung-time.h> #include "common.h" #include "h1940.h"
arch/arm/mach-s3c24xx/mach-jive.c +1 -1
@@ -53,7 +53,7 @@#include <plat/cpu.h> #include <plat/pm.h> #include <linux/platform_data/usb-s3c2410_udc.h> -#include <plat/samsung-time.h> +#include <linux/samsung-time.h> #include "s3c2412-power.h"
arch/arm/mach-s3c24xx/mach-mini2440.c +1 -1
@@ -56,7 +56,7 @@#include <plat/clock.h> #include <plat/devs.h> #include <plat/cpu.h> -#include <plat/samsung-time.h> +#include <linux/samsung-time.h> #include <sound/s3c24xx_uda134x.h>
arch/arm/mach-s3c24xx/mach-n30.c +1 -1
@@ -50,7 +50,7 @@#include <linux/platform_data/mmc-s3cmci.h> #include <plat/s3c2410.h> #include <linux/platform_data/usb-s3c2410_udc.h> -#include <plat/samsung-time.h> +#include <linux/samsung-time.h> #include "common.h"
arch/arm/mach-s3c24xx/mach-nexcoder.c +1 -1
@@ -46,7 +46,7 @@#include <plat/clock.h> #include <plat/devs.h> #include <plat/cpu.h> -#include <plat/samsung-time.h> +#include <linux/samsung-time.h> #include "common.h"
arch/arm/mach-s3c24xx/mach-osiris.c +1 -1
@@ -44,7 +44,7 @@#include <plat/devs.h> #include <plat/gpio-cfg.h> #include <plat/regs-serial.h> -#include <plat/samsung-time.h> +#include <linux/samsung-time.h> #include <mach/hardware.h> #include <mach/regs-gpio.h>
arch/arm/mach-s3c24xx/mach-otom.c +1 -1
@@ -34,7 +34,7 @@#include <plat/devs.h> #include <plat/regs-serial.h> #include <plat/s3c2410.h> -#include <plat/samsung-time.h> +#include <linux/samsung-time.h> #include "common.h" #include "otom.h"
arch/arm/mach-s3c24xx/mach-qt2410.c +1 -1
@@ -60,7 +60,7 @@#include <plat/devs.h> #include <plat/cpu.h> #include <plat/pm.h> -#include <plat/samsung-time.h> +#include <linux/samsung-time.h> #include "common.h"
arch/arm/mach-s3c24xx/mach-rx1950.c +1 -1
@@ -58,7 +58,7 @@#include <plat/pm.h> #include <plat/regs-iic.h> #include <plat/regs-serial.h> -#include <plat/samsung-time.h> +#include <linux/samsung-time.h> #include "common.h" #include "h1940.h"
arch/arm/mach-s3c24xx/mach-rx3715.c +1 -1
@@ -49,7 +49,7 @@#include <plat/devs.h> #include <plat/pm.h> #include <plat/regs-serial.h> -#include <plat/samsung-time.h> +#include <linux/samsung-time.h> #include "common.h" #include "h1940.h"
arch/arm/mach-s3c24xx/mach-smdk2410.c +1 -1
@@ -53,7 +53,7 @@#include <plat/cpu.h> #include <plat/common-smdk.h> -#include <plat/samsung-time.h> +#include <linux/samsung-time.h> #include "common.h"
arch/arm/mach-s3c24xx/mach-smdk2413.c +1 -1
@@ -46,7 +46,7 @@#include <plat/clock.h> #include <plat/devs.h> #include <plat/cpu.h> -#include <plat/samsung-time.h> +#include <linux/samsung-time.h> #include <plat/common-smdk.h>
arch/arm/mach-s3c24xx/mach-smdk2416.c +1 -1
@@ -51,7 +51,7 @@#include <plat/sdhci.h> #include <linux/platform_data/usb-s3c2410_udc.h> #include <linux/platform_data/s3c-hsudc.h> -#include <plat/samsung-time.h> +#include <linux/samsung-time.h> #include <plat/fb.h>
arch/arm/mach-s3c24xx/mach-smdk2440.c +1 -1
@@ -43,7 +43,7 @@#include <plat/clock.h> #include <plat/devs.h> #include <plat/cpu.h> -#include <plat/samsung-time.h> +#include <linux/samsung-time.h> #include <plat/common-smdk.h>
arch/arm/mach-s3c24xx/mach-smdk2443.c +1 -1
@@ -43,7 +43,7 @@#include <plat/clock.h> #include <plat/devs.h> #include <plat/cpu.h> -#include <plat/samsung-time.h> +#include <linux/samsung-time.h> #include <plat/common-smdk.h>
arch/arm/mach-s3c24xx/mach-tct_hammer.c +1 -1
@@ -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 <linux/samsung-time.h> #include "common.h"
arch/arm/mach-s3c24xx/mach-vr1000.c +1 -1
@@ -45,7 +45,7 @@#include <plat/cpu.h> #include <plat/devs.h> #include <plat/regs-serial.h> -#include <plat/samsung-time.h> +#include <linux/samsung-time.h> #include "bast.h" #include "common.h"
arch/arm/mach-s3c24xx/mach-vstms.c +1 -1
@@ -46,7 +46,7 @@#include <plat/clock.h> #include <plat/devs.h> #include <plat/cpu.h> -#include <plat/samsung-time.h> +#include <linux/samsung-time.h> static struct map_desc vstms_iodesc[]__initdata = { };
arch/arm/mach-s3c64xx/common.c +1 -1
@@ -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 <linux/samsung-time.h> #include <plat/watchdog-reset.h> #include "common.h"
arch/arm/mach-s3c64xx/mach-anw6410.c +1 -1
@@ -50,7 +50,7 @@#include <plat/devs.h> #include <plat/cpu.h> #include <mach/regs-gpio.h> -#include <plat/samsung-time.h> +#include <linux/samsung-time.h> #include "common.h" #include "regs-modem.h"
arch/arm/mach-s3c64xx/mach-crag6410.c +1 -1
@@ -65,7 +65,7 @@#include <plat/adc.h> #include <linux/platform_data/i2c-s3c2410.h> #include <plat/pm.h> -#include <plat/samsung-time.h> +#include <linux/samsung-time.h> #include "common.h" #include "crag6410.h"
arch/arm/mach-s3c64xx/mach-hmt.c +1 -1
@@ -42,7 +42,7 @@#include <plat/clock.h> #include <plat/devs.h> #include <plat/cpu.h> -#include <plat/samsung-time.h> +#include <linux/samsung-time.h> #include "common.h"
arch/arm/mach-s3c64xx/mach-mini6410.c +1 -1
@@ -42,7 +42,7 @@#include <video/platform_lcd.h> #include <video/samsung_fimd.h> -#include <plat/samsung-time.h> +#include <linux/samsung-time.h> #include "common.h" #include "regs-modem.h"
arch/arm/mach-s3c64xx/mach-ncp.c +1 -1
@@ -44,7 +44,7 @@#include <plat/clock.h> #include <plat/devs.h> #include <plat/cpu.h> -#include <plat/samsung-time.h> +#include <linux/samsung-time.h> #include "common.h"
arch/arm/mach-s3c64xx/mach-real6410.c +1 -1
@@ -43,7 +43,7 @@#include <video/platform_lcd.h> #include <video/samsung_fimd.h> -#include <plat/samsung-time.h> +#include <linux/samsung-time.h> #include "common.h" #include "regs-modem.h"
arch/arm/mach-s3c64xx/mach-smartq.c +1 -1
@@ -38,7 +38,7 @@#include <linux/platform_data/touchscreen-s3c2410.h> #include <video/platform_lcd.h> -#include <plat/samsung-time.h> +#include <linux/samsung-time.h> #include "common.h" #include "regs-modem.h"
arch/arm/mach-s3c64xx/mach-smartq5.c +1 -1
@@ -29,7 +29,7 @@#include <plat/devs.h> #include <plat/fb.h> #include <plat/gpio-cfg.h> -#include <plat/samsung-time.h> +#include <linux/samsung-time.h> #include "common.h" #include "mach-smartq.h"
arch/arm/mach-s3c64xx/mach-smartq7.c +1 -1
@@ -29,7 +29,7 @@#include <plat/devs.h> #include <plat/fb.h> #include <plat/gpio-cfg.h> -#include <plat/samsung-time.h> +#include <linux/samsung-time.h> #include "common.h" #include "mach-smartq.h"
arch/arm/mach-s3c64xx/mach-smdk6400.c +1 -1
@@ -36,7 +36,7 @@#include <plat/devs.h> #include <plat/cpu.h> #include <linux/platform_data/i2c-s3c2410.h> -#include <plat/samsung-time.h> +#include <linux/samsung-time.h> #include "common.h"
arch/arm/mach-s3c64xx/mach-smdk6410.c +1 -1
@@ -70,7 +70,7 @@#include <linux/platform_data/touchscreen-s3c2410.h> #include <plat/keypad.h> #include <plat/backlight.h> -#include <plat/samsung-time.h> +#include <linux/samsung-time.h> #include "common.h" #include "regs-modem.h"
arch/arm/mach-s5p64x0/common.c +1 -1
@@ -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 <linux/samsung-time.h> #include <plat/watchdog-reset.h> #include "common.h"
arch/arm/mach-s5p64x0/mach-smdk6440.c +1 -1
@@ -49,7 +49,7 @@#include <plat/pll.h> #include <plat/adc.h> #include <linux/platform_data/touchscreen-s3c2410.h> -#include <plat/samsung-time.h> +#include <linux/samsung-time.h> #include <plat/backlight.h> #include <plat/fb.h> #include <plat/sdhci.h>
arch/arm/mach-s5p64x0/mach-smdk6450.c +1 -1
@@ -49,7 +49,7 @@#include <plat/pll.h> #include <plat/adc.h> #include <linux/platform_data/touchscreen-s3c2410.h> -#include <plat/samsung-time.h> +#include <linux/samsung-time.h> #include <plat/backlight.h> #include <plat/fb.h> #include <plat/sdhci.h>
arch/arm/mach-s5pc100/common.c +1 -1
@@ -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 <linux/samsung-time.h> #include <plat/watchdog-reset.h> #include "common.h"
arch/arm/mach-s5pc100/mach-smdkc100.c +1 -1
@@ -52,7 +52,7 @@#include <linux/platform_data/touchscreen-s3c2410.h> #include <linux/platform_data/asoc-s3c.h> #include <plat/backlight.h> -#include <plat/samsung-time.h> +#include <linux/samsung-time.h> #include "common.h"
arch/arm/mach-s5pv210/common.c +1 -1
@@ -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 <linux/samsung-time.h> #include <plat/tv-core.h> #include <plat/spi-core.h> #include <plat/regs-serial.h>
arch/arm/mach-s5pv210/mach-aquila.c +1 -1
@@ -39,7 +39,7 @@#include <plat/fb.h> #include <plat/fimc-core.h> #include <plat/sdhci.h> -#include <plat/samsung-time.h> +#include <linux/samsung-time.h> #include "common.h"
arch/arm/mach-s5pv210/mach-goni.c +1 -1
@@ -48,7 +48,7 @@#include <plat/keypad.h> #include <plat/sdhci.h> #include <plat/clock.h> -#include <plat/samsung-time.h> +#include <linux/samsung-time.h> #include <plat/mfc.h> #include <plat/camport.h>
arch/arm/mach-s5pv210/mach-smdkc110.c +1 -1
@@ -30,7 +30,7 @@#include <linux/platform_data/ata-samsung_cf.h> #include <linux/platform_data/i2c-s3c2410.h> #include <plat/pm.h> -#include <plat/samsung-time.h> +#include <linux/samsung-time.h> #include <plat/mfc.h> #include "common.h"
arch/arm/mach-s5pv210/mach-smdkv210.c +1 -1
@@ -45,7 +45,7 @@#include <plat/keypad.h> #include <plat/pm.h> #include <plat/fb.h> -#include <plat/samsung-time.h> +#include <linux/samsung-time.h> #include <plat/backlight.h> #include <plat/mfc.h> #include <plat/clock.h>
arch/arm/mach-s5pv210/mach-torbreck.c +1 -1
@@ -27,7 +27,7 @@#include <plat/devs.h> #include <plat/cpu.h> #include <linux/platform_data/i2c-s3c2410.h> -#include <plat/samsung-time.h> +#include <linux/samsung-time.h> #include "common.h"
arch/arm/plat-samsung/include/plat/samsung-time.h deleted +0 -41
41 lines not on this page · raw message
drivers/clocksource/samsung-time.c +1 -1
@@ -15,6 +15,7 @@#include <linux/clk.h> #include <linux/clockchips.h> #include <linux/platform_device.h> +#include <linux/samsung-time.h> #include <asm/smp_twd.h> #include <asm/mach/time.h>
@@ -25,7 +26,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;
include/linux/samsung-time.h new file +41 -0
41 lines not on this page · raw message
Signature · 1 line
1.8.1.2
PATCH 4/12 clocksource: samsung-time: Move samsung-time.h header to include/linux
Quoted 2 lines · Tomasz Figa
This patch moves the
samsung-time.hheader file toinclude/linuxdirectory and fixes all references to it.
Perhaps include/clocksource would be better?
Thanks,
Mark.
PATCH 4/12 clocksource: samsung-time: Move samsung-time.h header to include/linux
Quoted 5 lines · On Monday 11 of February 2013 10:36:02 Mark Rutland wrote:
Quoted 2 lines · Tomasz Figa
This patch moves the
samsung-time.hheader file toinclude/linuxdirectory and fixes all references to it.Perhaps
include/clocksourcewould be better?
Right. Will move it there.
Best regards,
Tomasz
PATCH 5/12 clocksource: samsung-time: Use local register definitions
In reply to Tomasz FigaThis 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.
--- drivers/clocksource/samsung-time.c | 106 ++++++++++++++++++++++++++++++++++++- 1 file changed, 105 insertions(+), 1 deletion(-)
drivers/clocksource/samsung-time.c +105 -1
@@ -25,7 +25,111 @@#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_TCFG0 S3C_TIMERREG(0x00) +#define S3C2410_TCFG1 S3C_TIMERREG(0x04) +#define S3C2410_TCON S3C_TIMERREG(0x08) + +#define S3C64XX_TINT_CSTAT S3C_TIMERREG(0x44) + +#define S3C2410_TCFG_PRESCALER0_MASK (255<<0) +#define S3C2410_TCFG_PRESCALER1_MASK (255<<8) +#define S3C2410_TCFG_PRESCALER1_SHIFT (8) +#define S3C2410_TCFG_DEADZONE_MASK (255<<16) +#define S3C2410_TCFG_DEADZONE_SHIFT (16) + +#define S3C2410_TCFG1_MUX4_DIV2 (0<<16) +#define S3C2410_TCFG1_MUX4_DIV4 (1<<16) +#define S3C2410_TCFG1_MUX4_DIV8 (2<<16) +#define S3C2410_TCFG1_MUX4_DIV16 (3<<16) +#define S3C2410_TCFG1_MUX4_TCLK1 (4<<16) +#define S3C2410_TCFG1_MUX4_MASK (15<<16) +#define S3C2410_TCFG1_MUX4_SHIFT (16) + +#define S3C2410_TCFG1_MUX3_DIV2 (0<<12) +#define S3C2410_TCFG1_MUX3_DIV4 (1<<12) +#define S3C2410_TCFG1_MUX3_DIV8 (2<<12) +#define S3C2410_TCFG1_MUX3_DIV16 (3<<12) +#define S3C2410_TCFG1_MUX3_TCLK1 (4<<12) +#define S3C2410_TCFG1_MUX3_MASK (15<<12) + + +#define S3C2410_TCFG1_MUX2_DIV2 (0<<8) +#define S3C2410_TCFG1_MUX2_DIV4 (1<<8) +#define S3C2410_TCFG1_MUX2_DIV8 (2<<8) +#define S3C2410_TCFG1_MUX2_DIV16 (3<<8) +#define S3C2410_TCFG1_MUX2_TCLK1 (4<<8) +#define S3C2410_TCFG1_MUX2_MASK (15<<8) + + +#define S3C2410_TCFG1_MUX1_DIV2 (0<<4) +#define S3C2410_TCFG1_MUX1_DIV4 (1<<4) +#define S3C2410_TCFG1_MUX1_DIV8 (2<<4) +#define S3C2410_TCFG1_MUX1_DIV16 (3<<4) +#define S3C2410_TCFG1_MUX1_TCLK0 (4<<4) +#define S3C2410_TCFG1_MUX1_MASK (15<<4) + +#define S3C2410_TCFG1_MUX0_DIV2 (0<<0) +#define S3C2410_TCFG1_MUX0_DIV4 (1<<0) +#define S3C2410_TCFG1_MUX0_DIV8 (2<<0) +#define S3C2410_TCFG1_MUX0_DIV16 (3<<0) +#define S3C2410_TCFG1_MUX0_TCLK0 (4<<0) +#define S3C2410_TCFG1_MUX0_MASK (15<<0) + +#define S3C2410_TCFG1_MUX_DIV2 (0<<0) +#define S3C2410_TCFG1_MUX_DIV4 (1<<0) +#define S3C2410_TCFG1_MUX_DIV8 (2<<0) +#define S3C2410_TCFG1_MUX_DIV16 (3<<0) +#define S3C2410_TCFG1_MUX_TCLK (4<<0) +#define S3C2410_TCFG1_MUX_MASK (15<<0) + +#define S3C64XX_TCFG1_MUX_DIV1 (0<<0) +#define S3C64XX_TCFG1_MUX_DIV2 (1<<0) +#define S3C64XX_TCFG1_MUX_DIV4 (2<<0) +#define S3C64XX_TCFG1_MUX_DIV8 (3<<0) +#define S3C64XX_TCFG1_MUX_DIV16 (4<<0) +#define S3C64XX_TCFG1_MUX_TCLK (5<<0)/* 3 sets of TCLK */ +#define S3C64XX_TCFG1_MUX_MASK (15<<0) + +#define S3C2410_TCFG1_SHIFT (x) ((x) * 4) + +/* 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@+4 */ + +#define S3C2410_TCNTB (tmr) S3C_TIMERREG2(tmr, 0x00) +#define S3C2410_TCMPB (tmr) S3C_TIMERREG2(tmr, 0x04) +#define S3C2410_TCNTO (tmr) S3C_TIMERREG2(tmr, (((tmr) == 4) ? 0x04 : 0x08)) + +#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_T3INVERT (1<<18) +#define S3C2410_TCON_T3MANUALUPD (1<<17) +#define S3C2410_TCON_T3START (1<<16) + +#define S3C2410_TCON_T2RELOAD (1<<15) +#define S3C2410_TCON_T2INVERT (1<<14) +#define S3C2410_TCON_T2MANUALUPD (1<<13) +#define S3C2410_TCON_T2START (1<<12) + +#define S3C2410_TCON_T1RELOAD (1<<11) +#define S3C2410_TCON_T1INVERT (1<<10) +#define S3C2410_TCON_T1MANUALUPD (1<<9) +#define S3C2410_TCON_T1START (1<<8) + +#define S3C2410_TCON_T0DEADZONE (1<<4) +#define S3C2410_TCON_T0RELOAD (1<<3) +#define S3C2410_TCON_T0INVERT (1<<2) +#define S3C2410_TCON_T0MANUALUPD (1<<1) +#define S3C2410_TCON_T0START (1<<0)static struct clk *tin_event;static struct clk *tin_source;
Signature · 1 line
1.8.1.2
PATCH 6/12 clocksource: samsung-time: Remove use of static register mapping
In reply to Tomasz FigaThis 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.
--- 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/linux/samsung-time.h | 1 + 8 files changed, 14 insertions(+), 2 deletions(-)
arch/arm/mach-exynos/mach-universal_c210.c +1 -0
@@ -1091,6 +1091,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 =2 ,
arch/arm/mach-s3c24xx/common.c +1 -0
@@ -221,6 +221,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 =50 ,
arch/arm/mach-s3c64xx/common.c +1 -0
@@ -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 =2 ,
arch/arm/mach-s5p64x0/common.c +1 -0
@@ -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 =2 ,
arch/arm/mach-s5pc100/common.c +1 -0
@@ -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 =2 ,
arch/arm/mach-s5pv210/common.c +1 -0
@@ -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 =2 ,
drivers/clocksource/samsung-time.c +7 -2
@@ -23,10 +23,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_TCFG0 S3C_TIMERREG(0x00)
@@ -473,6 +474,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" );
include/linux/samsung-time.h +1 -0
@@ -28,6 +28,7 @@ struct samsung_timer_source { };struct samsung_timer_variant { +unsigned long reg_base;int bits;u16 prescale;u16 divisor;
Signature · 1 line
1.8.1.2
PATCH 7/12 clocksource: samsung-time: Use clk_get_sys for getting clocks
In reply to Tomasz FigaThis 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.
--- drivers/clocksource/samsung-time.c | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-)
drivers/clocksource/samsung-time.c +4 -13
@@ -23,8 +23,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))
@@ -335,9 +333,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; }
@@ -485,28 +480,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" );
Signature · 1 line
1.8.1.2
PATCH 8/12 ARM: SAMSUNG: devs: Drop unnecessary IRQ resources of timer devices
In reply to Tomasz FigaDevices from s3c_device_timer array are used only for PWM driver, which does not need interrupts. This patch removes IRQ resources of those devices.
--- arch/arm/plat-samsung/devs.c | 28 ++++++++-------------------- 1 file changed, 8 insertions(+), 20 deletions(-)
arch/arm/plat-samsung/devs.c +8 -20
@@ -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 */
Signature · 1 line
1.8.1.2
PATCH 9/12 clocksource: samsung-time: Do not use static IRQ definition
In reply to Tomasz FigaAs 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.
--- 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/linux/samsung-time.h | 1 + 8 files changed, 25 insertions(+), 1 deletion(-)
arch/arm/mach-exynos/mach-universal_c210.c +4 -0
@@ -1092,6 +1092,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 =2 ,
arch/arm/mach-s3c24xx/common.c +3 -0
@@ -222,6 +222,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 =50 ,
arch/arm/mach-s3c64xx/common.c +4 -0
@@ -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 =2 ,
arch/arm/mach-s5p64x0/common.c +4 -0
@@ -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 =2 ,
arch/arm/mach-s5pc100/common.c +4 -0
@@ -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 =2 ,
arch/arm/mach-s5pv210/common.c +4 -0
@@ -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 =2 ,
drivers/clocksource/samsung-time.c +1 -1
@@ -388,7 +388,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); }
include/linux/samsung-time.h +1 -0
@@ -29,6 +29,7 @@ struct samsung_timer_source {struct samsung_timer_variant {unsigned long reg_base; +unsigned int irqs[5 ];int bits;u16 prescale;u16 divisor;
Signature · 1 line
1.8.1.2
PATCH 10/12 clocksource: samsung-time: Move IRQ mask/ack handling to the driver
In reply to Tomasz FigaSince 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.
--- 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/linux/samsung-time.h | 1 + 15 files changed, 28 insertions(+), 40 deletions(-)
arch/arm/mach-exynos/include/mach/irqs.h +1 -2
@@ -470,10 +470,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 */
arch/arm/mach-exynos/mach-universal_c210.c +3 -2
@@ -1093,12 +1093,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 =2 , + .has_tint_cstat = true, };static void __init universal_map_io (void )
arch/arm/mach-s3c24xx/common.c +1 -0
@@ -228,6 +228,7 @@ static const struct samsung_timer_variant s3c24xx_timer_variant = { .bits = 16, .prescale = 25, .divisor = 50, + .has_tint_cstat = false, };void __init s3c24xx_init_io (struct map_desc *mach_desc,int size)
arch/arm/mach-s3c64xx/common.c +3 -5
@@ -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 =2 , + .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))
arch/arm/mach-s3c64xx/include/mach/irqs.h +0 -8
@@ -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
arch/arm/mach-s5p64x0/common.c +3 -2
@@ -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 =2 , + .has_tint_cstat = true, };/*
arch/arm/mach-s5p64x0/include/mach/irqs.h +0 -2
@@ -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)
arch/arm/mach-s5pc100/common.c +3 -2
@@ -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 =2 , + .has_tint_cstat = true, };/*
arch/arm/mach-s5pc100/include/mach/irqs.h +0 -2
@@ -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)
arch/arm/mach-s5pv210/common.c +3 -2
@@ -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 =2 , + .has_tint_cstat = true, };/*
arch/arm/mach-s5pv210/include/mach/irqs.h +0 -2
@@ -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)
arch/arm/plat-samsung/include/plat/irqs.h +0 -9
@@ -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))
arch/arm/plat-samsung/s5p-irq.c +0 -2
@@ -30,6 +30,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 ); }
drivers/clocksource/samsung-time.c +10 -0
@@ -355,6 +355,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 ;
@@ -390,6 +395,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 )
include/linux/samsung-time.h +1 -0
@@ -33,6 +33,7 @@ struct samsung_timer_variant {int bits;u16 prescale;u16 divisor; +bool has_tint_cstat; }; extern void __init samsung_set_timer_source(enum samsung_timer_mode event,
Signature · 1 line
1.8.1.2
PATCH 11/12 ARM: SAMSUNG: Remove unused PWM timer IRQ chip code
In reply to Tomasz FigaAs the need for an IRQ chip handling PWM timer interrupt chaining is gone now, this patch removes all the code made unnecessary.
--- 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
arch/arm/Kconfig +0 -1
@@ -778,7 +778,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
arch/arm/mach-s3c64xx/common.c +0 -1
@@ -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 <linux/samsung-time.h>
arch/arm/plat-samsung/Kconfig +0 -6
@@ -27,7 +27,6 @@ config PLAT_S5P select S5P_GPIO_DRVSTR select SAMSUNG_CLKSRC 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
arch/arm/plat-samsung/Makefile +0 -1
@@ -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
arch/arm/plat-samsung/include/plat/irq-vic-timer.h deleted +0 -13
@@ -1,13 +0,0 @@ -/* arch/arm/plat-samsung/include/plat/irq-vic-timer.h -* -* Copyright (c) 2010 Simtec Electronics -* Ben Dooks <[email protected]> -* -* 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);
arch/arm/plat-samsung/irq-vic-timer.c deleted +0 -98
98 lines not on this page · raw message
arch/arm/plat-samsung/s5p-irq.c +0 -1
@@ -19,7 +19,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) {
Signature · 1 line
1.8.1.2
PATCH 12/12 clocksource: samsung-time: Add Device Tree support
In reply to Tomasz FigaThis patch adds support for parsing all platform-specific data from Device Tree and instantiation using clocksource_of_init to samsung-time clocksource driver.
--- .../devicetree/bindings/arm/samsung-timer.txt | 32 +++++++ drivers/clocksource/samsung-time.c | 102 ++++++++++++++++++++- 2 files changed, 131 insertions(+), 3 deletions(-) create mode 100644 Documentation/devicetree/bindings/arm/samsung-timer.txt
Documentation/devicetree/bindings/arm/samsung-timer.txt new file +32 -0
@@ -0,0 +1,32 @@ +* Samsung PWM timer + +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-timer - for 16-bit timers present on S3C24xx + samsung,s3c64xx-pwm-timer - for 32-bit timers present on S3C64xx and newer +- reg: base address and size of register area +- interrupts: interrupt list for all five PWM timers. +- samsung,source-timer: index of timer to be used as clocksource +- samsung,event-timer: index of timer to be used as clock event + +Optional properties: +- samsung,prescale: PWM prescaler divisor (from 1 to 256) +- samsung,divisor: PWM main divider divisor (1, 2, 4, 8 or 16) + +Example: + timer at 7f006000 { + compatible = "samsung,s3c64xx-pwm-timer"; + reg = <0x7f006000 0x1000>; + interrupt-parent = <&vic0>; + interrupts = <23>, <24>, <25>, <27>, <28>; + samsung,source-timer = <4>; + samsung,event-timer = <3>; + samsung,prescale = <2>; + samsung,divisor = <1>; + };
drivers/clocksource/samsung-time.c +99 -3
125 lines not on this page · raw message
Signature · 1 line
1.8.1.2
PATCH 12/12 clocksource: samsung-time: Add Device Tree support
Quoted 22 lines · Tomasz Figa
This patch adds support for parsing all platform-specific data from Device Tree and instantiation using
clocksource_of_initto samsung-time clocksource driver.Cc devicetree-discuss at lists.ozlabs.orgSigned-off-by Tomasz Figa <[email protected]>--- .../devicetree/bindings/arm/samsung-timer.txt | 32 +++++++ drivers/clocksource/samsung-time.c | 102 ++++++++++++++++++++- 2 files changed, 131 insertions(+), 3 deletions(-) create mode 100644 Documentation/devicetree/bindings/arm/samsung-timer.txtDocumentation/devicetree/bindings/arm/samsung-timer.txt new file +4
-0@@ -0,0 +1,32 @@ +* Samsung PWM timer + +Samsung SoCs contain PWM timer blocks which can be used for system clock source +and clock event timers.
Documentation/devicetree/bindings/arm/samsung-timer.txt line 14
Quoted 10 lines
Documentation/devicetree/bindings/arm/samsung-timer.txt new file +10
-0+ +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-timer - for 16-bit timers present on S3C24xx + samsung,s3c64xx-pwm-timer - for 32-bit timers present on S3C64xx and newer +- reg: base address and size of register area +- interrupts: interrupt list for all five PWM timers.
Is this a set of combined interrupts, or one per timer?
Which order are they in?
Assuming they're one per timer, in order, how about something like:
"- interrupts: one interrupt per timer, starting at timer 0".
Documentation/devicetree/bindings/arm/samsung-timer.txt line 16
Quoted 2 lines
Documentation/devicetree/bindings/arm/samsung-timer.txt new file +2
-0+- samsung,source-timer: index of timer to be used as clocksource +- samsung,event-timer: index of timer to be used as clock event
Is there any reason this needs to be specified in the dt?
Can the driver not just select two arbitrary timers from the hardware?
Documentation/devicetree/bindings/arm/samsung-timer.txt line 19
Quoted 3 lines
Documentation/devicetree/bindings/arm/samsung-timer.txt new file +3
-0+ +Optional properties: +- samsung,prescale: PWM prescaler divisor (from 1 to 256)
It might be better to have this named "samsung,prescale-divisor" to make it clear to the average reader that its a divisor value rather than a multiplier value.
Quoted 29 lines
Documentation/devicetree/bindings/arm/samsung-timer.txt new file +13
-0+- samsung,divisor: PWM main divider divisor (1, 2, 4, 8 or 16) + +Example: + timer at 7f006000 { + compatible = "samsung,s3c64xx-pwm-timer"; + reg = <0x7f006000 0x1000>; + interrupt-parent = <&vic0>; + interrupts = <23>, <24>, <25>, <27>, <28>; + samsung,source-timer = <4>; + samsung,event-timer = <3>; + samsung,prescale = <2>; + samsung,divisor = <1>; + };drivers/clocksource/samsung-time.c +3
-0@@ -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 <linux/samsung-time.h> @@ -479,9 +482,11 @@ static void __init samsung_timer_resources(void)unsigned long source_id = timer_source.source_id;
drivers/clocksource/samsung-time.c static void __init samsung_timer_resources(void) · line 489
Quoted 10 lines
drivers/clocksource/samsung-time.c +5
-3char devname[15 ]; - timer_base =ioremap_nocache (timer_variant.reg_base,SZ_4K ); -if (!timer_base) -panic ("failed to map timer registers" ); +if (!timer_base) { + timer_base =ioremap_nocache (timer_variant.reg_base,SZ_4K ); +if (!timer_base) +panic ("failed to map timer registers" ); + }
You map 4K here, but the binding didn't mention that 4K is always the expected size of the reg.
Quoted 21 lines
drivers/clocksource/samsung-time.c +14
-0timerclk =clk_get (NULL ,"timers" );if (IS_ERR (timerclk))@@ -514,8 +519,92 @@ static void __init samsung_timer_resources(void)clk_enable (tin_source); } +enum { +TYPE_S3C24XX , +TYPE_S3C64XX , +}; + +#ifdef CONFIG_OF +static const struct of_device_id samsung_timer_ids[] = { + { .compatible ="samsung,s3c24xx-pwm-timer" , + .data = (void *)TYPE_S3C24XX , }, + { .compatible ="samsung,s3c64xx-pwm-timer" , + .data = (void *)TYPE_S3C64XX , }, + {}, +}; +
drivers/clocksource/samsung-time.c static void __init samsung_timer_resources(void) · line 545
Quoted 10 lines
drivers/clocksource/samsung-time.c +10
-0+static void samsung_timer_parse_dt (struct device_node *np, +const struct of_device_id *match) +{ +int i; +u32 val; + +if (of_property_read_u32 (np,"samsung,source-timer" , &val)) +panic ("no samsung,source-timer property provided" ); +if (val >ARRAY_SIZE (timer_variant.irqs)) +panic ("samsung,source-timer property out of range" );
This check doesn't tell you if you actually had an irq in the dt for the timer at that index.
Do you really need to panic here? Can you not just warn?
What if a future platform has another timer driver that can at least get the board to boot?
drivers/clocksource/samsung-time.c static void __init samsung_timer_resources(void) · line 552
Quoted 7 lines
drivers/clocksource/samsung-time.c +7
-0+ timer_source.source_id = val; + +if (of_property_read_u32 (np,"samsung,event-timer" , &val)) +panic ("no samsung,event-timer property provided" ); +if (val >ARRAY_SIZE (timer_variant.irqs)) +panic ("samsung,event-timer property out of range" ); + timer_source.event_id = val;
I have the same problems here as with the source-timer block above.
drivers/clocksource/samsung-time.c static void __init samsung_timer_resources(void) · line 556
Quoted 4 lines
drivers/clocksource/samsung-time.c +4
-0+ + timer_base =of_iomap (np,0 ); +if (!timer_base) +panic ("failed to map timer registers" );
Similarly here and every other place that panics: I think warning might be a better bet.
Quoted 22 lines
drivers/clocksource/samsung-time.c +22
-0+ +for (i =0 ; i <ARRAY_SIZE (timer_variant.irqs); ++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.prescale =50 ; + timer_variant.has_tint_cstat = false; +break ; +case TYPE_S3C64XX : + timer_variant.bits =32 ; + timer_variant.prescale =2 ; + timer_variant.divisor =2 ; + timer_variant.has_tint_cstat = true; +break ; + } +
drivers/clocksource/samsung-time.c static void __init samsung_timer_resources(void) · line 588
Quoted 10 lines
drivers/clocksource/samsung-time.c +10
-0+if (!of_property_read_u32 (np,"samsung,prescale" , &val)) { +if (val <1 || val >256 ) +panic ("prescale must be from 1 to 256 range" ); + timer_variant.prescale = val; + } + +if (!of_property_read_u32 (np,"samsung,divisor" , &val)) { +if (val >16 || (1 << (fls (val) -1 )) != val) +panic ("divsor must be 1, 2, 4, 8 or 16" ); + timer_variant.divisor = timer_variant.prescale * val;
Maybe it's just me, but I find this somewhat difficult to read.
How about something like:
switch (val) {
case 1:
case 2:
case 4:
case 8:
case 16:
timer_variant.divisor = timer_variant.prescale * val;
break;
default:
warn("no divisor specified");
};Thanks,
Mark.
PATCH 12/12 clocksource: samsung-time: Add Device Tree support
Hi Mark,
Thanks for your comments. See my replies inline.
Quoted 31 lines · On Monday 11 of February 2013 11:00:56 Mark Rutland wrote:
Quoted 30 lines · Tomasz Figa
This patch adds support for parsing all platform-specific data from Device Tree and instantiation using
clocksource_of_initto samsung-time
clocksource driver.Cc devicetree-discuss at lists.ozlabs.orgSigned-off-by Tomasz Figa <[email protected]>---
.../devicetree/bindings/arm/samsung-timer.txt | 32 +++++++ drivers/clocksource/samsung-time.c | 102 ++++++++++++++++++++- 2 files changed, 131 insertions(+), 3 deletions(-) create mode 100644
Documentation/devicetree/bindings/arm/samsung-timer.txt>(quoted diff) +0
-0
b/Documentation/devicetree/bindings/arm/samsung-timer.txtnew file mode 100644
index 0000000..8eb7030Documentation/devicetree/bindings/arm/samsung-timer.txt new file +3
-0@@ -0,0 +1,32 @@ +* Samsung PWM timer + +Samsung SoCs contain PWM timer blocks which can be used for systemclock source +and clock event timers.
Documentation/devicetree/bindings/arm/samsung-timer.txt new file +2
-0+ +Be aware that this configuration is supported only on uniprocessorplatforms. +For SMP SoCs, SMP-aware timers should be used, like MCT. +
Quoted 8 lines
Quoted 6 lines
Documentation/devicetree/bindings/arm/samsung-timer.txt new file +4
-0+Required properties: +- compatible : should be one of following: + samsung,s3c24xx-pwm-timer - for 16-bit timers present on S3C24xx + samsung,s3c64xx-pwm-timer - for 32-bit timers present on S3C64xxand newer +- reg: base address and size of register area +- interrupts: interrupt list for all five PWM timers.
Is this a set of combined interrupts, or one per timer?
It is one per timer, however the node represents a single PWM timer block that contains several timers (usually 5).
Quoted 5 lines
Which order are they in?
Assuming they're one per timer, in order, how about something like:
"- interrupts: one interrupt per timer, starting at timer 0".
Sounds fine to me. I will modify the description in next version.
Quoted 4 lines
Quoted 2 lines
+- samsung,source-timer: index of timer to be used as clocksource +- samsung,event-timer: index of timer to be used as clock eventIs there any reason this needs to be specified in the dt?
Yes. On some SoCs selected channels of PWM block can be used as PWM outputs and so thsoe cannot be used for system timers. This property makes it possible to specify channels used as system timers on particular platform (board).
Quoted 1 line
Can the driver not just select two arbitrary timers from the hardware?
In most cases I could statically choose channel 3 and 4 as it was done before my patches on S3C24xx and S3C64xx. I can make those channels default if others are not specified in properties.
Quoted 7 lines
Documentation/devicetree/bindings/arm/samsung-timer.txt line 19
Quoted 3 lines
Documentation/devicetree/bindings/arm/samsung-timer.txt new file +3
-0+ +Optional properties: +- samsung,prescale: PWM prescaler divisor (from 1 to 256)It might be better to have this named "samsung,prescale-divisor" to make it clear to the average reader that its a divisor value rather than a multiplier value.
Right.
Quoted 36 lines
Quoted 36 lines
+- samsung,divisor: PWM main divider divisor (1, 2, 4, 8 or 16)
Documentation/devicetree/bindings/arm/samsung-timer.txt new file +12
-0+ +Example: + timer at 7f006000 { + compatible = "samsung,s3c64xx-pwm-timer"; + reg = <0x7f006000 0x1000>; + interrupt-parent = <&vic0>; + interrupts = <23>, <24>, <25>, <27>, <28>; + samsung,source-timer = <4>; + samsung,event-timer = <3>; + samsung,prescale = <2>; + samsung,divisor = <1>; + };(quoted diff) +0
-0
b/drivers/clocksource/samsung-time.cindex 19a1c8a..63d2992 100644drivers/clocksource/samsung-time.c +3
-0@@ -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 <linux/samsung-time.h>drivers/clocksource/samsung-time.c +0
-0@@ -479,9 +482,11 @@ static void __init samsung_timer_resources(void)unsigned long source_id = timer_source.source_id;char devname[15 ];
Quoted 11 lines
drivers/clocksource/samsung-time.c static void __init samsung_timer_resources(void) · line 489
Quoted 8 lines
drivers/clocksource/samsung-time.c +5
-3- timer_base =ioremap_nocache (timer_variant.reg_base,SZ_4K ); -if (!timer_base) -panic ("failed to map timer registers" ); +if (!timer_base) { + timer_base =ioremap_nocache (timer_variant.reg_base,SZ_4K ); +if (!timer_base) +panic ("failed to map timer registers" ); + }You map 4K here, but the binding didn't mention that 4K is always the expected size of the reg.
This is a compatibility mapping for legacy (non-DT) platforms that will be removed once all platforms get moved to DT.
Quoted 28 lines
Quoted 28 lines
drivers/clocksource/samsung-time.c +19
-0timerclk =clk_get (NULL ,"timers" );if (IS_ERR (timerclk))@@ -514,8 +519,92 @@ static void __init samsung_timer_resources(void)clk_enable (tin_source); } +enum { +TYPE_S3C24XX , +TYPE_S3C64XX , +}; + +#ifdef CONFIG_OF +static const struct of_device_id samsung_timer_ids[] = { + { .compatible ="samsung,s3c24xx-pwm-timer" , + .data = (void *)TYPE_S3C24XX , }, + { .compatible ="samsung,s3c64xx-pwm-timer" , + .data = (void *)TYPE_S3C64XX , }, + {}, +}; + +static void samsung_timer_parse_dt (struct device_node *np, +const struct of_device_id *match) +{ +int i; +u32 val;
Quoted 8 lines
drivers/clocksource/samsung-time.c static void __init samsung_timer_resources(void) · line 545
Quoted 5 lines
drivers/clocksource/samsung-time.c +5
-0+ +if (of_property_read_u32 (np,"samsung,source-timer" , &val)) +panic ("no samsung,source-timer property provided" ); +if (val >ARRAY_SIZE (timer_variant.irqs)) +panic ("samsung,source-timer property out of range" );This check doesn't tell you if you actually had an irq in the dt for the timer at that index.
Hmm, this line is probably a bit confusing. I will add a define with maximum number of channels and use it here. This is only a check whether the index given is not out of range.
Quoted 4 lines
Do you really need to panic here? Can you not just warn?
What if a future platform has another timer driver that can at least get the board to boot?
It's rather unlikely that new platforms using samsung-time will show up. This clocksource is used only for non-SMP platforms based on S3C and S5P SoCs, where it is the only possible supported clocksource.
Quoted 61 lines
drivers/clocksource/samsung-time.c static void __init samsung_timer_resources(void) · line 552
Quoted 7 lines
drivers/clocksource/samsung-time.c +7
-0+ timer_source.source_id = val; + +if (of_property_read_u32 (np,"samsung,event-timer" , &val)) +panic ("no samsung,event-timer property provided" ); +if (val >ARRAY_SIZE (timer_variant.irqs)) +panic ("samsung,event-timer property out of range" ); + timer_source.event_id = val;I have the same problems here as with the source-timer block above.
drivers/clocksource/samsung-time.c static void __init samsung_timer_resources(void) · line 556
Quoted 4 lines
drivers/clocksource/samsung-time.c +4
-0+ + timer_base =of_iomap (np,0 ); +if (!timer_base) +panic ("failed to map timer registers" );Similarly here and every other place that panics: I think warning might be a better bet.
Quoted 22 lines
drivers/clocksource/samsung-time.c +22
-0+ +for (i =0 ; i <ARRAY_SIZE (timer_variant.irqs); ++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.prescale =50 ; + timer_variant.has_tint_cstat = false; +break ; +case TYPE_S3C64XX : + timer_variant.bits =32 ; + timer_variant.prescale =2 ; + timer_variant.divisor =2 ; + timer_variant.has_tint_cstat = true; +break ; + } +drivers/clocksource/samsung-time.c static void __init samsung_timer_resources(void) · line 588
Quoted 10 lines
drivers/clocksource/samsung-time.c +10
-0+if (!of_property_read_u32 (np,"samsung,prescale" , &val)) { +if (val <1 || val >256 ) +panic ("prescale must be from 1 to 256 range" ); + timer_variant.prescale = val; + } + +if (!of_property_read_u32 (np,"samsung,divisor" , &val)) { +if (val >16 || (1 << (fls (val) -1 )) != val) +panic ("divsor must be 1, 2, 4, 8 or 16" ); + timer_variant.divisor = timer_variant.prescale * val;Maybe it's just me, but I find this somewhat difficult to read.
How about something like:
switch (val) {
case 1:
case 2:
case 4:
case 8:
case 16:
Quoted 5 lines
timer_variant.divisor = timer_variant.prescale * val;
break;
default:
warn("no divisor specified");
};It looks better indeed. I will change this part in next version.
Best regards,
Tomasz
PATCH 12/12 clocksource: samsung-time: Add Device Tree support
Hi Tomasz,
[...]
Quoted 12 lines
Quoted 8 lines
Quoted 6 lines
Documentation/devicetree/bindings/arm/samsung-timer.txt new file +4
-0+Required properties: +- compatible : should be one of following: + samsung,s3c24xx-pwm-timer - for 16-bit timers present on S3C24xx + samsung,s3c64xx-pwm-timer - for 32-bit timers present on S3C64xxand newer +- reg: base address and size of register area +- interrupts: interrupt list for all five PWM timers.
Is this a set of combined interrupts, or one per timer?
It is one per timer, however the node represents a single PWM timer block that contains several timers (usually 5).
Quoted 7 lines
Quoted 5 lines
Which order are they in?
Assuming they're one per timer, in order, how about something like:
"- interrupts: one interrupt per timer, starting at timer 0".
Sounds fine to me. I will modify the description in next version.
Great.
Quoted 10 lines
Quoted 4 lines
Quoted 2 lines
+- samsung,source-timer: index of timer to be used as clocksource +- samsung,event-timer: index of timer to be used as clock eventIs there any reason this needs to be specified in the dt?
Yes. On some SoCs selected channels of PWM block can be used as PWM outputs and so thsoe cannot be used for system timers. This property makes it possible to specify channels used as system timers on particular platform (board).
Quoted 5 lines
Quoted 1 line
Can the driver not just select two arbitrary timers from the hardware?
In most cases I could statically choose channel 3 and 4 as it was done before my patches on S3C24xx and S3C64xx. I can make those channels default if others are not specified in properties.
That would be nice, it would mean we could have some less verbose dts :)
[...]
Quoted 12 lines
Quoted 11 lines
drivers/clocksource/samsung-time.c static void __init samsung_timer_resources(void) · line 489
Quoted 8 lines
drivers/clocksource/samsung-time.c +5
-3- timer_base =ioremap_nocache (timer_variant.reg_base,SZ_4K ); -if (!timer_base) -panic ("failed to map timer registers" ); +if (!timer_base) { + timer_base =ioremap_nocache (timer_variant.reg_base,SZ_4K ); +if (!timer_base) +panic ("failed to map timer registers" ); + }You map 4K here, but the binding didn't mention that 4K is always the expected size of the reg.
Quoted 2 lines
This is a compatibility mapping for legacy (non-DT) platforms that will be removed once all platforms get moved to DT.
Sounds reasonable.
[...]
Quoted 11 lines
Quoted 7 lines
drivers/clocksource/samsung-time.c static void __init samsung_timer_resources(void) · line 545
Quoted 4 lines
drivers/clocksource/samsung-time.c +4
-0+if (of_property_read_u32 (np,"samsung,source-timer" , &val)) +panic ("no samsung,source-timer property provided" ); +if (val >ARRAY_SIZE (timer_variant.irqs)) +panic ("samsung,source-timer property out of range" );This check doesn't tell you if you actually had an irq in the dt for the timer at that index.
Hmm, this line is probably a bit confusing. I will add a define with maximum number of channels and use it here. This is only a check whether the index given is not out of range.
Ok.
Quoted 8 lines
Quoted 4 lines
Do you really need to panic here? Can you not just warn?
What if a future platform has another timer driver that can at least get the board to boot?
It's rather unlikely that new platforms using samsung-time will show up. This clocksource is used only for non-SMP platforms based on S3C and S5P SoCs, where it is the only possible supported clocksource.
Ok.
[...]
Quoted 21 lines
Quoted 15 lines
drivers/clocksource/samsung-time.c static void __init samsung_timer_resources(void) · line 588
Quoted 4 lines
drivers/clocksource/samsung-time.c +4
-0+if (!of_property_read_u32 (np,"samsung,divisor" , &val)) { +if (val >16 || (1 << (fls (val) -1 )) != val) +panic ("divsor must be 1, 2, 4, 8 or 16" ); + timer_variant.divisor = timer_variant.prescale * val;Maybe it's just me, but I find this somewhat difficult to read.
How about something like:
switch (val) {
case 1:
case 2:
case 4:
case 8:
case 16:Quoted 5 lines
timer_variant.divisor = timer_variant.prescale * val; break; default: warn("no divisor specified"); };
Quoted 1 line
It looks better indeed. I will change this part in next version.
Great.
Thanks,
Mark.
cover ARM: samsung-time: Prepare for multiplatform support
In reply to Tomasz FigaSeems like several mail addresses of board maintainers are no longer valid.
guillaume.gourat at nexvision.tv
mentioned in: arch/arm/mach-s3c24xx/mach-nexcoder.c arch/arm/mach-s3c24xx/mach-otom.c
arhuaco at freaks-unidos.net
mentioned in: arch/arm/mach-s3c24xx/mach-gta02.c
danders at amltd.com
mentioned in: arch/arm/mach-s3c24xx/mach-amlm5900.c arch/arm/mach-s3c24xx/mach-tct_hammer.c
bhmin at samsung.com
mentioned in: arch/arm/mach-s5pc100/mach-smdkc100 and a bunch of files in arch/arm/mach-s5pc100
I wonder if we should do anything with them?
Best regards,
Tomasz
Quoted 102 lines · On Sunday 10 of February 2013 14:20:11 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 archs.
Tomasz Figa (12):
ARM: SAMSUNG: Move samsung-time todrivers/clocksource
clocksource: samsung-time: Set platform-specific parameters at runtime
clocksource: samsung-time: Drop useless defines from public header
clocksource: samsung-time: Movesamsung-time.hheader toinclude/linux
clocksource: samsung-time: Use local register definitions
clocksource: samsung-time: Remove use of static register mapping
clocksource: samsung-time: Useclk_get_sysfor 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/arm/samsung-timer.txt | 32 ++ 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 | 51 -- 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 | 624 +++++++++++++++++++++ include/linux/samsung-time.h | 44 ++ 68 files changed, 847 insertions(+), 668 deletions(-) create mode 100644
Documentation/devicetree/bindings/arm/samsung-timer.txtdelete mode 100644arch/arm/plat-samsung/include/plat/irq-vic-timer.hdelete mode 100644arch/arm/plat-samsung/include/plat/samsung-time.hdelete mode 100644arch/arm/plat-samsung/irq-vic-timer.cdelete mode 100644 arch/arm/plat-samsung/samsung-time.c create mode 100644 drivers/clocksource/samsung-time.c create mode 100644 include/linux/samsung-time.h
cover ARM: samsung-time: Prepare for multiplatform support
Quoted 13 lines · Tomasz Figa
Seems like several mail addresses of board maintainers are no longer valid.
guillaume.gourat at nexvision.tv
mentioned in: arch/arm/mach-s3c24xx/mach-nexcoder.c arch/arm/mach-s3c24xx/mach-otom.carhuaco at freaks-unidos.net
mentioned in: arch/arm/mach-s3c24xx/mach-gta02.cdanders at amltd.com
Quoted 8 lines
mentioned in: arch/arm/mach-s3c24xx/mach-amlm5900.c arch/arm/mach-s3c24xx/mach-tct_hammer.cbhmin at samsung.com
mentioned in:
arch/arm/mach-s5pc100/mach-smdkc100and a bunch of files inarch/arm/mach-s5pc100
FYI: He's left the company. and he doesn't work it anymore, so you can drop him.
Thank you,
Kyungmin Park
Quoted 114 lines
I wonder if we should do anything with them?
Best regards,
TomaszQuoted 95 lines · On Sunday 10 of February 2013 14:20:11 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 archs.
Tomasz Figa (12):
ARM: SAMSUNG: Move samsung-time todrivers/clocksource
clocksource: samsung-time: Set platform-specific parameters at runtime
clocksource: samsung-time: Drop useless defines from public header
clocksource: samsung-time: Movesamsung-time.hheader toinclude/linux
clocksource: samsung-time: Use local register definitions
clocksource: samsung-time: Remove use of static register mapping
clocksource: samsung-time: Useclk_get_sysfor 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/arm/samsung-timer.txt | 32 ++ 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 | 51 -- 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 | 624 +++++++++++++++++++++ include/linux/samsung-time.h | 44 ++ 68 files changed, 847 insertions(+), 668 deletions(-) create mode 100644Quoted 7 lines
Documentation/devicetree/bindings/arm/samsung-timer.txtdelete mode 100644arch/arm/plat-samsung/include/plat/irq-vic-timer.hdelete mode 100644arch/arm/plat-samsung/include/plat/samsung-time.hdelete mode 100644arch/arm/plat-samsung/irq-vic-timer.cdelete mode 100644 arch/arm/plat-samsung/samsung-time.c create mode 100644 drivers/clocksource/samsung-time.c create mode 100644 include/linux/samsung-time.h_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel