Re: [PATCH 0/3] nvmem: eeprom: add support for FRAM

2021-04-09 Thread Christian Eggers
Hi Jiri, I have two Fujitsu different FRAMs running with the stock at25 driver. I set the page size equal to the device size (as FRAMs have no pages). Are you able to run your FRAM with the unmodified driver? I assume that getting the device geometry from the chip is vendor specific (in

Re: [PATCH 2/2] units: Use the HZ_PER_KHZ macro

2021-02-23 Thread Christian Eggers
> +++ b/drivers/thermal/devfreq_cooling.c > @@ -19,10 +19,10 @@ > #include > #include > #include > +#include > > #include > > -#define HZ_PER_KHZ 1000 > #define SCALE_ERROR_MITIGATION 100 > > static DEFINE_IDA(devfreq_ida); > Reviewed-by: Christian Eggers

Re: [PATCH net-next v5 9/9] net: dsa: microchip: ksz9477: add periodic output support

2020-12-03 Thread Christian Eggers
On Thursday, 3 December 2020, 16:52:46 CET, Vladimir Oltean wrote: > On Thu, 3 Dec 2020 at 17:36, Christian Eggers wrote: > > Should ptp_sysfs be extended with a "pulse" attribute with calls > > enable() with only PTP_PEROUT_DUTY_CYCLE set? > > Use tools/testing

Re: [PATCH net-next v5 9/9] net: dsa: microchip: ksz9477: add periodic output support

2020-12-03 Thread Christian Eggers
On Thursday, 3 December 2020, 15:12:55 CET, Richard Cochran wrote: > On Thu, Dec 03, 2020 at 11:21:17AM +0100, Christian Eggers wrote: > > The KSZ9563 has a Trigger Output Unit (TOU) which can be used to > > generate periodic signals. > > > > The pulse length can be alt

[PATCH net-next v5 9/9] net: dsa: microchip: ksz9477: add periodic output support

2020-12-03 Thread Christian Eggers
The KSZ9563 has a Trigger Output Unit (TOU) which can be used to generate periodic signals. The pulse length can be altered via a device attribute. Tested on a Microchip KSZ9563 switch. Signed-off-by: Christian Eggers --- Changes in v4: -- - 80 chars per line - reverse christmas

[PATCH net-next v5 8/9] net: dsa: microchip: ksz9477: remaining hardware time stamping support

2020-12-03 Thread Christian Eggers
if this field is negative. Of course, the UDP checksums (if any) have to be corrected after this (for both directions). Everything has been tested on a Microchip KSZ9563 switch. Signed-off-by: Christian Eggers --- Changes in v5: -- - Fix compile error reported by kernel test robot

[PATCH net-next v5 7/9] net: dsa: microchip: ksz9477: initial hardware time stamping support

2020-12-03 Thread Christian Eggers
() for details: https://patchwork.ozlabs.org/project/netdev/patch/20201019172435.4416-8-cegg...@arri.de/ Signed-off-by: Christian Eggers Reviewed-by: Vladimir Oltean --- Changes in v4: -- - Remove useless case statement - Reviewed-by: Vladimir Oltean drivers/net/dsa/microchip/ksz9477_main.c

[PATCH net-next v5 6/9] net: ptp: add helper for one-step P2P clocks

2020-12-03 Thread Christian Eggers
in the tail-tag is set to zero) or move the value from the correction field back to the tail-tag. Changing the correction field requires updating the UDP checksum (if UDP is used as transport). Signed-off-by: Christian Eggers --- include/linux/ptp_classify.h | 73 1

[PATCH net-next v5 5/9] net: dsa: microchip: ksz9477: add Posix clock support for chip PTP clock

2020-12-03 Thread Christian Eggers
Implement routines (adjfine, adjtime, gettime and settime) for manipulating the chip's PTP clock. Signed-off-by: Christian Eggers Reviewed-by: Vladimir Oltean --- drivers/net/dsa/microchip/Kconfig| 8 + drivers/net/dsa/microchip/Makefile | 1 + drivers/net/dsa/microchip

[PATCH net-next v5 4/9] net: dsa: microchip: ksz9477: basic interrupt support

2020-12-03 Thread Christian Eggers
Interrupts are required for TX time stamping. Probably they could also be used for PHY connection status. This patch only adds the basic infrastructure for interrupts, no interrupts are finally enabled nor handled. Signed-off-by: Christian Eggers Reviewed-by: Vladimir Oltean --- Changes in v4

[PATCH net-next v5 3/9] net: dsa: microchip: ksz9477: move chip reset to ksz9477_switch_init()

2020-12-03 Thread Christian Eggers
The next patch will add basic interrupt support. Chip reset must be performed before requesting the IRQ, so move this from ksz9477_setup() to ksz9477_init(). Signed-off-by: Christian Eggers Reviewed-by: Vladimir Oltean --- drivers/net/dsa/microchip/ksz9477_main.c | 15 +++ 1 file

[PATCH net-next v5 1/9] net: dsa: microchip: rename ksz9477.c to ksz9477_main.c

2020-12-03 Thread Christian Eggers
PTP functionality will be built into a separate source file (ksz9477_ptp.c). Signed-off-by: Christian Eggers Reviewed-by: Vladimir Oltean --- drivers/net/dsa/microchip/Makefile | 1 + drivers/net/dsa/microchip/{ksz9477.c => ksz9477_main.c} | 0 2 files changed, 1 insert

[PATCH net-next v5 2/9] dt-bindings: net: dsa: microchip,ksz: add interrupt property

