aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorKukjin Kim <kgene.kim@samsung.com>2010-01-13 18:15:39 -0500
committerBen Dooks <ben-linux@fluff.org>2010-01-15 05:16:27 -0500
commit5f3545f64a44b2b2dac34141dba23d18cdf40a92 (patch)
tree60bd51bbf274ccc32f00d320834e965b4a2afbc5 /arch
parentb7db51be43bc8f9943324a00b80e5d034de0a733 (diff)
ARM: S5P6440: Add Timer support
This patch adds timer support for S5P6440 CPU. Signed-off-by: Atul Dahiya <atul.dahiya@samsung.com> Signed-off-by: Kukjin Kim <kgene.kim@samsung.com> Signed-off-by: Ben Dooks <ben-linux@fluff.org>
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/mach-s5p6440/include/mach/pwm-clock.h62
-rw-r--r--arch/arm/mach-s5p6440/include/mach/tick.h24
2 files changed, 86 insertions, 0 deletions
diff --git a/arch/arm/mach-s5p6440/include/mach/pwm-clock.h b/arch/arm/mach-s5p6440/include/mach/pwm-clock.h
new file mode 100644
index 000000000000..c4bb7c555477
--- /dev/null
+++ b/arch/arm/mach-s5p6440/include/mach/pwm-clock.h
@@ -0,0 +1,62 @@
1/* linux/arch/arm/mach-s5p6440/include/mach/pwm-clock.h
2 *
3 * Copyright 2008 Simtec Electronics
4 * Ben Dooks <ben@simtec.co.uk>
5 * http://armlinux.simtec.co.uk/
6 *
7 * Copyright 2009 Samsung Electronics Co., Ltd.
8 * http://www.samsung.com/
9 *
10 * S5P6440 - pwm clock and timer support
11 *
12 * This program is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License version 2 as
14 * published by the Free Software Foundation.
15*/
16
17/**
18 * pwm_cfg_src_is_tclk() - return whether the given mux config is a tclk
19 * @cfg: The timer TCFG1 register bits shifted down to 0.
20 *
21 * Return true if the given configuration from TCFG1 is a TCLK instead
22 * any of the TDIV clocks.
23 */
24static inline int pwm_cfg_src_is_tclk(unsigned long tcfg)
25{
26 return tcfg == S3C2410_TCFG1_MUX_TCLK;
27}
28
29/**
30 * tcfg_to_divisor() - convert tcfg1 setting to a divisor
31 * @tcfg1: The tcfg1 setting, shifted down.
32 *
33 * Get the divisor value for the given tcfg1 setting. We assume the
34 * caller has already checked to see if this is not a TCLK source.
35 */
36static inline unsigned long tcfg_to_divisor(unsigned long tcfg1)
37{
38 return 1 << (1 + tcfg1);
39}
40
41/**
42 * pwm_tdiv_has_div1() - does the tdiv setting have a /1
43 *
44 * Return true if we have a /1 in the tdiv setting.
45 */
46static inline unsigned int pwm_tdiv_has_div1(void)
47{
48 return 0;
49}
50
51/**
52 * pwm_tdiv_div_bits() - calculate TCFG1 divisor value.
53 * @div: The divisor to calculate the bit information for.
54 *
55 * Turn a divisor into the necessary bit field for TCFG1.
56 */
57static inline unsigned long pwm_tdiv_div_bits(unsigned int div)
58{
59 return ilog2(div) - 1;
60}
61
62#define S3C_TCFG1_MUX_TCLK S3C2410_TCFG1_MUX_TCLK
diff --git a/arch/arm/mach-s5p6440/include/mach/tick.h b/arch/arm/mach-s5p6440/include/mach/tick.h
new file mode 100644
index 000000000000..0815aeb4f2cf
--- /dev/null
+++ b/arch/arm/mach-s5p6440/include/mach/tick.h
@@ -0,0 +1,24 @@
1/* linux/arch/arm/mach-s5p6440/include/mach/tick.h
2 *
3 * Copyright (c) 2009 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com/
5 *
6 * S5P6440 - Timer tick support definitions
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11*/
12
13#ifndef __ASM_ARCH_TICK_H
14#define __ASM_ARCH_TICK_H __FILE__
15
16static inline u32 s3c24xx_ostimer_pending(void)
17{
18 u32 pend = __raw_readl(S5P_VA_VIC0 + VIC_RAW_STATUS);
19 return pend & (1 << (IRQ_TIMER4_VIC - S5P_IRQ_VIC0(0)));
20}
21
22#define TICK_MAX (0xffffffff)
23
24#endif /* __ASM_ARCH_TICK_H */