Angel Pons | ae59387 | 2020-04-04 18:50:57 +0200 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
Marc Jones | 2448484 | 2017-05-04 21:17:45 -0600 | [diff] [blame] | 2 | |
| 3 | // Use simple device model for this file even in ramstage |
| 4 | #define __SIMPLE_DEVICE__ |
| 5 | |
| 6 | #include <stdint.h> |
Kyösti Mälkki | f1b58b7 | 2019-03-01 13:43:02 +0200 | [diff] [blame] | 7 | #include <device/pci_ops.h> |
Marc Jones | 2448484 | 2017-05-04 21:17:45 -0600 | [diff] [blame] | 8 | #include <device/pci_ehci.h> |
| 9 | #include <device/pci_def.h> |
Marshall Dawson | afaedc9 | 2018-10-12 10:22:33 -0600 | [diff] [blame] | 10 | #include <soc/pci_devs.h> |
Marc Jones | dfeb1c4 | 2017-08-07 19:08:24 -0600 | [diff] [blame] | 11 | #include <soc/southbridge.h> |
Arthur Heymans | 2c43bf7 | 2019-11-16 12:53:28 +0100 | [diff] [blame] | 12 | #include <amdblocks/acpimmio.h> |
Marc Jones | 2448484 | 2017-05-04 21:17:45 -0600 | [diff] [blame] | 13 | |
Marc Jones | 2448484 | 2017-05-04 21:17:45 -0600 | [diff] [blame] | 14 | pci_devfn_t pci_ehci_dbg_dev(unsigned int hcd_idx) |
| 15 | { |
Marshall Dawson | 939bfcc | 2019-05-05 15:39:40 -0600 | [diff] [blame] | 16 | pm_io_write8(PM_USB_ENABLE, PM_USB_ALL_CONTROLLERS); |
Marshall Dawson | afaedc9 | 2018-10-12 10:22:33 -0600 | [diff] [blame] | 17 | return SOC_EHCI1_DEV; |
Marc Jones | 2448484 | 2017-05-04 21:17:45 -0600 | [diff] [blame] | 18 | } |
| 19 | |
| 20 | void pci_ehci_dbg_set_port(pci_devfn_t dev, unsigned int port) |
| 21 | { |
Richard Spiegel | 6635b3d | 2018-08-24 16:48:20 -0700 | [diff] [blame] | 22 | u32 reg32, value; |
Marc Jones | 2448484 | 2017-05-04 21:17:45 -0600 | [diff] [blame] | 23 | |
Richard Spiegel | 6635b3d | 2018-08-24 16:48:20 -0700 | [diff] [blame] | 24 | value = (port & 0x3) << DEBUG_PORT_SELECT_SHIFT; |
| 25 | value |= DEBUG_PORT_ENABLE; |
| 26 | reg32 = pci_read_config32(SOC_EHCI1_DEV, EHCI_HUB_CONFIG4); |
| 27 | reg32 &= ~DEBUG_PORT_MASK; |
| 28 | reg32 |= value; |
| 29 | pci_write_config32(SOC_EHCI1_DEV, EHCI_HUB_CONFIG4, reg32); |
Marc Jones | 2448484 | 2017-05-04 21:17:45 -0600 | [diff] [blame] | 30 | } |