2 * This file is part of the coreboot project.
4 * Copyright (C) 2009-2010 iWave Systems
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.
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.
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
20 #include <console/console.h>
21 #include <device/device.h>
22 #include <device/pci.h>
23 #include <device/pci_ids.h>
26 static void usb_client_init(struct device *dev)
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");
38 static void usb_client_set_subsystem(device_t dev, unsigned vendor, unsigned device)
40 if (!vendor || !device) {
41 pci_write_config32(dev, PCI_SUBSYSTEM_VENDOR_ID,
42 pci_read_config32(dev, PCI_VENDOR_ID));
44 pci_write_config32(dev, PCI_SUBSYSTEM_VENDOR_ID,
45 ((device & 0xffff) << 16) | (vendor & 0xffff));
49 static struct pci_operations lops_pci = {
50 .set_subsystem = &usb_client_set_subsystem,
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,
62 static const struct pci_driver sch_usb_client __pci_driver = {
63 .ops = &usb_client_ops,
64 .vendor = PCI_VENDOR_ID_INTEL,