2024-01-19 14:38:30 +01:00
|
|
|
/*
|
|
|
|
* SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD
|
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
|
|
*/
|
|
|
|
|
2024-04-03 01:03:29 +08:00
|
|
|
// TODO: Remove this file when proper support of P4 PHYs is implemented IDF-11144
|
|
|
|
#include "hal/usb_utmi_hal.h"
|
2024-01-19 14:38:30 +01:00
|
|
|
#include "esp_private/usb_phy.h"
|
2024-08-20 13:32:02 +08:00
|
|
|
|
2024-04-03 01:03:29 +08:00
|
|
|
#include "soc/soc_caps.h"
|
2024-08-20 13:32:02 +08:00
|
|
|
#if SOC_RCC_IS_INDEPENDENT
|
|
|
|
#define USB_UTMI_BUS_CLK_ATOMIC()
|
|
|
|
#else
|
2024-04-03 01:03:29 +08:00
|
|
|
#include "esp_private/periph_ctrl.h"
|
2024-08-20 13:32:02 +08:00
|
|
|
#define USB_UTMI_BUS_CLK_ATOMIC() PERIPH_RCC_ATOMIC()
|
|
|
|
#endif
|
2024-01-19 14:38:30 +01:00
|
|
|
|
2024-04-03 01:03:29 +08:00
|
|
|
static usb_utmi_hal_context_t s_utmi_hal_context;
|
|
|
|
|
2024-01-19 14:38:30 +01:00
|
|
|
esp_err_t usb_new_phy(const usb_phy_config_t *config, usb_phy_handle_t *handle_ret)
|
|
|
|
{
|
2024-08-20 13:32:02 +08:00
|
|
|
USB_UTMI_BUS_CLK_ATOMIC() {
|
2024-04-03 01:03:29 +08:00
|
|
|
usb_utmi_hal_init(&s_utmi_hal_context);
|
2024-08-29 14:38:41 +02:00
|
|
|
}
|
2024-01-19 14:38:30 +01:00
|
|
|
return ESP_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
esp_err_t usb_del_phy(usb_phy_handle_t handle)
|
|
|
|
{
|
2024-04-03 01:03:29 +08:00
|
|
|
// Note: handle argument is not checked, because we don't have phy_handle for P4 yet
|
2024-08-20 13:32:02 +08:00
|
|
|
USB_UTMI_BUS_CLK_ATOMIC() {
|
2024-04-03 01:03:29 +08:00
|
|
|
usb_utmi_hal_disable();
|
2024-08-20 13:32:02 +08:00
|
|
|
}
|
2024-01-19 14:38:30 +01:00
|
|
|
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;
|
|
|
|
}
|