2020-12-03 Thread Christian Eggers
The devices have an optional interrupt line. Signed-off-by: Christian Eggers --- .../devicetree/bindings/net/dsa/microchip,ksz.yaml | 7 +++ 1 file changed, 7 insertions(+) diff --git a/Documentation/devicetree/bindings/net/dsa/microchip,ksz.yaml b/Documentation/devicetree

[PATCH net-next v5 0/9] net: dsa: microchip: PTP support for KSZ956x

2020-12-03 Thread Christian Eggers
[1] http://ww1.microchip.com/downloads/en/DeviceDoc/KSZ9563R-Data-Sheet-DS2419D.pdf Changes from v4 --> v5 [8/9]- Fix compile error reported by kernel test robot (NET_DSA_TAG_KSZ must select NET_PTP_CLASSIFY) Changes from v3 --> v4

[PATCH net-next v4 9/9] net: dsa: microchip: ksz9477: add periodic output support

2020-12-01 Thread Christian Eggers
The KSZ9563 has a Trigger Output Unit (TOU) which can be used to generate periodic signals. The pulse length can be altered via a device attribute. Tested on a Microchip KSZ9563 switch. Signed-off-by: Christian Eggers --- Changes in v4: -- - 80 chars per line - reverse christmas

[PATCH net-next v4 8/9] net: dsa: microchip: ksz9477: remaining hardware time stamping support

2020-12-01 Thread Christian Eggers
if this field is negative. Of course, the UDP checksums (if any) have to be corrected after this (for both directions). Everything has been tested on a Microchip KSZ9563 switch. Signed-off-by: Christian Eggers --- Changes in v4: -- - s/low active/active low/ - 80 chars per line - Use IEEE

[PATCH net-next v4 7/9] net: dsa: microchip: ksz9477: initial hardware time stamping support

2020-12-01 Thread Christian Eggers
() for details: https://patchwork.ozlabs.org/project/netdev/patch/20201019172435.4416-8-cegg...@arri.de/ Signed-off-by: Christian Eggers Reviewed-by: Vladimir Oltean --- Changes in v4: -- - Remove useless case statement - Reviewed-by: Vladimir Oltean drivers/net/dsa/microchip/ksz9477_main.c

[PATCH net-next v4 6/9] net: ptp: add helper for one-step P2P clocks

2020-12-01 Thread Christian Eggers
in the tail-tag is set to zero) or move the value from the correction field back to the tail-tag. Changing the correction field requires updating the UDP checksum (if UDP is used as transport). Signed-off-by: Christian Eggers --- include/linux/ptp_classify.h | 73 1

[PATCH net-next v4 5/9] net: dsa: microchip: ksz9477: add Posix clock support for chip PTP clock

2020-12-01 Thread Christian Eggers
Implement routines (adjfine, adjtime, gettime and settime) for manipulating the chip's PTP clock. Signed-off-by: Christian Eggers Reviewed-by: Vladimir Oltean --- drivers/net/dsa/microchip/Kconfig| 8 + drivers/net/dsa/microchip/Makefile | 1 + drivers/net/dsa/microchip

[PATCH net-next v4 4/9] net: dsa: microchip: ksz9477: basic interrupt support

2020-12-01 Thread Christian Eggers
Interrupts are required for TX time stamping. Probably they could also be used for PHY connection status. This patch only adds the basic infrastructure for interrupts, no interrupts are finally enabled nor handled. Signed-off-by: Christian Eggers Reviewed-by: Vladimir Oltean --- Changes in v4

[PATCH net-next v4 3/9] net: dsa: microchip: ksz9477: move chip reset to ksz9477_switch_init()

2020-12-01 Thread Christian Eggers
The next patch will add basic interrupt support. Chip reset must be performed before requesting the IRQ, so move this from ksz9477_setup() to ksz9477_init(). Signed-off-by: Christian Eggers Reviewed-by: Vladimir Oltean --- drivers/net/dsa/microchip/ksz9477_main.c | 15 +++ 1 file

[PATCH net-next v4 1/9] net: dsa: microchip: rename ksz9477.c to ksz9477_main.c

2020-12-01 Thread Christian Eggers
PTP functionality will be built into a separate source file (ksz9477_ptp.c). Signed-off-by: Christian Eggers Reviewed-by: Vladimir Oltean --- drivers/net/dsa/microchip/Makefile | 1 + drivers/net/dsa/microchip/{ksz9477.c => ksz9477_main.c} | 0 2 files changed, 1 insert

[PATCH net-next v4 2/9] dt-bindings: net: dsa: microchip,ksz: add interrupt property

2020-12-01 Thread Christian Eggers
The devices have an optional interrupt line. Signed-off-by: Christian Eggers --- .../devicetree/bindings/net/dsa/microchip,ksz.yaml | 7 +++ 1 file changed, 7 insertions(+) diff --git a/Documentation/devicetree/bindings/net/dsa/microchip,ksz.yaml b/Documentation/devicetree

[PATCH net-next v4 0/9] net: dsa: microchip: PTP support for KSZ956x

2020-12-01 Thread Christian Eggers
There is only little documentation for PTP available on the data sheet [1] (more or less only the register reference). Questions to the Microchip support were seldom answered comprehensively or in reasonable time. So this is more or less the result of reverse engineering. [1]

Re: [PATCH v6 1/3] i2c: imx: Fix reset of I2SR_IAL flag

2020-11-30 Thread Christian Eggers
On Saturday, 10 October 2020, 13:09:20 CET, Wolfram Sang wrote: > On Fri, Oct 09, 2020 at 01:03:18PM +0200, Christian Eggers wrote: > > According to the "VFxxx Controller Reference Manual" (and the comment > > block starting at line 97), Vybrid requires writing a one for

