Angel Pons | f5627e8 | 2020-04-05 15:46:52 +0200 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
Lijian Zhao | ae56546 | 2017-10-02 19:18:16 -0700 | [diff] [blame] | 2 | |
| 3 | #include <soc/gpe.h> |
Lijian Zhao | ae56546 | 2017-10-02 19:18:16 -0700 | [diff] [blame] | 4 | |
Edward O'Callaghan | 8112841 | 2020-06-24 09:45:49 +1000 | [diff] [blame] | 5 | #define PORTSCN_OFFSET 0x480 |
| 6 | #define PORTSCXUSB3_OFFSET 0x540 |
| 7 | |
| 8 | #define WAKE_ON_CONNECT_DISCONNECT_ENABLE 0x6000000 |
| 9 | #define RO_BITS_OFF_MASK ~0x80FE0012 |
| 10 | |
| 11 | /* |
| 12 | * USB Port Wake Enable (UPWE) on usb attach/detach |
| 13 | * Arg0 - Port Number |
| 14 | * Arg1 - Port 1 Status and control offset |
| 15 | * Arg2 - xHCI Memory-mapped address |
| 16 | */ |
| 17 | Method (UPWE, 3, Serialized) |
| 18 | { |
| 19 | Local0 = Arg1 + ((Arg0 - 1) * 0x10) |
| 20 | |
| 21 | /* Map ((XMEM << 16) + Local0 in PSCR */ |
| 22 | OperationRegion (PSCR, SystemMemory, |
| 23 | Add (ShiftLeft (Arg2, 16), Local0), 0x10) |
| 24 | Field (PSCR, DWordAcc, NoLock, Preserve) |
| 25 | { |
| 26 | PSCT, 32, |
| 27 | } |
| 28 | Local0 = PSCT |
| 29 | /* |
| 30 | * And port status/control reg with RO and RWS bits |
| 31 | * RO bits: 0, 2:3, 10:13, 24, 28:30 |
| 32 | * RWS bits: 5:9, 14:16, 25:27 |
| 33 | */ |
| 34 | Local0 = Local0 & RO_BITS_OFF_MASK |
| 35 | /* Set WCE and WDE bits */ |
| 36 | Local0 = Local0 | WAKE_ON_CONNECT_DISCONNECT_ENABLE |
| 37 | PSCT = Local0 |
| 38 | } |
| 39 | |
| 40 | /* |
| 41 | * USB Wake Enable Setup (UWES) |
| 42 | * Arg0 - Port enable bitmap |
| 43 | * Arg1 - Port 1 Status and control offset |
| 44 | * Arg2 - xHCI Memory-mapped address |
| 45 | */ |
| 46 | Method (UWES, 3, Serialized) |
| 47 | { |
| 48 | Local0 = Arg0 |
| 49 | |
| 50 | While (One) { |
| 51 | FindSetRightBit (Local0, Local1) |
| 52 | If (Local1 == Zero) { |
| 53 | Break |
| 54 | } |
| 55 | UPWE (Local1, Arg1, Arg2) |
| 56 | /* |
| 57 | * Clear the lowest set bit in Local0 since it was |
| 58 | * processed. |
| 59 | */ |
| 60 | Local0 = Local0 & (Local0 - 1) |
| 61 | } |
| 62 | } |
| 63 | |
Lijian Zhao | ae56546 | 2017-10-02 19:18:16 -0700 | [diff] [blame] | 64 | /* XHCI Controller 0:14.0 */ |
| 65 | |
| 66 | Device (XHCI) |
| 67 | { |
| 68 | Name (_ADR, 0x00140000) |
| 69 | |
Patrick Rudolph | 7c8de86 | 2021-01-07 16:47:23 +0100 | [diff] [blame^] | 70 | Name (_PRW, Package () { GPE0_PME_B0, 4 }) |
Lijian Zhao | ae56546 | 2017-10-02 19:18:16 -0700 | [diff] [blame] | 71 | |
Edward O'Callaghan | 8112841 | 2020-06-24 09:45:49 +1000 | [diff] [blame] | 72 | Method (_DSW, 3) |
| 73 | { |
| 74 | UWES ((\U2WE & 0xFFF), PORTSCN_OFFSET, XMEM) |
| 75 | UWES ((\U3WE & 0x3F ), PORTSCXUSB3_OFFSET, XMEM) |
| 76 | } |
| 77 | |
Lijian Zhao | ae56546 | 2017-10-02 19:18:16 -0700 | [diff] [blame] | 78 | Name (_S3D, 3) /* D3 supported in S3 */ |
Lijian Zhao | ae56546 | 2017-10-02 19:18:16 -0700 | [diff] [blame] | 79 | Name (_S0W, 3) /* D3 can wake device in S0 */ |
| 80 | Name (_S3W, 3) /* D3 can wake system from S3 */ |
Lijian Zhao | ae56546 | 2017-10-02 19:18:16 -0700 | [diff] [blame] | 81 | |
Patrick Rudolph | 7c8de86 | 2021-01-07 16:47:23 +0100 | [diff] [blame^] | 82 | Name (_S4D, 3) /* D3 supported in S4 */ |
| 83 | Name (_S4W, 3) /* D3 can wake system from S4 */ |
| 84 | |
Edward O'Callaghan | 8112841 | 2020-06-24 09:45:49 +1000 | [diff] [blame] | 85 | OperationRegion (XPRT, PCI_Config, 0x00, 0x100) |
| 86 | Field (XPRT, AnyAcc, NoLock, Preserve) |
| 87 | { |
| 88 | Offset (0x10), |
| 89 | , 16, |
| 90 | XMEM, 16, /* MEM_BASE */ |
| 91 | } |
| 92 | |
Lijian Zhao | ae56546 | 2017-10-02 19:18:16 -0700 | [diff] [blame] | 93 | Method (_PS0, 0, Serialized) |
| 94 | { |
Lijian Zhao | ae56546 | 2017-10-02 19:18:16 -0700 | [diff] [blame] | 95 | |
Lijian Zhao | ae56546 | 2017-10-02 19:18:16 -0700 | [diff] [blame] | 96 | } |
| 97 | |
| 98 | Method (_PS3, 0, Serialized) |
| 99 | { |
Lijian Zhao | ae56546 | 2017-10-02 19:18:16 -0700 | [diff] [blame] | 100 | |
Lijian Zhao | ae56546 | 2017-10-02 19:18:16 -0700 | [diff] [blame] | 101 | } |
| 102 | |
| 103 | /* Root Hub for Cannonlake-LP PCH */ |
| 104 | Device (RHUB) |
| 105 | { |
| 106 | Name (_ADR, Zero) |
| 107 | |
| 108 | /* USB2 */ |
| 109 | Device (HS01) { Name (_ADR, 1) } |
| 110 | Device (HS02) { Name (_ADR, 2) } |
| 111 | Device (HS03) { Name (_ADR, 3) } |
| 112 | Device (HS04) { Name (_ADR, 4) } |
| 113 | Device (HS05) { Name (_ADR, 5) } |
| 114 | Device (HS06) { Name (_ADR, 6) } |
| 115 | Device (HS07) { Name (_ADR, 7) } |
| 116 | Device (HS08) { Name (_ADR, 8) } |
| 117 | Device (HS09) { Name (_ADR, 9) } |
| 118 | Device (HS10) { Name (_ADR, 10) } |
| 119 | Device (HS11) { Name (_ADR, 11) } |
| 120 | Device (HS12) { Name (_ADR, 12) } |
| 121 | |
| 122 | /* USBr */ |
| 123 | Device (USR1) { Name (_ADR, 11) } |
| 124 | Device (USR2) { Name (_ADR, 12) } |
| 125 | |
| 126 | /* USB3 */ |
| 127 | Device (SS01) { Name (_ADR, 13) } |
| 128 | Device (SS02) { Name (_ADR, 14) } |
| 129 | Device (SS03) { Name (_ADR, 15) } |
| 130 | Device (SS04) { Name (_ADR, 16) } |
| 131 | Device (SS05) { Name (_ADR, 17) } |
| 132 | Device (SS06) { Name (_ADR, 18) } |
| 133 | } |
| 134 | } |