dpll: add SiTime SiT9531x DPLL clock driver
Get series with b4
b4 am [email protected]Versions newest first · linked by author and title
- v17 Latest13 patches 0 repliesNew
- v1613 patches 19 repliesSuperseded
- v1513 patches 22 repliesSuperseded
Earlier versions · 12
| Version | Posted | Patches | Replies | Status |
|---|---|---|---|---|
| v14 | 12 patches | 1 reply | Superseded | |
| v13 | 12 patches | 8 replies | Superseded | |
| v12 | 12 patches | 13 replies | Superseded | |
| v11 | 13 patches | 14 replies | Superseded 1 of 13 applied | |
| v10 | 14 patches | 18 replies | Superseded | |
| v9 | 15 patches | 6 replies | Superseded | |
| v8 | 15 patches | 16 replies | Superseded | |
| v7 | 3 patches | 10 replies | Superseded | |
| v6 | 3 patches | 1 reply | Superseded | |
| v5 | 3 patches | 0 replies | Superseded | |
| v4 | 3 patches | 2 replies | Superseded | |
| v3 | 3 patches | 1 reply | Superseded |
Changes in v17 from the cover letter
- Patch 1: dpll.rst, the two callbacks in struct dpll_pin_ops and the netlink spec document the -ENODATA return.
- Patch 3: the description of supported-frequencies-hz says a rate is one 32-bit cell.
- Patch 4: probe enables the supplies and waits the start-up time before the first access.
- Patch 5: an output without supported-frequencies-hz advertises the datasheet rates, 1 Hz to 800 MHz and 61.44 MHz times 15, 20, 24, 30, 32, 40 and 48. A 0 Hz entry is refused as malformed.
- Patch 6: the clock_id comes from the die ID. The INTRB handler and the poll acknowledge every documented notification latch; an interrupt with no latch set is not handled. Resume waits the start-up time and reads the configuration again.
- Patch 7: a PLL that stays frozen is re-selected, as described above. On manual input select the selected input is CONNECTED and a state request is refused with a message. A failed receiver power-down and a failed close of the PLL debug key are retried.
- Patch 8: the XO pin of an automatic PLL reports its priority, read-only. A state request that succeeds is notified once.
- Patch 9: the setter accepts up to 2949.12 MHz, and 250 MHz on an LVCMOS output; the getter rounds to the nearest hertz. A failed NVM bank update is retried. The flush trigger falls before the trigger select is put back.
- Patch 10: an unmute writes back the force the loaded configuration set on each pad.
- Patch 11: the delay getter has no value while a delay waits for its re-time or update, or while the Fvco is outside the band. A request equal to the programmed delay writes nothing. A flush after a rate change waits for a pending bank update and stays pending until its trigger falls.
- Patch 12: no phase offset while the Fvco is outside the band.
- Patch 13: the getters answer from the kept record when a read fails. A failed close of an EXT page debug key is retried. A disconnect whose write fails writes the register back, so a PLL that still drives the line stays its source.
- Macros, helpers and struct fields move to the patch that first uses them.
Patches in v17 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/13 | dpll: omit pin phase attributes the driver has no value forDocumentation/ Documentation/ drivers/ +1 more | +27 | 0 replies | |
| 2/13 | dt-bindings: vendor-prefixes: add SiTime CorporationDocumentation/ | +2 | 0 replies | |
| 3/13 | dt-bindings: dpll: add SiTime SiT95316 clock generatorDocumentation/ MAINTAINERS | +221 | 0 replies | |
| 4/13 | dpll: add basic SiTime SiT9531x supportMAINTAINERS drivers/ drivers/ +5 more | +415 | 0 replies | |
| 5/13 | dpll: sit9531x: read DPLL types and pin properties from system firmwaredrivers/ drivers/ drivers/ +1 more | +441 | 0 replies | |
| 6/13 | dpll: sit9531x: register DPLL devices and pinsdrivers/ drivers/ drivers/ +4 more | +2199 | 0 replies | |
| 7/13 | dpll: sit9531x: implement input pin state on a DPLLdrivers/ drivers/ drivers/ +3 more | +1750 | 0 replies | |
| 8/13 | dpll: sit9531x: add support to get and set priority on input pinsdrivers/ drivers/ drivers/ +2 more | +371 | 0 replies | |
| 9/13 | dpll: sit9531x: add support to get and set frequency on pinsdrivers/ drivers/ drivers/ +2 more | +904 | 0 replies | |
| 10/13 | dpll: sit9531x: implement output pin state on a DPLLdrivers/ drivers/ drivers/ | +467 | 0 replies | |
| 11/13 | dpll: sit9531x: add support to adjust output phasedrivers/ drivers/ drivers/ +2 more | +1009 | 0 replies | |
| 12/13 | dpll: sit9531x: add support to get phase offset on the connected inputdrivers/ drivers/ drivers/ +1 more | +436 | 0 replies | |
| 13/13 | dpll: sit9531x: model the inter-PLL sync line as a pair of pinsdrivers/ drivers/ drivers/ +1 more | +1278 | 0 replies |
Reviews trailers per patch
3 of 13 patches have a Reviewed-by or Acked-by.
| Patch | Ivan Vecera | Conor Dooley | Rob Herring (Arm) |
|---|---|---|---|
| 1/13 | R-b | ||
| 2/13 | A-b | ||
| 3/13 | R-b | ||
| 4/13 | |||
| 5/13 | |||
| 6/13 | |||
| 7/13 | |||
| 8/13 | |||
| 9/13 | |||
| 10/13 | |||
| 11/13 | |||
| 12/13 | |||
| 13/13 |
Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 3 reviewers.
Cover letter [PATCH net-next v17 00/13] dpll: add SiTime SiT9531x DPLL clock driver
This series adds a DPLL subsystem driver for the SiTime SiT95316 and SiT95317 I2C clock generators. Each device integrates four PLLs with automatic reference selection and on-chip TDC phase-offset measurement, and is used for synchronization in telecom, networking, and data-center timing.
Patch 1 changes the DPLL core: phase_offset_get and phase_adjust_get may return -ENODATA, and the core then leaves the attribute out of the pin message instead of failing the dump. Patches 11 and 12 use it. The rest is the device-tree binding, the driver under drivers/dpll/sit9531x/, and the MAINTAINERS entry.
v1: https://lore.kernel.org/netdev/[email protected]/
v2: https://lore.kernel.org/netdev/[email protected]/
v3: https://lore.kernel.org/netdev/[email protected]/
v4: https://lore.kernel.org/netdev/[email protected]/
v5: https://lore.kernel.org/netdev/[email protected]/
v6: https://lore.kernel.org/netdev/[email protected]/
v7: https://lore.kernel.org/netdev/[email protected]/
v8: https://lore.kernel.org/netdev/[email protected]/
v9: https://lore.kernel.org/netdev/[email protected]/
v10: https://lore.kernel.org/netdev/[email protected]/
v11: https://lore.kernel.org/netdev/[email protected]/
v12: https://lore.kernel.org/netdev/[email protected]/
v13: https://lore.kernel.org/netdev/[email protected]/
v14: https://lore.kernel.org/netdev/[email protected]/
v15: https://lore.kernel.org/netdev/[email protected]/
v16: https://lore.kernel.org/netdev/[email protected]/
The changes in v17 answer the netdev AI review and the Sashiko review of v16. Each finding of the netdev AI review has a reply on its patch:
a fix folded into the patch that introduces the code, or a reason it does not hold. The two items left for patches after this series is merged are listed at the end of this letter.
Jiri, Ivan, Vadim, Arkadiusz: each AI review of this series raises new findings. Which open items would you want resolved before the series is merged, and would you rather review the driver as a smaller series first?
Ivan Vecera's Reviewed-by on patch 1 and Rob Herring's on patch 3 are carried. Patch 1 gained documentation of the -ENODATA return and no code; the schema in patch 3 gained one sentence in a description.
Oleg and I used LLM coding assistants to write parts of the driver code and of the commit messages, and reviewed and revised what they produced.
1 dpll core: omit phase attributes a driver has no value for 2 bindings: vendor prefix 3 bindings: the device schema 4 basic support: paged regmap, variant detection, probe 5 DPLL types and pin properties from system firmware 6 register the DPLL devices and pins, and keep their state 7 input pin state and operational state on a DPLL 8 input pin priority 9 pin frequency, both directions 10 output pin state (mute) 11 output phase adjust 12 phase offset through the TDC 13 the inter-PLL sync line as a pair of pins
The two bindings patches come before the driver, so the driver never matches on a compatible string before the schema that describes it is in the tree.
Every patch builds with only the earlier patches applied: no patch calls something a later patch introduces. This was re-checked for this posting patch by patch with W=1 and with sparse, and kernel-doc -Wall is clean on every driver patch. checkpatch --strict at 80 columns is clean except for the "does MAINTAINERS need updating?" hint on patches 5 and 6, which add files under drivers/dpll/sit9531x/; patch 4 already covers that directory with an F: entry.
Design decisions and hardware assumptions
=========================================
Configuration ownership. The part runs a configuration it loaded before the driver binds, from efuse or from a blob the board applies. The driver reads that configuration and never resets the part, rewrites loop-filter coefficients or touches a register the configurator sets. What it changes at runtime is what the DPLL API asks it to change:
input selection and priorities, output enables, rates and delays, the inter-PLL sync source. Where the loaded configuration puts a PLL outside what the API can express, the driver reports what the part does and withholds the control rather than reconfiguring the part:
a PLL in manual input select is reported in MANUAL mode with its selected input CONNECTED and no selection or priority setters; a half-armed fast lock registers without the attribute.
Automatic selection. A PLL whose profile arbitrates by priority is reported AUTOMATIC: the part picks among the listed inputs by the priorities it is given, and the driver keeps the table and the active selection register in step with the priorities it was asked for. A table write latches the active selection again and restarts acquisition. The driver writes the table of a PLL in holdover once when it loses its reference, once when the best source with signal changes, and once on the first sample after probe or resume. A PLL that stays frozen with the best source unchanged is re-selected after 10 s, then at doubling intervals up to 640 s: a PLL that locks and loses its source between two samples is never seen to track. Whether a PLL returns to a higher-priority input that recovers is the profile's REVERT_EN; the DPLL API has no attribute for revertive selection and no driver exposes its setting.
Qualification. The driver selects on loss of signal and reports ACTIVE from it. The frequency-drift monitors are reported as a qualification failure on an input the PLL is not on; an input the part keeps tracking while its drift flag is set is reported as the part reports it.
Register access. The part shows one 256-byte page at a time, selected through the register at offset 0xFF of every page and latched on the STOP of that write. The regmap is that flat window; the driver selects the page itself under its own lock, remembers the page it selected, forgets it on any failed transfer and on resume, and re-selects on the next access. No other regmap user, debugfs included, can move the page. The I2C_SLAVE_FORCE path of i2c-dev is the
documented debugging override and is not defended against.
Status. The poll reads the status registers twice a second and reports what it samples; a loss of lock that begins and ends between two samples is not reported. INTRB, where wired, brings the next sample forward. The handler and the poll acknowledge each documented notification latch by writing back only the bits found set.
Clocks and supplies. Probe enables vdd, vddin and each VDDO supply the board names, then waits the 10 ms start-up time of the datasheet before the first access, with or without a reset line; resume waits the same time and reads the select modes, priority tables and output routing again. The XO is taken through devm_clk_get_optional_enabled() for its rate and to hold a reference, so clk_disable_unused() cannot gate an XO the loaded configuration runs from; the enable is not what starts the XO, and the reference goes back to the provider on unbind or a failed probe. A clock or a rail the part must keep without a driver bound is the provider's property (CLK_IS_CRITICAL, regulator-always-on), as for any part that is configured before Linux runs.
Clock ID. The clock_id is built from the 9-byte die ID at page 0 0x41-0x49: the last eight bytes, with the first XORed into the most significant one. A die ID of all zeros or all ones, or one another bound part holds, gives the clock_id from the SiTime OUI, the I2C bus number and the address instead.
The XO pin. The XO is the reference of the inner loop of every PLL, so the XO pin is CONNECTED on every DPLL, next to the input the outer loop tracks, with no capabilities and no state setter. CONNECTED is the state the uAPI has for an input in use that the user cannot change. The XO pin has no phase offset.
VCO rate. The VCO rate is derived as Fref * DIVN, the XO rate (with the doubler) times the PLL page's static divider, which is how the register map defines the inner loop; the binding describes the XO and no other reference. The estimate is bounded: a product outside the PLL's VCO band is reported once, reads as 0 Hz and refuses every frequency and delay request, and inside the band a rate is programmed only when the estimated Fvco is a whole multiple of it. The read paths report the value computed from the product.
Output pads. The driver reads the pad-enable bits only to tell a CMOS output from a differential one, and mutes an output by forcing its pads off. It reports an output muted when both pads are forced off, the only state its own mute produces; a profile that forces one pad is reported as driven. Probe records the force the loaded configuration sets on each pad, and an unmute writes that record back. The force registers act when written, under the output system's debug key and without a programming sequence.
Phase offset. The measurement compares the selected input against a physical output the PLL drives, as the documented procedure does, so a PLL with no routed, enabled output reports no phase offset (the attribute is omitted). The offset is negative when the input edge comes first. A sample that cannot be taken, including one taken while the input disappears, leaves the attribute out rather than failing the dump.
Notifications. The driver sends again a change notification it could not build for a change it made itself (a failed request that moved hardware, a read-through that moved a value, the sync-line source). It does not retry the notifications the core sends after a successful
request: dpll_pin_prio_set() and dpll_pin_state_set() discard that result for every driver, and a retry in the driver would notify the change twice.
Recovery after a failed write. A sequence that fails part-way leaves the part in a state the driver records as pending: a priority table not latched, a forced holdover to release, a delay to re-time, an NVM bank update, an output realignment, open output loops, a receiver to power down, a debug window to close, a sync-line page half written. The poll retries each until the write succeeds; unbind retries once more and warns about what is left; resume drops the pending bank update, receiver power-down and realignment, since the registers it re-reads describe the part after a suspend that may have reloaded it, and keeps the sync-line ownership records until a retry resolves them.
Changes in v17:
- Patch 1: dpll.rst, the two callbacks in struct dpll_pin_ops and the netlink spec document the -ENODATA return.
- Patch 3: the description of supported-frequencies-hz says a rate is one 32-bit cell.
- Patch 4: probe enables the supplies and waits the start-up time before the first access.
- Patch 5: an output without supported-frequencies-hz advertises the datasheet rates, 1 Hz to 800 MHz and 61.44 MHz times 15, 20, 24, 30, 32, 40 and 48. A 0 Hz entry is refused as malformed.
- Patch 6: the clock_id comes from the die ID. The INTRB handler and the poll acknowledge every documented notification latch; an interrupt with no latch set is not handled. Resume waits the start-up time and reads the configuration again.
- Patch 7: a PLL that stays frozen is re-selected, as described above. On manual input select the selected input is CONNECTED and a state request is refused with a message. A failed receiver power-down and a failed close of the PLL debug key are retried.
- Patch 8: the XO pin of an automatic PLL reports its priority, read-only. A state request that succeeds is notified once.
- Patch 9: the setter accepts up to 2949.12 MHz, and 250 MHz on an LVCMOS output; the getter rounds to the nearest hertz. A failed NVM bank update is retried. The flush trigger falls before the trigger select is put back.
- Patch 10: an unmute writes back the force the loaded configuration set on each pad.
- Patch 11: the delay getter has no value while a delay waits for its re-time or update, or while the Fvco is outside the band. A request equal to the programmed delay writes nothing. A flush after a rate change waits for a pending bank update and stays pending until its trigger falls.
- Patch 12: no phase offset while the Fvco is outside the band.
- Patch 13: the getters answer from the kept record when a read fails. A failed close of an EXT page debug key is retried. A disconnect whose write fails writes the register back, so a PLL that still drives the line stays its source.
- Macros, helpers and struct fields move to the patch that first uses them.
Left for patches on top of this series once it is merged:
- reporting a loss of lock shorter than one poll period from the notification latches
- deriving the VCO rate of a PLL fed from another PLL
Ali Rouhi (2):
dt-bindings: vendor-prefixes: add SiTime Corporation
dt-bindings: dpll: add SiTime SiT95316 clock generator
Oleg Zadorozhnyi (11):
dpll: omit pin phase attributes the driver has no value for
dpll: add basic SiTime SiT9531x support
dpll: sit9531x: read DPLL types and pin properties from system
firmware
dpll: sit9531x: register DPLL devices and pins
dpll: sit9531x: implement input pin state on a DPLL
dpll: sit9531x: add support to get and set priority on input pins
dpll: sit9531x: add support to get and set frequency on pins
dpll: sit9531x: implement output pin state on a DPLL
dpll: sit9531x: add support to adjust output phase
dpll: sit9531x: add support to get phase offset on the connected input
dpll: sit9531x: model the inter-PLL sync line as a pair of pins
.../bindings/dpll/sitime,sit95316.yaml | 215 + .../devicetree/bindings/vendor-prefixes.yaml | 2 + Documentation/driver-api/dpll.rst | 11 +- Documentation/netlink/specs/dpll.yaml | 6 + MAINTAINERS | 7 + drivers/dpll/Kconfig | 2 + drivers/dpll/Makefile | 1 + drivers/dpll/dpll_netlink.c | 14 +- drivers/dpll/sit9531x/Kconfig | 17 + drivers/dpll/sit9531x/Makefile | 4 + drivers/dpll/sit9531x/core.c | 5816 +++++++++++++++++ drivers/dpll/sit9531x/core.h | 496 ++ drivers/dpll/sit9531x/dpll.c | 1632 +++++ drivers/dpll/sit9531x/dpll.h | 64 + drivers/dpll/sit9531x/prop.c | 406 ++ drivers/dpll/sit9531x/prop.h | 37 + drivers/dpll/sit9531x/regs.h | 353 + include/linux/dpll.h | 2 + 18 files changed, 9079 insertions(+), 6 deletions(-) create mode 100644 Documentation/devicetree/bindings/dpll/sitime,sit95316.yaml create mode 100644 drivers/dpll/sit9531x/Kconfig create mode 100644 drivers/dpll/sit9531x/Makefile create mode 100644 drivers/dpll/sit9531x/core.c create mode 100644 drivers/dpll/sit9531x/core.h create mode 100644 drivers/dpll/sit9531x/dpll.c create mode 100644 drivers/dpll/sit9531x/dpll.h create mode 100644 drivers/dpll/sit9531x/prop.c create mode 100644 drivers/dpll/sit9531x/prop.h create mode 100644 drivers/dpll/sit9531x/regs.h
base-commit: fa5196392691051963726787944db872420dfa75
Signature · 1 line
2.39.2 (Apple Git-143)