1. 06 Sep, 2022 3 commits
    • Marc Kleine-Budde's avatar
      Merge patch series "can: gs_usb: hardware timestamp support" · 26f6a2ae
      Marc Kleine-Budde authored
      Marc Kleine-Budde <mkl@pengutronix.de> says:
      
      after noticing that the gs_usb firmware sends timestamps on the TX,
      too, I updated the driver and squashed the 2nd patch. Also added
      proper endianness handling to gs_usb_get_timestamp(). I allowed to add
      myself as Co-developed-by.
      
      Changes since v2: https://lore.kernel.org/all/20220827092545.2971240-1-mkl@pengutronix.de
      - new patch 1/2: use common spelling of GS_USB in macros
      - squashed both old patches into now 2/2
      - use GS_USB instead of GSUSB in macros
      - gs_usb_get_timestamp(): renamed from gs_usb_get_sof_timestamp()
      - gs_usb_get_timestamp(): take care of endianness
      - gs_usb_skb_set_timestamp(): renamed from gs_usb_set_timestamp()
      - gs_usb_set_timestamp(): add new function to add timestamp to skb
        from struct gs_host_frame
      - add support for TX timestamps
      - gs_can_eth_ioctl(): return -EOPNOTSUPP if device doesn't support
        GS_CAN_FEATURE_HW_TIMESTAMP
      - gs_usb_get_ts_info(): renamed from gs_usb_get_ts_info_hwts()
      - gs_usb_get_ts_info(): call can_ethtool_op_get_ts_info_hwts() if
        device supports GS_CAN_FEATURE_HW_TIMESTAMP, call
        ethtool_op_get_ts_info() otherwise
      
      Changes since v1: https://lore.kernel.org/all/20220826104629.2837024-1-mkl@pengutronix.de
      - add new includes sorted
      - adjust multi line comment style
      - don't use 1e6, but 1 * HZ_PER_MHZ, to fix sparse warning
      - use __le32 instead of u32 in struct classic_can_ts and canfd_ts
      - place _ts in front of _quirk in union in struct gs_host_frame
      - gs_usb_get_sof_timestamp(): pass "const struct gs_can *dev" as 1st
        argument, not struct net_device *netdev, simplify return handling
      - gs_usb_timestamp_init(), gs_usb_timestamp_stop(),
        gs_usb_get_ts_info_hwts(): make static
      - gs_usb_timestamp_init(): increase cc->shift to maximize precision
      - fix long lines, remove braces {} for single statement blocks
      - gs_can_open(): move check for GS_CAN_FEATURE_HW_TIMESTAMP after all
        ctrlmode checks
      - gs_can_open(): move start polling sof timestamp after kfree(dm)
      - gs_can_close(): move stop polling sof timestamp to be symmetric with
        respect to gs_can_open()
      - gs_usb_probe(): make calculation of dev->hf_size_rx more robust
      
      Link: https://lore.kernel.org/all/20220827221548.3291393-1-mkl@pengutronix.deSigned-off-by: default avatarMarc Kleine-Budde <mkl@pengutronix.de>
      26f6a2ae
    • John Whittington's avatar
      can: gs_usb: add RX and TX hardware timestamp support · 45dfa45f
      John Whittington authored
      Add support for hardware timestamps, if the firmware includes it as a
      feature via the GS_CAN_FEATURE_HW_TIMESTAMP flag. Check for this
      feature during probe, extend the RX expected length if it is and
      enable it during open.
      
      The struct classic_can_ts and struct canfd_ts are extended to include
      the µs timestamp following data as defined in the firmware. The
      timestamp is then captured and set using skb_hwtstamps() on each RX
      and TX.
      
      The frame µs timestamp is provided from a 32 bit 1 MHz timer which
      rolls over every 4294 seconds, so a cyclecounter, timecounter, and
      delayed worker are used to convert the timer into a proper ns
      timestamp - same implementation as commit efd8d98d ("can:
      mcp251xfd: add HW timestamp infrastructure").
      
      Hardware timestamps are added to capabilities as commit
      b1f6b93e ("can: mcp251xfd: advertise timestamping capabilities and
      add ioctl support").
      Signed-off-by: default avatarJohn Whittington <git@jbrengineering.co.uk>
      Link: https://github.com/candle-usb/candleLight_fw/issues/100
      Link: https://lore.kernel.org/all/20220827221548.3291393-3-mkl@pengutronix.deCo-developed-by: default avatarMarc Kleine-Budde <mkl@pengutronix.de>
      Signed-off-by: default avatarMarc Kleine-Budde <mkl@pengutronix.de>
      45dfa45f
    • Marc Kleine-Budde's avatar
      can: gs_usb: use common spelling of GS_USB in macros · 49c007b9
      Marc Kleine-Budde authored
      There are a few macros in the driver which use GSUSB in the name of
      the macro, while the majority uses GS_USB. Convert all macros to
      GS_USB.
      
      Fixes: d08e973a ("can: gs_usb: Added support for the GS_USB CAN devices")
      Fixes: b00ca070 ("can: gs_usb: activate quirks for CANtact Pro unconditionally")
      Link: https://lore.kernel.org/all/20220827221548.3291393-2-mkl@pengutronix.deSigned-off-by: default avatarMarc Kleine-Budde <mkl@pengutronix.de>
      49c007b9
  2. 05 Sep, 2022 37 commits