diff options
| author | Bastien Curutchet (Schneider Electric) <bastien.curutchet@bootlin.com> | 2026-09-25 13:38:50 +0200 |
|---|---|---|
| committer | Jakub Kicinski <kuba@kernel.org> | 2026-09-30 17:02:01 -0700 |
| commit | 3336fa2007184dc900fcedabca887137bbebc421 (patch) | |
| tree | 4861cb4aad2eff4640f5e6068706bf3825a46889 /drivers/net | |
| parent | 7242c96652e3d2be2c9fe472f73f39c2c27bc221 (diff) | |
net: dsa: microchip: use dynamic mask to check pulse width validity
The pulse width validity is checked against an hardcoded mask. KSZ8463
uses a smaller register than other switches so this check won't work for
it.
Move the mask as a ksz_ptp_tou_pulse_verify()'s input to allow changing
it for KSZ8463 case.
Signed-off-by: Bastien Curutchet (Schneider Electric) <bastien.curutchet@bootlin.com>
Link: https://patch.msgid.link/20260925-ksz-perout-v4-4-d675bd21ce49@bootlin.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'drivers/net')
| -rw-r--r-- | drivers/net/dsa/microchip/ksz_ptp.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/net/dsa/microchip/ksz_ptp.c b/drivers/net/dsa/microchip/ksz_ptp.c index 84c799959aaa..1889698691e9 100644 --- a/drivers/net/dsa/microchip/ksz_ptp.c +++ b/drivers/net/dsa/microchip/ksz_ptp.c @@ -86,7 +86,7 @@ static int ksz_ptp_tou_reset(struct ksz_device *dev, u8 unit) 0); } -static int ksz_ptp_tou_pulse_verify(u64 pulse_ns) +static int ksz_ptp_tou_pulse_verify(u64 pulse_ns, u32 mask) { u32 data; @@ -94,7 +94,7 @@ static int ksz_ptp_tou_pulse_verify(u64 pulse_ns) return -EINVAL; data = (pulse_ns / 8); - if (!FIELD_FIT(TRIG_PULSE_WIDTH_M, data)) + if ((mask & data) != data) return -ERANGE; return 0; @@ -242,7 +242,7 @@ static int ksz_ptp_enable_perout(struct ksz_device *dev, KSZ_MAX_PULSE_WIDTH); } - ret = ksz_ptp_tou_pulse_verify(pulse_width_ns); + ret = ksz_ptp_tou_pulse_verify(pulse_width_ns, TRIG_PULSE_WIDTH_M); if (ret) return ret; |
