summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien Curutchet (Schneider Electric) <bastien.curutchet@bootlin.com>2026-01-05 16:08:08 +0300
committerPaolo Abeni <pabeni@redhat.com>2026-01-08 15:01:16 +0300
commit3adff276e751051e77be4df8d29eab1cf0856fbf (patch)
tree22e6a0a2a22e24db1317a602905427c07dfcb1e0
parentb4df828dfc290ffbb59b1172d71fdf34371edc23 (diff)
downloadlinux-3adff276e751051e77be4df8d29eab1cf0856fbf.tar.xz
net: dsa: microchip: Wrap timestamp reading in a function
Timestamps are directly accessed through a register read in the interrupt handler. KSZ8463's logic to access it will be a bit more complex because the same interrupt can be triggered by two different timestamps being ready. Wrap the timestamp's reading in a dedicated function to ease the KSZ8463's integration in upcoming patches. Signed-off-by: Bastien Curutchet (Schneider Electric) <bastien.curutchet@bootlin.com> Link: https://patch.msgid.link/20260105-ksz-rework-v1-9-a68df7f57375@bootlin.com Signed-off-by: Paolo Abeni <pabeni@redhat.com>
-rw-r--r--drivers/net/dsa/microchip/ksz_ptp.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/drivers/net/dsa/microchip/ksz_ptp.c b/drivers/net/dsa/microchip/ksz_ptp.c
index b3fff0643ea7..4a2cc57a628f 100644
--- a/drivers/net/dsa/microchip/ksz_ptp.c
+++ b/drivers/net/dsa/microchip/ksz_ptp.c
@@ -967,6 +967,11 @@ void ksz_ptp_clock_unregister(struct dsa_switch *ds)
ptp_clock_unregister(ptp_data->clock);
}
+static int ksz_read_ts(struct ksz_port *port, u16 reg, u32 *ts)
+{
+ return ksz_read32(port->ksz_dev, reg, ts);
+}
+
static irqreturn_t ksz_ptp_msg_thread_fn(int irq, void *dev_id)
{
struct ksz_ptp_irq *ptpmsg_irq = dev_id;
@@ -980,7 +985,7 @@ static irqreturn_t ksz_ptp_msg_thread_fn(int irq, void *dev_id)
dev = port->ksz_dev;
if (ptpmsg_irq->ts_en) {
- ret = ksz_read32(dev, ptpmsg_irq->ts_reg, &tstamp_raw);
+ ret = ksz_read_ts(port, ptpmsg_irq->ts_reg, &tstamp_raw);
if (ret)
return IRQ_NONE;