Skip to content

Commit 4f91989

Browse files
RengarajanSSgregkh
authored andcommitted
net: microchip: lan743x: Reduce PTP timeout on HW failure
[ Upstream commit b1de3c0df7abc41dc41862c0b08386411f2799d7 ] The PTP_CMD_CTL is a self clearing register which controls the PTP clock values. In the current implementation driver waits for a duration of 20 sec in case of HW failure to clear the PTP_CMD_CTL register bit. This timeout of 20 sec is very long to recognize a HW failure, as it is typically cleared in one clock(<16ns). Hence reducing the timeout to 1 sec would be sufficient to conclude if there is any HW failure observed. The usleep_range will sleep somewhere between 1 msec to 20 msec for each iteration. By setting the PTP_CMD_CTL_TIMEOUT_CNT to 50 the max timeout is extended to 1 sec. Signed-off-by: Rengarajan S <[email protected]> Reviewed-by: Simon Horman <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Paolo Abeni <[email protected]> Stable-dep-of: e353b0854d3a ("net: lan743x: fix potential out-of-bounds write in lan743x_ptp_io_event_clock_get()") Signed-off-by: Sasha Levin <[email protected]>
1 parent 9eaabb0 commit 4f91989

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

drivers/net/ethernet/microchip/lan743x_ptp.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ int lan743x_gpio_init(struct lan743x_adapter *adapter)
5858
static void lan743x_ptp_wait_till_cmd_done(struct lan743x_adapter *adapter,
5959
u32 bit_mask)
6060
{
61-
int timeout = 1000;
61+
int timeout = PTP_CMD_CTL_TIMEOUT_CNT;
6262
u32 data = 0;
6363

6464
while (timeout &&

drivers/net/ethernet/microchip/lan743x_ptp.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
#define LAN743X_PTP_N_EXTTS 4
2222
#define LAN743X_PTP_N_PPS 0
2323
#define PCI11X1X_PTP_IO_MAX_CHANNELS 8
24+
#define PTP_CMD_CTL_TIMEOUT_CNT 50
2425

2526
struct lan743x_adapter;
2627

0 commit comments

Comments
 (0)