Angel Pons | ba38f37 | 2020-04-05 15:46:45 +0200 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
shkim | cc728f0 | 2015-09-22 17:53:58 +0900 | [diff] [blame] | 2 | |
shkim | cc728f0 | 2015-09-22 17:53:58 +0900 | [diff] [blame] | 3 | #include <console/console.h> |
| 4 | #include <device/device.h> |
| 5 | #include <device/pci.h> |
| 6 | #include <device/pci_ids.h> |
shkim | cc728f0 | 2015-09-22 17:53:58 +0900 | [diff] [blame] | 7 | #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 HAOUAS | b13fac3 | 2018-05-24 22:29:44 +0200 | [diff] [blame] | 18 | static void xhci_init(struct device *dev) |
shkim | cc728f0 | 2015-09-22 17:53:58 +0900 | [diff] [blame] | 19 | { |
Kyösti Mälkki | 8950cfb | 2019-07-13 22:16:25 +0300 | [diff] [blame] | 20 | struct soc_intel_braswell_config *config = config_of(dev); |
shkim | cc728f0 | 2015-09-22 17:53:58 +0900 | [diff] [blame] | 21 | |
Kyösti Mälkki | 8950cfb | 2019-07-13 22:16:25 +0300 | [diff] [blame] | 22 | if (config->usb_comp_bg) { |
shkim | cc728f0 | 2015-09-22 17:53:58 +0900 | [diff] [blame] | 23 | struct reg_script ops[] = { |
Angel Pons | aee7ab2 | 2020-03-19 00:31:58 +0100 | [diff] [blame] | 24 | REG_IOSF_WRITE(IOSF_PORT_USBPHY, USBPHY_COMPBG, config->usb_comp_bg), |
shkim | cc728f0 | 2015-09-22 17:53:58 +0900 | [diff] [blame] | 25 | REG_SCRIPT_END |
| 26 | }; |
Angel Pons | aee7ab2 | 2020-03-19 00:31:58 +0100 | [diff] [blame] | 27 | printk(BIOS_INFO, "Override USB2_COMPBG to: 0x%X\n", config->usb_comp_bg); |
shkim | cc728f0 | 2015-09-22 17:53:58 +0900 | [diff] [blame] | 28 | reg_script_run(ops); |
| 29 | } |
| 30 | } |
| 31 | |
| 32 | static 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 | |
| 40 | static const struct pci_driver soc_xhci __pci_driver = { |
| 41 | .ops = &xhci_device_ops, |
| 42 | .vendor = PCI_VENDOR_ID_INTEL, |
| 43 | .device = XHCI_DEVID |
| 44 | }; |