Re: [PATCH net-next v3 00/12] net: dsa: microchip: PTP support for KSZ956x

2020-11-26 Thread Christian Eggers
ALU_VAL_C0100 FID 0 MAC_0_1 01:00 ALU_VAL_D5E000181 MAC_2_55E:00:01:81 On Wednesday, 25 November 2020, 22:08:39 CET, Christian Eggers wrote: > I need some help from Microchip, please read below. > > On Thursday, 19 November

Re: [PATCH net-next v3 00/12] net: dsa: microchip: PTP support for KSZ956x

2020-11-25 Thread Christian Eggers
I need some help from Microchip, please read below. On Thursday, 19 November 2020, 19:51:15 CET, tristram...@microchip.com wrote: > There is one more requirement that is a little difficult to do. The > calculated peer delay > needs to be programmed in hardware register, but the regular PTP

[PATCH net-next v2 3/3] net: phy: mscc: use new PTP_MSGTYPE_* defines

2020-11-23 Thread Christian Eggers
Use recently introduced PTP_MSGTYPE_SYNC and PTP_MSGTYPE_DELAY_REQ defines instead of a driver internal enumeration. Signed-off-by: Christian Eggers Reviewed-by: Antoine Tenart Cc: Antoine Tenart --- drivers/net/phy/mscc/mscc_ptp.c | 14 +++--- drivers/net/phy/mscc/mscc_ptp.h | 5

[PATCH net-next v2 2/3] mlxsw: spectrum_ptp: use PTP wide message type definitions

2020-11-23 Thread Christian Eggers
Use recently introduced PTP wide defines instead of a driver internal enumeration. Signed-off-by: Christian Eggers Reviewed-by: Ido Schimmel Cc: Petr Machata Cc: Jiri Pirko Cc: Ido Schimmel --- drivers/net/ethernet/mellanox/mlxsw/spectrum_ptp.c | 8 drivers/net/ethernet/mellanox

[PATCH net-next v2 1/3] net: phy: dp83640: use new PTP_MSGTYPE_SYNC define

2020-11-23 Thread Christian Eggers
Replace use of magic number with recently introduced define. Signed-off-by: Christian Eggers Cc: Kurt Kanzenbach --- drivers/net/phy/dp83640.c | 5 + 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/drivers/net/phy/dp83640.c b/drivers/net/phy/dp83640.c index f2caccaf4408

[PATCH net-next v2 0/3] net: ptp: use common defines for PTP message types in further drivers

2020-11-23 Thread Christian Eggers
driver internal enumeration / uses of magic numbers with the newly introduced PTP_MSGTYPE_* defines. On Friday, 20 November 2020, 23:39:10 CET, Vladimir Oltean wrote: > On Fri, Nov 20, 2020 at 09:41:03AM +0100, Christian Eggers wrote: > > This series introduces commen defines for PTP event

Re: [PATCH net-next 2/3] mlxsw: spectrum_ptp: use PTP wide message type definitions

2020-11-22 Thread Christian Eggers
On Sunday, 22 November 2020, 15:35:55 CET, Ido Schimmel wrote: > On Sun, Nov 22, 2020 at 09:26:35AM +0100, Christian Eggers wrote: > > Use recently introduced PTP wide defines instead of a driver internal > > enumeration. > > > > Signed-off-by: Christian Eggers > &g

[PATCH net-next 3/3] net: phy: mscc: use new PTP_MSGTYPE_* defines

2020-11-22 Thread Christian Eggers
Use recently introduced PTP_MSGTYPE_SYNC and PTP_MSGTYPE_DELAY_REQ defines instead of a driver internal enumeration. Signed-off-by: Christian Eggers Cc: Quentin Schulz Cc: Antoine Tenart Cc: Antoine Tenart --- drivers/net/phy/mscc/mscc_ptp.c | 14 +++--- drivers/net/phy/mscc

[PATCH net-next 2/3] mlxsw: spectrum_ptp: use PTP wide message type definitions

2020-11-22 Thread Christian Eggers
Use recently introduced PTP wide defines instead of a driver internal enumeration. Signed-off-by: Christian Eggers Cc: Petr Machata Cc: Jiri Pirko Cc: Ido Schimmel --- drivers/net/ethernet/mellanox/mlxsw/spectrum_ptp.c | 8 drivers/net/ethernet/mellanox/mlxsw/spectrum_ptp.h | 7

[PATCH net-next 1/3] net: phy: dp83640: use new PTP_MSGTYPE_SYNC define

2020-11-22 Thread Christian Eggers
Replace use of magic number with recently introduced define. Signed-off-by: Christian Eggers Cc: Kurt Kanzenbach --- drivers/net/phy/dp83640.c | 5 + 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/drivers/net/phy/dp83640.c b/drivers/net/phy/dp83640.c index f2caccaf4408

[PATCH net-next 0/3] net: ptp: use common defines for PTP message types in further drivers

2020-11-22 Thread Christian Eggers
This series replaces further driver internal enumeration / uses of magic numbers with the newly introduced PTP_MSGTYPE_* defines. On Friday, 20 November 2020, 23:39:10 CET, Vladimir Oltean wrote: > On Fri, Nov 20, 2020 at 09:41:03AM +0100, Christian Eggers wrote: > > This series introduc

[PATCH net-next 4/4] net: dsa: microchip: ksz8795: setup SPI mode

2020-11-20 Thread Christian Eggers
This should be done in the device driver instead of the device tree. Signed-off-by: Christian Eggers --- drivers/net/dsa/microchip/ksz8795_spi.c | 6 ++ 1 file changed, 6 insertions(+) diff --git a/drivers/net/dsa/microchip/ksz8795_spi.c b/drivers/net/dsa/microchip/ksz8795_spi.c index

