summaryrefslogtreecommitdiff
path: root/src/soc/intel/common/block/xdci
diff options
context:
space:
mode:
authorAngel Pons <th3fanbus@gmail.com>2021-06-23 12:39:22 +0200
committerPatrick Georgi <pgeorgi@google.com>2021-07-01 12:14:02 +0000
commitc7cfe0ba54bd280b8c4a5079bb2f6e19334f6dea (patch)
treea7a769621549d3de3e8dd371544c74baee07bd38 /src/soc/intel/common/block/xdci
parent3657187789ee72834539b82cac6dda525421e4ed (diff)
soc/intel: Refactor `xdci_can_enable()` function
The same pattern appears on all `xdci_can_enable()` call sites. Move the logic inside the function and take the xDCI devfn as parameter. Change-Id: I94c24c10c7fc7c5b4938cffca17bdfb853c7bd59 Signed-off-by: Angel Pons <th3fanbus@gmail.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/55790 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Subrata Banik <subrata.banik@intel.com> Reviewed-by: Tim Wawrzynczak <twawrzynczak@chromium.org>
Diffstat (limited to 'src/soc/intel/common/block/xdci')
-rw-r--r--src/soc/intel/common/block/xdci/xdci.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/soc/intel/common/block/xdci/xdci.c b/src/soc/intel/common/block/xdci/xdci.c
index 9f15ac1d6e..e1d880975f 100644
--- a/src/soc/intel/common/block/xdci/xdci.c
+++ b/src/soc/intel/common/block/xdci/xdci.c
@@ -8,9 +8,14 @@
__weak void soc_xdci_init(struct device *dev) { /* no-op */ }
-int xdci_can_enable(void)
+bool xdci_can_enable(unsigned int xdci_devfn)
{
- return vboot_can_enable_udc();
+ /* Enable xDCI controller if enabled in devicetree and allowed */
+ if (!vboot_can_enable_udc()) {
+ devfn_disable(pci_root_bus(), xdci_devfn);
+ return false;
+ }
+ return is_devfn_enabled(xdci_devfn);
}
static struct device_operations usb_xdci_ops = {