add a patch to export dma_set_coherent_mask
[openwrt/staging/chunkeey.git] / target / linux / ixp4xx / patches-2.6.35 / 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 @@ -1008,8 +1052,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 @@ -1130,7 +1173,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 @@ -1156,7 +1199,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 @@ -1214,18 +1256,10 @@ 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 ((err = IS_ERR(port->phydev)))
89 + err = ixp4xx_phy_connect(dev);
90 + if (err)
91 goto err_free_mem;
92
93 - /* mask with MAC supported features */
94 - port->phydev->supported &= PHY_BASIC_FEATURES;
95 - port->phydev->advertising = port->phydev->supported;
96 -
97 - port->phydev->irq = PHY_POLL;
98 -
99 if ((err = register_netdev(dev)))
100 goto err_phy_dis;
101
102 @@ -1235,7 +1269,7 @@ static int __devinit eth_init_one(struct
103 return 0;
104
105 err_phy_dis:
106 - phy_disconnect(port->phydev);
107 + ixp4xx_phy_disconnect(dev);
108 err_free_mem:
109 npe_port_tab[NPE_ID(port->id)] = NULL;
110 platform_set_drvdata(pdev, NULL);
111 @@ -1253,7 +1287,7 @@ static int __devexit eth_remove_one(stru
112 struct port *port = netdev_priv(dev);
113
114 unregister_netdev(dev);
115 - phy_disconnect(port->phydev);
116 + ixp4xx_phy_disconnect(dev);
117 npe_port_tab[NPE_ID(port->id)] = NULL;
118 platform_set_drvdata(pdev, NULL);
119 npe_release(port->npe);