[package] udev: bump to 173
[openwrt.git] / target / linux / generic / patches-2.6.36 / 600-phy_extension.patch
1 --- a/drivers/net/phy/phy.c
2 +++ b/drivers/net/phy/phy.c
3 @@ -298,6 +298,50 @@ int phy_ethtool_gset(struct phy_device *
4 }
5 EXPORT_SYMBOL(phy_ethtool_gset);
6
7 +int phy_ethtool_ioctl(struct phy_device *phydev, void *useraddr)
8 +{
9 + u32 cmd;
10 + int tmp;
11 + struct ethtool_cmd ecmd = { ETHTOOL_GSET };
12 + struct ethtool_value edata = { ETHTOOL_GLINK };
13 +
14 + if (get_user(cmd, (u32 *) useraddr))
15 + return -EFAULT;
16 +
17 + switch (cmd) {
18 + case ETHTOOL_GSET:
19 + phy_ethtool_gset(phydev, &ecmd);
20 + if (copy_to_user(useraddr, &ecmd, sizeof(ecmd)))
21 + return -EFAULT;
22 + return 0;
23 +
24 + case ETHTOOL_SSET:
25 + if (copy_from_user(&ecmd, useraddr, sizeof(ecmd)))
26 + return -EFAULT;
27 + return phy_ethtool_sset(phydev, &ecmd);
28 +
29 + case ETHTOOL_NWAY_RST:
30 + /* if autoneg is off, it's an error */
31 + tmp = phy_read(phydev, MII_BMCR);
32 + if (tmp & BMCR_ANENABLE) {
33 + tmp |= (BMCR_ANRESTART);
34 + phy_write(phydev, MII_BMCR, tmp);
35 + return 0;
36 + }
37 + return -EINVAL;
38 +
39 + case ETHTOOL_GLINK:
40 + edata.data = (phy_read(phydev,
41 + MII_BMSR) & BMSR_LSTATUS) ? 1 : 0;
42 + if (copy_to_user(useraddr, &edata, sizeof(edata)))
43 + return -EFAULT;
44 + return 0;
45 + }
46 +
47 + return -EOPNOTSUPP;
48 +}
49 +EXPORT_SYMBOL(phy_ethtool_ioctl);
50 +
51 /**
52 * phy_mii_ioctl - generic PHY MII ioctl interface
53 * @phydev: the phy_device struct
54 @@ -352,7 +396,7 @@ int phy_mii_ioctl(struct phy_device *phy
55 }
56
57 phy_write(phydev, mii_data->reg_num, val);
58 -
59 +
60 if (mii_data->reg_num == MII_BMCR &&
61 val & BMCR_RESET &&
62 phydev->drv->config_init) {
63 @@ -471,7 +515,7 @@ static void phy_force_reduction(struct p
64 int idx;
65
66 idx = phy_find_setting(phydev->speed, phydev->duplex);
67 -
68 +
69 idx++;
70
71 idx = phy_find_valid(idx, phydev->supported);
72 --- a/include/linux/phy.h
73 +++ b/include/linux/phy.h
74 @@ -519,6 +519,7 @@ void phy_start_machine(struct phy_device
75 void phy_stop_machine(struct phy_device *phydev);
76 int phy_ethtool_sset(struct phy_device *phydev, struct ethtool_cmd *cmd);
77 int phy_ethtool_gset(struct phy_device *phydev, struct ethtool_cmd *cmd);
78 +int phy_ethtool_ioctl(struct phy_device *phydev, void *useraddr);
79 int phy_mii_ioctl(struct phy_device *phydev,
80 struct ifreq *ifr, int cmd);
81 int phy_start_interrupts(struct phy_device *phydev);
This page took 0.047535 seconds and 5 git commands to generate.