xref: /OK3568_Linux_fs/u-boot/include/sh_tmu.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun /*
2*4882a593Smuzhiyun  * Copyright (C) 2012  Renesas Solutions Corp.
3*4882a593Smuzhiyun  *
4*4882a593Smuzhiyun  * See file CREDITS for list of people who contributed to this
5*4882a593Smuzhiyun  * project.
6*4882a593Smuzhiyun  *
7*4882a593Smuzhiyun  * This program is free software; you can redistribute it and/or
8*4882a593Smuzhiyun  * modify it under the terms of the GNU General Public License as
9*4882a593Smuzhiyun  * published by the Free Software Foundation; either version 2 of
10*4882a593Smuzhiyun  * the License.
11*4882a593Smuzhiyun  *
12*4882a593Smuzhiyun  * This program is distributed in the hope that it will be useful,
13*4882a593Smuzhiyun  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14*4882a593Smuzhiyun  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15*4882a593Smuzhiyun  * GNU General Public License for more details.
16*4882a593Smuzhiyun  *
17*4882a593Smuzhiyun  * You should have received a copy of the GNU General Public License
18*4882a593Smuzhiyun  * along with this program; if not, write to the Free Software
19*4882a593Smuzhiyun  * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
20*4882a593Smuzhiyun  * MA 02111-1307 USA
21*4882a593Smuzhiyun  */
22*4882a593Smuzhiyun 
23*4882a593Smuzhiyun #ifndef __SH_TMU_H
24*4882a593Smuzhiyun #define __SH_TMU_H
25*4882a593Smuzhiyun 
26*4882a593Smuzhiyun #include <asm/types.h>
27*4882a593Smuzhiyun 
28*4882a593Smuzhiyun #if defined(CONFIG_CPU_SH3)
29*4882a593Smuzhiyun struct tmu_regs {
30*4882a593Smuzhiyun 	u8	tocr;
31*4882a593Smuzhiyun 	u8	reserved0;
32*4882a593Smuzhiyun 	u8	tstr;
33*4882a593Smuzhiyun 	u8	reserved1;
34*4882a593Smuzhiyun 	u32	tcor0;
35*4882a593Smuzhiyun 	u32	tcnt0;
36*4882a593Smuzhiyun 	u16	tcr0;
37*4882a593Smuzhiyun 	u16	reserved2;
38*4882a593Smuzhiyun 	u32	tcor1;
39*4882a593Smuzhiyun 	u32	tcnt1;
40*4882a593Smuzhiyun 	u16	tcr1;
41*4882a593Smuzhiyun 	u16	reserved3;
42*4882a593Smuzhiyun 	u32	tcor2;
43*4882a593Smuzhiyun 	u32	tcnt2;
44*4882a593Smuzhiyun 	u16	tcr2;
45*4882a593Smuzhiyun 	u16	reserved4;
46*4882a593Smuzhiyun 	u32	tcpr2;
47*4882a593Smuzhiyun };
48*4882a593Smuzhiyun #endif /* CONFIG_CPU_SH3 */
49*4882a593Smuzhiyun 
50*4882a593Smuzhiyun #if defined(CONFIG_CPU_SH4) || defined(CONFIG_ARCH_RMOBILE)
51*4882a593Smuzhiyun struct tmu_regs {
52*4882a593Smuzhiyun 	u32 reserved;
53*4882a593Smuzhiyun 	u8  tstr;
54*4882a593Smuzhiyun 	u8  reserved2[3];
55*4882a593Smuzhiyun 	u32 tcor0;
56*4882a593Smuzhiyun 	u32 tcnt0;
57*4882a593Smuzhiyun 	u16 tcr0;
58*4882a593Smuzhiyun 	u16 reserved3;
59*4882a593Smuzhiyun 	u32 tcor1;
60*4882a593Smuzhiyun 	u32 tcnt1;
61*4882a593Smuzhiyun 	u16 tcr1;
62*4882a593Smuzhiyun 	u16 reserved4;
63*4882a593Smuzhiyun 	u32 tcor2;
64*4882a593Smuzhiyun 	u32 tcnt2;
65*4882a593Smuzhiyun 	u16 tcr2;
66*4882a593Smuzhiyun 	u16 reserved5;
67*4882a593Smuzhiyun };
68*4882a593Smuzhiyun #endif /* CONFIG_CPU_SH4 */
69*4882a593Smuzhiyun 
get_tmu0_clk_rate(void)70*4882a593Smuzhiyun static inline unsigned long get_tmu0_clk_rate(void)
71*4882a593Smuzhiyun {
72*4882a593Smuzhiyun 	return CONFIG_SH_TMU_CLK_FREQ;
73*4882a593Smuzhiyun }
74*4882a593Smuzhiyun 
75*4882a593Smuzhiyun #endif	/* __SH_TMU_H */
76