Add support for pc speaker
[openwrt.git] / target / linux / ixp4xx / patches-2.6.29 / 205-npe_driver_separate_phy_functions.patch
1 --- a/drivers/net/arm/ixp4xx_eth.c
2 +++ b/drivers/net/arm/ixp4xx_eth.c
3 @@ -394,6 +394,53 @@ static void ixp4xx_adjust_link(struct ne
4 dev->name, port->speed, port->duplex ? "full" : "half");
5 }
6
7 +static int ixp4xx_phy_connect(struct net_device *dev)
8 +{
9 + struct port *port = netdev_priv(dev);
10 + struct eth_plat_info *plat = port->plat;
11 + char phy_id[BUS_ID_SIZE];
12 +
13 + snprintf(phy_id, BUS_ID_SIZE, PHY_ID_FMT, "0", plat->phy);
14 + port->phydev = phy_connect(dev, phy_id, &ixp4xx_adjust_link, 0,
15 + PHY_INTERFACE_MODE_MII);
16 + if (IS_ERR(port->phydev)) {
17 + printk(KERN_ERR "%s: Could not attach to PHY\n", dev->name);
18 + return PTR_ERR(port->phydev);
19 + }
20 +
21 + /* mask with MAC supported features */
22 + port->phydev->supported &= PHY_BASIC_FEATURES;
23 + port->phydev->advertising = port->phydev->supported;
24 +
25 + port->phydev->irq = PHY_POLL;
26 +
27 + printk(KERN_INFO "%s: MII PHY %i on %s\n", dev->name, plat->phy,
28 + npe_name(port->npe));
29 +
30 + return 0;
31 +}
32 +
33 +static void ixp4xx_phy_disconnect(struct net_device *dev)
34 +{
35 + struct port *port = netdev_priv(dev);
36 +
37 + phy_disconnect(port->phydev);
38 +}
39 +
40 +static void ixp4xx_phy_start(struct net_device *dev)
41 +{
42 + struct port *port = netdev_priv(dev);
43 +
44 + port->speed = 0; /* force "link up" message */
45 + phy_start(port->phydev);
46 +}
47 +
48 +static void ixp4xx_phy_stop(struct net_device *dev)
49 +{
50 + struct port *port = netdev_priv(dev);
51 +
52 + phy_stop(port->phydev);
53 +}
54
55 static inline void debug_pkt(struct net_device *dev, const char *func,
56 u8 *data, int len)
57 @@ -1001,8 +1048,7 @@ static int eth_open(struct net_device *d
58 return err;
59 }
60
61 - port->speed = 0; /* force "link up" message */
62 - phy_start(port->phydev);
63 + ixp4xx_phy_start(dev);
64
65 for (i = 0; i < ETH_ALEN; i++)
66 __raw_writel(dev->dev_addr[i], &port->regs->hw_addr[i]);
67 @@ -1123,7 +1169,7 @@ static int eth_close(struct net_device *
68 printk(KERN_CRIT "%s: unable to disable loopback\n",
69 dev->name);
70
71 - phy_stop(port->phydev);
72 + ixp4xx_phy_stop(dev);
73
74 if (!ports_open)
75 qmgr_disable_irq(TXDONE_QUEUE);
76 @@ -1147,7 +1193,6 @@ static int __devinit eth_init_one(struct
77 struct net_device *dev;
78 struct eth_plat_info *plat = pdev->dev.platform_data;
79 u32 regs_phys;
80 - char phy_id[BUS_ID_SIZE];
81 int err;
82
83 if (!(dev = alloc_etherdev(sizeof(struct port))))
84 @@ -1210,22 +1255,9 @@ static int __devinit eth_init_one(struct
85 __raw_writel(DEFAULT_CORE_CNTRL, &port->regs->core_control);
86 udelay(50);
87
88 - snprintf(phy_id, BUS_ID_SIZE, PHY_ID_FMT, "0", plat->phy);
89 - port->phydev = phy_connect(dev, phy_id, &ixp4xx_adjust_link, 0,
90 - PHY_INTERFACE_MODE_MII);
91 - if (IS_ERR(port->phydev)) {
92 - printk(KERN_ERR "%s: Could not attach to PHY\n", dev->name);
93 - return PTR_ERR(port->phydev);
94 - }
95 -
96 - /* mask with MAC supported features */
97 - port->phydev->supported &= PHY_BASIC_FEATURES;
98 - port->phydev->advertising = port->phydev->supported;
99 -
100 - port->phydev->irq = PHY_POLL;
101 -
102 - printk(KERN_INFO "%s: MII PHY %i on %s\n", dev->name, plat->phy,
103 - npe_name(port->npe));
104 + err = ixp4xx_phy_connect(dev);
105 + if (err)
106 + goto err_unreg;
107
108 return 0;
109
110 @@ -1243,7 +1275,7 @@ static int __devexit eth_remove_one(stru
111 struct net_device *dev = platform_get_drvdata(pdev);
112 struct port *port = netdev_priv(dev);
113
114 - phy_disconnect(port->phydev);
115 + ixp4xx_phy_disconnect(dev);
116 unregister_netdev(dev);
117 npe_port_tab[NPE_ID(port->id)] = NULL;
118 platform_set_drvdata(pdev, NULL);
This page took 0.042987 seconds and 5 git commands to generate.