blob: e7a445d377c04d29c458565346c3c56d05e6dba7 [file] [log] [blame]
Angel Pons32859fc2020-04-02 23:48:27 +02001/* SPDX-License-Identifier: GPL-2.0-only */
Stefan Reinauerbb01f602009-07-21 21:20:45 +00002
Kyösti Mälkkie2227a22014-02-05 13:02:55 +02003#ifndef _PCI_EHCI_H_
4#define _PCI_EHCI_H_
5
Kyösti Mälkkie2227a22014-02-05 13:02:55 +02006#include <device/device.h>
Kyösti Mälkki3e6913b2019-03-02 16:26:10 +02007#include <device/pci_type.h>
Elyes HAOUAS5817c562020-07-12 09:03:22 +02008#include <stdint.h>
Yinghai Lud57241f2007-02-28 11:17:02 +00009
Kyösti Mälkkifb387df2013-06-07 22:16:52 +030010#define EHCI_BAR_INDEX 0x10
Lee Leahy6a566d72017-03-07 17:45:12 -080011#define PCI_EHCI_CLASSCODE 0x0c0320 /* USB2.0 with EHCI controller */
Kyösti Mälkki8101aa62013-08-15 16:27:06 +030012
Kyösti Mälkki6683e402017-07-30 13:23:32 +030013/* 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 Leahy0ca2a062017-03-06 18:01:04 -080016pci_devfn_t pci_ehci_dbg_dev(unsigned int hcd_idx);
Kyösti Mälkki6683e402017-07-30 13:23:32 +030017
Kevin Paul Herbertbde6d302014-12-24 18:43:20 -080018u8 *pci_ehci_base_regs(pci_devfn_t dev);
Kyösti Mälkki8101aa62013-08-15 16:27:06 +030019void pci_ehci_dbg_set_port(pci_devfn_t dev, unsigned int port);
Kyösti Mälkkifb387df2013-06-07 22:16:52 +030020
Julius Wernercd49cce2019-03-05 16:53:33 -080021#if !CONFIG(USBDEBUG)
Kyösti Mälkkifb387df2013-06-07 22:16:52 +030022#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 */
32struct device;
33void pci_ehci_read_resources(struct device *dev);
34#endif
Myles Watson127e9762010-08-04 19:29:11 +000035
Kyösti Mälkkie2227a22014-02-05 13:02:55 +020036#endif /* _PCI_EHCI_H_ */