Yinghai Lu | c65bd56 | 2007-02-01 00:10:05 +0000 | [diff] [blame] | 1 | /* |
Stefan Reinauer | 7e61e45 | 2008-01-18 10:35:56 +0000 | [diff] [blame] | 2 | * This file is part of the coreboot project. |
Yinghai Lu | c65bd56 | 2007-02-01 00:10:05 +0000 | [diff] [blame] | 3 | * |
| 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 | * |
| 9 | * This program is free software; you can redistribute it and/or modify |
| 10 | * it under the terms of the GNU General Public License as published by |
| 11 | * the Free Software Foundation; either version 2 of the License, or |
| 12 | * (at your option) any later version. |
| 13 | * |
| 14 | * This program is distributed in the hope that it will be useful, |
| 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 17 | * GNU General Public License for more details. |
| 18 | * |
| 19 | * You should have received a copy of the GNU General Public License |
| 20 | * along with this program; if not, write to the Free Software |
| 21 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
| 22 | */ |
| 23 | |
| 24 | #include <console/console.h> |
| 25 | #include <device/device.h> |
| 26 | #include <device/pci.h> |
| 27 | #include <device/pci_ids.h> |
| 28 | #include <device/pci_ops.h> |
| 29 | #include "mcp55.h" |
Stefan Reinauer | da32373 | 2010-05-25 16:17:45 +0000 | [diff] [blame] | 30 | #include <usbdebug.h> |
Yinghai Lu | c65bd56 | 2007-02-01 00:10:05 +0000 | [diff] [blame] | 31 | |
Yinghai Lu | c65bd56 | 2007-02-01 00:10:05 +0000 | [diff] [blame] | 32 | static void usb2_init(struct device *dev) |
| 33 | { |
Uwe Hermann | c7f0c8f | 2011-01-04 19:51:33 +0000 | [diff] [blame] | 34 | u32 dword; |
Yinghai Lu | c65bd56 | 2007-02-01 00:10:05 +0000 | [diff] [blame] | 35 | dword = pci_read_config32(dev, 0xf8); |
| 36 | dword |= 40; |
| 37 | pci_write_config32(dev, 0xf8, dword); |
| 38 | } |
| 39 | |
| 40 | static void usb2_set_resources(struct device *dev) |
| 41 | { |
Stefan Reinauer | 7e00a44 | 2010-05-25 17:09:05 +0000 | [diff] [blame] | 42 | #if CONFIG_USBDEBUG |
Yinghai Lu | c65bd56 | 2007-02-01 00:10:05 +0000 | [diff] [blame] | 43 | struct resource *res; |
| 44 | unsigned base; |
| 45 | unsigned old_debug; |
| 46 | |
| 47 | old_debug = get_ehci_debug(); |
| 48 | set_ehci_debug(0); |
| 49 | #endif |
| 50 | pci_dev_set_resources(dev); |
| 51 | |
Stefan Reinauer | 7e00a44 | 2010-05-25 17:09:05 +0000 | [diff] [blame] | 52 | #if CONFIG_USBDEBUG |
Yinghai Lu | c65bd56 | 2007-02-01 00:10:05 +0000 | [diff] [blame] | 53 | res = find_resource(dev, 0x10); |
| 54 | set_ehci_debug(old_debug); |
| 55 | if (!res) return; |
| 56 | base = res->base; |
| 57 | set_ehci_base(base); |
| 58 | report_resource_stored(dev, res, ""); |
| 59 | #endif |
| 60 | |
| 61 | } |
| 62 | |
Yinghai Lu | c65bd56 | 2007-02-01 00:10:05 +0000 | [diff] [blame] | 63 | static struct device_operations usb2_ops = { |
| 64 | .read_resources = pci_dev_read_resources, |
| 65 | .set_resources = usb2_set_resources, |
| 66 | .enable_resources = pci_dev_enable_resources, |
| 67 | .init = usb2_init, |
| 68 | // .enable = mcp55_enable, |
| 69 | .scan_bus = 0, |
Jonathan Kollasch | dca8b1b | 2010-10-29 20:40:06 +0000 | [diff] [blame] | 70 | .ops_pci = &mcp55_pci_ops, |
Yinghai Lu | c65bd56 | 2007-02-01 00:10:05 +0000 | [diff] [blame] | 71 | }; |
| 72 | |
Stefan Reinauer | f1cf1f7 | 2007-10-24 09:08:58 +0000 | [diff] [blame] | 73 | static const struct pci_driver usb2_driver __pci_driver = { |
Yinghai Lu | c65bd56 | 2007-02-01 00:10:05 +0000 | [diff] [blame] | 74 | .ops = &usb2_ops, |
| 75 | .vendor = PCI_VENDOR_ID_NVIDIA, |
| 76 | .device = PCI_DEVICE_ID_NVIDIA_MCP55_USB2, |
| 77 | }; |