From: Qingfang Deng <qingfang.deng@linux.dev>
To: Abid Ali <dev.taqnialabs@gmail.com>,
Andrew Lunn <andrew+netdev@lunn.ch>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Maxime Coquelin <mcoquelin.stm32@gmail.com>,
Alexandre Torgue <alexandre.torgue@foss.st.com>
Cc: netdev@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] net: stmmac: enable MAC rx/tx after DMA start
Date: Fri, 31 Jul 2026 10:11:40 +0800 [thread overview]
Message-ID: <507ad6a6-52a2-4c68-9ba2-5cc4f92e192d@linux.dev> (raw)
In-Reply-To: <20260727-stmmac-rx-fifo-block-v2-1-4dc3457d31d0@gmail.com>
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
prev parent reply other threads:[~2026-07-31 2:12 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-27 6:14 [PATCH v2] net: stmmac: enable MAC rx/tx after DMA start Abid Ali
2026-07-27 8:23 ` Maxime Chevallier
2026-07-30 23:07 ` Jakub Kicinski
2026-07-31 2:11 ` Qingfang Deng [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=507ad6a6-52a2-4c68-9ba2-5cc4f92e192d@linux.dev \
--to=qingfang.deng@linux.dev \
--cc=alexandre.torgue@foss.st.com \
--cc=andrew+netdev@lunn.ch \
--cc=davem@davemloft.net \
--cc=dev.taqnialabs@gmail.com \
--cc=edumazet@google.com \
--cc=kuba@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-stm32@st-md-mailman.stormreply.com \
--cc=mcoquelin.stm32@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox