esp-idf/components/usb/usb_phy_p4.c
Tomas Rezucha ba16f50560 refactor(usb/host): Move P4 HS PHY function to correct LL file
Moved usb_wrap_ll_enable_precise_detection() in usb_wrap_ll.h
to usb_utmi_ll_enable_precise_detection() in usb_utmi_ll.h

Fixes commit 97d30e7c48
2024-09-02 14:39:28 +02:00

50 lines
1.4 KiB
C

/*
* SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
// TODO: Refactor during the IDF-9198
#include "sdkconfig.h"
#include "soc/usb_dwc_cfg.h"
#include "hal/usb_utmi_ll.h" // We don't have usb_utmi_hal yet
#include "esp_private/periph_ctrl.h"
// TODO: Remove this file when proper support of P4 PHYs is implemented IDF-7323
#include "esp_private/usb_phy.h"
esp_err_t usb_new_phy(const usb_phy_config_t *config, usb_phy_handle_t *handle_ret)
{
#if (OTG_HSPHY_INTERFACE != 0)
#if CONFIG_IDF_TARGET_ESP32P4
PERIPH_RCC_ATOMIC() {
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(&USB_UTMI, true);
#endif // CONFIG_IDF_TARGET_ESP32P4
#endif // (OTG_HSPHY_INTERFACE != 0)
return ESP_OK;
}
esp_err_t usb_del_phy(usb_phy_handle_t handle)
{
return ESP_OK;
}
esp_err_t usb_phy_get_phy_status(usb_phy_target_t target, usb_phy_status_t *status)
{
return ESP_OK;
}
esp_err_t usb_phy_action(usb_phy_handle_t handle, usb_phy_action_t action)
{
return ESP_OK;
}