aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDale Farnsworth <dale@farnsworth.org>2005-09-02 16:49:10 -0400
committerJeff Garzik <jgarzik@pobox.com>2005-09-05 18:08:30 -0400
commit63c9e549148fb95c11befb4f255c84ded9277f89 (patch)
treed3ec50c0949080f2dd3977654530d575403659b5
parent7342cd810cfd73120687d5323846e5c114cb23bb (diff)
[PATCH] mv643xx: add netpoll api support
Add support for the netpoll api for use by netconsole, kgdb, etc. Signed-off-by: Dale Farnsworth <dale@farnsworth.org> Signed-off-by: Jeff Garzik <jgarzik@pobox.com>
-rw-r--r--drivers/net/mv643xx_eth.c44
1 files changed, 42 insertions, 2 deletions
diff --git a/drivers/net/mv643xx_eth.c b/drivers/net/mv643xx_eth.c
index bb230e6c197b..7c9dbc8c9423 100644
--- a/drivers/net/mv643xx_eth.c
+++ b/drivers/net/mv643xx_eth.c
@@ -58,11 +58,10 @@
58 58
59#define INT_CAUSE_UNMASK_ALL 0x0007ffff 59#define INT_CAUSE_UNMASK_ALL 0x0007ffff
60#define INT_CAUSE_UNMASK_ALL_EXT 0x0011ffff 60#define INT_CAUSE_UNMASK_ALL_EXT 0x0011ffff
61#ifdef MV643XX_RX_QUEUE_FILL_ON_TASK
62#define INT_CAUSE_MASK_ALL 0x00000000 61#define INT_CAUSE_MASK_ALL 0x00000000
62#define INT_CAUSE_MASK_ALL_EXT 0x00000000
63#define INT_CAUSE_CHECK_BITS INT_CAUSE_UNMASK_ALL 63#define INT_CAUSE_CHECK_BITS INT_CAUSE_UNMASK_ALL
64#define INT_CAUSE_CHECK_BITS_EXT INT_CAUSE_UNMASK_ALL_EXT 64#define INT_CAUSE_CHECK_BITS_EXT INT_CAUSE_UNMASK_ALL_EXT
65#endif
66 65
67#ifdef MV643XX_CHECKSUM_OFFLOAD_TX 66#ifdef MV643XX_CHECKSUM_OFFLOAD_TX
68#define MAX_DESCS_PER_SKB (MAX_SKB_FRAGS + 1) 67#define MAX_DESCS_PER_SKB (MAX_SKB_FRAGS + 1)
@@ -1338,6 +1337,43 @@ static struct net_device_stats *mv643xx_eth_get_stats(struct net_device *dev)
1338 return &mp->stats; 1337 return &mp->stats;
1339} 1338}
1340 1339
1340#ifdef CONFIG_NET_POLL_CONTROLLER
1341static inline void mv643xx_enable_irq(struct mv643xx_private *mp)
1342{
1343 int port_num = mp->port_num;
1344 unsigned long flags;
1345
1346 spin_lock_irqsave(&mp->lock, flags);
1347 mv_write(MV643XX_ETH_INTERRUPT_MASK_REG(port_num),
1348 INT_CAUSE_UNMASK_ALL);
1349 mv_write(MV643XX_ETH_INTERRUPT_EXTEND_MASK_REG(port_num),
1350 INT_CAUSE_UNMASK_ALL_EXT);
1351 spin_unlock_irqrestore(&mp->lock, flags);
1352}
1353
1354static inline void mv643xx_disable_irq(struct mv643xx_private *mp)
1355{
1356 int port_num = mp->port_num;
1357 unsigned long flags;
1358
1359 spin_lock_irqsave(&mp->lock, flags);
1360 mv_write(MV643XX_ETH_INTERRUPT_MASK_REG(port_num),
1361 INT_CAUSE_MASK_ALL);
1362 mv_write(MV643XX_ETH_INTERRUPT_EXTEND_MASK_REG(port_num),
1363 INT_CAUSE_MASK_ALL_EXT);
1364 spin_unlock_irqrestore(&mp->lock, flags);
1365}
1366
1367static void mv643xx_netpoll(struct net_device *netdev)
1368{
1369 struct mv643xx_private *mp = netdev_priv(netdev);
1370
1371 mv643xx_disable_irq(mp);
1372 mv643xx_eth_int_handler(netdev->irq, netdev, NULL);
1373 mv643xx_enable_irq(mp);
1374}
1375#endif
1376
1341/*/ 1377/*/
1342 * mv643xx_eth_probe 1378 * mv643xx_eth_probe
1343 * 1379 *
@@ -1388,6 +1424,10 @@ static int mv643xx_eth_probe(struct device *ddev)
1388 dev->weight = 64; 1424 dev->weight = 64;
1389#endif 1425#endif
1390 1426
1427#ifdef CONFIG_NET_POLL_CONTROLLER
1428 dev->poll_controller = mv643xx_netpoll;
1429#endif
1430
1391 dev->watchdog_timeo = 2 * HZ; 1431 dev->watchdog_timeo = 2 * HZ;
1392 dev->tx_queue_len = mp->tx_ring_size; 1432 dev->tx_queue_len = mp->tx_ring_size;
1393 dev->base_addr = 0; 1433 dev->base_addr = 0;