aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-s3c64xx/common.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/mach-s3c64xx/common.c')
-rw-r--r--arch/arm/mach-s3c64xx/common.c32
1 files changed, 28 insertions, 4 deletions
diff --git a/arch/arm/mach-s3c64xx/common.c b/arch/arm/mach-s3c64xx/common.c
index 3f62e467b129..73d79cf5e141 100644
--- a/arch/arm/mach-s3c64xx/common.c
+++ b/arch/arm/mach-s3c64xx/common.c
@@ -27,6 +27,7 @@
27#include <linux/irq.h> 27#include <linux/irq.h>
28#include <linux/gpio.h> 28#include <linux/gpio.h>
29#include <linux/irqchip/arm-vic.h> 29#include <linux/irqchip/arm-vic.h>
30#include <clocksource/samsung_pwm.h>
30 31
31#include <asm/mach/arch.h> 32#include <asm/mach/arch.h>
32#include <asm/mach/map.h> 33#include <asm/mach/map.h>
@@ -42,7 +43,7 @@
42#include <plat/pm.h> 43#include <plat/pm.h>
43#include <plat/gpio-cfg.h> 44#include <plat/gpio-cfg.h>
44#include <plat/irq-uart.h> 45#include <plat/irq-uart.h>
45#include <plat/irq-vic-timer.h> 46#include <plat/pwm-core.h>
46#include <plat/regs-irqtype.h> 47#include <plat/regs-irqtype.h>
47#include <plat/regs-serial.h> 48#include <plat/regs-serial.h>
48#include <plat/watchdog-reset.h> 49#include <plat/watchdog-reset.h>
@@ -149,6 +150,30 @@ static struct device s3c64xx_dev = {
149 .bus = &s3c64xx_subsys, 150 .bus = &s3c64xx_subsys,
150}; 151};
151 152
153static struct samsung_pwm_variant s3c64xx_pwm_variant = {
154 .bits = 32,
155 .div_base = 0,
156 .has_tint_cstat = true,
157 .tclk_mask = (1 << 7) | (1 << 6) | (1 << 5),
158};
159
160void __init samsung_set_timer_source(unsigned int event, unsigned int source)
161{
162 s3c64xx_pwm_variant.output_mask = BIT(SAMSUNG_PWM_NUM) - 1;
163 s3c64xx_pwm_variant.output_mask &= ~(BIT(event) | BIT(source));
164}
165
166void __init samsung_timer_init(void)
167{
168 unsigned int timer_irqs[SAMSUNG_PWM_NUM] = {
169 IRQ_TIMER0_VIC, IRQ_TIMER1_VIC, IRQ_TIMER2_VIC,
170 IRQ_TIMER3_VIC, IRQ_TIMER4_VIC,
171 };
172
173 samsung_pwm_clocksource_init(S3C_VA_TIMER,
174 timer_irqs, &s3c64xx_pwm_variant);
175}
176
152/* read cpu identification code */ 177/* read cpu identification code */
153 178
154void __init s3c64xx_init_io(struct map_desc *mach_desc, int size) 179void __init s3c64xx_init_io(struct map_desc *mach_desc, int size)
@@ -161,6 +186,8 @@ void __init s3c64xx_init_io(struct map_desc *mach_desc, int size)
161 s3c64xx_init_cpu(); 186 s3c64xx_init_cpu();
162 187
163 s3c_init_cpu(samsung_cpu_id, cpu_ids, ARRAY_SIZE(cpu_ids)); 188 s3c_init_cpu(samsung_cpu_id, cpu_ids, ARRAY_SIZE(cpu_ids));
189
190 samsung_pwm_set_platdata(&s3c64xx_pwm_variant);
164} 191}
165 192
166static __init int s3c64xx_dev_init(void) 193static __init int s3c64xx_dev_init(void)
@@ -195,9 +222,6 @@ void __init s3c64xx_init_irq(u32 vic0_valid, u32 vic1_valid)
195 /* initialise the pair of VICs */ 222 /* initialise the pair of VICs */
196 vic_init(VA_VIC0, IRQ_VIC0_BASE, vic0_valid, IRQ_VIC0_RESUME); 223 vic_init(VA_VIC0, IRQ_VIC0_BASE, vic0_valid, IRQ_VIC0_RESUME);
197 vic_init(VA_VIC1, IRQ_VIC1_BASE, vic1_valid, IRQ_VIC1_RESUME); 224 vic_init(VA_VIC1, IRQ_VIC1_BASE, vic1_valid, IRQ_VIC1_RESUME);
198
199 /* add the timer sub-irqs */
200 s3c_init_vic_timer_irq(5, IRQ_TIMER0);
201} 225}
202 226
203#define eint_offset(irq) ((irq) - IRQ_EINT(0)) 227#define eint_offset(irq) ((irq) - IRQ_EINT(0))