[PATCH net-next 3/4] net: dsa: microchip: ksz9477: setup SPI mode

2020-11-20 Thread Christian Eggers
This should be done in the device driver instead of the device tree. Signed-off-by: Christian Eggers --- drivers/net/dsa/microchip/ksz9477_spi.c | 6 ++ 1 file changed, 6 insertions(+) diff --git a/drivers/net/dsa/microchip/ksz9477_spi.c b/drivers/net/dsa/microchip/ksz9477_spi.c index

[PATCH net-next 2/4] net: dsa: microchip: support for "ethernet-ports" node

2020-11-20 Thread Christian Eggers
The dsa.yaml device tree binding allows "ethernet-ports" (preferred) and "ports". Signed-off-by: Christian Eggers Reviewed-by: Vladimir Oltean --- drivers/net/dsa/microchip/ksz_common.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drive

[PATCH net-next 1/4] dt-bindings: net: dsa: convert ksz bindings document to yaml

2020-11-20 Thread Christian Eggers
Convert the bindings document for Microchip KSZ Series Ethernet switches from txt to yaml. Removed spi-cpha and spi-cpol flags is this should be handled by the device driver. Signed-off-by: Christian Eggers --- .../devicetree/bindings/net/dsa/ksz.txt | 125 --- .../bindings

[PATCH net-next 0/4] dt-bindings: net: dsa: microchip: convert KSZ bindings to yaml

2020-11-20 Thread Christian Eggers
These patches are orginally from the series "net: dsa: microchip: PTP support for KSZ956x" As the the device tree conversion to yaml is not really related to the PTP patches and the original series is going to take more time than I expected, I would like to split this. Changes (original series

[PATCH net-next v3 3/3] ptp: ptp_ines: use new PTP_MSGTYPE_* define(s)

2020-11-20 Thread Christian Eggers
Remove driver internal defines for this. Masking msgtype with 0xf is already done within ptp_get_msgtype(). Signed-off-by: Christian Eggers Cc: Richard Cochran Cc: Kurt Kanzenbach --- drivers/ptp/ptp_ines.c | 19 +++ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git

[PATCH net-next v3 2/3] dpaa2-eth: use new PTP_MSGTYPE_* define(s)

2020-11-20 Thread Christian Eggers
Remove usage of magic numbers. Signed-off-by: Christian Eggers Cc: Ioana Ciornei Cc: Ioana Radulescu Cc: Yangbo Lu --- drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c b

[PATCH net-next v3 1/3] net: ptp: introduce common defines for PTP message types

2020-11-20 Thread Christian Eggers
Using PTP wide defines will obsolete different driver internal defines and uses of magic numbers. Signed-off-by: Christian Eggers Cc: Kurt Kanzenbach --- include/linux/ptp_classify.h | 7 ++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/include/linux/ptp_classify.h b

[PATCH net-next v3 0/3] net: ptp: introduce common defines for PTP message types

2020-11-20 Thread Christian Eggers
This series introduces commen defines for PTP event messages. Driver internal defines are removed and some uses of magic numbers are replaced by the new defines. Changes v2 --> v3 -- - extend commit description for ptp_ines (Jacob Keller) Changes v1 --> v2 -- -

Re: [PATCH net-next v3 01/12] dt-bindings: net: dsa: convert ksz bindings document to yaml

2020-11-19 Thread Christian Eggers
On Thursday, 19 November 2020, 14:48:01 CET, Rob Herring wrote: > On Wed, Nov 18, 2020 at 09:30:02PM +0100, Christian Eggers wrote: > > Convert the bindings document for Microchip KSZ Series Ethernet switches > > from txt to yaml. > > > > Sign

Re: [PATCH net-next v3 00/12] net: dsa: microchip: PTP support for KSZ956x

2020-11-19 Thread Christian Eggers
Hi Tristram, thank you for joining this thread. On Thursday, 19 November 2020, 19:51:15 CET, tristram...@microchip.com wrote: > > On Thursday, 19 November 2020, 00:40:18 CET, Vladimir Oltean wrote: > > > On Wed, Nov 18, 2020 at 09:30:01PM +0100, Christi

[PATCH net-next v2] net: dsa: avoid potential use-after-free error

2020-11-19 Thread Christian Eggers
If dsa_switch_ops::port_txtstamp() returns false, clone will be freed immediately. Shouldn't store a pointer to freed memory. Signed-off-by: Christian Eggers Fixes: 146d442c2357 ("net: dsa: Keep a pointer to the skb clone for TX timestamping") --- Changes since v1: - Fixed &q

Re: [PATCH net-next v3 00/12] net: dsa: microchip: PTP support for KSZ956x

2020-11-18 Thread Christian Eggers
Hi Vladimir, On Thursday, 19 November 2020, 00:40:18 CET, Vladimir Oltean wrote: > On Wed, Nov 18, 2020 at 09:30:01PM +0100, Christian Eggers wrote: > > This series adds support for PTP to the KSZ956x and KSZ9477 devices. > > > > There is only little documentation for PTP

Re: [PATCH net-next v2 3/3] ptp: ptp_ines: use new PTP_MSGTYPE_* define(s)

2020-11-18 Thread Christian Eggers
On Wednesday, 18 November 2020, 22:03:56 CET, Jacob Keller wrote: > On 11/18/2020 8:22 AM, Christian Eggers wrote: > > Remove driver internal defines for this. > > > > Signed-off-by: Christian Eggers > > Cc: Richard Cochran > > Cc: Kurt Kanzenbach > > --

Re: [PATCH net-next] net: dsa: avoid potential use-after-free error

2020-11-18 Thread Christian Eggers
On Thursday, 19 November 2020, 00:33:57 CET, Vladimir Oltean wrote: > On Wed, Nov 18, 2020 at 04:43:35PM +0100, Christian Eggers wrote: > > If dsa_switch_ops::port_txtstamp() returns false, clone will be freed > > immediately. Storing the pointer in DSA_SKB_CB(skb)->clone an

[PATCH net-next v3 12/12] net: dsa: microchip: ksz9477: add periodic output support

2020-11-18 Thread Christian Eggers
The KSZ9563 has a Trigger Output Unit (TOU) which can be used to generate periodic signals. The pulse length can be altered via a device attribute. Tested on a Microchip KSZ9563 switch. Signed-off-by: Christian Eggers --- drivers/net/dsa/microchip/ksz9477_ptp.c | 197

[PATCH net-next v3 11/12] net: dsa: microchip: ksz9477: add Pulse Per Second (PPS) support

2020-11-18 Thread Christian Eggers
The KSZ9563 has a Trigger Output Unit (TOU) which can be used to generate periodic signals. After adjusting the PTP clock time, the PPS signal has to be restarted. Tested on a Microchip KSZ9563 switch. Signed-off-by: Christian Eggers --- drivers/net/dsa/microchip/ksz9477_ptp.c | 251

[PATCH net-next v3 10/12] net: dsa: microchip: ksz9477: remaining hardware time stamping support

2020-11-18 Thread Christian Eggers
an invalid UDP checksum if this field is negative. Of course, the UDP checksums (if any) have to be corrected after this (for both directions). Everything has been tested on a Microchip KSZ9563 switch. Signed-off-by: Christian Eggers --- drivers/net/dsa/microchip/ksz9477_main.c | 12

[PATCH net-next v3 09/12] net: dsa: microchip: ksz9477: initial hardware time stamping support

2020-11-18 Thread Christian Eggers
() for details: https://patchwork.ozlabs.org/project/netdev/patch/20201019172435.4416-8-cegg...@arri.de/ Signed-off-by: Christian Eggers --- drivers/net/dsa/microchip/ksz9477_main.c | 6 + drivers/net/dsa/microchip/ksz9477_ptp.c | 187 +++ drivers/net/dsa/microchip/ksz9477_ptp.h | 22

[PATCH net-next v3 08/12] net: ptp: add helper for one-step P2P clocks

2020-11-18 Thread Christian Eggers
in the tail-tag is set to zero) or move the value from the correction field back to the tail-tag. Changing the correction field requires updating the UDP checksum (if UDP is used as transport). Signed-off-by: Christian Eggers --- include/linux/ptp_classify.h | 73 1

