Commit d7d94b26 authored by Casper Andersson's avatar Casper Andersson Committed by David S. Miller

net: microchip: sparx5: fix PTP init/deinit not checking all ports

Check all ports instead of just port_count ports. PTP init was only
checking ports 0 to port_count. If the hardware ports are not mapped
starting from 0 then they would be missed, e.g. if only ports 20-30 were
mapped it would attempt to init ports 0-10, resulting in NULL pointers
when attempting to timestamp. Now it will init all mapped ports.

Fixes: 70dfe25c ("net: sparx5: Update extraction/injection for timestamping")
Signed-off-by: default avatarCasper Andersson <casper.casan@gmail.com>
Reviewed-by: default avatarHoratiu Vultur <horatiu.vultur@microchip.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 03702d4d
...@@ -633,7 +633,7 @@ int sparx5_ptp_init(struct sparx5 *sparx5) ...@@ -633,7 +633,7 @@ int sparx5_ptp_init(struct sparx5 *sparx5)
/* Enable master counters */ /* Enable master counters */
spx5_wr(PTP_PTP_DOM_CFG_PTP_ENA_SET(0x7), sparx5, PTP_PTP_DOM_CFG); spx5_wr(PTP_PTP_DOM_CFG_PTP_ENA_SET(0x7), sparx5, PTP_PTP_DOM_CFG);
for (i = 0; i < sparx5->port_count; i++) { for (i = 0; i < SPX5_PORTS; i++) {
port = sparx5->ports[i]; port = sparx5->ports[i];
if (!port) if (!port)
continue; continue;
...@@ -649,7 +649,7 @@ void sparx5_ptp_deinit(struct sparx5 *sparx5) ...@@ -649,7 +649,7 @@ void sparx5_ptp_deinit(struct sparx5 *sparx5)
struct sparx5_port *port; struct sparx5_port *port;
int i; int i;
for (i = 0; i < sparx5->port_count; i++) { for (i = 0; i < SPX5_PORTS; i++) {
port = sparx5->ports[i]; port = sparx5->ports[i];
if (!port) if (!port)
continue; continue;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment