aboutsummaryrefslogtreecommitdiffstats
path: root/arch/ppc/8xx_io/fec.c
diff options
context:
space:
mode:
authorJeff Garzik <jgarzik@pobox.com>2005-08-11 00:07:03 -0400
committerJeff Garzik <jgarzik@pobox.com>2005-08-11 00:07:03 -0400
commitcd04b947bc674f8fc9cac38ec30497bae5d664ad (patch)
tree988b0b7ea08063e5499672346eb2f619f0629717 /arch/ppc/8xx_io/fec.c
parentb3df9f813bc7b9db62ae0c90b8990b1cebf97345 (diff)
parentbc68552faad0e134eb22281343d5ae5a4873fa80 (diff)
Merge /spare/repo/linux-2.6/
Diffstat (limited to 'arch/ppc/8xx_io/fec.c')
-rw-r--r--arch/ppc/8xx_io/fec.c43
1 files changed, 26 insertions, 17 deletions
diff --git a/arch/ppc/8xx_io/fec.c b/arch/ppc/8xx_io/fec.c
index 0730392dcc20..62f68d6181c6 100644
--- a/arch/ppc/8xx_io/fec.c
+++ b/arch/ppc/8xx_io/fec.c
@@ -173,7 +173,7 @@ struct fec_enet_private {
173 uint phy_status; 173 uint phy_status;
174 uint phy_speed; 174 uint phy_speed;
175 phy_info_t *phy; 175 phy_info_t *phy;
176 struct tq_struct phy_task; 176 struct work_struct phy_task;
177 177
178 uint sequence_done; 178 uint sequence_done;
179 179
@@ -199,7 +199,8 @@ static int fec_enet_start_xmit(struct sk_buff *skb, struct net_device *dev);
199#ifdef CONFIG_USE_MDIO 199#ifdef CONFIG_USE_MDIO
200static void fec_enet_mii(struct net_device *dev); 200static void fec_enet_mii(struct net_device *dev);
201#endif /* CONFIG_USE_MDIO */ 201#endif /* CONFIG_USE_MDIO */
202static void fec_enet_interrupt(int irq, void * dev_id, struct pt_regs * regs); 202static irqreturn_t fec_enet_interrupt(int irq, void * dev_id,
203 struct pt_regs * regs);
203#ifdef CONFIG_FEC_PACKETHOOK 204#ifdef CONFIG_FEC_PACKETHOOK
204static void fec_enet_tx(struct net_device *dev, __u32 regval); 205static void fec_enet_tx(struct net_device *dev, __u32 regval);
205static void fec_enet_rx(struct net_device *dev, __u32 regval); 206static void fec_enet_rx(struct net_device *dev, __u32 regval);
@@ -471,7 +472,7 @@ fec_timeout(struct net_device *dev)
471/* The interrupt handler. 472/* The interrupt handler.
472 * This is called from the MPC core interrupt. 473 * This is called from the MPC core interrupt.
473 */ 474 */
474static void 475static irqreturn_t
475fec_enet_interrupt(int irq, void * dev_id, struct pt_regs * regs) 476fec_enet_interrupt(int irq, void * dev_id, struct pt_regs * regs)
476{ 477{
477 struct net_device *dev = dev_id; 478 struct net_device *dev = dev_id;
@@ -525,6 +526,7 @@ printk("%s[%d] %s: unexpected FEC_ENET_MII event\n", __FILE__,__LINE__,__FUNCTIO
525 } 526 }
526 527
527 } 528 }
529 return IRQ_RETVAL(IRQ_HANDLED);
528} 530}
529 531
530 532
@@ -1263,8 +1265,9 @@ static void mii_display_status(struct net_device *dev)
1263 printk(".\n"); 1265 printk(".\n");
1264} 1266}
1265 1267
1266static void mii_display_config(struct net_device *dev) 1268static void mii_display_config(void *priv)
1267{ 1269{
1270 struct net_device *dev = (struct net_device *)priv;
1268 struct fec_enet_private *fep = dev->priv; 1271 struct fec_enet_private *fep = dev->priv;
1269 volatile uint *s = &(fep->phy_status); 1272 volatile uint *s = &(fep->phy_status);
1270 1273
@@ -1294,8 +1297,9 @@ static void mii_display_config(struct net_device *dev)
1294 fep->sequence_done = 1; 1297 fep->sequence_done = 1;
1295} 1298}
1296 1299
1297static void mii_relink(struct net_device *dev) 1300static void mii_relink(void *priv)
1298{ 1301{
1302 struct net_device *dev = (struct net_device *)priv;
1299 struct fec_enet_private *fep = dev->priv; 1303 struct fec_enet_private *fep = dev->priv;
1300 int duplex; 1304 int duplex;
1301 1305
@@ -1323,18 +1327,16 @@ static void mii_queue_relink(uint mii_reg, struct net_device *dev)
1323{ 1327{
1324 struct fec_enet_private *fep = dev->priv; 1328 struct fec_enet_private *fep = dev->priv;
1325 1329
1326 fep->phy_task.routine = (void *)mii_relink; 1330 INIT_WORK(&fep->phy_task, mii_relink, (void *)dev);
1327 fep->phy_task.data = dev; 1331 schedule_work(&fep->phy_task);
1328 schedule_task(&fep->phy_task);
1329} 1332}
1330 1333
1331static void mii_queue_config(uint mii_reg, struct net_device *dev) 1334static void mii_queue_config(uint mii_reg, struct net_device *dev)
1332{ 1335{
1333 struct fec_enet_private *fep = dev->priv; 1336 struct fec_enet_private *fep = dev->priv;
1334 1337
1335 fep->phy_task.routine = (void *)mii_display_config; 1338 INIT_WORK(&fep->phy_task, mii_display_config, (void *)dev);
1336 fep->phy_task.data = dev; 1339 schedule_work(&fep->phy_task);
1337 schedule_task(&fep->phy_task);
1338} 1340}
1339 1341
1340 1342
@@ -1403,11 +1405,11 @@ mii_discover_phy(uint mii_reg, struct net_device *dev)
1403 1405
1404/* This interrupt occurs when the PHY detects a link change. 1406/* This interrupt occurs when the PHY detects a link change.
1405*/ 1407*/
1406static void 1408static
1407#ifdef CONFIG_RPXCLASSIC 1409#ifdef CONFIG_RPXCLASSIC
1408mii_link_interrupt(void *dev_id) 1410void mii_link_interrupt(void *dev_id)
1409#else 1411#else
1410mii_link_interrupt(int irq, void * dev_id, struct pt_regs * regs) 1412irqreturn_t mii_link_interrupt(int irq, void * dev_id, struct pt_regs * regs)
1411#endif 1413#endif
1412{ 1414{
1413#ifdef CONFIG_USE_MDIO 1415#ifdef CONFIG_USE_MDIO
@@ -1440,6 +1442,9 @@ mii_link_interrupt(int irq, void * dev_id, struct pt_regs * regs)
1440printk("%s[%d] %s: unexpected Link interrupt\n", __FILE__,__LINE__,__FUNCTION__); 1442printk("%s[%d] %s: unexpected Link interrupt\n", __FILE__,__LINE__,__FUNCTION__);
1441#endif /* CONFIG_USE_MDIO */ 1443#endif /* CONFIG_USE_MDIO */
1442 1444
1445#ifndef CONFIG_RPXCLASSIC
1446 return IRQ_RETVAL(IRQ_HANDLED);
1447#endif /* CONFIG_RPXCLASSIC */
1443} 1448}
1444 1449
1445static int 1450static int
@@ -1575,7 +1580,7 @@ static int __init fec_enet_init(void)
1575 struct fec_enet_private *fep; 1580 struct fec_enet_private *fep;
1576 int i, j, k, err; 1581 int i, j, k, err;
1577 unsigned char *eap, *iap, *ba; 1582 unsigned char *eap, *iap, *ba;
1578 unsigned long mem_addr; 1583 dma_addr_t mem_addr;
1579 volatile cbd_t *bdp; 1584 volatile cbd_t *bdp;
1580 cbd_t *cbd_base; 1585 cbd_t *cbd_base;
1581 volatile immap_t *immap; 1586 volatile immap_t *immap;
@@ -1640,7 +1645,8 @@ static int __init fec_enet_init(void)
1640 printk("FEC initialization failed.\n"); 1645 printk("FEC initialization failed.\n");
1641 return 1; 1646 return 1;
1642 } 1647 }
1643 cbd_base = (cbd_t *)consistent_alloc(GFP_KERNEL, PAGE_SIZE, &mem_addr); 1648 cbd_base = (cbd_t *)dma_alloc_coherent(dev->class_dev.dev, PAGE_SIZE,
1649 &mem_addr, GFP_KERNEL);
1644 1650
1645 /* Set receive and transmit descriptor base. 1651 /* Set receive and transmit descriptor base.
1646 */ 1652 */
@@ -1657,7 +1663,10 @@ static int __init fec_enet_init(void)
1657 1663
1658 /* Allocate a page. 1664 /* Allocate a page.
1659 */ 1665 */
1660 ba = (unsigned char *)consistent_alloc(GFP_KERNEL, PAGE_SIZE, &mem_addr); 1666 ba = (unsigned char *)dma_alloc_coherent(dev->class_dev.dev,
1667 PAGE_SIZE,
1668 &mem_addr,
1669 GFP_KERNEL);
1661 /* BUG: no check for failure */ 1670 /* BUG: no check for failure */
1662 1671
1663 /* Initialize the BD for every fragment in the page. 1672 /* Initialize the BD for every fragment in the page.