Add constants for fast path resume copying
[coreboot.git] / src / southbridge / intel / sch / usb_client.c
1 /*
2  * This file is part of the coreboot project.
3  *
4  * Copyright (C) 2009-2010 iWave Systems
5  *
6  * This program is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License as
8  * published by the Free Software Foundation; version 2 of the License.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
18  */
19
20 #include <console/console.h>
21 #include <device/device.h>
22 #include <device/pci.h>
23 #include <device/pci_ids.h>
24 #include <arch/io.h>
25
26 static void usb_client_init(struct device *dev)
27 {
28         u32 reg32;
29
30         printk(BIOS_DEBUG, "USB Client: Setting up controller.. ");
31         reg32 = pci_read_config32(dev, PCI_COMMAND);
32         reg32 |= PCI_COMMAND_MASTER;
33         reg32 |= PCI_COMMAND_MEMORY;
34         pci_write_config32(dev, PCI_COMMAND, reg32);
35         printk(BIOS_DEBUG, "done.\n");
36 }
37
38 static void usb_client_set_subsystem(device_t dev, unsigned vendor, unsigned device)
39 {
40         if (!vendor || !device) {
41                 pci_write_config32(dev, PCI_SUBSYSTEM_VENDOR_ID,
42                                 pci_read_config32(dev, PCI_VENDOR_ID));
43         } else {
44                 pci_write_config32(dev, PCI_SUBSYSTEM_VENDOR_ID,
45                                 ((device & 0xffff) << 16) | (vendor & 0xffff));
46         }
47 }
48
49 static struct pci_operations lops_pci = {
50         .set_subsystem = &usb_client_set_subsystem,
51 };
52
53 static struct device_operations usb_client_ops = {
54         .read_resources         = pci_dev_read_resources,
55         .set_resources          = pci_dev_set_resources,
56         .enable_resources       = pci_dev_enable_resources,
57         .init                   = usb_client_init,
58         .scan_bus               = 0,
59         .ops_pci                = &lops_pci,
60 };
61
62 static const struct pci_driver sch_usb_client __pci_driver = {
63         .ops    = &usb_client_ops,
64         .vendor = PCI_VENDOR_ID_INTEL,
65         .device = 0x8118,
66 };