From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtpout-03.galae.net (smtpout-03.galae.net [185.246.85.4]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3509F415B68; Mon, 31 Aug 2026 13:25:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.246.85.4 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788182745; cv=none; b=Jf2IPYL+8MldZ6EGUJ4wzsaU4LuXFlbKgvWXF7fEV8L/rdu3c1M/PqlbDN3wy3wYXkN8dhg49NWEnfmyD8nihoPbX/f8Na0hXX+C6clxIhdEsmNEVDWny3fmcJCElnRIfz3P8HT37ShxTAidPwzlrHYNrWjt8bw3pN+7lBjGQaE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788182745; c=relaxed/simple; bh=j1+ZBVJmPVW03bJXf/56FabNKgWY7EFAGihdRcW3d0M=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=E34EQvCipNtKN3LOmpJt/FRXlHRzmxEKVZlb4VeVQOx7f2k43Mcl3W9a52KOyakPqIn4LJoRzGbdrUmqBSxyvviwSCxJm3qCWMnlL+xFd9g6i4z1LwP/pudH9upywh3NCq+NXHF4NfGWpBtkuwH07sIKMzm8Ts3XgR8zRY2Te4s= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=vgI9QscX; arc=none smtp.client-ip=185.246.85.4 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="vgI9QscX" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-03.galae.net (Postfix) with ESMTPS id A8B7D4E41480; Mon, 31 Aug 2026 13:25:41 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id 7D47E60231; Mon, 31 Aug 2026 13:25:41 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 432BA11C78D63; Mon, 31 Aug 2026 15:25:39 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1788182740; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=B3aS/Mr7RC/ZOcg+EzhbjQUCCCKDV341PmBKKjmtwgs=; b=vgI9QscXXtXzNjenW3yFrgKHyHRXV6CqBpP4HhCrZAd5Kh6H3guTd7W5ZiSGpfkueXfQkX cqi6OuuZ6lKZ1VyW9lDRbzE9YDVrc7H3wcXKfIbLHNdFQbsOC1FP53vXfjBBxgLhmKs/6V vdNSh190wJnGsGu02ljvZbg0eITMSMM+TIy3IuzBAEjfXhYNn5VdHmrBcHNncckr8EO60J voTz88fRCij8GFW3lfgm3b6ovdoDwxJnJJ7dBbjQQr8ePi9d9cwc2O/+PAiYB81Woh6YEx bRLrkU6+WHD5HOer8vR0sHaQoG4Y+LoaQuv9p3CFd+uc5PIs3+y56fpiatW36A== From: "Bastien Curutchet (Schneider Electric)" Date: Mon, 31 Aug 2026 15:25:29 +0200 Subject: [PATCH net-next 07/10] net: dsa: microchip: extract prepare reset Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20260831-ksz-perout-v1-7-14202db763b3@bootlin.com> References: <20260831-ksz-perout-v1-0-14202db763b3@bootlin.com> In-Reply-To: <20260831-ksz-perout-v1-0-14202db763b3@bootlin.com> To: Woojung Huh , UNGLinuxDriver@microchip.com, Andrew Lunn , Vladimir Oltean , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Richard Cochran Cc: Pascal Eberhard , =?utf-8?q?Miqu=C3=A8l_Raynal?= , Thomas Petazzoni , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, "Bastien Curutchet (Schneider Electric)" X-Mailer: b4 0.14.3 X-Last-TLS-Session-Version: TLSv1.3 The KSZ8463 supports periodic outputs but doesn't handle them in the same way as the other KSZ switches. To add proper support for the KSZ8463, a dedicated ksz8463_ptp_restart_perout() function needs to be created. This function will use the same request initialization as the common ksz_ptp_restart_perout() function. Extract the inialization into a dedicated function so it can be used later by the KSZ8463 support. Signed-off-by: Bastien Curutchet (Schneider Electric) --- drivers/net/dsa/microchip/ksz_ptp.c | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/drivers/net/dsa/microchip/ksz_ptp.c b/drivers/net/dsa/microchip/ksz_ptp.c index 2f141df65eb0..e262bc7448f2 100644 --- a/drivers/net/dsa/microchip/ksz_ptp.c +++ b/drivers/net/dsa/microchip/ksz_ptp.c @@ -788,11 +788,11 @@ static int ksz_ptp_gettime(struct ptp_clock_info *ptp, struct timespec64 *ts) return ret; } -static int ksz_ptp_restart_perout(struct ksz_device *dev) +static int ksz_ptp_prepare_restart_perout(struct ksz_device *dev, + struct ptp_perout_request *request) { struct ksz_ptp_data *ptp_data = &dev->ptp_data; s64 now_ns, first_ns, period_ns, next_ns; - struct ptp_perout_request request; struct timespec64 next; struct timespec64 now; unsigned int count; @@ -823,12 +823,24 @@ static int ksz_ptp_restart_perout(struct ksz_device *dev) /* Restart periodic output signal */ next = ns_to_timespec64(next_ns); - request.start.sec = next.tv_sec; - request.start.nsec = next.tv_nsec; - request.period.sec = ptp_data->perout_period.tv_sec; - request.period.nsec = ptp_data->perout_period.tv_nsec; - request.index = 0; - request.flags = 0; + request->start.sec = next.tv_sec; + request->start.nsec = next.tv_nsec; + request->period.sec = ptp_data->perout_period.tv_sec; + request->period.nsec = ptp_data->perout_period.tv_nsec; + request->index = 0; + request->flags = 0; + + return 0; +} + +static int ksz_ptp_restart_perout(struct ksz_device *dev) +{ + struct ptp_perout_request request; + int ret; + + ret = ksz_ptp_prepare_restart_perout(dev, &request); + if (ret) + return ret; return ksz_ptp_enable_perout(dev, &request, 1); } -- 2.55.0