Commit Graph

167 Commits

Author SHA1 Message Date
Tian Sen Wen
61e05bddc9 fix(esp_eth): Fix DM9051 abnormal operation when SPI clock is too high
Simplified buffer allocation for DM9051
2024-08-08 20:53:48 +08:00
Ivan Grokhotkov
728136a91d
fix(esp_eth): fix variable declarations inside switch for clang 2024-07-12 12:14:32 +02:00
Ivan Grokhotkov
aad9ab02e8
feat(esp_eth): enable openeth in QEMU for ESP32-S3 2024-06-12 10:50:13 +02:00
Ondrej Kosta
e9adde3485 Merge branch 'bugfix/yeat_another_memory_leak' into 'master'
fix(esp_eth): Fixed another memory leak ESP MAC

Closes IDF-10079

See merge request espressif/esp-idf!31336
2024-06-06 18:48:09 +08:00
Bogdan Kolendovskyy
75222cc6b7 Merge branch 'feature/emac_insufficient_tx_buffer_debug_log' into 'master'
feat(esp_eth): Do not produce error when insufficient TX buffer size happens

See merge request espressif/esp-idf!31175
2024-06-05 19:29:06 +08:00
Ondrej Kosta
f9071cfce1 fix(esp_eth): Fixed another memory leak ESP MAC 2024-06-05 11:30:04 +02:00
Bogdan Kolendovskyy
514d8cb51d feat(esp_eth): Do not produce error when insufficient TX buffer size happens 2024-06-04 12:06:59 +02:00
morris
e5b7987e21 refactor(emac): use heap component API to allocate cached aligned DMA buffer 2024-06-02 22:19:46 +08:00
Ondrej Kosta
a558e94952 fix(esp_eth): fixing memory leak and invalid bit shift 2024-05-15 09:27:37 +02:00
Ondrej Kosta
d15a9c2c48 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-05-14 08:23:31 +02:00
Ondrej Kosta
7843c51ec4 Merge branch 'contrib/github_pr_13560' into 'master'
esp_eth: DP83848: correct link detection to use BMSR (GitHub PR)

Closes IDFGH-12557

See merge request espressif/esp-idf!30361
2024-04-24 14:22:45 +08:00
Karl Palsson
e2945871b7 fix(esp_eth): dp83848: correct link detection to use BMSR
Reading the link state via PHYSTS was incorrect, as it only reflects the
link state bit from BMSR.  BMSR latches link down events, and are not
cleared without being read.  (See 802.3-2008 section 2, section 22.2.4.2.13)
This leads to the original DP828xx code only supporting link up, then a
single link down event.

Switch to reading the link state via BMSR, but continuing to read the
negotiation results via PHYSTS and ANLPAR.  This is inline with
LAN8720x, RTL8201, KSZ80xx phy drivers, and other opensource drivers for
the DP838xx family of devices.

Tested on a private board with a DP83825i PHY.  No publically available
boards using the original DP83848 are known of for testing.

Signed-off-by: Karl Palsson <karl.palsson@marel.com>
2024-04-16 11:08:48 +00:00
Ondrej Kosta
60384d4fc0 fix(esp_eth): made access to PHY registers for DM9051 more robust 2024-04-15 15:39:23 +08:00
gaoxu
40f38bea6f feat(dma): refactor dma calloc function 2024-04-02 14:30:14 +08:00
Armando
78f96c4466 change(eth): use new esp_dma_calloc 2024-04-02 14:30:14 +08:00
Ondrej Kosta
9d0b8d62b0 Merge branch 'feature/emac_intr_prio' into 'master'
feat(esp_eth): added option to configure interrupt priority

Closes IDF-7969

See merge request espressif/esp-idf!29300
2024-03-19 21:09:30 +08:00
Ondrej Kosta
93db5a609a fix(esp_eth): fixed build for openeth due to incorrect printf format 2024-03-14 09:44:53 +01:00
Ondrej Kosta
6a09d98089 feat(esp_eth): added option to configure interrupt priority 2024-03-07 10:30:32 +01:00
Ondrej Kosta
edf49a92b7 fix(esp_eth): Removed -Wno-format in esp_eth component 2024-03-01 17:01:28 +01:00
Ondrej Kosta
4ddc947d1c Merge branch 'bugfix/eth_link_reset' into 'master'
fix(esp_eth): Fixed Ethernet link reset when Ethernet is stopped

Closes IDF-9195

See merge request espressif/esp-idf!29058
2024-02-28 20:26:29 +08:00
Bogdan Kolendovskyy
f02fadda87 Merge branch 'bugfix/ip101_hw_reset_include' into 'master'
fix(esp_eth): explicitly include FreeRTOS headers into ip101 driver

