[PATCH v2] net: stmmac: enable MAC rx/tx after DMA start
Qingfang Deng
qingfang.deng at linux.dev
Thu Jul 30 19:11:40 PDT 2026
Hi,
On 2026/7/27 14:14, Abid Ali wrote:
> The EMAC should only accept packets after the DMAs are enabled.
This is correct.
> Similarly, the teardown should ensure the MAC rx/tx is stopped before
> DMA engine is stopped.
This is _not_ correct. Instead it's a bit more complicated, according to
their programming guidelines:
Stopping and Restarting Transmission
- Disable the Transmit DMA (if applicable) by clearing Bit 0 (ST) of the
`DMA_CH(#i)_Tx_Control` register.
- Wait until the Transmit DMA generates the stopped interrupt (TPS field
of the `DMA_CH(#i)_Status` register).
- Wait for any previous frame transmissions to complete. You can check
this by reading the appropriate fields of the `MTL_TxQ0_Debug` register
(`TRCSTS != 1` and `TXQSTS = 0`).
- Disable the MAC transmitter and MAC receiver by clearing Bit 0 (RE) of
the `MAC_Rx_Configuration` and Bit 0 (TE) of the `MAC_Tx_Configuration`
register.
- Disable the Receive DMA (if applicable), after ensuring the data in
the Rx FIFO is transferred to the system memory (by reading the
appropriate fields of the `MTL_RxQ0_Debug` register; `PRXQ = 0` and
`RXQSTS = 0`).
- Wait until the Receive DMA generates the stopped interrupt, which is
available in the RPS field of the `DMA_CH(#i)_Status` register.
- Restart the DMAs.
- Enable the MAC Transmitter and Receiver.
So the correct order is: stop TX DMA -> stop MAC RX/TX -> stop RX DMA.
Best regards,
Qingfang
More information about the linux-arm-kernel
mailing list