blob: 7a33ed895b55d68c162858e2d92ff21b3616602a [file] [log] [blame]
Minkyu Kang399e5ae2009-10-01 17:20:01 +09001/*
2 * Copyright (C) 2009 Samsung Electronics
3 * Kyungmin Park <kyungmin.park@samsung.com>
4 * Minkyu Kang <mk7.kang@samsung.com>
5 *
Wolfgang Denk1a459662013-07-08 09:37:19 +02006 * SPDX-License-Identifier: GPL-2.0+
Minkyu Kang399e5ae2009-10-01 17:20:01 +09007 */
8
9#ifndef __ASM_ARM_ARCH_PWM_H_
10#define __ASM_ARM_ARCH_PWM_H_
11
Donghwa Lee3f129282011-03-07 21:11:42 +000012#define PRESCALER_0 (8 - 1) /* prescaler of timer 0, 1 */
13#define PRESCALER_1 (16 - 1) /* prescaler of timer 2, 3, 4 */
14
15/* Divider MUX */
16#define MUX_DIV_1 0 /* 1/1 period */
17#define MUX_DIV_2 1 /* 1/2 period */
18#define MUX_DIV_4 2 /* 1/4 period */
19#define MUX_DIV_8 3 /* 1/8 period */
20#define MUX_DIV_16 4 /* 1/16 period */
21
22#define MUX_DIV_SHIFT(x) (x * 4)
23
Donghwa Lee3f129282011-03-07 21:11:42 +000024#define TCON_OFFSET(x) ((x + 1) * (!!x) << 2)
25
26#define TCON_START(x) (1 << TCON_OFFSET(x))
27#define TCON_UPDATE(x) (1 << (TCON_OFFSET(x) + 1))
28#define TCON_INVERTER(x) (1 << (TCON_OFFSET(x) + 2))
29#define TCON_AUTO_RELOAD(x) (1 << (TCON_OFFSET(x) + 3))
Minkyu Kang70fc52d2011-03-10 20:05:58 +090030#define TCON4_AUTO_RELOAD (1 << 22)
Donghwa Lee3f129282011-03-07 21:11:42 +000031
Minkyu Kang399e5ae2009-10-01 17:20:01 +090032#ifndef __ASSEMBLY__
Minkyu Kang37168da2010-08-19 20:41:50 +090033struct s5p_timer {
Minkyu Kangf3807372009-10-15 11:19:15 +090034 unsigned int tcfg0;
35 unsigned int tcfg1;
36 unsigned int tcon;
37 unsigned int tcntb0;
38 unsigned int tcmpb0;
39 unsigned int tcnto0;
40 unsigned int tcntb1;
41 unsigned int tcmpb1;
42 unsigned int tcnto1;
43 unsigned int tcntb2;
44 unsigned int tcmpb2;
45 unsigned int tcnto2;
46 unsigned int tcntb3;
47 unsigned int res1;
48 unsigned int tcnto3;
49 unsigned int tcntb4;
50 unsigned int tcnto4;
51 unsigned int tintcstat;
Minkyu Kang399e5ae2009-10-01 17:20:01 +090052};
53#endif /* __ASSEMBLY__ */
54
55#endif