| 1 |
|
| 2 |
|
| 3 |
#include <device/device.h> |
| 4 |
#include <device/pci.h> |
| 5 |
#include <device/pci_ids.h> |
| 6 |
#include <device/pci_ehci.h> |
| 7 |
#include <device/pci_ops.h> |
| 8 |
#include <soc/ehci.h> |
| 9 |
#include <soc/pch.h> |
| 10 |
|
| 11 |
static void usb_ehci_set_subsystem(struct device *dev, unsigned int vendor, |
| 12 |
unsigned int device) |
| 13 |
{ |
| 14 |
u8 access_cntl; |
| 15 |
|
| 16 |
access_cntl = pci_read_config8(dev, 0x80); |
| 17 |
|
| 18 |
|
| 19 |
pci_write_config8(dev, 0x80, access_cntl | 1); |
| 20 |
|
| 21 |
pci_dev_set_subsystem(dev, vendor, device); |
| 22 |
|
| 23 |
|
| 24 |
pci_write_config8(dev, 0x80, access_cntl); |
| 25 |
} |
| 26 |
|
| 27 |
static void ehci_enable(struct device *dev) |
| 28 |
{ |
| 29 |
if (CONFIG(USBDEBUG)) |
| 30 |
dev->enabled = 1; |
| 31 |
else |
| 32 |
pch_disable_devfn(dev); |
| 33 |
} |
| 34 |
|
| 35 |
static struct pci_operations ehci_ops_pci = { |
| 36 |
.set_subsystem = &usb_ehci_set_subsystem, |
| 37 |
}; |
| 38 |
|
| 39 |
static struct device_operations usb_ehci_ops = { |
| 40 |
.read_resources = pci_ehci_read_resources, |
| 41 |
.set_resources = pci_dev_set_resources, |
| 42 |
.enable_resources = pci_dev_enable_resources, |
| 43 |
.ops_pci = &ehci_ops_pci, |
| 44 |
.enable = ehci_enable, |
| 45 |
}; |
| 46 |
|
| 47 |
static const unsigned short pci_device_ids[] = { |
| 48 |
0x9c26, |
| 49 |
0x9ca6, |
| 50 |
0 |
| 51 |
}; |
| 52 |
|
| 53 |
static const struct pci_driver pch_usb_ehci __pci_driver = { |
| 54 |
.ops = &usb_ehci_ops, |
| 55 |
.vendor = PCI_VID_INTEL, |
| 56 |
.devices = pci_device_ids, |
| 57 |
}; |