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