#include <asm/irq.h>
#include <asm/uaccess.h>
-static void phy_change(void *data);
-static void phy_timer(unsigned long data);
-
/* Convenience function to print out the current phy status
*/
void phy_print_status(struct phy_device *phydev)
return (retval < 0) ? retval : (retval & BMSR_ANEGCOMPLETE);
}
-/* phy_start_aneg
- *
- * description: Calls the PHY driver's config_aneg, and then
- * sets the PHY state to PHY_AN if auto-negotiation is enabled,
- * and to PHY_FORCING if auto-negotiation is disabled. Unless
- * the PHY is currently HALTED.
- */
-int phy_start_aneg(struct phy_device *phydev)
-{
- int err;
-
- spin_lock(&phydev->lock);
-
- if (AUTONEG_DISABLE == phydev->autoneg)
- phy_sanitize_settings(phydev);
-
- err = phydev->drv->config_aneg(phydev);
-
- if (err < 0)
- goto out_unlock;
-
- if (phydev->state != PHY_HALTED) {
- if (AUTONEG_ENABLE == phydev->autoneg) {
- phydev->state = PHY_AN;
- phydev->link_timeout = PHY_AN_TIMEOUT;
- } else {
- phydev->state = PHY_FORCING;
- phydev->link_timeout = PHY_FORCE_TIMEOUT;
- }
- }
-
-out_unlock:
- spin_unlock(&phydev->lock);
- return err;
-}
-EXPORT_SYMBOL(phy_start_aneg);
-
-
/* A structure for mapping a particular speed and duplex
* combination to a particular SUPPORTED and ADVERTISED value */
struct phy_setting {
}
EXPORT_SYMBOL(phy_sanitize_settings);
-/* phy_force_reduction
- *
- * description: Reduces the speed/duplex settings by
- * one notch. The order is so:
- * 1000/FULL, 1000/HALF, 100/FULL, 100/HALF,
- * 10/FULL, 10/HALF. The function bottoms out at 10/HALF.
- */
-static void phy_force_reduction(struct phy_device *phydev)
-{
- int idx;
-
- idx = phy_find_setting(phydev->speed, phydev->duplex);
-
- idx++;
-
- idx = phy_find_valid(idx, phydev->supported);
-
- phydev->speed = settings[idx].speed;
- phydev->duplex = settings[idx].duplex;
-
- pr_info("Trying %d/%s\n", phydev->speed,
- DUPLEX_FULL == phydev->duplex ?
- "FULL" : "HALF");
-}
-
/* phy_ethtool_sset:
* A generic ethtool sset function. Handles all the details
*
* - phy_start_aneg() will make sure forced settings are sane, and
* choose the next best ones from the ones selected, so we don't
* care if ethtool tries to give us bad values
+ *
*/
int phy_ethtool_sset(struct phy_device *phydev, struct ethtool_cmd *cmd)
{
return 0;
}
+/* phy_start_aneg
+ *
+ * description: Sanitizes the settings (if we're not
+ * autonegotiating them), and then calls the driver's
+ * config_aneg function. If the PHYCONTROL Layer is operating,
+ * we change the state to reflect the beginning of
+ * Auto-negotiation or forcing.
+ */
+int phy_start_aneg(struct phy_device *phydev)
+{
+ int err;
+
+ spin_lock(&phydev->lock);
+
+ if (AUTONEG_DISABLE == phydev->autoneg)
+ phy_sanitize_settings(phydev);
+
+ err = phydev->drv->config_aneg(phydev);
+
+ if (err < 0)
+ goto out_unlock;
+
+ if (phydev->state != PHY_HALTED) {
+ if (AUTONEG_ENABLE == phydev->autoneg) {
+ phydev->state = PHY_AN;
+ phydev->link_timeout = PHY_AN_TIMEOUT;
+ } else {
+ phydev->state = PHY_FORCING;
+ phydev->link_timeout = PHY_FORCE_TIMEOUT;
+ }
+ }
+
+out_unlock:
+ spin_unlock(&phydev->lock);
+ return err;
+}
+EXPORT_SYMBOL(phy_start_aneg);
+
+
+static void phy_change(void *data);
+static void phy_timer(unsigned long data);
+
/* phy_start_machine:
*
* description: The PHY infrastructure can run a state machine
phydev->adjust_state = NULL;
}
-#ifdef CONFIG_PHYCONTROL
+/* phy_force_reduction
+ *
+ * description: Reduces the speed/duplex settings by
+ * one notch. The order is so:
+ * 1000/FULL, 1000/HALF, 100/FULL, 100/HALF,
+ * 10/FULL, 10/HALF. The function bottoms out at 10/HALF.
+ */
+static void phy_force_reduction(struct phy_device *phydev)
+{
+ int idx;
+
+ idx = phy_find_setting(phydev->speed, phydev->duplex);
+
+ idx++;
+
+ idx = phy_find_valid(idx, phydev->supported);
+
+ phydev->speed = settings[idx].speed;
+ phydev->duplex = settings[idx].duplex;
+
+ pr_info("Trying %d/%s\n", phydev->speed,
+ DUPLEX_FULL == phydev->duplex ?
+ "FULL" : "HALF");
+}
+
+
/* phy_error:
*
* Moves the PHY to the HALTED state in response to a read
mod_timer(&phydev->phy_timer, jiffies + PHY_STATE_TIME * HZ);
}
-#endif /* CONFIG_PHYCONTROL */