Skip to content

Documentation/ptp: add the existing implementations. - #20208

Merged
xiaoxiang781216 merged 1 commit into
apache:masterfrom
daniel-p-carvalho:docs/ptp-existing-implementations
Sep 21, 2026
Merged

xiaoxiang781216 merged 1 commit into
apache:masterfrom
daniel-p-carvalho:docs/ptp-existing-implementations

Conversation

@daniel-p-carvalho

Copy link
Copy Markdown
Contributor

Summary

The PTP clock driver page (Documentation/components/drivers/special/ptp.rst) explains how to write a lower-half driver, but it does not say which ones exist in the tree, and the driver of a real Ethernet MAC was added in #20180. This PR adds an "Existing Implementations" section, in the way that other driver pages do (for example the RPTUN driver porting page). It changes documentation only.

The section lists the two lower-half drivers that call ptp_clock_register() in master:

  • drivers/timers/ptp_clock_dummy.c, the dummy driver described in the same page, enabled with CONFIG_PTP_CLOCK_DUMMY and registered as /dev/ptp0 at start-up.
  • arch/arm/src/common/stm32/stm32_eth_m3m4_v1.c, the Ethernet MAC of the STM32 (the legacy driver), enabled with CONFIG_PTP_CLOCK and CONFIG_STM32_ETH_PTP and registered as /dev/ptpN, where N is the number of the Ethernet interface. It says that the clock is the PTP counter of the MAC, which is also the time base of the hardware timestamps of the received packets, so those are not values of CLOCK_REALTIME.

It also says that both use the device number 0 by default, so they cannot be registered at the same time. That comes from the code: the dummy driver is initialized with device number 0 in drivers_initialize() and the STM32 driver registers with the number of the interface.

Impact

Documentation only, no code change. Only the page components/drivers/special/ptp changes.

Testing

Built the documentation with Sphinx 6.2.1 and the packages of Documentation/Pipfile, without -W: the build succeeds, the new section renders and none of the 19 warnings (duplicate C declarations in other pages) is from this file. ./tools/checkpatch.sh passes.

The statements were checked by reading the code: the only two drivers that register a PTP clock were found with a search for ptp_clock_register() and ptp_clock_dummy_initialize() in master.

The page described how to write a lower-half driver but did not say
which ones are in the tree.

- List the two lower-half drivers that register a PTP clock, the dummy
  driver and the Ethernet MAC of the STM32, with the option that
  enables each.
- Say that the clock of the STM32 driver is the PTP counter of the MAC,
  which is also the time base of the timestamps of the received
  packets, and not CLOCK_REALTIME.
- Say that both use the device number 0 by default and so cannot be
  registered at the same time.

Signed-off-by: Daniel P. Carvalho <danieloak@gmail.com>
Assisted-by: Claude:claude-sonnet-5
@github-actions github-actions Bot added Area: Documentation Improvements or additions to documentation Size: S The size of the change in this PR is small labels Sep 20, 2026
@xiaoxiang781216
xiaoxiang781216 merged commit bda32d3 into apache:master Sep 21, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area: Documentation Improvements or additions to documentation Size: S The size of the change in this PR is small

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants