timer.c (4f779ad9939038821202ac5632bbb9610fbac124) timer.c (0583fe478a7d93be2c814b7e50d6e81c287edfe8)
1/*
2 * linux/arch/arm/mach-omap2/timer.c
3 *
4 * OMAP2 GP timer support.
5 *
6 * Copyright (C) 2009 Nokia Corporation
7 *
8 * Update to use new clocksource/clockevent layers

--- 32 unchanged lines hidden (view full) ---

41#include <linux/of_irq.h>
42#include <linux/platform_device.h>
43#include <linux/platform_data/dmtimer-omap.h>
44
45#include <asm/mach/time.h>
46#include <asm/smp_twd.h>
47#include <asm/sched_clock.h>
48
1/*
2 * linux/arch/arm/mach-omap2/timer.c
3 *
4 * OMAP2 GP timer support.
5 *
6 * Copyright (C) 2009 Nokia Corporation
7 *
8 * Update to use new clocksource/clockevent layers

--- 32 unchanged lines hidden (view full) ---

41#include <linux/of_irq.h>
42#include <linux/platform_device.h>
43#include <linux/platform_data/dmtimer-omap.h>
44
45#include <asm/mach/time.h>
46#include <asm/smp_twd.h>
47#include <asm/sched_clock.h>
48
49#include <asm/arch_timer.h>
50#include "omap_hwmod.h"
51#include "omap_device.h"
52#include <plat/counter-32k.h>
53#include <plat/dmtimer.h>
54#include "omap-pm.h"
55
56#include "soc.h"
57#include "common.h"
58#include "powerdomain.h"
59
60/* Parent clocks, eventually these will come from the clock framework */
61
62#define OMAP2_MPU_SOURCE "sys_ck"
63#define OMAP3_MPU_SOURCE OMAP2_MPU_SOURCE
64#define OMAP4_MPU_SOURCE "sys_clkin_ck"
49#include "omap_hwmod.h"
50#include "omap_device.h"
51#include <plat/counter-32k.h>
52#include <plat/dmtimer.h>
53#include "omap-pm.h"
54
55#include "soc.h"
56#include "common.h"
57#include "powerdomain.h"
58
59/* Parent clocks, eventually these will come from the clock framework */
60
61#define OMAP2_MPU_SOURCE "sys_ck"
62#define OMAP3_MPU_SOURCE OMAP2_MPU_SOURCE
63#define OMAP4_MPU_SOURCE "sys_clkin_ck"
65#define OMAP5_MPU_SOURCE "sys_clkin"
66#define OMAP2_32K_SOURCE "func_32k_ck"
67#define OMAP3_32K_SOURCE "omap_32k_fck"
68#define OMAP4_32K_SOURCE "sys_32k_ck"
69
70#define REALTIME_COUNTER_BASE 0x48243200
71#define INCREMENTER_NUMERATOR_OFFSET 0x10
72#define INCREMENTER_DENUMERATOR_RELOAD_OFFSET 0x14
73#define NUMERATOR_DENUMERATOR_MASK 0xfffff000

--- 65 unchanged lines hidden (view full) ---

139
140static struct property device_disabled = {
141 .name = "status",
142 .length = sizeof("disabled"),
143 .value = "disabled",
144};
145
146static struct of_device_id omap_timer_match[] __initdata = {
64#define OMAP2_32K_SOURCE "func_32k_ck"
65#define OMAP3_32K_SOURCE "omap_32k_fck"
66#define OMAP4_32K_SOURCE "sys_32k_ck"
67
68#define REALTIME_COUNTER_BASE 0x48243200
69#define INCREMENTER_NUMERATOR_OFFSET 0x10
70#define INCREMENTER_DENUMERATOR_RELOAD_OFFSET 0x14
71#define NUMERATOR_DENUMERATOR_MASK 0xfffff000

--- 65 unchanged lines hidden (view full) ---

137
138static struct property device_disabled = {
139 .name = "status",
140 .length = sizeof("disabled"),
141 .value = "disabled",
142};
143
144static struct of_device_id omap_timer_match[] __initdata = {
147 { .compatible = "ti,omap2420-timer", },
148 { .compatible = "ti,omap3430-timer", },
149 { .compatible = "ti,omap4430-timer", },
150 { .compatible = "ti,omap5430-timer", },
151 { .compatible = "ti,am335x-timer", },
152 { .compatible = "ti,am335x-timer-1ms", },
145 { .compatible = "ti,omap2-timer", },
153 { }
154};
155
156/**
157 * omap_get_timer_dt - get a timer using device-tree
158 * @match - device-tree match structure for matching a device type
159 * @property - optional timer property to match
160 *

--- 327 unchanged lines hidden (view full) ---

488 unsigned long rate;
489 unsigned int reg, num, den;
490
491 base = ioremap(REALTIME_COUNTER_BASE, SZ_32);
492 if (!base) {
493 pr_err("%s: ioremap failed\n", __func__);
494 return;
495 }
146 { }
147};
148
149/**
150 * omap_get_timer_dt - get a timer using device-tree
151 * @match - device-tree match structure for matching a device type
152 * @property - optional timer property to match
153 *

--- 327 unchanged lines hidden (view full) ---

481 unsigned long rate;
482 unsigned int reg, num, den;
483
484 base = ioremap(REALTIME_COUNTER_BASE, SZ_32);
485 if (!base) {
486 pr_err("%s: ioremap failed\n", __func__);
487 return;
488 }
496 sys_clk = clk_get(NULL, OMAP5_MPU_SOURCE);
489 sys_clk = clk_get(NULL, "sys_clkin_ck");
497 if (IS_ERR(sys_clk)) {
498 pr_err("%s: failed to get system clock handle\n", __func__);
499 iounmap(base);
500 return;
501 }
502
503 rate = clk_get_rate(sys_clk);
504 /* Numerator/denumerator values refer TRM Realtime Counter section */

--- 112 unchanged lines hidden (view full) ---

617{
618 omap4_sync32k_timer_init();
619}
620#endif /* CONFIG_LOCAL_TIMERS */
621#endif /* CONFIG_ARCH_OMAP4 */
622
623#ifdef CONFIG_SOC_OMAP5
624OMAP_SYS_32K_TIMER_INIT(5, 1, OMAP4_32K_SOURCE, "ti,timer-alwon",
490 if (IS_ERR(sys_clk)) {
491 pr_err("%s: failed to get system clock handle\n", __func__);
492 iounmap(base);
493 return;
494 }
495
496 rate = clk_get_rate(sys_clk);
497 /* Numerator/denumerator values refer TRM Realtime Counter section */

--- 112 unchanged lines hidden (view full) ---

610{
611 omap4_sync32k_timer_init();
612}
613#endif /* CONFIG_LOCAL_TIMERS */
614#endif /* CONFIG_ARCH_OMAP4 */
615
616#ifdef CONFIG_SOC_OMAP5
617OMAP_SYS_32K_TIMER_INIT(5, 1, OMAP4_32K_SOURCE, "ti,timer-alwon",
625 2, OMAP5_MPU_SOURCE);
618 2, OMAP4_MPU_SOURCE);
626void __init omap5_realtime_timer_init(void)
627{
628 int err;
629
630 omap5_sync32k_timer_init();
631 realtime_counter_init();
632
619void __init omap5_realtime_timer_init(void)
620{
621 int err;
622
623 omap5_sync32k_timer_init();
624 realtime_counter_init();
625
633 err = arch_timer_of_register();
634 if (err)
635 pr_err("%s: arch_timer_register failed %d\n", __func__, err);
626 clocksource_of_init();
636}
637#endif /* CONFIG_SOC_OMAP5 */
638
639/**
640 * omap_timer_init - build and register timer device with an
641 * associated timer hwmod
642 * @oh: timer hwmod pointer to be used to build timer device
643 * @user: parameter that can be passed from calling hwmod API

--- 109 unchanged lines hidden ---
627}
628#endif /* CONFIG_SOC_OMAP5 */
629
630/**
631 * omap_timer_init - build and register timer device with an
632 * associated timer hwmod
633 * @oh: timer hwmod pointer to be used to build timer device
634 * @user: parameter that can be passed from calling hwmod API

--- 109 unchanged lines hidden ---