[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <9f65fac0-e706-4a00-bac7-20c3ee727f69@lunn.ch>
Date: Fri, 11 Jul 2025 15:25:03 +0200
From: Andrew Lunn <andrew@...n.ch>
To: Wei Fang <wei.fang@....com>
Cc: robh@...nel.org, krzk+dt@...nel.org, conor+dt@...nel.org,
richardcochran@...il.com, claudiu.manoil@....com,
vladimir.oltean@....com, xiaoning.wang@....com,
andrew+netdev@...n.ch, davem@...emloft.net, edumazet@...gle.com,
kuba@...nel.org, pabeni@...hat.com, fushi.peng@....com,
devicetree@...r.kernel.org, netdev@...r.kernel.org,
linux-kernel@...r.kernel.org, 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?
Andrew
Powered by blists - more mailing lists