Re: [PATCH net 2/4] ptp: ocp: use hardware selectors in DPLL frequency operations

From: Ahmad Byagowi

Date: Sun Nov 22 2026 - 20:58:04 EST


On Sun, 22 Nov 2026 at 20:41:07 +0000, netdev-bot+sashiko@xxxxxxxxxx wrote:
> Does this still return -EINVAL for an enabled input that has more than
> one destination?
>
> The commit message says that without the mask "an enabled,
> direction-configurable pin has no matching table entry and its DPLL get
> or dump fails". The sysfs ABI allows several input destinations, and
> sma_parse_inputs() ORs them into one selector:
>
> sma_parse_inputs() {
> ...
> ret |= ptp_ocp_select_val_from_name(tbl[dir], argv[idx]);
>
> For example, writing "IN: TS1 TS2" to smaN gives 0x000C. After
> ptp_ocp_sma_store_val() adds SMA_ENABLE, 0x800C is written to the GPIO
> map.

Yes. I reproduced the error against the previous candidate. Masking the
enable bit alone did not fix combined destinations, and the DPLL core's
get-before-set path could still prevent recovery.

The v4 getter handles input combinations after the exact-match
lookup. Frequency-bearing destinations must agree to produce a known
frequency. Timestamp/counter destinations do not constrain it. A route
with no known frequency, conflicting frequencies or unknown bits returns
zero, as an individual timestamp route already does. This is a routing
interpretation, not a measurement of the input signal. Output selectors
still require an exact match.

The source-derived tests cover 4,669 masks across FB, ADVA and ADVA X1,
including TS1|TS2, timestamp-plus-PPS, conflicting destinations and
unknown bits. Recovery exercises the actual DPLL core get-before-set
function. The previous getter and a variant that chooses the first
conflicting frequency both fail runtime assertions.

> The commit message says passing the index can "fail on ART". Can a
> 10 MHz request on an ART input reach this line?
>
> The ART input table lists the 10Mhz entry at 1 MHz:
>
> static const struct ocp_selector ptp_ocp_art_sma_in[] = {
> ...
> { .name = "10Mhz", .value = 0x0008, .frequency = 1000000 },
>
> ART pins advertise ptp_ocp_sma_freq (1PPS, 10MHz, IRIG-B, DCF77). So
> dpll_pin_freq_set() accepts 10000000 and rejects 1000000.

Agreed. The selector fix was necessary but did not fix that separate
table error. I removed the misleading implication from patch 2 and
added a separate patch 5 changing the ART input frequency to 10000000.
The tests use the actual ART init/set/get functions and DPLL core
validation: 10000000 succeeds, 1000000 is rejected, and the fixed 0x08
default reads as 10000000. The old source fails those assertions.

Both issues are addressed in the v4 draft. Patch 2's expanded
behavior needs fresh review, so its earlier Reviewed-by is not retained.
All testing here is software-only with stubbed hardware operations.

The five-patch v4 series is posted separately to net:
https://lore.kernel.org/r/20261122-timecard-common-v4-e0db4ab1aa-0-ahmadexp@xxxxxxxxx

Ahmad

pw-bot: cr