[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID:
<PAXPR04MB8510CF6159CECAEC10A638848854A@PAXPR04MB8510.eurprd04.prod.outlook.com>
Date: Mon, 14 Jul 2025 02:29:58 +0000
From: Wei Fang <wei.fang@....com>
To: Andrew Lunn <andrew@...n.ch>
CC: "robh@...nel.org" <robh@...nel.org>, "krzk+dt@...nel.org"
<krzk+dt@...nel.org>, "conor+dt@...nel.org" <conor+dt@...nel.org>,
"richardcochran@...il.com" <richardcochran@...il.com>, Claudiu Manoil
<claudiu.manoil@....com>, Vladimir Oltean <vladimir.oltean@....com>, Clark
Wang <xiaoning.wang@....com>, "andrew+netdev@...n.ch"
<andrew+netdev@...n.ch>, "davem@...emloft.net" <davem@...emloft.net>,
"edumazet@...gle.com" <edumazet@...gle.com>, "kuba@...nel.org"
<kuba@...nel.org>, "pabeni@...hat.com" <pabeni@...hat.com>, "F.S. Peng"
<fushi.peng@....com>, "devicetree@...r.kernel.org"
<devicetree@...r.kernel.org>, "netdev@...r.kernel.org"
<netdev@...r.kernel.org>, "linux-kernel@...r.kernel.org"
<linux-kernel@...r.kernel.org>, "imx@...ts.linux.dev" <imx@...ts.linux.dev>
Subject: RE: [PATCH net-next 02/12] ptp: netc: add NETC Timer PTP driver
support
> > + of_property_read_string(np, "clock-names", &clk_name);
> > + if (clk_name) {
> > + priv->src_clk = devm_clk_get_optional(dev, clk_name);
> > + if (IS_ERR_OR_NULL(priv->src_clk)) {
> > + dev_warn(dev, "Failed to get source clock\n");
> > + priv->src_clk = NULL;
> > + goto select_system_clk;
> > + }
> > +
> > + priv->clk_freq = clk_get_rate(priv->src_clk);
> > + if (!strcmp(clk_name, "system")) {
> > + /* There is a 1/2 divider */
> > + priv->clk_freq /= 2;
> > + priv->clk_select = NETC_TMR_SYSTEM_CLK;
> > + } else if (!strcmp(clk_name, "ccm_timer")) {
> > + priv->clk_select = NETC_TMR_CCM_TIMER1;
> > + } else if (!strcmp(clk_name, "ext_1588")) {
> > + priv->clk_select = NETC_TMR_EXT_OSC;
> > + } else {
> > + dev_warn(dev, "Unknown clock source\n");
> > + priv->src_clk = NULL;
> > + goto select_system_clk;
> > + }
>
> That is pretty unusual. Generally, a clock is a clock, and you only
> use the name to pick out a specific clock when there are multiple
> listed.
>
> Please expand the binding documentation to include a description of
> how the clock name is used here.
>
> I don't generally get involved with clock trees, but i'm wondering if
> the tree is correctly described. Maybe you need to add a clk-divider.c
> into the tree to represent the system clock being divided by two?
>
Currently, for i.MX platforms, there is a fixed 1/2 divider inside the
NETCMIX, so the system clock rate is always divided by two. Another
solution is to add a " fixed-factor-clock" node to the DTS and set the
"clock-div" to 2. Then this clock is used as the system clock of NETC,
so that we can remove the 1/2 divider from the driver. This method
should be more appropriate, after all, future platforms may remove
the 1/2 divider or replace it with another divider.
Powered by blists - more mailing lists