Commit Graph

70 Commits

Author SHA1 Message Date
Ondrej Kosta
f6420436eb feat(esp_eth): a new folder structure of the driver and other improvements
Fixed memory leak in emac_esp_new_dma function.

Polished ESP EMAC cache management.

Added emac_periph definitions based on SoC features and improved(generalized) ESP EMAC GPIO
initialization.

Added ESP EMAC GPIO reservation.

Added check for frame error condition indicated by EMAC DMA and created a target test.
2024-06-07 15:26:18 +02:00
gaoxu
c3303c0096 fix(eth): fix defaultip101 tests error on ci 2024-04-02 16:17:10 +08:00
Ondrej Kosta
6a09d98089 feat(esp_eth): added option to configure interrupt priority 2024-03-07 10:30:32 +01:00
Ondrej Kosta
1ae315e1ed fix(esp_eth): Fixed Ethernet link reset when Ethernet is stopped 2024-02-16 16:36:26 +01:00
Bogdan Kolendovskyy
748c215c63 fix(esp_eth): Use uint32_t in mmd access functions 2024-02-13 12:53:11 +01:00
Ondrej Kosta
5df5f0cf80 Merge branch 'feature/spi_eth_no_int' into 'master'
feat(esp_eth): added SPI Ethernet module polling mode

Closes IDFGH-11561

See merge request espressif/esp-idf!28782
2024-02-08 22:34:47 +08:00
Ondrej Kosta
fd0a1dc53c feat(esp_eth): added SPI Ethernet module polling mode
Closes https://github.com/espressif/esp-idf/issues/12682
2024-02-07 11:21:57 +01:00
Bogdan Kolendovskyy
d9e1d69b4e esp_eth: Add functions to access PHY using MDIO
Specifically:
  - Set/get address
  - Read/write data at address with specified MDIO access function
  - Read/write both address and data with a single call
2024-01-30 12:08:18 +01:00
Ondrej Kosta
ce388a4111 feat(esp_eth): Added support of internal EMAC for ESP32P4
Refactored internal EMAC DMA access.

Added MPLL acquire to manage access to the MPLL by multiple periphs.
2024-01-16 14:29:25 +01:00
Ondrej Kosta
78f791d4d5 feat(esp_eth): added ioctl option to read/write PHY registers
LAN87xx: Added extra delay after setting PHY speed
2023-11-08 12:40:28 +00:00
Ondrej Kosta
ecd1759a0b feat(esp_eth): abstraction of SPI driver for SPI Ethernet modules 2023-09-26 07:58:05 +00:00
Bogdan Kolendovskyy
224ba396f1 esp_eth: add loopback test, change chip drivers to reflect chip specific behaviour
In esp_eth_test_apps.c:
Add test of loopback functionality. Change speed/duplex/autonegotiation test - remove need to enable loopback (required
for it to work on some phys supported by ESP-IDF)

In Kconfig.projbuild:
Add parameters to select which configuration is used - standard or custom.
Add for custom configuration parameters to select MDC and MDIO pins (required to work with WESP-32 and other boards that
use non-standard pin assignments).

In esp_eth_test_common.c:
Add code to support changes made in Kconfig

In sdkconfig.ci.default_rtl8201:
Change config which is used. Now custom is used and MDC is gpio 16, MDIO is gpio 17. Reuqired to work with WESP-32

In esp_eth_phy_802_3.h:
Make 802.3 API public.

In esp_eth_phy_802_3.c:
Add loopback check in eth_phy_802_3_set_duplex(). Now ESP_ERR_INVALID_STATE is invoked on attempt to set duplex to half
when loopback is enabled.
Remove static property from esp_eth_phy_802_3_autonego_ctrl and esp_eth_phy_802_3_loopback.

In esp_eth_phy_dm9051.c:
Add dm9051_loopback() because DM9051 requires setting additional bit to enable auto-negotiation loopback for data to be
received. Add dm9051_set_speed() which invokes ESP_ERR_INVALID_STATE on attempt to set speed to 10 Mbps when loopback is
enabled because such speed configuration is unsupported.

In esp_eth_phy_ksz80xx.c:
Add ksz80xx_set_speed() which invokes ESP_ERR_INVALID_STATE on attempt to set speed to 10 Mbps when loopback is enabled
because such speed configuration is unsupported.

In esp_eth_phy_ksz8851snl.c:
Change phy_ksz8851_set_duplex() to invoke ESP_ERR_INVALID_STATE on attempt to set duplex to half when loopback is enabled.

