From: "Bastien Curutchet (Schneider Electric)" <bastien.curutchet@bootlin.com>
To: Woojung Huh <woojung.huh@microchip.com>,
UNGLinuxDriver@microchip.com, Andrew Lunn <andrew@lunn.ch>,
Vladimir Oltean <olteanv@gmail.com>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>,
Paolo Abeni <pabeni@redhat.com>,
Richard Cochran <richardcochran@gmail.com>,
Simon Horman <horms@kernel.org>
Cc: "Pascal Eberhard" <pascal.eberhard@se.com>,
"Miquèl Raynal" <miquel.raynal@bootlin.com>,
"Thomas Petazzoni" <thomas.petazzoni@bootlin.com>,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
"Bastien Curutchet (Schneider Electric)"
<bastien.curutchet@bootlin.com>
Subject: [PATCH net-next v4 3/8] net: dsa: microchip: Decorrelate msg_irq index from IRQ bit offset
Date: Tue, 27 Jan 2026 10:06:45 +0100 [thread overview]
Message-ID: <20260127-ksz8463-ptp-v4-3-652e021aae86@bootlin.com> (raw)
In-Reply-To: <20260127-ksz8463-ptp-v4-0-652e021aae86@bootlin.com>
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) <bastien.curutchet@bootlin.com>
---
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/microchip/ksz_ptp.c
index 3b0dddf918595e9318c9e9779035d5152dcd9dde..ae46ba41c588c076de2c3b70c7c6702ad85263d5 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 *port, u8 n)
irq_dispose_mapping(ptpmsg_irq->num);
}
-static int ksz_ptp_msg_irq_setup(struct irq_domain *domain, struct ksz_port *port, u8 n)
+static int ksz_ptp_msg_irq_setup(struct irq_domain *domain, struct ksz_port *port,
+ u8 index, int irq)
{
u16 ts_reg[] = {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 = port->ksz_dev->dev_ops;
struct ksz_ptp_irq *ptpmsg_irq;
- ptpmsg_irq = &port->ptpmsg_irq[n];
- ptpmsg_irq->num = irq_create_mapping(domain, n);
+ ptpmsg_irq = &port->ptpmsg_irq[index];
+ ptpmsg_irq->num = irq_create_mapping(domain, irq);
if (!ptpmsg_irq->num)
return -EINVAL;
ptpmsg_irq->port = port;
- ptpmsg_irq->ts_reg = ops->get_port_addr(port->num, ts_reg[n]);
+ ptpmsg_irq->ts_reg = ops->get_port_addr(port->num, ts_reg[index]);
- strscpy(ptpmsg_irq->name, name[n]);
+ strscpy(ptpmsg_irq->name, name[index]);
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;
for (irq = 0; irq < ptpirq->nirqs; irq++) {
- ret = ksz_ptp_msg_irq_setup(ptpirq->domain, port, irq);
+ ret = ksz_ptp_msg_irq_setup(ptpirq->domain, port, irq, irq);
if (ret)
goto out_ptp_msg;
}
--
2.52.0
next prev parent reply other threads:[~2026-01-27 9:07 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-27 9:06 [PATCH net-next v4 0/8] net: dsa: microchip: Add PTP support for the KSZ8463 Bastien Curutchet (Schneider Electric)
2026-01-27 9:06 ` [PATCH net-next v4 1/8] net: dsa: microchip: Add support for KSZ8463 global irq Bastien Curutchet (Schneider Electric)
2026-01-27 19:42 ` Maxime Chevallier
2026-01-28 3:03 ` Jakub Kicinski
2026-01-28 9:22 ` Bastien Curutchet
2026-01-27 9:06 ` [PATCH net-next v4 2/8] net: dsa: microchip: Decorrelate IRQ domain from port Bastien Curutchet (Schneider Electric)
2026-01-27 9:06 ` Bastien Curutchet (Schneider Electric) [this message]
2026-01-27 9:06 ` [PATCH net-next v4 4/8] net: dsa: microchip: Add support for KSZ8463's PTP interrupts Bastien Curutchet (Schneider Electric)
2026-01-27 9:06 ` [PATCH net-next v4 5/8] net: dsa: microchip: Add KSZ8463 tail tag handling Bastien Curutchet (Schneider Electric)
2026-01-30 4:15 ` Jakub Kicinski
2026-02-18 9:35 ` Bastien Curutchet
2026-02-02 13:29 ` Vladimir Oltean
2026-02-18 9:36 ` Bastien Curutchet
2026-01-27 9:06 ` [PATCH net-next v4 6/8] net: dsa: microchip: Enable Ethernet PTP detection Bastien Curutchet (Schneider Electric)
2026-01-30 4:17 ` Jakub Kicinski
2026-01-30 5:16 ` Tristram.Ha
2026-02-18 10:22 ` Bastien Curutchet
2026-01-27 9:06 ` [PATCH net-next v4 7/8] net: dsa: microchip: Adapt port offset for KSZ8463's PTP register Bastien Curutchet (Schneider Electric)
2026-01-27 9:06 ` [PATCH net-next v4 8/8] net: dsa: microchip: Add two-step PTP support for KSZ8463 Bastien Curutchet (Schneider Electric)
2026-02-02 13:43 ` Vladimir Oltean
2026-02-18 15:21 ` Bastien Curutchet
2026-02-18 15:25 ` Vladimir Oltean
2026-02-18 16:42 ` Bastien Curutchet
2026-02-18 16:47 ` Vladimir Oltean
2026-02-18 16:49 ` Bastien Curutchet
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=20260127-ksz8463-ptp-v4-3-652e021aae86@bootlin.com \
--to=bastien.curutchet@bootlin.com \
--cc=UNGLinuxDriver@microchip.com \
--cc=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=miquel.raynal@bootlin.com \
--cc=netdev@vger.kernel.org \
--cc=olteanv@gmail.com \
--cc=pabeni@redhat.com \
--cc=pascal.eberhard@se.com \
--cc=richardcochran@gmail.com \
--cc=thomas.petazzoni@bootlin.com \
--cc=woojung.huh@microchip.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
all inboxes | Powered by JetHome®