lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAL+tcoD6WuJH6yXaEGvuz_s3sROPXtEMeZw1hBNQvb6wnKKr-w@mail.gmail.com>
Date: Sun, 12 Jan 2025 07:38:04 +0800
From: Jason Xing <kerneljasonxing@...il.com>
To: Basharath Hussain Khaja <basharath@...thit.com>
Cc: danishanwar@...com, rogerq@...nel.org, andrew+netdev@...n.ch, 
	davem@...emloft.net, edumazet@...gle.com, kuba@...nel.org, pabeni@...hat.com, 
	robh@...nel.org, krzk+dt@...nel.org, conor+dt@...nel.org, nm@...com, 
	ssantosh@...nel.org, tony@...mide.com, richardcochran@...il.com, 
	parvathi@...thit.com, schnelle@...ux.ibm.com, rdunlap@...radead.org, 
	diogo.ivo@...mens.com, m-karicheri2@...com, horms@...nel.org, 
	jacob.e.keller@...el.com, m-malladi@...com, javier.carrasco.cruz@...il.com, 
	afd@...com, s-anna@...com, linux-arm-kernel@...ts.infradead.org, 
	netdev@...r.kernel.org, devicetree@...r.kernel.org, 
	linux-kernel@...r.kernel.org, linux-omap@...r.kernel.org, pratheesh@...com, 
	prajith@...com, vigneshr@...com, praneeth@...com, srk@...com, rogerq@...com, 
	krishna@...thit.com, pmohan@...thit.com, mohan@...thit.com
Subject: Re: [RFC PATCH 06/10] net: ti: prueth: Adds HW timestamping support
 for PTP using PRU-ICSS IEP module

