blob: 24d2955b898294ca7bbb3d7d77e5c98c55ec5358 [file] [log] [blame]
Angel Ponsba38f372020-04-05 15:46:45 +02001/* SPDX-License-Identifier: GPL-2.0-only */
shkimcc728f02015-09-22 17:53:58 +09002
shkimcc728f02015-09-22 17:53:58 +09003#include <console/console.h>
4#include <device/device.h>
5#include <device/pci.h>
6#include <device/pci_ids.h>
shkimcc728f02015-09-22 17:53:58 +09007#include <reg_script.h>
8
9#include <soc/iomap.h>
10#include <soc/iosf.h>
11#include <soc/pci_devs.h>
12#include <soc/pm.h>
13#include <soc/ramstage.h>
14#include <soc/xhci.h>
15
16#include "chip.h"
17
Elyes HAOUASb13fac32018-05-24 22:29:44 +020018static void xhci_init(struct device *dev)
shkimcc728f02015-09-22 17:53:58 +090019{
Kyösti Mälkki8950cfb2019-07-13 22:16:25 +030020 struct soc_intel_braswell_config *config = config_of(dev);
shkimcc728f02015-09-22 17:53:58 +090021
Kyösti Mälkki8950cfb2019-07-13 22:16:25 +030022 if (config->usb_comp_bg) {
shkimcc728f02015-09-22 17:53:58 +090023 struct reg_script ops[] = {
Angel Ponsaee7ab22020-03-19 00:31:58 +010024 REG_IOSF_WRITE(IOSF_PORT_USBPHY, USBPHY_COMPBG, config->usb_comp_bg),
shkimcc728f02015-09-22 17:53:58 +090025 REG_SCRIPT_END
26 };
Angel Ponsaee7ab22020-03-19 00:31:58 +010027 printk(BIOS_INFO, "Override USB2_COMPBG to: 0x%X\n", config->usb_comp_bg);
shkimcc728f02015-09-22 17:53:58 +090028 reg_script_run(ops);
29 }
30}
31
32static struct device_operations xhci_device_ops = {
33 .read_resources = pci_dev_read_resources,
34 .set_resources = pci_dev_set_resources,
35 .enable_resources = pci_dev_enable_resources,
36 .init = xhci_init,
37 .ops_pci = &soc_pci_ops,
38};
39
40static const struct pci_driver soc_xhci __pci_driver = {
41 .ops = &xhci_device_ops,
Felix Singer43b7f412022-03-07 04:34:52 +010042 .vendor = PCI_VID_INTEL,
shkimcc728f02015-09-22 17:53:58 +090043 .device = XHCI_DEVID
44};