From da7d0e6979386eb082e41c3b9fc1bf1e43aed5dd Mon Sep 17 00:00:00 2001 From: Tomas Rezucha Date: Thu, 20 Nov 2025 12:44:11 +0100 Subject: [PATCH] fix(usb): Fix USB PHY mocking on linux target --- .../esp_hal_usb/include/hal/usb_phy_types.h | 65 ------------------- .../include/esp_private/usb_phy.h | 43 +++++++++++- 2 files changed, 42 insertions(+), 66 deletions(-) delete mode 100644 components/esp_hal_usb/include/hal/usb_phy_types.h diff --git a/components/esp_hal_usb/include/hal/usb_phy_types.h b/components/esp_hal_usb/include/hal/usb_phy_types.h deleted file mode 100644 index 62da8f6ae04..00000000000 --- a/components/esp_hal_usb/include/hal/usb_phy_types.h +++ /dev/null @@ -1,65 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2015-2025 Espressif Systems (Shanghai) CO LTD - * - * SPDX-License-Identifier: Apache-2.0 - */ - -/* -Note: This header file contains USB2.0 related types and macros that can be used by code specific to the DWC_OTG -controller (i.e., the HW specific layers of the USB host stack). Thus, this header is only meant to be used below (and -including) the HAL layer. For types and macros that are HW implementation agnostic (i.e., HCD layer and above), add them -to the "usb/usb_types_ch9.h" header instead. -*/ - -#pragma once - -#ifdef __cplusplus -extern "C" -{ -#endif - -/** - * @brief USB PHY target - */ -typedef enum { - USB_PHY_TARGET_INT, /**< USB target is internal FSLS PHY */ - USB_PHY_TARGET_UTMI, /**< USB target is internal UTMI PHY */ - USB_PHY_TARGET_EXT, /**< USB target is external PHY */ - USB_PHY_TARGET_MAX, -} usb_phy_target_t; - -/** - * @brief USB PHY source - */ -typedef enum { - USB_PHY_CTRL_OTG, /**< PHY controller is USB OTG */ -#if SOC_USB_SERIAL_JTAG_SUPPORTED - USB_PHY_CTRL_SERIAL_JTAG, /**< PHY controller is USB Serial JTAG */ -#endif - USB_PHY_CTRL_MAX, -} usb_phy_controller_t; - -/** - * @brief USB OTG mode - */ -typedef enum { - USB_PHY_MODE_DEFAULT, /**< USB OTG default mode */ - USB_OTG_MODE_HOST, /**< USB OTG host mode */ - USB_OTG_MODE_DEVICE, /**< USB OTG device mode */ - USB_OTG_MODE_MAX, -} usb_otg_mode_t; - -/** - * @brief USB speed - */ -typedef enum { - USB_PHY_SPEED_UNDEFINED, - USB_PHY_SPEED_LOW, /**< USB Low Speed (1.5 Mbit/s) */ - USB_PHY_SPEED_FULL, /**< USB Full Speed (12 Mbit/s) */ - USB_PHY_SPEED_HIGH, /**< USB High Speed (480 Mbit/s) */ - USB_PHY_SPEED_MAX, -} usb_phy_speed_t; - -#ifdef __cplusplus -} -#endif diff --git a/components/esp_hw_support/include/esp_private/usb_phy.h b/components/esp_hw_support/include/esp_private/usb_phy.h index f966b45949e..7553b879bad 100644 --- a/components/esp_hw_support/include/esp_private/usb_phy.h +++ b/components/esp_hw_support/include/esp_private/usb_phy.h @@ -9,7 +9,6 @@ #include #include "esp_err.h" #include "soc/soc_caps.h" -#include "hal/usb_phy_types.h" #define USB_PHY_SUPPORTS_P4_OTG11 1 // This version of usb_phy supports P4 OTG1.1 PHY @@ -17,6 +16,48 @@ extern "C" { #endif +/** + * @brief USB PHY target + */ +typedef enum { + USB_PHY_TARGET_INT, /**< USB target is internal FSLS PHY */ + USB_PHY_TARGET_UTMI, /**< USB target is internal UTMI PHY */ + USB_PHY_TARGET_EXT, /**< USB target is external PHY */ + USB_PHY_TARGET_MAX, +} usb_phy_target_t; + +/** + * @brief USB PHY source + */ +typedef enum { + USB_PHY_CTRL_OTG, /**< PHY controller is USB OTG */ +#if SOC_USB_SERIAL_JTAG_SUPPORTED + USB_PHY_CTRL_SERIAL_JTAG, /**< PHY controller is USB Serial JTAG */ +#endif + USB_PHY_CTRL_MAX, +} usb_phy_controller_t; + +/** + * @brief USB OTG mode + */ +typedef enum { + USB_PHY_MODE_DEFAULT, /**< USB OTG default mode */ + USB_OTG_MODE_HOST, /**< USB OTG host mode */ + USB_OTG_MODE_DEVICE, /**< USB OTG device mode */ + USB_OTG_MODE_MAX, +} usb_otg_mode_t; + +/** + * @brief USB speed + */ +typedef enum { + USB_PHY_SPEED_UNDEFINED, + USB_PHY_SPEED_LOW, /**< USB Low Speed (1.5 Mbit/s) */ + USB_PHY_SPEED_FULL, /**< USB Full Speed (12 Mbit/s) */ + USB_PHY_SPEED_HIGH, /**< USB High Speed (480 Mbit/s) */ + USB_PHY_SPEED_MAX, +} usb_phy_speed_t; + /** * @brief Initialization for usb_phy_otg_io_conf_t: Self-powered device */