pegasus.c (8a160e2e9aeb8318159b48701ad8a6e22274372d) pegasus.c (bc65bacf239d0bc1d00d92cd535a4031921dd78a)
1// SPDX-License-Identifier: GPL-2.0-only
2/*
1// SPDX-License-Identifier: GPL-2.0-only
2/*
3 * Copyright (c) 1999-2013 Petko Manolov (petkan@nucleusys.com)
3 * Copyright (c) 1999-2021 Petko Manolov (petkan@nucleusys.com)
4 *
4 *
5 * ChangeLog:
6 * .... Most of the time spent on reading sources & docs.
7 * v0.2.x First official release for the Linux kernel.
8 * v0.3.0 Beutified and structured, some bugs fixed.
9 * v0.3.x URBifying bulk requests and bugfixing. First relatively
10 * stable release. Still can touch device's registers only
11 * from top-halves.
12 * v0.4.0 Control messages remained unurbified are now URBs.
13 * Now we can touch the HW at any time.
14 * v0.4.9 Control urbs again use process context to wait. Argh...
15 * Some long standing bugs (enable_net_traffic) fixed.
16 * Also nasty trick about resubmiting control urb from
17 * interrupt context used. Please let me know how it
18 * behaves. Pegasus II support added since this version.
19 * TODO: suppressing HCD warnings spewage on disconnect.
20 * v0.4.13 Ethernet address is now set at probe(), not at open()
21 * time as this seems to break dhcpd.
22 * v0.5.0 branch to 2.5.x kernels
23 * v0.5.1 ethtool support added
24 * v0.5.5 rx socket buffers are in a pool and the their allocation
25 * is out of the interrupt routine.
26 * ...
27 * v0.9.3 simplified [get|set]_register(s), async update registers
28 * logic revisited, receive skb_pool removed.
29 */
30
31#include <linux/sched.h>
32#include <linux/slab.h>
33#include <linux/init.h>
34#include <linux/delay.h>
35#include <linux/netdevice.h>
36#include <linux/etherdevice.h>
37#include <linux/ethtool.h>
38#include <linux/mii.h>
39#include <linux/usb.h>
40#include <linux/module.h>
41#include <asm/byteorder.h>
42#include <linux/uaccess.h>
43#include "pegasus.h"
44
45/*
46 * Version Information
47 */
5 */
6
7#include <linux/sched.h>
8#include <linux/slab.h>
9#include <linux/init.h>
10#include <linux/delay.h>
11#include <linux/netdevice.h>
12#include <linux/etherdevice.h>
13#include <linux/ethtool.h>
14#include <linux/mii.h>
15#include <linux/usb.h>
16#include <linux/module.h>
17#include <asm/byteorder.h>
18#include <linux/uaccess.h>
19#include "pegasus.h"
20
21/*
22 * Version Information
23 */
48#define DRIVER_VERSION "v0.9.3 (2013/04/25)"
49#define DRIVER_AUTHOR "Petko Manolov <petkan@nucleusys.com>"
50#define DRIVER_DESC "Pegasus/Pegasus II USB Ethernet driver"
51
52static const char driver_name[] = "pegasus";
53
54#undef PEGASUS_WRITE_EEPROM
55#define BMSR_MEDIA (BMSR_10HALF | BMSR_10FULL | BMSR_100HALF | \
56 BMSR_100FULL | BMSR_ANEGCAPABLE)

--- 852 unchanged lines hidden (view full) ---

909}
910
911static void pegasus_get_drvinfo(struct net_device *dev,
912 struct ethtool_drvinfo *info)
913{
914 pegasus_t *pegasus = netdev_priv(dev);
915
916 strlcpy(info->driver, driver_name, sizeof(info->driver));
24#define DRIVER_AUTHOR "Petko Manolov <petkan@nucleusys.com>"
25#define DRIVER_DESC "Pegasus/Pegasus II USB Ethernet driver"
26
27static const char driver_name[] = "pegasus";
28
29#undef PEGASUS_WRITE_EEPROM
30#define BMSR_MEDIA (BMSR_10HALF | BMSR_10FULL | BMSR_100HALF | \
31 BMSR_100FULL | BMSR_ANEGCAPABLE)

--- 852 unchanged lines hidden (view full) ---

884}
885
886static void pegasus_get_drvinfo(struct net_device *dev,
887 struct ethtool_drvinfo *info)
888{
889 pegasus_t *pegasus = netdev_priv(dev);
890
891 strlcpy(info->driver, driver_name, sizeof(info->driver));
917 strlcpy(info->version, DRIVER_VERSION, sizeof(info->version));
918 usb_make_path(pegasus->usb, info->bus_info, sizeof(info->bus_info));
919}
920
921/* also handles three patterns of some kind in hardware */
922#define WOL_SUPPORTED (WAKE_MAGIC|WAKE_PHY)
923
924static void
925pegasus_get_wol(struct net_device *dev, struct ethtool_wolinfo *wol)

--- 407 unchanged lines hidden (view full) ---

1333 usb_dev_id[i].private = flags;
1334 pegasus_ids[i].match_flags = USB_DEVICE_ID_MATCH_DEVICE;
1335 pegasus_ids[i].idVendor = vendor_id;
1336 pegasus_ids[i].idProduct = device_id;
1337}
1338
1339static int __init pegasus_init(void)
1340{
892 usb_make_path(pegasus->usb, info->bus_info, sizeof(info->bus_info));
893}
894
895/* also handles three patterns of some kind in hardware */
896#define WOL_SUPPORTED (WAKE_MAGIC|WAKE_PHY)
897
898static void
899pegasus_get_wol(struct net_device *dev, struct ethtool_wolinfo *wol)

--- 407 unchanged lines hidden (view full) ---

1307 usb_dev_id[i].private = flags;
1308 pegasus_ids[i].match_flags = USB_DEVICE_ID_MATCH_DEVICE;
1309 pegasus_ids[i].idVendor = vendor_id;
1310 pegasus_ids[i].idProduct = device_id;
1311}
1312
1313static int __init pegasus_init(void)
1314{
1341 pr_info("%s: %s, " DRIVER_DESC "\n", driver_name, DRIVER_VERSION);
1315 pr_info("%s: " DRIVER_DESC "\n", driver_name);
1342 if (devid)
1343 parse_id(devid);
1344 return usb_register(&pegasus_driver);
1345}
1346
1347static void __exit pegasus_exit(void)
1348{
1349 usb_deregister(&pegasus_driver);
1350}
1351
1352module_init(pegasus_init);
1353module_exit(pegasus_exit);
1316 if (devid)
1317 parse_id(devid);
1318 return usb_register(&pegasus_driver);
1319}
1320
1321static void __exit pegasus_exit(void)
1322{
1323 usb_deregister(&pegasus_driver);
1324}
1325
1326module_init(pegasus_init);
1327module_exit(pegasus_exit);