summaryrefslogtreecommitdiff
path: root/arch/arm/mach-wmt/wmt_clk.h
blob: 6160f0a98dc7dab47a811a4860b3ae348cc469bf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
/*++
linux/arch/arm/mach-wmt/wmt_clk.h

Copyright (c) 2008  WonderMedia Technologies, Inc.

This program is free software: you can redistribute it and/or modify it under the
terms of the GNU General Public License as published by the Free Software Foundation,
either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.  See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with
this program.  If not, see <http://www.gnu.org/licenses/>.

WonderMedia Technologies, Inc.
10F, 529, Chung-Cheng Road, Hsin-Tien, Taipei 231, R.O.C.
--*/
#ifndef _WMT_CLK_H_
#define _WMT_CLK_H_

/*
 *   WMT_CLK register struct
 *
 */

enum dev_id {
 DEV_SDMMC0 = 0, /* PMC lower register offset PMC OFFSET + 0x250*/
 DEV_SDMMC1 = 1,
 DEV_SDMMC2 = 2,
 /*DEV_SDMMC3 = 3,
 DEV_ETHMAC = 4,*/
 DEV_C24MOUT = 6,/*DEV_ETHPHY = 6,*/
 DEV_RTC = 7,
 DEV_I2C0 = 8,
 DEV_I2C1 = 9,
 DEV_I2C2 = 10,
 DEV_GPIO = 11,
 DEV_I2C3 = 12,
 /*DEV_KEYPAD = 14,*/
 DEV_CNMVDU = 15,/*DEV_EBM = 15,*/
 DEV_PAXI = 16,
 DEV_PWM = 17,
 DEV_ADC = 18,
 DEV_I2C4 = 19,
 DEV_SCC = 21,
 DEV_SYS = 22,
 DEV_AMP = 24,
 DEV_MALI = 26,
 DEV_PCM0 = 27,
 DEV_PCM1 = 28,
 DEV_PERM = 30,
 DEV_MBOX = 31,
 

 DEV_DDRMC = 32, /* PMC upper register offset 0xd8130254 */
 DEV_ARF   = 32+3,
 DEV_ARFP  = 32+4,
 DEV_DMA   = 32+5,
 DEV_PDMA  = 32+6,
 /*DEV_VDMA  = 32+7,*/
 DEV_UHDC  = 32+9,
 DEV_AHBB  = 32+13,
 DEV_NAND  = 32+16,
 /*DEV_NOR   = 32+17,*/
 DEV_SPI0  = 32+19,
 DEV_SPI1  = 32+20,
 DEV_SF    = 32+23,
 DEV_UART0 = 32+24,
 DEV_UART1 = 32+25,
 DEV_UART2 = 32+26,
 DEV_UART3 = 32+27,
 DEV_CSI0 = 32+28,/*DEV_UART4 = 32+28,*/
 DEV_CSI1 = 32+29,/*DEV_UART5 = 32+29,*/

 DEV_WMTNA   = 64,/*DEV_NA0   = 64,*/ /* PMC upper register offset 0xd8130258 */
 /*DEV_NA0REF= 64+1,*/
 DEV_CNMNA = 64+2,
 DEV_JDEC  = 64+3,
 DEV_MSVD  = 64+4,
 DEV_VP8DEC= 64+5,
 DEV_SAE   = 64+6,
 DEV_HDCE  = 64+7,
 DEV_H264  = 64+8,
 DEV_JENC  = 64+9,
 DEV_LVDS  = 64+14,
 DEV_CIR   = 64+15,
 DEV_NA12  = 64+16,
 DEV_VPU   = 64+17,
 DEV_VPP   = 64+18,
 DEV_VID   = 64+19,
 DEV_WMTVDU  = 64+20,/*DEV_VDU   = 64+20,*/
 DEV_SCL444U = 64+21,
 DEV_HDMII2C = 64+22,
 DEV_HDMI  = 64+23,
 DEV_GOVW  = 64+24,
 DEV_GOVRHD= 64+25,
 DEV_GE    = 64+26,
 DEV_DISP  = 64+27,
 DEV_DVO   = 64+29,
 DEV_HDMILVDS = 64+30,
 DEV_SDTV  = 64+31,
 
 DEV_I2S   = 96+2, /* PMC upper register offset 0xd8130258 */
 /*DEV_ROT,			
 DEV_XD,*/


 DEV_ARM, /* number >= 128 has no clk_en to enable clk */
 DEV_AHB,
 DEV_APB,
 DEV_L2C,
 DEV_L2CAXI,
 DEV_L2CPAXI,
 DEV_AT,
 DEV_PERI,
 DEV_TRACE,
 DEV_DBG,
};

enum clk_cmd {
CLK_DISABLE = 0,
GET_FREQ,
CLK_ENABLE,
SET_DIV,
SET_PLL,
SET_PLLDIV,
GET_CPUTIMER
};

enum power_cmd {
DEV_PWRON = 0,
DEV_PWROFF,
DEV_PWRSTS,
};

struct plla_param {
unsigned int plla_clk;
unsigned int arm_div;
unsigned int l2c_div;
unsigned int l2c_tag_div;
unsigned int l2c_data_div;
unsigned int axi_div;
unsigned int tb_index;
};

struct pll_map {
unsigned int freq;
unsigned int pll;
};

enum wmt_mmfreq_type {
	WMT_MMFREQ_HDMI_PLUG = 0x01,
	WMT_MMFREQ_MIRACAST = 0x02,
	WMT_MMFREQ_MULTI_VD = 0x04
};

extern int auto_pll_divisor(enum dev_id dev, enum clk_cmd cmd, int unit, int freq);
extern int manu_pll_divisor(enum dev_id dev, int DIVF, int DIVR, int DIVQ, int dev_div);
extern int set_plla_divisor(struct plla_param *plla_env);
extern int wmt_power_dev(enum dev_id dev, enum power_cmd cmd);
extern void wmt_resume_mmfreq(void);
extern void wmt_suspend_mmfreq(void);
extern void wmt_set_mmfreq(int num);
extern void wmt_enable_mmfreq(enum wmt_mmfreq_type type, int enable);
#endif /* __WMT_CLK_H__*/