• G
    net: ethernet: ti: am65-cpts: adjust estf following ptp changes · 7849c42d
    Grygorii Strashko 提交于
    When the CPTS clock is synced/adjusted by running linuxptp (ptp4l/phc2sys),
    it will cause the TSN EST schedule to drift away over time. This is because
    the schedule is driven by the EstF periodic counter whose pulse length is
    defined in ref_clk cycles and it does not automatically sync to CPTS clock.
       _______
     _|
      ^
      expected cycle start time boundary
       _______________
     _|_|___|_|
      ^
      EstF drifted away -> direction
    
    To fix it, the same PPM adjustment has to be applied to EstF as done to the
    PHC CPTS clock, in order to correct the TSN EST cycle length and keep them
    in sync.
    
    Drifted cycle:
    AM65_CPTS_EVT: 7 e1:01770001 e2:000000ff t:1635968230373377017
    AM65_CPTS_EVT: 7 e1:01770001 e2:000000ff t:1635968230373877017
    AM65_CPTS_EVT: 7 e1:01770001 e2:000000ff t:1635968230374377017
    AM65_CPTS_EVT: 7 e1:01770001 e2:000000ff t:1635968230374877017
    AM65_CPTS_EVT: 7 e1:01770001 e2:000000ff t:1635968230375377017
    AM65_CPTS_EVT: 7 e1:01770001 e2:000000ff t:1635968230375877023
    AM65_CPTS_EVT: 7 e1:01770001 e2:000000ff t:1635968230376377018
    AM65_CPTS_EVT: 7 e1:01770001 e2:000000ff t:1635968230376877018
    AM65_CPTS_EVT: 7 e1:01770001 e2:000000ff t:1635968230377377018
    
    Stable cycle:
    AM65_CPTS_EVT: 7 e1:01770001 e2:000000ff t:1635966863193375473
    AM65_CPTS_EVT: 7 e1:01770001 e2:000000ff t:1635966863193875473
    AM65_CPTS_EVT: 7 e1:01770001 e2:000000ff t:1635966863194375473
    AM65_CPTS_EVT: 7 e1:01770001 e2:000000ff t:1635966863194875473
    AM65_CPTS_EVT: 7 e1:01770001 e2:000000ff t:1635966863195375473
    AM65_CPTS_EVT: 7 e1:01770001 e2:000000ff t:1635966863195875473
    AM65_CPTS_EVT: 7 e1:01770001 e2:000000ff t:1635966863196375473
    Signed-off-by: NGrygorii Strashko <grygorii.strashko@ti.com>
    Signed-off-by: NSiddharth Vadapalli <s-vadapalli@ti.com>
    Reviewed-by: NRoger Quadros <rogerq@kernel.org>
    Acked-by: NRichard Cochran <richardcochran@gmail.com>
    Link: https://lore.kernel.org/r/20230321062600.2539544-1-s-vadapalli@ti.comSigned-off-by: NPaolo Abeni <pabeni@redhat.com>
    7849c42d
am65-cpts.c 34.5 KB