Simon Glass | 18d4a11 | 2024-10-23 15:20:12 +0200 | [diff] [blame] | 1 | /** @file |
| 2 | * |
| 3 | * [DSDT] Devices behind the GPU. |
| 4 | * |
| 5 | * Copyright (c) 2018-2020, Andrey Warkentin <andrey.warkentin@gmail.com> |
| 6 | * Copyright (c) Microsoft Corporation. All rights reserved. |
| 7 | * |
| 8 | * SPDX-License-Identifier: BSD-2-Clause-Patent |
| 9 | * |
| 10 | **/ |
| 11 | |
| 12 | // DWC OTG Controller |
| 13 | Device (USB0) |
| 14 | { |
| 15 | Name (_HID, "BCM2848") |
| 16 | #if defined(CONFIG_TARGET_RPI_3) |
| 17 | Name (_CID, "DWC_OTG") |
| 18 | #elif defined(CONFIG_TARGET_RPI_4) |
| 19 | Name (_CID, "BCM2848") |
| 20 | #endif |
| 21 | Name (_UID, 0x0) |
| 22 | Name (_CCA, 0x0) |
| 23 | Method (_STA) |
| 24 | { |
| 25 | Return (0xf) |
| 26 | } |
| 27 | Name (RBUF, ResourceTemplate () |
| 28 | { |
| 29 | MEMORY32FIXED (ReadWrite, 0, BCM2836_USB_LENGTH, RMEM) |
| 30 | Interrupt (ResourceConsumer, Level, ActiveHigh, Exclusive) { BCM2836_USB_INTERRUPT } |
| 31 | }) |
| 32 | Method (_CRS, 0x0, Serialized) |
| 33 | { |
| 34 | MEMORY32SETBASE (RBUF, RMEM, RBAS, BCM2836_USB_OFFSET) |
| 35 | Return (^RBUF) |
| 36 | } |
| 37 | } |
| 38 | |
| 39 | // Video Core 4 GPU |
| 40 | Device (GPU0) |
| 41 | { |
| 42 | Name (_HID, "BCM2850") |
| 43 | Name (_CID, "BCM2850") |
| 44 | Name (_UID, 0x0) |
| 45 | Name (_CCA, 0x0) |
| 46 | Method (_STA) |
| 47 | { |
| 48 | Return (0xf) |
| 49 | } |
| 50 | Name (RBUF, ResourceTemplate () |
| 51 | { |
| 52 | // Memory and interrupt for the GPU |
| 53 | MEMORY32FIXED (ReadWrite, 0, BCM2836_V3D_BUS_LENGTH, RM01) |
| 54 | Interrupt (ResourceConsumer, Level, ActiveHigh, Exclusive) { BCM2836_V3D_BUS_INTERRUPT } |
| 55 | |
| 56 | // HVS - Hardware Video Scalar |
| 57 | MEMORY32FIXED (ReadWrite, 0, BCM2836_HVS_LENGTH, RM02) |
| 58 | // The HVS interrupt is reserved by the VPU |
| 59 | // Interrupt (ResourceConsumer, Level, ActiveHigh, Exclusive) { BCM2836_HVS_INTERRUPT } |
| 60 | |
| 61 | // PixelValve0 - DSI0 or DPI |
| 62 | // MEMORY32FIXED (ReadWrite, BCM2836_PV0_BASE_ADDRESS, BCM2836_PV0_LENGTH, RM03) |
| 63 | // Interrupt (ResourceConsumer, Level, ActiveHigh, Exclusive) { BCM2836_PV0_INTERRUPT } |
| 64 | |
| 65 | // PixelValve1 - DS1 or SMI |
| 66 | // MEMORY32FIXED (ReadWrite, BCM2836_PV1_BASE_ADDRESS, BCM2836_PV1_LENGTH, RM04) |
| 67 | // Interrupt (ResourceConsumer, Level, ActiveHigh, Exclusive) { BCM2836_PV1_INTERRUPT } |
| 68 | |
| 69 | // PixelValve2 - HDMI output - connected to HVS display FIFO 1 |
| 70 | MEMORY32FIXED (ReadWrite, 0, BCM2836_PV2_LENGTH, RM05) |
| 71 | Interrupt (ResourceConsumer, Level, ActiveHigh, Exclusive) { BCM2836_PV2_INTERRUPT } |
| 72 | |
| 73 | // HDMI registers |
| 74 | MEMORY32FIXED (ReadWrite, 0, BCM2836_HDMI0_LENGTH, RM06) |
| 75 | MEMORY32FIXED (ReadWrite, 0, BCM2836_HDMI1_LENGTH, RM07) |
| 76 | // hdmi_int[0] |
| 77 | // Interrupt (ResourceConsumer, Level, ActiveHigh, Exclusive) { BCM2836_HDMI0_INTERRUPT } |
| 78 | // hdmi_int[1] |
| 79 | // Interrupt (ResourceConsumer, Level, ActiveHigh, Exclusive) { BCM2836_HDMI1_INTERRUPT } |
| 80 | |
| 81 | // HDMI DDC connection |
| 82 | I2CSerialBus (0x50,, 100000,, "\\_SB.GDV0.I2C2",,,,) // EDID |
| 83 | I2CSerialBus (0x30,, 100000,, "\\_SB.GDV0.I2C2",,,,) // E-DDC Segment Pointer |
| 84 | }) |
| 85 | Method (_CRS, 0x0, Serialized) |
| 86 | { |
| 87 | MEMORY32SETBASE (RBUF, RM01, RB01, BCM2836_V3D_BUS_OFFSET) |
| 88 | MEMORY32SETBASE (RBUF, RM02, RB02, BCM2836_HVS_OFFSET) |
| 89 | MEMORY32SETBASE (RBUF, RM05, RB05, BCM2836_PV2_OFFSET) |
| 90 | MEMORY32SETBASE (RBUF, RM06, RB06, BCM2836_HDMI0_OFFSET) |
| 91 | MEMORY32SETBASE (RBUF, RM07, RB07, BCM2836_HDMI1_OFFSET) |
| 92 | Return (^RBUF) |
| 93 | } |
| 94 | |
| 95 | // GPU Power Management Component Data |
| 96 | // Reference : https://github.com/Microsoft/graphics-driver-samples/wiki/Install-Driver-in-a-Windows-VM |
| 97 | Method (PMCD, 0, Serialized) |
| 98 | { |
| 99 | Name (RBUF, Package () |
| 100 | { |
| 101 | 1, // Version |
| 102 | 1, // Number of graphics power components |
| 103 | Package () // Power components package |
| 104 | { |
| 105 | Package () // GPU component package |
| 106 | { |
| 107 | 0, // Component Index |
| 108 | 0, // DXGK_POWER_COMPONENT_MAPPING.ComponentType (0 = DXGK_POWER_COMPONENT_ENGINE) |
| 109 | 0, // DXGK_POWER_COMPONENT_MAPPING.NodeIndex |
| 110 | |
| 111 | Buffer () // DXGK_POWER_RUNTIME_COMPONENT.ComponentGuid |
| 112 | { // 9B2D1E26-1575-4747-8FC0-B9EB4BAA2D2B |
| 113 | 0x26, 0x1E, 0x2D, 0x9B, 0x75, 0x15, 0x47, 0x47, |
| 114 | 0x8f, 0xc0, 0xb9, 0xeb, 0x4b, 0xaa, 0x2d, 0x2b |
| 115 | }, |
| 116 | |
| 117 | "VC4_Engine_00",// DXGK_POWER_RUNTIME_COMPONENT.ComponentName |
| 118 | 2, // DXGK_POWER_RUNTIME_COMPONENT.StateCount |
| 119 | |
| 120 | Package () // DXGK_POWER_RUNTIME_COMPONENT.States[] package |
| 121 | { |
| 122 | Package () // F0 |
| 123 | { |
| 124 | 0, // DXGK_POWER_RUNTIME_STATE.TransitionLatency |
| 125 | 0, // DXGK_POWER_RUNTIME_STATE.ResidencyRequirement |
| 126 | 1210000, // DXGK_POWER_RUNTIME_STATE.NominalPower (microwatt) |
| 127 | }, |
| 128 | |
| 129 | Package () // F1 - Placeholder |
| 130 | { |
| 131 | 10000, // DXGK_POWER_RUNTIME_STATE.TransitionLatency |
| 132 | 10000, // DXGK_POWER_RUNTIME_STATE.ResidencyRequirement |
| 133 | 4, // DXGK_POWER_RUNTIME_STATE.NominalPower |
| 134 | }, |
| 135 | } |
| 136 | } |
| 137 | } |
| 138 | }) |
| 139 | Return (RBUF) |
| 140 | } |
| 141 | } |
| 142 | |
| 143 | // PiQ Mailbox Driver |
| 144 | Device (RPIQ) |
| 145 | { |
| 146 | Name (_HID, "BCM2849") |
| 147 | Name (_CID, "BCM2849") |
| 148 | Name (_UID, 0) |
| 149 | Name (_CCA, 0x0) |
| 150 | |
| 151 | Name (RBUF, ResourceTemplate () |
| 152 | { |
| 153 | MEMORY32FIXED (ReadWrite, 0, BCM2836_MBOX_LENGTH, RMEM) |
| 154 | Interrupt (ResourceConsumer, Level, ActiveHigh, Exclusive) { BCM2836_MBOX_INTERRUPT } |
| 155 | }) |
| 156 | |
| 157 | Method (_CRS, 0x0, Serialized) |
| 158 | { |
| 159 | MEMORY32SETBASE (RBUF, RMEM, RBAS, BCM2836_MBOX_OFFSET) |
| 160 | Return (^RBUF) |
| 161 | } |
| 162 | } |
| 163 | |
| 164 | // VCHIQ Driver |
| 165 | Device (VCIQ) |
| 166 | { |
| 167 | Name (_HID, "BCM2835") |
| 168 | Name (_CID, "BCM2835") |
| 169 | Name (_UID, 0) |
| 170 | Name (_CCA, 0x0) |
| 171 | Name (_DEP, Package() { \_SB.GDV0.RPIQ }) |
| 172 | Method (_STA) |
| 173 | { |
| 174 | Return (0xf) |
| 175 | } |
| 176 | Name (RBUF, ResourceTemplate () |
| 177 | { |
| 178 | MEMORY32FIXED (ReadWrite, 0, BCM2836_VCHIQ_LENGTH, RMEM) |
| 179 | Interrupt (ResourceConsumer, Level, ActiveHigh, Exclusive) { BCM2836_VCHIQ_INTERRUPT } |
| 180 | }) |
| 181 | |
| 182 | Method (_CRS, 0x0, Serialized) |
| 183 | { |
| 184 | MEMORY32SETBASE (RBUF, RMEM, RBAS, BCM2836_VCHIQ_OFFSET) |
| 185 | Return (^RBUF) |
| 186 | } |
| 187 | } |
| 188 | |
| 189 | // VC Shared Memory Driver |
| 190 | Device (VCSM) |
| 191 | { |
| 192 | Name (_HID, "BCM2856") |
| 193 | Name (_CID, "BCM2856") |
| 194 | Name (_UID, 0) |
| 195 | Name (_CCA, 0x0) |
| 196 | Name (_DEP, Package() { \_SB.GDV0.VCIQ }) |
| 197 | Method (_STA) |
| 198 | { |
| 199 | Return (0xf) |
| 200 | } |
| 201 | } |
| 202 | |
| 203 | // Description: GPIO |
| 204 | Device (GPI0) |
| 205 | { |
| 206 | Name (_HID, "BCM2845") |
| 207 | Name (_CID, "BCM2845") |
| 208 | Name (_UID, 0x0) |
| 209 | Name (_CCA, 0x0) |
| 210 | |
| 211 | Name (RBUF, ResourceTemplate () |
| 212 | { |
| 213 | MEMORY32FIXED (ReadWrite, 0, GPIO_LENGTH, RMEM) |
| 214 | Interrupt (ResourceConsumer, Level, ActiveHigh, Shared) |
| 215 | { |
| 216 | BCM2386_GPIO_INTERRUPT0, BCM2386_GPIO_INTERRUPT1, |
| 217 | BCM2386_GPIO_INTERRUPT2, BCM2386_GPIO_INTERRUPT3 |
| 218 | } |
| 219 | }) |
| 220 | Method (_CRS, 0x0, Serialized) |
| 221 | { |
| 222 | MEMORY32SETBASE (RBUF, RMEM, RBAS, GPIO_OFFSET) |
| 223 | Return (^RBUF) |
| 224 | } |
| 225 | } |
| 226 | |
| 227 | // Description: I2C |
| 228 | Device (I2C1) |
| 229 | { |
| 230 | Name (_HID, "BCM2841") |
| 231 | Name (_CID, "BCM2841") |
| 232 | Name (_UID, 0x1) |
| 233 | Name (_CCA, 0x0) |
| 234 | |
| 235 | Name (RBUF, ResourceTemplate () |
| 236 | { |
| 237 | MEMORY32FIXED (ReadWrite, 0, BCM2836_I2C1_LENGTH, RMEM) |
| 238 | Interrupt (ResourceConsumer, Level, ActiveHigh, Shared) { BCM2836_I2C1_INTERRUPT } |
| 239 | PinFunction (Exclusive, PullUp, BCM_ALT0, "\\_SB.GDV0.GPI0", 0, ResourceConsumer, , ) { 2, 3 } |
| 240 | }) |
| 241 | Method (_CRS, 0x0, Serialized) |
| 242 | { |
| 243 | MEMORY32SETBASE (RBUF, RMEM, RBAS, BCM2836_I2C1_OFFSET) |
| 244 | Return (^RBUF) |
| 245 | } |
| 246 | } |
| 247 | |
| 248 | // I2C2 is the HDMI DDC connection |
| 249 | Device (I2C2) |
| 250 | { |
| 251 | Name (_HID, "BCM2841") |
| 252 | Name (_CID, "BCM2841") |
| 253 | Name (_UID, 0x2) |
| 254 | Name (_CCA, 0x0) |
| 255 | |
| 256 | Name (RBUF, ResourceTemplate() |
| 257 | { |
| 258 | MEMORY32FIXED (ReadWrite, 0, BCM2836_I2C2_LENGTH, RMEM) |
| 259 | Interrupt (ResourceConsumer, Level, ActiveHigh, Shared) { BCM2836_I2C2_INTERRUPT } |
| 260 | }) |
| 261 | |
| 262 | Method (_CRS, 0x0, Serialized) |
| 263 | { |
| 264 | MEMORY32SETBASE (RBUF, RMEM, RBAS, BCM2836_I2C2_OFFSET) |
| 265 | Return (^RBUF) |
| 266 | } |
| 267 | } |
| 268 | |
| 269 | // SPI |
| 270 | Device (SPI0) |
| 271 | { |
| 272 | Name (_HID, "BCM2838") |
| 273 | Name (_CID, "BCM2838") |
| 274 | Name (_UID, 0x0) |
| 275 | Name (_CCA, 0x0) |
| 276 | |
| 277 | Name (RBUF, ResourceTemplate () |
| 278 | { |
| 279 | MEMORY32FIXED (ReadWrite, 0, BCM2836_SPI0_LENGTH, RMEM) |
| 280 | Interrupt (ResourceConsumer, Level, ActiveHigh, Shared) { BCM2836_SPI0_INTERRUPT } |
| 281 | PinFunction (Exclusive, PullDown, BCM_ALT0, "\\_SB.GDV0.GPI0", 0, ResourceConsumer, , ) { 9, 10, 11 } // MISO, MOSI, SCLK |
| 282 | PinFunction (Exclusive, PullUp, BCM_ALT0, "\\_SB.GDV0.GPI0", 0, ResourceConsumer, , ) { 8 } // CE0 |
| 283 | PinFunction (Exclusive, PullUp, BCM_ALT0, "\\_SB.GDV0.GPI0", 0, ResourceConsumer, , ) { 7 } // CE1 |
| 284 | }) |
| 285 | |
| 286 | Method (_CRS, 0x0, Serialized) |
| 287 | { |
| 288 | MEMORY32SETBASE (RBUF, RMEM, RBAS, BCM2836_SPI0_OFFSET) |
| 289 | Return (^RBUF) |
| 290 | } |
| 291 | } |
| 292 | |
| 293 | Device (SPI1) |
| 294 | { |
| 295 | Name (_HID, "BCM2839") |
| 296 | Name (_CID, "BCM2839") |
| 297 | Name (_UID, 0x1) |
| 298 | Name (_CCA, 0x0) |
| 299 | Name (_DEP, Package() { \_SB.GDV0.RPIQ }) |
| 300 | |
| 301 | Name (RBUF, ResourceTemplate () |
| 302 | { |
| 303 | MEMORY32FIXED (ReadWrite, 0, BCM2836_SPI1_LENGTH, RMEM) |
| 304 | Interrupt (ResourceConsumer, Level, ActiveHigh, Shared,) { BCM2836_SPI1_INTERRUPT } |
| 305 | PinFunction (Exclusive, PullDown, BCM_ALT4, "\\_SB.GDV0.GPI0", 0, ResourceConsumer, , ) { 19, 20, 21 } // MISO, MOSI, SCLK |
| 306 | PinFunction (Exclusive, PullDown, BCM_ALT4, "\\_SB.GDV0.GPI0", 0, ResourceConsumer, , ) { 16 } // CE2 |
| 307 | }) |
| 308 | |
| 309 | Method (_CRS, 0x0, Serialized) |
| 310 | { |
| 311 | MEMORY32SETBASE (RBUF, RMEM, RBAS, BCM2836_SPI1_OFFSET) |
| 312 | Return (^RBUF) |
| 313 | } |
| 314 | } |
| 315 | |
| 316 | // SPI2 has no pins on GPIO header |
| 317 | // Device (SPI2) |
| 318 | // { |
| 319 | // Name (_HID, "BCM2839") |
| 320 | // Name (_CID, "BCM2839") |
| 321 | // Name (_UID, 0x2) |
| 322 | // Name (_CCA, 0x0) |
| 323 | // Name (_DEP, Package() { \_SB.GDV0.RPIQ }) |
| 324 | // Method (_STA) |
| 325 | // { |
| 326 | // Return (0xf) // Disabled |
| 327 | // } |
| 328 | // Method (_CRS, 0x0, Serialized) |
| 329 | // { |
| 330 | // Name (RBUF, ResourceTemplate () |
| 331 | // { |
| 332 | // MEMORY32FIXED (ReadWrite, BCM2836_SPI2_BASE_ADDRESS, BCM2836_SPI2_LENGTH, RMEM) |
| 333 | // Interrupt (ResourceConsumer, Level, ActiveHigh, Shared,) { BCM2836_SPI2_INTERRUPT } |
| 334 | // }) |
| 335 | // Return (RBUF) |
| 336 | // } |
| 337 | // } |
| 338 | |
| 339 | // PWM Driver |
| 340 | Device (PWM0) |
| 341 | { |
| 342 | Name (_HID, "BCM2844") |
| 343 | Name (_CID, "BCM2844") |
| 344 | Name (_UID, 0) |
| 345 | Name (_CCA, 0x0) |
| 346 | |
| 347 | Name (RBUF, ResourceTemplate () |
| 348 | { |
| 349 | // DMA channel 11 control |
| 350 | MEMORY32FIXED (ReadWrite, 0, BCM2836_PWM_DMA_LENGTH, RM01) |
| 351 | // PWM control |
| 352 | MEMORY32FIXED (ReadWrite, 0, BCM2836_PWM_CTRL_LENGTH, RM02) |
| 353 | // PWM control bus |
| 354 | MEMORY32FIXED (ReadWrite, BCM2836_PWM_BUS_BASE_ADDRESS, BCM2836_PWM_BUS_LENGTH, ) |
| 355 | // PWM control uncached |
| 356 | MEMORY32FIXED (ReadWrite, BCM2836_PWM_CTRL_UNCACHED_BASE_ADDRESS, BCM2836_PWM_CTRL_UNCACHED_LENGTH, ) |
| 357 | // PWM clock control |
| 358 | MEMORY32FIXED (ReadWrite, 0, BCM2836_PWM_CLK_LENGTH, RM03) |
| 359 | // Interrupt DMA channel 11 |
| 360 | Interrupt (ResourceConsumer, Level, ActiveHigh, Exclusive) { BCM2836_DMA_INTERRUPT } |
| 361 | // DMA channel 11, DREQ 5 for PWM |
| 362 | FixedDMA (5, 11, Width32Bit, ) |
| 363 | }) |
| 364 | |
| 365 | Method (_CRS, 0x0, Serialized) |
| 366 | { |
| 367 | MEMORY32SETBASE (RBUF, RM01, RB01, BCM2836_PWM_DMA_OFFSET) |
| 368 | MEMORY32SETBASE (RBUF, RM02, RB02, BCM2836_PWM_CTRL_OFFSET) |
| 369 | MEMORY32SETBASE (RBUF, RM03, RB03, BCM2836_PWM_CLK_OFFSET) |
| 370 | Return (^RBUF) |
| 371 | } |
| 372 | } |