Angel Pons | 0612b27 | 2020-04-05 15:46:56 +0200 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
Subrata Banik | 23ccb0d | 2017-04-24 11:28:40 +0530 | [diff] [blame] | 2 | |
Subrata Banik | 23ccb0d | 2017-04-24 11:28:40 +0530 | [diff] [blame] | 3 | #include <device/device.h> |
| 4 | #include <device/pci.h> |
| 5 | #include <device/pci_ids.h> |
| 6 | #include <intelblocks/xdci.h> |
Duncan Laurie | 4df7d2c | 2018-03-26 02:17:33 -0700 | [diff] [blame] | 7 | #include <security/vboot/vboot_common.h> |
Subrata Banik | 23ccb0d | 2017-04-24 11:28:40 +0530 | [diff] [blame] | 8 | |
Aaron Durbin | 6403167 | 2018-04-21 14:45:32 -0600 | [diff] [blame] | 9 | __weak void soc_xdci_init(struct device *dev) { /* no-op */ } |
Subrata Banik | 23ccb0d | 2017-04-24 11:28:40 +0530 | [diff] [blame] | 10 | |
Angel Pons | c7cfe0b | 2021-06-23 12:39:22 +0200 | [diff] [blame] | 11 | bool xdci_can_enable(unsigned int xdci_devfn) |
Duncan Laurie | 4df7d2c | 2018-03-26 02:17:33 -0700 | [diff] [blame] | 12 | { |
Angel Pons | c7cfe0b | 2021-06-23 12:39:22 +0200 | [diff] [blame] | 13 | /* Enable xDCI controller if enabled in devicetree and allowed */ |
| 14 | if (!vboot_can_enable_udc()) { |
| 15 | devfn_disable(pci_root_bus(), xdci_devfn); |
| 16 | return false; |
| 17 | } |
| 18 | return is_devfn_enabled(xdci_devfn); |
Duncan Laurie | 4df7d2c | 2018-03-26 02:17:33 -0700 | [diff] [blame] | 19 | } |
| 20 | |
Subrata Banik | 23ccb0d | 2017-04-24 11:28:40 +0530 | [diff] [blame] | 21 | static struct device_operations usb_xdci_ops = { |
Elyes HAOUAS | 1d19127 | 2018-11-27 12:23:48 +0100 | [diff] [blame] | 22 | .read_resources = pci_dev_read_resources, |
| 23 | .set_resources = pci_dev_set_resources, |
| 24 | .enable_resources = pci_dev_enable_resources, |
Subrata Banik | 23ccb0d | 2017-04-24 11:28:40 +0530 | [diff] [blame] | 25 | .init = soc_xdci_init, |
Subrata Banik | 6bbc91a | 2017-12-07 14:55:51 +0530 | [diff] [blame] | 26 | .ops_pci = &pci_dev_ops_pci, |
Subrata Banik | 23ccb0d | 2017-04-24 11:28:40 +0530 | [diff] [blame] | 27 | }; |
| 28 | |
| 29 | static const unsigned short pci_device_ids[] = { |
Aaron Durbin | f27d98f | 2017-05-05 16:52:52 -0500 | [diff] [blame] | 30 | PCI_DEVICE_ID_INTEL_APL_XDCI, |
Lijian Zhao | bbedef9 | 2017-07-29 16:38:38 -0700 | [diff] [blame] | 31 | PCI_DEVICE_ID_INTEL_CNL_LP_XDCI, |
Subrata Banik | 23ccb0d | 2017-04-24 11:28:40 +0530 | [diff] [blame] | 32 | PCI_DEVICE_ID_INTEL_GLK_XDCI, |
| 33 | PCI_DEVICE_ID_INTEL_SPT_LP_XDCI, |
praveen hodagatta pranesh | e26c4a4 | 2018-09-20 03:49:45 +0800 | [diff] [blame] | 34 | PCI_DEVICE_ID_INTEL_CNP_H_XDCI, |
Aamir Bohra | 9eac039 | 2018-06-30 12:07:04 +0530 | [diff] [blame] | 35 | PCI_DEVICE_ID_INTEL_ICP_LP_XDCI, |
Ronak Kanabar | da7ffb48 | 2019-02-05 01:51:13 +0530 | [diff] [blame] | 36 | PCI_DEVICE_ID_INTEL_CMP_LP_XDCI, |
Gaggery Tsai | 12a651c | 2019-12-05 11:23:20 -0800 | [diff] [blame] | 37 | PCI_DEVICE_ID_INTEL_CMP_H_XDCI, |
Ravi Sarawadi | 6b5bf40 | 2019-10-21 22:25:04 -0700 | [diff] [blame] | 38 | PCI_DEVICE_ID_INTEL_TGP_LP_XDCI, |
Jeremy Soller | 191a8d7 | 2021-08-10 14:06:51 -0600 | [diff] [blame] | 39 | PCI_DEVICE_ID_INTEL_TGP_H_XDCI, |
Tan, Lean Sheng | 2613609 | 2020-01-20 19:13:56 -0800 | [diff] [blame] | 40 | PCI_DEVICE_ID_INTEL_MCC_XDCI, |
Meera Ravindranath | 3f4af0d | 2020-02-12 16:01:22 +0530 | [diff] [blame] | 41 | PCI_DEVICE_ID_INTEL_JSP_XDCI, |
Subrata Banik | f672f7f | 2020-08-03 14:29:25 +0530 | [diff] [blame] | 42 | PCI_DEVICE_ID_INTEL_ADP_P_XDCI, |
| 43 | PCI_DEVICE_ID_INTEL_ADP_S_XDCI, |
Varshit Pandya | f4d98fdd2 | 2021-01-17 18:39:29 +0530 | [diff] [blame] | 44 | PCI_DEVICE_ID_INTEL_ADP_M_XDCI, |
Subrata Banik | 23ccb0d | 2017-04-24 11:28:40 +0530 | [diff] [blame] | 45 | 0 |
| 46 | }; |
| 47 | |
| 48 | static const struct pci_driver pch_usb_xdci __pci_driver = { |
| 49 | .ops = &usb_xdci_ops, |
| 50 | .vendor = PCI_VENDOR_ID_INTEL, |
| 51 | .devices = pci_device_ids, |
| 52 | }; |