In the early days of phylib we had a functionality that changed to the next lower speed in fixed mode if no link was established after a certain period of time. This functionality has been removed years ago, and state PHY_FORCING isn't needed any longer. Instead we can go from UP to RUNNING or NOLINK directly (same as in autoneg mode).
Unified · Split
| @@ -43,7 +43,6 @@ static const char *phy_state_to_str(enum phy_state st) · 42 unmodified lines | |||
| 43 | PHY_STATE_STR(UP) | 43 | PHY_STATE_STR(UP) |
| 44 | PHY_STATE_STR(RUNNING) | 44 | PHY_STATE_STR(RUNNING) |
| 45 | PHY_STATE_STR(NOLINK) | 45 | PHY_STATE_STR(NOLINK) |
| 46 | PHY_STATE_STR(FORCING) | ||
| 47 | PHY_STATE_STR(HALTED) | 46 | PHY_STATE_STR(HALTED) |
| 48 | } | 47 | } |
| 49 | 48 | ||
| @@ -577,15 +576,8 @@ int phy_start_aneg(struct phy_device *phydev) · 527 unmodified lines | |||
| 577 | if (err < 0) | 576 | if (err < 0) |
| 578 | goto out_unlock; | 577 | goto out_unlock; |
| 579 | 578 | ||
| 580 | if (phy_is_started(phydev)) { | 579 | if (phy_is_started(phydev)) |
| 581 | if (phydev->autoneg == AUTONEG_ENABLE) { | 580 | err = phy_check_link_status(phydev); |
| 582 | err = phy_check_link_status(phydev); | ||
| 583 | } else { | ||
| 584 | phydev->state = PHY_FORCING; | ||
| 585 | phydev->link_timeout = PHY_FORCE_TIMEOUT; | ||
| 586 | } | ||
| 587 | } | ||
| 588 | |||
| 589 | out_unlock: | 581 | out_unlock: |
| 590 | mutex_unlock(&phydev->lock); | 582 | mutex_unlock(&phydev->lock); |
| 591 | 583 | ||
| @@ -951,20 +943,6 @@ void phy_state_machine(struct work_struct *work) · 359 unmodified lines | |||
| 951 | case PHY_RUNNING: | 943 | case PHY_RUNNING: |
| 952 | err = phy_check_link_status(phydev); | 944 | err = phy_check_link_status(phydev); |
| 953 | break; | 945 | break; |
| 954 | case PHY_FORCING: | ||
| 955 | err = genphy_update_link(phydev); | ||
| 956 | if (err) | ||
| 957 | break; | ||
| 958 | |||
| 959 | if (phydev->link) { | ||
| 960 | phydev->state = PHY_RUNNING; | ||
| 961 | phy_link_up(phydev); | ||
| 962 | } else { | ||
| 963 | if (0 == phydev->link_timeout--) | ||
| 964 | needs_aneg = true; | ||
| 965 | phy_link_down(phydev, false); | ||
| 966 | } | ||
| 967 | break; | ||
| 968 | case PHY_HALTED: | 946 | case PHY_HALTED: |
| 969 | if (phydev->link) { | 947 | if (phydev->link) { |
| 970 | phydev->link = 0; | 948 | phydev->link = 0; |
| @@ -297,12 +297,6 @@ struct phy_device *mdiobus_scan(struct mii_bus *bus, int addr); · 296 unmodified lines | |||
| 297 | * - irq or timer will set RUNNING if link comes back | 297 | * - irq or timer will set RUNNING if link comes back |
| 298 | * - phy_stop moves to HALTED | 298 | * - phy_stop moves to HALTED |
| 299 | * | 299 | * |
| 300 | * FORCING: PHY is being configured with forced settings | ||
| 301 | * - if link is up, move to RUNNING | ||
| 302 | * - If link is down, we drop to the next highest setting, and | ||
| 303 | * retry (FORCING) after a timeout | ||
| 304 | * - phy_stop moves to HALTED | ||
| 305 | * | ||
| 306 | * RUNNING: PHY is currently up, running, and possibly sending | 300 | * RUNNING: PHY is currently up, running, and possibly sending |
| 307 | * and/or receiving packets | 301 | * and/or receiving packets |
| 308 | * - irq or timer will set NOLINK if link goes down | 302 | * - irq or timer will set NOLINK if link goes down |
| @@ -319,7 +313,6 @@ enum phy_state { · 10 unmodified lines | |||
| 319 | PHY_UP, | 313 | PHY_UP, |
| 320 | PHY_RUNNING, | 314 | PHY_RUNNING, |
| 321 | PHY_NOLINK, | 315 | PHY_NOLINK, |
| 322 | PHY_FORCING, | ||
| 323 | }; | 316 | }; |
| 324 | 317 | ||
| 325 | /** | 318 | /** |
| @@ -347,8 +340,6 @@ struct phy_c45_device_ids { · 21 unmodified lines | |||
| 347 | * loopback_enabled: Set true if this phy has been loopbacked successfully. | 340 | * loopback_enabled: Set true if this phy has been loopbacked successfully. |
| 348 | * state: state of the PHY for management purposes | 341 | * state: state of the PHY for management purposes |
| 349 | * dev_flags: Device-specific flags used by the PHY driver. | 342 | * dev_flags: Device-specific flags used by the PHY driver. |
| 350 | * link_timeout: The number of timer firings to wait before the | ||
| 351 | * giving up on the current attempt at acquiring a link | ||
| 352 | * irq: IRQ number of the PHY's interrupt (-1 if none) | 343 | * irq: IRQ number of the PHY's interrupt (-1 if none) |
| 353 | * phy_timer: The timer for handling the state machine | 344 | * phy_timer: The timer for handling the state machine |
| 354 | * attached_dev: The attached enet driver's device instance ptr | 345 | * attached_dev: The attached enet driver's device instance ptr |
| @@ -416,8 +407,6 @@ struct phy_device { · 61 unmodified lines | |||
| 416 | /* Energy efficient ethernet modes which should be prohibited */ | 407 | /* Energy efficient ethernet modes which should be prohibited */ |
| 417 | u32 eee_broken_modes; | 408 | u32 eee_broken_modes; |
| 418 | 409 | ||
| 419 | int link_timeout; | ||
| 420 | |||
| 421 | #ifdef CONFIG_LED_TRIGGER_PHY | 410 | #ifdef CONFIG_LED_TRIGGER_PHY |
| 422 | struct phy_led_trigger *phy_led_triggers; | 411 | struct phy_led_trigger *phy_led_triggers; |
| 423 | unsigned int phy_num_led_triggers; | 412 | unsigned int phy_num_led_triggers; |