blob: e3e3462fa50e4e917ab40209031486ed7d906789 [file] [log] [blame]
shkimcc728f02015-09-22 17:53:58 +09001/*
2 * This file is part of the coreboot project.
3 *
4 * Copyright 2013 Google Inc.
5 * Copyright (C) 2015 Intel Corp.
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; version 2 of 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 */
17
18#include <arch/acpi.h>
19#include <console/console.h>
20#include <device/device.h>
21#include <device/pci.h>
22#include <device/pci_ids.h>
23#include <stdint.h>
24#include <reg_script.h>
25
26#include <soc/iomap.h>
27#include <soc/iosf.h>
28#include <soc/pci_devs.h>
29#include <soc/pm.h>
30#include <soc/ramstage.h>
31#include <soc/xhci.h>
32
33#include "chip.h"
34
35static void xhci_init(device_t dev)
36{
37 struct soc_intel_braswell_config *config = dev->chip_info;
38
39 if (config && config->usb_comp_bg) {
40 struct reg_script ops[] = {
41 REG_IOSF_WRITE(IOSF_PORT_USBPHY, USBPHY_COMPBG,
42 config->usb_comp_bg),
43 REG_SCRIPT_END
44 };
45 printk(BIOS_INFO, "Override USB2_COMPBG to: 0x%X\n", config->usb_comp_bg);
46 reg_script_run(ops);
47 }
48}
49
50static struct device_operations xhci_device_ops = {
51 .read_resources = pci_dev_read_resources,
52 .set_resources = pci_dev_set_resources,
53 .enable_resources = pci_dev_enable_resources,
54 .init = xhci_init,
55 .ops_pci = &soc_pci_ops,
56};
57
58static const struct pci_driver soc_xhci __pci_driver = {
59 .ops = &xhci_device_ops,
60 .vendor = PCI_VENDOR_ID_INTEL,
61 .device = XHCI_DEVID
62};