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
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
|
/*
* Copyright (c) 2014 Samsung Electronics Co., Ltd.
* http://www.samsung.com
*
* Author: Sung-Hyun Na <sunghyun.na@samsung.com>
*
* USBPHY configuration definitions for Samsung USB PHY 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.
*
* 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.
*/
#ifndef __PHY_SAMSUNG_USB_FW_CAL_H__
#define __PHY_SAMSUNG_USB_FW_CAL_H__
#define EXYNOS_USBCON_VER_01_0_0 0x0100 /* Istor */
#define EXYNOS_USBCON_VER_01_0_1 0x0101 /* JF 3.0 */
#define EXYNOS_USBCON_VER_01_1_1 0x0111 /* KC */
#define EXYNOS_USBCON_VER_01_MAX 0x01FF
#define EXYNOS_USBCON_VER_02_0_0 0x0200 /* Insel-D, Island */
#define EXYNOS_USBCON_VER_02_0_1 0x0201 /* JF EVT0 2.0 Host */
#define EXYNOS_USBCON_VER_02_1_0 0x0210
#define EXYNOS_USBCON_VER_02_1_1 0x0211 /* JF EVT1 2.0 Host */
#define EXYNOS_USBCON_VER_02_1_2 0x0212 /* Katmai EVT0 */
#define EXYNOS_USBCON_VER_02_MAX 0x02FF
#define EXYNOS_USBCON_VER_03_0_0 0x0300 /* Lhotse, Lassen HS */
#define EXYNOS_USBCON_VER_03_0_1 0x0301 /* Super Speed */
#define EXYNOS_USBCON_VER_03_MAX 0x03FF
#define EXYNOS_USBCON_VER_04_0_0 0x0400 /* Lhotse - USB/DP */
#define EXYNOS_USBCON_VER_04_MAX 0x04FF
/* Sub phy control - not include System/Link control */
#define EXYNOS_USBCON_VER_05_0_0 0x0500 /* High Speed Only */
#define EXYNOS_USBCON_VER_05_1_0 0x0510 /* Super Speed */
#define EXYNOS_USBCON_VER_05_3_0 0x0530 /* Super Speed Dual PHY */
#define EXYNOS_USBCON_VER_05_MAX 0x05FF
#define EXYNOS_USBCON_VER_F2_0_0 0xF200
#define EXYNOS_USBCON_VER_F2_MAX 0xF2FF
#define EXYNOS_USBCON_VER_MAJOR_VER_MASK 0xFF00
#define EXYNOS_USBCON_VER_SS_CAP 0x0010
enum exynos_usbphy_mode {
USBPHY_MODE_DEV = 0,
USBPHY_MODE_HOST = 1,
/* usb phy for uart bypass mode */
USBPHY_MODE_BYPASS = 0x10,
};
enum exynos_usbphy_refclk {
USBPHY_REFCLK_DIFF_100MHZ = 0x80 | 0x27,
USBPHY_REFCLK_DIFF_52MHZ = 0x80 | 0x02 | 0x40,
USBPHY_REFCLK_DIFF_26MHZ = 0x80 | 0x02,
USBPHY_REFCLK_DIFF_24MHZ = 0x80 | 0x2a,
USBPHY_REFCLK_DIFF_20MHZ = 0x80 | 0x31,
USBPHY_REFCLK_DIFF_19_2MHZ = 0x80 | 0x38,
USBPHY_REFCLK_EXT_50MHZ = 0x07,
USBPHY_REFCLK_EXT_26MHZ = 0x06,
USBPHY_REFCLK_EXT_24MHZ = 0x05,
USBPHY_REFCLK_EXT_20MHZ = 0x04,
USBPHY_REFCLK_EXT_12MHZ = 0x02,
};
enum exynos_usbphy_refsel {
USBPHY_REFSEL_CLKCORE = 0x2,
USBPHY_REFSEL_EXT_OSC = 0x1,
USBPHY_REFSEL_EXT_XTAL = 0x0,
USBPHY_REFSEL_DIFF_PAD = 0x6,
USBPHY_REFSEL_DIFF_INTERNAL = 0x4,
USBPHY_REFSEL_DIFF_SINGLE = 0x3,
};
enum exynos_usbphy_utmi {
USBPHY_UTMI_FREECLOCK, USBPHY_UTMI_PHYCLOCK,
};
enum exynos_usbphy_tune_para {
USBPHY_TUNE_HS_COMPDIS = 0x0,
USBPHY_TUNE_HS_OTG = 0x1,
USBPHY_TUNE_HS_SQRX = 0x2,
USBPHY_TUNE_HS_TXFSLS = 0x3,
USBPHY_TUNE_HS_TXHSXV = 0x4,
USBPHY_TUNE_HS_TXPREEMP = 0x5,
USBPHY_TUNE_HS_TXPREEMP_PLUS = 0x6,
USBPHY_TUNE_HS_TXRES = 0x7,
USBPHY_TUNE_HS_TXRISE = 0x8,
USBPHY_TUNE_HS_TXVREF = 0x9,
USBPHY_TUNE_SS_TX_BOOST = 0x0 | 0x10000,
USBPHY_TUNE_SS_TX_SWING = 0x1 | 0x10000,
USBPHY_TUNE_SS_TX_DEEMPHASIS = 0x2 | 0x10000,
USBPHY_TUNE_SS_LOS_BIAS = 0x3 | 0x10000,
USBPHY_TUNE_SS_LOS_MASK_VAL = 0x4 | 0x10000,
USBPHY_TUNE_SS_FIX_EQ = 0x5 | 0x10000,
USBPHY_TUNE_SS_RX_EQ = 0x6 | 0x10000,
USBPHY_TUNE_COMBO = 0x20000,
USBPHY_TUNE_COMBO_TX_AMP = USBPHY_TUNE_COMBO | 0x0,
USBPHY_TUNE_COMBO_TX_EMPHASIS = USBPHY_TUNE_COMBO | 0x1,
USBPHY_TUNE_COMBO_TX_IDRV = USBPHY_TUNE_COMBO | 0x2,
USBPHY_TUNE_COMBO_TX_ACCDRV = USBPHY_TUNE_COMBO | 0x3,
};
struct exynos_usb_tune_param {
char name[20];
u32 value;
};
#define EXYNOS_USB_TUNE_LAST 0x4C415354
/* HS PHY tune parameter */
struct exynos_usbphy_hs_tune {
u8 tx_vref;
u8 tx_pre_emp;
u8 tx_pre_emp_plus;
u8 tx_res;
u8 tx_rise;
u8 tx_hsxv;
u8 tx_fsls;
u8 rx_sqrx;
u8 compdis;
u8 otg;
bool enable_user_imp;
u8 user_imp_value;
enum exynos_usbphy_utmi utmi_clk;
};
/* SS PHY tune parameter */
struct exynos_usbphy_ss_tune {
/* TX Swing Level*/
u8 tx_boost_level;
u8 tx_swing_level;
u8 tx_swing_full;
u8 tx_swing_low;
/* TX De-Emphasis */
u8 tx_deemphasis_mode;
u8 tx_deemphasis_3p5db;
u8 tx_deemphasis_6db;
/* SSC Operation*/
u8 enable_ssc;
u8 ssc_range;
/* Loss-of-Signal detector threshold level */
u8 los_bias;
/* Loss-of-Signal mask width */
u16 los_mask_val;
/* RX equalizer mode */
u8 enable_fixed_rxeq_mode;
u8 fix_rxeq_value;
/* Decrease TX Impedance */
u8 decrease_ss_tx_imp;
u8 set_crport_level_en;
u8 set_crport_mpll_charge_pump;
/* RX LFPS(decode) mode */
u8 rx_decode_mode;
};
/**
* struct exynos_usbphy_info : USBPHY information to share USBPHY CAL code
* @version: PHY controller version
* 0x0100 - for EXYNOS_USB3 : EXYNOS7420, EXYNOS7890
* 0x0101 - EXYNOS8890
* 0x0111 - EXYNOS8895
* 0x0200 - for EXYNOS_USB2 : EXYNOS7580, EXYNOS3475
* 0x0210 - EXYNOS8890_EVT1
* 0xF200 - for EXT : EXYNOS7420_HSIC
* @refclk: reference clock frequency for USBPHY
* @refsrc: reference clock source path for USBPHY
* @use_io_for_ovc: use over-current notification io for USBLINK
* @regs_base: base address of PHY control register *
*/
struct exynos_usbphy_info {
/* Device Information */
struct device *dev;
u32 version;
enum exynos_usbphy_refclk refclk;
enum exynos_usbphy_refsel refsel;
bool use_io_for_ovc;
bool common_block_disable;
bool not_used_vbus_pad;
void __iomem *regs_base;
/* HS PHY tune parameter */
struct exynos_usbphy_hs_tune *hs_tune;
/* SS PHY tune parameter */
struct exynos_usbphy_ss_tune *ss_tune;
/* Tune Parma list */
struct exynos_usb_tune_param *tune_param;
/* multiple phy */
int hw_version;
void __iomem *regs_base_2nd;
int used_phy_port;
/* Alternative PHY REF_CLK source */
bool alt_ref_clk;
/* Remote Wake-up Advisor */
unsigned hs_rewa :1;
/* Dual PHY */
bool dual_phy;
};
#endif /* __PHY_SAMSUNG_USB_FW_CAL_H__ */
|