[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID:
<PAXPR04MB85106E94B1E59B3C896ED30D8851A@PAXPR04MB8510.eurprd04.prod.outlook.com>
Date: Thu, 17 Jul 2025 12:11:20 +0000
From: Wei Fang <wei.fang@....com>
To: Frank Li <frank.li@....com>
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>,
"vadim.fedorenko@...ux.dev" <vadim.fedorenko@...ux.dev>,
"shawnguo@...nel.org" <shawnguo@...nel.org>, "s.hauer@...gutronix.de"
<s.hauer@...gutronix.de>, "festevam@...il.com" <festevam@...il.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>,
"kernel@...gutronix.de" <kernel@...gutronix.de>
Subject: RE: [PATCH v2 net-next 05/14] ptp: netc: add periodic pulse output
support
> On Wed, Jul 16, 2025 at 03:31:02PM +0800, Wei Fang wrote:
> > NETC Timer has three pulse channels, all of which support periodic pulse
> > output. Bind the channel to a ALARM register and then sets a future time
> > into the ALARM register. When the current time is greater than the ALARM
> > value, the FIPER register will be triggered to count down, and when the
> > count reaches 0, the pulse will be triggered. The PPS signal is also
> > implemented in this way. However, for i.MX95, only ALARM1 can be used for
> > periodic pulse output, and for i.MX943, ALARM1 and ALARM2 can be used
> for
> > periodic pulse output, but NETC Timer has three channels, so for i.MX95,
> > only one channel can work at the same time, and for i.MX943, at most two
> > channel can work at the same time. Otherwise, if multiple channels share
> > the same ALARM register, some channel pulses will not meet expectations.
> > Therefore, the current implementation does not allow multiple channels to
> > share the same ALARM register at the same time.
>
> Can you simple said
>
> NETC Timer has three pulse channels. i.MX95 have one ALARM1. i.MX943 have
> ALARM1 and ALARM2. So only one channel can work for i.MX95. Two channels
> for imx943 at most.
Actually, i.MX95 have ALARM2 as well, but ALARM2 cannot be used as an
indication to the TMR_FIPER register start down counting. Let me think
how to refine the commit.
>
> Current (driver or IP) implementation don't allow multiple channels to
> share the same alarm register at the same time.
>
> > +static int netc_timer_get_alarm_id(struct netc_timer *priv)
> > +{
> > + int i;
> > +
> > + for (i = 0; i < priv->fs_alarm_num; i++) {
> > + if (!(priv->fs_alarm_bitmap & BIT(i))) {
>
> fnd_next_zero_bit()?
>
> or use ffz();
>
fs_alarm_num is 1 or 2, so fs_alarm_bitmap is u8 type, it fine
to use the current implementation, no need to change the type
of fs_alarm_bitmap to use the generic helper.
> > + priv->fs_alarm_bitmap |= BIT(i);
> > + break;
> > + }
> > + }
> > +
> > + return i;
> > +}
Powered by blists - more mailing lists