@@ -1600,6 +1600,7 @@ static const char * const sja1105_reset_reasons[] = {
int sja1105_static_config_reload(struct sja1105_private *priv,
enum sja1105_reset_reason reason)
{
+ const int mask = (BMCR_SPEED1000 | BMCR_SPEED100 | BMCR_SPEED10);
struct ptp_system_timestamp ptp_sts_before;
struct ptp_system_timestamp ptp_sts_after;
struct sja1105_mac_config_entry *mac;
@@ -1684,14 +1685,16 @@ int sja1105_static_config_reload(struct sja1105_private *priv,
sja1105_sgmii_pcs_config(priv, an_enabled, false);
if (!an_enabled) {
- int speed = SPEED_UNKNOWN;
+ int speed;
- if (bmcr & BMCR_SPEED1000)
+ if ((bmcr & mask) == BMCR_SPEED1000)
speed = SPEED_1000;
- else if (bmcr & BMCR_SPEED100)
+ else if ((bmcr & mask) == BMCR_SPEED100)
speed = SPEED_100;
- else if (bmcr & BMCR_SPEED10)
+ else if ((bmcr & mask) == BMCR_SPEED10)
speed = SPEED_10;
+ else
+ speed = SPEED_UNKNOWN;
sja1105_sgmii_pcs_force_speed(priv, speed);
}