From nobody Tue Apr 7 18:48:13 2026 Received: from smtpout-02.galae.net (smtpout-02.galae.net [185.246.84.56]) (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 B363A332635 for ; Thu, 26 Feb 2026 16:42:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.246.84.56 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772124126; cv=none; b=N/YELwALmLqIkgVBb33avfwHr7No21TNMLsa+FQyoa4Ab3R6NXibh7GnI/mn6NBJiQ9Cq9Lv4agU6DG14vLTb67WIIAOnxzsB2SCWqdjcZsNjI5jiryTSdfI85ZT4CxtWvVd63cthH09MTTjzG6cENj1+cLg2kTDpPGA972HsMs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772124126; c=relaxed/simple; bh=qAUGqtuwCqJ0laxCFzHnXNutNvHz8zxfyVdBttZkIQY=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=N7GanwibpWIXE/WzzNLxt4QlvGR0Mv8UGkC8zA2vmp8CUCRK1Thb3yP1boAvqic6tz0u1oe3VKYPMMZLnMF0lu8BaNRPeF8cKlJHUOdJwV8E6oZH87oi7uF5dMdZW5FMiodLxXZtST8gaRujz7f1z9okRLKBnZ7ZOBS0aFak9sQ= 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=PrYNTNMJ; arc=none smtp.client-ip=185.246.84.56 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="PrYNTNMJ" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-02.galae.net (Postfix) with ESMTPS id 99ADA1A1577; Thu, 26 Feb 2026 16:42:03 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id 707225FDE9; Thu, 26 Feb 2026 16:42:03 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 0D6D3103693FB; Thu, 26 Feb 2026 17:42:00 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1772124122; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=Dt/xWp/luOgqyet9/x/e/zuW8LChXz1mN0JA1otPa0w=; b=PrYNTNMJMZx+6shinKM+OCrZhocShxW44POVa68Cz1kDuY3trTQlAN3M2vLx1FNNzunh5V AUPE5bk+Fu0AIPN8CPz6qba2FxtsSjhlUDBKFo2hkL/wx1oLoQ7htpqEzNIX4w3BmjTQsI oP9gA2UIU4OBQLo09zojZHC5+dCnDMJagEZD4JxFEZUlSF993k9qI86MjtuyEArkEvURD/ dYPWWTMvSkPpewYK8y7CsfF4VNjnFoyJ7uJTlEwRxcoLiMtcSF82PZPGTRpGatw0vZu9bt PkcRhTSUqeio+NqUTZQCMEy2w6t3at60NXMy/qgc90gTsrsu6DQ/K/1XmC2r4w== From: "Bastien Curutchet (Schneider Electric)" Date: Thu, 26 Feb 2026 17:41:50 +0100 Subject: [PATCH net-next v5 3/9] net: dsa: microchip: Decorrelate msg_irq index from IRQ bit offset Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260226-ksz8463-ptp-v5-3-1bc24fb9627d@bootlin.com> References: <20260226-ksz8463-ptp-v5-0-1bc24fb9627d@bootlin.com> In-Reply-To: <20260226-ksz8463-ptp-v5-0-1bc24fb9627d@bootlin.com> To: Woojung Huh , UNGLinuxDriver@microchip.com, Andrew Lunn , Vladimir Oltean , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Richard Cochran , Simon Horman 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.2 X-Last-TLS-Session-Version: TLSv1.3 KSZ8463 has one register containing all the PTP-related interrupts from all ports. So it will use one IRQ domain for all of them, leading to 4 interrupt bits to be dispatched in two ports. Current implementation doesn't allow to do so because the IRQ bit offset is also used as index to store the struct ptpmsg_irq in the table held by the port. Add a new input to the setup() function to independently provide the interrupt bit offset and the ptpmsg_irq index. Signed-off-by: Bastien Curutchet (Schneider Electric) --- drivers/net/dsa/microchip/ksz_ptp.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/drivers/net/dsa/microchip/ksz_ptp.c b/drivers/net/dsa/microchi= p/ksz_ptp.c index 3b0dddf918595e9318c9e9779035d5152dcd9dde..ae46ba41c588c076de2c3b70c7c= 6702ad85263d5 100644 --- a/drivers/net/dsa/microchip/ksz_ptp.c +++ b/drivers/net/dsa/microchip/ksz_ptp.c @@ -1099,7 +1099,8 @@ static void ksz_ptp_msg_irq_free(struct ksz_port *por= t, u8 n) irq_dispose_mapping(ptpmsg_irq->num); } =20 -static int ksz_ptp_msg_irq_setup(struct irq_domain *domain, struct ksz_por= t *port, u8 n) +static int ksz_ptp_msg_irq_setup(struct irq_domain *domain, struct ksz_por= t *port, + u8 index, int irq) { u16 ts_reg[] =3D {REG_PTP_PORT_PDRESP_TS, REG_PTP_PORT_XDELAY_TS, REG_PTP_PORT_SYNC_TS}; @@ -1108,15 +1109,15 @@ static int ksz_ptp_msg_irq_setup(struct irq_domain = *domain, struct ksz_port *por const struct ksz_dev_ops *ops =3D port->ksz_dev->dev_ops; struct ksz_ptp_irq *ptpmsg_irq; =20 - ptpmsg_irq =3D &port->ptpmsg_irq[n]; - ptpmsg_irq->num =3D irq_create_mapping(domain, n); + ptpmsg_irq =3D &port->ptpmsg_irq[index]; + ptpmsg_irq->num =3D irq_create_mapping(domain, irq); if (!ptpmsg_irq->num) return -EINVAL; =20 ptpmsg_irq->port =3D port; - ptpmsg_irq->ts_reg =3D ops->get_port_addr(port->num, ts_reg[n]); + ptpmsg_irq->ts_reg =3D ops->get_port_addr(port->num, ts_reg[index]); =20 - strscpy(ptpmsg_irq->name, name[n]); + strscpy(ptpmsg_irq->name, name[index]); =20 return request_threaded_irq(ptpmsg_irq->num, NULL, ksz_ptp_msg_thread_fn, IRQF_ONESHOT, @@ -1161,7 +1162,7 @@ int ksz_ptp_irq_setup(struct dsa_switch *ds, u8 p) goto out; =20 for (irq =3D 0; irq < ptpirq->nirqs; irq++) { - ret =3D ksz_ptp_msg_irq_setup(ptpirq->domain, port, irq); + ret =3D ksz_ptp_msg_irq_setup(ptpirq->domain, port, irq, irq); if (ret) goto out_ptp_msg; } --=20 2.53.0