blob: f60cc0b706e04d77714a5c528b77c5e386c904fc [file] [log] [blame]
Angel Pons182dbde2020-04-02 23:49:05 +02001/* SPDX-License-Identifier: GPL-2.0-only */
Alexandru Gagniucecf2eb42015-09-28 21:39:12 -07002
Kyösti Mälkkif1b58b72019-03-01 13:43:02 +02003#include <device/pci_ops.h>
Alexandru Gagniucecf2eb42015-09-28 21:39:12 -07004#include <device/pci_def.h>
5#include "pch.h"
6
7#define PCH_EHCI1_TEMP_BAR0 0xe8000000
8#define PCH_EHCI2_TEMP_BAR0 0xe8000400
9
10/*
11 * Setup USB controller MMIO BAR to prevent the
12 * reference code from resetting the controller.
13 *
14 * The BAR will be re-assigned during device
15 * enumeration so these are only temporary.
16 */
17void enable_usb_bar(void)
18{
Elyes HAOUAS68c851b2018-06-12 22:06:09 +020019 pci_devfn_t usb0 = PCH_EHCI1_DEV;
20 pci_devfn_t usb1 = PCH_EHCI2_DEV;
Alexandru Gagniucecf2eb42015-09-28 21:39:12 -070021
22 /* USB Controller 1 */
23 pci_write_config32(usb0, PCI_BASE_ADDRESS_0,
24 PCH_EHCI1_TEMP_BAR0);
Elyes HAOUAS729c0692020-04-28 19:50:44 +020025 pci_or_config16(usb0, PCI_COMMAND, PCI_COMMAND_MASTER | PCI_COMMAND_MEMORY);
Alexandru Gagniucecf2eb42015-09-28 21:39:12 -070026
27 /* USB Controller 2 */
28 pci_write_config32(usb1, PCI_BASE_ADDRESS_0,
29 PCH_EHCI2_TEMP_BAR0);
Elyes HAOUAS729c0692020-04-28 19:50:44 +020030 pci_or_config16(usb1, PCI_COMMAND, PCI_COMMAND_MASTER | PCI_COMMAND_MEMORY);
Alexandru Gagniucecf2eb42015-09-28 21:39:12 -070031}