Debian Codegraph @

src/southbridge/intel/i82801jx/usb_ehci.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_ops.h>
7 #include <device/pci_ids.h>
8 #include "i82801jx.h"
9 #include <device/pci_ehci.h>
10
11 static void usb_ehci_init(struct device *dev)
12 {
13 printk(BIOS_DEBUG, "EHCI: Setting up controller.. ");
14 pci_or_config16(dev, PCI_COMMAND, PCI_COMMAND_MASTER);
15
16 printk(BIOS_DEBUG, "done.\n");
17 }
18
19 static void usb_ehci_set_subsystem(struct device *dev, unsigned int vendor,
20 unsigned int device)
21 {
22 u8 access_cntl;
23
24 access_cntl = pci_read_config8(dev, 0x80);
25
26 /* Enable writes to protected registers. */
27 pci_write_config8(dev, 0x80, access_cntl | 1);
28
29 pci_dev_set_subsystem(dev, vendor, device);
30
31 /* Restore protection. */
32 pci_write_config8(dev, 0x80, access_cntl);
33 }
34
35 static const unsigned short pci_device_ids[] = {
36 0x3a3a,
37 0x3a6a,
38 0x3a3c,
39 0x3a6c,
40 0
41 };
42
43 static struct pci_operations lops_pci = {
44 .set_subsystem = &usb_ehci_set_subsystem,
45 };
46
47 static struct device_operations usb_ehci_ops = {
48 .read_resources = pci_ehci_read_resources,
49 .set_resources = pci_dev_set_resources,
50 .enable_resources = pci_dev_enable_resources,
51 .init = usb_ehci_init,
52 .ops_pci = &lops_pci,
53 };
54
55 static const struct pci_driver pch_usb_ehci1 __pci_driver = {
56 .ops = &usb_ehci_ops,
57 .vendor = PCI_VID_INTEL,
58 .devices = pci_device_ids,
59 };