strip the kernel version suffix from target directories, except for brcm-2.4 (the...
[openwrt/openwrt.git] / target / linux / ixp4xx / patches / 140-ixp4xx_net_driver_no_phy.patch
1 diff -Nur linux-2.6.19.2/drivers/net/ixp4xx/mac_driver.c linux-2.6.19.2-owrt/drivers/net/ixp4xx/mac_driver.c
2 --- linux-2.6.19.2/drivers/net/ixp4xx/mac_driver.c 2007-04-15 14:26:54.000000000 +0200
3 +++ linux-2.6.19.2-owrt/drivers/net/ixp4xx/mac_driver.c 2007-04-15 14:33:44.000000000 +0200
4 @@ -161,6 +161,16 @@
5 {
6 struct mac_info *mac = netdev_priv(dev);
7
8 + if ( mac->mii.phy_id < 0 ) {
9 + if ( init ) {
10 + netif_carrier_on(mac->mii.dev);
11 + mac->mii.full_duplex = 1;
12 + update_duplex_mode(dev);
13 + return 1;
14 + }
15 + return 0;
16 + }
17 +
18 if (mii_check_media(&mac->mii, netif_msg_link(mac), init)) {
19 update_duplex_mode(dev);
20 return 1;
21 @@ -458,7 +468,12 @@
22 return -EINVAL;
23 if (!try_module_get(THIS_MODULE))
24 return -ENODEV;
25 - rc = generic_mii_ioctl(&mac->mii, if_mii(rq), cmd, &duplex_changed);
26 + if ( mac->mii.phy_id < 0 ) {
27 + duplex_changed = 0;
28 + rc = -EOPNOTSUPP;
29 + } else {
30 + rc = generic_mii_ioctl(&mac->mii, if_mii(rq), cmd, &duplex_changed);
31 + }
32 module_put(THIS_MODULE);
33 if (duplex_changed)
34 update_duplex_mode(dev);
35 @@ -488,6 +503,9 @@
36 static int ixmac_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
37 {
38 struct mac_info *mac = netdev_priv(dev);
39 + if ( mac->mii.phy_id < 0 ) {
40 + return 0;
41 + }
42 mii_ethtool_gset(&mac->mii, cmd);
43 return 0;
44 }
45 @@ -496,6 +514,9 @@
46 {
47 struct mac_info *mac = netdev_priv(dev);
48 int rc;
49 + if ( mac->mii.phy_id < 0 ) {
50 + return -EOPNOTSUPP;
51 + }
52 rc = mii_ethtool_sset(&mac->mii, cmd);
53 return rc;
54 }
55 @@ -503,12 +524,18 @@
56 static int ixmac_nway_reset(struct net_device *dev)
57 {
58 struct mac_info *mac = netdev_priv(dev);
59 + if ( mac->mii.phy_id < 0 ) {
60 + return -EOPNOTSUPP;
61 + }
62 return mii_nway_restart(&mac->mii);
63 }
64
65 static u32 ixmac_get_link(struct net_device *dev)
66 {
67 struct mac_info *mac = netdev_priv(dev);
68 + if ( mac->mii.phy_id < 0 ) {
69 + return 1;
70 + }
71 return mii_link_ok(&mac->mii);
72 }
73