blob: f2ee8f6427d2778f75e56e882b364681c91ea72b [file] [log] [blame]
Marc Jones24484842017-05-04 21:17:45 -06001/*
2 * This file is part of the coreboot project.
3 *
4 * Copyright (C) 2007-2009 coresystems GmbH
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License as
8 * published by the Free Software Foundation; version 2 of
9 * the License.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 */
16
Marc Jones2e8476c2017-10-05 21:56:15 -060017/* 0:12.0 - EHCI */
18Device(EHC0) {
Marc Jones24484842017-05-04 21:17:45 -060019 Name(_ADR, 0x00120000)
Marshall Dawsonfdb846d2018-09-26 15:43:21 -060020 Name(_PRW, Package() { 0xb, 3 })
Duncan Laurie32bdffa2018-05-07 15:37:28 -070021 Device (RHUB) {
22 Name (_ADR, Zero)
23 Device (HS01) { Name (_ADR, 1) }
24 Device (HS02) { Name (_ADR, 2) }
25 Device (HS03) { Name (_ADR, 3) }
26 Device (HS04) { Name (_ADR, 4) }
27 Device (HS05) { Name (_ADR, 5) }
28 Device (HS06) { Name (_ADR, 6) }
29 Device (HS07) { Name (_ADR, 7) }
30 Device (HS08) { Name (_ADR, 8) }
31 }
Marshall Dawsonfdb846d2018-09-26 15:43:21 -060032
33 Name(_PR0, Package() { P0U2 }) /* Indicate support for D0 */
34 Name(_PR3, Package() { P3U2 }) /* Indicate support for D3cold */
35
36 Method(_S0W,0) {
37 Return(0)
38 }
39
40 Method(_S3W,0) {
41 Return(4)
42 }
43
44 Method(_S4W,0) {
45 Return(4)
46 }
Marc Jones2e8476c2017-10-05 21:56:15 -060047} /* end EHC0 */
Marc Jones24484842017-05-04 21:17:45 -060048
Marc Jones24484842017-05-04 21:17:45 -060049
50/* 0:10.0 - XHCI 0*/
51Device(XHC0) {
52 Name(_ADR, 0x00100000)
Marshall Dawsonfdb846d2018-09-26 15:43:21 -060053 Name(_PRW, Package() { 0xb, 3 })
Duncan Laurie32bdffa2018-05-07 15:37:28 -070054 Device (SS01) { Name (_ADR, 1) }
55 Device (SS02) { Name (_ADR, 2) }
56 Device (SS03) { Name (_ADR, 3) }
Marshall Dawsonfdb846d2018-09-26 15:43:21 -060057
58 Name(_PR0, Package() { P0U3 }) /* Indicate support for D0 */
59 Name(_PR3, Package() { P3U3 }) /* Indicate support for D3cold */
60
61 Method(_S0W,0) {
62 Return(0)
63 }
64
65 Method(_S3W,0) {
66 Return(4)
67 }
68
69 Method(_S4W,0) {
70 Return(4)
71 }
72
Marc Jones24484842017-05-04 21:17:45 -060073} /* end XHC0 */
Marshall Dawsonfdb846d2018-09-26 15:43:21 -060074
75Scope(\_SB)
76{
77 Name(XHD0, 0)
78 Name(XHD3, 0)
79 PowerResource(P0U3, 0, 0) {
80 Method(_STA) {
81 Return(XHD0)
82 }
83 Method(_ON) {
84 Store(0x01, XHD0)
85 }
86 Method(_OFF) {
87 Store(0x00, XHD0)
88 }
89 }
90 PowerResource(P3U3, 0, 0) {
91 Method(_STA) {
92 Return(XHD3)
93 }
94 Method(_ON) {
95 Store(0x01, XHD3)
96 }
97 Method(_OFF) {
98 Store(0x00, XHD3)
99 }
100 }
101
102 Name(EHD0, 0)
103 Name(EHD3, 0)
104 PowerResource(P0U2, 0, 0) {
105 Method(_STA) {
106 Return(EHD0)
107 }
108 Method(_ON) {
109 Store(0x01, EHD0)
110 }
111 Method(_OFF) {
112 Store(0x00, EHD0)
113 }
114 }
115 PowerResource(P3U2, 0, 0) {
116 Method(_STA) {
117 Return(EHD3)
118 }
119 Method(_ON) {
120 Store(0x01, EHD3)
121 }
122 Method(_OFF) {
123 Store(0x00, EHD3)
124 }
125 }
126}
127
128OperationRegion(EHMC, SystemMemory, EH10, 0x100)
129Field(EHMC, DwordAcc, NoLock, Preserve)
130{
131 Offset(0xb0),
132 , 5,
133 ESIM, 1,
134}
135
136Method(U2D3,0, Serialized)
137{
138 if (LNotEqual(EH10, Zero)) {
139 Store (EH10, EHBA)
140 Store (One, EHME)
141 Store (ESIM, SSIM)
142 }
143
144 if (LEqual(E_PS, 3)) {
145 Store (Zero, RQTY)
146 Store (One, RQ18)
147
148 Store (U2SR, Local0)
149 while (Local0) {
150 Store (U2SR, Local0)
151 }
152
153 Store (Zero, U2PD)
154
155 Store (U2DS, Local0)
156 while (LNotEqual(Local0, Zero)) {
157 Store (U2DS, Local0)
158 }
159
160 Store (0x03,U2TD)
161
162 if (LEqual(U3TD, 0x03)) { /* Shutdown USB2 PLL */
163 PWGC (0x40, 0)
164 Store (One, U2RP)
165 }
166 }
167}
168
169Method(U2D0,0, Serialized)
170{
171 PWGC (0x40, 1)
172 Store (Zero, U2RP)
173 Store (0x00,U2TD)
174
175 Store (Zero, U2TD)
176 Store (One, U2PD)
177
178 Store (U2DS, Local0)
179 while (LNotEqual(Local0,0x7)) {
180 Store (U2DS, Local0)
181 }
182
183 Store (One, RQTY)
184 Store (One, RQ18)
185 Store (U2SR, Local0)
186 while (LNot(Local0)) {
187 Store (U2SR, Local0)
188 }
189 Store (EHID, EH2C)
190
191
192 if (LNotEqual(EH10, Zero)) {
193 Store (EH10, EHBA)
194 Store (One, EHME)
195 Store (SSIM, ESIM)
196 }
197
198 Store (ES54, EH54)
199 Store (ES64, EH64)
200}
201
202Method(LXFW,3, Serialized) //Load Xhci FirmWare
203{
204 Store (One, FWLM) /* Firmware Load Mode */
205 Store (Arg0, ROAM) /* ROM/RAM */
206 Store (Arg1, UA04)
207 Store (Arg2, UA08)
208 Store (One, FPLS) /* Firmware Preload Start */
209 Store (FPLC, Local0) /* Firmware Preload Complete */
210 while (LNot(Local0)) {
211 Store (FPLC, Local0)
212 }
213 Store (Zero, FPLS)
214}
215
216Method(U3D3,0, Serialized)
217{
218 if (LEqual(U_PS, 3)) {
219 X0_S ()
220
221 Or (PGA3, 0x20, PGA3) /* SwUsb3SlpShutdown */
222 And (PGA3, 0x20, Local0)
223 while (LNot(Local0)) { /* wait for it to complete */
224 And (PGA3, 0x20, Local0)
225 }
226 Store (One, UD3P) /* U3P_D3Cold_PWRDN */
227
228 Store (Zero, U3PD) /* PwrOnDev */
229 Store (U3DS, Local0)
230 while (Local0) { /* RstBState, RefClkOkState, PwrRstBState */
231 Store (U3DS, Local0)
232 }
233
234 Store (0x3, U3TD) /* TargetedDeviceState */
235
236 Store (One, U3RP) /* USB3_RefClk_Pwdn */
237
238 if (Lequal(U2TD, 0x3)) { /* If EHCI targeted in D3cold */
239 And (PGA3, 0x9f, PGA3) /* SwUsb2S5RstB */
240 Store (One, U2RP) /* USB2_RefClk_Pwdn */
241 }
242 Store (Zero, U3PG) /* XhcPwrGood */
243 Store (One, U3PS) /* Usb3PowerSel */
244 }
245}
246
247Method(U3D0,0, Serialized)
248{
249 Store (Zero, U3PS) /* Usb3PowerSel */
250 Store (One, U3PG) /* XhcPwrGood */
251
252 Store (Zero, U2RP)
253 Store (Zero, U3RP)
254
255 And (PGA3, 0xdf, Local0)
256 Or (Local0, 0x40, Local0)
257 Store (Local0, PGA3) /* SwUsb2S5RstB */
258
259 Store (Zero, U3TD) /* TargetedDeviceState */
260 Store (One, U3PD) /* PwrOnDev */
261
262 Store (U3DS, Local0) /* wait for RstBState, RefClkOkState, PwrRstBState */
263 while (LNot(Lequal(Local0, 0x7))) {
264 Store (U3DS, Local0)
265 }
266
267 Store (U3PY, Local0) /* USB3 PHY Lock */
268 while (LNot(Local0)) {
269 Store (U3PY, Local0)
270 }
271
272 Store (Zero, U3PR) /* U3P_RESTORE_RESET */
273
274 Store (AUSS, Local0) /* AutoSizeStart */
275 if (LNotEqual(Local0,1)) {
276 Store(One, AUSS)
277 }
278 Store (AUSS, Local0)
279 while (LNotEqual(Local0,1)) {
280 Store (AUSS, Local0)
281 }
282
283 LXFW (1, FW00, FW01)
284 LXFW (0, FW02, FW03)
285
286 X0_R ()
287
288 Store (One, U3PR) /* U3P_RESTORE_RESET */
289 Store (Zero, UD3P) /* U3P_D3Cold_PWRDN */
290 Store (One, U3TD) /* TargetedDeviceState */
291}
292
293Name (SVBF, Buffer (0x1000) {0}) /* length from FchCarrizo.asl, new fields */
294CreateDWordField(SVBF, 0x000, S000) /* will be easier to add from there */
295CreateDWordField(SVBF, 0x004, S004)
296CreateDWordField(SVBF, 0x008, S008)
297CreateDWordField(SVBF, 0x00C, S00C)
298CreateDWordField(SVBF, 0x018, S018)
299CreateDWordField(SVBF, 0x01C, S01C)
300CreateDWordField(SVBF, 0x020, S020)
301CreateDWordField(SVBF, 0x030, S030)
302CreateDWordField(SVBF, 0x118, S118)
303CreateDWordField(SVBF, 0x158, S158)
304CreateDWordField(SVBF, 0x198, S198)
305CreateDWordField(SVBF, 0x1D8, S1D8)
306CreateDWordField(SVBF, 0x300, S300)
307CreateDWordField(SVBF, 0x304, S304)
308CreateDWordField(SVBF, 0x308, S308)
309CreateDWordField(SVBF, 0x30C, S30C)
310CreateDWordField(SVBF, 0x310, S310)
311CreateDWordField(SVBF, 0x428, S428)
312CreateDWordField(SVBF, 0x438, S438)
313CreateDWordField(SVBF, 0x43C, S43C)
314CreateDWordField(SVBF, 0x458, S458)
315CreateDWordField(SVBF, 0x468, S468)
316CreateDWordField(SVBF, 0x46C, S46C)
317CreateDWordField(SVBF, 0x470, S470)
318CreateDWordField(SVBF, 0x480, S480)
319CreateDWordField(SVBF, 0x484, S484)
320CreateDWordField(SVBF, 0x488, S488)
321CreateDWordField(SVBF, 0x48C, S48C)
322CreateDWordField(SVBF, 0x730, EHID) /* EHCI SSID */
323CreateDWordField(SVBF, 0x734, XHID) /* XHCI SSID */
324CreateByteField(SVBF, 0x740, ES54) /* EHCI PCIx54 */
325CreateByteField(SVBF, 0x741, ES64) /* EHCI PCIx64 */
326CreateDWordField(SVBF, 0x7B0, SSIM) /* EHCI SIM BIT */
327
328Method(X0_S,0)
329{
330 Store (XH2C, XHID)
331 Store (0x00000000, IDEX) Store (DATA, S000)
332 Store (0x00000004, IDEX) Store (DATA, S004)
333 Store (0x00000008, IDEX) Store (DATA, S008)
334 Store (0x0000000c, IDEX) Store (DATA, S00C)
335 Store (0x00000018, IDEX) Store (DATA, S018)
336 Store (0x0000001c, IDEX) Store (DATA, S01C)
337 Store (0x00000020, IDEX) Store (DATA, S020)
338 Store (0x00000030, IDEX) Store (DATA, S030)
339 Store (0x00000118, IDEX) Store (DATA, S118)
340 Store (0x00000158, IDEX) Store (DATA, S158)
341 Store (0x00000198, IDEX) Store (DATA, S198)
342 Store (0x000001d8, IDEX) Store (DATA, S1D8)
343 Store (0x00000300, IDEX) Store (DATA, S300)
344 Store (0x00000304, IDEX) Store (DATA, S304)
345 Store (0x00000308, IDEX) Store (DATA, S308)
346 Store (0x0000030c, IDEX) Store (DATA, S30C)
347 Store (0x00000310, IDEX) Store (DATA, S310)
348 Store (0x40000028, IDEX) Store (DATA, S428)
349 Store (0x40000038, IDEX) Store (DATA, S438)
350 Store (0x4000003c, IDEX) Store (DATA, S43C)
351 Store (0x40000058, IDEX) Store (DATA, S458)
352 Store (0x40000068, IDEX) Store (DATA, S468)
353 Store (0x4000006c, IDEX) Store (DATA, S46C)
354 Store (0x40000070, IDEX) Store (DATA, S470)
355 Store (0x40000080, IDEX) Store (DATA, S480)
356 Store (0x40000084, IDEX) Store (DATA, S484)
357 Store (0x40000088, IDEX) Store (DATA, S488)
358 Store (0x4000008c, IDEX) Store (DATA, S48C)
359}
360
361Method(X0_R,0)
362{
363 Store (XHID, XH2C)
364 Store (0x00000000, IDEX) Store (S000, DATA)
365 Store (0x00000004, IDEX) Store (S004, DATA)
366 Store (0x00000008, IDEX) Store (S008, DATA)
367 Store (0x0000000c, IDEX) Store (S00C, DATA)
368 Store (0x00000018, IDEX) Store (S018, DATA)
369 Store (0x0000001c, IDEX) Store (S01C, DATA)
370 Store (0x00000020, IDEX) Store (S020, DATA)
371 Store (0x00000030, IDEX) Store (S030, DATA)
372 Store (0x00000118, IDEX) Store (S118, DATA)
373 Store (0x00000158, IDEX) Store (S158, DATA)
374 Store (0x00000198, IDEX) Store (S198, DATA)
375 Store (0x000001d8, IDEX) Store (S1D8, DATA)
376 Store (0x00000300, IDEX) Store (S300, DATA)
377 Store (0x00000304, IDEX) Store (S304, DATA)
378 Store (0x00000308, IDEX) Store (S308, DATA)
379 Store (0x0000030c, IDEX) Store (S30C, DATA)
380 Store (0x00000310, IDEX) Store (S310, DATA)
381 Store (0x40000028, IDEX) Store (S428, DATA)
382 Store (0x40000038, IDEX) Store (S438, DATA)
383 Store (0x4000003c, IDEX) Store (S43C, DATA)
384 Store (0x40000058, IDEX) Store (S458, DATA)
385 Store (0x40000068, IDEX) Store (S468, DATA)
386 Store (0x4000006c, IDEX) Store (S46C, DATA)
387 Store (0x40000070, IDEX) Store (S470, DATA)
388 Store (0x40000080, IDEX) Store (S480, DATA)
389 Store (0x40000084, IDEX) Store (S484, DATA)
390 Store (0x40000088, IDEX) Store (S488, DATA)
391 Store (0x4000008c, IDEX) Store (S48C, DATA)
392}