blob: 53fece054a6ec5aa1afc5026a162208f10dd922a [file] [log] [blame]
Angel Pons182dbde2020-04-02 23:49:05 +02001/* SPDX-License-Identifier: GPL-2.0-only */
2/* This file is part of the coreboot project. */
Ronald G. Minnich182615d2004-08-24 16:20:46 +00003
4#include <console/console.h>
5#include <device/device.h>
6#include <device/pci.h>
7#include <device/pci_ids.h>
8#include <device/pci_ops.h>
Kyösti Mälkkie2227a22014-02-05 13:02:55 +02009#include <device/pci_ehci.h>
Stefan Reinauer138be832010-02-27 01:50:21 +000010#include "i82801dx.h"
Ronald G. Minnich182615d2004-08-24 16:20:46 +000011
12static void usb2_init(struct device *dev)
13{
Stefan Reinauer8702ab52010-03-14 17:01:08 +000014 u32 cmd;
Stefan Reinauerc02b4fc2010-03-22 11:42:32 +000015 printk(BIOS_DEBUG, "USB: Setting up controller.. ");
Ronald G. Minnich182615d2004-08-24 16:20:46 +000016 cmd = pci_read_config32(dev, PCI_COMMAND);
Stefan Reinauer8702ab52010-03-14 17:01:08 +000017 pci_write_config32(dev, PCI_COMMAND,
18 cmd | PCI_COMMAND_IO | PCI_COMMAND_MEMORY |
19 PCI_COMMAND_MASTER | PCI_COMMAND_INVALIDATE);
Stefan Reinauerc02b4fc2010-03-22 11:42:32 +000020 printk(BIOS_DEBUG, "done.\n");
Ronald G. Minnich182615d2004-08-24 16:20:46 +000021}
22
Stefan Reinauer8702ab52010-03-14 17:01:08 +000023static struct device_operations usb2_ops = {
Kyösti Mälkkicaaf0bf2013-06-06 10:21:28 +030024 .read_resources = pci_ehci_read_resources,
Stefan Reinauer8702ab52010-03-14 17:01:08 +000025 .set_resources = pci_dev_set_resources,
Ronald G. Minnich182615d2004-08-24 16:20:46 +000026 .enable_resources = pci_dev_enable_resources,
Stefan Reinauer8702ab52010-03-14 17:01:08 +000027 .init = usb2_init,
28 .scan_bus = 0,
29 .enable = i82801dx_enable,
Ronald G. Minnich182615d2004-08-24 16:20:46 +000030};
31
Stefan Reinauer8702ab52010-03-14 17:01:08 +000032/* 82801DB/DBM USB 2.0 */
Stefan Reinauerf1cf1f72007-10-24 09:08:58 +000033static const struct pci_driver usb2_driver __pci_driver = {
Stefan Reinauer8702ab52010-03-14 17:01:08 +000034 .ops = &usb2_ops,
Ronald G. Minnich182615d2004-08-24 16:20:46 +000035 .vendor = PCI_VENDOR_ID_INTEL,
Stefan Reinauer8702ab52010-03-14 17:01:08 +000036 .device = PCI_DEVICE_ID_INTEL_82801DB_EHCI,
Ronald G. Minnich182615d2004-08-24 16:20:46 +000037};