diff options
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/dm9000.c | 69 |
1 files changed, 68 insertions, 1 deletions
diff --git a/drivers/net/dm9000.c b/drivers/net/dm9000.c index d42cb734c5ea..709fd674ec38 100644 --- a/drivers/net/dm9000.c +++ b/drivers/net/dm9000.c | |||
@@ -63,6 +63,7 @@ | |||
63 | #include <linux/spinlock.h> | 63 | #include <linux/spinlock.h> |
64 | #include <linux/crc32.h> | 64 | #include <linux/crc32.h> |
65 | #include <linux/mii.h> | 65 | #include <linux/mii.h> |
66 | #include <linux/ethtool.h> | ||
66 | #include <linux/dm9000.h> | 67 | #include <linux/dm9000.h> |
67 | #include <linux/delay.h> | 68 | #include <linux/delay.h> |
68 | #include <linux/platform_device.h> | 69 | #include <linux/platform_device.h> |
@@ -80,6 +81,7 @@ | |||
80 | 81 | ||
81 | #define CARDNAME "dm9000" | 82 | #define CARDNAME "dm9000" |
82 | #define PFX CARDNAME ": " | 83 | #define PFX CARDNAME ": " |
84 | #define DRV_VERSION "1.30" | ||
83 | 85 | ||
84 | #ifdef CONFIG_BLACKFIN | 86 | #ifdef CONFIG_BLACKFIN |
85 | #define readsb insb | 87 | #define readsb insb |
@@ -145,6 +147,11 @@ typedef struct board_info { | |||
145 | } \ | 147 | } \ |
146 | } while (0) | 148 | } while (0) |
147 | 149 | ||
150 | static inline board_info_t *to_dm9000_board(struct net_device *dev) | ||
151 | { | ||
152 | return dev->priv; | ||
153 | } | ||
154 | |||
148 | /* function declaration ------------------------------------- */ | 155 | /* function declaration ------------------------------------- */ |
149 | static int dm9000_probe(struct platform_device *); | 156 | static int dm9000_probe(struct platform_device *); |
150 | static int dm9000_open(struct net_device *); | 157 | static int dm9000_open(struct net_device *); |
@@ -342,6 +349,64 @@ static void dm9000_poll_controller(struct net_device *dev) | |||
342 | } | 349 | } |
343 | #endif | 350 | #endif |
344 | 351 | ||
352 | /* ethtool ops */ | ||
353 | |||
354 | static void dm9000_get_drvinfo(struct net_device *dev, | ||
355 | struct ethtool_drvinfo *info) | ||
356 | { | ||
357 | board_info_t *dm = to_dm9000_board(dev); | ||
358 | |||
359 | strcpy(info->driver, CARDNAME); | ||
360 | strcpy(info->version, DRV_VERSION); | ||
361 | strcpy(info->bus_info, to_platform_device(dm->dev)->name); | ||
362 | } | ||
363 | |||
364 | static int dm9000_get_settings(struct net_device *dev, struct ethtool_cmd *cmd) | ||
365 | { | ||
366 | board_info_t *dm = to_dm9000_board(dev); | ||
367 | unsigned long flags; | ||
368 | |||
369 | spin_lock_irqsave(&dm->lock, flags); | ||
370 | mii_ethtool_gset(&dm->mii, cmd); | ||
371 | spin_lock_irqsave(&dm->lock, flags); | ||
372 | |||
373 | return 0; | ||
374 | } | ||
375 | |||
376 | static int dm9000_set_settings(struct net_device *dev, struct ethtool_cmd *cmd) | ||
377 | { | ||
378 | board_info_t *dm = to_dm9000_board(dev); | ||
379 | unsigned long flags; | ||
380 | int rc; | ||
381 | |||
382 | spin_lock_irqsave(&dm->lock, flags); | ||
383 | rc = mii_ethtool_sset(&dm->mii, cmd); | ||
384 | spin_lock_irqsave(&dm->lock, flags); | ||
385 | |||
386 | return rc; | ||
387 | } | ||
388 | |||
389 | static int dm9000_nway_reset(struct net_device *dev) | ||
390 | { | ||
391 | board_info_t *dm = to_dm9000_board(dev); | ||
392 | return mii_nway_restart(&dm->mii); | ||
393 | } | ||
394 | |||
395 | static u32 dm9000_get_link(struct net_device *dev) | ||
396 | { | ||
397 | board_info_t *dm = to_dm9000_board(dev); | ||
398 | return mii_link_ok(&dm->mii); | ||
399 | } | ||
400 | |||
401 | static const struct ethtool_ops dm9000_ethtool_ops = { | ||
402 | .get_drvinfo = dm9000_get_drvinfo, | ||
403 | .get_settings = dm9000_get_settings, | ||
404 | .set_settings = dm9000_set_settings, | ||
405 | .nway_reset = dm9000_nway_reset, | ||
406 | .get_link = dm9000_get_link, | ||
407 | }; | ||
408 | |||
409 | |||
345 | /* dm9000_release_board | 410 | /* dm9000_release_board |
346 | * | 411 | * |
347 | * release a board, and any mapped resources | 412 | * release a board, and any mapped resources |
@@ -546,6 +611,8 @@ dm9000_probe(struct platform_device *pdev) | |||
546 | ndev->watchdog_timeo = msecs_to_jiffies(watchdog); | 611 | ndev->watchdog_timeo = msecs_to_jiffies(watchdog); |
547 | ndev->stop = &dm9000_stop; | 612 | ndev->stop = &dm9000_stop; |
548 | ndev->set_multicast_list = &dm9000_hash_table; | 613 | ndev->set_multicast_list = &dm9000_hash_table; |
614 | ndev->ethtool_ops = &dm9000_ethtool_ops; | ||
615 | |||
549 | #ifdef CONFIG_NET_POLL_CONTROLLER | 616 | #ifdef CONFIG_NET_POLL_CONTROLLER |
550 | ndev->poll_controller = &dm9000_poll_controller; | 617 | ndev->poll_controller = &dm9000_poll_controller; |
551 | #endif | 618 | #endif |
@@ -1167,7 +1234,7 @@ static struct platform_driver dm9000_driver = { | |||
1167 | static int __init | 1234 | static int __init |
1168 | dm9000_init(void) | 1235 | dm9000_init(void) |
1169 | { | 1236 | { |
1170 | printk(KERN_INFO "%s Ethernet Driver\n", CARDNAME); | 1237 | printk(KERN_INFO "%s Ethernet Driver, V%s\n", CARDNAME, DRV_VERSION); |
1171 | 1238 | ||
1172 | return platform_driver_register(&dm9000_driver); /* search board and register */ | 1239 | return platform_driver_register(&dm9000_driver); /* search board and register */ |
1173 | } | 1240 | } |