2 * This file is part of the coreboot project.
4 * Copyright (C) 2008 coresystems GmbH
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
21 #include <console/console.h>
22 #include <device/device.h>
23 #include <device/pci.h>
24 #include <device/pci_ids.h>
27 static void usb_ehci_init(struct device *dev)
31 printk_debug("EHCI: Setting up controller.. ");
32 reg32 = pci_read_config32(dev, PCI_COMMAND);
33 pci_write_config32(dev, PCI_COMMAND, reg32 | PCI_COMMAND_MASTER);
35 reg32 = pci_read_config32(dev, 0xdc);
36 reg32 |= (1 << 31) | (1 << 27);
37 pci_write_config32(dev, 0xdc, reg32);
39 reg32 = pci_read_config32(dev, 0xfc);
41 reg32 |= (2 << 2) | (1 << 29) | (1 << 17);
42 pci_write_config32(dev, 0xfc, reg32);
44 printk_debug("done.\n");
47 static void usb_ehci_set_subsystem(device_t dev, unsigned vendor,
52 access_cntl = pci_read_config8(dev, 0x80);
54 /* Enable writes to protected registers. */
55 pci_write_config8(dev, 0x80, access_cntl | 1);
57 /* Write the subsystem vendor and device ID. */
58 pci_write_config32(dev, PCI_SUBSYSTEM_VENDOR_ID,
59 ((device & 0xffff) << 16) | (vendor & 0xffff));
61 /* Restore protection. */
62 pci_write_config8(dev, 0x80, access_cntl);
65 static struct pci_operations lops_pci = {
66 .set_subsystem = &usb_ehci_set_subsystem,
69 static struct device_operations usb_ehci_ops = {
70 .read_resources = pci_dev_read_resources,
71 .set_resources = pci_dev_set_resources,
72 .enable_resources = pci_dev_enable_resources,
73 .init = usb_ehci_init,
75 .enable = i82801gx_enable,
80 static const struct pci_driver i82801ex_usb_ehci __pci_driver = {
82 .vendor = PCI_VENDOR_ID_INTEL,