mbox series

[0/4] Introduce IEP driver and packet timestamping support

Message ID 20230803110153.3309577-1-danishanwar@ti.com
Headers show
Series Introduce IEP driver and packet timestamping support | expand

Message

MD Danish Anwar Aug. 3, 2023, 11:01 a.m. UTC
This series introduces Industrial Ethernet Peripheral (IEP) driver to
support timestamping of ethernet packets and thus support PTP and PPS
for PRU ICSSG ethernet ports.

This series also adds 10M full duplex support for ICSSG ethernet driver.

There are two IEP instances. IEP0 is used for packet timestamping while IEP1
is used for 10M full duplex support.

This series is based on linux-next(#next-20230803).

Thanks and Regards,
Md Danish Anwar

Grygorii Strashko (1):
  net: ti: icssg-prueth: am65x SR2.0 add 10M full duplex support

Md Danish Anwar (1):
  dt-bindings: net: Add ICSS IEP

Roger Quadros (2):
  net: ti: icss-iep: Add IEP driver
  net: ti: icssg-prueth: add packet timestamping and ptp support

 .../devicetree/bindings/net/ti,icss-iep.yaml  |  37 +
 drivers/net/ethernet/ti/Kconfig               |  12 +
 drivers/net/ethernet/ti/Makefile              |   1 +
 drivers/net/ethernet/ti/icssg/icss_iep.c      | 961 ++++++++++++++++++
 drivers/net/ethernet/ti/icssg/icss_iep.h      |  41 +
 drivers/net/ethernet/ti/icssg/icssg_config.c  |   6 +
 drivers/net/ethernet/ti/icssg/icssg_ethtool.c |  21 +
 drivers/net/ethernet/ti/icssg/icssg_prueth.c  | 433 +++++++-
 drivers/net/ethernet/ti/icssg/icssg_prueth.h  |  28 +-
 9 files changed, 1533 insertions(+), 7 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/net/ti,icss-iep.yaml
 create mode 100644 drivers/net/ethernet/ti/icssg/icss_iep.c
 create mode 100644 drivers/net/ethernet/ti/icssg/icss_iep.h

Comments

Simon Horman Aug. 3, 2023, 3:16 p.m. UTC | #1
On Thu, Aug 03, 2023 at 04:31:51PM +0530, MD Danish Anwar wrote:
> From: Roger Quadros <rogerq@ti.com>
> 
> Add a driver for Industrial Ethernet Peripheral (IEP) block of PRUSS to
> support timestamping of ethernet packets and thus support PTP and PPS
> for PRU ethernet ports.
> 
> Signed-off-by: Roger Quadros <rogerq@ti.com>
> Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
> Signed-off-by: Murali Karicheri <m-karicheri2@ti.com>
> Signed-off-by: Vignesh Raghavendra <vigneshr@ti.com>
> Signed-off-by: MD Danish Anwar <danishanwar@ti.com>

...

> +static int icss_iep_pps_enable(struct icss_iep *iep, int on)
> +{
> +	int ret = 0;
> +	struct timespec64 ts;
> +	struct ptp_clock_request rq;
> +	unsigned long flags;
> +	u64 ns;

For networking code, please arrange local variables in reverse xmas tree
order - longest line to shortest.

https://github.com/ecree-solarflare/xmastree is your friend here.

...
Anwar, Md Danish Aug. 4, 2023, 6:26 a.m. UTC | #2
Hi Conor,

On 03/08/23 8:57 pm, Conor Dooley wrote:
> On Thu, Aug 03, 2023 at 04:31:50PM +0530, MD Danish Anwar wrote:
>> From: Md Danish Anwar <danishanwar@ti.com>
>>
>> Add DT binding documentation for ICSS IEP module.
>>
>> Signed-off-by: Md Danish Anwar <danishanwar@ti.com>
>> ---
>>  .../devicetree/bindings/net/ti,icss-iep.yaml  | 37 +++++++++++++++++++
>>  1 file changed, 37 insertions(+)
>>  create mode 100644 Documentation/devicetree/bindings/net/ti,icss-iep.yaml
>>
>> diff --git a/Documentation/devicetree/bindings/net/ti,icss-iep.yaml b/Documentation/devicetree/bindings/net/ti,icss-iep.yaml
>> new file mode 100644
>> index 000000000000..79cd72b330a6
>> --- /dev/null
>> +++ b/Documentation/devicetree/bindings/net/ti,icss-iep.yaml
>> @@ -0,0 +1,37 @@
>> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
>> +%YAML 1.2
>> +---
>> +$id: http://devicetree.org/schemas/net/ti,icss-iep.yaml#
>> +$schema: http://devicetree.org/meta-schemas/core.yaml#
>> +
>> +title: Texas Instruments ICSS Industrial Ethernet Peripheral (IEP) module
>> +
>> +maintainers:
>> +  - Md Danish Anwar <danishanwar@ti.com>
>> +
>> +properties:
>> +  compatible:
>> +    enum:
>> +      - ti,am654-icss-iep   # for K3 AM65x, J721E and AM64x SoCs
> 
> No. ti,am654-icss-iep is for am654. You should really have compatibles
> specific to the SoC - is there a reason why this has not been done?
> 

Yes, ti,am654-icss-iep is for am654. You are right, the compatibles should be
specific to SoC. Currently the upstream support is being added for only AM65x.

I will remove J721E and AM64x SoCs from the comment above and these compatibles
when their support is enabled in future.

Below is the updated compatible property.

properties:
  compatible:
    enum:
      - ti,am654-icss-iep   # for K3 AM65x SoCs

> 
>> +
>> +  reg:
>> +    maxItems: 1
>> +
>> +  clocks:
>> +    maxItems: 1
>> +    description: phandle to the IEP source clock
>> +
>> +required:
>> +  - compatible
>> +  - reg
>> +  - clocks
>> +
>> +additionalProperties: false
>> +
>> +examples:
>> +  - |
>> +    icssg0_iep0: iep@2e000 {
>> +        compatible = "ti,am654-icss-iep";
>> +        reg = <0x2e000 0x1000>;
>> +        clocks = <&icssg0_iepclk_mux>;
>> +    };
>> -- 
>> 2.34.1
>>
Anwar, Md Danish Aug. 4, 2023, 6:27 a.m. UTC | #3
On 03/08/23 8:46 pm, Simon Horman wrote:
> On Thu, Aug 03, 2023 at 04:31:51PM +0530, MD Danish Anwar wrote:
>> From: Roger Quadros <rogerq@ti.com>
>>
>> Add a driver for Industrial Ethernet Peripheral (IEP) block of PRUSS to
>> support timestamping of ethernet packets and thus support PTP and PPS
>> for PRU ethernet ports.
>>
>> Signed-off-by: Roger Quadros <rogerq@ti.com>
>> Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
>> Signed-off-by: Murali Karicheri <m-karicheri2@ti.com>
>> Signed-off-by: Vignesh Raghavendra <vigneshr@ti.com>
>> Signed-off-by: MD Danish Anwar <danishanwar@ti.com>
> 
> ...
> 
>> +static int icss_iep_pps_enable(struct icss_iep *iep, int on)
>> +{
>> +	int ret = 0;
>> +	struct timespec64 ts;
>> +	struct ptp_clock_request rq;
>> +	unsigned long flags;
>> +	u64 ns;
> 
> For networking code, please arrange local variables in reverse xmas tree
> order - longest line to shortest.
> 
> https://github.com/ecree-solarflare/xmastree is your friend here.
> 
> ...

Sure Simon, I will take care of this in next revision.
Conor Dooley Aug. 4, 2023, 3:35 p.m. UTC | #4
On Fri, Aug 04, 2023 at 11:56:19AM +0530, Md Danish Anwar wrote:
> Hi Conor,
> 
> On 03/08/23 8:57 pm, Conor Dooley wrote:
> > On Thu, Aug 03, 2023 at 04:31:50PM +0530, MD Danish Anwar wrote:
> >> From: Md Danish Anwar <danishanwar@ti.com>
> >>
> >> Add DT binding documentation for ICSS IEP module.
> >>
> >> Signed-off-by: Md Danish Anwar <danishanwar@ti.com>
> >> ---
> >>  .../devicetree/bindings/net/ti,icss-iep.yaml  | 37 +++++++++++++++++++
> >>  1 file changed, 37 insertions(+)
> >>  create mode 100644 Documentation/devicetree/bindings/net/ti,icss-iep.yaml
> >>
> >> diff --git a/Documentation/devicetree/bindings/net/ti,icss-iep.yaml b/Documentation/devicetree/bindings/net/ti,icss-iep.yaml
> >> new file mode 100644
> >> index 000000000000..79cd72b330a6
> >> --- /dev/null
> >> +++ b/Documentation/devicetree/bindings/net/ti,icss-iep.yaml
> >> @@ -0,0 +1,37 @@
> >> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> >> +%YAML 1.2
> >> +---
> >> +$id: http://devicetree.org/schemas/net/ti,icss-iep.yaml#
> >> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> >> +
> >> +title: Texas Instruments ICSS Industrial Ethernet Peripheral (IEP) module
> >> +
> >> +maintainers:
> >> +  - Md Danish Anwar <danishanwar@ti.com>
> >> +
> >> +properties:
> >> +  compatible:
> >> +    enum:
> >> +      - ti,am654-icss-iep   # for K3 AM65x, J721E and AM64x SoCs
> > 
> > No. ti,am654-icss-iep is for am654. You should really have compatibles
> > specific to the SoC - is there a reason why this has not been done?
> > 
> 
> Yes, ti,am654-icss-iep is for am654. You are right, the compatibles should be
> specific to SoC. Currently the upstream support is being added for only AM65x.
> 
> I will remove J721E and AM64x SoCs from the comment above and these compatibles
> when their support is enabled in future.

So the comment was totally wrong? Or does the same code work for all 3
of these SoC types & you used the same compatible on each of the 3?

Thanks,
Conor.


> Below is the updated compatible property.
> 
> properties:
>   compatible:
>     enum:
>       - ti,am654-icss-iep   # for K3 AM65x SoCs
Anwar, Md Danish Aug. 7, 2023, 4:38 a.m. UTC | #5
On 04/08/23 9:05 pm, Conor Dooley wrote:
> On Fri, Aug 04, 2023 at 11:56:19AM +0530, Md Danish Anwar wrote:
>> Hi Conor,
>>
>> On 03/08/23 8:57 pm, Conor Dooley wrote:
>>> On Thu, Aug 03, 2023 at 04:31:50PM +0530, MD Danish Anwar wrote:
>>>> From: Md Danish Anwar <danishanwar@ti.com>
>>>>
>>>> Add DT binding documentation for ICSS IEP module.
>>>>
>>>> Signed-off-by: Md Danish Anwar <danishanwar@ti.com>
>>>> ---
>>>>  .../devicetree/bindings/net/ti,icss-iep.yaml  | 37 +++++++++++++++++++
>>>>  1 file changed, 37 insertions(+)
>>>>  create mode 100644 Documentation/devicetree/bindings/net/ti,icss-iep.yaml
>>>>
>>>> diff --git a/Documentation/devicetree/bindings/net/ti,icss-iep.yaml b/Documentation/devicetree/bindings/net/ti,icss-iep.yaml
>>>> new file mode 100644
>>>> index 000000000000..79cd72b330a6
>>>> --- /dev/null
>>>> +++ b/Documentation/devicetree/bindings/net/ti,icss-iep.yaml
>>>> @@ -0,0 +1,37 @@
>>>> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
>>>> +%YAML 1.2
>>>> +---
>>>> +$id: http://devicetree.org/schemas/net/ti,icss-iep.yaml#
>>>> +$schema: http://devicetree.org/meta-schemas/core.yaml#
>>>> +
>>>> +title: Texas Instruments ICSS Industrial Ethernet Peripheral (IEP) module
>>>> +
>>>> +maintainers:
>>>> +  - Md Danish Anwar <danishanwar@ti.com>
>>>> +
>>>> +properties:
>>>> +  compatible:
>>>> +    enum:
>>>> +      - ti,am654-icss-iep   # for K3 AM65x, J721E and AM64x SoCs
>>>
>>> No. ti,am654-icss-iep is for am654. You should really have compatibles
>>> specific to the SoC - is there a reason why this has not been done?
>>>
>>
>> Yes, ti,am654-icss-iep is for am654. You are right, the compatibles should be
>> specific to SoC. Currently the upstream support is being added for only AM65x.
>>
>> I will remove J721E and AM64x SoCs from the comment above and these compatibles
>> when their support is enabled in future.
> 
> So the comment was totally wrong? Or does the same code work for all 3
> of these SoC types & you used the same compatible on each of the 3?

Comment was not totally wrong, the same compatible currently works for all
these 3 SoCs as the same code works for them.

But for now as we are upstreaming only for AM65x, I will only keep am65x in the
comment.

> 
> Thanks,
> Conor.
> 
> 
>> Below is the updated compatible property.
>>
>> properties:
>>   compatible:
>>     enum:
>>       - ti,am654-icss-iep   # for K3 AM65x SoCs