On Thu, 14 Dec 2023, Russell King (Oracle) wrote:
On Thu, Dec 14, 2023 at 09:13:58AM +0100, Romain Gantois wrote:
quoted
Hello Russell,
I've implemented and tested the general-case solution you proposed to this
receive clock issue with stmmac drivers. The core of your suggestion is pretty
much unchanged, I just added a phylink_pcs flag for standalone PCS drivers that
also need to provide the receive clock.
So this affects the ability of PCS to operate correctly as well as MACs?
Would you enlighten which PCS are affected, and what PCS <--> PHY link
modes this is required for?
The affected hardware is the RZN1 GMAC1 that is found in the r9a06g032 SoC from
Renesas. This MAC controller is internally connected to a custom PCS that
functions as a RGMII converter. This converter is handled by a standalone PCS
driver that is already upstream, unlike the GMAC1 driver. So in hardware, the
MAC/PHY links are organised this way:
RZN1 GMAC1 <--[GMII]--> MII_CONV1 (internal) <--[RGMII]--> external PHY
The issue is that the RX clock from the external PHY has to be transmitted by
the MII converter before it reaches GMAC1. Therefore, if the RZN1 PCS driver
isn't configured to let the clock through before the stmmac GMAC1 driver
initializes its hardware, then said initialization will fail with a vague DMA
error.
To solve this, I added a flag to phylink_pcs and made the phylink core set it in
phylink_validate_mac_and_pcs(). This gives the PCS driver a chance to check the
flag in pcs_validate() and allow the clock through before the GMAC1 net device
is brought up.
Regards,
--
Romain Gantois, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com