pegasus.h 10 KB

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