mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Marek Vasut <marex@nabladev.com>
To: Vladimir Oltean <vladimir.oltean@nxp.com>
Cc: Wei Fang <wei.fang@nxp.com>, Clark Wang <xiaoning.wang@nxp.com>,
	Claudiu Manoil <claudiu.manoil@nxp.com>,
	"David S. Miller" <davem@davemloft.net>,
	Andrew Lunn <andrew+netdev@lunn.ch>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	"imx@lists.linux.dev" <imx@lists.linux.dev>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>
Subject: Re: [net-next,PATCH v2] enetc: Increase eMDIO MDC rate to 2.5 MHz
Date: Fri, 16 Oct 2026 21:09:36 +0200	[thread overview]
Message-ID: <df4212fa-2fb8-40ab-872a-40bd8a35ba0b@nabladev.com> (raw)
In-Reply-To: <20261013152559.cnh2i7i36hak6z3t@skbuf>

On 10/13/26 5:25 PM, Vladimir Oltean wrote:
> On Wed, Sep 30, 2026 at 06:19:04AM +0200, Marek Vasut wrote:
>> Are those clock which feed MDC clock available via clock framework on LS ?
>> If so, we could calculate the divider based on those clock.
> 
> Yes.
> 
> On LS1028A, the ENETC clock selection is made by a mux called HWA_CGA_M4_CLK_SEL
> (Hardware Accelerator Block Cluster Group A Mux 4 Clock Select).
> 
> You can describe that in ls1028a.dtsi like this (note that in the RM,
> the mux numbering is one-based, while in the device tree it is 0-based,
> so 3 is actually "MUX 4"):
> 
>   			enetc_mdio_pf3: mdio@0,3 {
>   				compatible = "pci1957,ee01", "fsl,enetc-mdio";
>   				reg = <0x000300 0 0 0 0>;
> +				clocks = <&clockgen QORIQ_CLK_HWACCEL 3>;
>   				#address-cells = <1>;
>   				#size-cells = <0>;
>   			};
> 
> Upon clk_get_rate(), the qoriq clockgen driver will use the device tree
> definition to index the hwaccel[] array and find the ls1028a_hwa4 structure.
> This defines what values the HWA4CSR register can legally take, and what
> each means. It will read HWA4CSR[HWACLKSEL] as 0011 (meaning Cluster PLL2
> divide-by-3). Then to calculate this clock rate, it knows it must read
> CGA_PLL2 and to divide by PLL_DIV3 (1200 / 3 = 400 MHz).
> 
> Note the ENETC PTP device already has this property defined (which is
> OK, all ENETC devices share the same clock).
> 
> Without a 'clocks' and/or 'clock-frequency' property, we have to figure
> out a default that works for everyone, or if that fails.
> 
> For example, with 400 MHz enet_clk on LS1028A, the original
> MDIO_CFG_CLKDIV value of 258 used to produce an MDC frequency of
> 400000000÷((258×2)+1)=773 KHz.
> 
> Your new MDIO_CFG_CLKDIV value of 66 produces 400000000÷((66)+1)=3 MHz,
> which is too high to be a default value. So from LS perspective, this
> patch needs to be reverted.
> 
> Generally it is assumed that low MDIO clock frequencies are not a
> problem. Otherwise, drivers/net/mdio/mdio-bitbang.c could never work.
> It seems TJA1120 is the odd one for requiring a maximum MDC clock
> period of 1000 ns.
> 
> Please use xgmac_mdio_set_mdc_freq() as model, since it exists to
> solve a very similar issue as you are trying to do.

All right, let's revert the original broken patch (already posted) and 
lemme prepare something similar to xgmac_mdio_set_mdc_freq(). Thanks !

      reply	other threads:[~2026-10-16 19:31 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-24 18:05 Marek Vasut
2026-09-25 18:43 ` netdev-bot+sashiko
2026-09-30  2:10 ` patchwork-bot+netdevbpf
2026-09-30  2:21   ` Marek Vasut
2026-09-30 20:51     ` Jakub Kicinski
2026-09-30  3:40 ` Wei Fang
2026-09-30  4:19   ` Marek Vasut
2026-09-30  6:12     ` Wei Fang
2026-09-30 13:11       ` Andrew Lunn
2026-10-01  0:04         ` Wei Fang
2026-09-30 13:27       ` Marek Vasut
2026-10-01  0:45         ` Wei Fang
2026-10-01  1:34           ` Marek Vasut
2026-10-01 10:57             ` Wei Fang
2026-10-01 13:53               ` Andrew Lunn
2026-10-01 22:43                 ` Marek Vasut
2026-10-08  3:08                   ` Wei Fang
2026-10-01 22:51             ` Jakub Kicinski
2026-10-01 23:11               ` Marek Vasut
2026-10-01 22:00         ` Marek Vasut
2026-10-08  2:34           ` Wei Fang
2026-10-12 17:05             ` Marek Vasut
2026-10-13  2:17               ` Wei Fang
2026-10-15 21:20                 ` Marek Vasut
2026-10-13 15:25     ` Vladimir Oltean
2026-10-16 19:09       ` Marek Vasut [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=df4212fa-2fb8-40ab-872a-40bd8a35ba0b@nabladev.com \
    --to=marex@nabladev.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=claudiu.manoil@nxp.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=imx@lists.linux.dev \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=vladimir.oltean@nxp.com \
    --cc=wei.fang@nxp.com \
    --cc=xiaoning.wang@nxp.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

all inboxes | Powered by JetHome®