2 * This file is part of the coreboot project.
4 * Copyright (C) 2005 Tyan Computer
5 * (Written by Yinghai Lu <yinghailu@gmail.com> for Tyan Computer>
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
22 #include <console/console.h>
23 #include <device/device.h>
24 #include <device/pci.h>
25 #include <device/pci_ids.h>
28 static void usb_ehci_init(struct device *dev)
30 /* TODO: Is any special init really needed? */
33 printk(BIOS_DEBUG, "EHCI: Setting up controller.. ");
34 cmd = pci_read_config32(dev, PCI_COMMAND);
35 pci_write_config32(dev, PCI_COMMAND, cmd | PCI_COMMAND_MASTER);
37 printk(BIOS_DEBUG, "done.\n");
40 static void usb_ehci_set_subsystem(device_t dev, unsigned vendor,
45 access_cntl = pci_read_config8(dev, 0x80);
47 /* Enable writes to protected registers. */
48 pci_write_config8(dev, 0x80, access_cntl | 1);
50 /* Write the subsystem vendor and device ID. */
51 pci_write_config32(dev, PCI_SUBSYSTEM_VENDOR_ID,
52 ((device & 0xffff) << 16) | (vendor & 0xffff));
54 /* Restore protection. */
55 pci_write_config8(dev, 0x80, access_cntl);
58 static struct pci_operations lops_pci = {
59 .set_subsystem = &usb_ehci_set_subsystem,
62 static struct device_operations usb_ehci_ops = {
63 .read_resources = pci_dev_read_resources,
64 .set_resources = pci_dev_set_resources,
65 .enable_resources = pci_dev_enable_resources,
66 .init = usb_ehci_init,
68 .enable = i82801bx_enable,
72 /* 82801DB and 82801DBM */
73 static const struct pci_driver i82801db_usb_ehci __pci_driver = {
75 .vendor = PCI_VENDOR_ID_INTEL,
79 /* 82801EB and 82801ER */
80 static const struct pci_driver i82801ex_usb_ehci __pci_driver = {
82 .vendor = PCI_VENDOR_ID_INTEL,