summaryrefslogtreecommitdiff
path: root/hw
diff options
context:
space:
mode:
authorigor.masar <[email protected]>2026-04-22 14:22:23 +0200
committerigor.masar <[email protected]>2026-04-22 22:51:12 +0200
commit776f613dbf9ebb14e7dab6529db96a273157a943 (patch)
tree4a54d2eab6b718df85b7951135ef1dc947d311e1 /hw
parent723e0167a3d164918c1453d3941cb2b9a6a2d463 (diff)
Add ESP32-S31 as a supported MCU in TinyUSB
Diffstat (limited to 'hw')
-rw-r--r--hw/bsp/espressif/boards/family.c8
-rw-r--r--hw/bsp/espressif/family.cmake17
2 files changed, 16 insertions, 9 deletions
diff --git a/hw/bsp/espressif/boards/family.c b/hw/bsp/espressif/boards/family.c
index 48b1253b6..4b28cecf2 100644
--- a/hw/bsp/espressif/boards/family.c
+++ b/hw/bsp/espressif/boards/family.c
@@ -49,7 +49,7 @@ static led_strip_handle_t led_strip;
static void max3421_init(void);
#endif
-#if TU_CHECK_MCU(OPT_MCU_ESP32S2, OPT_MCU_ESP32S3, OPT_MCU_ESP32H4, OPT_MCU_ESP32P4)
+#if TU_CHECK_MCU(OPT_MCU_ESP32S2, OPT_MCU_ESP32S3, OPT_MCU_ESP32H4, OPT_MCU_ESP32P4, OPT_MCU_ESP32S31)
static bool usb_init(uint8_t rhport, bool is_host);
#endif
@@ -111,10 +111,6 @@ void board_init(void) {
#endif
}
-#if TU_CHECK_MCU(OPT_MCU_ESP32S2, OPT_MCU_ESP32S3, OPT_MCU_ESP32H4)
-
-#endif
-
//--------------------------------------------------------------------+
// Board porting API
//--------------------------------------------------------------------+
@@ -178,7 +174,7 @@ void board_reset_to_bootloader(void) {
// PHY Init
//--------------------------------------------------------------------
-#if TU_CHECK_MCU(OPT_MCU_ESP32S2, OPT_MCU_ESP32S3, OPT_MCU_ESP32H4, OPT_MCU_ESP32P4)
+#if TU_CHECK_MCU(OPT_MCU_ESP32S2, OPT_MCU_ESP32S3, OPT_MCU_ESP32H4, OPT_MCU_ESP32P4, OPT_MCU_ESP32S31)
#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(5, 3, 0)
#include "esp_private/usb_phy.h"
diff --git a/hw/bsp/espressif/family.cmake b/hw/bsp/espressif/family.cmake
index ca9eadaf6..30d5a6ac9 100644
--- a/hw/bsp/espressif/family.cmake
+++ b/hw/bsp/espressif/family.cmake
@@ -2,7 +2,10 @@
include("${CMAKE_CURRENT_LIST_DIR}/boards/${BOARD}/board.cmake")
string(TOUPPER ${IDF_TARGET} FAMILY_MCUS)
-# Device port default to Port1 for P4 (highspeed), Port0 for others (fullspeed)
+# Device/host port defaults:
+# - ESP32-P4 uses Port1 (highspeed)
+# - ESP32-S31 uses Port0 (highspeed)
+# - Other targets use Port0 and derive the default speed from RHPORT_SPEED
set(RHPORT_SPEED OPT_MODE_FULL_SPEED OPT_MODE_HIGH_SPEED)
if (NOT DEFINED RHPORT_DEVICE)
@@ -22,10 +25,18 @@ if (NOT DEFINED RHPORT_HOST)
endif()
if (NOT DEFINED RHPORT_DEVICE_SPEED)
- list(GET RHPORT_SPEED ${RHPORT_DEVICE} RHPORT_DEVICE_SPEED)
+ if (IDF_TARGET STREQUAL "esp32s31")
+ set(RHPORT_DEVICE_SPEED OPT_MODE_HIGH_SPEED)
+ else ()
+ list(GET RHPORT_SPEED ${RHPORT_DEVICE} RHPORT_DEVICE_SPEED)
+ endif ()
endif ()
if (NOT DEFINED RHPORT_HOST_SPEED)
- list(GET RHPORT_SPEED ${RHPORT_HOST} RHPORT_HOST_SPEED)
+ if (IDF_TARGET STREQUAL "esp32s31")
+ set(RHPORT_HOST_SPEED OPT_MODE_HIGH_SPEED)
+ else ()
+ list(GET RHPORT_SPEED ${RHPORT_HOST} RHPORT_HOST_SPEED)
+ endif ()
endif ()
# Add example src and bsp directories