[PATCH net-next v3 07/12] net: dsa: microchip: ksz9477: add Posix clock support for chip PTP clock

2020-11-18 Thread Christian Eggers
Implement routines (adjfine, adjtime, gettime and settime) for manipulating the chip's PTP clock. Signed-off-by: Christian Eggers --- drivers/net/dsa/microchip/Kconfig| 8 + drivers/net/dsa/microchip/Makefile | 1 + drivers/net/dsa/microchip/ksz9477_i2c.c | 2 +- drivers

[PATCH net-next v3 06/12] net: dsa: microchip: ksz9477: basic interrupt support

2020-11-18 Thread Christian Eggers
Interrupts are required for TX time stamping. Probably they could also be used for PHY connection status. This patch only adds the basic infrastructure for interrupts, no interrupts are finally enabled nor handled. Signed-off-by: Christian Eggers --- drivers/net/dsa/microchip/ksz9477_i2c.c

[PATCH net-next v3 05/12] net: dsa: microchip: ksz9477: move chip reset to ksz9477_switch_init()

2020-11-18 Thread Christian Eggers
The next patch will add basic interrupt support. Chip reset must be performed before requesting the IRQ, so move this from ksz9477_setup() to ksz9477_init(). Signed-off-by: Christian Eggers --- drivers/net/dsa/microchip/ksz9477_main.c | 15 +++ 1 file changed, 7 insertions(+), 8

[PATCH net-next v3 04/12] dt-bindings: net: dsa: microchip,ksz: add interrupt property

2020-11-18 Thread Christian Eggers
The devices have an optional interrupt line. Signed-off-by: Christian Eggers --- .../devicetree/bindings/net/dsa/microchip,ksz.yaml | 7 +++ 1 file changed, 7 insertions(+) diff --git a/Documentation/devicetree/bindings/net/dsa/microchip,ksz.yaml b/Documentation/devicetree

[PATCH net-next v3 03/12] net: dsa: microchip: rename ksz9477.c to ksz9477_main.c

2020-11-18 Thread Christian Eggers
PTP functionality will be built into a separate source file (ksz9477_ptp.c). Signed-off-by: Christian Eggers Reviewed-by: Vladimir Oltean --- drivers/net/dsa/microchip/Makefile | 1 + drivers/net/dsa/microchip/{ksz9477.c => ksz9477_main.c} | 0 2 files changed, 1 insert

[PATCH net-next v3 02/12] net: dsa: microchip: support for "ethernet-ports" node

2020-11-18 Thread Christian Eggers
The dsa.yaml device tree binding allows "ethernet-ports" (preferred) and "ports". Signed-off-by: Christian Eggers Reviewed-by: Vladimir Oltean --- drivers/net/dsa/microchip/ksz_common.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drive

[PATCH net-next v3 01/12] dt-bindings: net: dsa: convert ksz bindings document to yaml

