1 --- a/drivers/net/dm9000.c
2 +++ b/drivers/net/dm9000.c
4 * Sascha Hauer <s.hauer@pengutronix.de>
8 #include <linux/module.h>
9 #include <linux/ioport.h>
10 #include <linux/netdevice.h>
11 @@ -121,6 +122,8 @@ typedef struct board_info {
12 struct delayed_work phy_poll;
13 struct net_device *ndev;
15 + struct delayed_work irq_poll; /* for use in irq polling mode */
19 struct mii_if_info mii;
20 @@ -790,12 +793,14 @@ static void dm9000_timeout(struct net_de
23 /* Save previous register address */
24 - reg_save = readb(db->io_addr);
25 spin_lock_irqsave(&db->lock, flags);
26 + reg_save = readb(db->io_addr);
28 netif_stop_queue(dev);
30 dm9000_init_dm9000(dev);
32 + dm9000_init_dm9000(dev);
33 /* We can accept TX packets again */
34 dev->trans_start = jiffies;
35 netif_wake_queue(dev);
36 @@ -867,6 +872,12 @@ dm9000_start_xmit(struct sk_buff *skb, s
40 + /* directly poll afterwards */
41 + if (dev->irq == -1) {
42 + cancel_delayed_work(&db->irq_poll);
43 + schedule_delayed_work(&db->irq_poll, 1);
49 @@ -1073,6 +1084,18 @@ static void dm9000_poll_controller(struc
53 +static void dm9000_poll_irq(struct work_struct *w)
55 + struct delayed_work *dw = to_delayed_work(w);
56 + board_info_t *db = container_of(dw, board_info_t, irq_poll);
57 + struct net_device *ndev = db->ndev;
59 + dm9000_interrupt(0, ndev);
61 + if (netif_running(ndev))
62 + schedule_delayed_work(&db->irq_poll, HZ /100);
67 * The interface is opened whenever "ifconfig" actives it.
68 @@ -1086,27 +1109,35 @@ dm9000_open(struct net_device *dev)
69 if (netif_msg_ifup(db))
70 dev_dbg(db->dev, "enabling %s\n", dev->name);
72 - /* If there is no IRQ type specified, default to something that
73 - * may work, and tell the user that this is a problem */
74 + if (dev->irq != -1) {
75 + /* If there is no IRQ type specified, default to something that
76 + * may work, and tell the user that this is a problem */
78 - if (irqflags == IRQF_TRIGGER_NONE)
79 - dev_warn(db->dev, "WARNING: no IRQ resource flags set.\n");
80 + if (irqflags == IRQF_TRIGGER_NONE)
81 + dev_warn(db->dev, "WARNING: no IRQ resource flags set.\n");
83 - irqflags |= IRQF_SHARED;
84 + irqflags |= IRQF_SHARED;
86 - if (request_irq(dev->irq, &dm9000_interrupt, irqflags, dev->name, dev))
88 + if (request_irq(dev->irq, dm9000_interrupt, irqflags, dev->name, dev))
92 /* Initialize DM9000 board */
94 dm9000_init_dm9000(dev);
95 + /* workaround: init a second time */
97 + dm9000_init_dm9000(dev);
99 /* Init driver variable */
102 mii_check_media(&db->mii, netif_msg_link(db), 1);
103 netif_start_queue(dev);
106 + if (dev->irq == -1)
107 + schedule_delayed_work(&db->irq_poll, HZ / 100);
109 dm9000_schedule_poll(db);
112 @@ -1303,6 +1334,7 @@ dm9000_probe(struct platform_device *pde
113 mutex_init(&db->addr_lock);
115 INIT_DELAYED_WORK(&db->phy_poll, dm9000_poll_work);
116 + INIT_DELAYED_WORK(&db->irq_poll, dm9000_poll_irq);
118 db->addr_res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
119 db->data_res = platform_get_resource(pdev, IORESOURCE_MEM, 1);