Lines Matching refs:ch

47 #define TCFG0_BIT_CH(ch)		((ch) == 0 || (ch) == 1 ? 0 : 8)  argument
48 #define TCFG1_BIT_CH(ch) ((ch) * 4) argument
49 #define TCON_BIT_CH(ch) ((ch) ? (ch) * 4 + 4 : 0) argument
50 #define TINT_CH(ch) (ch) argument
51 #define TINT_CSTAT_BIT_CH(ch) ((ch) + 5) argument
61 static inline void timer_clock(void __iomem *base, int ch, int mux, int scl) in timer_clock() argument
63 u32 val = readl(base + REG_TCFG0) & ~(0xFF << TCFG0_BIT_CH(ch)); in timer_clock()
65 writel(val | ((scl - 1) << TCFG0_BIT_CH(ch)), base + REG_TCFG0); in timer_clock()
66 val = readl(base + REG_TCFG1) & ~(0xF << TCFG1_BIT_CH(ch)); in timer_clock()
67 writel(val | (mux << TCFG1_BIT_CH(ch)), base + REG_TCFG1); in timer_clock()
70 static inline void timer_count(void __iomem *base, int ch, unsigned int cnt) in timer_count() argument
72 writel((cnt - 1), base + REG_TCNTB0 + (TIMER_TCNT_OFFS * ch)); in timer_count()
73 writel((cnt - 1), base + REG_TCMPB0 + (TIMER_TCNT_OFFS * ch)); in timer_count()
76 static inline void timer_start(void __iomem *base, int ch) in timer_start() argument
79 u32 val = readl(base + REG_CSTAT) & ~(TINT_CSTAT_MASK << 5 | 0x1 << ch); in timer_start()
81 writel(val | (0x1 << TINT_CSTAT_BIT_CH(ch) | on << ch), in timer_start()
83 val = readl(base + REG_TCON) & ~(0xE << TCON_BIT_CH(ch)); in timer_start()
84 writel(val | (TCON_BIT_UP << TCON_BIT_CH(ch)), base + REG_TCON); in timer_start()
86 val &= ~(TCON_BIT_UP << TCON_BIT_CH(ch)); in timer_start()
87 val |= ((TCON_BIT_AUTO | TCON_BIT_RUN) << TCON_BIT_CH(ch)); in timer_start()
92 static inline void timer_stop(void __iomem *base, int ch) in timer_stop() argument
95 u32 val = readl(base + REG_CSTAT) & ~(TINT_CSTAT_MASK << 5 | 0x1 << ch); in timer_stop()
97 writel(val | (0x1 << TINT_CSTAT_BIT_CH(ch) | on << ch), in timer_stop()
99 val = readl(base + REG_TCON) & ~(TCON_BIT_RUN << TCON_BIT_CH(ch)); in timer_stop()
103 static inline unsigned long timer_read(void __iomem *base, int ch) in timer_read() argument
107 ret = TIMER_COUNT - readl(base + REG_TCNT0 + (TIMER_TCNT_OFFS * ch)); in timer_read()
115 int ch = CONFIG_TIMER_SYS_TICK_CH; in timer_init() local
148 timer_stop(base, ch); in timer_init()
149 timer_clock(base, ch, tmux, tscl); in timer_init()
150 timer_count(base, ch, tcnt); in timer_init()
151 timer_start(base, ch); in timer_init()
182 int ch = CONFIG_TIMER_SYS_TICK_CH; in reset_timer_masked() local
186 lastdec = timer_read(base, ch); in reset_timer_masked()
194 int ch = CONFIG_TIMER_SYS_TICK_CH; in get_timer_masked() local
196 unsigned long now = timer_read(base, ch); /* current tick value */ in get_timer_masked()