All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jonathan Lemon <jonathan.lemon@gmail.com>
To: Vadim Fedorenko <vfedorenko@novek.ru>
Cc: Jakub Kicinski <kuba@kernel.org>, Vadim Fedorenko <vadfed@fb.com>,
	Aya Levin <ayal@nvidia.com>,
	Arkadiusz Kubalewski <arkadiusz.kubalewski@intel.com>,
	netdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org
Subject: Re: [RFC PATCH v1 3/3] ptp_ocp: implement DPLL ops
Date: Thu, 23 Jun 2022 16:36:20 -0700	[thread overview]
Message-ID: <20220623233620.vq7oqzop6lg4nmlb@bsd-mbp.dhcp.thefacebook.com> (raw)
In-Reply-To: <a978c45e-db51-a67c-9240-10eeeaa2db8d@novek.ru>

On Fri, Jun 24, 2022 at 12:11:43AM +0100, Vadim Fedorenko wrote:
> On 23.06.2022 19:28, Jonathan Lemon wrote:
> > On Thu, Jun 23, 2022 at 03:57:17AM +0300, Vadim Fedorenko wrote:
> > > From: Vadim Fedorenko <vadfed@fb.com>
> > > +static int ptp_ocp_dpll_get_source_type(struct dpll_device *dpll, int sma)
> > > +{
> > > +	struct ptp_ocp *bp = (struct ptp_ocp *)dpll_priv(dpll);
> > > +	int ret;
> > > +
> > > +	if (bp->sma[sma].mode != SMA_MODE_IN)
> > > +		return -1;
> > > +
> > > +	switch (ptp_ocp_sma_get(bp, sma)) {
> > > +	case 0:
> > > +		ret = DPLL_TYPE_EXT_10MHZ;
> > > +		break;
> > > +	case 1:
> > > +	case 2:
> > > +		ret = DPLL_TYPE_EXT_1PPS;
> > > +		break;
> > > +	default:
> > > +		ret = DPLL_TYPE_INT_OSCILLATOR;
> > > +	}
> > > +
> > > +	return ret;
> > > +}
> > 
> > These case statements switch on private bits.  This needs to match
> > on the selector name instead.
> > 
> 
> Not sure that string comparison is a good idea. Maybe it's better to extend
> struct ocp_selector with netlink type id and fill it according to hardware?

Sure, that could be an option.  But, as this is DPLL only, how does it
handle things when a pin is used for non-clock IO?  In the timecard,
for example, we have the frequency counters for input, and the frequency
generators/VCC/GND for output.

Actually our HW has a multi-level input, where the DPLL selects its
source from an internal mux - this isn't reflected here.  The external
pins feed into some complex HW logic, which performs its own priority
calculations before presenting the end result as an available selection
for the DPLL.
-- 
Jonathan

WARNING: multiple messages have this Message-ID (diff)
From: Jonathan Lemon <jonathan.lemon@gmail.com>
To: Vadim Fedorenko <vfedorenko@novek.ru>
Cc: Jakub Kicinski <kuba@kernel.org>, Vadim Fedorenko <vadfed@fb.com>,
	Aya Levin <ayal@nvidia.com>,
	Arkadiusz Kubalewski <arkadiusz.kubalewski@intel.com>,
	netdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org
Subject: Re: [RFC PATCH v1 3/3] ptp_ocp: implement DPLL ops
Date: Thu, 23 Jun 2022 16:36:20 -0700	[thread overview]
Message-ID: <20220623233620.vq7oqzop6lg4nmlb@bsd-mbp.dhcp.thefacebook.com> (raw)
In-Reply-To: <a978c45e-db51-a67c-9240-10eeeaa2db8d@novek.ru>

On Fri, Jun 24, 2022 at 12:11:43AM +0100, Vadim Fedorenko wrote:
> On 23.06.2022 19:28, Jonathan Lemon wrote:
> > On Thu, Jun 23, 2022 at 03:57:17AM +0300, Vadim Fedorenko wrote:
> > > From: Vadim Fedorenko <vadfed@fb.com>
> > > +static int ptp_ocp_dpll_get_source_type(struct dpll_device *dpll, int sma)
> > > +{
> > > +	struct ptp_ocp *bp = (struct ptp_ocp *)dpll_priv(dpll);
> > > +	int ret;
> > > +
> > > +	if (bp->sma[sma].mode != SMA_MODE_IN)
> > > +		return -1;
> > > +
> > > +	switch (ptp_ocp_sma_get(bp, sma)) {
> > > +	case 0:
> > > +		ret = DPLL_TYPE_EXT_10MHZ;
> > > +		break;
> > > +	case 1:
> > > +	case 2:
> > > +		ret = DPLL_TYPE_EXT_1PPS;
> > > +		break;
> > > +	default:
> > > +		ret = DPLL_TYPE_INT_OSCILLATOR;
> > > +	}
> > > +
> > > +	return ret;
> > > +}
> > 
> > These case statements switch on private bits.  This needs to match
> > on the selector name instead.
> > 
> 
> Not sure that string comparison is a good idea. Maybe it's better to extend
> struct ocp_selector with netlink type id and fill it according to hardware?

