Browse Source

drivers: ethernet: remove get configs that are unused

remove get configs that are unused by the
ethernet mgmt api.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
pull/90351/merge
Fin Maaß 1 month ago committed by Dan Kalowsky
parent
commit
c169ac07a0
  1. 45
      drivers/ethernet/dwc_xgmac/eth_dwc_xgmac.c
  2. 49
      drivers/ethernet/eth_enc424j600.c
  3. 25
      drivers/ethernet/eth_sensry_sy1xx_mac.c
  4. 36
      drivers/ethernet/eth_stm32_hal.c
  5. 8
      subsys/usb/device_next/class/usbd_cdc_ecm.c

45
drivers/ethernet/dwc_xgmac/eth_dwc_xgmac.c

@ -1667,51 +1667,6 @@ static int eth_dwc_xgmac_set_config(const struct device *dev, enum ethernet_conf @@ -1667,51 +1667,6 @@ static int eth_dwc_xgmac_set_config(const struct device *dev, enum ethernet_conf
return retval;
}
/**
* @brief XGMAC get config function
* XGMAC get config function facilitates to read the existing MAC settings
*
* @param dev Pointer to the ethernet device
* @param type Type of configuration
* @param config Pointer to configuration data
* @retval 0 get configuration successful
* -ENOTSUP for invalid config type
*/
static int eth_dwc_xgmac_get_config(const struct device *dev, enum ethernet_config_type type,
struct ethernet_config *config)
{
struct eth_dwc_xgmac_dev_data *dev_data = (struct eth_dwc_xgmac_dev_data *)dev->data;
switch (type) {
case ETHERNET_CONFIG_TYPE_AUTO_NEG:
config->auto_negotiation = dev_data->auto_neg;
break;
case ETHERNET_CONFIG_TYPE_LINK:
if (dev_data->link_speed == LINK_1GBIT) {
config->l.link_1000bt = true;
} else if (dev_data->link_speed == LINK_100MBIT) {
config->l.link_100bt = true;
} else if (dev_data->link_speed == LINK_10MBIT) {
config->l.link_10bt = true;
}
break;
case ETHERNET_CONFIG_TYPE_DUPLEX:
config->full_duplex = dev_data->enable_full_duplex;
break;
case ETHERNET_CONFIG_TYPE_MAC_ADDRESS:
memcpy(config->mac_address.addr, dev_data->mac_addr, 6);
break;
#if (!CONFIG_ETH_DWC_XGMAC_PROMISCUOUS_EXCEPTION && CONFIG_NET_PROMISCUOUS_MODE)
case ETHERNET_CONFIG_TYPE_PROMISC_MODE:
config->promisc_mode = dev_data->promisc_mode;
break;
#endif
default:
return -ENOTSUP;
}
return 0;
}
/**
* @brief XGMAC capability request function

49
drivers/ethernet/eth_enc424j600.c

@ -501,54 +501,6 @@ static void enc424j600_rx_thread(void *p1, void *p2, void *p3) @@ -501,54 +501,6 @@ static void enc424j600_rx_thread(void *p1, void *p2, void *p3)
}
}
static int enc424j600_get_config(const struct device *dev,
enum ethernet_config_type type,
struct ethernet_config *config)
{
uint16_t tmp;
int rc = 0;
struct enc424j600_runtime *context = dev->data;
if (type != ETHERNET_CONFIG_TYPE_LINK &&
type != ETHERNET_CONFIG_TYPE_DUPLEX) {
/* Unsupported configuration query */
return -ENOTSUP;
}
k_sem_take(&context->tx_rx_sem, K_FOREVER);
if (type == ETHERNET_CONFIG_TYPE_LINK) {
/* Query active link speed */
enc424j600_read_phy(dev, ENC424J600_PSFR_PHSTAT3, &tmp);
if (tmp & ENC424J600_PHSTAT3_SPDDPX_100) {
/* 100Mbps link speed */
config->l.link_100bt = true;
} else if (tmp & ENC424J600_PHSTAT3_SPDDPX_10) {
/* 10Mbps link speed */
config->l.link_10bt = true;
} else {
/* Unknown link speed */
rc = -EINVAL;
}
} else if (type == ETHERNET_CONFIG_TYPE_DUPLEX) {
/* Query if half or full duplex */
enc424j600_read_phy(dev, ENC424J600_PSFR_PHSTAT3, &tmp);
/* Assume operating in half duplex mode */
config->full_duplex = false;
if (tmp & ENC424J600_PHSTAT3_SPDDPX_FD) {
/* Operating in full duplex mode */
config->full_duplex = true;
}
}
k_sem_give(&context->tx_rx_sem);
return rc;
}
static enum ethernet_hw_caps enc424j600_get_capabilities(const struct device *dev)
{
ARG_UNUSED(dev);
@ -677,7 +629,6 @@ static int enc424j600_stop_device(const struct device *dev) @@ -677,7 +629,6 @@ static int enc424j600_stop_device(const struct device *dev)
static const struct ethernet_api api_funcs = {
.iface_api.init = enc424j600_iface_init,
.get_config = enc424j600_get_config,
.set_config = enc424j600_set_config,
.get_capabilities = enc424j600_get_capabilities,
.send = enc424j600_tx,

25
drivers/ethernet/eth_sensry_sy1xx_mac.c

@ -352,30 +352,6 @@ static enum ethernet_hw_caps sy1xx_mac_get_caps(const struct device *dev) @@ -352,30 +352,6 @@ static enum ethernet_hw_caps sy1xx_mac_get_caps(const struct device *dev)
return supported;
}
static int sy1xx_mac_get_config(const struct device *dev, enum ethernet_config_type type,
struct ethernet_config *config)
{
struct sy1xx_mac_dev_data *data = (struct sy1xx_mac_dev_data *)dev->data;
/* we currently support only 1000mbit/s full duplex */
switch (type) {
case ETHERNET_CONFIG_TYPE_LINK:
config->l.link_1000bt = true;
break;
case ETHERNET_CONFIG_TYPE_DUPLEX:
config->full_duplex = true;
break;
case ETHERNET_CONFIG_TYPE_MAC_ADDRESS:
memcpy(config->mac_address.addr, data->mac_addr, 6);
break;
default:
return -ENOTSUP;
}
return 0;
}
static int sy1xx_mac_set_config(const struct device *dev, enum ethernet_config_type type,
const struct ethernet_config *config)
{
@ -588,7 +564,6 @@ const struct ethernet_api sy1xx_mac_driver_api = { @@ -588,7 +564,6 @@ const struct ethernet_api sy1xx_mac_driver_api = {
.stop = sy1xx_mac_stop,
.iface_api.init = sy1xx_mac_iface_init,
.get_capabilities = sy1xx_mac_get_caps,
.get_config = sy1xx_mac_get_config,
.set_config = sy1xx_mac_set_config,
.send = sy1xx_mac_send,
.get_phy = sy1xx_mac_get_phy,

36
drivers/ethernet/eth_stm32_hal.c

@ -1230,41 +1230,6 @@ static enum ethernet_hw_caps eth_stm32_hal_get_capabilities(const struct device @@ -1230,41 +1230,6 @@ static enum ethernet_hw_caps eth_stm32_hal_get_capabilities(const struct device
;
}
static int eth_stm32_hal_get_config(const struct device *dev, enum ethernet_config_type type,
struct ethernet_config *config)
{
struct eth_stm32_hal_dev_data *dev_data = dev->data;
switch (type) {
case ETHERNET_CONFIG_TYPE_MAC_ADDRESS:
memcpy(config->mac_address.addr, dev_data->mac_addr,
sizeof(config->mac_address.addr));
return 0;
#if defined(CONFIG_NET_PROMISCUOUS_MODE)
case ETHERNET_CONFIG_TYPE_PROMISC_MODE:
ETH_HandleTypeDef *heth = &dev_data->heth;
#if defined(CONFIG_ETH_STM32_HAL_API_V2)
ETH_MACFilterConfigTypeDef MACFilterConf;
HAL_ETH_GetMACFilterConfig(heth, &MACFilterConf);
config->promisc_mode = (MACFilterConf.PromiscuousMode == ENABLE);
#else
if (heth->Instance->MACFFR & ETH_MACFFR_PM) {
config->promisc_mode = true;
} else {
config->promisc_mode = false;
}
#endif /* CONFIG_ETH_STM32_HAL_API_V2 */
return 0;
#endif /* CONFIG_NET_PROMISCUOUS_MODE */
default:
break;
}
return -ENOTSUP;
}
static int eth_stm32_hal_set_config(const struct device *dev,
enum ethernet_config_type type,
const struct ethernet_config *config)
@ -1348,7 +1313,6 @@ static const struct ethernet_api eth_api = { @@ -1348,7 +1313,6 @@ static const struct ethernet_api eth_api = {
.get_capabilities = eth_stm32_hal_get_capabilities,
.set_config = eth_stm32_hal_set_config,
.get_phy = eth_stm32_hal_get_phy,
.get_config = eth_stm32_hal_get_config,
#if defined(CONFIG_NET_DSA_DEPRECATED)
.send = dsa_tx,
#else

8
subsys/usb/device_next/class/usbd_cdc_ecm.c

@ -546,13 +546,6 @@ static int cdc_ecm_set_config(const struct device *dev, @@ -546,13 +546,6 @@ static int cdc_ecm_set_config(const struct device *dev,
return -ENOTSUP;
}
static int cdc_ecm_get_config(const struct device *dev,
enum ethernet_config_type type,
struct ethernet_config *config)
{
return -ENOTSUP;
}
static enum ethernet_hw_caps cdc_ecm_get_capabilities(const struct device *dev)
{
ARG_UNUSED(dev);
@ -639,7 +632,6 @@ static struct usbd_class_api usbd_cdc_ecm_api = { @@ -639,7 +632,6 @@ static struct usbd_class_api usbd_cdc_ecm_api = {
static const struct ethernet_api cdc_ecm_eth_api = {
.iface_api.init = cdc_ecm_iface_init,
.get_config = cdc_ecm_get_config,
.set_config = cdc_ecm_set_config,
.get_capabilities = cdc_ecm_get_capabilities,
.send = cdc_ecm_send,

Loading…
Cancel
Save