generic: ar8216: add vtu_flush field to ar8xxx_chip
[openwrt.git] / target / linux / ixp4xx / patches-2.6.38 / 205-npe_driver_separate_phy_functions.patch
1 --- a/drivers/net/arm/ixp4xx_eth.c
2 +++ b/drivers/net/arm/ixp4xx_eth.c
3 @@ -397,6 +397,50 @@ 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[MII_BUS_ID_SIZE + 3];
12 +
13 + snprintf(phy_id, MII_BUS_ID_SIZE + 3, 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 + return 0;
28 +}
29 +
30 +static void ixp4xx_phy_disconnect(struct net_device *dev)
31 +{
32 + struct port *port = netdev_priv(dev);
33 +
34 + phy_disconnect(port->phydev);
35 +}
36 +
37 +static void ixp4xx_phy_start(struct net_device *dev)
38 +{
39 + struct port *port = netdev_priv(dev);
40 +
41 + port->speed = 0; /* force "link up" message */
42 + phy_start(port->phydev);
43 +}
44 +
45 +static void ixp4xx_phy_stop(struct net_device *dev)
46 +{
47 + struct port *port = netdev_priv(dev);
48 +
49 + phy_stop(port->phydev);
50 +}
51
52 static inline void debug_pkt(struct net_device *dev, const char *func,
53 u8 *data, int len)
54 @@ -1020,8 +1064,7 @@ static int eth_open(struct net_device *d
55 return err;
56 }
57
58 - port->speed = 0; /* force "link up" message */
59 - phy_start(port->phydev);
60 + ixp4xx_phy_start(dev);
61
62 for (i = 0; i < ETH_ALEN; i++)
63 __raw_writel(dev->dev_addr[i], &port->regs->hw_addr[i]);
64 @@ -1142,7 +1185,7 @@ static int eth_close(struct net_device *
65 printk(KERN_CRIT "%s: unable to disable loopback\n",
66 dev->name);
67
68 - phy_stop(port->phydev);
69 + ixp4xx_phy_stop(dev);
70
71 if (!ports_open)
72 qmgr_disable_irq(TXDONE_QUEUE);
73 @@ -1168,7 +1211,6 @@ static int __devinit eth_init_one(struct
74 struct net_device *dev;
75 struct eth_plat_info *plat = pdev->dev.platform_data;
76 u32 regs_phys;
77 - char phy_id[MII_BUS_ID_SIZE + 3];
78 int err;
79
80 if (!(dev = alloc_etherdev(sizeof(struct port))))
81 @@ -1226,19 +1268,9 @@ static int __devinit eth_init_one(struct
82 __raw_writel(DEFAULT_CORE_CNTRL, &port->regs->core_control);
83 udelay(50);
84
85 - snprintf(phy_id, MII_BUS_ID_SIZE + 3, PHY_ID_FMT, "0", plat->phy);
86 - port->phydev = phy_connect(dev, phy_id, &ixp4xx_adjust_link, 0,
87 - PHY_INTERFACE_MODE_MII);
88 - if (IS_ERR(port->phydev)) {
89 - err = PTR_ERR(port->phydev);
90 + err = ixp4xx_phy_connect(dev);
91 + if (err)
92 goto err_free_mem;
93 - }
94 -
95 - /* mask with MAC supported features */
96 - port->phydev->supported &= PHY_BASIC_FEATURES;
97 - port->phydev->advertising = port->phydev->supported;
98 -
99 - port->phydev->irq = PHY_POLL;
100
101 if ((err = register_netdev(dev)))
102 goto err_phy_dis;
103 @@ -1249,7 +1281,7 @@ static int __devinit eth_init_one(struct
104 return 0;
105
106 err_phy_dis:
107 - phy_disconnect(port->phydev);
108 + ixp4xx_phy_disconnect(dev);
109 err_free_mem:
110 npe_port_tab[NPE_ID(port->id)] = NULL;
111 platform_set_drvdata(pdev, NULL);
112 @@ -1267,7 +1299,7 @@ static int __devexit eth_remove_one(stru
113 struct port *port = netdev_priv(dev);
114
115 unregister_netdev(dev);
116 - phy_disconnect(port->phydev);
117 + ixp4xx_phy_disconnect(dev);
118 npe_port_tab[NPE_ID(port->id)] = NULL;
119 platform_set_drvdata(pdev, NULL);
120 npe_release(port->npe);
This page took 0.048111 seconds and 5 git commands to generate.