dm9601.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691
  1. /*
  2. * Davicom DM9601 USB 1.1 10/100Mbps ethernet devices
  3. *
  4. * Peter Korsgaard <jacmet@sunsite.dk>
  5. *
  6. * This file is licensed under the terms of the GNU General Public License
  7. * version 2. This program is licensed "as is" without any warranty of any
  8. * kind, whether express or implied.
  9. */
  10. //#define DEBUG
  11. #include <linux/module.h>
  12. #include <linux/sched.h>
  13. #include <linux/stddef.h>
  14. #include <linux/init.h>
  15. #include <linux/netdevice.h>
  16. #include <linux/etherdevice.h>
  17. #include <linux/ethtool.h>
  18. #include <linux/mii.h>
  19. #include <linux/usb.h>
  20. #include <linux/crc32.h>
  21. #include <linux/usb/usbnet.h>
  22. #include <linux/slab.h>
  23. /* datasheet:
  24. http://ptm2.cc.utu.fi/ftp/network/cards/DM9601/From_NET/DM9601-DS-P01-930914.pdf
  25. */
  26. /* control requests */
  27. #define DM_READ_REGS 0x00
  28. #define DM_WRITE_REGS 0x01
  29. #define DM_READ_MEMS 0x02
  30. #define DM_WRITE_REG 0x03
  31. #define DM_WRITE_MEMS 0x05
  32. #define DM_WRITE_MEM 0x07
  33. /* registers */
  34. #define DM_NET_CTRL 0x00
  35. #define DM_RX_CTRL 0x05
  36. #define DM_SHARED_CTRL 0x0b
  37. #define DM_SHARED_ADDR 0x0c
  38. #define DM_SHARED_DATA 0x0d /* low + high */
  39. #define DM_PHY_ADDR 0x10 /* 6 bytes */
  40. #define DM_MCAST_ADDR 0x16 /* 8 bytes */
  41. #define DM_GPR_CTRL 0x1e
  42. #define DM_GPR_DATA 0x1f
  43. #define DM_MAX_MCAST 64
  44. #define DM_MCAST_SIZE 8
  45. #define DM_EEPROM_LEN 256
  46. #define DM_TX_OVERHEAD 2 /* 2 byte header */
  47. #define DM_RX_OVERHEAD 7 /* 3 byte header + 4 byte crc tail */
  48. #define DM_TIMEOUT 1000
  49. static int dm_read(struct usbnet *dev, u8 reg, u16 length, void *data)
  50. {
  51. void *buf;
  52. int err = -ENOMEM;
  53. netdev_dbg(dev->net, "dm_read() reg=0x%02x length=%d\n", reg, length);
  54. buf = kmalloc(length, GFP_KERNEL);
  55. if (!buf)
  56. goto out;
  57. err = usb_control_msg(dev->udev,
  58. usb_rcvctrlpipe(dev->udev, 0),
  59. DM_READ_REGS,
  60. USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
  61. 0, reg, buf, length, USB_CTRL_SET_TIMEOUT);
  62. if (err == length)
  63. memcpy(data, buf, length);
  64. else if (err >= 0)
  65. err = -EINVAL;
  66. kfree(buf);
  67. out:
  68. return err;
  69. }
  70. static int dm_read_reg(struct usbnet *dev, u8 reg, u8 *value)
  71. {
  72. return dm_read(dev, reg, 1, value);
  73. }
  74. static int dm_write(struct usbnet *dev, u8 reg, u16 length, void *data)
  75. {
  76. void *buf = NULL;
  77. int err = -ENOMEM;
  78. netdev_dbg(dev->net, "dm_write() reg=0x%02x, length=%d\n", reg, length);
  79. if (data) {
  80. buf = kmemdup(data, length, GFP_KERNEL);
  81. if (!buf)
  82. goto out;
  83. }
  84. err = usb_control_msg(dev->udev,
  85. usb_sndctrlpipe(dev->udev, 0),
  86. DM_WRITE_REGS,
  87. USB_DIR_OUT | USB_TYPE_VENDOR |USB_RECIP_DEVICE,
  88. 0, reg, buf, length, USB_CTRL_SET_TIMEOUT);
  89. kfree(buf);
  90. if (err >= 0 && err < length)
  91. err = -EINVAL;
  92. out:
  93. return err;
  94. }
  95. static int dm_write_reg(struct usbnet *dev, u8 reg, u8 value)
  96. {
  97. netdev_dbg(dev->net, "dm_write_reg() reg=0x%02x, value=0x%02x\n",
  98. reg, value);
  99. return usb_control_msg(dev->udev,
  100. usb_sndctrlpipe(dev->udev, 0),
  101. DM_WRITE_REG,
  102. USB_DIR_OUT | USB_TYPE_VENDOR |USB_RECIP_DEVICE,
  103. value, reg, NULL, 0, USB_CTRL_SET_TIMEOUT);
  104. }
  105. static void dm_write_async_callback(struct urb *urb)
  106. {
  107. struct usb_ctrlrequest *req = (struct usb_ctrlrequest *)urb->context;
  108. int status = urb->status;
  109. if (status < 0)
  110. printk(KERN_DEBUG "dm_write_async_callback() failed with %d\n",
  111. status);
  112. kfree(req);
  113. usb_free_urb(urb);
  114. }
  115. static void dm_write_async_helper(struct usbnet *dev, u8 reg, u8 value,
  116. u16 length, void *data)
  117. {
  118. struct usb_ctrlrequest *req;
  119. struct urb *urb;
  120. int status;
  121. urb = usb_alloc_urb(0, GFP_ATOMIC);
  122. if (!urb) {
  123. netdev_err(dev->net, "Error allocating URB in dm_write_async_helper!\n");
  124. return;
  125. }
  126. req = kmalloc(sizeof(struct usb_ctrlrequest), GFP_ATOMIC);
  127. if (!req) {
  128. netdev_err(dev->net, "Failed to allocate memory for control request\n");
  129. usb_free_urb(urb);
  130. return;
  131. }
  132. req->bRequestType = USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE;
  133. req->bRequest = length ? DM_WRITE_REGS : DM_WRITE_REG;
  134. req->wValue = cpu_to_le16(value);
  135. req->wIndex = cpu_to_le16(reg);
  136. req->wLength = cpu_to_le16(length);
  137. usb_fill_control_urb(urb, dev->udev,
  138. usb_sndctrlpipe(dev->udev, 0),
  139. (void *)req, data, length,
  140. dm_write_async_callback, req);
  141. status = usb_submit_urb(urb, GFP_ATOMIC);
  142. if (status < 0) {
  143. netdev_err(dev->net, "Error submitting the control message: status=%d\n",
  144. status);
  145. kfree(req);
  146. usb_free_urb(urb);
  147. }
  148. }
  149. static void dm_write_async(struct usbnet *dev, u8 reg, u16 length, void *data)
  150. {
  151. netdev_dbg(dev->net, "dm_write_async() reg=0x%02x length=%d\n", reg, length);
  152. dm_write_async_helper(dev, reg, 0, length, data);
  153. }
  154. static void dm_write_reg_async(struct usbnet *dev, u8 reg, u8 value)
  155. {
  156. netdev_dbg(dev->net, "dm_write_reg_async() reg=0x%02x value=0x%02x\n",
  157. reg, value);
  158. dm_write_async_helper(dev, reg, value, 0, NULL);
  159. }
  160. static int dm_read_shared_word(struct usbnet *dev, int phy, u8 reg, __le16 *value)
  161. {
  162. int ret, i;
  163. mutex_lock(&dev->phy_mutex);
  164. dm_write_reg(dev, DM_SHARED_ADDR, phy ? (reg | 0x40) : reg);
  165. dm_write_reg(dev, DM_SHARED_CTRL, phy ? 0xc : 0x4);
  166. for (i = 0; i < DM_TIMEOUT; i++) {
  167. u8 tmp;
  168. udelay(1);
  169. ret = dm_read_reg(dev, DM_SHARED_CTRL, &tmp);
  170. if (ret < 0)
  171. goto out;
  172. /* ready */
  173. if ((tmp & 1) == 0)
  174. break;
  175. }
  176. if (i == DM_TIMEOUT) {
  177. netdev_err(dev->net, "%s read timed out!\n", phy ? "phy" : "eeprom");
  178. ret = -EIO;
  179. goto out;
  180. }
  181. dm_write_reg(dev, DM_SHARED_CTRL, 0x0);
  182. ret = dm_read(dev, DM_SHARED_DATA, 2, value);
  183. netdev_dbg(dev->net, "read shared %d 0x%02x returned 0x%04x, %d\n",
  184. phy, reg, *value, ret);
  185. out:
  186. mutex_unlock(&dev->phy_mutex);
  187. return ret;
  188. }
  189. static int dm_write_shared_word(struct usbnet *dev, int phy, u8 reg, __le16 value)
  190. {
  191. int ret, i;
  192. mutex_lock(&dev->phy_mutex);
  193. ret = dm_write(dev, DM_SHARED_DATA, 2, &value);
  194. if (ret < 0)
  195. goto out;
  196. dm_write_reg(dev, DM_SHARED_ADDR, phy ? (reg | 0x40) : reg);
  197. dm_write_reg(dev, DM_SHARED_CTRL, phy ? 0x1a : 0x12);
  198. for (i = 0; i < DM_TIMEOUT; i++) {
  199. u8 tmp;
  200. udelay(1);
  201. ret = dm_read_reg(dev, DM_SHARED_CTRL, &tmp);
  202. if (ret < 0)
  203. goto out;
  204. /* ready */
  205. if ((tmp & 1) == 0)
  206. break;
  207. }
  208. if (i == DM_TIMEOUT) {
  209. netdev_err(dev->net, "%s write timed out!\n", phy ? "phy" : "eeprom");
  210. ret = -EIO;
  211. goto out;
  212. }
  213. dm_write_reg(dev, DM_SHARED_CTRL, 0x0);
  214. out:
  215. mutex_unlock(&dev->phy_mutex);
  216. return ret;
  217. }
  218. static int dm_read_eeprom_word(struct usbnet *dev, u8 offset, void *value)
  219. {
  220. return dm_read_shared_word(dev, 0, offset, value);
  221. }
  222. static int dm9601_get_eeprom_len(struct net_device *dev)
  223. {
  224. return DM_EEPROM_LEN;
  225. }
  226. static int dm9601_get_eeprom(struct net_device *net,
  227. struct ethtool_eeprom *eeprom, u8 * data)
  228. {
  229. struct usbnet *dev = netdev_priv(net);
  230. __le16 *ebuf = (__le16 *) data;
  231. int i;
  232. /* access is 16bit */
  233. if ((eeprom->offset % 2) || (eeprom->len % 2))
  234. return -EINVAL;
  235. for (i = 0; i < eeprom->len / 2; i++) {
  236. if (dm_read_eeprom_word(dev, eeprom->offset / 2 + i,
  237. &ebuf[i]) < 0)
  238. return -EINVAL;
  239. }
  240. return 0;
  241. }
  242. static int dm9601_mdio_read(struct net_device *netdev, int phy_id, int loc)
  243. {
  244. struct usbnet *dev = netdev_priv(netdev);
  245. __le16 res;
  246. if (phy_id) {
  247. netdev_dbg(dev->net, "Only internal phy supported\n");
  248. return 0;
  249. }
  250. dm_read_shared_word(dev, 1, loc, &res);
  251. netdev_dbg(dev->net,
  252. "dm9601_mdio_read() phy_id=0x%02x, loc=0x%02x, returns=0x%04x\n",
  253. phy_id, loc, le16_to_cpu(res));
  254. return le16_to_cpu(res);
  255. }
  256. static void dm9601_mdio_write(struct net_device *netdev, int phy_id, int loc,
  257. int val)
  258. {
  259. struct usbnet *dev = netdev_priv(netdev);
  260. __le16 res = cpu_to_le16(val);
  261. if (phy_id) {
  262. netdev_dbg(dev->net, "Only internal phy supported\n");
  263. return;
  264. }
  265. netdev_dbg(dev->net, "dm9601_mdio_write() phy_id=0x%02x, loc=0x%02x, val=0x%04x\n",
  266. phy_id, loc, val);
  267. dm_write_shared_word(dev, 1, loc, res);
  268. }
  269. static void dm9601_get_drvinfo(struct net_device *net,
  270. struct ethtool_drvinfo *info)
  271. {
  272. /* Inherit standard device info */
  273. usbnet_get_drvinfo(net, info);
  274. info->eedump_len = DM_EEPROM_LEN;
  275. }
  276. static u32 dm9601_get_link(struct net_device *net)
  277. {
  278. struct usbnet *dev = netdev_priv(net);
  279. return mii_link_ok(&dev->mii);
  280. }
  281. static int dm9601_ioctl(struct net_device *net, struct ifreq *rq, int cmd)
  282. {
  283. struct usbnet *dev = netdev_priv(net);
  284. return generic_mii_ioctl(&dev->mii, if_mii(rq), cmd, NULL);
  285. }
  286. static const struct ethtool_ops dm9601_ethtool_ops = {
  287. .get_drvinfo = dm9601_get_drvinfo,
  288. .get_link = dm9601_get_link,
  289. .get_msglevel = usbnet_get_msglevel,
  290. .set_msglevel = usbnet_set_msglevel,
  291. .get_eeprom_len = dm9601_get_eeprom_len,
  292. .get_eeprom = dm9601_get_eeprom,
  293. .get_settings = usbnet_get_settings,
  294. .set_settings = usbnet_set_settings,
  295. .nway_reset = usbnet_nway_reset,
  296. };
  297. static void dm9601_set_multicast(struct net_device *net)
  298. {
  299. struct usbnet *dev = netdev_priv(net);
  300. /* We use the 20 byte dev->data for our 8 byte filter buffer
  301. * to avoid allocating memory that is tricky to free later */
  302. u8 *hashes = (u8 *) & dev->data;
  303. u8 rx_ctl = 0x31;
  304. memset(hashes, 0x00, DM_MCAST_SIZE);
  305. hashes[DM_MCAST_SIZE - 1] |= 0x80; /* broadcast address */
  306. if (net->flags & IFF_PROMISC) {
  307. rx_ctl |= 0x02;
  308. } else if (net->flags & IFF_ALLMULTI ||
  309. netdev_mc_count(net) > DM_MAX_MCAST) {
  310. rx_ctl |= 0x04;
  311. } else if (!netdev_mc_empty(net)) {
  312. struct netdev_hw_addr *ha;
  313. netdev_for_each_mc_addr(ha, net) {
  314. u32 crc = ether_crc(ETH_ALEN, ha->addr) >> 26;
  315. hashes[crc >> 3] |= 1 << (crc & 0x7);
  316. }
  317. }
  318. dm_write_async(dev, DM_MCAST_ADDR, DM_MCAST_SIZE, hashes);
  319. dm_write_reg_async(dev, DM_RX_CTRL, rx_ctl);
  320. }
  321. static void __dm9601_set_mac_address(struct usbnet *dev)
  322. {
  323. dm_write_async(dev, DM_PHY_ADDR, ETH_ALEN, dev->net->dev_addr);
  324. }
  325. static int dm9601_set_mac_address(struct net_device *net, void *p)
  326. {
  327. struct sockaddr *addr = p;
  328. struct usbnet *dev = netdev_priv(net);
  329. if (!is_valid_ether_addr(addr->sa_data)) {
  330. dev_err(&net->dev, "not setting invalid mac address %pM\n",
  331. addr->sa_data);
  332. return -EINVAL;
  333. }
  334. memcpy(net->dev_addr, addr->sa_data, net->addr_len);
  335. __dm9601_set_mac_address(dev);
  336. return 0;
  337. }
  338. static const struct net_device_ops dm9601_netdev_ops = {
  339. .ndo_open = usbnet_open,
  340. .ndo_stop = usbnet_stop,
  341. .ndo_start_xmit = usbnet_start_xmit,
  342. .ndo_tx_timeout = usbnet_tx_timeout,
  343. .ndo_change_mtu = usbnet_change_mtu,
  344. .ndo_validate_addr = eth_validate_addr,
  345. .ndo_do_ioctl = dm9601_ioctl,
  346. .ndo_set_multicast_list = dm9601_set_multicast,
  347. .ndo_set_mac_address = dm9601_set_mac_address,
  348. };
  349. static int dm9601_bind(struct usbnet *dev, struct usb_interface *intf)
  350. {
  351. int ret;
  352. u8 mac[ETH_ALEN];
  353. ret = usbnet_get_endpoints(dev, intf);
  354. if (ret)
  355. goto out;
  356. dev->net->netdev_ops = &dm9601_netdev_ops;
  357. dev->net->ethtool_ops = &dm9601_ethtool_ops;
  358. dev->net->hard_header_len += DM_TX_OVERHEAD;
  359. dev->hard_mtu = dev->net->mtu + dev->net->hard_header_len;
  360. dev->rx_urb_size = dev->net->mtu + ETH_HLEN + DM_RX_OVERHEAD;
  361. dev->mii.dev = dev->net;
  362. dev->mii.mdio_read = dm9601_mdio_read;
  363. dev->mii.mdio_write = dm9601_mdio_write;
  364. dev->mii.phy_id_mask = 0x1f;
  365. dev->mii.reg_num_mask = 0x1f;
  366. /* reset */
  367. dm_write_reg(dev, DM_NET_CTRL, 1);
  368. udelay(20);
  369. /* read MAC */
  370. if (dm_read(dev, DM_PHY_ADDR, ETH_ALEN, mac) < 0) {
  371. printk(KERN_ERR "Error reading MAC address\n");
  372. ret = -ENODEV;
  373. goto out;
  374. }
  375. /*
  376. * Overwrite the auto-generated address only with good ones.
  377. */
  378. if (is_valid_ether_addr(mac))
  379. memcpy(dev->net->dev_addr, mac, ETH_ALEN);
  380. else {
  381. printk(KERN_WARNING
  382. "dm9601: No valid MAC address in EEPROM, using %pM\n",
  383. dev->net->dev_addr);
  384. __dm9601_set_mac_address(dev);
  385. }
  386. /* power up phy */
  387. dm_write_reg(dev, DM_GPR_CTRL, 1);
  388. dm_write_reg(dev, DM_GPR_DATA, 0);
  389. /* receive broadcast packets */
  390. dm9601_set_multicast(dev->net);
  391. dm9601_mdio_write(dev->net, dev->mii.phy_id, MII_BMCR, BMCR_RESET);
  392. dm9601_mdio_write(dev->net, dev->mii.phy_id, MII_ADVERTISE,
  393. ADVERTISE_ALL | ADVERTISE_CSMA | ADVERTISE_PAUSE_CAP);
  394. mii_nway_restart(&dev->mii);
  395. out:
  396. return ret;
  397. }
  398. static int dm9601_rx_fixup(struct usbnet *dev, struct sk_buff *skb)
  399. {
  400. u8 status;
  401. int len;
  402. /* format:
  403. b1: rx status
  404. b2: packet length (incl crc) low
  405. b3: packet length (incl crc) high
  406. b4..n-4: packet data
  407. bn-3..bn: ethernet crc
  408. */
  409. if (unlikely(skb->len < DM_RX_OVERHEAD)) {
  410. dev_err(&dev->udev->dev, "unexpected tiny rx frame\n");
  411. return 0;
  412. }
  413. status = skb->data[0];
  414. len = (skb->data[1] | (skb->data[2] << 8)) - 4;
  415. if (unlikely(status & 0xbf)) {
  416. if (status & 0x01) dev->net->stats.rx_fifo_errors++;
  417. if (status & 0x02) dev->net->stats.rx_crc_errors++;
  418. if (status & 0x04) dev->net->stats.rx_frame_errors++;
  419. if (status & 0x20) dev->net->stats.rx_missed_errors++;
  420. if (status & 0x90) dev->net->stats.rx_length_errors++;
  421. return 0;
  422. }
  423. skb_pull(skb, 3);
  424. skb_trim(skb, len);
  425. return 1;
  426. }
  427. static struct sk_buff *dm9601_tx_fixup(struct usbnet *dev, struct sk_buff *skb,
  428. gfp_t flags)
  429. {
  430. int len;
  431. /* format:
  432. b1: packet length low
  433. b2: packet length high
  434. b3..n: packet data
  435. */
  436. len = skb->len;
  437. if (skb_headroom(skb) < DM_TX_OVERHEAD) {
  438. struct sk_buff *skb2;
  439. skb2 = skb_copy_expand(skb, DM_TX_OVERHEAD, 0, flags);
  440. dev_kfree_skb_any(skb);
  441. skb = skb2;
  442. if (!skb)
  443. return NULL;
  444. }
  445. __skb_push(skb, DM_TX_OVERHEAD);
  446. /* usbnet adds padding if length is a multiple of packet size
  447. if so, adjust length value in header */
  448. if ((skb->len % dev->maxpacket) == 0)
  449. len++;
  450. skb->data[0] = len;
  451. skb->data[1] = len >> 8;
  452. return skb;
  453. }
  454. static void dm9601_status(struct usbnet *dev, struct urb *urb)
  455. {
  456. int link;
  457. u8 *buf;
  458. /* format:
  459. b0: net status
  460. b1: tx status 1
  461. b2: tx status 2
  462. b3: rx status
  463. b4: rx overflow
  464. b5: rx count
  465. b6: tx count
  466. b7: gpr
  467. */
  468. if (urb->actual_length < 8)
  469. return;
  470. buf = urb->transfer_buffer;
  471. link = !!(buf[0] & 0x40);
  472. if (netif_carrier_ok(dev->net) != link) {
  473. if (link) {
  474. netif_carrier_on(dev->net);
  475. usbnet_defer_kevent (dev, EVENT_LINK_RESET);
  476. }
  477. else
  478. netif_carrier_off(dev->net);
  479. netdev_dbg(dev->net, "Link Status is: %d\n", link);
  480. }
  481. }
  482. static int dm9601_link_reset(struct usbnet *dev)
  483. {
  484. struct ethtool_cmd ecmd = { .cmd = ETHTOOL_GSET };
  485. mii_check_media(&dev->mii, 1, 1);
  486. mii_ethtool_gset(&dev->mii, &ecmd);
  487. netdev_dbg(dev->net, "link_reset() speed: %u duplex: %d\n",
  488. ethtool_cmd_speed(&ecmd), ecmd.duplex);
  489. return 0;
  490. }
  491. static const struct driver_info dm9601_info = {
  492. .description = "Davicom DM9601 USB Ethernet",
  493. .flags = FLAG_ETHER | FLAG_LINK_INTR,
  494. .bind = dm9601_bind,
  495. .rx_fixup = dm9601_rx_fixup,
  496. .tx_fixup = dm9601_tx_fixup,
  497. .status = dm9601_status,
  498. .link_reset = dm9601_link_reset,
  499. .reset = dm9601_link_reset,
  500. };
  501. static const struct usb_device_id products[] = {
  502. {
  503. USB_DEVICE(0x07aa, 0x9601), /* Corega FEther USB-TXC */
  504. .driver_info = (unsigned long)&dm9601_info,
  505. },
  506. {
  507. USB_DEVICE(0x0a46, 0x9601), /* Davicom USB-100 */
  508. .driver_info = (unsigned long)&dm9601_info,
  509. },
  510. {
  511. USB_DEVICE(0x0a46, 0x6688), /* ZT6688 USB NIC */
  512. .driver_info = (unsigned long)&dm9601_info,
  513. },
  514. {
  515. USB_DEVICE(0x0a46, 0x0268), /* ShanTou ST268 USB NIC */
  516. .driver_info = (unsigned long)&dm9601_info,
  517. },
  518. {
  519. USB_DEVICE(0x0a46, 0x8515), /* ADMtek ADM8515 USB NIC */
  520. .driver_info = (unsigned long)&dm9601_info,
  521. },
  522. {
  523. USB_DEVICE(0x0a47, 0x9601), /* Hirose USB-100 */
  524. .driver_info = (unsigned long)&dm9601_info,
  525. },
  526. {
  527. USB_DEVICE(0x0fe6, 0x8101), /* DM9601 USB to Fast Ethernet Adapter */
  528. .driver_info = (unsigned long)&dm9601_info,
  529. },
  530. {
  531. USB_DEVICE(0x0fe6, 0x9700), /* DM9601 USB to Fast Ethernet Adapter */
  532. .driver_info = (unsigned long)&dm9601_info,
  533. },
  534. {
  535. USB_DEVICE(0x0a46, 0x9000), /* DM9000E */
  536. .driver_info = (unsigned long)&dm9601_info,
  537. },
  538. {}, // END
  539. };
  540. MODULE_DEVICE_TABLE(usb, products);
  541. static struct usb_driver dm9601_driver = {
  542. .name = "dm9601",
  543. .id_table = products,
  544. .probe = usbnet_probe,
  545. .disconnect = usbnet_disconnect,
  546. .suspend = usbnet_suspend,
  547. .resume = usbnet_resume,
  548. };
  549. static int __init dm9601_init(void)
  550. {
  551. return usb_register(&dm9601_driver);
  552. }
  553. static void __exit dm9601_exit(void)
  554. {
  555. usb_deregister(&dm9601_driver);
  556. }
  557. module_init(dm9601_init);
  558. module_exit(dm9601_exit);
  559. MODULE_AUTHOR("Peter Korsgaard <jacmet@sunsite.dk>");
  560. MODULE_DESCRIPTION("Davicom DM9601 USB 1.1 ethernet devices");
  561. MODULE_LICENSE("GPL");