See merge request espressif/esp-idf!29063
2024-02-28 16:20:35 +08:00
Bogdan Kolendovskyy
eb8985886d fix(esp_eth): explicitly include FreeRTOS headers into ip101 driver to ensure availability of vTaskDelay 2024-02-27 18:13:07 +08:00
gaoxu
e9ce63532b feat(gpio): add gpio fun sellect api 2024-02-27 17:01:53 +08:00
Ondrej Kosta
1ae315e1ed fix(esp_eth): Fixed Ethernet link reset when Ethernet is stopped 2024-02-16 16:36:26 +01:00
Ondrej Kosta
dee34c2a48 Merge branch 'bugfix/spi_eth_recv_alloc' into 'master'
fix(esp_eth): improved SPI Ethernet _alloc_recv_buf error handling

Closes IDF-8601

See merge request espressif/esp-idf!29040
2024-02-16 19:52:48 +08:00
Ondrej Kosta
b0259f59c2 fix(esp_eth): improved SPI Ethernet _alloc_recv_buf error handling 2024-02-14 12:40:04 +01:00
Bogdan Kolendovskyy
748c215c63 fix(esp_eth): Use uint32_t in mmd access functions 2024-02-13 12:53:11 +01:00
Bogdan Kolendovskyy
91630fab36 Merge branch 'bugfix/ip101_reset_timing' into 'master'
fix(esp_eth): ip101-specific reset_hw to match reset timings from datasheet

Closes IDF-9160

See merge request espressif/esp-idf!28906
2024-02-09 16:44:24 +08: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
Bogdan Kolendovskyy
222f67f043 fix(esp_eth): ip101-specific reset_hw to match reset timings from datasheet
IP101 requires 10ms reset assertion time and 10ms post-reset delay to properly initialize.
2024-02-07 11:24:17 +01: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
morris
d78750306d refactor(emac): use clock_output driver for configuring RMII reference clock 2023-10-31 14:24:48 +08:00
Ondrej Kosta
a93d53aadb fix(esp_eth): various Ethernet driver fixes
ksz8851snl: enabled reception of multicast frames

Internal EMAC: fixed APLL CLK deinitialization

DM9051 and KSZ80xx: fixed speed configuration when not in loopback mode

phy_802_3: added multiple attempts when autodetecting PHY address
2023-10-12 07:23:51 +00:00
Bogdan Kolendovskyy
fac7cb4b78 Merge branch 'bugfix/rtl8201_reset_timing' into 'master'
esp_eth: rtl8201 timing fix

Closes IDFGH-10170

See merge request espressif/esp-idf!25814
2023-10-04 03:00:23 +08:00
Bogdan Kolendovskyy
c75fab3fa4 esp_eth: change rtl8201 reset timing to match datasheet
In esp_eth_phy_rtl8201.c:
Add 150ms delay after hardware reset, chage reset assertion time to 10ms

In esp_eth_phy_802_3.c:
Change reset function to use vTaskDelay for long (>=10ms) reset assertion time
Change esp_eth_phy_802_3_detect_phy_addr to check range 0-31 instead of 0-15.
2023-10-02 10:10:25 +02:00
Ondrej Kosta
e0c225b4f7 Merge branch 'feature/eth_spi_abstraction' into 'master'
Abstraction of SPI driver for SPI Ethernet modules

Closes IDF-7645

See merge request espressif/esp-idf!24429
2023-09-27 18:36:25 +08: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
303d2c2dc6 fix(esp_eth): Add model number 0x13 to list of suported models
Add model number 0x13 to KSZ80xx driver's list of supported models
corresonding to KSZ8041RLNI.
2023-09-25 11:24:52 +02:00
morris
0b970a8dfe refactor(emac): add LL functions for bus clock control 2023-09-04 10:52:03 +08:00
Omar Chebib
3e9d2155eb feat(esp_eth): add opencores ethernet support for ESP32-C3 (QEMU) target 2023-08-24 10:32:46 +08: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
Bogdan Kolendovskyy
a28d87e72a fix(eth_netif_glue): Move reporting speed to action connected
esp_eth_netif_glue.c:
Moved reporting link speed to action connected, removed speed reportg code from action start.
2023-07-27 13:15:42 +02:00
Ondrej Kosta
5ebe6b51d8 esp_eth: fixed esp_eth_transmit_vargs to transmit only when link is up
esp_eth test: clear unicast Rx event before wait
2023-05-23 08:23:34 +02:00
Jackson Ming Hu
896a07e5d6 w5500: rework version check to avoid a false alarm on fault detection
See: https://github.com/espressif/esp-idf/issues/11331
2023-05-19 15:33:22 +02:00
Ondrej Kosta
c231c79fc8 HAL: wrapped emac_ll functions to emac_hal
Closes #9934
2023-04-19 12:46:45 +00:00
Ondrej Kosta
3d66a10114 Ethernet driver and documentation clean-up 2023-04-04 11:33:08 +00:00
Ondrej
2ec7fc8f10 esp_eth: allowed DM9051 to receive multicast packets
Removed extra PHY status link checks from DM9051 MAC layer
2023-03-14 13:59:27 +00:00