blob: 52e8ac17f87221c969ceabd373826b50d02664a5 [file] [log] [blame]
Angel Pons182dbde2020-04-02 23:49:05 +02001/* SPDX-License-Identifier: GPL-2.0-only */
Aaron Durbin76c37002012-10-30 09:03:43 -05002
Kyösti Mälkkif1b58b72019-03-01 13:43:02 +02003#include <device/pci_ops.h>
Aaron Durbin76c37002012-10-30 09:03:43 -05004#include <device/pci_def.h>
5#include "pch.h"
6
Aaron Durbin76c37002012-10-30 09:03:43 -05007/*
8 * Setup USB controller MMIO BAR to prevent the
9 * reference code from resetting the controller.
10 *
11 * The BAR will be re-assigned during device
12 * enumeration so these are only temporary.
13 */
Elyes HAOUAS38f1d132018-09-17 08:44:18 +020014static void enable_usb_bar_on_device(pci_devfn_t dev, u32 bar)
Kyösti Mälkki81d3d7d2013-06-15 12:30:13 +030015{
Kyösti Mälkki81d3d7d2013-06-15 12:30:13 +030016 pci_write_config32(dev, PCI_BASE_ADDRESS_0, bar);
Angel Ponsd5d4fbc2020-05-31 01:03:59 +020017 pci_or_config16(dev, PCI_COMMAND, PCI_COMMAND_MASTER | PCI_COMMAND_MEMORY);
Kyösti Mälkki81d3d7d2013-06-15 12:30:13 +030018}
19
Aaron Durbin76c37002012-10-30 09:03:43 -050020void enable_usb_bar(void)
21{
Kyösti Mälkki81d3d7d2013-06-15 12:30:13 +030022 enable_usb_bar_on_device(PCH_EHCI1_DEV, PCH_EHCI1_TEMP_BAR0);
Duncan Laurie7d14e892013-07-30 15:45:25 -070023 if (!pch_is_lp())
24 enable_usb_bar_on_device(PCH_EHCI2_DEV, PCH_EHCI2_TEMP_BAR0);
Aaron Durbin76c37002012-10-30 09:03:43 -050025}