public inbox for linux-omap@vger.kernel.org
 help / color / mirror / Atom feed
From: Basharath Hussain Khaja <basharath@couthit.com>
To: Jason Xing <kerneljasonxing@gmail.com>
Cc: basharath <basharath@couthit.com>,
	danishanwar <danishanwar@ti.com>,  rogerq <rogerq@kernel.org>,
	andrew+netdev <andrew+netdev@lunn.ch>,
	 davem <davem@davemloft.net>, edumazet <edumazet@google.com>,
	 kuba <kuba@kernel.org>, pabeni <pabeni@redhat.com>,
	 Rob Herring <robh@kernel.org>, krzk+dt <krzk+dt@kernel.org>,
	 conor+dt <conor+dt@kernel.org>, nm <nm@ti.com>,
	 ssantosh <ssantosh@kernel.org>, tony <tony@atomide.com>,
	 richardcochran <richardcochran@gmail.com>,
	 parvathi <parvathi@couthit.com>,
	schnelle <schnelle@linux.ibm.com>,
	 rdunlap <rdunlap@infradead.org>,
	diogo ivo <diogo.ivo@siemens.com>,
	 m-karicheri2 <m-karicheri2@ti.com>, horms <horms@kernel.org>,
	 jacob e keller <jacob.e.keller@intel.com>,
	 m-malladi <m-malladi@ti.com>,
	 javier carrasco cruz <javier.carrasco.cruz@gmail.com>,
	 afd <afd@ti.com>, s-anna <s-anna@ti.com>,
	 linux-arm-kernel <linux-arm-kernel@lists.infradead.org>,
	 netdev <netdev@vger.kernel.org>,
	 devicetree <devicetree@vger.kernel.org>,
	 linux-kernel <linux-kernel@vger.kernel.org>,
	 linux-omap <linux-omap@vger.kernel.org>,
	 pratheesh <pratheesh@ti.com>, prajith <prajith@ti.com>,
	 vigneshr <vigneshr@ti.com>, praneeth <praneeth@ti.com>,
	 srk <srk@ti.com>, rogerq <rogerq@ti.com>,
	 krishna <krishna@couthit.com>, pmohan <pmohan@couthit.com>,
	 mohan <mohan@couthit.com>
Subject: Re: [RFC PATCH 06/10] net: ti: prueth: Adds HW timestamping support for PTP using PRU-ICSS IEP module
Date: Thu, 23 Jan 2025 12:55:48 +0530 (IST)	[thread overview]
Message-ID: <507763040.391350.1737617148913.JavaMail.zimbra@couthit.local> (raw)
In-Reply-To: <CAL+tcoD6WuJH6yXaEGvuz_s3sROPXtEMeZw1hBNQvb6wnKKr-w@mail.gmail.com>

> On Fri, Jan 10, 2025 at 2:01 PM Basharath Hussain Khaja
> <basharath@couthit.com> wrote:
>>
>> From: Roger Quadros <rogerq@ti.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@ti.com>
>> Signed-off-by: Andrew F. Davis <afd@ti.com>
>> Signed-off-by: Parvathi Pudi <parvathi@couthit.com>
>> Signed-off-by: Basharath Hussain Khaja <basharath@couthit.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().
> 

Yes. This module always uses IEP HW timestamping both on RX side and TX side 
for better precision. We will clean this in the next version.

