6b13f685e
김민수
BSP 최초 추가
|
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
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
|
#ifndef _EHCI_FSL_H
#define _EHCI_FSL_H
#include <asm/processor.h>
#define CONTROL_REGISTER_W1C_MASK 0x00020000 /* W1C: PHY_CLK_VALID */
#define FSL_SKIP_PCI 0x100
#define FSL_SOC_USB_ULPIVP 0x170
#define FSL_SOC_USB_PORTSC1 0x184
#define PORT_PTS_MSK (3 << 30)
#define PORT_PTS_UTMI (0 << 30)
#define PORT_PTS_ULPI (2 << 30)
#define PORT_PTS_SERIAL (3 << 30)
#define PORT_PTS_PTW (1 << 28)
#define PORT_PFSC (1 << 24) /* Defined on Page 39-44 of the mpc5151 ERM */
#define PORT_PTS_PHCD (1 << 23)
#define PORT_PP (1 << 12)
#define PORT_PR (1 << 8)
#define CM_IDLE (0 << 0)
#define CM_RESERVED (1 << 0)
#define CM_DEVICE (2 << 0)
#define CM_HOST (3 << 0)
#define ES_BE (1 << 2) /* Big Endian Select, default is LE */
#define USBMODE_RESERVED_2 (0 << 2)
#define SLOM (1 << 3)
#define SDIS (1 << 4)
#define ULPI_INT_EN (1 << 0)
#define WU_INT_EN (1 << 1)
#define USB_EN (1 << 2)
#define LSF_EN (1 << 3)
#define KEEP_OTG_ON (1 << 4)
#define OTG_PORT (1 << 5)
#define REFSEL_12MHZ (0 << 6)
#define REFSEL_16MHZ (1 << 6)
#define REFSEL_48MHZ (2 << 6)
#define PLL_RESET (1 << 8)
#define UTMI_PHY_EN (1 << 9)
#define PHY_CLK_SEL_UTMI (0 << 10)
#define PHY_CLK_SEL_ULPI (1 << 10)
#define CLKIN_SEL_USB_CLK (0 << 11)
#define CLKIN_SEL_USB_CLK2 (1 << 11)
#define CLKIN_SEL_SYS_CLK (2 << 11)
#define CLKIN_SEL_SYS_CLK2 (3 << 11)
#define RESERVED_18 (0 << 13)
#define RESERVED_17 (0 << 14)
#define RESERVED_16 (0 << 15)
#define WU_INT (1 << 16)
#define PHY_CLK_VALID (1 << 17)
#define FSL_SOC_USB_PORTSC2 0x188
#define FSL_SOC_USB_OTGSC 0x1a4
#define CTRL_VBUS_DISCHARGE (0x1<<0)
#define CTRL_VBUS_CHARGE (0x1<<1)
#define CTRL_OTG_TERMINATION (0x1<<3)
#define CTRL_DATA_PULSING (0x1<<4)
#define CTRL_ID_PULL_EN (0x1<<5)
#define HA_DATA_PULSE (0x1<<6)
#define HA_BA (0x1<<7)
#define STS_USB_ID (0x1<<8)
#define STS_A_VBUS_VALID (0x1<<9)
#define STS_A_SESSION_VALID (0x1<<10)
#define STS_B_SESSION_VALID (0x1<<11)
#define STS_B_SESSION_END (0x1<<12)
#define STS_1MS_TOGGLE (0x1<<13)
#define STS_DATA_PULSING (0x1<<14)
#define INTSTS_USB_ID (0x1<<16)
#define INTSTS_A_VBUS_VALID (0x1<<17)
#define INTSTS_A_SESSION_VALID (0x1<<18)
#define INTSTS_B_SESSION_VALID (0x1<<19)
#define INTSTS_B_SESSION_END (0x1<<20)
#define INTSTS_1MS (0x1<<21)
#define INTSTS_DATA_PULSING (0x1<<22)
#define INTR_USB_ID_EN (0x1<<24)
#define INTR_A_VBUS_VALID_EN (0x1<<25)
#define INTR_A_SESSION_VALID_EN (0x1<<26)
#define INTR_B_SESSION_VALID_EN (0x1<<27)
#define INTR_B_SESSION_END_EN (0x1<<28)
#define INTR_1MS_TIMER_EN (0x1<<29)
#define INTR_DATA_PULSING_EN (0x1<<30)
#define INTSTS_MASK (0x00ff0000)
#define EHCI_FSL_USBCMD_RST (1 << 1)
#define EHCI_FSL_USBCMD_RS (1 << 0)
#define INTERRUPT_ENABLE_BITS_MASK \
(INTR_USB_ID_EN | \
INTR_1MS_TIMER_EN | \
INTR_A_VBUS_VALID_EN | \
INTR_A_SESSION_VALID_EN | \
INTR_B_SESSION_VALID_EN | \
INTR_B_SESSION_END_EN | \
INTR_DATA_PULSING_EN)
#define INTERRUPT_STATUS_BITS_MASK \
(INTSTS_USB_ID | \
INTR_1MS_TIMER_EN | \
INTSTS_A_VBUS_VALID | \
INTSTS_A_SESSION_VALID | \
INTSTS_B_SESSION_VALID | \
INTSTS_B_SESSION_END | \
INTSTS_DATA_PULSING)
#define FSL_SOC_USB_USBMODE 0x1a8
#define USBGENCTRL 0x200 /* NOTE: big endian */
#define GC_WU_INT_CLR (1 << 5) /* Wakeup int clear */
#define GC_ULPI_SEL (1 << 4) /* ULPI i/f select (usb0 only)*/
#define GC_PPP (1 << 3) /* Port Power Polarity */
#define GC_PFP (1 << 2) /* Power Fault Polarity */
#define GC_WU_ULPI_EN (1 << 1) /* Wakeup on ULPI event */
#define GC_WU_IE (1 << 1) /* Wakeup interrupt enable */
#define ISIPHYCTRL 0x204 /* NOTE: big endian */
#define PHYCTRL_PHYE (1 << 4) /* On-chip UTMI PHY enable */
#define PHYCTRL_BSENH (1 << 3) /* Bit Stuff Enable High */
#define PHYCTRL_BSEN (1 << 2) /* Bit Stuff Enable */
#define PHYCTRL_LSFE (1 << 1) /* Line State Filter Enable */
#define PHYCTRL_PXE (1 << 0) /* PHY oscillator enable */
#define FSL_SOC_USB_SNOOP1 0x400 /* NOTE: big-endian */
#define FSL_SOC_USB_SNOOP2 0x404 /* NOTE: big-endian */
#define FSL_SOC_USB_AGECNTTHRSH 0x408 /* NOTE: big-endian */
#define FSL_SOC_USB_PRICTRL 0x40c /* NOTE: big-endian */
#define FSL_SOC_USB_SICTRL 0x410 /* NOTE: big-endian */
#define FSL_SOC_USB_CTRL 0x500 /* NOTE: big-endian */
#define SNOOP_SIZE_2GB 0x1e
#define MPC83XX_SCCR_USB_MASK 0x00f00000
#define MPC83XX_SCCR_USB_DRCM_11 0x00300000
#define MPC83XX_SCCR_USB_DRCM_01 0x00100000
#define MPC83XX_SCCR_USB_DRCM_10 0x00200000
#if defined(CONFIG_MPC83xx)
#define CONFIG_SYS_FSL_USB1_ADDR CONFIG_SYS_MPC83xx_USB1_ADDR
#if defined(CONFIG_MPC834x)
#define CONFIG_SYS_FSL_USB2_ADDR CONFIG_SYS_MPC83xx_USB2_ADDR
#else
#define CONFIG_SYS_FSL_USB2_ADDR 0
#endif
#elif defined(CONFIG_MPC85xx)
#define CONFIG_SYS_FSL_USB1_ADDR CONFIG_SYS_MPC85xx_USB1_ADDR
#define CONFIG_SYS_FSL_USB2_ADDR CONFIG_SYS_MPC85xx_USB2_ADDR
#elif defined(CONFIG_MPC512X)
#define CONFIG_SYS_FSL_USB1_ADDR CONFIG_SYS_MPC512x_USB1_ADDR
#define CONFIG_SYS_FSL_USB2_ADDR 0
#elif defined(CONFIG_LS102XA)
#define CONFIG_SYS_FSL_USB1_ADDR CONFIG_SYS_LS102XA_USB1_ADDR
#define CONFIG_SYS_FSL_USB2_ADDR 0
#endif
#define TXFIFOTHRESH 4
struct usb_ehci {
u32 id;
u32 hwgeneral;
u32 hwhost;
u32 hwdevice;
u32 hwtxbuf;
u32 hwrxbuf;
u8 res1[0x68];
u32 gptimer0_ld;
u32 gptimer0_ctrl;
u32 gptimer1_ld;
u32 gptimer1_ctrl;
u32 sbuscfg;
u8 res2[0x6C];
u8 caplength;
u8 res3[0x1];
u16 hciversion;
u32 hcsparams;
u32 hccparams;
u8 res4[0x14];
u32 dciversion;
u32 dciparams;
u8 res5[0x18];
u32 usbcmd;
u32 usbsts;
u32 usbintr;
u32 frindex;
u8 res6[0x4];
u32 perlistbase;
u32 ep_list_addr;
u8 res7[0x4];
u32 burstsize;
#define FSL_EHCI_TXPBURST(X) ((X) << 8)
#define FSL_EHCI_RXPBURST(X) (X)
u32 txfilltuning;
u8 res8[0x8];
u32 ulpi_viewpoint;
u8 res9[0xc];
u32 config_flag;
u32 portsc;
u8 res10[0x1C];
u32 otgsc;
u32 usbmode;
u32 epsetupstat;
u32 epprime;
u32 epflush;
u32 epstatus;
u32 epcomplete;
u32 epctrl0;
u32 epctrl1;
u32 epctrl2;
u32 epctrl3;
u32 epctrl4;
u32 epctrl5;
u8 res11[0x28];
u32 usbgenctrl;
u32 isiphyctrl;
u8 res12[0x1F8];
u32 snoop1;
u32 snoop2;
u32 age_cnt_limit;
u32 prictrl;
u32 sictrl;
u8 res13[0xEC];
u32 control;
u8 res14[0xafc];
};
#define MXC_EHCI_PHY_LOW_POWER_SUSPEND (1 << 23)
#define MXC_EHCI_FORCE_FS (1 << 24)
#define MXC_EHCI_UTMI_8BIT (0 << 28)
#define MXC_EHCI_UTMI_16BIT (1 << 28)
#define MXC_EHCI_SERIAL (1 << 29)
#define MXC_EHCI_MODE_UTMI (0 << 30)
#define MXC_EHCI_MODE_PHILIPS (1 << 30)
#define MXC_EHCI_MODE_ULPI (2 << 30)
#define MXC_EHCI_MODE_SERIAL (3 << 30)
#define MXC_EHCI_INTERFACE_DIFF_UNI (0 << 0)
#define MXC_EHCI_INTERFACE_DIFF_BI (1 << 0)
#define MXC_EHCI_INTERFACE_SINGLE_UNI (2 << 0)
#define MXC_EHCI_INTERFACE_SINGLE_BI (3 << 0)
#define MXC_EHCI_INTERFACE_MASK (0xf)
#define MXC_EHCI_POWER_PINS_ENABLED (1 << 5)
#define MXC_EHCI_PWR_PIN_ACTIVE_HIGH (1 << 6)
#define MXC_EHCI_OC_PIN_ACTIVE_LOW (1 << 7)
#define MXC_EHCI_TTL_ENABLED (1 << 8)
#define MXC_EHCI_INTERNAL_PHY (1 << 9)
#define MXC_EHCI_IPPUE_DOWN (1 << 10)
#define MXC_EHCI_IPPUE_UP (1 << 11)
int usb_phy_mode(int port);
int board_ehci_hcd_init(int port);
int board_usb_phy_mode(int port);
#endif /* _EHCI_FSL_H */
|