feat(esp_eth): add ioctl for 1G PHY master/slave mode

Needed when forcing 1000 Mbps with autonegotiation disabled.
This commit is contained in:
Ondrej Kosta
2026-08-12 13:07:42 +08:00
committed by morris
parent 32c93135cd
commit 72a35d0f08
6 changed files with 174 additions and 19 deletions
+8 -1
View File
@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2019-2025 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2019-2026 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
@@ -178,6 +178,8 @@ typedef enum {
ETH_CMD_S_ALL_MULTICAST, /*!< Set receive all multicast */
ETH_CMD_ADD_MAC_FILTER, /*!< Add MAC filter */
ETH_CMD_DEL_MAC_FILTER, /*!< Delete MAC filter */
ETH_CMD_S_PHY_MASTER_MODE, /*!< Set PHY master mode */
ETH_CMD_G_PHY_MASTER_MODE, /*!< Get PHY master mode */
ETH_CMD_CUSTOM_MAC_CMDS = ETH_CMD_CUSTOM_MAC_CMDS_OFFSET, // Offset for start of MAC custom commands
ETH_CMD_CUSTOM_PHY_CMDS = ETH_CMD_CUSTOM_PHY_CMDS_OFFSET, // Offset for start of PHY custom commands
@@ -383,9 +385,14 @@ esp_err_t esp_eth_transmit_ctrl_vargs(esp_eth_handle_t hdl, void *ctrl, uint32_t
* Preconditions: Ethernet driver needs to be stopped and auto-negotiation disabled.
* @li @c ETH_CMD_G_DUPLEX_MODE gets current Ethernet link duplex mode. @c data argument is pointer to memory of eth_duplex_t datatype to which the duplex mode is to be stored.
* @li @c ETH_CMD_S_PHY_LOOPBACK sets/resets PHY to/from loopback mode. @c data argument is pointer to memory of bool datatype from which the configuration option is read.
* @li @c ETH_CMD_READ_PHY_REG reads PHY register. @c data argument is pointer to @c esp_eth_phy_reg_rw_data_t containing register address and pointer to store read value.
* @li @c ETH_CMD_WRITE_PHY_REG writes PHY register. @c data argument is pointer to @c esp_eth_phy_reg_rw_data_t containing register address and pointer to value to write.
* @li @c ETH_CMD_S_ALL_MULTICAST sets/resets Ethernet interface to/from receive all multicast mode. @c data argument is pointer to memory of bool datatype from which the configuration option is read.
* @li @c ETH_CMD_ADD_MAC_FILTER adds a MAC address to the MAC filter. @c data argument is pointer to MAC address buffer with expected size of 6 bytes.
* @li @c ETH_CMD_DEL_MAC_FILTER deletes a MAC address from the MAC filter. @c data argument is pointer to MAC address buffer with expected size of 6 bytes.
* @li @c ETH_CMD_S_PHY_MASTER_MODE sets PHY master/slave mode for 1000BASE-T. @c data argument is pointer to memory of bool datatype from which the configuration option is read (true = master, false = slave).
* Preconditions: Ethernet driver needs to be stopped. Required before forcing 1000 Mbps speed when auto-negotiation is disabled.
* @li @c ETH_CMD_G_PHY_MASTER_MODE gets PHY master/slave mode for 1000BASE-T. @c data argument is pointer to memory of bool datatype to which the current configuration is to be stored (true = master, false = slave).
*
* @li Note that additional control commands may be available for specific MAC or PHY chips. Please consult specific MAC or PHY documentation or driver code.
*/