[kernel] refresh 2.6.35 patches
[openwrt/svn-archive/archive.git] / target / linux / generic / patches-2.6.35 / 601-phy-add-aneg-done-function.patch
1 --- a/include/linux/phy.h
2 +++ b/include/linux/phy.h
3 @@ -384,9 +384,18 @@ struct phy_driver {
4 */
5 int (*config_aneg)(struct phy_device *phydev);
6
7 + /* Determine if autonegotiation is done */
8 + int (*aneg_done)(struct phy_device *phydev);
9 +
10 /* Determines the negotiated speed and duplex */
11 int (*read_status)(struct phy_device *phydev);
12
13 + /*
14 + * Update the value in phydev->link to reflect the
15 + * current link value
16 + */
17 + int (*update_link)(struct phy_device *phydev);
18 +
19 /* Clears any pending interrupts */
20 int (*ack_interrupt)(struct phy_device *phydev);
21
22 --- a/drivers/net/phy/phy_device.c
23 +++ b/drivers/net/phy/phy_device.c
24 @@ -710,6 +710,9 @@ int genphy_update_link(struct phy_device
25 {
26 int status;
27
28 + if (phydev->drv->update_link)
29 + return phydev->drv->update_link(phydev);
30 +
31 /* Do a fake read */
32 status = phy_read(phydev, MII_BMSR);
33
34 --- a/drivers/net/phy/phy.c
35 +++ b/drivers/net/phy/phy.c
36 @@ -106,6 +106,9 @@ static inline int phy_aneg_done(struct p
37 {
38 int retval;
39
40 + if (phydev->drv->aneg_done)
41 + return phydev->drv->aneg_done(phydev);
42 +
43 retval = phy_read(phydev, MII_BMSR);
44
45 return (retval < 0) ? retval : (retval & BMSR_ANEGCOMPLETE);