Commit eccc64fc authored by Lukasz Majewski's avatar Lukasz Majewski Committed by Carles Cufi
Browse files

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: default avatarLukasz Majewski <lukma@denx.de>
parent f426ad16
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -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);