update iptables to 1.4.0 (2.6 kernels only), refresh kernel patches
[openwrt/svn-archive/archive.git] / target / linux / generic-2.6 / patches-2.6.23 / 600-phy_extension.patch
1 Index: linux-2.6.23/drivers/net/phy/phy.c
2 ===================================================================
3 --- linux-2.6.23.orig/drivers/net/phy/phy.c 2007-10-14 00:05:26.000000000 +0200
4 +++ linux-2.6.23/drivers/net/phy/phy.c 2007-10-14 00:44:21.000000000 +0200
5 @@ -344,6 +344,50 @@
6 }
7 EXPORT_SYMBOL(phy_ethtool_gset);
8
9 +int phy_ethtool_ioctl(struct phy_device *phydev, void *useraddr)
10 +{
11 + u32 cmd;
12 + int tmp;
13 + struct ethtool_cmd ecmd = { ETHTOOL_GSET };
14 + struct ethtool_value edata = { ETHTOOL_GLINK };
15 +
16 + if (get_user(cmd, (u32 *) useraddr))
17 + return -EFAULT;
18 +
19 + switch (cmd) {
20 + case ETHTOOL_GSET:
21 + phy_ethtool_gset(phydev, &ecmd);
22 + if (copy_to_user(useraddr, &ecmd, sizeof(ecmd)))
23 + return -EFAULT;
24 + return 0;
25 +
26 + case ETHTOOL_SSET:
27 + if (copy_from_user(&ecmd, useraddr, sizeof(ecmd)))
28 + return -EFAULT;
29 + return phy_ethtool_sset(phydev, &ecmd);
30 +
31 + case ETHTOOL_NWAY_RST:
32 + /* if autoneg is off, it's an error */
33 + tmp = phy_read(phydev, MII_BMCR);
34 + if (tmp & BMCR_ANENABLE) {
35 + tmp |= (BMCR_ANRESTART);
36 + phy_write(phydev, MII_BMCR, tmp);
37 + return 0;
38 + }
39 + return -EINVAL;
40 +
41 + case ETHTOOL_GLINK:
42 + edata.data = (phy_read(phydev,
43 + MII_BMSR) & BMSR_LSTATUS) ? 1 : 0;
44 + if (copy_to_user(useraddr, &edata, sizeof(edata)))
45 + return -EFAULT;
46 + return 0;
47 + }
48 +
49 + return -EOPNOTSUPP;
50 +}
51 +EXPORT_SYMBOL(phy_ethtool_ioctl);
52 +
53 /**
54 * phy_mii_ioctl - generic PHY MII ioctl interface
55 * @phydev: the phy_device struct
56 Index: linux-2.6.23/include/linux/phy.h
57 ===================================================================
58 --- linux-2.6.23.orig/include/linux/phy.h 2007-10-14 00:05:15.000000000 +0200
59 +++ linux-2.6.23/include/linux/phy.h 2007-10-14 00:18:54.000000000 +0200
60 @@ -393,6 +393,7 @@
61 void phy_stop_machine(struct phy_device *phydev);
62 int phy_ethtool_sset(struct phy_device *phydev, struct ethtool_cmd *cmd);
63 int phy_ethtool_gset(struct phy_device *phydev, struct ethtool_cmd *cmd);
64 +int phy_ethtool_ioctl(struct phy_device *phydev, void *useraddr);
65 int phy_mii_ioctl(struct phy_device *phydev,
66 struct mii_ioctl_data *mii_data, int cmd);
67 int phy_start_interrupts(struct phy_device *phydev);