shkim | cc728f0 | 2015-09-22 17:53:58 +0900 | [diff] [blame] | 1 | /* |
| 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 | |
shkim | cc728f0 | 2015-09-22 17:53:58 +0900 | [diff] [blame] | 18 | #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 HAOUAS | b13fac3 | 2018-05-24 22:29:44 +0200 | [diff] [blame] | 34 | static void xhci_init(struct device *dev) |
shkim | cc728f0 | 2015-09-22 17:53:58 +0900 | [diff] [blame] | 35 | { |
| 36 | struct soc_intel_braswell_config *config = dev->chip_info; |
| 37 | |
| 38 | if (config && config->usb_comp_bg) { |
| 39 | struct reg_script ops[] = { |
| 40 | REG_IOSF_WRITE(IOSF_PORT_USBPHY, USBPHY_COMPBG, |
| 41 | config->usb_comp_bg), |
| 42 | REG_SCRIPT_END |
| 43 | }; |
Lee Leahy | d94cff6 | 2017-03-16 17:49:42 -0700 | [diff] [blame] | 44 | printk(BIOS_INFO, "Override USB2_COMPBG to: 0x%X\n", |
| 45 | config->usb_comp_bg); |
shkim | cc728f0 | 2015-09-22 17:53:58 +0900 | [diff] [blame] | 46 | reg_script_run(ops); |
| 47 | } |
| 48 | } |
| 49 | |
| 50 | static 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 | |
| 58 | static const struct pci_driver soc_xhci __pci_driver = { |
| 59 | .ops = &xhci_device_ops, |
| 60 | .vendor = PCI_VENDOR_ID_INTEL, |
| 61 | .device = XHCI_DEVID |
| 62 | }; |