blob: 789458f99bf788d8320f9f71d4509fbe5c83ebef [file] [log] [blame]
Yinghai Luc65bd562007-02-01 00:10:05 +00001/*
Stefan Reinauer7e61e452008-01-18 10:35:56 +00002 * This file is part of the coreboot project.
Yinghai Luc65bd562007-02-01 00:10:05 +00003 *
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 Reinauerda323732010-05-25 16:17:45 +000030#include <usbdebug.h>
Yinghai Luc65bd562007-02-01 00:10:05 +000031
Yinghai Luc65bd562007-02-01 00:10:05 +000032static void usb2_init(struct device *dev)
33{
Uwe Hermannc7f0c8f2011-01-04 19:51:33 +000034 u32 dword;
Yinghai Luc65bd562007-02-01 00:10:05 +000035 dword = pci_read_config32(dev, 0xf8);
36 dword |= 40;
37 pci_write_config32(dev, 0xf8, dword);
38}
39
40static void usb2_set_resources(struct device *dev)
41{
Stefan Reinauer7e00a442010-05-25 17:09:05 +000042#if CONFIG_USBDEBUG
Yinghai Luc65bd562007-02-01 00:10:05 +000043 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 Reinauer7e00a442010-05-25 17:09:05 +000052#if CONFIG_USBDEBUG
Yinghai Luc65bd562007-02-01 00:10:05 +000053 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 Luc65bd562007-02-01 00:10:05 +000063static 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 Kollaschdca8b1b2010-10-29 20:40:06 +000070 .ops_pci = &mcp55_pci_ops,
Yinghai Luc65bd562007-02-01 00:10:05 +000071};
72
Stefan Reinauerf1cf1f72007-10-24 09:08:58 +000073static const struct pci_driver usb2_driver __pci_driver = {
Yinghai Luc65bd562007-02-01 00:10:05 +000074 .ops = &usb2_ops,
75 .vendor = PCI_VENDOR_ID_NVIDIA,
76 .device = PCI_DEVICE_ID_NVIDIA_MCP55_USB2,
77};