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
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
|
/*
* linux/arch/arm/mach-exynos/include/mach/asv-exynos5_cal.h
*
* Copyright (c) 2014 Samsung Electronics Co., Ltd.
* http://www.samsung.com/
*
* EXYNOS5 - support ASV drvier to interact with cal.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*/
#ifndef __ASM_ARCH_NEW_EXYNOS5_ASV_CAL_H
#define __ASM_ARCH_NEW_EXYNOS5_ASV_CAL_H __FILE__
/* Use by ASV drvier */
#ifdef CONFIG_SOC_EXYNOS5433
#include <linux/io.h>
#include <mach/map.h>
#include <mach/otp.h>
u32 re_err(void);
#define Assert(b) (!(b) ? re_err() : 0)
#define SetBits(uAddr, uBaseBit, uMaskValue, uSetValue) \
do { \
__raw_writel((__raw_readl((const volatile void __iomem *)uAddr) & \
~((uMaskValue) << (uBaseBit))) | \
(((uMaskValue) & (uSetValue)) << (uBaseBit)), uAddr) \
} while (0);
#define GetBits(uAddr, uBaseBit, uMaskValue) \
((__raw_readl((const volatile void __iomem *) uAddr) >> (uBaseBit)) & (uMaskValue))
#define CHIPID_BASE S5P_VA_CHIPID
#define CHIPID_ASV_TBL_BASE S5P_VA_CHIPID2
#define CHIPID_ABB_TBL_BASE S5P_VA_CHIPID3
#define SYSREG_EGL_BASE S5P_VA_CHIPID4
#define CHIPID_ABBG_BASE S5P_VA_CHIPID5
/* Use by CAL */
#else
#ifndef __cplusplus
#define false (0)
#define true (1)
#endif
typedef unsigned char bool;
typedef unsigned long long u64;
typedef unsigned int u32;
typedef unsigned short u16;
typedef unsigned char u8;
typedef signed long long s64;
typedef signed int s32;
typedef signed short s16;
typedef signed char s8;
#define __raw_writel(addr, data) (*(volatile u32 *)(addr) = (data))
#define __raw_readl(addr) (*(volatile u32 *)(addr))
#define NULL 0
#define SetBits(uAddr, uBaseBit, uMaskValue, uSetValue) \
do { \
__raw_writel(uAddr, (__raw_readl(uAddr) & \
~((uMaskValue) << (uBaseBit))) | \
(((uMaskValue)&(uSetValue)) << (uBaseBit))) \
} while (0);
#define GetBits(uAddr, uBaseBit, uMaskValue) \
((__raw_readl(uAddr) >> (uBaseBit)) & (uMaskValue))
u32 stop (void)
{
while (1) {
};
return 1;
}
#define Assert(b) (!(b) ? stop() : 0)
#define CHIPID_BASE 0x10000000
#define CHIPID_ASV_TBL_BASE 0x10004000
#define CHIPID_ABB_TBL_BASE 0x105D0000
#define SYSREG_EGL_BASE 0x11810000
#define CHIPID_ABBG_BASE 0x105C0000
#endif
/* COMMON code */
#define ENABLE (1)
#define DISABLE (0)
#define PKG_ID (CHIPID_BASE + 0x0004)
#define PRODUCT_ID (CHIPID_BASE + 0x0000)
#define ABB_X060 0
#define ABB_X065 1
#define ABB_X070 2
#define ABB_X075 3
#define ABB_X080 4
#define ABB_X085 5
#define ABB_X090 6
#define ABB_X095 7
#define ABB_X100 8
#define ABB_X105 9
#define ABB_X110 10
#define ABB_X115 11
#define ABB_X120 12
#define ABB_X125 13
#define ABB_X130 14
#define ABB_X135 15
#define ABB_X140 16
#define ABB_X145 17
#define ABB_X150 18
#define ABB_X155 19
#define ABB_X160 20
#define ABB_BYPASS 255
enum SYSC_DVFS_SEL {
SYSC_DVFS_EGL,
SYSC_DVFS_KFC,
SYSC_DVFS_INT,
SYSC_DVFS_MIF,
SYSC_DVFS_G3D,
SYSC_DVFS_CAM,
SYSC_DVFS_NUM
};
enum SYSC_DVFS_LVL {
SYSC_DVFS_L0 = 0,
SYSC_DVFS_L1,
SYSC_DVFS_L2,
SYSC_DVFS_L3,
SYSC_DVFS_L4,
SYSC_DVFS_L5,
SYSC_DVFS_L6,
SYSC_DVFS_L7,
SYSC_DVFS_L8,
SYSC_DVFS_L9,
SYSC_DVFS_L10,
SYSC_DVFS_L11,
SYSC_DVFS_L12,
SYSC_DVFS_L13,
SYSC_DVFS_L14,
SYSC_DVFS_L15,
SYSC_DVFS_L16,
SYSC_DVFS_L17,
SYSC_DVFS_L18,
SYSC_DVFS_L19,
SYSC_DVFS_L20,
SYSC_DVFS_L21,
SYSC_DVFS_L22,
SYSC_DVFS_L23,
SYSC_DVFS_L24,
};
enum SYSC_ASV_GROUP {
SYSC_ASV_0 = 0,
SYSC_ASV_1,
SYSC_ASV_2,
SYSC_ASV_3,
SYSC_ASV_4,
SYSC_ASV_5 = 5,
SYSC_ASV_6,
SYSC_ASV_7,
SYSC_ASV_8,
SYSC_ASV_9,
SYSC_ASV_10,
SYSC_ASV_11 = 11,
SYSC_ASV_12 = 12,
SYSC_ASV_13,
SYSC_ASV_14,
SYSC_ASV_15 = 15,
SYSC_ASV_MAX /* ASV limit */
};
void cal_init(void);
s32 cal_get_max_lv(u32 id);
s32 cal_get_min_lv(u32 id);
u32 cal_get_volt(u32 id, s32 level);
u32 cal_get_freq(u32 id, s32 level);
u32 cal_get_abb(u32 id, s32 level);
bool cal_use_dynimic_abb(u32 id);
void cal_set_abb(u32 id, u32 abb);
void cal_set_ema(u32 id , u32 setvolt);
bool cal_use_dynimic_ema(u32 id);
u32 cal_get_ids_group(void);
u32 cal_get_table_ver(void);
u32 cal_get_dram_size(void);
bool cal_is_fused_speed_grp(void);
u32 cal_get_ids(void);
u32 cal_get_asv_grp(u32 id, s32 level);
u32 is_max_limit_sample(void);
#endif
|