18c2ecf20Sopenharmony_ci/* 28c2ecf20Sopenharmony_ci * Timer/Counter Unit (TC) registers. 38c2ecf20Sopenharmony_ci * 48c2ecf20Sopenharmony_ci * This program is free software; you can redistribute it and/or modify 58c2ecf20Sopenharmony_ci * it under the terms of the GNU General Public License as published by 68c2ecf20Sopenharmony_ci * the Free Software Foundation; either version 2 of the License, or 78c2ecf20Sopenharmony_ci * (at your option) any later version. 88c2ecf20Sopenharmony_ci */ 98c2ecf20Sopenharmony_ci 108c2ecf20Sopenharmony_ci#ifndef __SOC_ATMEL_TCB_H 118c2ecf20Sopenharmony_ci#define __SOC_ATMEL_TCB_H 128c2ecf20Sopenharmony_ci 138c2ecf20Sopenharmony_ci#include <linux/compiler.h> 148c2ecf20Sopenharmony_ci#include <linux/list.h> 158c2ecf20Sopenharmony_ci 168c2ecf20Sopenharmony_ci/* 178c2ecf20Sopenharmony_ci * Many 32-bit Atmel SOCs include one or more TC blocks, each of which holds 188c2ecf20Sopenharmony_ci * three general-purpose 16-bit timers. These timers share one register bank. 198c2ecf20Sopenharmony_ci * Depending on the SOC, each timer may have its own clock and IRQ, or those 208c2ecf20Sopenharmony_ci * may be shared by the whole TC block. 218c2ecf20Sopenharmony_ci * 228c2ecf20Sopenharmony_ci * These TC blocks may have up to nine external pins: TCLK0..2 signals for 238c2ecf20Sopenharmony_ci * clocks or clock gates, and per-timer TIOA and TIOB signals used for PWM 248c2ecf20Sopenharmony_ci * or triggering. Those pins need to be set up for use with the TC block, 258c2ecf20Sopenharmony_ci * else they will be used as GPIOs or for a different controller. 268c2ecf20Sopenharmony_ci * 278c2ecf20Sopenharmony_ci * Although we expect each TC block to have a platform_device node, those 288c2ecf20Sopenharmony_ci * nodes are not what drivers bind to. Instead, they ask for a specific 298c2ecf20Sopenharmony_ci * TC block, by number ... which is a common approach on systems with many 308c2ecf20Sopenharmony_ci * timers. Then they use clk_get() and platform_get_irq() to get clock and 318c2ecf20Sopenharmony_ci * IRQ resources. 328c2ecf20Sopenharmony_ci */ 338c2ecf20Sopenharmony_ci 348c2ecf20Sopenharmony_cistruct clk; 358c2ecf20Sopenharmony_ci 368c2ecf20Sopenharmony_ci/** 378c2ecf20Sopenharmony_ci * struct atmel_tcb_config - SoC data for a Timer/Counter Block 388c2ecf20Sopenharmony_ci * @counter_width: size in bits of a timer counter register 398c2ecf20Sopenharmony_ci * @has_gclk: boolean indicating if a timer counter has a generic clock 408c2ecf20Sopenharmony_ci * @has_qdec: boolean indicating if a timer counter has a quadrature 418c2ecf20Sopenharmony_ci * decoder. 428c2ecf20Sopenharmony_ci */ 438c2ecf20Sopenharmony_cistruct atmel_tcb_config { 448c2ecf20Sopenharmony_ci size_t counter_width; 458c2ecf20Sopenharmony_ci bool has_gclk; 468c2ecf20Sopenharmony_ci bool has_qdec; 478c2ecf20Sopenharmony_ci}; 488c2ecf20Sopenharmony_ci 498c2ecf20Sopenharmony_ci/** 508c2ecf20Sopenharmony_ci * struct atmel_tc - information about a Timer/Counter Block 518c2ecf20Sopenharmony_ci * @pdev: physical device 528c2ecf20Sopenharmony_ci * @regs: mapping through which the I/O registers can be accessed 538c2ecf20Sopenharmony_ci * @id: block id 548c2ecf20Sopenharmony_ci * @tcb_config: configuration data from SoC 558c2ecf20Sopenharmony_ci * @irq: irq for each of the three channels 568c2ecf20Sopenharmony_ci * @clk: internal clock source for each of the three channels 578c2ecf20Sopenharmony_ci * @node: list node, for tclib internal use 588c2ecf20Sopenharmony_ci * @allocated: if already used, for tclib internal use 598c2ecf20Sopenharmony_ci * 608c2ecf20Sopenharmony_ci * On some platforms, each TC channel has its own clocks and IRQs, 618c2ecf20Sopenharmony_ci * while on others, all TC channels share the same clock and IRQ. 628c2ecf20Sopenharmony_ci * Drivers should clk_enable() all the clocks they need even though 638c2ecf20Sopenharmony_ci * all the entries in @clk may point to the same physical clock. 648c2ecf20Sopenharmony_ci * Likewise, drivers should request irqs independently for each 658c2ecf20Sopenharmony_ci * channel, but they must use IRQF_SHARED in case some of the entries 668c2ecf20Sopenharmony_ci * in @irq are actually the same IRQ. 678c2ecf20Sopenharmony_ci */ 688c2ecf20Sopenharmony_cistruct atmel_tc { 698c2ecf20Sopenharmony_ci struct platform_device *pdev; 708c2ecf20Sopenharmony_ci void __iomem *regs; 718c2ecf20Sopenharmony_ci int id; 728c2ecf20Sopenharmony_ci const struct atmel_tcb_config *tcb_config; 738c2ecf20Sopenharmony_ci int irq[3]; 748c2ecf20Sopenharmony_ci struct clk *clk[3]; 758c2ecf20Sopenharmony_ci struct clk *slow_clk; 768c2ecf20Sopenharmony_ci struct list_head node; 778c2ecf20Sopenharmony_ci bool allocated; 788c2ecf20Sopenharmony_ci}; 798c2ecf20Sopenharmony_ci 808c2ecf20Sopenharmony_ciextern struct atmel_tc *atmel_tc_alloc(unsigned block); 818c2ecf20Sopenharmony_ciextern void atmel_tc_free(struct atmel_tc *tc); 828c2ecf20Sopenharmony_ci 838c2ecf20Sopenharmony_ci/* platform-specific ATMEL_TC_TIMER_CLOCKx divisors (0 means 32KiHz) */ 848c2ecf20Sopenharmony_ciextern const u8 atmel_tc_divisors[5]; 858c2ecf20Sopenharmony_ci 868c2ecf20Sopenharmony_ci 878c2ecf20Sopenharmony_ci/* 888c2ecf20Sopenharmony_ci * Two registers have block-wide controls. These are: configuring the three 898c2ecf20Sopenharmony_ci * "external" clocks (or event sources) used by the timer channels; and 908c2ecf20Sopenharmony_ci * synchronizing the timers by resetting them all at once. 918c2ecf20Sopenharmony_ci * 928c2ecf20Sopenharmony_ci * "External" can mean "external to chip" using the TCLK0, TCLK1, or TCLK2 938c2ecf20Sopenharmony_ci * signals. Or, it can mean "external to timer", using the TIOA output from 948c2ecf20Sopenharmony_ci * one of the other two timers that's being run in waveform mode. 958c2ecf20Sopenharmony_ci */ 968c2ecf20Sopenharmony_ci 978c2ecf20Sopenharmony_ci#define ATMEL_TC_BCR 0xc0 /* TC Block Control Register */ 988c2ecf20Sopenharmony_ci#define ATMEL_TC_SYNC (1 << 0) /* synchronize timers */ 998c2ecf20Sopenharmony_ci 1008c2ecf20Sopenharmony_ci#define ATMEL_TC_BMR 0xc4 /* TC Block Mode Register */ 1018c2ecf20Sopenharmony_ci#define ATMEL_TC_TC0XC0S (3 << 0) /* external clock 0 source */ 1028c2ecf20Sopenharmony_ci#define ATMEL_TC_TC0XC0S_TCLK0 (0 << 0) 1038c2ecf20Sopenharmony_ci#define ATMEL_TC_TC0XC0S_NONE (1 << 0) 1048c2ecf20Sopenharmony_ci#define ATMEL_TC_TC0XC0S_TIOA1 (2 << 0) 1058c2ecf20Sopenharmony_ci#define ATMEL_TC_TC0XC0S_TIOA2 (3 << 0) 1068c2ecf20Sopenharmony_ci#define ATMEL_TC_TC1XC1S (3 << 2) /* external clock 1 source */ 1078c2ecf20Sopenharmony_ci#define ATMEL_TC_TC1XC1S_TCLK1 (0 << 2) 1088c2ecf20Sopenharmony_ci#define ATMEL_TC_TC1XC1S_NONE (1 << 2) 1098c2ecf20Sopenharmony_ci#define ATMEL_TC_TC1XC1S_TIOA0 (2 << 2) 1108c2ecf20Sopenharmony_ci#define ATMEL_TC_TC1XC1S_TIOA2 (3 << 2) 1118c2ecf20Sopenharmony_ci#define ATMEL_TC_TC2XC2S (3 << 4) /* external clock 2 source */ 1128c2ecf20Sopenharmony_ci#define ATMEL_TC_TC2XC2S_TCLK2 (0 << 4) 1138c2ecf20Sopenharmony_ci#define ATMEL_TC_TC2XC2S_NONE (1 << 4) 1148c2ecf20Sopenharmony_ci#define ATMEL_TC_TC2XC2S_TIOA0 (2 << 4) 1158c2ecf20Sopenharmony_ci#define ATMEL_TC_TC2XC2S_TIOA1 (3 << 4) 1168c2ecf20Sopenharmony_ci 1178c2ecf20Sopenharmony_ci 1188c2ecf20Sopenharmony_ci/* 1198c2ecf20Sopenharmony_ci * Each TC block has three "channels", each with one counter and controls. 1208c2ecf20Sopenharmony_ci * 1218c2ecf20Sopenharmony_ci * Note that the semantics of ATMEL_TC_TIMER_CLOCKx (input clock selection 1228c2ecf20Sopenharmony_ci * when it's not "external") is silicon-specific. AT91 platforms use one 1238c2ecf20Sopenharmony_ci * set of definitions; AVR32 platforms use a different set. Don't hard-wire 1248c2ecf20Sopenharmony_ci * such knowledge into your code, use the global "atmel_tc_divisors" ... 1258c2ecf20Sopenharmony_ci * where index N is the divisor for clock N+1, else zero to indicate it uses 1268c2ecf20Sopenharmony_ci * the 32 KiHz clock. 1278c2ecf20Sopenharmony_ci * 1288c2ecf20Sopenharmony_ci * The timers can be chained in various ways, and operated in "waveform" 1298c2ecf20Sopenharmony_ci * generation mode (including PWM) or "capture" mode (to time events). In 1308c2ecf20Sopenharmony_ci * both modes, behavior can be configured in many ways. 1318c2ecf20Sopenharmony_ci * 1328c2ecf20Sopenharmony_ci * Each timer has two I/O pins, TIOA and TIOB. Waveform mode uses TIOA as a 1338c2ecf20Sopenharmony_ci * PWM output, and TIOB as either another PWM or as a trigger. Capture mode 1348c2ecf20Sopenharmony_ci * uses them only as inputs. 1358c2ecf20Sopenharmony_ci */ 1368c2ecf20Sopenharmony_ci#define ATMEL_TC_CHAN(idx) ((idx)*0x40) 1378c2ecf20Sopenharmony_ci#define ATMEL_TC_REG(idx, reg) (ATMEL_TC_CHAN(idx) + ATMEL_TC_ ## reg) 1388c2ecf20Sopenharmony_ci 1398c2ecf20Sopenharmony_ci#define ATMEL_TC_CCR 0x00 /* Channel Control Register */ 1408c2ecf20Sopenharmony_ci#define ATMEL_TC_CLKEN (1 << 0) /* clock enable */ 1418c2ecf20Sopenharmony_ci#define ATMEL_TC_CLKDIS (1 << 1) /* clock disable */ 1428c2ecf20Sopenharmony_ci#define ATMEL_TC_SWTRG (1 << 2) /* software trigger */ 1438c2ecf20Sopenharmony_ci 1448c2ecf20Sopenharmony_ci#define ATMEL_TC_CMR 0x04 /* Channel Mode Register */ 1458c2ecf20Sopenharmony_ci 1468c2ecf20Sopenharmony_ci/* Both modes share some CMR bits */ 1478c2ecf20Sopenharmony_ci#define ATMEL_TC_TCCLKS (7 << 0) /* clock source */ 1488c2ecf20Sopenharmony_ci#define ATMEL_TC_TIMER_CLOCK1 (0 << 0) 1498c2ecf20Sopenharmony_ci#define ATMEL_TC_TIMER_CLOCK2 (1 << 0) 1508c2ecf20Sopenharmony_ci#define ATMEL_TC_TIMER_CLOCK3 (2 << 0) 1518c2ecf20Sopenharmony_ci#define ATMEL_TC_TIMER_CLOCK4 (3 << 0) 1528c2ecf20Sopenharmony_ci#define ATMEL_TC_TIMER_CLOCK5 (4 << 0) 1538c2ecf20Sopenharmony_ci#define ATMEL_TC_XC0 (5 << 0) 1548c2ecf20Sopenharmony_ci#define ATMEL_TC_XC1 (6 << 0) 1558c2ecf20Sopenharmony_ci#define ATMEL_TC_XC2 (7 << 0) 1568c2ecf20Sopenharmony_ci#define ATMEL_TC_CLKI (1 << 3) /* clock invert */ 1578c2ecf20Sopenharmony_ci#define ATMEL_TC_BURST (3 << 4) /* clock gating */ 1588c2ecf20Sopenharmony_ci#define ATMEL_TC_GATE_NONE (0 << 4) 1598c2ecf20Sopenharmony_ci#define ATMEL_TC_GATE_XC0 (1 << 4) 1608c2ecf20Sopenharmony_ci#define ATMEL_TC_GATE_XC1 (2 << 4) 1618c2ecf20Sopenharmony_ci#define ATMEL_TC_GATE_XC2 (3 << 4) 1628c2ecf20Sopenharmony_ci#define ATMEL_TC_WAVE (1 << 15) /* true = Waveform mode */ 1638c2ecf20Sopenharmony_ci 1648c2ecf20Sopenharmony_ci/* CAPTURE mode CMR bits */ 1658c2ecf20Sopenharmony_ci#define ATMEL_TC_LDBSTOP (1 << 6) /* counter stops on RB load */ 1668c2ecf20Sopenharmony_ci#define ATMEL_TC_LDBDIS (1 << 7) /* counter disable on RB load */ 1678c2ecf20Sopenharmony_ci#define ATMEL_TC_ETRGEDG (3 << 8) /* external trigger edge */ 1688c2ecf20Sopenharmony_ci#define ATMEL_TC_ETRGEDG_NONE (0 << 8) 1698c2ecf20Sopenharmony_ci#define ATMEL_TC_ETRGEDG_RISING (1 << 8) 1708c2ecf20Sopenharmony_ci#define ATMEL_TC_ETRGEDG_FALLING (2 << 8) 1718c2ecf20Sopenharmony_ci#define ATMEL_TC_ETRGEDG_BOTH (3 << 8) 1728c2ecf20Sopenharmony_ci#define ATMEL_TC_ABETRG (1 << 10) /* external trigger is TIOA? */ 1738c2ecf20Sopenharmony_ci#define ATMEL_TC_CPCTRG (1 << 14) /* RC compare trigger enable */ 1748c2ecf20Sopenharmony_ci#define ATMEL_TC_LDRA (3 << 16) /* RA loading edge (of TIOA) */ 1758c2ecf20Sopenharmony_ci#define ATMEL_TC_LDRA_NONE (0 << 16) 1768c2ecf20Sopenharmony_ci#define ATMEL_TC_LDRA_RISING (1 << 16) 1778c2ecf20Sopenharmony_ci#define ATMEL_TC_LDRA_FALLING (2 << 16) 1788c2ecf20Sopenharmony_ci#define ATMEL_TC_LDRA_BOTH (3 << 16) 1798c2ecf20Sopenharmony_ci#define ATMEL_TC_LDRB (3 << 18) /* RB loading edge (of TIOA) */ 1808c2ecf20Sopenharmony_ci#define ATMEL_TC_LDRB_NONE (0 << 18) 1818c2ecf20Sopenharmony_ci#define ATMEL_TC_LDRB_RISING (1 << 18) 1828c2ecf20Sopenharmony_ci#define ATMEL_TC_LDRB_FALLING (2 << 18) 1838c2ecf20Sopenharmony_ci#define ATMEL_TC_LDRB_BOTH (3 << 18) 1848c2ecf20Sopenharmony_ci 1858c2ecf20Sopenharmony_ci/* WAVEFORM mode CMR bits */ 1868c2ecf20Sopenharmony_ci#define ATMEL_TC_CPCSTOP (1 << 6) /* RC compare stops counter */ 1878c2ecf20Sopenharmony_ci#define ATMEL_TC_CPCDIS (1 << 7) /* RC compare disables counter */ 1888c2ecf20Sopenharmony_ci#define ATMEL_TC_EEVTEDG (3 << 8) /* external event edge */ 1898c2ecf20Sopenharmony_ci#define ATMEL_TC_EEVTEDG_NONE (0 << 8) 1908c2ecf20Sopenharmony_ci#define ATMEL_TC_EEVTEDG_RISING (1 << 8) 1918c2ecf20Sopenharmony_ci#define ATMEL_TC_EEVTEDG_FALLING (2 << 8) 1928c2ecf20Sopenharmony_ci#define ATMEL_TC_EEVTEDG_BOTH (3 << 8) 1938c2ecf20Sopenharmony_ci#define ATMEL_TC_EEVT (3 << 10) /* external event source */ 1948c2ecf20Sopenharmony_ci#define ATMEL_TC_EEVT_TIOB (0 << 10) 1958c2ecf20Sopenharmony_ci#define ATMEL_TC_EEVT_XC0 (1 << 10) 1968c2ecf20Sopenharmony_ci#define ATMEL_TC_EEVT_XC1 (2 << 10) 1978c2ecf20Sopenharmony_ci#define ATMEL_TC_EEVT_XC2 (3 << 10) 1988c2ecf20Sopenharmony_ci#define ATMEL_TC_ENETRG (1 << 12) /* external event is trigger */ 1998c2ecf20Sopenharmony_ci#define ATMEL_TC_WAVESEL (3 << 13) /* waveform type */ 2008c2ecf20Sopenharmony_ci#define ATMEL_TC_WAVESEL_UP (0 << 13) 2018c2ecf20Sopenharmony_ci#define ATMEL_TC_WAVESEL_UPDOWN (1 << 13) 2028c2ecf20Sopenharmony_ci#define ATMEL_TC_WAVESEL_UP_AUTO (2 << 13) 2038c2ecf20Sopenharmony_ci#define ATMEL_TC_WAVESEL_UPDOWN_AUTO (3 << 13) 2048c2ecf20Sopenharmony_ci#define ATMEL_TC_ACPA (3 << 16) /* RA compare changes TIOA */ 2058c2ecf20Sopenharmony_ci#define ATMEL_TC_ACPA_NONE (0 << 16) 2068c2ecf20Sopenharmony_ci#define ATMEL_TC_ACPA_SET (1 << 16) 2078c2ecf20Sopenharmony_ci#define ATMEL_TC_ACPA_CLEAR (2 << 16) 2088c2ecf20Sopenharmony_ci#define ATMEL_TC_ACPA_TOGGLE (3 << 16) 2098c2ecf20Sopenharmony_ci#define ATMEL_TC_ACPC (3 << 18) /* RC compare changes TIOA */ 2108c2ecf20Sopenharmony_ci#define ATMEL_TC_ACPC_NONE (0 << 18) 2118c2ecf20Sopenharmony_ci#define ATMEL_TC_ACPC_SET (1 << 18) 2128c2ecf20Sopenharmony_ci#define ATMEL_TC_ACPC_CLEAR (2 << 18) 2138c2ecf20Sopenharmony_ci#define ATMEL_TC_ACPC_TOGGLE (3 << 18) 2148c2ecf20Sopenharmony_ci#define ATMEL_TC_AEEVT (3 << 20) /* external event changes TIOA */ 2158c2ecf20Sopenharmony_ci#define ATMEL_TC_AEEVT_NONE (0 << 20) 2168c2ecf20Sopenharmony_ci#define ATMEL_TC_AEEVT_SET (1 << 20) 2178c2ecf20Sopenharmony_ci#define ATMEL_TC_AEEVT_CLEAR (2 << 20) 2188c2ecf20Sopenharmony_ci#define ATMEL_TC_AEEVT_TOGGLE (3 << 20) 2198c2ecf20Sopenharmony_ci#define ATMEL_TC_ASWTRG (3 << 22) /* software trigger changes TIOA */ 2208c2ecf20Sopenharmony_ci#define ATMEL_TC_ASWTRG_NONE (0 << 22) 2218c2ecf20Sopenharmony_ci#define ATMEL_TC_ASWTRG_SET (1 << 22) 2228c2ecf20Sopenharmony_ci#define ATMEL_TC_ASWTRG_CLEAR (2 << 22) 2238c2ecf20Sopenharmony_ci#define ATMEL_TC_ASWTRG_TOGGLE (3 << 22) 2248c2ecf20Sopenharmony_ci#define ATMEL_TC_BCPB (3 << 24) /* RB compare changes TIOB */ 2258c2ecf20Sopenharmony_ci#define ATMEL_TC_BCPB_NONE (0 << 24) 2268c2ecf20Sopenharmony_ci#define ATMEL_TC_BCPB_SET (1 << 24) 2278c2ecf20Sopenharmony_ci#define ATMEL_TC_BCPB_CLEAR (2 << 24) 2288c2ecf20Sopenharmony_ci#define ATMEL_TC_BCPB_TOGGLE (3 << 24) 2298c2ecf20Sopenharmony_ci#define ATMEL_TC_BCPC (3 << 26) /* RC compare changes TIOB */ 2308c2ecf20Sopenharmony_ci#define ATMEL_TC_BCPC_NONE (0 << 26) 2318c2ecf20Sopenharmony_ci#define ATMEL_TC_BCPC_SET (1 << 26) 2328c2ecf20Sopenharmony_ci#define ATMEL_TC_BCPC_CLEAR (2 << 26) 2338c2ecf20Sopenharmony_ci#define ATMEL_TC_BCPC_TOGGLE (3 << 26) 2348c2ecf20Sopenharmony_ci#define ATMEL_TC_BEEVT (3 << 28) /* external event changes TIOB */ 2358c2ecf20Sopenharmony_ci#define ATMEL_TC_BEEVT_NONE (0 << 28) 2368c2ecf20Sopenharmony_ci#define ATMEL_TC_BEEVT_SET (1 << 28) 2378c2ecf20Sopenharmony_ci#define ATMEL_TC_BEEVT_CLEAR (2 << 28) 2388c2ecf20Sopenharmony_ci#define ATMEL_TC_BEEVT_TOGGLE (3 << 28) 2398c2ecf20Sopenharmony_ci#define ATMEL_TC_BSWTRG (3 << 30) /* software trigger changes TIOB */ 2408c2ecf20Sopenharmony_ci#define ATMEL_TC_BSWTRG_NONE (0 << 30) 2418c2ecf20Sopenharmony_ci#define ATMEL_TC_BSWTRG_SET (1 << 30) 2428c2ecf20Sopenharmony_ci#define ATMEL_TC_BSWTRG_CLEAR (2 << 30) 2438c2ecf20Sopenharmony_ci#define ATMEL_TC_BSWTRG_TOGGLE (3 << 30) 2448c2ecf20Sopenharmony_ci 2458c2ecf20Sopenharmony_ci#define ATMEL_TC_CV 0x10 /* counter Value */ 2468c2ecf20Sopenharmony_ci#define ATMEL_TC_RA 0x14 /* register A */ 2478c2ecf20Sopenharmony_ci#define ATMEL_TC_RB 0x18 /* register B */ 2488c2ecf20Sopenharmony_ci#define ATMEL_TC_RC 0x1c /* register C */ 2498c2ecf20Sopenharmony_ci 2508c2ecf20Sopenharmony_ci#define ATMEL_TC_SR 0x20 /* status (read-only) */ 2518c2ecf20Sopenharmony_ci/* Status-only flags */ 2528c2ecf20Sopenharmony_ci#define ATMEL_TC_CLKSTA (1 << 16) /* clock enabled */ 2538c2ecf20Sopenharmony_ci#define ATMEL_TC_MTIOA (1 << 17) /* TIOA mirror */ 2548c2ecf20Sopenharmony_ci#define ATMEL_TC_MTIOB (1 << 18) /* TIOB mirror */ 2558c2ecf20Sopenharmony_ci 2568c2ecf20Sopenharmony_ci#define ATMEL_TC_IER 0x24 /* interrupt enable (write-only) */ 2578c2ecf20Sopenharmony_ci#define ATMEL_TC_IDR 0x28 /* interrupt disable (write-only) */ 2588c2ecf20Sopenharmony_ci#define ATMEL_TC_IMR 0x2c /* interrupt mask (read-only) */ 2598c2ecf20Sopenharmony_ci 2608c2ecf20Sopenharmony_ci/* Status and IRQ flags */ 2618c2ecf20Sopenharmony_ci#define ATMEL_TC_COVFS (1 << 0) /* counter overflow */ 2628c2ecf20Sopenharmony_ci#define ATMEL_TC_LOVRS (1 << 1) /* load overrun */ 2638c2ecf20Sopenharmony_ci#define ATMEL_TC_CPAS (1 << 2) /* RA compare */ 2648c2ecf20Sopenharmony_ci#define ATMEL_TC_CPBS (1 << 3) /* RB compare */ 2658c2ecf20Sopenharmony_ci#define ATMEL_TC_CPCS (1 << 4) /* RC compare */ 2668c2ecf20Sopenharmony_ci#define ATMEL_TC_LDRAS (1 << 5) /* RA loading */ 2678c2ecf20Sopenharmony_ci#define ATMEL_TC_LDRBS (1 << 6) /* RB loading */ 2688c2ecf20Sopenharmony_ci#define ATMEL_TC_ETRGS (1 << 7) /* external trigger */ 2698c2ecf20Sopenharmony_ci#define ATMEL_TC_ALL_IRQ (ATMEL_TC_COVFS | ATMEL_TC_LOVRS | \ 2708c2ecf20Sopenharmony_ci ATMEL_TC_CPAS | ATMEL_TC_CPBS | \ 2718c2ecf20Sopenharmony_ci ATMEL_TC_CPCS | ATMEL_TC_LDRAS | \ 2728c2ecf20Sopenharmony_ci ATMEL_TC_LDRBS | ATMEL_TC_ETRGS) \ 2738c2ecf20Sopenharmony_ci /* all IRQs */ 2748c2ecf20Sopenharmony_ci 2758c2ecf20Sopenharmony_ci#endif 276