Angel Pons | 3bd1e3d | 2020-04-05 15:47:17 +0200 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
Lee Leahy | b000513 | 2015-05-12 18:19:47 -0700 | [diff] [blame] | 2 | |
Subrata Banik | 36ca7b3 | 2023-03-23 14:48:53 +0530 | [diff] [blame] | 3 | #include <intelblocks/xhci.h> |
Edward O'Callaghan | ed31024 | 2020-06-30 13:39:01 +1000 | [diff] [blame] | 4 | |
Reka Norman | a5215c4 | 2023-09-22 15:26:54 +1000 | [diff] [blame^] | 5 | /* Include UWES method for enabling USB wake */ |
| 6 | #include <soc/intel/common/acpi/xhci_wake.asl> |
Furquan Shaikh | 3bfe340 | 2016-10-18 14:25:25 -0700 | [diff] [blame] | 7 | |
Lee Leahy | 1d14b3e | 2015-05-12 18:23:27 -0700 | [diff] [blame] | 8 | /* XHCI Controller 0:14.0 */ |
Lee Leahy | b000513 | 2015-05-12 18:19:47 -0700 | [diff] [blame] | 9 | |
| 10 | Device (XHCI) |
| 11 | { |
| 12 | Name (_ADR, 0x00140000) |
| 13 | |
Duncan Laurie | e32da95 | 2015-08-27 17:09:02 -0700 | [diff] [blame] | 14 | Name (_PRW, Package () { GPE0_PME_B0, 3 }) |
| 15 | |
| 16 | Method (_DSW, 3) |
| 17 | { |
Edward O'Callaghan | ed31024 | 2020-06-30 13:39:01 +1000 | [diff] [blame] | 18 | PMEE = Arg0 |
| 19 | UWES ((\U2WE & 0x3FF), PORTSCN_OFFSET, XMEM) |
| 20 | UWES ((\U3WE & 0x3F ), PORTSCXUSB3_OFFSET, XMEM) |
Duncan Laurie | e32da95 | 2015-08-27 17:09:02 -0700 | [diff] [blame] | 21 | } |
| 22 | |
| 23 | Name (_S3D, 3) /* D3 supported in S3 */ |
| 24 | Name (_S4D, 3) /* D3 supported in S4 */ |
| 25 | Name (_S0W, 3) /* D3 can wake device in S0 */ |
| 26 | Name (_S3W, 3) /* D3 can wake system from S3 */ |
| 27 | Name (_S4W, 3) /* D3 can wake system from S4 */ |
Lee Leahy | b000513 | 2015-05-12 18:19:47 -0700 | [diff] [blame] | 28 | |
| 29 | OperationRegion (XPRT, PCI_Config, 0x00, 0x100) |
| 30 | Field (XPRT, AnyAcc, NoLock, Preserve) |
| 31 | { |
Duncan Laurie | e32da95 | 2015-08-27 17:09:02 -0700 | [diff] [blame] | 32 | DVID, 16, /* VENDORID */ |
Lee Leahy | b000513 | 2015-05-12 18:19:47 -0700 | [diff] [blame] | 33 | Offset (0x10), |
| 34 | , 16, |
Lee Leahy | 1d14b3e | 2015-05-12 18:23:27 -0700 | [diff] [blame] | 35 | XMEM, 16, /* MEM_BASE */ |
Naresh G Solanki | fb79379 | 2017-03-16 15:30:25 +0530 | [diff] [blame] | 36 | Offset (0x50), /* XHCLKGTEN */ |
| 37 | , 2, |
| 38 | STGE, 1, /* SS Link Trunk clock gating enable */ |
Lee Leahy | b000513 | 2015-05-12 18:19:47 -0700 | [diff] [blame] | 39 | Offset (0x74), |
Duncan Laurie | e32da95 | 2015-08-27 17:09:02 -0700 | [diff] [blame] | 40 | D0D3, 2, /* POWERSTATE */ |
Lee Leahy | b000513 | 2015-05-12 18:19:47 -0700 | [diff] [blame] | 41 | , 6, |
Lee Leahy | 1d14b3e | 2015-05-12 18:23:27 -0700 | [diff] [blame] | 42 | PMEE, 1, /* PME_EN */ |
Lee Leahy | b000513 | 2015-05-12 18:19:47 -0700 | [diff] [blame] | 43 | , 6, |
Lee Leahy | 1d14b3e | 2015-05-12 18:23:27 -0700 | [diff] [blame] | 44 | PMES, 1, /* PME_STS */ |
Naresh G Solanki | fb79379 | 2017-03-16 15:30:25 +0530 | [diff] [blame] | 45 | Offset (0xA2), |
| 46 | , 2, |
| 47 | D3HE, 1, /* D3_hot_en */ |
Lee Leahy | b000513 | 2015-05-12 18:19:47 -0700 | [diff] [blame] | 48 | } |
| 49 | |
Felix Singer | 372573e | 2022-12-16 03:49:55 +0100 | [diff] [blame] | 50 | OperationRegion (XREG, SystemMemory, (XMEM << 16) + 0x8000, 0x200) |
Duncan Laurie | e32da95 | 2015-08-27 17:09:02 -0700 | [diff] [blame] | 51 | Field (XREG, DWordAcc, Lock, Preserve) |
Lee Leahy | b000513 | 2015-05-12 18:19:47 -0700 | [diff] [blame] | 52 | { |
Duncan Laurie | e32da95 | 2015-08-27 17:09:02 -0700 | [diff] [blame] | 53 | Offset (0x1c4), /* USB2PMCTRL */ |
| 54 | , 2, |
| 55 | UPSW, 2, /* U2PSUSPGP */ |
Lee Leahy | b000513 | 2015-05-12 18:19:47 -0700 | [diff] [blame] | 56 | } |
| 57 | |
Duncan Laurie | e32da95 | 2015-08-27 17:09:02 -0700 | [diff] [blame] | 58 | Method (_PSC, 0, Serialized) |
Lee Leahy | b000513 | 2015-05-12 18:19:47 -0700 | [diff] [blame] | 59 | { |
| 60 | Return (^D0D3) |
| 61 | } |
| 62 | |
| 63 | Method (_PS0, 0, Serialized) |
| 64 | { |
Elyes HAOUAS | fc29afb | 2020-10-09 15:05:28 +0200 | [diff] [blame] | 65 | If (^DVID != 0xFFFF) { |
| 66 | If (!((^XMEM == 0xFFFF) || (^XMEM == 0x0000))) { |
Duncan Laurie | e32da95 | 2015-08-27 17:09:02 -0700 | [diff] [blame] | 67 | |
Christian Walter | 343e134 | 2019-06-07 10:36:24 +0200 | [diff] [blame] | 68 | /* Disable d3hot and SS link trunk clock gating */ |
Elyes HAOUAS | fc29afb | 2020-10-09 15:05:28 +0200 | [diff] [blame] | 69 | ^D3HE = 0 |
| 70 | ^STGE = 0 |
Naresh G Solanki | fb79379 | 2017-03-16 15:30:25 +0530 | [diff] [blame] | 71 | |
Christian Walter | 343e134 | 2019-06-07 10:36:24 +0200 | [diff] [blame] | 72 | /* If device is in D3, set back to D0 */ |
Elyes HAOUAS | fc29afb | 2020-10-09 15:05:28 +0200 | [diff] [blame] | 73 | If (^D0D3 == 3) { |
| 74 | Local0 = 0 |
| 75 | ^D0D3 = Local0 |
| 76 | Local0 = ^D0D3 |
Duncan Laurie | e32da95 | 2015-08-27 17:09:02 -0700 | [diff] [blame] | 77 | } |
Christian Walter | 343e134 | 2019-06-07 10:36:24 +0200 | [diff] [blame] | 78 | |
| 79 | /* Disable USB2 PHY SUS Well Power Gating */ |
Elyes HAOUAS | fc29afb | 2020-10-09 15:05:28 +0200 | [diff] [blame] | 80 | ^UPSW = 0 |
Christian Walter | 343e134 | 2019-06-07 10:36:24 +0200 | [diff] [blame] | 81 | |
| 82 | /* |
| 83 | * Apply USB2 PHPY Power Gating workaround if needed. |
| 84 | */ |
| 85 | If (^^PMC.UWAB) { |
| 86 | /* Write to MTPMC to have PMC disable power gating */ |
Elyes HAOUAS | fc29afb | 2020-10-09 15:05:28 +0200 | [diff] [blame] | 87 | ^^PMC.MPMC = 1 |
Christian Walter | 343e134 | 2019-06-07 10:36:24 +0200 | [diff] [blame] | 88 | |
| 89 | /* Wait for PCH_PM_STS.MSG_FULL_STS to be 0 */ |
Elyes HAOUAS | fc29afb | 2020-10-09 15:05:28 +0200 | [diff] [blame] | 90 | Local0 = 10 |
Christian Walter | 343e134 | 2019-06-07 10:36:24 +0200 | [diff] [blame] | 91 | While (^^PMC.PMFS) { |
Elyes HAOUAS | fc29afb | 2020-10-09 15:05:28 +0200 | [diff] [blame] | 92 | If (!Local0) { |
Christian Walter | 343e134 | 2019-06-07 10:36:24 +0200 | [diff] [blame] | 93 | Break |
| 94 | } |
Elyes HAOUAS | fc29afb | 2020-10-09 15:05:28 +0200 | [diff] [blame] | 95 | Local0-- |
Christian Walter | 343e134 | 2019-06-07 10:36:24 +0200 | [diff] [blame] | 96 | Sleep (10) |
| 97 | } |
| 98 | } |
Duncan Laurie | e32da95 | 2015-08-27 17:09:02 -0700 | [diff] [blame] | 99 | } |
| 100 | } |
Lee Leahy | b000513 | 2015-05-12 18:19:47 -0700 | [diff] [blame] | 101 | } |
Duncan Laurie | e32da95 | 2015-08-27 17:09:02 -0700 | [diff] [blame] | 102 | |
Lee Leahy | b000513 | 2015-05-12 18:19:47 -0700 | [diff] [blame] | 103 | Method (_PS3, 0, Serialized) |
| 104 | { |
Elyes HAOUAS | fc29afb | 2020-10-09 15:05:28 +0200 | [diff] [blame] | 105 | If (^DVID != 0xFFFF) { |
| 106 | If (!((^XMEM == 0xFFFF) || (^XMEM == 0x0000))) { |
Duncan Laurie | e32da95 | 2015-08-27 17:09:02 -0700 | [diff] [blame] | 107 | |
Christian Walter | 343e134 | 2019-06-07 10:36:24 +0200 | [diff] [blame] | 108 | /* Clear PME Status */ |
Elyes HAOUAS | fc29afb | 2020-10-09 15:05:28 +0200 | [diff] [blame] | 109 | ^PMES = 1 |
Duncan Laurie | e32da95 | 2015-08-27 17:09:02 -0700 | [diff] [blame] | 110 | |
Christian Walter | 343e134 | 2019-06-07 10:36:24 +0200 | [diff] [blame] | 111 | /* Enable PME */ |
Elyes HAOUAS | fc29afb | 2020-10-09 15:05:28 +0200 | [diff] [blame] | 112 | ^PMEE= 1 |
Duncan Laurie | e32da95 | 2015-08-27 17:09:02 -0700 | [diff] [blame] | 113 | |
Christian Walter | 343e134 | 2019-06-07 10:36:24 +0200 | [diff] [blame] | 114 | /* If device is in D3, set back to D0 */ |
Elyes HAOUAS | fc29afb | 2020-10-09 15:05:28 +0200 | [diff] [blame] | 115 | If (^D0D3 == 3) { |
| 116 | Local0 = 0 |
| 117 | ^D0D3 = Local0 |
| 118 | Local0 = ^D0D3 |
Duncan Laurie | e32da95 | 2015-08-27 17:09:02 -0700 | [diff] [blame] | 119 | } |
Christian Walter | 343e134 | 2019-06-07 10:36:24 +0200 | [diff] [blame] | 120 | |
| 121 | /* Enable USB2 PHY SUS Well Power Gating in D0/D0i2/D0i3/D3 */ |
Elyes HAOUAS | fc29afb | 2020-10-09 15:05:28 +0200 | [diff] [blame] | 122 | ^UPSW = 3 |
Christian Walter | 343e134 | 2019-06-07 10:36:24 +0200 | [diff] [blame] | 123 | |
| 124 | /* Enable d3hot and SS link trunk clock gating */ |
Elyes HAOUAS | fc29afb | 2020-10-09 15:05:28 +0200 | [diff] [blame] | 125 | ^D3HE = 1 |
| 126 | ^STGE = 1 |
Christian Walter | 343e134 | 2019-06-07 10:36:24 +0200 | [diff] [blame] | 127 | |
| 128 | /* Now put device in D3 */ |
Elyes HAOUAS | fc29afb | 2020-10-09 15:05:28 +0200 | [diff] [blame] | 129 | Local0 = 3 |
| 130 | ^D0D3 = Local0 |
| 131 | Local0 = ^D0D3 |
Christian Walter | 343e134 | 2019-06-07 10:36:24 +0200 | [diff] [blame] | 132 | |
| 133 | /* |
| 134 | * Apply USB2 PHPY Power Gating workaround if needed. |
| 135 | * This code assumes XDCI is disabled, if it is enabled |
| 136 | * then this must also check if it is in D3 state too. |
| 137 | */ |
| 138 | If (^^PMC.UWAB) { |
| 139 | /* Write to MTPMC to have PMC enable power gating */ |
Elyes HAOUAS | fc29afb | 2020-10-09 15:05:28 +0200 | [diff] [blame] | 140 | ^^PMC.MPMC = 3 |
Christian Walter | 343e134 | 2019-06-07 10:36:24 +0200 | [diff] [blame] | 141 | |
| 142 | /* Wait for PCH_PM_STS.MSG_FULL_STS to be 0 */ |
Elyes HAOUAS | fc29afb | 2020-10-09 15:05:28 +0200 | [diff] [blame] | 143 | Local0 = 10 |
Christian Walter | 343e134 | 2019-06-07 10:36:24 +0200 | [diff] [blame] | 144 | While (^^PMC.PMFS) { |
Elyes HAOUAS | fc29afb | 2020-10-09 15:05:28 +0200 | [diff] [blame] | 145 | If (!Local0) { |
Christian Walter | 343e134 | 2019-06-07 10:36:24 +0200 | [diff] [blame] | 146 | Break |
| 147 | } |
Elyes HAOUAS | fc29afb | 2020-10-09 15:05:28 +0200 | [diff] [blame] | 148 | Local0-- |
Christian Walter | 343e134 | 2019-06-07 10:36:24 +0200 | [diff] [blame] | 149 | Sleep (10) |
| 150 | } |
| 151 | } |
Duncan Laurie | e32da95 | 2015-08-27 17:09:02 -0700 | [diff] [blame] | 152 | } |
| 153 | } |
Lee Leahy | b000513 | 2015-05-12 18:19:47 -0700 | [diff] [blame] | 154 | } |
| 155 | |
Duncan Laurie | e32da95 | 2015-08-27 17:09:02 -0700 | [diff] [blame] | 156 | /* Root Hub for Skylake-LP PCH */ |
| 157 | Device (RHUB) |
| 158 | { |
Felix Singer | 9df60d3 | 2022-12-26 09:43:07 +0100 | [diff] [blame] | 159 | Name (_ADR, 0) |
Lee Leahy | b000513 | 2015-05-12 18:19:47 -0700 | [diff] [blame] | 160 | |
Matt DeVillier | dc1b781 | 2017-04-22 16:36:10 -0500 | [diff] [blame] | 161 | // GPLD: Generate Port Location Data (PLD) |
| 162 | Method (GPLD, 1, Serialized) |
| 163 | { |
| 164 | |
| 165 | Name (PCKG, Package (0x01) |
| 166 | { |
| 167 | Buffer (0x10) {} |
| 168 | }) |
| 169 | |
| 170 | // REV: Revision 0x02 for ACPI 5.0 |
Felix Singer | 9df60d3 | 2022-12-26 09:43:07 +0100 | [diff] [blame] | 171 | CreateField (DerefOf (PCKG[0]), 0, 0x07, REV) |
Edward O'Callaghan | ed31024 | 2020-06-30 13:39:01 +1000 | [diff] [blame] | 172 | REV = 0x02 |
Matt DeVillier | dc1b781 | 2017-04-22 16:36:10 -0500 | [diff] [blame] | 173 | |
| 174 | // VISI: Port visibility to user per port |
Felix Singer | 7b8ac00 | 2022-12-26 08:45:56 +0100 | [diff] [blame] | 175 | CreateField (DerefOf (PCKG[0]), 0x40, 1, VISI) |
Edward O'Callaghan | ed31024 | 2020-06-30 13:39:01 +1000 | [diff] [blame] | 176 | VISI = Arg0 |
Matt DeVillier | dc1b781 | 2017-04-22 16:36:10 -0500 | [diff] [blame] | 177 | |
| 178 | Return (PCKG) |
| 179 | } |
| 180 | |
Duncan Laurie | e32da95 | 2015-08-27 17:09:02 -0700 | [diff] [blame] | 181 | /* USB2 */ |
| 182 | Device (HS01) { Name (_ADR, 1) } |
| 183 | Device (HS02) { Name (_ADR, 2) } |
| 184 | Device (HS03) { Name (_ADR, 3) } |
| 185 | Device (HS04) { Name (_ADR, 4) } |
| 186 | Device (HS05) { Name (_ADR, 5) } |
| 187 | Device (HS06) { Name (_ADR, 6) } |
| 188 | Device (HS07) { Name (_ADR, 7) } |
| 189 | Device (HS08) { Name (_ADR, 8) } |
| 190 | Device (HS09) { Name (_ADR, 9) } |
| 191 | Device (HS10) { Name (_ADR, 10) } |
Lee Leahy | b000513 | 2015-05-12 18:19:47 -0700 | [diff] [blame] | 192 | |
Duncan Laurie | e32da95 | 2015-08-27 17:09:02 -0700 | [diff] [blame] | 193 | /* USBr */ |
| 194 | Device (USR1) { Name (_ADR, 11) } |
| 195 | Device (USR2) { Name (_ADR, 12) } |
Lee Leahy | b000513 | 2015-05-12 18:19:47 -0700 | [diff] [blame] | 196 | |
Duncan Laurie | e32da95 | 2015-08-27 17:09:02 -0700 | [diff] [blame] | 197 | /* USB3 */ |
| 198 | Device (SS01) { Name (_ADR, 13) } |
| 199 | Device (SS02) { Name (_ADR, 14) } |
| 200 | Device (SS03) { Name (_ADR, 15) } |
| 201 | Device (SS04) { Name (_ADR, 16) } |
| 202 | Device (SS05) { Name (_ADR, 17) } |
| 203 | Device (SS06) { Name (_ADR, 18) } |
Lee Leahy | b000513 | 2015-05-12 18:19:47 -0700 | [diff] [blame] | 204 | } |
| 205 | } |