drivers: ethernet: Build ethernet drivers with ETH_DRIVER_RAW_MODE

Allow building ethernet drivers without NET_L2_ETHERNET config symbol.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
This commit is contained in:
Pieter De Gendt 2024-03-11 15:14:05 +01:00 committed by David Leach
parent e99b5228a1
commit 2ee4716091
3 changed files with 54 additions and 1 deletions

View file

@ -35,6 +35,7 @@ add_subdirectory_ifdef(CONFIG_EDAC edac)
add_subdirectory_ifdef(CONFIG_EEPROM eeprom)
add_subdirectory_ifdef(CONFIG_ENTROPY_GENERATOR entropy)
add_subdirectory_ifdef(CONFIG_ESPI espi)
add_subdirectory_ifdef(CONFIG_ETH_DRIVER ethernet)
add_subdirectory_ifdef(CONFIG_FLASH flash)
add_subdirectory_ifdef(CONFIG_FPGA fpga)
add_subdirectory_ifdef(CONFIG_FUEL_GAUGE fuel_gauge)
@ -61,7 +62,6 @@ add_subdirectory_ifdef(CONFIG_MIPI_DSI mipi_dsi)
add_subdirectory_ifdef(CONFIG_MM_DRV mm)
add_subdirectory_ifdef(CONFIG_MODEM modem)
add_subdirectory_ifdef(CONFIG_NET_DRIVERS net)
add_subdirectory_ifdef(CONFIG_NET_L2_ETHERNET ethernet)
add_subdirectory_ifdef(CONFIG_PECI peci)
add_subdirectory_ifdef(CONFIG_PINCTRL pinctrl)
add_subdirectory_ifdef(CONFIG_PM_CPU_OPS pm_cpu_ops)

View file

@ -2,6 +2,11 @@
zephyr_library()
zephyr_library_property(ALLOW_EMPTY TRUE)
zephyr_library_include_directories(${ZEPHYR_BASE}/subsys/net/l2)
zephyr_library_sources_ifdef(CONFIG_ETH_DRIVER_RAW_MODE
eth_raw.c
)
zephyr_library_sources_ifdef(CONFIG_ETH_GECKO
eth_gecko.c

View file

@ -0,0 +1,48 @@
/**
* @file
* @brief Ethernet Driver raw mode
*
* This file contains a collection of functions called from the ethernet drivers
* to the missing upper layer.
*/
/*
* Copyright 2024 Basalte bv
*
* SPDX-License-Identifier: Apache-2.0
*/
#include <zephyr/net/ethernet.h>
__weak void ethernet_init(struct net_if *iface)
{
ARG_UNUSED(iface);
}
__weak void net_eth_carrier_on(struct net_if *iface)
{
ARG_UNUSED(iface);
}
__weak void net_eth_carrier_off(struct net_if *iface)
{
ARG_UNUSED(iface);
}
__weak int net_recv_data(struct net_if *iface, struct net_pkt *pkt)
{
ARG_UNUSED(iface);
ARG_UNUSED(pkt);
return -ENOTSUP;
}
__weak void net_if_carrier_on(struct net_if *iface)
{
ARG_UNUSED(iface);
}
__weak void net_if_carrier_off(struct net_if *iface)
{
ARG_UNUSED(iface);
}