mirror of
https://github.com/espressif/esp-idf.git
synced 2026-04-27 19:13:21 +00:00
9ab7d5eb03
Add ESP32-S31 USB DWC/UTMI LL headers, SoC register structures, peripheral descriptors, capabilities, and linker mappings so the HS OTG controller and UTMI PHY can be built in esp_hal_usb. Introduce SOC_USB_FSLS_PHY_NUM on USB-OTG targets to separate FSLS USB_WRAP support from OTG/UTMI support. Use it to gate usb_wrap, the USB PHY driver, docs, and example build rules on targets without an FSLS PHY. Also add UTMI data pulldown control to the HAL, clear the boot-time DWC suspend state on ESP32-S31, alias the legacy internal PHY target to UTMI for backward compatibility, and extend usb_phy tests for UTMI-only targets.
35 lines
899 B
C
35 lines
899 B
C
/*
|
|
* SPDX-FileCopyrightText: 2024-2026 Espressif Systems (Shanghai) CO LTD
|
|
*
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
*/
|
|
|
|
#include "hal/usb_utmi_ll.h"
|
|
#include "hal/usb_utmi_hal.h"
|
|
|
|
void _usb_utmi_hal_init(usb_utmi_hal_context_t *hal)
|
|
{
|
|
hal->dev = &USB_UTMI;
|
|
_usb_utmi_ll_enable_bus_clock(true);
|
|
_usb_utmi_ll_reset_register();
|
|
|
|
/*
|
|
Additional setting to solve missing DCONN event on ESP32P4 (IDF-9953).
|
|
|
|
Note: On ESP32P4, the HP_SYSTEM_OTG_SUSPENDM is not connected to 1 by hardware.
|
|
For correct detection of the device detaching, internal signal should be set to 1 by the software.
|
|
*/
|
|
usb_utmi_ll_enable_precise_detection(true);
|
|
usb_utmi_ll_configure_ls(hal->dev, true);
|
|
}
|
|
|
|
void usb_utmi_hal_enable_data_pulldowns(bool enable)
|
|
{
|
|
usb_utmi_ll_enable_data_pulldowns(enable);
|
|
}
|
|
|
|
void _usb_utmi_hal_disable(void)
|
|
{
|
|
_usb_utmi_ll_enable_bus_clock(false);
|
|
}
|