blob: 42288f9e1831d7717c40b1333a7b1b5e9cce68e8 [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
shkimcc728f02015-09-22 17:53:58 +090018#include <console/console.h>
19#include <device/device.h>
20#include <device/pci.h>
21#include <device/pci_ids.h>
22#include <stdint.h>
23#include <reg_script.h>
24
25#include <soc/iomap.h>
26#include <soc/iosf.h>
27#include <soc/pci_devs.h>
28#include <soc/pm.h>
29#include <soc/ramstage.h>
30#include <soc/xhci.h>
31
32#include "chip.h"
33
Elyes HAOUASb13fac32018-05-24 22:29:44 +020034static void xhci_init(struct device *dev)
shkimcc728f02015-09-22 17:53:58 +090035{
Kyösti Mälkki8950cfb2019-07-13 22:16:25 +030036 struct soc_intel_braswell_config *config = config_of(dev);
shkimcc728f02015-09-22 17:53:58 +090037
Kyösti Mälkki8950cfb2019-07-13 22:16:25 +030038 if (config->usb_comp_bg) {
shkimcc728f02015-09-22 17:53:58 +090039 struct reg_script ops[] = {
40 REG_IOSF_WRITE(IOSF_PORT_USBPHY, USBPHY_COMPBG,
41 config->usb_comp_bg),
42 REG_SCRIPT_END
43 };
Lee Leahyd94cff62017-03-16 17:49:42 -070044 printk(BIOS_INFO, "Override USB2_COMPBG to: 0x%X\n",
45 config->usb_comp_bg);
shkimcc728f02015-09-22 17:53:58 +090046 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};