On Fri, Jan 10, 2025 at 2:01 PM Basharath Hussain Khaja
<basharath@...thit.com> wrote:
>
> From: Roger Quadros <rogerq@...com>
>
> PRU-ICSS IEP module, which is capable of timestamping RX and
> TX packets at HW level, is used for time synchronization by PTP4L.
>
> This change includes interaction between firmware and user space
> application (ptp4l) with required packet timestamps. The driver
> initializes the PRU firmware with appropriate mode and configuration
> flags. Firmware updates local registers with the flags set by driver
> and uses for further operation. RX SOF timestamp comes along with
> packet and firmware will rise interrupt with TX SOF timestamp after
> pushing the packet on to the wire.
>
> IEP driver is available in upstream and we are reusing for hardware
> configuration for ICSSM as well. On top of that we have extended it
> with the changes for AM57xx SoC.
>
> Extended ethtool for reading HW timestamping capability of the PRU
> interfaces.
>
> Currently ordinary clock (OC) configuration has been validated with
> Linux ptp4l.
>
> Signed-off-by: Roger Quadros <rogerq@...com>
> Signed-off-by: Andrew F. Davis <afd@...com>
> Signed-off-by: Parvathi Pudi <parvathi@...thit.com>
> Signed-off-by: Basharath Hussain Khaja <basharath@...thit.com>
> ---
>  drivers/net/ethernet/ti/icssg/icss_iep.c      |  42 ++
>  drivers/net/ethernet/ti/icssm/icssm_ethtool.c |  26 +
>  drivers/net/ethernet/ti/icssm/icssm_prueth.c  | 443 +++++++++++++++++-
>  drivers/net/ethernet/ti/icssm/icssm_prueth.h  |  11 +
>  .../net/ethernet/ti/icssm/icssm_prueth_ptp.h  |  85 ++++
>  5 files changed, 605 insertions(+), 2 deletions(-)
>  create mode 100644 drivers/net/ethernet/ti/icssm/icssm_prueth_ptp.h
>
> diff --git a/drivers/net/ethernet/ti/icssg/icss_iep.c b/drivers/net/ethernet/ti/icssg/icss_iep.c
> index 768578c0d958..9a2ea13703d8 100644
> --- a/drivers/net/ethernet/ti/icssg/icss_iep.c
> +++ b/drivers/net/ethernet/ti/icssg/icss_iep.c
> @@ -937,11 +937,53 @@ static const struct icss_iep_plat_data am654_icss_iep_plat_data = {
>         .config = &am654_icss_iep_regmap_config,
>  };
>
> +static const struct icss_iep_plat_data am57xx_icss_iep_plat_data = {
> +       .flags = ICSS_IEP_64BIT_COUNTER_SUPPORT |
> +                ICSS_IEP_SLOW_COMPEN_REG_SUPPORT,
> +       .reg_offs = {
> +               [ICSS_IEP_GLOBAL_CFG_REG] = 0x00,
> +               [ICSS_IEP_COMPEN_REG] = 0x08,
> +               [ICSS_IEP_SLOW_COMPEN_REG] = 0x0C,
> +               [ICSS_IEP_COUNT_REG0] = 0x10,
> +               [ICSS_IEP_COUNT_REG1] = 0x14,
> +               [ICSS_IEP_CAPTURE_CFG_REG] = 0x18,
> +               [ICSS_IEP_CAPTURE_STAT_REG] = 0x1c,
> +
> +               [ICSS_IEP_CAP6_RISE_REG0] = 0x50,
> +               [ICSS_IEP_CAP6_RISE_REG1] = 0x54,
> +
> +               [ICSS_IEP_CAP7_RISE_REG0] = 0x60,
> +               [ICSS_IEP_CAP7_RISE_REG1] = 0x64,
> +
> +               [ICSS_IEP_CMP_CFG_REG] = 0x70,
> +               [ICSS_IEP_CMP_STAT_REG] = 0x74,
> +               [ICSS_IEP_CMP0_REG0] = 0x78,
> +               [ICSS_IEP_CMP0_REG1] = 0x7c,
> +               [ICSS_IEP_CMP1_REG0] = 0x80,
> +               [ICSS_IEP_CMP1_REG1] = 0x84,
> +
> +               [ICSS_IEP_CMP8_REG0] = 0xc0,
> +               [ICSS_IEP_CMP8_REG1] = 0xc4,
> +               [ICSS_IEP_SYNC_CTRL_REG] = 0x180,
> +               [ICSS_IEP_SYNC0_STAT_REG] = 0x188,
> +               [ICSS_IEP_SYNC1_STAT_REG] = 0x18c,
> +               [ICSS_IEP_SYNC_PWIDTH_REG] = 0x190,
> +               [ICSS_IEP_SYNC0_PERIOD_REG] = 0x194,
> +               [ICSS_IEP_SYNC1_DELAY_REG] = 0x198,
> +               [ICSS_IEP_SYNC_START_REG] = 0x19c,
> +       },
> +       .config = &am654_icss_iep_regmap_config,
> +};
> +
>  static const struct of_device_id icss_iep_of_match[] = {
>         {
>                 .compatible = "ti,am654-icss-iep",
>                 .data = &am654_icss_iep_plat_data,
>         },
> +       {
> +               .compatible = "ti,am5728-icss-iep",
> +               .data = &am57xx_icss_iep_plat_data,
> +       },
>         {},
>  };
>  MODULE_DEVICE_TABLE(of, icss_iep_of_match);
> diff --git a/drivers/net/ethernet/ti/icssm/icssm_ethtool.c b/drivers/net/ethernet/ti/icssm/icssm_ethtool.c
> index cce3276d5565..86d62d64dc4d 100644
> --- a/drivers/net/ethernet/ti/icssm/icssm_ethtool.c
> +++ b/drivers/net/ethernet/ti/icssm/icssm_ethtool.c
> @@ -7,6 +7,7 @@
>
>  #include <linux/if_bridge.h>
>  #include "icssm_prueth.h"
> +#include "../icssg/icss_iep.h"
>
>  #define PRUETH_MODULE_VERSION "0.2"
>  #define PRUETH_MODULE_DESCRIPTION "PRUSS Ethernet driver"
> @@ -189,12 +190,37 @@ static void icssm_emac_get_regs(struct net_device *ndev,
>         regs->version = PRUETH_REG_DUMP_GET_VER(prueth);
>  }
>
> +static int icssm_emac_get_ts_info(struct net_device *ndev,
> +                                 struct kernel_ethtool_ts_info *info)
> +{
> +       struct prueth_emac *emac = netdev_priv(ndev);
> +
> +       if ((PRUETH_IS_EMAC(emac->prueth) && !emac->emac_ptp_tx_irq))
> +               return ethtool_op_get_ts_info(ndev, info);
> +
> +       info->so_timestamping =
> +               SOF_TIMESTAMPING_TX_HARDWARE |
> +               SOF_TIMESTAMPING_TX_SOFTWARE |
> +               SOF_TIMESTAMPING_RX_HARDWARE |
> +               SOF_TIMESTAMPING_RX_SOFTWARE |
> +               SOF_TIMESTAMPING_SOFTWARE |
> +               SOF_TIMESTAMPING_RAW_HARDWARE;

In addtion to what Richard suggested, there is no need to re-mark the
following flags "SOF_TIMESTAMPING_RX_SOFTWARE" and
"SOF_TIMESTAMPING_SOFTWARE", please see __ethtool_get_ts_info().

Thanks,
Jason

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