blob: 5dd5866c4e501f46ce75b7f0fd175903bef222ca [file] [log] [blame]
Stefan Reinauer8702ab52010-03-14 17:01:08 +00001/*
2 * This file is part of the coreboot project.
3 *
4 * Copyright (C) 2003 Tyan
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License as
8 * published by the Free Software Foundation; version 2 of
9 * the License.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
19 * MA 02110-1301 USA
20 */
Ronald G. Minnich182615d2004-08-24 16:20:46 +000021
22#include <console/console.h>
23#include <device/device.h>
24#include <device/pci.h>
25#include <device/pci_ids.h>
26#include <device/pci_ops.h>
Kyösti Mälkkicaaf0bf2013-06-06 10:21:28 +030027#include <usbdebug.h>
Stefan Reinauer138be832010-02-27 01:50:21 +000028#include "i82801dx.h"
Ronald G. Minnich182615d2004-08-24 16:20:46 +000029
30static void usb2_init(struct device *dev)
31{
Stefan Reinauer8702ab52010-03-14 17:01:08 +000032 u32 cmd;
Stefan Reinauerc02b4fc2010-03-22 11:42:32 +000033 printk(BIOS_DEBUG, "USB: Setting up controller.. ");
Ronald G. Minnich182615d2004-08-24 16:20:46 +000034 cmd = pci_read_config32(dev, PCI_COMMAND);
Stefan Reinauer8702ab52010-03-14 17:01:08 +000035 pci_write_config32(dev, PCI_COMMAND,
36 cmd | PCI_COMMAND_IO | PCI_COMMAND_MEMORY |
37 PCI_COMMAND_MASTER | PCI_COMMAND_INVALIDATE);
Stefan Reinauerc02b4fc2010-03-22 11:42:32 +000038 printk(BIOS_DEBUG, "done.\n");
Ronald G. Minnich182615d2004-08-24 16:20:46 +000039}
40
Stefan Reinauer8702ab52010-03-14 17:01:08 +000041static struct device_operations usb2_ops = {
Kyösti Mälkkicaaf0bf2013-06-06 10:21:28 +030042 .read_resources = pci_ehci_read_resources,
Stefan Reinauer8702ab52010-03-14 17:01:08 +000043 .set_resources = pci_dev_set_resources,
Ronald G. Minnich182615d2004-08-24 16:20:46 +000044 .enable_resources = pci_dev_enable_resources,
Stefan Reinauer8702ab52010-03-14 17:01:08 +000045 .init = usb2_init,
46 .scan_bus = 0,
47 .enable = i82801dx_enable,
Ronald G. Minnich182615d2004-08-24 16:20:46 +000048};
49
Stefan Reinauer8702ab52010-03-14 17:01:08 +000050/* 82801DB/DBM USB 2.0 */
Stefan Reinauerf1cf1f72007-10-24 09:08:58 +000051static const struct pci_driver usb2_driver __pci_driver = {
Stefan Reinauer8702ab52010-03-14 17:01:08 +000052 .ops = &usb2_ops,
Ronald G. Minnich182615d2004-08-24 16:20:46 +000053 .vendor = PCI_VENDOR_ID_INTEL,
Stefan Reinauer8702ab52010-03-14 17:01:08 +000054 .device = PCI_DEVICE_ID_INTEL_82801DB_EHCI,
Ronald G. Minnich182615d2004-08-24 16:20:46 +000055};