Skip to content
  1. Nov 12, 2022
  2. Nov 11, 2022
    • David S. Miller's avatar
      Merge branch 'ptp-adjfreq-copnvert' · 2cf7e87f
      David S. Miller authored
      
      
      Jacob Keller says:
      
      ====================
      ptp: convert remaining users of .adjfreq
      
      A handful of drivers remain which still use the .adjfreq interface instead
      of the newer .adjfine interface. The new interface is preferred as it has a
      more precise adjustment using scaled parts per million.
      
      A handful of the remaining drivers are implemented with a common pattern
      that can be refactored to use the adjust_by_scaled_ppm and
      diff_by_scaled_ppm helper functions. These include the ptp_phc, ptp_ixp64x,
      tg3, hclge, stmac, cpts and bnxt drivers. These are each refactored in a
      separate change.
      
      The remaining drivers, bnx2x, liquidio, cxgb4, fec, and qede implement
      .adjfreq in a way different from the normal pattern expected by
      adjust_by_scaled_ppm. Fixing these drivers to properly use .adjfine requires
      specific knowledge of the hardware implementation. Instead I simply refactor
      them to use .adjfine and convert scaled_ppm into ppb using the
      scaled_ppm_to_ppb function.
      
      Finally, the .adjfreq implementation interface is removed entirely. This
      simplifies the interface and ensures that new drivers must implement the new
      interface as they no longer have an alternative.
      
      This still leaves parts per billion used as part of the max_adj interface,
      and the core PTP stack still converts scaled_ppm to ppb to check this. I
      plan to investigate fixing this in the future.
      ====================
      
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      2cf7e87f
    • Jacob Keller's avatar
      ptp: remove the .adjfreq interface function · 75ab70ec
      Jacob Keller authored
      
      
      Now that all drivers have been converted to .adjfine, we can remove the
      .adjfreq from the interface structure.
      
      Signed-off-by: default avatarJacob Keller <jacob.e.keller@intel.com>
      Cc: Richard Cochran <richardcochran@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      75ab70ec
    • Jacob Keller's avatar
      ptp: convert remaining drivers to adjfine interface · e2bd9c76
      Jacob Keller authored
      
      
      Convert all remaining drivers that still use .adjfreq to the newer .adjfine
      implementation. These drivers are not straightforward, as they use
      non-standard methods of programming their hardware. They are all converted
      to use scaled_ppm_to_ppb to get the parts per billion value that their
      logic depends on.
      
      Signed-off-by: default avatarJacob Keller <jacob.e.keller@intel.com>
      Cc: Ariel Elior <aelior@marvell.com>
      Cc: Sudarsana Kalluru <skalluru@marvell.com>
      Cc: Manish Chopra <manishc@marvell.com>
      Cc: Derek Chickles <dchickles@marvell.com>
      Cc: Satanand Burla <sburla@marvell.com>
      Cc: Felix Manlunas <fmanlunas@marvell.com>
      Cc: Raju Rangoju <rajur@chelsio.com>
      Cc: Joakim Zhang <qiangqing.zhang@nxp.com>
      Cc: Edward Cree <ecree.xilinx@gmail.com>
      Cc: Martin Habets <habetsm.xilinx@gmail.com>
      Cc: Richard Cochran <richardcochran@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      e2bd9c76
    • Jacob Keller's avatar
      ptp: bnxt: convert .adjfreq to .adjfine · a29c132f
      Jacob Keller authored
      
      
      When the BNXT_FW_CAP_PTP_RTC flag is not set, the bnxt driver implements
      .adjfreq on a cyclecounter in terms of the straightforward "base * ppb / 1
      billion" calculation. When BNXT_FW_CAP_PTP_RTC is set, the driver forwards
      the ppb value to firmware for configuration.
      
      Convert the driver to the newer .adjfine interface, updating the
      cyclecounter calculation to use adjust_by_scaled_ppm to perform the
      calculation. Use scaled_ppm_to_ppb when forwarding the correction to
      firmware.
      
      Signed-off-by: default avatarJacob Keller <jacob.e.keller@intel.com>
      Cc: Michael Chan <michael.chan@broadcom.com>
      Cc: Richard Cochran <richardcochran@gmail.com>
      Reviewed-by: default avatarPavan Chebbi <pavan.chebbi@broadcom.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      a29c132f
    • Jacob Keller's avatar
      ptp: cpts: convert .adjfreq to .adjfine · a4539207
      Jacob Keller authored
      
      
      The cpts implementation of .adjfreq is implemented in terms of a
      straight forward "base * ppb / 1 billion" calculation.
      
      Convert this to the newer .adjfine, using the recently added
      adjust_by_scaled_ppm helper function.
      
      Signed-off-by: default avatarJacob Keller <jacob.e.keller@intel.com>
      Richard Cochran <richardcochran@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      a4539207
    • Jacob Keller's avatar
      ptp: stmac: convert .adjfreq to .adjfine · 2d96099f
      Jacob Keller authored
      
      
      The stmac implementation of .adjfreq is implemented in terms of a
      straight forward "base * ppb / 1 billion" calculation.
      
      Convert this to the newer .adjfine, using the recently added
      adjust_by_scaled_ppm helper function.
      
      Signed-off-by: default avatarJacob Keller <jacob.e.keller@intel.com>
      Cc: Giuseppe Cavallaro <peppe.cavallaro@st.com>
      Cc: Alexandre Torgue <alexandre.torgue@foss.st.com>
      Cc: Jose Abreu <joabreu@synopsys.com>
      Cc: Richard Cochran <richardcochran@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      2d96099f
    • Jacob Keller's avatar
      ptp: hclge: convert .adjfreq to .adjfine · 97455702
      Jacob Keller authored
      
      
      The hclge implementation of .adjfreq is implemented in terms of a
      straight forward "base * ppb / 1 billion" calculation.
      
      Convert this to the newer .adjfine, using the recently added
      adjust_by_scaled_ppm helper function.
      
      Signed-off-by: default avatarJacob Keller <jacob.e.keller@intel.com>
      Cc: Yisen Zhuang <yisen.zhuang@huawei.com>
      Cc: Salil Mehta <salil.mehta@huawei.com>
      Cc: Richard Cochran <richardcochran@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      97455702
    • Jacob Keller's avatar
      ptp: tg3: convert .adjfreq to .adjfine · e3f18e9d
      Jacob Keller authored
      
      
      The tg3 implementation of .adjfreq is implemented in terms of a
      straight forward "base * ppb / 1 billion" calculation.
      
      Convert this to the newer .adjfine, using the recently added
      diff_by_scaled_ppm helper function to calculate the difference and
      direction of the adjustment.
      
      Signed-off-by: default avatarJacob Keller <jacob.e.keller@intel.com>
      Cc: Siva Reddy Kallam <siva.kallam@broadcom.com>
      Cc: Prashant Sreedharan <prashant@broadcom.com>
      Cc: Michael Chan <mchan@broadcom.com>
      Cc: Richard Cochran <richardcochran@gmail.com>
      Reviewed-by: default avatarPavan Chebbi <pavan.chebbi@broadcom.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      e3f18e9d
    • Jacob Keller's avatar
      ptp_ixp46x: convert .adjfreq to .adjfine · 319d77e9
      Jacob Keller authored
      
      
      The ptp_ixp46x implementation of .adjfreq is implemented in terms of a
      straight forward "base * ppb / 1 billion" calculation.
      
      Convert this to the newer .adjfine, using the recently added
      adjust_by_scaled_ppm helper function.
      
      Signed-off-by: default avatarJacob Keller <jacob.e.keller@intel.com>
      Cc: Paolo Abeni <pabeni@redhat.com>
      Cc: Richard Cochran <richardcochran@gmail.com>
      Cc: Linus Walleij <linus.walleij@linaro.org>
      Reviewed-by: default avatarLinus Walleij <linus.walleij@linaro.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      319d77e9