Messages in this thread Patch in this message | | | From | Hubert Feurstein <> | Subject | [PATCH net-next 3/3] net: fec: add support for PTP system timestamping for MDIO devices | Date | Fri, 16 Aug 2019 18:31:57 +0200 |
| |
In order to improve the synchronisation precision of phc2sys (from the linuxptp project) for devices like switches which are attached to the MDIO bus, it is necessary the get the system timestamps as close as possible to the access which causes the PTP timestamp register to be snapshotted in the switch hardware. Usually this is triggered by an MDIO write access, the snapshotted timestamp is then transferred by several MDIO reads.
The ptp_read_system_*ts functions already check the ptp_sts pointer.
Signed-off-by: Hubert Feurstein <h.feurstein@gmail.com> --- drivers/net/ethernet/freescale/fec_main.c | 3 +++ 1 file changed, 3 insertions(+)
diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c index 2f6057e7335d..60e866631b61 100644 --- a/drivers/net/ethernet/freescale/fec_main.c +++ b/drivers/net/ethernet/freescale/fec_main.c @@ -1815,10 +1815,12 @@ static int fec_enet_mdio_write(struct mii_bus *bus, int mii_id, int regnum, reinit_completion(&fep->mdio_done); /* start a write op */ + ptp_read_system_prets(bus->ptp_sts); writel(FEC_MMFR_ST | FEC_MMFR_OP_WRITE | FEC_MMFR_PA(mii_id) | FEC_MMFR_RA(regnum) | FEC_MMFR_TA | FEC_MMFR_DATA(value), fep->hwp + FEC_MII_DATA); + ptp_read_system_postts(bus->ptp_sts); /* wait for end of transfer */ time_left = wait_for_completion_timeout(&fep->mdio_done, @@ -2034,6 +2036,7 @@ static int fec_enet_mii_init(struct platform_device *pdev) pdev->name, fep->dev_id + 1); fep->mii_bus->priv = fep; fep->mii_bus->parent = &pdev->dev; + fep->mii_bus->ptp_sts_supported = true; node = of_get_child_by_name(pdev->dev.of_node, "mdio"); err = of_mdiobus_register(fep->mii_bus, node); -- 2.22.1
| |