Debian Codegraph @

src/southbridge/intel/bd82x6x/usb_xhci.c

raw symbols SCIP
1 /* SPDX-License-Identifier: GPL-2.0-only */
2
3 #include <console/console.h>
4 #include <device/device.h>
5 #include <device/pci.h>
6 #include <device/pci_ids.h>
7 #include "pch.h"
8 #include <device/pci_ehci.h>
9 #include <device/pci_ops.h>
10 #include <southbridge/intel/common/rcba.h>
11 #include "chip.h"
12
13 static void usb_xhci_init(struct device *dev)
14 {
15 u32 reg32;
16 struct southbridge_intel_bd82x6x_config *config = dev->chip_info;
17
18 printk(BIOS_DEBUG, "XHCI: Setting up controller.. ");
19
20 reg32 = RCBA32(USBOCM1) & 0x0f0f0f0f;
21 pci_write_config32(dev, XOCM, reg32);
22
23 /* lock overcurrent map */
24 pci_or_config32(dev, 0x44, 1);
25
26 pci_write_config32(dev, XUSB2PRM, config->xhci_switchable_ports);
27 pci_write_config32(dev, USB3PRM, config->superspeed_capable_ports);
28
29 /* Enable clock gating */
30 reg32 = pci_read_config32(dev, 0x40);
31 reg32 &= ~((1 << 20) | (1 << 21));
32 reg32 |= (1 << 19) | (1 << 18) | (1 << 17);
33 reg32 |= (1 << 10) | (1 << 9) | (1 << 8);
34 reg32 |= (1 << 31); /* lock */
35 pci_write_config32(dev, 0x40, reg32);
36
37 printk(BIOS_DEBUG, "done.\n");
38 }
39
40 static const char *xhci_acpi_name(const struct device *dev)
41 {
42 return "XHC";
43 }
44
45 struct device_operations bd82x6x_usb_xhci_ops = {
46 .read_resources = pci_dev_read_resources,
47 .set_resources = pci_dev_set_resources,
48 .enable_resources = pci_dev_enable_resources,
49 .init = usb_xhci_init,
50 .ops_pci = &pci_dev_ops_pci,
51 .acpi_name = xhci_acpi_name,
52 };