Angel Pons | 32859fc | 2020-04-02 23:48:27 +0200 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
Stefan Reinauer | bb01f60 | 2009-07-21 21:20:45 +0000 | [diff] [blame] | 2 | |
Kyösti Mälkki | e2227a2 | 2014-02-05 13:02:55 +0200 | [diff] [blame] | 3 | #ifndef _PCI_EHCI_H_ |
| 4 | #define _PCI_EHCI_H_ |
| 5 | |
Kyösti Mälkki | e2227a2 | 2014-02-05 13:02:55 +0200 | [diff] [blame] | 6 | #include <device/device.h> |
Kyösti Mälkki | 3e6913b | 2019-03-02 16:26:10 +0200 | [diff] [blame] | 7 | #include <device/pci_type.h> |
Elyes HAOUAS | 5817c56 | 2020-07-12 09:03:22 +0200 | [diff] [blame] | 8 | #include <stdint.h> |
Yinghai Lu | d57241f | 2007-02-28 11:17:02 +0000 | [diff] [blame] | 9 | |
Kyösti Mälkki | fb387df | 2013-06-07 22:16:52 +0300 | [diff] [blame] | 10 | #define EHCI_BAR_INDEX 0x10 |
Lee Leahy | 6a566d7 | 2017-03-07 17:45:12 -0800 | [diff] [blame] | 11 | #define PCI_EHCI_CLASSCODE 0x0c0320 /* USB2.0 with EHCI controller */ |
Kyösti Mälkki | 8101aa6 | 2013-08-15 16:27:06 +0300 | [diff] [blame] | 12 | |
Kyösti Mälkki | 6683e40 | 2017-07-30 13:23:32 +0300 | [diff] [blame] | 13 | /* Return PCI BDF for an EHCI controller by a given index. PCI function |
| 14 | * must already be powered to respond to configuration requests. |
| 15 | */ |
Lee Leahy | 0ca2a06 | 2017-03-06 18:01:04 -0800 | [diff] [blame] | 16 | pci_devfn_t pci_ehci_dbg_dev(unsigned int hcd_idx); |
Kyösti Mälkki | 6683e40 | 2017-07-30 13:23:32 +0300 | [diff] [blame] | 17 | |
Kevin Paul Herbert | bde6d30 | 2014-12-24 18:43:20 -0800 | [diff] [blame] | 18 | u8 *pci_ehci_base_regs(pci_devfn_t dev); |
Kyösti Mälkki | 8101aa6 | 2013-08-15 16:27:06 +0300 | [diff] [blame] | 19 | void pci_ehci_dbg_set_port(pci_devfn_t dev, unsigned int port); |
Kyösti Mälkki | fb387df | 2013-06-07 22:16:52 +0300 | [diff] [blame] | 20 | |
Julius Werner | cd49cce | 2019-03-05 16:53:33 -0800 | [diff] [blame] | 21 | #if !CONFIG(USBDEBUG) |
Kyösti Mälkki | fb387df | 2013-06-07 22:16:52 +0300 | [diff] [blame] | 22 | #define pci_ehci_read_resources pci_dev_read_resources |
| 23 | #else |
| 24 | /* Relocation of EHCI Debug Port BAR |
| 25 | * |
| 26 | * PCI EHCI controller with Debug Port capability shall replace |
| 27 | * pci_dev_read_resources() with pci_ehci_read_resources() in its |
| 28 | * declaration of device_operations for .read_resources. |
| 29 | * This installs a hook to reconfigure usbdebug when resource allocator |
| 30 | * assigns a new BAR for the device. |
| 31 | */ |
| 32 | struct device; |
| 33 | void pci_ehci_read_resources(struct device *dev); |
| 34 | #endif |
Myles Watson | 127e976 | 2010-08-04 19:29:11 +0000 | [diff] [blame] | 35 | |
Kyösti Mälkki | e2227a2 | 2014-02-05 13:02:55 +0200 | [diff] [blame] | 36 | #endif /* _PCI_EHCI_H_ */ |