Angel Pons | 182dbde | 2020-04-02 23:49:05 +0200 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 2 | |
Kyösti Mälkki | f1b58b7 | 2019-03-01 13:43:02 +0200 | [diff] [blame] | 3 | #include <device/pci_ops.h> |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 4 | #include <device/pci_def.h> |
| 5 | #include "pch.h" |
| 6 | |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 7 | /* |
| 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 HAOUAS | 38f1d13 | 2018-09-17 08:44:18 +0200 | [diff] [blame] | 14 | static void enable_usb_bar_on_device(pci_devfn_t dev, u32 bar) |
Kyösti Mälkki | 81d3d7d | 2013-06-15 12:30:13 +0300 | [diff] [blame] | 15 | { |
Kyösti Mälkki | 81d3d7d | 2013-06-15 12:30:13 +0300 | [diff] [blame] | 16 | pci_write_config32(dev, PCI_BASE_ADDRESS_0, bar); |
Angel Pons | d5d4fbc | 2020-05-31 01:03:59 +0200 | [diff] [blame] | 17 | pci_or_config16(dev, PCI_COMMAND, PCI_COMMAND_MASTER | PCI_COMMAND_MEMORY); |
Kyösti Mälkki | 81d3d7d | 2013-06-15 12:30:13 +0300 | [diff] [blame] | 18 | } |
| 19 | |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 20 | void enable_usb_bar(void) |
| 21 | { |
Kyösti Mälkki | 81d3d7d | 2013-06-15 12:30:13 +0300 | [diff] [blame] | 22 | enable_usb_bar_on_device(PCH_EHCI1_DEV, PCH_EHCI1_TEMP_BAR0); |
Duncan Laurie | 7d14e89 | 2013-07-30 15:45:25 -0700 | [diff] [blame] | 23 | if (!pch_is_lp()) |
| 24 | enable_usb_bar_on_device(PCH_EHCI2_DEV, PCH_EHCI2_TEMP_BAR0); |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 25 | } |