2020-11-18 Thread Christian Eggers
Convert the bindings document for Microchip KSZ Series Ethernet switches from txt to yaml. Signed-off-by: Christian Eggers --- .../devicetree/bindings/net/dsa/ksz.txt | 125 -- .../bindings/net/dsa/microchip,ksz.yaml | 152 ++ MAINTAINERS

[PATCH net-next v3 00/12] net: dsa: microchip: PTP support for KSZ956x

2020-11-18 Thread Christian Eggers
This series adds support for PTP to the KSZ956x and KSZ9477 devices. There is only little documentation for PTP available on the data sheet [1] (more or less only the register reference). Questions to the Microchip support were seldom answered comprehensively or in reasonable time. So this is

[PATCH net-next v2 3/3] ptp: ptp_ines: use new PTP_MSGTYPE_* define(s)

2020-11-18 Thread Christian Eggers
Remove driver internal defines for this. Signed-off-by: Christian Eggers Cc: Richard Cochran Cc: Kurt Kanzenbach --- drivers/ptp/ptp_ines.c | 19 +++ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/drivers/ptp/ptp_ines.c b/drivers/ptp/ptp_ines.c index

[PATCH net-next v2 2/3] dpaa2-eth: use new PTP_MSGTYPE_* define(s)

2020-11-18 Thread Christian Eggers
Remove usage of magic numbers. Signed-off-by: Christian Eggers Cc: Ioana Ciornei Cc: Ioana Radulescu Cc: Yangbo Lu --- drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c b

[PATCH net-next v2 1/3] net: ptp: introduce common defines for PTP message types

2020-11-18 Thread Christian Eggers
Using PTP wide defines will obsolete different driver internal defines and uses of magic numbers. Signed-off-by: Christian Eggers Cc: Kurt Kanzenbach --- include/linux/ptp_classify.h | 7 ++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/include/linux/ptp_classify.h b

[PATCH net-next v2 0/3] net: ptp: introduce common defines for PTP message types

2020-11-18 Thread Christian Eggers
This series introduces commen defines for PTP event messages. Driver internal defines are removed and some uses of magic numbers are replaced by the new defines.

[PATCH net-next] net: dsa: avoid potential use-after-free error

