kernel: add missing symbols
[openwrt.git] / target / linux / atheros / patches-2.6.32 / 220-enet_micrel_workaround.patch
1 --- a/drivers/net/ar231x.c
2 +++ b/drivers/net/ar231x.c
3 @@ -148,6 +148,7 @@ static int ar231x_mdiobus_write(struct m
4 static int ar231x_mdiobus_reset(struct mii_bus *bus);
5 static int ar231x_mdiobus_probe (struct net_device *dev);
6 static void ar231x_adjust_link(struct net_device *dev);
7 +static bool no_phy = false;
8
9 #ifndef ERR
10 #define ERR(fmt, args...) printk("%s: " fmt, __func__, ##args)
11 @@ -278,6 +279,21 @@ int __init ar231x_probe(struct platform_
12
13 mdiobus_register(sp->mii_bus);
14
15 + /* Workaround for Micrel switch, which is only available on
16 + * one PHY and cannot be configured through MDIO */
17 + if (!no_phy) {
18 + u32 phy_id = 0;
19 + get_phy_id(sp->mii_bus, 1, &phy_id);
20 + if (phy_id == 0x00221450)
21 + no_phy = true;
22 + }
23 + if (no_phy) {
24 + sp->link = 1;
25 + netif_carrier_on(dev);
26 + return 0;
27 + }
28 + no_phy = true;
29 +
30 if (ar231x_mdiobus_probe(dev) != 0) {
31 printk(KERN_ERR "%s: mdiobus_probe failed\n", dev->name);
32 rx_tasklet_cleanup(dev);
33 @@ -334,8 +350,10 @@ static int __exit ar231x_remove(struct p
34 rx_tasklet_cleanup(dev);
35 ar231x_init_cleanup(dev);
36 unregister_netdev(dev);
37 - mdiobus_unregister(sp->mii_bus);
38 - mdiobus_free(sp->mii_bus);
39 + if (sp->mii_bus) {
40 + mdiobus_unregister(sp->mii_bus);
41 + mdiobus_free(sp->mii_bus);
42 + }
43 kfree(dev);
44 return 0;
45 }
46 @@ -836,7 +854,12 @@ static int ar231x_rx_int(struct net_devi
47 dev->stats.rx_bytes += skb->len;
48
49 /* pass the packet to upper layers */
50 - sp->rx(skb);
51 + if (sp->rx) {
52 + sp->rx(skb);
53 + } else {
54 + skb->protocol = eth_type_trans(skb, skb->dev);
55 + netif_rx(skb);
56 + }
57 skb_new->dev = dev;
58
59 /* 16 bit align */
60 @@ -1123,6 +1146,9 @@ static int ar231x_ioctl(struct net_devic
61 struct ar231x_private *sp = netdev_priv(dev);
62 int ret;
63
64 + if (!sp->phy_dev)
65 + return -ENODEV;
66 +
67 switch (cmd) {
68
69 case SIOCETHTOOL:
This page took 0.045263 seconds and 5 git commands to generate.