11/*
2- * SPDX-FileCopyrightText: 2020-2024 Espressif Systems (Shanghai) CO LTD
2+ * SPDX-FileCopyrightText: 2020-2025 Espressif Systems (Shanghai) CO LTD
33 *
44 * SPDX-License-Identifier: Apache-2.0
55 */
66
77#pragma once
88
9- #include <stdint.h>
10- #include <stdbool.h>
11- #include "soc/soc_pins.h"
129#include "soc/soc_caps.h"
13- #include "soc/periph_defs.h"
14- #include "soc/gpio_sig_map.h"
1510
1611#ifdef __cplusplus
1712extern "C" {
@@ -21,6 +16,16 @@ extern "C" {
2116
2217/* ---------------------------------- Types --------------------------------- */
2318
19+ /**
20+ * @brief USB PHY Instance Type
21+ */
22+ typedef enum {
23+ USB_PHY_INST_FSLS_INTERN_0 = (1 << 0 ),
24+ USB_PHY_INST_FSLS_INTERN_1 = (1 << 1 ),
25+ USB_PHY_INST_UTMI_0 = (1 << 2 ),
26+ USB_PHY_INST_EXTERN = (1 << 3 ),
27+ } usb_phy_inst_t ;
28+
2429/**
2530 * @brief USB PHY FSLS Serial Interface Signals
2631 *
@@ -65,15 +70,30 @@ typedef struct {
6570 int dischrgvbus ;
6671} usb_otg_signal_conn_t ;
6772
73+ /**
74+ * @brief Internal USB PHY IO
75+ *
76+ * Structure to store the IO numbers for a particular internal USB PHY
77+ */
78+ typedef struct {
79+ int dp ;
80+ int dm ;
81+ } usb_internal_phy_io_t ;
82+
6883/**
6984 * @brief USB Controller Information
7085 *
7186 * Structure to store information for all USB-DWC instances
87+ *
88+ * For targets with multiple USB controllers, we support only fixed mapping of the PHYs.
89+ * This is a software limitation; the hardware supports swapping Controllers and PHYs.
7290 */
7391typedef struct {
7492 struct {
7593 const usb_fsls_serial_signal_conn_t * const fsls_signals ; // Must be set if external PHY is supported by controller
7694 const usb_otg_signal_conn_t * const otg_signals ;
95+ const usb_internal_phy_io_t * const internal_phy_io ; // Must be set for internal FSLS PHY(s)
96+ const usb_phy_inst_t supported_phys ; // Bitmap of supported PHYs by this controller
7797 const int irq ;
7898 const int irq_2nd_cpu ; // The USB-DWC can provide 2nd interrupt so each CPU can have its own interrupt line. Set to -1 if not supported
7999 } controllers [SOC_USB_OTG_PERIPH_NUM ];
@@ -85,6 +105,8 @@ extern const usb_dwc_info_t usb_dwc_info;
85105
86106/* ------------------------------- Deprecated ------------------------------- */
87107/* Todo: Remove in ESP-IDF v6.0 (IDF-9052) */
108+ #include <stdint.h>
109+ #include "soc/periph_defs.h"
88110
89111#if SOC_USB_OTG_SUPPORTED
90112
0 commit comments