15295d8329d82c8d7a18e6d36ddf31639571a540
[coreboot.git] / src / southbridge / broadcom / bcm5785 / bcm5785_usb.c
1 /*
2  * Copyright  2005 AMD
3  *  by yinghai.lu@amd.com
4  */
5
6 #include <console/console.h>
7 #include <device/device.h>
8 #include <device/pci.h>
9 #include <device/pci_ids.h>
10 #include <device/pci_ops.h>
11 #include "bcm5785.h"
12
13 static void usb_init(struct device *dev)
14 {
15         uint32_t dword;
16
17         dword = pci_read_config32(dev, 0x04);
18         dword |= (1<<2)|(1<<1)|(1<<0);
19         pci_write_config32(dev, 0x04, dword);
20
21         pci_write_config8(dev, 0x41, 0x00); // Serversworks said
22
23 }
24
25 static void lpci_set_subsystem(device_t dev, unsigned vendor, unsigned device)
26 {
27         pci_write_config32(dev, 0x40,
28                 ((device & 0xffff) << 16) | (vendor & 0xffff));
29 }
30 static struct pci_operations lops_pci = {
31         .set_subsystem = lpci_set_subsystem,
32 };
33
34 static struct device_operations usb_ops  = {
35         .read_resources   = pci_dev_read_resources,
36         .set_resources    = pci_dev_set_resources,
37         .enable_resources = pci_dev_enable_resources,
38         .init             = usb_init,
39 //      .enable           = bcm5785_enable,
40         .scan_bus         = 0,
41         .ops_pci          = &lops_pci,
42 };
43
44 static const struct pci_driver usb_driver __pci_driver = {
45         .ops    = &usb_ops,
46         .vendor = PCI_VENDOR_ID_SERVERWORKS,
47         .device = PCI_DEVICE_ID_SERVERWORKS_BCM5785_USB,
48 };
49