1 /* SPDX-License-Identifier: GPL-2.0-only */
3 #include <amdblocks/gpio.h>
4 #include <amdblocks/smi.h>
5 #include <amdblocks/xhci.h>
7 #include <device/device.h>
8 #include <drivers/usb/pci_xhci/pci_xhci.h>
9 #include <soc/pci_devs.h>
12 static const struct sci_source xhci_sci_sources
[] = {
14 .scimap
= SMITYPE_XHC0_PME
,
16 .direction
= SMI_SCI_LVL_HIGH
,
20 .scimap
= SMITYPE_XHC1_PME
,
22 .direction
= SMI_SCI_LVL_HIGH
,
27 enum cb_err
pci_xhci_get_wake_gpe(const struct device
*dev
, int *gpe
)
29 if (dev
->upstream
->dev
->path
.type
!= DEVICE_PATH_PCI
)
32 if (dev
->upstream
->dev
->path
.pci
.devfn
!= PCIE_ABC_A_DEVFN
)
35 if (dev
->path
.type
!= DEVICE_PATH_PCI
)
38 if (dev
->path
.pci
.devfn
== XHCI0_DEVFN
)
39 *gpe
= xhci_sci_sources
[0].gpe
;
40 else if (dev
->path
.pci
.devfn
== XHCI1_DEVFN
)
41 *gpe
= xhci_sci_sources
[1].gpe
;
48 static void configure_xhci_sci(void *unused
)
50 gpe_configure_sci(xhci_sci_sources
, ARRAY_SIZE(xhci_sci_sources
));
53 BOOT_STATE_INIT_ENTRY(BS_POST_DEVICE
, BS_ON_ENTRY
, configure_xhci_sci
, NULL
);