Thanks & Best Regards,
Basharath

  reply	other threads:[~2025-01-23  7:26 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-09 10:55 [RFC PATCH 00/10] PRU-ICSSM Ethernet Driver Basharath Hussain Khaja
2025-01-09 10:55 ` [RFC PATCH 01/10] dt-bindings: net: ti: Adds device tree binding for DUAL-EMAC mode support on PRU-ICSS2 for AM57xx SOCs Basharath Hussain Khaja
2025-01-09 14:16   ` Andrew Lunn
2025-01-22 13:21     ` Basharath Hussain Khaja
2025-01-09 16:02   ` Andrew Lunn
2025-01-22 13:26     ` Basharath Hussain Khaja
2025-01-22 13:43       ` Andrew Lunn
2025-01-22 15:03         ` Basharath Hussain Khaja
2025-01-10 16:15   ` Rob Herring
2025-01-22 13:43     ` Basharath Hussain Khaja
2025-01-10 16:16   ` Rob Herring
2025-01-22 13:46     ` Basharath Hussain Khaja
2025-01-22 15:28     ` Basharath Hussain Khaja
2025-01-09 10:55 ` [RFC PATCH 02/10] net: ti: prueth: Adds ICSSM Ethernet driver Basharath Hussain Khaja
2025-01-09 15:59   ` Andrew Lunn
2025-01-22 15:33     ` Basharath Hussain Khaja
2025-01-09 10:55 ` [RFC PATCH 03/10] net: ti: prueth: Adds PRUETH HW and SW configuration Basharath Hussain Khaja
2025-01-09 16:10   ` Andrew Lunn
2025-01-22 15:57     ` Basharath Hussain Khaja
2025-01-09 10:55 ` [RFC PATCH 04/10] net: ti: prueth: Adds link detection, RX and TX support Basharath Hussain Khaja
2025-01-09 16:24   ` Andrew Lunn
2025-01-23  7:02     ` Basharath Hussain Khaja
2025-01-23  7:16   ` Christophe JAILLET
2025-01-23 12:30     ` Basharath Hussain Khaja
2025-01-09 14:11 ` [RFC PATCH 00/10] PRU-ICSSM Ethernet Driver Andrew Lunn
2025-01-22 13:17   ` Basharath Hussain Khaja
2025-01-10  5:59 ` [RFC PATCH 05/10] net: ti: prueth: Adds ethtool support for ICSSM PRUETH Driver Basharath Hussain Khaja
2025-01-10  5:59 ` [RFC PATCH 06/10] net: ti: prueth: Adds HW timestamping support for PTP using PRU-ICSS IEP module Basharath Hussain Khaja
2025-01-11 16:35   ` Richard Cochran
2025-01-23  7:23     ` Basharath Hussain Khaja
2025-01-11 23:38   ` Jason Xing
2025-01-23  7:25     ` Basharath Hussain Khaja [this message]
2025-01-10  5:59 ` [RFC PATCH 07/10] net: ti: prueth: Adds support for network filters for traffic control supported by PRU-ICSS Basharath Hussain Khaja
2025-01-10  7:13 ` [RFC PATCH 08/10] net: ti: prueth: Adds support for RX interrupt coalescing/pacing Basharath Hussain Khaja
2025-01-10  7:13 ` [RFC PATCH 09/10] net: ti: prueth: Adds power management support for PRU-ICSS Basharath Hussain Khaja
2025-01-10  7:13 ` [RFC PATCH 10/10] arm: dts: ti: Adds device tree nodes for PRU Cores, IEP and eCAP modules of PRU-ICSS2 Instance Basharath Hussain Khaja

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=507763040.391350.1737617148913.JavaMail.zimbra@couthit.local \
    --to=basharath@couthit.com \
    --cc=afd@ti.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=conor+dt@kernel.org \
    --cc=danishanwar@ti.com \
    --cc=davem@davemloft.net \
    --cc=devicetree@vger.kernel.org \
    --cc=diogo.ivo@siemens.com \
    --cc=edumazet@google.com \
    --cc=horms@kernel.org \
    --cc=jacob.e.keller@intel.com \
    --cc=javier.carrasco.cruz@gmail.com \
    --cc=kerneljasonxing@gmail.com \
    --cc=krishna@couthit.com \
    --cc=krzk+dt@kernel.org \
    --cc=kuba@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=m-karicheri2@ti.com \
    --cc=m-malladi@ti.com \
    --cc=mohan@couthit.com \
    --cc=netdev@vger.kernel.org \
    --cc=nm@ti.com \
    --cc=pabeni@redhat.com \
    --cc=parvathi@couthit.com \
    --cc=pmohan@couthit.com \
    --cc=prajith@ti.com \
    --cc=praneeth@ti.com \
    --cc=pratheesh@ti.com \
    --cc=rdunlap@infradead.org \
    --cc=richardcochran@gmail.com \
    --cc=robh@kernel.org \
    --cc=rogerq@kernel.org \
    --cc=rogerq@ti.com \
    --cc=s-anna@ti.com \
    --cc=schnelle@linux.ibm.com \
    --cc=srk@ti.com \
    --cc=ssantosh@kernel.org \
    --cc=tony@atomide.com \
    --cc=vigneshr@ti.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox