drivers/clocksource/timer-ti-dm.c
Source file repositories/reference/linux-study-clean/drivers/clocksource/timer-ti-dm.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/clocksource/timer-ti-dm.c- Extension
.c- Size
- 40724 bytes
- Lines
- 1642
- Domain
- Driver Families
- Bucket
- drivers/clocksource
- Inferred role
- Driver Families: implementation source
- Status
- source implementation candidate
Why This File Exists
Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Touches IRQ or DMA behavior; this matters for the representative real-device path.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/clk.hlinux/clk-provider.hlinux/clocksource.hlinux/clockchips.hlinux/cpu_pm.hlinux/module.hlinux/interrupt.hlinux/io.hlinux/device.hlinux/err.hlinux/pm_runtime.hlinux/of.hlinux/platform_device.hlinux/platform_data/dmtimer-omap.hlinux/sched_clock.hclocksource/timer-ti-dm.hlinux/delay.hlinux/soc/ti/omap1-io.h
Detected Declarations
struct timer_regsstruct dmtimerstruct dmtimer_clocksourcestruct omap_dm_timer_clockeventfunction dmtimer_readfunction dmtimer_writefunction __omap_dm_timer_init_regsfunction __omap_dm_timer_enable_postedfunction __omap_dm_timer_stopfunction __omap_dm_timer_int_enablefunction __omap_dm_timer_read_counterfunction __omap_dm_timer_write_statusfunction omap_timer_restore_contextfunction omap_timer_save_contextfunction omap_timer_context_notifierfunction omap_timer_fclk_notifierfunction omap_dm_timer_resetfunction omap_dm_timer_set_sourcefunction omap_dm_timer_enablefunction omap_dm_timer_disablefunction omap_dm_timer_preparefunction omap_dm_timer_reserved_systimerfunction omap_dm_timer_freefunction omap_dm_timer_get_irqfunction omap_dm_timer_modify_idlect_maskfunction omap_dm_timer_modify_idlect_maskfunction omap_dm_timer_startfunction omap_dm_timer_stopfunction omap_dm_timer_set_loadfunction omap_dm_timer_set_matchfunction omap_dm_timer_set_capfunction omap_dm_timer_set_pwmfunction omap_dm_timer_get_pwm_statusfunction omap_dm_timer_set_prescalerfunction omap_dm_timer_set_int_enablefunction omap_dm_timer_set_int_disablefunction omap_dm_timer_read_statusfunction omap_dm_timer_write_statusfunction omap_dm_timer_read_counterfunction __omap_dm_timer_capfunction omap_dm_timer_write_counterfunction omap_dm_timer_cap_counterfunction omap_dm_timer_runtime_suspendfunction omap_dm_timer_runtime_resumefunction omap_dm_timer_read_cyclesfunction omap_dm_timer_read_sched_clockfunction omap_dm_timer_clocksource_suspendfunction omap_dm_timer_clocksource_resume
Annotated Snippet
struct timer_regs {
u32 ocp_cfg;
u32 tidr;
u32 tier;
u32 twer;
u32 tclr;
u32 tcrr;
u32 tldr;
u32 ttrg;
u32 twps;
u32 tmar;
u32 tcar1;
u32 tsicr;
u32 tcar2;
u32 tpir;
u32 tnir;
u32 tcvr;
u32 tocr;
u32 towr;
};
struct dmtimer {
struct omap_dm_timer cookie;
int id;
int irq;
struct clk *fclk;
void __iomem *io_base;
int irq_stat; /* TISR/IRQSTATUS interrupt status */
int irq_ena; /* irq enable */
int irq_dis; /* irq disable, only on v2 ip */
void __iomem *pend; /* write pending */
void __iomem *func_base; /* function register base */
atomic_t enabled;
unsigned reserved:1;
unsigned posted:1;
unsigned omap1:1;
struct timer_regs context;
int revision;
u32 capability;
u32 errata;
struct platform_device *pdev;
struct list_head node;
struct notifier_block nb;
struct notifier_block fclk_nb;
unsigned long fclk_rate;
};
static u32 omap_reserved_systimers;
static LIST_HEAD(omap_timer_list);
static DEFINE_SPINLOCK(dm_timer_lock);
struct dmtimer_clocksource {
struct clocksource dev;
struct dmtimer *timer;
unsigned int loadval;
};
struct omap_dm_timer_clockevent {
struct clock_event_device dev;
struct dmtimer *timer;
u32 period;
};
static bool omap_dm_timer_clockevent_setup;
static void __iomem *omap_dm_timer_sched_clock_counter;
enum {
REQUEST_ANY = 0,
REQUEST_BY_ID,
REQUEST_BY_CAP,
REQUEST_BY_NODE,
};
/**
* dmtimer_read - read timer registers in posted and non-posted mode
* @timer: timer pointer over which read operation to perform
* @reg: lowest byte holds the register offset
*
* The posted mode bit is encoded in reg. Note that in posted mode, write
* pending bit must be checked. Otherwise a read of a non completed write
* will produce an error.
*/
static inline u32 dmtimer_read(struct dmtimer *timer, u32 reg)
{
u16 wp, offset;
wp = reg >> WPSHIFT;
offset = reg & 0xff;
Annotation
- Immediate include surface: `linux/clk.h`, `linux/clk-provider.h`, `linux/clocksource.h`, `linux/clockchips.h`, `linux/cpu_pm.h`, `linux/module.h`, `linux/interrupt.h`, `linux/io.h`.
- Detected declarations: `struct timer_regs`, `struct dmtimer`, `struct dmtimer_clocksource`, `struct omap_dm_timer_clockevent`, `function dmtimer_read`, `function dmtimer_write`, `function __omap_dm_timer_init_regs`, `function __omap_dm_timer_enable_posted`, `function __omap_dm_timer_stop`, `function __omap_dm_timer_int_enable`.
- Atlas domain: Driver Families / drivers/clocksource.
- Implementation status: source implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
- IRQ or DMA behavior appears here, which is relevant to the selected PCIe/NVMe device path.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.