2020-11-18 Thread Christian Eggers
If dsa_switch_ops::port_txtstamp() returns false, clone will be freed immediately. Storing the pointer in DSA_SKB_CB(skb)->clone anyway, supports annoying use-after-free bugs. Signed-off-by: Christian Eggers Fixes 146d442c2357 ("net: dsa: Keep a pointer to the skb clone for TX time

[PATCH net-next 4/4] ptp: ptp_ines: use enum ptp_msg_type

2020-11-17 Thread Christian Eggers
Use new return type of ptp_get_msgtype(). Remove driver internal defines for this. Signed-off-by: Christian Eggers Cc: Richard Cochran Cc: Kurt Kanzenbach --- drivers/ptp/ptp_ines.c | 25 ++--- 1 file changed, 10 insertions(+), 15 deletions(-) diff --git a/drivers/ptp

[PATCH net-next 3/4] dpaa2-eth: use enum ptp_msg_type

2020-11-17 Thread Christian Eggers
Use new return type of ptp_get_msgtype(). Remove usage of magic numbers. Signed-off-by: Christian Eggers Cc: Ioana Ciornei Cc: Ioana Radulescu Cc: Yangbo Lu --- drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c | 14 +- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git

[PATCH net-next 2/4] net: phy: dp83640: use enum ptp_msg_type

2020-11-17 Thread Christian Eggers
Use new return type of ptp_get_msgtype(). Remove usage of magic number. Signed-off-by: Christian Eggers Cc: Richard Cochran Cc: Kurt Kanzenbach --- drivers/net/phy/dp83640.c | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/net/phy/dp83640.c b/drivers/net

[PATCH net-next 1/4] net: ptp: introduce enum ptp_msg_type

2020-11-17 Thread Christian Eggers
Using a PTP wide enum will obsolete different driver internal defines and uses of magic numbers. Signed-off-by: Christian Eggers Cc: Kurt Kanzenbach --- include/linux/ptp_classify.h | 15 +++ 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/include/linux

Re: [RFC PATCH net-next 7/9] net: dsa: microchip: ksz9477: add hardware time stamping support

2020-11-17 Thread Christian Eggers
On Thursday, 12 November 2020, 16:28:44 CET, Christian Eggers wrote: > Hi Vladimir, > > On Tuesday, 10 November 2020, 20:32:45 CET, Vladimir Oltean wrote: > > But something is still wrong if you need to special-case the negative > > correctionField, it looks like the a

Re: [PATCH net-next v2 01/11] dt-bindings: net: dsa: convert ksz bindings document to yaml

2020-11-16 Thread Christian Eggers
On Monday, 16 November 2020, 15:37:20 CET, Rob Herring wrote: > On Thu, 12 Nov 2020 16:35:27 +0100, Christian Eggers wrote: > > Convert the bindings document for Microchip KSZ Series Ethernet switches > > from txt to yaml. > > > > Signed-off-by: Christian Eggers >

Re: [PATCH net-next v2 03/11] net: dsa: microchip: split ksz_common.h

2020-11-16 Thread Christian Eggers
On Friday, 13 November 2020, 17:56:34 CET, Christian Eggers wrote: > On Friday, 13 November 2020, 00:02:54 CET, Vladimir Oltean wrote: > > On Thu, Nov 12, 2020 at 04:35:29PM +0100, Christian Eggers wrote: > > > Parts of ksz_common.h (struct ksz_device) will be required in >

Re: [PATCH net-next v2 09/11] net: dsa: microchip: ksz9477: add hardware time stamping support

2020-11-13 Thread Christian Eggers
On Friday, 13 November 2020, 03:40:20 CET, Vladimir Oltean wrote: > On Thu, Nov 12, 2020 at 04:35:35PM +0100, Christian Eggers wrote: [...] > > @@ -103,6 +108,10 @@ static int ksz9477_ptp_adjtime(struct ptp_clock_info > > *ptp, s64 delta)> > > if (ret) >

Re: [PATCH net-next v2 08/11] net: ptp: add helper for one-step P2P clocks

2020-11-13 Thread Christian Eggers
On Friday, 13 November 2020, 01:51:24 CET, Vladimir Oltean wrote: > On Thu, Nov 12, 2020 at 04:35:34PM +0100, Christian Eggers wrote: > > This function subtracts the ingress hardware time stamp from the > > correction field of a PTP header and updates the UDP checksum (if

Re: [PATCH net-next v2 06/11] net: dsa: microchip: ksz9477: basic interrupt support

2020-11-13 Thread Christian Eggers
On Friday, 13 November 2020, 00:26:17 CET, Vladimir Oltean wrote: > On Thu, Nov 12, 2020 at 04:35:32PM +0100, Christian Eggers wrote: > > Interrupts are required for TX time stamping. Probably they could also > > be used for PHY connection status. > > Do the KSZ switches

Re: [PATCH net-next v2 05/11] dt-bindings: net: dsa: microchip,ksz: add interrupt property

2020-11-13 Thread Christian Eggers
On Friday, 13 November 2020, 00:07:32 CET, Vladimir Oltean wrote: > On Thu, Nov 12, 2020 at 04:35:31PM +0100, Christian Eggers wrote: > > The devices have an optional interrupt line. > > > > Signed-off-by: Christian Eggers > > --- > > > > .../devicet

Re: [PATCH net-next v2 03/11] net: dsa: microchip: split ksz_common.h

2020-11-13 Thread Christian Eggers
On Friday, 13 November 2020, 00:02:54 CET, Vladimir Oltean wrote: > On Thu, Nov 12, 2020 at 04:35:29PM +0100, Christian Eggers wrote: > > Parts of ksz_common.h (struct ksz_device) will be required in > > net/dsa/tag_ksz.c soon. So move the relevant parts into a new header > >

[PATCH net-next v2 11/11] net: dsa: microchip: ksz9477: add periodic output support

2020-11-12 Thread Christian Eggers
The KSZ9563 has a Trigger Output Unit (TOU) which can be used to generate periodic signals. The pulse length can be altered via a device attribute. Tested on a Microchip KSZ9563 switch. Signed-off-by: Christian Eggers --- drivers/net/dsa/microchip/ksz9477_ptp.c | 197

[PATCH net-next v2 10/11] net: dsa: microchip: ksz9477: add Pulse Per Second (PPS) support

2020-11-12 Thread Christian Eggers
The KSZ9563 has a Trigger Output Unit (TOU) which can be used to generate periodic signals. After adjusting the PTP clock time, the PPS signal has to be restarted. Tested on a Microchip KSZ9563 switch. Signed-off-by: Christian Eggers --- drivers/net/dsa/microchip/ksz9477_ptp.c | 251

[PATCH net-next v2 09/11] net: dsa: microchip: ksz9477: add hardware time stamping support

2020-11-12 Thread Christian Eggers
values on this field. Of course, the UDP checksums (if any) have to be corrected after this (for both directions). Everything has been tested on a Microchip KSZ9563 switch. Signed-off-by: Christian Eggers --- drivers/net/dsa/microchip/ksz9477_main.c | 9 +- drivers/net/dsa/microchip

[PATCH net-next v2 08/11] net: ptp: add helper for one-step P2P clocks

2020-11-12 Thread Christian Eggers
. Signed-off-by: Christian Eggers --- include/linux/ptp_classify.h | 97 1 file changed, 97 insertions(+) diff --git a/include/linux/ptp_classify.h b/include/linux/ptp_classify.h index 56b2d7d66177..f27b512e1abd 100644 --- a/include/linux/ptp_classify.h +++ b

[PATCH net-next v2 07/11] net: dsa: microchip: ksz9477: add Posix clock support for chip PTP clock

2020-11-12 Thread Christian Eggers
Implement routines (adjfine, adjtime, gettime and settime) for manipulating the chip's PTP clock. Signed-off-by: Christian Eggers --- drivers/net/dsa/microchip/Kconfig| 9 + drivers/net/dsa/microchip/Makefile | 1 + drivers/net/dsa/microchip/ksz9477_i2c.c | 2 +- drivers

[PATCH net-next v2 06/11] net: dsa: microchip: ksz9477: basic interrupt support

2020-11-12 Thread Christian Eggers
() instead of ksz9477_setup()). Signed-off-by: Christian Eggers --- drivers/net/dsa/microchip/ksz9477_i2c.c | 2 + drivers/net/dsa/microchip/ksz9477_main.c | 103 +-- drivers/net/dsa/microchip/ksz9477_spi.c | 2 + include/linux/dsa/ksz_common.h | 1 + 4 files

[PATCH net-next v2 05/11] dt-bindings: net: dsa: microchip,ksz: add interrupt property

2020-11-12 Thread Christian Eggers
The devices have an optional interrupt line. Signed-off-by: Christian Eggers --- .../devicetree/bindings/net/dsa/microchip,ksz.yaml| 8 1 file changed, 8 insertions(+) diff --git a/Documentation/devicetree/bindings/net/dsa/microchip,ksz.yaml b/Documentation/devicetree

[PATCH net-next v2 04/11] net: dsa: microchip: rename ksz9477.c to ksz9477_main.o

2020-11-12 Thread Christian Eggers
PTP functionality will be built into a separate source file (ksz9477_ptp.c). Signed-off-by: Christian Eggers --- drivers/net/dsa/microchip/Makefile | 1 + drivers/net/dsa/microchip/{ksz9477.c => ksz9477_main.c} | 0 2 files changed, 1 insertion(+) rename drivers/net/

[PATCH net-next v2 03/11] net: dsa: microchip: split ksz_common.h

2020-11-12 Thread Christian Eggers
Parts of ksz_common.h (struct ksz_device) will be required in net/dsa/tag_ksz.c soon. So move the relevant parts into a new header file. Signed-off-by: Christian Eggers --- MAINTAINERS| 1 + drivers/net/dsa/microchip/ksz_common.h | 81 +- include

[PATCH net-next v2 02/11] net: dsa: microchip: support for "ethernet-ports" node

2020-11-12 Thread Christian Eggers
The dsa.yaml device tree binding allows "ethernet-ports" (preferred) and "ports". Signed-off-by: Christian Eggers --- drivers/net/dsa/microchip/ksz_common.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/net/dsa/microchip/ksz_common.c b/drive

[PATCH net-next v2 01/11] dt-bindings: net: dsa: convert ksz bindings document to yaml

2020-11-12 Thread Christian Eggers
Convert the bindings document for Microchip KSZ Series Ethernet switches from txt to yaml. Signed-off-by: Christian Eggers --- .../devicetree/bindings/net/dsa/ksz.txt | 125 --- .../bindings/net/dsa/microchip,ksz.yaml | 150 ++ MAINTAINERS

[PATCH net-next v2 00/11] net: dsa: microchip: PTP support for KSZ956x

2020-11-12 Thread Christian Eggers
There is only little documentation for PTP available on the data sheet [1] (more or less only the register reference). Questions to the Microchip support were seldom answered comprehensively or in reasonable time. So this is more or less the result of reverse engineering. [1]

Re: [RFC PATCH net-next 7/9] net: dsa: microchip: ksz9477: add hardware time stamping support

2020-11-12 Thread Christian Eggers
Hi Vladimir, On Tuesday, 10 November 2020, 20:32:45 CET, Vladimir Oltean wrote: > But something is still wrong if you need to special-case the negative > correctionField, it looks like the arithmetic is not done on the correct > number of bits, either by the driver or by the hardware. I got it!

Re: [RFC PATCH net-next 7/9] net: dsa: microchip: ksz9477: add hardware time stamping support

2020-11-11 Thread Christian Eggers
Hi Vladimir, On Tuesday, 10 November 2020, 20:32:45 CET, Vladimir Oltean wrote: > On Tue, Nov 10, 2020 at 06:40:45PM +0200, Vladimir Oltean wrote: > > I am fairly confident that this is how your hardware works, because > > that's also how peer delay wants to be timestamped, it seems. > > So I

Re: [RFC PATCH net-next 7/9] net: dsa: microchip: ksz9477: add hardware time stamping support

2020-11-11 Thread Christian Eggers
Hi Vladimir, On Tuesday, 10 November 2020, 20:32:45 CET, Vladimir Oltean wrote: > On Tue, Nov 10, 2020 at 06:40:45PM +0200, Vladimir Oltean wrote: > > I am fairly confident that this is how your hardware works, because > > that's also how peer delay wants to be timestamped, it seems. > > So I

Re: [RFC PATCH net-next 7/9] net: dsa: microchip: ksz9477: add hardware time stamping support

2020-11-10 Thread Christian Eggers
On Tuesday, 10 November 2020, 02:42:34 CET, Vladimir Oltean wrote: > Sorry for getting back late to you. It did not compute when I read your > email the first time around, then I let it sit for a while. > > On Thu, Nov 05, 2020 at 09:18:04PM +0100, Christian Eggers wrote: > > un

Re: [RFC PATCH net-next 7/9] net: dsa: microchip: ksz9477: add hardware time stamping support

2020-11-05 Thread Christian Eggers
Hi Vladimir, On Thursday, 22 October 2020, 13:32:43 CET, Vladimir Oltean wrote: > On Thu, Oct 22, 2020 at 01:11:40PM +0200, Christian Eggers wrote: > > On Thursday, 22 October 2020, 12:50:14 CEST, Vladimir Oltean wrote: > > after applying the RX timestamp correctly to the c

Re: [RFC PATCH net-next 7/9] net: dsa: microchip: ksz9477: add hardware time stamping support

2020-11-02 Thread Christian Eggers
On Monday, 2 November 2020, 00:41:49 CET, Vladimir Oltean wrote: > On Sun, Nov 01, 2020 at 11:14:24PM +0100, Christian Eggers wrote: > > My assumption is that the KSZ9563 simply doesn't forward specific PTP > > packages from the slave ports to the CPU port. In my imagination t

Re: [RFC PATCH net-next 7/9] net: dsa: microchip: ksz9477: add hardware time stamping support

2020-11-01 Thread Christian Eggers
On Sunday, 1 November 2020, 12:10:08 CET, Vladimir Oltean wrote: > On Sun, Nov 01, 2020 at 10:35:01AM +0100, Christian Eggers wrote: > > Hi Vladimir, > > > > On Friday, 30 October 2020, 19:24:47 CET, Vladimir Oltean wrote: > > > On Thu, Oct 22, 2020 at 12:17:48PM

  1   2   3   >