Sure, that could be an option.  But, as this is DPLL only, how does it
handle things when a pin is used for non-clock IO?  In the timecard,
for example, we have the frequency counters for input, and the frequency
generators/VCC/GND for output.

Actually our HW has a multi-level input, where the DPLL selects its
source from an internal mux - this isn't reflected here.  The external
pins feed into some complex HW logic, which performs its own priority
calculations before presenting the end result as an available selection
for the DPLL.
-- 
Jonathan

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2022-06-23 23:36 UTC|newest]

Thread overview: 48+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-23  0:57 [RFC PATCH v1 0/3] Create common DPLL/clock configuration API Vadim Fedorenko
2022-06-23  0:57 ` Vadim Fedorenko
2022-06-23  0:57 ` [RFC PATCH v1 1/3] dpll: Add DPLL framework base functions Vadim Fedorenko
2022-06-23  0:57   ` Vadim Fedorenko
2022-06-23 15:33   ` Kubalewski, Arkadiusz
2022-06-23 15:33     ` Kubalewski, Arkadiusz
2022-06-23 22:48     ` Vadim Fedorenko
2022-06-23 22:48       ` Vadim Fedorenko
2022-06-24 17:36       ` Kubalewski, Arkadiusz
2022-06-24 17:36         ` Kubalewski, Arkadiusz
2022-06-26 19:39         ` Vadim Fedorenko
2022-06-26 19:39           ` Vadim Fedorenko
2022-06-29  1:46           ` Kubalewski, Arkadiusz
2022-06-29  1:46             ` Kubalewski, Arkadiusz
2022-06-29 23:30             ` Vadim Fedorenko
2022-06-29 23:30               ` Vadim Fedorenko
2022-06-30 10:00               ` Kubalewski, Arkadiusz
2022-06-30 10:00                 ` Kubalewski, Arkadiusz
     [not found]               ` <20220629192312.45acd2fd@kernel.org>
2022-06-30 15:50                 ` Vadim Fedorenko
2022-06-30 15:50                   ` Vadim Fedorenko
2022-06-30 18:27                   ` Jakub Kicinski
2022-06-30 18:27                     ` Jakub Kicinski
2022-06-23  0:57 ` [RFC PATCH v1 2/3] dpll: add netlink events Vadim Fedorenko
2022-06-23  0:57   ` Vadim Fedorenko
2022-06-23  0:57 ` [RFC PATCH v1 3/3] ptp_ocp: implement DPLL ops Vadim Fedorenko
2022-06-23  0:57   ` Vadim Fedorenko
2022-06-23 18:28   ` Jonathan Lemon
2022-06-23 18:28     ` Jonathan Lemon
2022-06-23 23:11     ` Vadim Fedorenko
2022-06-23 23:11       ` Vadim Fedorenko
2022-06-23 23:36       ` Jonathan Lemon [this message]
2022-06-23 23:36         ` Jonathan Lemon
2022-06-26 19:28         ` Vadim Fedorenko
2022-06-26 19:28           ` Vadim Fedorenko
2022-06-27 19:27           ` Jonathan Lemon
2022-06-27 19:27             ` Jonathan Lemon
2022-06-27 22:06             ` Vadim Fedorenko
2022-06-27 22:06               ` Vadim Fedorenko
2022-06-26 19:27     ` Vadim Fedorenko
2022-06-26 19:27       ` Vadim Fedorenko
2022-06-27 19:23       ` Jonathan Lemon
2022-06-27 19:23         ` Jonathan Lemon
2022-06-27 22:04         ` Vadim Fedorenko
2022-06-27 22:04           ` Vadim Fedorenko
2022-06-24 17:20 ` [RFC PATCH v1 0/3] Create common DPLL/clock configuration API Florian Fainelli
2022-06-24 17:20   ` Florian Fainelli
2022-06-24 17:55   ` Jakub Kicinski
2022-06-24 17:55     ` Jakub Kicinski

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=20220623233620.vq7oqzop6lg4nmlb@bsd-mbp.dhcp.thefacebook.com \
    --to=jonathan.lemon@gmail.com \
    --cc=arkadiusz.kubalewski@intel.com \
    --cc=ayal@nvidia.com \
    --cc=kuba@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=netdev@vger.kernel.org \
    --cc=vadfed@fb.com \
    --cc=vfedorenko@novek.ru \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.