[PATCH net-next v2 02/10] net: dsa: microchip: add the number of periodic signals to chip infos
From: Bastien Curutchet (Schneider Electric)
Date: Wed Sep 02 2026 - 06:09:39 EST
The number of periodic signals available is hardcoded to 3 while
KSZ8463 can produce 12 different periodic signals.
Add an n_per_out attribute to the struct ksz_chip_data to make this
setting configurable.
Set it to 3 for all the PTP-capable switches.
Signed-off-by: Bastien Curutchet (Schneider Electric) <bastien.curutchet@xxxxxxxxxxx>
---
drivers/net/dsa/microchip/ksz_common.c | 10 ++++++++++
drivers/net/dsa/microchip/ksz_common.h | 1 +
drivers/net/dsa/microchip/ksz_ptp.c | 2 +-
3 files changed, 12 insertions(+), 1 deletion(-)
diff --git a/drivers/net/dsa/microchip/ksz_common.c b/drivers/net/dsa/microchip/ksz_common.c
index d01fba253af5..041bb4f96365 100644
--- a/drivers/net/dsa/microchip/ksz_common.c
+++ b/drivers/net/dsa/microchip/ksz_common.c
@@ -1195,6 +1195,7 @@ const struct ksz_chip_data ksz_switch_chips[] = {
.wr_table = &ksz8563_register_set,
.rd_table = &ksz8563_register_set,
.n_pins = 2,
+ .n_per_out = 3,
},
[KSZ8795] = {
@@ -1416,6 +1417,7 @@ const struct ksz_chip_data ksz_switch_chips[] = {
.wr_table = &ksz9477_register_set,
.rd_table = &ksz9477_register_set,
.n_pins = 2,
+ .n_per_out = 3,
},
[KSZ9896] = {
@@ -1547,6 +1549,7 @@ const struct ksz_chip_data ksz_switch_chips[] = {
.gbit_capable = {true, true, true},
.ptp_capable = true,
.n_pins = 2,
+ .n_per_out = 3,
},
[KSZ8567] = {
@@ -1585,6 +1588,7 @@ const struct ksz_chip_data ksz_switch_chips[] = {
true, true},
.ptp_capable = true,
.n_pins = 2,
+ .n_per_out = 3,
},
[KSZ9567] = {
@@ -1620,6 +1624,7 @@ const struct ksz_chip_data ksz_switch_chips[] = {
.gbit_capable = {true, true, true, true, true, true, true},
.ptp_capable = true,
.n_pins = 2,
+ .n_per_out = 3,
},
[LAN9370] = {
@@ -1652,6 +1657,7 @@ const struct ksz_chip_data ksz_switch_chips[] = {
.internal_phy = {true, true, true, true, false},
.ptp_capable = true,
.n_pins = 2,
+ .n_per_out = 3,
},
[LAN9371] = {
@@ -1684,6 +1690,7 @@ const struct ksz_chip_data ksz_switch_chips[] = {
.internal_phy = {true, true, true, true, false, false},
.ptp_capable = true,
.n_pins = 2,
+ .n_per_out = 3,
},
[LAN9372] = {
@@ -1720,6 +1727,7 @@ const struct ksz_chip_data ksz_switch_chips[] = {
false, false, true, true},
.ptp_capable = true,
.n_pins = 2,
+ .n_per_out = 3,
},
[LAN9373] = {
@@ -1756,6 +1764,7 @@ const struct ksz_chip_data ksz_switch_chips[] = {
false, false, true, true},
.ptp_capable = true,
.n_pins = 2,
+ .n_per_out = 3,
},
[LAN9374] = {
@@ -1792,6 +1801,7 @@ const struct ksz_chip_data ksz_switch_chips[] = {
false, false, true, true},
.ptp_capable = true,
.n_pins = 2,
+ .n_per_out = 3,
},
[LAN9646] = {
diff --git a/drivers/net/dsa/microchip/ksz_common.h b/drivers/net/dsa/microchip/ksz_common.h
index c678fc6597dc..1155b39350c2 100644
--- a/drivers/net/dsa/microchip/ksz_common.h
+++ b/drivers/net/dsa/microchip/ksz_common.h
@@ -140,6 +140,7 @@ struct ksz_chip_data {
const struct regmap_access_table *wr_table;
const struct regmap_access_table *rd_table;
const u8 n_pins;
+ const u8 n_per_out;
};
struct ksz_irq {
diff --git a/drivers/net/dsa/microchip/ksz_ptp.c b/drivers/net/dsa/microchip/ksz_ptp.c
index c92936bf78d3..f80015250e5a 100644
--- a/drivers/net/dsa/microchip/ksz_ptp.c
+++ b/drivers/net/dsa/microchip/ksz_ptp.c
@@ -1051,7 +1051,7 @@ int ksz_ptp_clock_register(struct dsa_switch *ds)
ptp_data->caps.enable = ksz_ptp_enable;
ptp_data->caps.verify = ksz_ptp_verify_pin;
ptp_data->caps.n_pins = dev->info->n_pins;
- ptp_data->caps.n_per_out = 3;
+ ptp_data->caps.n_per_out = dev->info->n_per_out;
ret = ksz_ptp_start_clock(dev);
if (ret)
--
2.55.0