Netdev List
 help / color / mirror / Atom feed
From: Vadim Fedorenko <vadim.fedorenko@linux.dev>
To: Maciek Machnikowski <maciej.machnikowski@intel.com>,
	intel-wired-lan@lists.osuosl.org
Cc: maciek@machnikowski.net, netdev@vger.kernel.org,
	Przemek Kitszel <przemyslaw.kitszel@intel.com>
Subject: Re: [PATCH iwl-net] ice: fix slow signal rise on SDPs
Date: Wed, 2 Dec 2026 14:40:44 +0000	[thread overview]
Message-ID: <e50dc0a4-bebf-4b35-9bd7-dff78823dca3@linux.dev> (raw)
In-Reply-To: <20261201080620.149128-1-maciej.machnikowski@intel.com>

On 01/12/2026 08:06, Maciek Machnikowski wrote:
> When an SDP (Software Definable Pin) is configured as a periodic output,
> the driver already sets PIN_DIR (output) and PIN_FUNC (routing the pin
> to the timer's AUX output) in GPIO_CTL, but leaves TRI_CTL cleared. Per
> the hardware definition, TRI_CTL (bit 5) is meaningful only for single
> ended GPIOs configured as output and driven high: 0b tristates the pin,
> 1b drives it high.
> 
> With TRI_CTL cleared, the pin is driven low but tristated instead of
> driven high, so the high level comes only from the pull-up and the
> rising edge is slow. A device that timestamps this signal sees the
> rising edge late. The measured delay was ~6 us, and it depends on the
> board and the load on the line. This adds an offset and jitter between
> the PHC and the device that consumes the signal. Examples are a second
> NIC using EXTTS, a DPLL input or a measurement instrument.
> 
> The problem was found during development, while validating periodic
> output signal quality with an oscilloscope. It was not found by static
> analysis.
> 
> To reproduce, enable a 1 PPS periodic output on one of the SDPs, e.g.:
> 
>    testptp -d /dev/ptpX -L <pin>,2
>    testptp -d /dev/ptpX -p 1000000000
> 
> and probe the pin with an oscilloscope. The rising edge is delayed by
> ~6 us.
> 
> Set TRI_CTL, the only missing bit, when enabling periodic outputs, so
> the pin is actively driven high. With this change the rising edge delay
> drops from ~6 us to ~50 ns. This has no effect on pins that are not
> single ended SDPs, such as the differential 1PPS output.
> 
> Fixes: 172db5f91d5f ("ice: add support for auxiliary input/output pins")
> Reviewed-by: Przemek Kitszel <przemyslaw.kitszel@intel.com>
> Signed-off-by: Maciek Machnikowski <maciej.machnikowski@intel.com>
> ---
>   drivers/net/ethernet/intel/ice/ice_hw_autogen.h | 1 +
>   drivers/net/ethernet/intel/ice/ice_ptp.c        | 7 +++++--
>   2 files changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/ethernet/intel/ice/ice_hw_autogen.h b/drivers/net/ethernet/intel/ice/ice_hw_autogen.h
> index 082ad33c53dc..1d538a04196c 100644
> --- a/drivers/net/ethernet/intel/ice/ice_hw_autogen.h
> +++ b/drivers/net/ethernet/intel/ice/ice_hw_autogen.h
> @@ -154,6 +154,7 @@
>   #define GLGEN_CLKSTAT_SRC			0x000B826C
>   #define GLGEN_GPIO_CTL(_i)			(0x000880C8 + ((_i) * 4))
>   #define GLGEN_GPIO_CTL_PIN_DIR_M		BIT(4)
> +#define GLGEN_GPIO_CTL_TRI_CTL_M		BIT(5)
>   #define GLGEN_GPIO_CTL_PIN_FUNC_S		8
>   #define GLGEN_GPIO_CTL_PIN_FUNC_M		ICE_M(0xF, 8)
>   #define GLGEN_RSTAT				0x000B8188
> diff --git a/drivers/net/ethernet/intel/ice/ice_ptp.c b/drivers/net/ethernet/intel/ice/ice_ptp.c
> index 30bc2d8aed9e..803744ff1a89 100644
> --- a/drivers/net/ethernet/intel/ice/ice_ptp.c
> +++ b/drivers/net/ethernet/intel/ice/ice_ptp.c
> @@ -1762,9 +1762,12 @@ static int ice_ptp_write_perout(struct ice_hw *hw, unsigned int chan,
>   
>   	/* 4. write GPIO CTL reg */
>   	val = GLGEN_GPIO_CTL_PIN_DIR_M;
> -	if (!!period)
> -		val |= FIELD_PREP(GLGEN_GPIO_CTL_PIN_FUNC_M,
> +	if (!!period) {
> +		/* TRI_CTL=1 drives SDPs high instead of tristating them */
> +		val |= GLGEN_GPIO_CTL_TRI_CTL_M |
> +		       FIELD_PREP(GLGEN_GPIO_CTL_PIN_FUNC_M,
>   				  8 + chan + (tmr_idx * 4));
> +	}
>   
>   	wr32(hw, GLGEN_GPIO_CTL(gpio_pin), val);
>   	ice_flush(hw);

why is GLGEN_GPIO_CTL_TRI_CTL_M only applied to enable operation? does
it harm when it's always applied? just simple patch with less LoC:

         /* 4. write GPIO CTL reg */
-       val = GLGEN_GPIO_CTL_PIN_DIR_M;
+       val = GLGEN_GPIO_CTL_PIN_DIR_M | GLGEN_GPIO_CTL_TRI_CTL_M;
         if (!!period)




      parent reply	other threads:[~2026-12-02 14:40 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-01  8:06 [PATCH iwl-net] ice: fix slow signal rise on SDPs Maciek Machnikowski
2026-12-01  8:08 ` netdev-bot+sinfo
2026-12-01  8:15   ` Maciek Machnikowski
2026-12-02 14:40 ` Vadim Fedorenko [this message]

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=e50dc0a4-bebf-4b35-9bd7-dff78823dca3@linux.dev \
    --to=vadim.fedorenko@linux.dev \
    --cc=intel-wired-lan@lists.osuosl.org \
    --cc=maciej.machnikowski@intel.com \
    --cc=maciek@machnikowski.net \
    --cc=netdev@vger.kernel.org \
    --cc=przemyslaw.kitszel@intel.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