drivers: ethernet: lan865x: Trigger IRQ routine when rca>0 read from TX ftr

This code fixes following issue:

The TX data chunk (with NORX set) is send to chip (via SPI) and at the
same time a frame is received (by the LAN8651 chip), there will be no IRQ
(the CS is still asserted), just the footer will indicate this with the
rca > 0.

Afterwards, new frames are received by LAN865x, but as the previous footer
already is larger than zero there is no IRQ generated.

To be more specific (from [1], chapter 7.7):
----->8-------
RCA – Receive Chunks Available
Asserted:
The MAC-PHY detects CSn deasserted and the previous data footer had no
receive data chunks available (RCA = 0). The IRQn pin will be asserted
when receive data chunks become available for reading while CSn is
deasserted.

Deasserted:
On reception of the first data header following CSn being asserted
------8<------

Doc:
[1] - "OPEN Alliance 10BASE-T1x MAC-PHY Serial Interface"
OPEN_Alliance_10BASET1x_MAC-PHY_Serial_Interface_V1.1.pdf

Signed-off-by: Lukasz Majewski <lukma@denx.de>
This commit is contained in:
Lukasz Majewski 2023-12-12 11:17:30 +01:00 committed by Carles Cufí
parent f426ad16e1
commit eccc64fc49

View file

@ -547,6 +547,12 @@ static int lan865x_port_send(const struct device *dev, struct net_pkt *pkt)
k_sem_take(&ctx->tx_rx_sem, K_FOREVER);
ret = oa_tc6_send_chunks(tc6, pkt);
/* Check if rca > 0 during half-duplex TX transmission */
if (tc6->rca > 0) {
k_sem_give(&ctx->int_sem);
}
k_sem_give(&ctx->tx_rx_sem);
if (ret < 0) {
LOG_ERR("TX transmission error, %d", ret);