2 * This file is part of the coreboot project.
4 * Copyright (C) 2004 Tyan Computer
5 * Written by Yinghai Lu <yhlu@tyan.com> for Tyan Computer.
6 * Copyright (C) 2006,2007 AMD
7 * Written by Yinghai Lu <yinghai.lu@amd.com> for AMD.
8 * Copyright (C) 2007 Silicon Integrated Systems Corp. (SiS)
9 * Written by Morgan Tsai <my_tsai@sis.com> for SiS.
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
26 #include <console/console.h>
27 #include <device/device.h>
28 #include <device/pci.h>
29 #include <device/pci_ids.h>
30 #include <device/pci_ops.h>
35 extern struct ehci_debug_info dbg_info;
37 u8 SiS_SiS7002_init[22][3]={
66 {0x00, 0x00, 0x00} //End of table
69 static void usb2_init(struct device *dev)
74 print_debug("USB 2.0 INIT:---------->\n");
76 //-------------- enable USB2.0 (SiS7002) -------------------------
81 while(SiS_SiS7002_init[i][0] != 0)
83 temp8 = pci_read_config8(dev, SiS_SiS7002_init[i][0]);
84 temp8 &= SiS_SiS7002_init[i][1];
85 temp8 |= SiS_SiS7002_init[i][2];
86 pci_write_config8(dev, SiS_SiS7002_init[i][0], temp8);
91 res = find_resource(dev, 0x10);
96 printk(BIOS_DEBUG, "base = 0x%08x\n", base);
97 write32(base+0x20, 0x2);
98 //-----------------------------------------------------------
104 print_debug("****** USB 2.0 PCI config ******");
105 print_debug("\n 03020100 07060504 0B0A0908 0F0E0D0C");
107 for(i=0;i<0xff;i+=4){
113 print_debug_hex32(pci_read_config32(dev,i));
119 print_debug("USB 2.0 INIT:<----------\n");
122 static void usb2_set_resources(struct device *dev)
125 struct resource *res;
129 old_debug = get_ehci_debug();
132 pci_dev_set_resources(dev);
135 res = find_resource(dev, 0x10);
136 set_ehci_debug(old_debug);
140 report_resource_stored(dev, res, "");
145 static void lpci_set_subsystem(device_t dev, unsigned vendor, unsigned device)
147 pci_write_config32(dev, 0x40,
148 ((device & 0xffff) << 16) | (vendor & 0xffff));
150 static struct pci_operations lops_pci = {
151 .set_subsystem = lpci_set_subsystem,
154 static struct device_operations usb2_ops = {
155 .read_resources = pci_dev_read_resources,
156 .set_resources = usb2_set_resources,
157 .enable_resources = pci_dev_enable_resources,
159 // .enable = sis966_enable,
161 .ops_pci = &lops_pci,
164 static const struct pci_driver usb2_driver __pci_driver = {
166 .vendor = PCI_VENDOR_ID_SIS,
167 .device = PCI_DEVICE_ID_SIS_SIS966_USB2,