pegasus.h 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316
  1. /*
  2. * Copyright (c) 1999-2003 Petko Manolov - Petkan (petkan@users.sourceforge.net)
  3. *
  4. * This program is free software; you can redistribute it and/or modify
  5. * it under the terms of the GNU General Public License version 2 as published
  6. * by the Free Software Foundation.
  7. */
  8. #ifndef PEGASUS_DEV
  9. #define PEGASUS_II 0x80000000
  10. #define HAS_HOME_PNA 0x40000000
  11. #define PEGASUS_MTU 1536
  12. #define RX_SKBS 4
  13. #define EPROM_WRITE 0x01
  14. #define EPROM_READ 0x02
  15. #define EPROM_DONE 0x04
  16. #define EPROM_WR_ENABLE 0x10
  17. #define EPROM_LOAD 0x20
  18. #define PHY_DONE 0x80
  19. #define PHY_READ 0x40
  20. #define PHY_WRITE 0x20
  21. #define DEFAULT_GPIO_RESET 0x24
  22. #define DEFAULT_GPIO_SET 0x26
  23. #define PEGASUS_PRESENT 0x00000001
  24. #define PEGASUS_TX_BUSY 0x00000004
  25. #define PEGASUS_RX_BUSY 0x00000008
  26. #define CTRL_URB_RUNNING 0x00000010
  27. #define CTRL_URB_SLEEP 0x00000020
  28. #define PEGASUS_UNPLUG 0x00000040
  29. #define PEGASUS_RX_URB_FAIL 0x00000080
  30. #define ETH_REGS_CHANGE 0x40000000
  31. #define ETH_REGS_CHANGED 0x80000000
  32. #define RX_MULTICAST 2
  33. #define RX_PROMISCUOUS 4
  34. #define REG_TIMEOUT (HZ)
  35. #define PEGASUS_TX_TIMEOUT (HZ*10)
  36. #define TX_UNDERRUN 0x80
  37. #define EXCESSIVE_COL 0x40
  38. #define LATE_COL 0x20
  39. #define NO_CARRIER 0x10
  40. #define LOSS_CARRIER 0x08
  41. #define JABBER_TIMEOUT 0x04
  42. #define LINK_STATUS 0x01
  43. #define PEGASUS_REQT_READ 0xc0
  44. #define PEGASUS_REQT_WRITE 0x40
  45. #define PEGASUS_REQ_GET_REGS 0xf0
  46. #define PEGASUS_REQ_SET_REGS 0xf1
  47. #define PEGASUS_REQ_SET_REG PEGASUS_REQ_SET_REGS
  48. enum pegasus_registers {
  49. EthCtrl0 = 0,
  50. EthCtrl1 = 1,
  51. EthCtrl2 = 2,
  52. EthID = 0x10,
  53. Reg1d = 0x1d,
  54. EpromOffset = 0x20,
  55. EpromData = 0x21, /* 0x21 low, 0x22 high byte */
  56. EpromCtrl = 0x23,
  57. PhyAddr = 0x25,
  58. PhyData = 0x26, /* 0x26 low, 0x27 high byte */
  59. PhyCtrl = 0x28,
  60. UsbStst = 0x2a,
  61. EthTxStat0 = 0x2b,
  62. EthTxStat1 = 0x2c,
  63. EthRxStat = 0x2d,
  64. WakeupControl = 0x78,
  65. Reg7b = 0x7b,
  66. Gpio0 = 0x7e,
  67. Gpio1 = 0x7f,
  68. Reg81 = 0x81,
  69. };
  70. typedef struct pegasus {
  71. struct usb_device *usb;
  72. struct usb_interface *intf;
  73. struct net_device *net;
  74. struct net_device_stats stats;
  75. struct mii_if_info mii;
  76. unsigned flags;
  77. unsigned features;
  78. u32 msg_enable;
  79. u32 wolopts;
  80. int dev_index;
  81. int intr_interval;
  82. struct tasklet_struct rx_tl;
  83. struct delayed_work carrier_check;
  84. struct urb *ctrl_urb, *rx_urb, *tx_urb, *intr_urb;
  85. struct sk_buff *rx_pool[RX_SKBS];
  86. struct sk_buff *rx_skb;
  87. struct usb_ctrlrequest dr;
  88. wait_queue_head_t ctrl_wait;
  89. spinlock_t rx_pool_lock;
  90. int chip;
  91. unsigned char intr_buff[8];
  92. __u8 tx_buff[PEGASUS_MTU];
  93. __u8 eth_regs[4];
  94. __u8 phy;
  95. __u8 gpio_res;
  96. } pegasus_t;
  97. struct usb_eth_dev {
  98. char *name;
  99. __u16 vendor;
  100. __u16 device;
  101. __u32 private; /* LSB is gpio reset value */
  102. };
  103. #define VENDOR_3COM 0x0506
  104. #define VENDOR_ABOCOM 0x07b8
  105. #define VENDOR_ACCTON 0x083a
  106. #define VENDOR_ADMTEK 0x07a6
  107. #define VENDOR_AEILAB 0x3334
  108. #define VENDOR_ALLIEDTEL 0x07c9
  109. #define VENDOR_ATEN 0x0557
  110. #define VENDOR_BELKIN 0x050d
  111. #define VENDOR_BILLIONTON 0x08dd
  112. #define VENDOR_COMPAQ 0x049f
  113. #define VENDOR_COREGA 0x07aa
  114. #define VENDOR_DLINK 0x2001
  115. #define VENDOR_ELCON 0x0db7
  116. #define VENDOR_ELECOM 0x056e
  117. #define VENDOR_ELSA 0x05cc
  118. #define VENDOR_GIGABYTE 0x1044
  119. #define VENDOR_HAWKING 0x0e66
  120. #define VENDOR_HP 0x03f0
  121. #define VENDOR_IODATA 0x04bb
  122. #define VENDOR_KINGSTON 0x0951
  123. #define VENDOR_LANEED 0x056e
  124. #define VENDOR_LINKSYS 0x066b
  125. #define VENDOR_LINKSYS2 0x077b
  126. #define VENDOR_MELCO 0x0411
  127. #define VENDOR_MICROSOFT 0x045e
  128. #define VENDOR_MOBILITY 0x1342
  129. #define VENDOR_NETGEAR 0x0846
  130. #define VENDOR_OCT 0x0b39
  131. #define VENDOR_SMARTBRIDGES 0x08d1
  132. #define VENDOR_SMC 0x0707
  133. #define VENDOR_SOHOWARE 0x15e8
  134. #define VENDOR_SIEMENS 0x067c
  135. #else /* PEGASUS_DEV */
  136. PEGASUS_DEV("3Com USB Ethernet 3C460B", VENDOR_3COM, 0x4601,
  137. DEFAULT_GPIO_RESET | PEGASUS_II)
  138. PEGASUS_DEV("ATEN USB Ethernet UC-110T", VENDOR_ATEN, 0x2007,
  139. DEFAULT_GPIO_RESET | PEGASUS_II)
  140. PEGASUS_DEV("USB HPNA/Ethernet", VENDOR_ABOCOM, 0x110c,
  141. DEFAULT_GPIO_RESET | PEGASUS_II | HAS_HOME_PNA)
  142. PEGASUS_DEV("USB HPNA/Ethernet", VENDOR_ABOCOM, 0x4104,
  143. DEFAULT_GPIO_RESET | HAS_HOME_PNA)
  144. PEGASUS_DEV("USB HPNA/Ethernet", VENDOR_ABOCOM, 0x4004,
  145. DEFAULT_GPIO_RESET | HAS_HOME_PNA)
  146. PEGASUS_DEV("USB HPNA/Ethernet", VENDOR_ABOCOM, 0x4007,
  147. DEFAULT_GPIO_RESET | HAS_HOME_PNA)
  148. PEGASUS_DEV("USB 10/100 Fast Ethernet", VENDOR_ABOCOM, 0x4102,
  149. DEFAULT_GPIO_RESET | PEGASUS_II)
  150. PEGASUS_DEV("USB 10/100 Fast Ethernet", VENDOR_ABOCOM, 0x4002,
  151. DEFAULT_GPIO_RESET)
  152. PEGASUS_DEV("USB 10/100 Fast Ethernet", VENDOR_ABOCOM, 0x400b,
  153. DEFAULT_GPIO_RESET | PEGASUS_II)
  154. PEGASUS_DEV("USB 10/100 Fast Ethernet", VENDOR_ABOCOM, 0x400c,
  155. DEFAULT_GPIO_RESET | PEGASUS_II)
  156. PEGASUS_DEV("USB 10/100 Fast Ethernet", VENDOR_ABOCOM, 0xabc1,
  157. DEFAULT_GPIO_RESET)
  158. PEGASUS_DEV("USB 10/100 Fast Ethernet", VENDOR_ABOCOM, 0x200c,
  159. DEFAULT_GPIO_RESET | PEGASUS_II)
  160. PEGASUS_DEV("Accton USB 10/100 Ethernet Adapter", VENDOR_ACCTON, 0x1046,
  161. DEFAULT_GPIO_RESET)
  162. PEGASUS_DEV("SpeedStream USB 10/100 Ethernet", VENDOR_ACCTON, 0x5046,
  163. DEFAULT_GPIO_RESET | PEGASUS_II)
  164. PEGASUS_DEV("Philips USB 10/100 Ethernet", VENDOR_ACCTON, 0xb004,
  165. DEFAULT_GPIO_RESET | PEGASUS_II)
  166. PEGASUS_DEV("ADMtek ADM8511 \"Pegasus II\" USB Ethernet",
  167. VENDOR_ADMTEK, 0x8511,
  168. DEFAULT_GPIO_RESET | PEGASUS_II | HAS_HOME_PNA)
  169. PEGASUS_DEV("ADMtek ADM8513 \"Pegasus II\" USB Ethernet",
  170. VENDOR_ADMTEK, 0x8513,
  171. DEFAULT_GPIO_RESET | PEGASUS_II)
  172. PEGASUS_DEV("ADMtek ADM8515 \"Pegasus II\" USB-2.0 Ethernet",
  173. VENDOR_ADMTEK, 0x8515,
  174. DEFAULT_GPIO_RESET | PEGASUS_II)
  175. PEGASUS_DEV("ADMtek AN986 \"Pegasus\" USB Ethernet (evaluation board)",
  176. VENDOR_ADMTEK, 0x0986,
  177. DEFAULT_GPIO_RESET | HAS_HOME_PNA)
  178. PEGASUS_DEV("AN986A USB MAC", VENDOR_ADMTEK, 1986,
  179. DEFAULT_GPIO_RESET | PEGASUS_II)
  180. PEGASUS_DEV("AEI USB Fast Ethernet Adapter", VENDOR_AEILAB, 0x1701,
  181. DEFAULT_GPIO_RESET | PEGASUS_II)
  182. PEGASUS_DEV("Allied Telesyn Int. AT-USB100", VENDOR_ALLIEDTEL, 0xb100,
  183. DEFAULT_GPIO_RESET | PEGASUS_II)
  184. /*
  185. * Distinguish between this Belkin adaptor and the Belkin bluetooth adaptors
  186. * with the same product IDs by checking the device class too.
  187. */
  188. PEGASUS_DEV_CLASS("Belkin F5D5050 USB Ethernet", VENDOR_BELKIN, 0x0121, 0x00,
  189. DEFAULT_GPIO_RESET | PEGASUS_II)
  190. PEGASUS_DEV("Belkin F5U122 10/100 USB Ethernet", VENDOR_BELKIN, 0x0122,
  191. DEFAULT_GPIO_RESET | PEGASUS_II)
  192. PEGASUS_DEV("Billionton USB-100", VENDOR_BILLIONTON, 0x0986,
  193. DEFAULT_GPIO_RESET)
  194. PEGASUS_DEV("Billionton USBLP-100", VENDOR_BILLIONTON, 0x0987,
  195. DEFAULT_GPIO_RESET | HAS_HOME_PNA)
  196. PEGASUS_DEV("iPAQ Networking 10/100 USB", VENDOR_COMPAQ, 0x8511,
  197. DEFAULT_GPIO_RESET | PEGASUS_II)
  198. PEGASUS_DEV("Billionton USBEL-100", VENDOR_BILLIONTON, 0x0988,
  199. DEFAULT_GPIO_RESET)
  200. PEGASUS_DEV("Billionton USBE-100", VENDOR_BILLIONTON, 0x8511,
  201. DEFAULT_GPIO_RESET | PEGASUS_II)
  202. PEGASUS_DEV("Corega FEther USB-TX", VENDOR_COREGA, 0x0004,
  203. DEFAULT_GPIO_RESET)
  204. PEGASUS_DEV("Corega FEther USB-TXS", VENDOR_COREGA, 0x000d,
  205. DEFAULT_GPIO_RESET | PEGASUS_II)
  206. PEGASUS_DEV("D-Link DSB-650TX", VENDOR_DLINK, 0x4001,
  207. DEFAULT_GPIO_RESET)
  208. PEGASUS_DEV("D-Link DSB-650TX", VENDOR_DLINK, 0x4002,
  209. DEFAULT_GPIO_RESET)
  210. PEGASUS_DEV("D-Link DSB-650TX", VENDOR_DLINK, 0x4102,
  211. DEFAULT_GPIO_RESET | PEGASUS_II)
  212. PEGASUS_DEV("D-Link DSB-650TX", VENDOR_DLINK, 0x400b,
  213. DEFAULT_GPIO_RESET | PEGASUS_II)
  214. PEGASUS_DEV("D-Link DSB-650TX", VENDOR_DLINK, 0x200c,
  215. DEFAULT_GPIO_RESET | PEGASUS_II)
  216. PEGASUS_DEV("D-Link DSB-650TX(PNA)", VENDOR_DLINK, 0x4003,
  217. DEFAULT_GPIO_RESET | HAS_HOME_PNA)
  218. PEGASUS_DEV("D-Link DSB-650", VENDOR_DLINK, 0xabc1,
  219. DEFAULT_GPIO_RESET)
  220. PEGASUS_DEV("GOLDPFEIL USB Adapter", VENDOR_ELCON, 0x0002,
  221. DEFAULT_GPIO_RESET | PEGASUS_II | HAS_HOME_PNA)
  222. PEGASUS_DEV("ELECOM USB Ethernet LD-USB20", VENDOR_ELECOM, 0x4010,
  223. DEFAULT_GPIO_RESET | PEGASUS_II)
  224. PEGASUS_DEV("EasiDock Ethernet", VENDOR_MOBILITY, 0x0304,
  225. DEFAULT_GPIO_RESET)
  226. PEGASUS_DEV("Elsa Micolink USB2Ethernet", VENDOR_ELSA, 0x3000,
  227. DEFAULT_GPIO_RESET)
  228. PEGASUS_DEV("GIGABYTE GN-BR402W Wireless Router", VENDOR_GIGABYTE, 0x8002,
  229. DEFAULT_GPIO_RESET)
  230. PEGASUS_DEV("Hawking UF100 10/100 Ethernet", VENDOR_HAWKING, 0x400c,
  231. DEFAULT_GPIO_RESET | PEGASUS_II)
  232. PEGASUS_DEV("HP hn210c Ethernet USB", VENDOR_HP, 0x811c,
  233. DEFAULT_GPIO_RESET | PEGASUS_II)
  234. PEGASUS_DEV("IO DATA USB ET/TX", VENDOR_IODATA, 0x0904,
  235. DEFAULT_GPIO_RESET)
  236. PEGASUS_DEV("IO DATA USB ET/TX-S", VENDOR_IODATA, 0x0913,
  237. DEFAULT_GPIO_RESET | PEGASUS_II)
  238. PEGASUS_DEV("IO DATA USB ETX-US2", VENDOR_IODATA, 0x093a,
  239. DEFAULT_GPIO_RESET | PEGASUS_II)
  240. PEGASUS_DEV("Kingston KNU101TX Ethernet", VENDOR_KINGSTON, 0x000a,
  241. DEFAULT_GPIO_RESET)
  242. PEGASUS_DEV("LANEED USB Ethernet LD-USB/TX", VENDOR_LANEED, 0x4002,
  243. DEFAULT_GPIO_RESET)
  244. PEGASUS_DEV("LANEED USB Ethernet LD-USBL/TX", VENDOR_LANEED, 0x4005,
  245. DEFAULT_GPIO_RESET | PEGASUS_II)
  246. PEGASUS_DEV("LANEED USB Ethernet LD-USB/TX", VENDOR_LANEED, 0x400b,
  247. DEFAULT_GPIO_RESET | PEGASUS_II)
  248. PEGASUS_DEV("LANEED USB Ethernet LD-USB/T", VENDOR_LANEED, 0xabc1,
  249. DEFAULT_GPIO_RESET)
  250. PEGASUS_DEV("LANEED USB Ethernet LD-USB/TX", VENDOR_LANEED, 0x200c,
  251. DEFAULT_GPIO_RESET | PEGASUS_II)
  252. PEGASUS_DEV("Linksys USB10TX", VENDOR_LINKSYS, 0x2202,
  253. DEFAULT_GPIO_RESET)
  254. PEGASUS_DEV("Linksys USB100TX", VENDOR_LINKSYS, 0x2203,
  255. DEFAULT_GPIO_RESET)
  256. PEGASUS_DEV("Linksys USB100TX", VENDOR_LINKSYS, 0x2204,
  257. DEFAULT_GPIO_RESET | HAS_HOME_PNA)
  258. PEGASUS_DEV("Linksys USB10T Ethernet Adapter", VENDOR_LINKSYS, 0x2206,
  259. DEFAULT_GPIO_RESET | PEGASUS_II)
  260. PEGASUS_DEV("Linksys USBVPN1", VENDOR_LINKSYS2, 0x08b4,
  261. DEFAULT_GPIO_RESET)
  262. PEGASUS_DEV("Linksys USB USB100TX", VENDOR_LINKSYS, 0x400b,
  263. DEFAULT_GPIO_RESET | PEGASUS_II)
  264. PEGASUS_DEV("Linksys USB10TX", VENDOR_LINKSYS, 0x200c,
  265. DEFAULT_GPIO_RESET | PEGASUS_II)
  266. PEGASUS_DEV("MELCO/BUFFALO LUA-TX", VENDOR_MELCO, 0x0001,
  267. DEFAULT_GPIO_RESET)
  268. PEGASUS_DEV("MELCO/BUFFALO LUA-TX", VENDOR_MELCO, 0x0005,
  269. DEFAULT_GPIO_RESET)
  270. PEGASUS_DEV("MELCO/BUFFALO LUA2-TX", VENDOR_MELCO, 0x0009,
  271. DEFAULT_GPIO_RESET | PEGASUS_II)
  272. PEGASUS_DEV("Microsoft MN-110", VENDOR_MICROSOFT, 0x007a,
  273. DEFAULT_GPIO_RESET | PEGASUS_II)
  274. PEGASUS_DEV("NETGEAR FA101", VENDOR_NETGEAR, 0x1020,
  275. DEFAULT_GPIO_RESET | PEGASUS_II)
  276. PEGASUS_DEV("OCT Inc.", VENDOR_OCT, 0x0109,
  277. DEFAULT_GPIO_RESET | PEGASUS_II)
  278. PEGASUS_DEV("OCT USB TO Ethernet", VENDOR_OCT, 0x0901,
  279. DEFAULT_GPIO_RESET | PEGASUS_II)
  280. PEGASUS_DEV("smartNIC 2 PnP Adapter", VENDOR_SMARTBRIDGES, 0x0003,
  281. DEFAULT_GPIO_RESET | PEGASUS_II)
  282. PEGASUS_DEV("SMC 202 USB Ethernet", VENDOR_SMC, 0x0200,
  283. DEFAULT_GPIO_RESET)
  284. PEGASUS_DEV("SMC 2206 USB Ethernet", VENDOR_SMC, 0x0201,
  285. DEFAULT_GPIO_RESET | PEGASUS_II)
  286. PEGASUS_DEV("SOHOware NUB100 Ethernet", VENDOR_SOHOWARE, 0x9100,
  287. DEFAULT_GPIO_RESET)
  288. PEGASUS_DEV("SOHOware NUB110 Ethernet", VENDOR_SOHOWARE, 0x9110,
  289. DEFAULT_GPIO_RESET | PEGASUS_II)
  290. PEGASUS_DEV("SpeedStream USB 10/100 Ethernet", VENDOR_SIEMENS, 0x1001,
  291. DEFAULT_GPIO_RESET | PEGASUS_II)
  292. #endif /* PEGASUS_DEV */