blob: dda3d95493537828b2c8367e933574cf368735c1 [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.
Stefan Reinauer8702ab52010-03-14 17:01:08 +000015 */
Ronald G. Minnich182615d2004-08-24 16:20:46 +000016
17#include <console/console.h>
18#include <device/device.h>
19#include <device/pci.h>
20#include <device/pci_ids.h>
21#include <device/pci_ops.h>
Kyösti Mälkkie2227a22014-02-05 13:02:55 +020022#include <device/pci_ehci.h>
Stefan Reinauer138be832010-02-27 01:50:21 +000023#include "i82801dx.h"
Ronald G. Minnich182615d2004-08-24 16:20:46 +000024
25static void usb2_init(struct device *dev)
26{
Stefan Reinauer8702ab52010-03-14 17:01:08 +000027 u32 cmd;
Stefan Reinauerc02b4fc2010-03-22 11:42:32 +000028 printk(BIOS_DEBUG, "USB: Setting up controller.. ");
Ronald G. Minnich182615d2004-08-24 16:20:46 +000029 cmd = pci_read_config32(dev, PCI_COMMAND);
Stefan Reinauer8702ab52010-03-14 17:01:08 +000030 pci_write_config32(dev, PCI_COMMAND,
31 cmd | PCI_COMMAND_IO | PCI_COMMAND_MEMORY |
32 PCI_COMMAND_MASTER | PCI_COMMAND_INVALIDATE);
Stefan Reinauerc02b4fc2010-03-22 11:42:32 +000033 printk(BIOS_DEBUG, "done.\n");
Ronald G. Minnich182615d2004-08-24 16:20:46 +000034}
35
Stefan Reinauer8702ab52010-03-14 17:01:08 +000036static struct device_operations usb2_ops = {
Kyösti Mälkkicaaf0bf2013-06-06 10:21:28 +030037 .read_resources = pci_ehci_read_resources,
Stefan Reinauer8702ab52010-03-14 17:01:08 +000038 .set_resources = pci_dev_set_resources,
Ronald G. Minnich182615d2004-08-24 16:20:46 +000039 .enable_resources = pci_dev_enable_resources,
Stefan Reinauer8702ab52010-03-14 17:01:08 +000040 .init = usb2_init,
41 .scan_bus = 0,
42 .enable = i82801dx_enable,
Ronald G. Minnich182615d2004-08-24 16:20:46 +000043};
44
Stefan Reinauer8702ab52010-03-14 17:01:08 +000045/* 82801DB/DBM USB 2.0 */
Stefan Reinauerf1cf1f72007-10-24 09:08:58 +000046static const struct pci_driver usb2_driver __pci_driver = {
Stefan Reinauer8702ab52010-03-14 17:01:08 +000047 .ops = &usb2_ops,
Ronald G. Minnich182615d2004-08-24 16:20:46 +000048 .vendor = PCI_VENDOR_ID_INTEL,
Stefan Reinauer8702ab52010-03-14 17:01:08 +000049 .device = PCI_DEVICE_ID_INTEL_82801DB_EHCI,
Ronald G. Minnich182615d2004-08-24 16:20:46 +000050};