We face the issue that link change interrupt and link status may be reported by different PHY layers. As a result the link change interrupt may occur before the link status changes. Export phy_queue_state_machine to allow PHY drivers to specify a delay between link status change interrupt and link status check. v2: - change jiffies parameter type to unsigned long
Unified · Split
| @@ -29,6 +29,8 @@ · 28 unmodified lines | |||
| 29 | #include <linux/uaccess.h> | 29 | #include <linux/uaccess.h> |
| 30 | #include <linux/atomic.h> | 30 | #include <linux/atomic.h> |
| 31 | 31 | ||
| 32 | #define PHY_STATE_TIME HZ | ||
| 33 | |||
| 32 | #define PHY_STATE_STR(_state) \ | 34 | #define PHY_STATE_STR(_state) \ |
| 33 | case PHY_##_state: \ | 35 | case PHY_##_state: \ |
| 34 | return __stringify(_state); \ | 36 | return __stringify(_state); \ |
| @@ -478,12 +480,12 @@ int phy_mii_ioctl(struct phy_device *phydev, struct ifreq *ifr, int cmd) · 443 unmodified lines | |||
| 478 | } | 480 | } |
| 479 | EXPORT_SYMBOL(phy_mii_ioctl); | 481 | EXPORT_SYMBOL(phy_mii_ioctl); |
| 480 | 482 | ||
| 481 | static void phy_queue_state_machine(struct phy_device *phydev, | 483 | void phy_queue_state_machine(struct phy_device *phydev, unsigned long jiffies) |
| 482 | unsigned int secs) | ||
| 483 | { | 484 | { |
| 484 | mod_delayed_work(system_power_efficient_wq, &phydev->state_queue, | 485 | mod_delayed_work(system_power_efficient_wq, &phydev->state_queue, |
| 485 | secs * HZ); | 486 | jiffies); |
| 486 | } | 487 | } |
| 488 | EXPORT_SYMBOL(phy_queue_state_machine); | ||
| 487 | 489 | ||
| 488 | static void phy_trigger_machine(struct phy_device *phydev) | 490 | static void phy_trigger_machine(struct phy_device *phydev) |
| 489 | { | 491 | { |
| @@ -188,7 +188,6 @@ static inline const char *phy_modes(phy_interface_t interface) · 187 unmodified lines | |||
| 188 | 188 | ||
| 189 | 189 | ||
| 190 | #define PHY_INIT_TIMEOUT 100000 | 190 | #define PHY_INIT_TIMEOUT 100000 |
| 191 | #define PHY_STATE_TIME 1 | ||
| 192 | #define PHY_FORCE_TIMEOUT 10 | 191 | #define PHY_FORCE_TIMEOUT 10 |
| 193 | 192 | ||
| 194 | #define PHY_MAX_ADDR 32 | 193 | #define PHY_MAX_ADDR 32 |
| @@ -1140,6 +1139,7 @@ int phy_driver_register(struct phy_driver *new_driver, struct module *owner); · 945 unmodified lines | |||
| 1140 | int phy_drivers_register(struct phy_driver *new_driver, int n, | 1139 | int phy_drivers_register(struct phy_driver *new_driver, int n, |
| 1141 | struct module *owner); | 1140 | struct module *owner); |
| 1142 | void phy_state_machine(struct work_struct *work); | 1141 | void phy_state_machine(struct work_struct *work); |
| 1142 | void phy_queue_state_machine(struct phy_device *phydev, unsigned long jiffies); | ||
| 1143 | void phy_mac_interrupt(struct phy_device *phydev); | 1143 | void phy_mac_interrupt(struct phy_device *phydev); |
| 1144 | void phy_start_machine(struct phy_device *phydev); | 1144 | void phy_start_machine(struct phy_device *phydev); |
| 1145 | void phy_stop_machine(struct phy_device *phydev); | 1145 | void phy_stop_machine(struct phy_device *phydev); |