blob: 21d1a6b49157caa393c2ec28c3e3b7dbf35bf6ba [file] [log] [blame]
Stefan Reinauerdebb11f2008-10-29 04:46:52 +00001/*
2 * This file is part of the coreboot project.
3 *
Stefan Reinauerdebb11f2008-10-29 04:46:52 +00004 *
Stefan Reinauera8e11682009-03-11 14:54:18 +00005 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License as
7 * published by the Free Software Foundation; version 2 of
8 * the License.
Stefan Reinauerdebb11f2008-10-29 04:46:52 +00009 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
Stefan Reinauerdebb11f2008-10-29 04:46:52 +000014 */
15
16#include <console/console.h>
17#include <device/device.h>
18#include <device/pci.h>
Kyösti Mälkkif1b58b72019-03-01 13:43:02 +020019#include <device/pci_ops.h>
Stefan Reinauerdebb11f2008-10-29 04:46:52 +000020#include <device/pci_ids.h>
21#include "i82801gx.h"
22
23static void usb_init(struct device *dev)
24{
25 u32 reg32;
26 u8 reg8;
27
28 /* USB Specification says the device must be Bus Master */
Stefan Reinauerc02b4fc2010-03-22 11:42:32 +000029 printk(BIOS_DEBUG, "UHCI: Setting up controller.. ");
Stefan Reinauerdebb11f2008-10-29 04:46:52 +000030
31 reg32 = pci_read_config32(dev, PCI_COMMAND);
32 pci_write_config32(dev, PCI_COMMAND, reg32 | PCI_COMMAND_MASTER);
33
Stefan Reinauer7a3d0952010-01-17 13:49:07 +000034 // Erratum
35 pci_write_config8(dev, 0xca, 0x00);
36
37 // Yes. Another Erratum
Stefan Reinauerdebb11f2008-10-29 04:46:52 +000038 reg8 = pci_read_config8(dev, 0xca);
39 reg8 |= (1 << 0);
40 pci_write_config8(dev, 0xca, reg8);
41
Stefan Reinauerc02b4fc2010-03-22 11:42:32 +000042 printk(BIOS_DEBUG, "done.\n");
Stefan Reinauerdebb11f2008-10-29 04:46:52 +000043}
44
Stefan Reinauera8e11682009-03-11 14:54:18 +000045static struct pci_operations usb_pci_ops = {
Subrata Banik4a0f0712019-03-20 14:29:47 +053046 .set_subsystem = pci_dev_set_subsystem,
Stefan Reinauera8e11682009-03-11 14:54:18 +000047};
48
Stefan Reinauerdebb11f2008-10-29 04:46:52 +000049static struct device_operations usb_ops = {
50 .read_resources = pci_dev_read_resources,
51 .set_resources = pci_dev_set_resources,
52 .enable_resources = pci_dev_enable_resources,
53 .init = usb_init,
54 .scan_bus = 0,
55 .enable = i82801gx_enable,
Stefan Reinauera8e11682009-03-11 14:54:18 +000056 .ops_pci = &usb_pci_ops,
Stefan Reinauerdebb11f2008-10-29 04:46:52 +000057};
58
59/* 82801GB/GR/GDH/GBM/GHM/GU (ICH7/ICH7R/ICH7DH/ICH7-M/ICH7-M DH/ICH7-U) */
60static const struct pci_driver i82801gb_usb1 __pci_driver = {
61 .ops = &usb_ops,
62 .vendor = PCI_VENDOR_ID_INTEL,
Uwe Hermann5d7a1c82008-10-31 18:41:09 +000063 .device = 0x27c8,
Stefan Reinauerdebb11f2008-10-29 04:46:52 +000064};
65
Uwe Hermannbddc6932008-10-29 13:51:31 +000066/* 82801GB/GR/GDH/GBM/GHM/GU (ICH7/ICH7R/ICH7DH/ICH7-M/ICH7-M DH/ICH7-U) */
Stefan Reinauerdebb11f2008-10-29 04:46:52 +000067static const struct pci_driver i82801gb_usb2 __pci_driver = {
68 .ops = &usb_ops,
69 .vendor = PCI_VENDOR_ID_INTEL,
Uwe Hermann5d7a1c82008-10-31 18:41:09 +000070 .device = 0x27c9,
Stefan Reinauerdebb11f2008-10-29 04:46:52 +000071};
72
Uwe Hermannbddc6932008-10-29 13:51:31 +000073/* 82801GB/GR/GDH/GBM/GHM/GU (ICH7/ICH7R/ICH7DH/ICH7-M/ICH7-M DH/ICH7-U) */
Stefan Reinauerdebb11f2008-10-29 04:46:52 +000074static const struct pci_driver i82801gb_usb3 __pci_driver = {
75 .ops = &usb_ops,
76 .vendor = PCI_VENDOR_ID_INTEL,
Uwe Hermann5d7a1c82008-10-31 18:41:09 +000077 .device = 0x27ca,
Stefan Reinauerdebb11f2008-10-29 04:46:52 +000078};
79
Uwe Hermannbddc6932008-10-29 13:51:31 +000080/* 82801GB/GR/GDH/GBM/GHM/GU (ICH7/ICH7R/ICH7DH/ICH7-M/ICH7-M DH/ICH7-U) */
Stefan Reinauerdebb11f2008-10-29 04:46:52 +000081static const struct pci_driver i82801gb_usb4 __pci_driver = {
82 .ops = &usb_ops,
83 .vendor = PCI_VENDOR_ID_INTEL,
Uwe Hermann5d7a1c82008-10-31 18:41:09 +000084 .device = 0x27cb,
Stefan Reinauerdebb11f2008-10-29 04:46:52 +000085};