From: Olof Johansson Date: Mon, 14 Jan 2013 18:20:02 +0000 (-0800) Subject: Merge branch 'clocksource/cleanup' into next/cleanup X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=8d84981e395850aab31c3f2ca7e2738e03f671d7;p=linux-beck.git Merge branch 'clocksource/cleanup' into next/cleanup Clockevent cleanup series from Shawn Guo. Resolved move/change conflict in mach-pxa/time.c due to the sys_timer cleanup. * clocksource/cleanup: clocksource: use clockevents_config_and_register() where possible ARM: use clockevents_config_and_register() where possible clockevents: export clockevents_config_and_register for module use + sync to Linux 3.8-rc3 Signed-off-by: Olof Johansson Conflicts: arch/arm/mach-pxa/time.c --- 8d84981e395850aab31c3f2ca7e2738e03f671d7 diff --cc arch/arm/mach-footbridge/dc21285-timer.c index 9f14b1d9a0e7,a9918b691a84..9ee78f7b4990 --- a/arch/arm/mach-footbridge/dc21285-timer.c +++ b/arch/arm/mach-footbridge/dc21285-timer.c @@@ -101,10 -101,10 +101,6 @@@ void __init footbridge_timer_init(void setup_irq(ce->irq, &footbridge_timer_irq); - clockevents_calc_mult_shift(ce, mem_fclk_21285, 5); - ce->max_delta_ns = clockevent_delta2ns(0xffffff, ce); - ce->min_delta_ns = clockevent_delta2ns(0x000004, ce); ce->cpumask = cpumask_of(smp_processor_id()); - - clockevents_register_device(ce); + clockevents_config_and_register(ce, mem_fclk_21285, 0x4, 0xffffff); } - -struct sys_timer footbridge_timer = { - .init = footbridge_timer_init, -}; diff --cc arch/arm/mach-highbank/highbank.c index f6ca285ee5c5,981dc1e1da51..41e254cac1ac --- a/arch/arm/mach-highbank/highbank.c +++ b/arch/arm/mach-highbank/highbank.c @@@ -129,9 -129,13 +129,9 @@@ static void __init highbank_timer_init( arch_timer_sched_clock_init(); } -static struct sys_timer highbank_timer = { - .init = highbank_timer_init, -}; - static void highbank_power_off(void) { - hignbank_set_pwr_shutdown(); + highbank_set_pwr_shutdown(); while (1) cpu_do_idle(); diff --cc arch/arm/mach-netx/time.c index 0dee4524494f,d780a93e1cf7..6df42e643031 --- a/arch/arm/mach-netx/time.c +++ b/arch/arm/mach-netx/time.c @@@ -140,14 -139,13 +139,9 @@@ void __init netx_timer_init(void clocksource_mmio_init(NETX_GPIO_COUNTER_CURRENT(TIMER_CLOCKSOURCE), "netx_timer", CLOCK_TICK_RATE, 200, 32, clocksource_mmio_readl_up); - netx_clockevent.mult = div_sc(CLOCK_TICK_RATE, NSEC_PER_SEC, - netx_clockevent.shift); - netx_clockevent.max_delta_ns = - clockevent_delta2ns(0xfffffffe, &netx_clockevent); /* with max_delta_ns >= delta2ns(0x800) the system currently runs fine. * Adding some safety ... */ - netx_clockevent.min_delta_ns = - clockevent_delta2ns(0xa00, &netx_clockevent); netx_clockevent.cpumask = cpumask_of(0); - clockevents_register_device(&netx_clockevent); + clockevents_config_and_register(&netx_clockevent, CLOCK_TICK_RATE, + 0xa00, 0xfffffffe); } - -struct sys_timer netx_timer = { - .init = netx_timer_init, -}; diff --cc arch/arm/mach-pxa/time.c index bea19a06b2bf,08cc47f6a79f..8f1ee92aea30 --- a/arch/arm/mach-pxa/time.c +++ b/arch/arm/mach-pxa/time.c @@@ -134,33 -164,3 +134,29 @@@ static struct clock_event_device ckevt_ .suspend = pxa_timer_suspend, .resume = pxa_timer_resume, }; + +static struct irqaction pxa_ost0_irq = { + .name = "ost0", + .flags = IRQF_DISABLED | IRQF_TIMER | IRQF_IRQPOLL, + .handler = pxa_ost0_interrupt, + .dev_id = &ckevt_pxa_osmr0, +}; + +void __init pxa_timer_init(void) +{ + unsigned long clock_tick_rate = get_clock_tick_rate(); + + writel_relaxed(0, OIER); + writel_relaxed(OSSR_M0 | OSSR_M1 | OSSR_M2 | OSSR_M3, OSSR); + + setup_sched_clock(pxa_read_sched_clock, 32, clock_tick_rate); + - clockevents_calc_mult_shift(&ckevt_pxa_osmr0, clock_tick_rate, 4); - ckevt_pxa_osmr0.max_delta_ns = - clockevent_delta2ns(0x7fffffff, &ckevt_pxa_osmr0); - ckevt_pxa_osmr0.min_delta_ns = - clockevent_delta2ns(MIN_OSCR_DELTA * 2, &ckevt_pxa_osmr0) + 1; + ckevt_pxa_osmr0.cpumask = cpumask_of(0); + + setup_irq(IRQ_OST0, &pxa_ost0_irq); + + clocksource_mmio_init(OSCR, "oscr0", clock_tick_rate, 200, 32, + clocksource_mmio_readl_up); - clockevents_register_device(&ckevt_pxa_osmr0); ++ clockevents_config_and_register(&ckevt_pxa_osmr0, clock_tick_rate, ++ MIN_OSCR_DELTA * 2, 0x7fffffff); +} diff --cc arch/arm/mach-sa1100/time.c index 934db6385cd6,6e980da5ebfe..a59a13a665a6 --- a/arch/arm/mach-sa1100/time.c +++ b/arch/arm/mach-sa1100/time.c @@@ -109,31 -137,3 +109,27 @@@ static struct clock_event_device ckevt_ .suspend = sa1100_timer_suspend, .resume = sa1100_timer_resume, }; + +static struct irqaction sa1100_timer_irq = { + .name = "ost0", + .flags = IRQF_DISABLED | IRQF_TIMER | IRQF_IRQPOLL, + .handler = sa1100_ost0_interrupt, + .dev_id = &ckevt_sa1100_osmr0, +}; + +void __init sa1100_timer_init(void) +{ + writel_relaxed(0, OIER); + writel_relaxed(OSSR_M0 | OSSR_M1 | OSSR_M2 | OSSR_M3, OSSR); + + setup_sched_clock(sa1100_read_sched_clock, 32, 3686400); + - clockevents_calc_mult_shift(&ckevt_sa1100_osmr0, 3686400, 4); - ckevt_sa1100_osmr0.max_delta_ns = - clockevent_delta2ns(0x7fffffff, &ckevt_sa1100_osmr0); - ckevt_sa1100_osmr0.min_delta_ns = - clockevent_delta2ns(MIN_OSCR_DELTA * 2, &ckevt_sa1100_osmr0) + 1; + ckevt_sa1100_osmr0.cpumask = cpumask_of(0); + + setup_irq(IRQ_OST0, &sa1100_timer_irq); + + clocksource_mmio_init(OSCR, "oscr", CLOCK_TICK_RATE, 200, 32, + clocksource_mmio_readl_up); - clockevents_register_device(&ckevt_sa1100_osmr0); ++ clockevents_config_and_register(&ckevt_sa1100_osmr0, 3686400, ++ MIN_OSCR_DELTA * 2, 0x7fffffff); +} diff --cc drivers/clocksource/sunxi_timer.c index 6c2ed56e8b14,f9118664e440..0ce85e29769b --- a/drivers/clocksource/sunxi_timer.c +++ b/drivers/clocksource/sunxi_timer.c @@@ -154,14 -153,12 +153,8 @@@ void __init sunxi_timer_init(void val = readl(timer_base + TIMER_CTL_REG); writel(val | TIMER_CTL_ENABLE, timer_base + TIMER_CTL_REG); - sunxi_clockevent.mult = div_sc(rate / TIMER_SCAL, - NSEC_PER_SEC, - sunxi_clockevent.shift); - sunxi_clockevent.max_delta_ns = clockevent_delta2ns(0xff, - &sunxi_clockevent); - sunxi_clockevent.min_delta_ns = clockevent_delta2ns(0x1, - &sunxi_clockevent); sunxi_clockevent.cpumask = cpumask_of(0); - clockevents_register_device(&sunxi_clockevent); + clockevents_config_and_register(&sunxi_clockevent, rate / TIMER_SCAL, + 0x1, 0xff); } - -struct sys_timer sunxi_timer = { - .init = sunxi_timer_init, -};