In  esp_eth_phy_dp83848.c, esp_eth_phy_rtl8201.c:
Add autonego_ctrl implementation which prevents enabling autonegotiation when loopback is enabled.
Add loopback implementation which disables autonegotiation prior to enabling loopback.

In esp_eth_phy_lan87xx.c:
Add autonego_ctrl implementation which prevents enabling autonegotiation when loopback is enabled.
Add loopback implementation which disables autonegotiation prior to enabling loopback.
Fix link indicating being down when loopback is enabled by force setting link up.
2023-08-03 13:18:44 +02:00
Ondrej Kosta
bb6c6aff36 esp_eth: SPI Ethernet modules initialization simplification 2022-07-14 08:46:22 +02:00
Ondrej Kosta
43f3904304 esp_eth: IEEE 802.3 PHY MII Management Interface functionality grouped to one common file 2022-06-24 05:51:44 +00:00
David Cermak
fd366fac9e esp_eth: Remove deprecated esp_eth_receive() 2022-06-09 07:55:40 +00:00
David Cermak
343cf2696e esp_eth: Reduce internal deps onto netif-glue 2022-06-09 07:55:40 +00:00
David Cermak
5e19b9c951 esp-netif: Make dependency on esp-eth optional
* esp-netif to optionally depend on esp-eth (only for l2tap config)
* esp_eth.h now includes the original ethernet header and the
ethernet-netif glue layer
* Updated examples and test to explicitely use esp-eth dependency if
needed
2022-06-09 07:55:40 +00:00
David Cermak
680f3a50c2 esp_eth: Rename drivers main header to esp_eth_driver
The original  would be used as API header bringing both driver and netif related includes
2022-06-09 07:55:40 +00:00
Marius Vikhammer
c8617fe965 docs: fix all doxygen warnings
Doxygen warnings would previously not result in a failed pipeline.
Fixed this as well as all current warnings.
2022-05-12 14:50:03 +08:00
Ondrej Kosta
4051b80b4d esp_netif: remove dependency of L2 TAP Interface from netif_lwip
esp_eth: extended infrastructure to optionally provide more advanced access to MAC/PHY layers
2022-04-08 16:40:29 +02:00
David Cermak
8da2e4088c esp_eth: Update esp32's EMAC API to decouple driver and vendor config 2022-02-14 16:17:29 +00:00
David Cermak
1dc60730ee esp_eth: ESP32 EMAC to use common DMA busrt size for both Tx and Rx 2022-02-14 16:17:29 +00:00
David Cermak
2553fb5845 esp_eth: Make EMAC DMA burst size configurable
Merges https://github.com/espressif/esp-idf/pull/7874
Closes  https://github.com/espressif/esp-idf/issues/7380
2022-02-14 16:17:29 +00:00
Ondrej Kosta
7e864d6856 netif_glue: Removed deprecated esp_eth_set_default_handlers and esp_eth_clear_default_handlers 2021-12-08 09:21:30 +01:00
Ondrej Kosta
914eafe2db Merge branch 'feature/ksz80xx_support_extension' into 'master'
esp_eth: rework KSZ80xx implementation and add more KSZ80xx PHYs

Closes IDFGH-6203 and IDF-3522

See merge request espressif/esp-idf!16024
2021-12-06 08:54:33 +00:00
Ondrej Kosta
970986e5b6 Added KSZ8041/81 and LAN8720 Driver IDF v5.0 migration description
LAN8720 function call clean up
2021-12-03 14:28:52 +01:00
Fischerauer Christian
3fb83f2866 esp_eth: rework KSZ80xx implementation and add more KSZ80xx PHYs
* add support for KSZ8001, KSZ8021, KSZ8031, KSZ8051 and KSZ8061
* remove duplicate code
* simplify architecture to make the code base extensible (for future work)
2021-12-02 11:56:08 +01:00
Ondrej Kosta
fcd634faec Merge branch 'contrib/github_pr_7958' into 'master'
fix: missing initializer waring in esp_eth

Closes IDFGH-6293

See merge request espressif/esp-idf!16178
2021-11-29 13:24:58 +00:00
Vladimir Chistyakov
2b944ca056 fix: missing initializer warning in esp_eth
remove auto_nego_en member from esp_eth_config_t as it is not used
 anywhere
