pci drivers should be const.
[coreboot.git] / src / southbridge / intel / i3100 / i3100_ehci.c
1 /*
2  * This file is part of the coreboot project.
3  *
4  * Copyright (C) 2008 Arastra, Inc.
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License version 2 as
8  * published by the Free Software Foundation.
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
21 #include <console/console.h>
22 #include <device/device.h>
23 #include <device/pci.h>
24 #include <device/pci_ids.h>
25 #include <device/pci_ops.h>
26 #include "i3100.h"
27
28 static void ehci_init(struct device *dev)
29 {
30 }
31
32 static void ehci_set_subsystem(device_t dev, unsigned vendor, unsigned device)
33 {
34         u8 access_cntl;
35         access_cntl = pci_read_config8(dev, 0x80);
36         /* Enable writes to protected registers */
37         pci_write_config8(dev, 0x80, access_cntl | 1);
38         /* Write the subsystem vendor and device id */
39         pci_write_config32(dev, PCI_SUBSYSTEM_VENDOR_ID,
40                 ((device & 0xffff) << 16) | (vendor & 0xffff));
41         /* Restore protection */
42         pci_write_config8(dev, 0x80, access_cntl);
43 }
44
45 static struct pci_operations lops_pci = {
46         .set_subsystem = &ehci_set_subsystem,
47 };
48 static struct device_operations ehci_ops  = {
49         .read_resources   = pci_dev_read_resources,
50         .set_resources    = pci_dev_set_resources,
51         .enable_resources = pci_dev_enable_resources,
52         .init             = ehci_init,
53         .scan_bus         = 0,
54         .enable           = i3100_enable,
55         .ops_pci          = &lops_pci,
56 };
57
58 static const struct pci_driver ehci_driver __pci_driver = {
59         .ops    = &ehci_ops,
60         .vendor = PCI_VENDOR_ID_INTEL,
61         .device = PCI_DEVICE_ID_INTEL_3100_EHCI,
62 };
63
64 static const struct pci_driver ehci_driver_ep80579 __pci_driver = {
65         .ops    = &ehci_ops,
66         .vendor = PCI_VENDOR_ID_INTEL,
67         .device = PCI_DEVICE_ID_INTEL_EP80579_EHCI,
68 };