2 * This file is part of the LinuxBIOS project.
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19 #include <console/console.h>
20 #include <device/device.h>
21 #include <device/pci.h>
22 #include <device/pci_ids.h>
23 #include <device/pci_ops.h>
26 static void ehci_init(struct device *dev)
30 printk_debug("EHCI: Setting up controller.. ");
31 cmd = pci_read_config32(dev, PCI_COMMAND);
32 pci_write_config32(dev, PCI_COMMAND,
33 cmd | PCI_COMMAND_MASTER);
35 printk_debug("done.\n");
38 static void ehci_set_subsystem(device_t dev, unsigned vendor, unsigned device)
41 access_cntl = pci_read_config8(dev, 0x80);
42 /* Enable writes to protected registers */
43 pci_write_config8(dev, 0x80, access_cntl | 1);
44 /* Write the subsystem vendor and device id */
45 pci_write_config32(dev, PCI_SUBSYSTEM_VENDOR_ID,
46 ((device & 0xffff) << 16) | (vendor & 0xffff));
47 /* Restore protection */
48 pci_write_config8(dev, 0x80, access_cntl);
51 static struct pci_operations lops_pci = {
52 .set_subsystem = &ehci_set_subsystem,
54 static struct device_operations ehci_ops = {
55 .read_resources = pci_dev_read_resources,
56 .set_resources = pci_dev_set_resources,
57 .enable_resources = pci_dev_enable_resources,
60 .enable = i82801db_enable,
64 static const struct pci_driver ehci_driver __pci_driver = {
66 .vendor = PCI_VENDOR_ID_INTEL,
67 .device = PCI_DEVICE_ID_INTEL_82801DB_EHCI,