2021-11-26 17:42:38 +07:00
Ondrej Kosta
3a7a67f174 netif: added ESP-NETIF L2 TAP interface 2021-11-23 11:17:22 +01:00
Ondrej Kosta
d1f2a3dfcc esp_eth: added ioctl options to set Ethernet speed and duplex mode
esp_eth_ioctl third argument always acts as untyped pointer to memory now
2021-11-16 08:34:07 +01:00
ma-lalonde
0f754551dd Add support for Eth PHY KSZ8091 2021-11-01 11:11:18 -04:00
Ondrej Kosta
76326e8268 esp_eth: add PHY loopback control via esp_eth_ioctl
Fixed esp_eth_ioctl command's data argument non-standard handling
2021-09-14 09:13:54 +02:00
laokaiyao
8d18a9c614 emac: optimise iperf performane 2021-09-01 19:11:28 +08:00
Ondrej Kosta
ef30384902 esp_eth: add support for multiple Ethernets modules at a time
Ethernet driver events properly bounded with ESP NETIF actions to support multiple Ethernet modules used at a time.

Components using Ethernet updated to conform with new API.

Closes https://github.com/espressif/esp-idf/issues/7318
2021-08-24 17:10:36 +02:00
Ondrej Kosta
404905d5f1 esp_eth: Add support to LAN87xx family
Merges/Related-to https://github.com/espressif/esp-idf/pull/7097
2021-07-28 19:34:05 +08:00
Ondrej Kosta
02a432b8d3 Fix invalid ETH_MAC_DEFAULT_CONFIG macro in C++ 2021-07-19 09:56:07 +02:00
Ondrej Kosta
a6db3a5e77 esp_eth: Change clock mode setting
RMII clock mode is made to be run-time configurable.

Closes https://github.com/espressif/esp-idf/issues/6564
Closes https://github.com/espressif/esp-idf/issues/7107
2021-07-08 14:27:31 +02:00
laokaiyao
fe354f1c50 hal/emac_hal: refactord emac_hal 2021-06-16 09:48:21 +08:00
Vladimir Chistyakov
c4f131e6ee esp_eth: Add a KSZ8851SNL SPI Ethernet driver
Implement the PHY and MAC layers in the driver similar to
the W5500 driver.

Update Kconfig, CMakeLists.txt, and component.mk to incorporate
the changes.

Resolves: #6542

Merges https://github.com/espressif/esp-idf/pull/6636
Closes https://github.com/espressif/esp-idf/issues/6542
2021-04-22 13:55:51 +00:00
morris
537617aec7 esp_eth: support user customized PHY io function
Closes https://www.github.com/espressif/esp-idf/issues/6745
2021-04-21 13:08:07 +08:00
Patrick Wieder
98a4c70af9 Added support for Ethernet PHY KSZ8081
Merges https://github.com/espressif/esp-idf/pull/6578
2021-03-30 08:53:15 +00:00
morris
c010f24d8b esp_eth: deprecate esp_eth_receive
Ethernet driver is interrupt driven only, don't support polling mode.
So deprecate esp_eth_receive API.
2021-01-27 23:48:01 +08:00
Axel Lin
2049aa9f68 esp_eth: Add ioctl command for getting duplex mode
Similar to ETH_CMD_G_SPEED, add ETH_CMD_G_DUPLEX_MODE for getting duplex mode.

Merges https://github.com/espressif/esp-idf/pull/6436
2021-01-25 08:40:47 +00:00
morris
753a929525 global: fix sign-compare warnings 2021-01-12 14:05:08 +08:00
morris
1e905acacf eth: support W5500 MAC RAW mode
W5500 features an Ethernet MAC+PHY, plus a HW SOCKET implementation.
But in IDF, we only use software TCP/IP stack, which means we have
to bypass the HW TCP/IP stack in W5500.
So we enables the MAC RAW mode in W5500.
2020-11-16 13:30:49 +08:00
Angus Gratton
420aef1ffe Updates for riscv support
* Target components pull in xtensa component directly
* Use CPU HAL where applicable
* Remove unnecessary xtensa headers
* Compilation changes necessary to support non-xtensa gcc types (ie int32_t/uint32_t is no
  longer signed/unsigned int).

Changes come from internal branch commit a6723fc
2020-11-13 07:49:11 +11:00
Yorick van Pelt
65707cfb41 esp_eth_mac_esp32: optionally setup SMI GPIO's
This enables passing smi_mdio_gpio_num = -1 to disable that signal

Merges https://github.com/espressif/esp-idf/pull/5903
2020-09-25 19:59:41 +08:00
Jakob Hasse
f7f46905ec esp_eth: moved extern "C" after includes 2020-09-08 17:44:57 +08:00
morris
4e38aab1b0 ethernet: support flow control for esp32 emac 2020-08-10 18:54:25 +08:00