8250_pci.c 71 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874
  1. /*
  2. * linux/drivers/char/8250_pci.c
  3. *
  4. * Probe module for 8250/16550-type PCI serial ports.
  5. *
  6. * Based on drivers/char/serial.c, by Linus Torvalds, Theodore Ts'o.
  7. *
  8. * Copyright (C) 2001 Russell King, All Rights Reserved.
  9. *
  10. * This program is free software; you can redistribute it and/or modify
  11. * it under the terms of the GNU General Public License as published by
  12. * the Free Software Foundation; either version 2 of the License.
  13. */
  14. #include <linux/module.h>
  15. #include <linux/init.h>
  16. #include <linux/pci.h>
  17. #include <linux/string.h>
  18. #include <linux/kernel.h>
  19. #include <linux/slab.h>
  20. #include <linux/delay.h>
  21. #include <linux/tty.h>
  22. #include <linux/serial_core.h>
  23. #include <linux/8250_pci.h>
  24. #include <linux/bitops.h>
  25. #include <asm/byteorder.h>
  26. #include <asm/io.h>
  27. #include "8250.h"
  28. #undef SERIAL_DEBUG_PCI
  29. /*
  30. * init function returns:
  31. * > 0 - number of ports
  32. * = 0 - use board->num_ports
  33. * < 0 - error
  34. */
  35. struct pci_serial_quirk {
  36. u32 vendor;
  37. u32 device;
  38. u32 subvendor;
  39. u32 subdevice;
  40. int (*init)(struct pci_dev *dev);
  41. int (*setup)(struct serial_private *, struct pciserial_board *,
  42. struct uart_port *, int);
  43. void (*exit)(struct pci_dev *dev);
  44. };
  45. #define PCI_NUM_BAR_RESOURCES 6
  46. struct serial_private {
  47. struct pci_dev *dev;
  48. unsigned int nr;
  49. void __iomem *remapped_bar[PCI_NUM_BAR_RESOURCES];
  50. struct pci_serial_quirk *quirk;
  51. int line[0];
  52. };
  53. static void moan_device(const char *str, struct pci_dev *dev)
  54. {
  55. printk(KERN_WARNING "%s: %s\n"
  56. KERN_WARNING "Please send the output of lspci -vv, this\n"
  57. KERN_WARNING "message (0x%04x,0x%04x,0x%04x,0x%04x), the\n"
  58. KERN_WARNING "manufacturer and name of serial board or\n"
  59. KERN_WARNING "modem board to rmk+serial@arm.linux.org.uk.\n",
  60. pci_name(dev), str, dev->vendor, dev->device,
  61. dev->subsystem_vendor, dev->subsystem_device);
  62. }
  63. static int
  64. setup_port(struct serial_private *priv, struct uart_port *port,
  65. int bar, int offset, int regshift)
  66. {
  67. struct pci_dev *dev = priv->dev;
  68. unsigned long base, len;
  69. if (bar >= PCI_NUM_BAR_RESOURCES)
  70. return -EINVAL;
  71. base = pci_resource_start(dev, bar);
  72. if (pci_resource_flags(dev, bar) & IORESOURCE_MEM) {
  73. len = pci_resource_len(dev, bar);
  74. if (!priv->remapped_bar[bar])
  75. priv->remapped_bar[bar] = ioremap_nocache(base, len);
  76. if (!priv->remapped_bar[bar])
  77. return -ENOMEM;
  78. port->iotype = UPIO_MEM;
  79. port->iobase = 0;
  80. port->mapbase = base + offset;
  81. port->membase = priv->remapped_bar[bar] + offset;
  82. port->regshift = regshift;
  83. } else {
  84. port->iotype = UPIO_PORT;
  85. port->iobase = base + offset;
  86. port->mapbase = 0;
  87. port->membase = NULL;
  88. port->regshift = 0;
  89. }
  90. return 0;
  91. }
  92. /*
  93. * ADDI-DATA GmbH communication cards <info@addi-data.com>
  94. */
  95. static int addidata_apci7800_setup(struct serial_private *priv,
  96. struct pciserial_board *board,
  97. struct uart_port *port, int idx)
  98. {
  99. unsigned int bar = 0, offset = board->first_offset;
  100. bar = FL_GET_BASE(board->flags);
  101. if (idx < 2) {
  102. offset += idx * board->uart_offset;
  103. } else if ((idx >= 2) && (idx < 4)) {
  104. bar += 1;
  105. offset += ((idx - 2) * board->uart_offset);
  106. } else if ((idx >= 4) && (idx < 6)) {
  107. bar += 2;
  108. offset += ((idx - 4) * board->uart_offset);
  109. } else if (idx >= 6) {
  110. bar += 3;
  111. offset += ((idx - 6) * board->uart_offset);
  112. }
  113. return setup_port(priv, port, bar, offset, board->reg_shift);
  114. }
  115. /*
  116. * AFAVLAB uses a different mixture of BARs and offsets
  117. * Not that ugly ;) -- HW
  118. */
  119. static int
  120. afavlab_setup(struct serial_private *priv, struct pciserial_board *board,
  121. struct uart_port *port, int idx)
  122. {
  123. unsigned int bar, offset = board->first_offset;
  124. bar = FL_GET_BASE(board->flags);
  125. if (idx < 4)
  126. bar += idx;
  127. else {
  128. bar = 4;
  129. offset += (idx - 4) * board->uart_offset;
  130. }
  131. return setup_port(priv, port, bar, offset, board->reg_shift);
  132. }
  133. /*
  134. * HP's Remote Management Console. The Diva chip came in several
  135. * different versions. N-class, L2000 and A500 have two Diva chips, each
  136. * with 3 UARTs (the third UART on the second chip is unused). Superdome
  137. * and Keystone have one Diva chip with 3 UARTs. Some later machines have
  138. * one Diva chip, but it has been expanded to 5 UARTs.
  139. */
  140. static int pci_hp_diva_init(struct pci_dev *dev)
  141. {
  142. int rc = 0;
  143. switch (dev->subsystem_device) {
  144. case PCI_DEVICE_ID_HP_DIVA_TOSCA1:
  145. case PCI_DEVICE_ID_HP_DIVA_HALFDOME:
  146. case PCI_DEVICE_ID_HP_DIVA_KEYSTONE:
  147. case PCI_DEVICE_ID_HP_DIVA_EVEREST:
  148. rc = 3;
  149. break;
  150. case PCI_DEVICE_ID_HP_DIVA_TOSCA2:
  151. rc = 2;
  152. break;
  153. case PCI_DEVICE_ID_HP_DIVA_MAESTRO:
  154. rc = 4;
  155. break;
  156. case PCI_DEVICE_ID_HP_DIVA_POWERBAR:
  157. case PCI_DEVICE_ID_HP_DIVA_HURRICANE:
  158. rc = 1;
  159. break;
  160. }
  161. return rc;
  162. }
  163. /*
  164. * HP's Diva chip puts the 4th/5th serial port further out, and
  165. * some serial ports are supposed to be hidden on certain models.
  166. */
  167. static int
  168. pci_hp_diva_setup(struct serial_private *priv, struct pciserial_board *board,
  169. struct uart_port *port, int idx)
  170. {
  171. unsigned int offset = board->first_offset;
  172. unsigned int bar = FL_GET_BASE(board->flags);
  173. switch (priv->dev->subsystem_device) {
  174. case PCI_DEVICE_ID_HP_DIVA_MAESTRO:
  175. if (idx == 3)
  176. idx++;
  177. break;
  178. case PCI_DEVICE_ID_HP_DIVA_EVEREST:
  179. if (idx > 0)
  180. idx++;
  181. if (idx > 2)
  182. idx++;
  183. break;
  184. }
  185. if (idx > 2)
  186. offset = 0x18;
  187. offset += idx * board->uart_offset;
  188. return setup_port(priv, port, bar, offset, board->reg_shift);
  189. }
  190. /*
  191. * Added for EKF Intel i960 serial boards
  192. */
  193. static int pci_inteli960ni_init(struct pci_dev *dev)
  194. {
  195. unsigned long oldval;
  196. if (!(dev->subsystem_device & 0x1000))
  197. return -ENODEV;
  198. /* is firmware started? */
  199. pci_read_config_dword(dev, 0x44, (void *)&oldval);
  200. if (oldval == 0x00001000L) { /* RESET value */
  201. printk(KERN_DEBUG "Local i960 firmware missing");
  202. return -ENODEV;
  203. }
  204. return 0;
  205. }
  206. /*
  207. * Some PCI serial cards using the PLX 9050 PCI interface chip require
  208. * that the card interrupt be explicitly enabled or disabled. This
  209. * seems to be mainly needed on card using the PLX which also use I/O
  210. * mapped memory.
  211. */
  212. static int pci_plx9050_init(struct pci_dev *dev)
  213. {
  214. u8 irq_config;
  215. void __iomem *p;
  216. if ((pci_resource_flags(dev, 0) & IORESOURCE_MEM) == 0) {
  217. moan_device("no memory in bar 0", dev);
  218. return 0;
  219. }
  220. irq_config = 0x41;
  221. if (dev->vendor == PCI_VENDOR_ID_PANACOM ||
  222. dev->subsystem_vendor == PCI_SUBVENDOR_ID_EXSYS)
  223. irq_config = 0x43;
  224. if ((dev->vendor == PCI_VENDOR_ID_PLX) &&
  225. (dev->device == PCI_DEVICE_ID_PLX_ROMULUS))
  226. /*
  227. * As the megawolf cards have the int pins active
  228. * high, and have 2 UART chips, both ints must be
  229. * enabled on the 9050. Also, the UARTS are set in
  230. * 16450 mode by default, so we have to enable the
  231. * 16C950 'enhanced' mode so that we can use the
  232. * deep FIFOs
  233. */
  234. irq_config = 0x5b;
  235. /*
  236. * enable/disable interrupts
  237. */
  238. p = ioremap_nocache(pci_resource_start(dev, 0), 0x80);
  239. if (p == NULL)
  240. return -ENOMEM;
  241. writel(irq_config, p + 0x4c);
  242. /*
  243. * Read the register back to ensure that it took effect.
  244. */
  245. readl(p + 0x4c);
  246. iounmap(p);
  247. return 0;
  248. }
  249. static void __devexit pci_plx9050_exit(struct pci_dev *dev)
  250. {
  251. u8 __iomem *p;
  252. if ((pci_resource_flags(dev, 0) & IORESOURCE_MEM) == 0)
  253. return;
  254. /*
  255. * disable interrupts
  256. */
  257. p = ioremap_nocache(pci_resource_start(dev, 0), 0x80);
  258. if (p != NULL) {
  259. writel(0, p + 0x4c);
  260. /*
  261. * Read the register back to ensure that it took effect.
  262. */
  263. readl(p + 0x4c);
  264. iounmap(p);
  265. }
  266. }
  267. /* SBS Technologies Inc. PMC-OCTPRO and P-OCTAL cards */
  268. static int
  269. sbs_setup(struct serial_private *priv, struct pciserial_board *board,
  270. struct uart_port *port, int idx)
  271. {
  272. unsigned int bar, offset = board->first_offset;
  273. bar = 0;
  274. if (idx < 4) {
  275. /* first four channels map to 0, 0x100, 0x200, 0x300 */
  276. offset += idx * board->uart_offset;
  277. } else if (idx < 8) {
  278. /* last four channels map to 0x1000, 0x1100, 0x1200, 0x1300 */
  279. offset += idx * board->uart_offset + 0xC00;
  280. } else /* we have only 8 ports on PMC-OCTALPRO */
  281. return 1;
  282. return setup_port(priv, port, bar, offset, board->reg_shift);
  283. }
  284. /*
  285. * This does initialization for PMC OCTALPRO cards:
  286. * maps the device memory, resets the UARTs (needed, bc
  287. * if the module is removed and inserted again, the card
  288. * is in the sleep mode) and enables global interrupt.
  289. */
  290. /* global control register offset for SBS PMC-OctalPro */
  291. #define OCT_REG_CR_OFF 0x500
  292. static int sbs_init(struct pci_dev *dev)
  293. {
  294. u8 __iomem *p;
  295. p = ioremap_nocache(pci_resource_start(dev, 0),
  296. pci_resource_len(dev, 0));
  297. if (p == NULL)
  298. return -ENOMEM;
  299. /* Set bit-4 Control Register (UART RESET) in to reset the uarts */
  300. writeb(0x10, p + OCT_REG_CR_OFF);
  301. udelay(50);
  302. writeb(0x0, p + OCT_REG_CR_OFF);
  303. /* Set bit-2 (INTENABLE) of Control Register */
  304. writeb(0x4, p + OCT_REG_CR_OFF);
  305. iounmap(p);
  306. return 0;
  307. }
  308. /*
  309. * Disables the global interrupt of PMC-OctalPro
  310. */
  311. static void __devexit sbs_exit(struct pci_dev *dev)
  312. {
  313. u8 __iomem *p;
  314. p = ioremap_nocache(pci_resource_start(dev, 0),
  315. pci_resource_len(dev, 0));
  316. /* FIXME: What if resource_len < OCT_REG_CR_OFF */
  317. if (p != NULL)
  318. writeb(0, p + OCT_REG_CR_OFF);
  319. iounmap(p);
  320. }
  321. /*
  322. * SIIG serial cards have an PCI interface chip which also controls
  323. * the UART clocking frequency. Each UART can be clocked independently
  324. * (except cards equiped with 4 UARTs) and initial clocking settings
  325. * are stored in the EEPROM chip. It can cause problems because this
  326. * version of serial driver doesn't support differently clocked UART's
  327. * on single PCI card. To prevent this, initialization functions set
  328. * high frequency clocking for all UART's on given card. It is safe (I
  329. * hope) because it doesn't touch EEPROM settings to prevent conflicts
  330. * with other OSes (like M$ DOS).
  331. *
  332. * SIIG support added by Andrey Panin <pazke@donpac.ru>, 10/1999
  333. *
  334. * There is two family of SIIG serial cards with different PCI
  335. * interface chip and different configuration methods:
  336. * - 10x cards have control registers in IO and/or memory space;
  337. * - 20x cards have control registers in standard PCI configuration space.
  338. *
  339. * Note: all 10x cards have PCI device ids 0x10..
  340. * all 20x cards have PCI device ids 0x20..
  341. *
  342. * There are also Quartet Serial cards which use Oxford Semiconductor
  343. * 16954 quad UART PCI chip clocked by 18.432 MHz quartz.
  344. *
  345. * Note: some SIIG cards are probed by the parport_serial object.
  346. */
  347. #define PCI_DEVICE_ID_SIIG_1S_10x (PCI_DEVICE_ID_SIIG_1S_10x_550 & 0xfffc)
  348. #define PCI_DEVICE_ID_SIIG_2S_10x (PCI_DEVICE_ID_SIIG_2S_10x_550 & 0xfff8)
  349. static int pci_siig10x_init(struct pci_dev *dev)
  350. {
  351. u16 data;
  352. void __iomem *p;
  353. switch (dev->device & 0xfff8) {
  354. case PCI_DEVICE_ID_SIIG_1S_10x: /* 1S */
  355. data = 0xffdf;
  356. break;
  357. case PCI_DEVICE_ID_SIIG_2S_10x: /* 2S, 2S1P */
  358. data = 0xf7ff;
  359. break;
  360. default: /* 1S1P, 4S */
  361. data = 0xfffb;
  362. break;
  363. }
  364. p = ioremap_nocache(pci_resource_start(dev, 0), 0x80);
  365. if (p == NULL)
  366. return -ENOMEM;
  367. writew(readw(p + 0x28) & data, p + 0x28);
  368. readw(p + 0x28);
  369. iounmap(p);
  370. return 0;
  371. }
  372. #define PCI_DEVICE_ID_SIIG_2S_20x (PCI_DEVICE_ID_SIIG_2S_20x_550 & 0xfffc)
  373. #define PCI_DEVICE_ID_SIIG_2S1P_20x (PCI_DEVICE_ID_SIIG_2S1P_20x_550 & 0xfffc)
  374. static int pci_siig20x_init(struct pci_dev *dev)
  375. {
  376. u8 data;
  377. /* Change clock frequency for the first UART. */
  378. pci_read_config_byte(dev, 0x6f, &data);
  379. pci_write_config_byte(dev, 0x6f, data & 0xef);
  380. /* If this card has 2 UART, we have to do the same with second UART. */
  381. if (((dev->device & 0xfffc) == PCI_DEVICE_ID_SIIG_2S_20x) ||
  382. ((dev->device & 0xfffc) == PCI_DEVICE_ID_SIIG_2S1P_20x)) {
  383. pci_read_config_byte(dev, 0x73, &data);
  384. pci_write_config_byte(dev, 0x73, data & 0xef);
  385. }
  386. return 0;
  387. }
  388. static int pci_siig_init(struct pci_dev *dev)
  389. {
  390. unsigned int type = dev->device & 0xff00;
  391. if (type == 0x1000)
  392. return pci_siig10x_init(dev);
  393. else if (type == 0x2000)
  394. return pci_siig20x_init(dev);
  395. moan_device("Unknown SIIG card", dev);
  396. return -ENODEV;
  397. }
  398. static int pci_siig_setup(struct serial_private *priv,
  399. struct pciserial_board *board,
  400. struct uart_port *port, int idx)
  401. {
  402. unsigned int bar = FL_GET_BASE(board->flags) + idx, offset = 0;
  403. if (idx > 3) {
  404. bar = 4;
  405. offset = (idx - 4) * 8;
  406. }
  407. return setup_port(priv, port, bar, offset, 0);
  408. }
  409. /*
  410. * Timedia has an explosion of boards, and to avoid the PCI table from
  411. * growing *huge*, we use this function to collapse some 70 entries
  412. * in the PCI table into one, for sanity's and compactness's sake.
  413. */
  414. static const unsigned short timedia_single_port[] = {
  415. 0x4025, 0x4027, 0x4028, 0x5025, 0x5027, 0
  416. };
  417. static const unsigned short timedia_dual_port[] = {
  418. 0x0002, 0x4036, 0x4037, 0x4038, 0x4078, 0x4079, 0x4085,
  419. 0x4088, 0x4089, 0x5037, 0x5078, 0x5079, 0x5085, 0x6079,
  420. 0x7079, 0x8079, 0x8137, 0x8138, 0x8237, 0x8238, 0x9079,
  421. 0x9137, 0x9138, 0x9237, 0x9238, 0xA079, 0xB079, 0xC079,
  422. 0xD079, 0
  423. };
  424. static const unsigned short timedia_quad_port[] = {
  425. 0x4055, 0x4056, 0x4095, 0x4096, 0x5056, 0x8156, 0x8157,
  426. 0x8256, 0x8257, 0x9056, 0x9156, 0x9157, 0x9158, 0x9159,
  427. 0x9256, 0x9257, 0xA056, 0xA157, 0xA158, 0xA159, 0xB056,
  428. 0xB157, 0
  429. };
  430. static const unsigned short timedia_eight_port[] = {
  431. 0x4065, 0x4066, 0x5065, 0x5066, 0x8166, 0x9066, 0x9166,
  432. 0x9167, 0x9168, 0xA066, 0xA167, 0xA168, 0
  433. };
  434. static const struct timedia_struct {
  435. int num;
  436. const unsigned short *ids;
  437. } timedia_data[] = {
  438. { 1, timedia_single_port },
  439. { 2, timedia_dual_port },
  440. { 4, timedia_quad_port },
  441. { 8, timedia_eight_port }
  442. };
  443. static int pci_timedia_init(struct pci_dev *dev)
  444. {
  445. const unsigned short *ids;
  446. int i, j;
  447. for (i = 0; i < ARRAY_SIZE(timedia_data); i++) {
  448. ids = timedia_data[i].ids;
  449. for (j = 0; ids[j]; j++)
  450. if (dev->subsystem_device == ids[j])
  451. return timedia_data[i].num;
  452. }
  453. return 0;
  454. }
  455. /*
  456. * Timedia/SUNIX uses a mixture of BARs and offsets
  457. * Ugh, this is ugly as all hell --- TYT
  458. */
  459. static int
  460. pci_timedia_setup(struct serial_private *priv, struct pciserial_board *board,
  461. struct uart_port *port, int idx)
  462. {
  463. unsigned int bar = 0, offset = board->first_offset;
  464. switch (idx) {
  465. case 0:
  466. bar = 0;
  467. break;
  468. case 1:
  469. offset = board->uart_offset;
  470. bar = 0;
  471. break;
  472. case 2:
  473. bar = 1;
  474. break;
  475. case 3:
  476. offset = board->uart_offset;
  477. /* FALLTHROUGH */
  478. case 4: /* BAR 2 */
  479. case 5: /* BAR 3 */
  480. case 6: /* BAR 4 */
  481. case 7: /* BAR 5 */
  482. bar = idx - 2;
  483. }
  484. return setup_port(priv, port, bar, offset, board->reg_shift);
  485. }
  486. /*
  487. * Some Titan cards are also a little weird
  488. */
  489. static int
  490. titan_400l_800l_setup(struct serial_private *priv,
  491. struct pciserial_board *board,
  492. struct uart_port *port, int idx)
  493. {
  494. unsigned int bar, offset = board->first_offset;
  495. switch (idx) {
  496. case 0:
  497. bar = 1;
  498. break;
  499. case 1:
  500. bar = 2;
  501. break;
  502. default:
  503. bar = 4;
  504. offset = (idx - 2) * board->uart_offset;
  505. }
  506. return setup_port(priv, port, bar, offset, board->reg_shift);
  507. }
  508. static int pci_xircom_init(struct pci_dev *dev)
  509. {
  510. msleep(100);
  511. return 0;
  512. }
  513. static int pci_netmos_init(struct pci_dev *dev)
  514. {
  515. /* subdevice 0x00PS means <P> parallel, <S> serial */
  516. unsigned int num_serial = dev->subsystem_device & 0xf;
  517. if (num_serial == 0)
  518. return -ENODEV;
  519. return num_serial;
  520. }
  521. /*
  522. * ITE support by Niels de Vos <niels.devos@wincor-nixdorf.com>
  523. *
  524. * These chips are available with optionally one parallel port and up to
  525. * two serial ports. Unfortunately they all have the same product id.
  526. *
  527. * Basic configuration is done over a region of 32 I/O ports. The base
  528. * ioport is called INTA or INTC, depending on docs/other drivers.
  529. *
  530. * The region of the 32 I/O ports is configured in POSIO0R...
  531. */
  532. /* registers */
  533. #define ITE_887x_MISCR 0x9c
  534. #define ITE_887x_INTCBAR 0x78
  535. #define ITE_887x_UARTBAR 0x7c
  536. #define ITE_887x_PS0BAR 0x10
  537. #define ITE_887x_POSIO0 0x60
  538. /* I/O space size */
  539. #define ITE_887x_IOSIZE 32
  540. /* I/O space size (bits 26-24; 8 bytes = 011b) */
  541. #define ITE_887x_POSIO_IOSIZE_8 (3 << 24)
  542. /* I/O space size (bits 26-24; 32 bytes = 101b) */
  543. #define ITE_887x_POSIO_IOSIZE_32 (5 << 24)
  544. /* Decoding speed (1 = slow, 2 = medium, 3 = fast) */
  545. #define ITE_887x_POSIO_SPEED (3 << 29)
  546. /* enable IO_Space bit */
  547. #define ITE_887x_POSIO_ENABLE (1 << 31)
  548. static int pci_ite887x_init(struct pci_dev *dev)
  549. {
  550. /* inta_addr are the configuration addresses of the ITE */
  551. static const short inta_addr[] = { 0x2a0, 0x2c0, 0x220, 0x240, 0x1e0,
  552. 0x200, 0x280, 0 };
  553. int ret, i, type;
  554. struct resource *iobase = NULL;
  555. u32 miscr, uartbar, ioport;
  556. /* search for the base-ioport */
  557. i = 0;
  558. while (inta_addr[i] && iobase == NULL) {
  559. iobase = request_region(inta_addr[i], ITE_887x_IOSIZE,
  560. "ite887x");
  561. if (iobase != NULL) {
  562. /* write POSIO0R - speed | size | ioport */
  563. pci_write_config_dword(dev, ITE_887x_POSIO0,
  564. ITE_887x_POSIO_ENABLE | ITE_887x_POSIO_SPEED |
  565. ITE_887x_POSIO_IOSIZE_32 | inta_addr[i]);
  566. /* write INTCBAR - ioport */
  567. pci_write_config_dword(dev, ITE_887x_INTCBAR,
  568. inta_addr[i]);
  569. ret = inb(inta_addr[i]);
  570. if (ret != 0xff) {
  571. /* ioport connected */
  572. break;
  573. }
  574. release_region(iobase->start, ITE_887x_IOSIZE);
  575. iobase = NULL;
  576. }
  577. i++;
  578. }
  579. if (!inta_addr[i]) {
  580. printk(KERN_ERR "ite887x: could not find iobase\n");
  581. return -ENODEV;
  582. }
  583. /* start of undocumented type checking (see parport_pc.c) */
  584. type = inb(iobase->start + 0x18) & 0x0f;
  585. switch (type) {
  586. case 0x2: /* ITE8871 (1P) */
  587. case 0xa: /* ITE8875 (1P) */
  588. ret = 0;
  589. break;
  590. case 0xe: /* ITE8872 (2S1P) */
  591. ret = 2;
  592. break;
  593. case 0x6: /* ITE8873 (1S) */
  594. ret = 1;
  595. break;
  596. case 0x8: /* ITE8874 (2S) */
  597. ret = 2;
  598. break;
  599. default:
  600. moan_device("Unknown ITE887x", dev);
  601. ret = -ENODEV;
  602. }
  603. /* configure all serial ports */
  604. for (i = 0; i < ret; i++) {
  605. /* read the I/O port from the device */
  606. pci_read_config_dword(dev, ITE_887x_PS0BAR + (0x4 * (i + 1)),
  607. &ioport);
  608. ioport &= 0x0000FF00; /* the actual base address */
  609. pci_write_config_dword(dev, ITE_887x_POSIO0 + (0x4 * (i + 1)),
  610. ITE_887x_POSIO_ENABLE | ITE_887x_POSIO_SPEED |
  611. ITE_887x_POSIO_IOSIZE_8 | ioport);
  612. /* write the ioport to the UARTBAR */
  613. pci_read_config_dword(dev, ITE_887x_UARTBAR, &uartbar);
  614. uartbar &= ~(0xffff << (16 * i)); /* clear half the reg */
  615. uartbar |= (ioport << (16 * i)); /* set the ioport */
  616. pci_write_config_dword(dev, ITE_887x_UARTBAR, uartbar);
  617. /* get current config */
  618. pci_read_config_dword(dev, ITE_887x_MISCR, &miscr);
  619. /* disable interrupts (UARTx_Routing[3:0]) */
  620. miscr &= ~(0xf << (12 - 4 * i));
  621. /* activate the UART (UARTx_En) */
  622. miscr |= 1 << (23 - i);
  623. /* write new config with activated UART */
  624. pci_write_config_dword(dev, ITE_887x_MISCR, miscr);
  625. }
  626. if (ret <= 0) {
  627. /* the device has no UARTs if we get here */
  628. release_region(iobase->start, ITE_887x_IOSIZE);
  629. }
  630. return ret;
  631. }
  632. static void __devexit pci_ite887x_exit(struct pci_dev *dev)
  633. {
  634. u32 ioport;
  635. /* the ioport is bit 0-15 in POSIO0R */
  636. pci_read_config_dword(dev, ITE_887x_POSIO0, &ioport);
  637. ioport &= 0xffff;
  638. release_region(ioport, ITE_887x_IOSIZE);
  639. }
  640. static int
  641. pci_default_setup(struct serial_private *priv, struct pciserial_board *board,
  642. struct uart_port *port, int idx)
  643. {
  644. unsigned int bar, offset = board->first_offset, maxnr;
  645. bar = FL_GET_BASE(board->flags);
  646. if (board->flags & FL_BASE_BARS)
  647. bar += idx;
  648. else
  649. offset += idx * board->uart_offset;
  650. maxnr = (pci_resource_len(priv->dev, bar) - board->first_offset) >>
  651. (board->reg_shift + 3);
  652. if (board->flags & FL_REGION_SZ_CAP && idx >= maxnr)
  653. return 1;
  654. return setup_port(priv, port, bar, offset, board->reg_shift);
  655. }
  656. /* This should be in linux/pci_ids.h */
  657. #define PCI_VENDOR_ID_SBSMODULARIO 0x124B
  658. #define PCI_SUBVENDOR_ID_SBSMODULARIO 0x124B
  659. #define PCI_DEVICE_ID_OCTPRO 0x0001
  660. #define PCI_SUBDEVICE_ID_OCTPRO232 0x0108
  661. #define PCI_SUBDEVICE_ID_OCTPRO422 0x0208
  662. #define PCI_SUBDEVICE_ID_POCTAL232 0x0308
  663. #define PCI_SUBDEVICE_ID_POCTAL422 0x0408
  664. /*
  665. * Master list of serial port init/setup/exit quirks.
  666. * This does not describe the general nature of the port.
  667. * (ie, baud base, number and location of ports, etc)
  668. *
  669. * This list is ordered alphabetically by vendor then device.
  670. * Specific entries must come before more generic entries.
  671. */
  672. static struct pci_serial_quirk pci_serial_quirks[] __refdata = {
  673. /*
  674. * ADDI-DATA GmbH communication cards <info@addi-data.com>
  675. */
  676. {
  677. .vendor = PCI_VENDOR_ID_ADDIDATA_OLD,
  678. .device = PCI_DEVICE_ID_ADDIDATA_APCI7800,
  679. .subvendor = PCI_ANY_ID,
  680. .subdevice = PCI_ANY_ID,
  681. .setup = addidata_apci7800_setup,
  682. },
  683. /*
  684. * AFAVLAB cards - these may be called via parport_serial
  685. * It is not clear whether this applies to all products.
  686. */
  687. {
  688. .vendor = PCI_VENDOR_ID_AFAVLAB,
  689. .device = PCI_ANY_ID,
  690. .subvendor = PCI_ANY_ID,
  691. .subdevice = PCI_ANY_ID,
  692. .setup = afavlab_setup,
  693. },
  694. /*
  695. * HP Diva
  696. */
  697. {
  698. .vendor = PCI_VENDOR_ID_HP,
  699. .device = PCI_DEVICE_ID_HP_DIVA,
  700. .subvendor = PCI_ANY_ID,
  701. .subdevice = PCI_ANY_ID,
  702. .init = pci_hp_diva_init,
  703. .setup = pci_hp_diva_setup,
  704. },
  705. /*
  706. * Intel
  707. */
  708. {
  709. .vendor = PCI_VENDOR_ID_INTEL,
  710. .device = PCI_DEVICE_ID_INTEL_80960_RP,
  711. .subvendor = 0xe4bf,
  712. .subdevice = PCI_ANY_ID,
  713. .init = pci_inteli960ni_init,
  714. .setup = pci_default_setup,
  715. },
  716. /*
  717. * ITE
  718. */
  719. {
  720. .vendor = PCI_VENDOR_ID_ITE,
  721. .device = PCI_DEVICE_ID_ITE_8872,
  722. .subvendor = PCI_ANY_ID,
  723. .subdevice = PCI_ANY_ID,
  724. .init = pci_ite887x_init,
  725. .setup = pci_default_setup,
  726. .exit = __devexit_p(pci_ite887x_exit),
  727. },
  728. /*
  729. * Panacom
  730. */
  731. {
  732. .vendor = PCI_VENDOR_ID_PANACOM,
  733. .device = PCI_DEVICE_ID_PANACOM_QUADMODEM,
  734. .subvendor = PCI_ANY_ID,
  735. .subdevice = PCI_ANY_ID,
  736. .init = pci_plx9050_init,
  737. .setup = pci_default_setup,
  738. .exit = __devexit_p(pci_plx9050_exit),
  739. },
  740. {
  741. .vendor = PCI_VENDOR_ID_PANACOM,
  742. .device = PCI_DEVICE_ID_PANACOM_DUALMODEM,
  743. .subvendor = PCI_ANY_ID,
  744. .subdevice = PCI_ANY_ID,
  745. .init = pci_plx9050_init,
  746. .setup = pci_default_setup,
  747. .exit = __devexit_p(pci_plx9050_exit),
  748. },
  749. /*
  750. * PLX
  751. */
  752. {
  753. .vendor = PCI_VENDOR_ID_PLX,
  754. .device = PCI_DEVICE_ID_PLX_9030,
  755. .subvendor = PCI_SUBVENDOR_ID_PERLE,
  756. .subdevice = PCI_ANY_ID,
  757. .setup = pci_default_setup,
  758. },
  759. {
  760. .vendor = PCI_VENDOR_ID_PLX,
  761. .device = PCI_DEVICE_ID_PLX_9050,
  762. .subvendor = PCI_SUBVENDOR_ID_EXSYS,
  763. .subdevice = PCI_SUBDEVICE_ID_EXSYS_4055,
  764. .init = pci_plx9050_init,
  765. .setup = pci_default_setup,
  766. .exit = __devexit_p(pci_plx9050_exit),
  767. },
  768. {
  769. .vendor = PCI_VENDOR_ID_PLX,
  770. .device = PCI_DEVICE_ID_PLX_9050,
  771. .subvendor = PCI_SUBVENDOR_ID_KEYSPAN,
  772. .subdevice = PCI_SUBDEVICE_ID_KEYSPAN_SX2,
  773. .init = pci_plx9050_init,
  774. .setup = pci_default_setup,
  775. .exit = __devexit_p(pci_plx9050_exit),
  776. },
  777. {
  778. .vendor = PCI_VENDOR_ID_PLX,
  779. .device = PCI_DEVICE_ID_PLX_ROMULUS,
  780. .subvendor = PCI_VENDOR_ID_PLX,
  781. .subdevice = PCI_DEVICE_ID_PLX_ROMULUS,
  782. .init = pci_plx9050_init,
  783. .setup = pci_default_setup,
  784. .exit = __devexit_p(pci_plx9050_exit),
  785. },
  786. /*
  787. * SBS Technologies, Inc., PMC-OCTALPRO 232
  788. */
  789. {
  790. .vendor = PCI_VENDOR_ID_SBSMODULARIO,
  791. .device = PCI_DEVICE_ID_OCTPRO,
  792. .subvendor = PCI_SUBVENDOR_ID_SBSMODULARIO,
  793. .subdevice = PCI_SUBDEVICE_ID_OCTPRO232,
  794. .init = sbs_init,
  795. .setup = sbs_setup,
  796. .exit = __devexit_p(sbs_exit),
  797. },
  798. /*
  799. * SBS Technologies, Inc., PMC-OCTALPRO 422
  800. */
  801. {
  802. .vendor = PCI_VENDOR_ID_SBSMODULARIO,
  803. .device = PCI_DEVICE_ID_OCTPRO,
  804. .subvendor = PCI_SUBVENDOR_ID_SBSMODULARIO,
  805. .subdevice = PCI_SUBDEVICE_ID_OCTPRO422,
  806. .init = sbs_init,
  807. .setup = sbs_setup,
  808. .exit = __devexit_p(sbs_exit),
  809. },
  810. /*
  811. * SBS Technologies, Inc., P-Octal 232
  812. */
  813. {
  814. .vendor = PCI_VENDOR_ID_SBSMODULARIO,
  815. .device = PCI_DEVICE_ID_OCTPRO,
  816. .subvendor = PCI_SUBVENDOR_ID_SBSMODULARIO,
  817. .subdevice = PCI_SUBDEVICE_ID_POCTAL232,
  818. .init = sbs_init,
  819. .setup = sbs_setup,
  820. .exit = __devexit_p(sbs_exit),
  821. },
  822. /*
  823. * SBS Technologies, Inc., P-Octal 422
  824. */
  825. {
  826. .vendor = PCI_VENDOR_ID_SBSMODULARIO,
  827. .device = PCI_DEVICE_ID_OCTPRO,
  828. .subvendor = PCI_SUBVENDOR_ID_SBSMODULARIO,
  829. .subdevice = PCI_SUBDEVICE_ID_POCTAL422,
  830. .init = sbs_init,
  831. .setup = sbs_setup,
  832. .exit = __devexit_p(sbs_exit),
  833. },
  834. /*
  835. * SIIG cards - these may be called via parport_serial
  836. */
  837. {
  838. .vendor = PCI_VENDOR_ID_SIIG,
  839. .device = PCI_ANY_ID,
  840. .subvendor = PCI_ANY_ID,
  841. .subdevice = PCI_ANY_ID,
  842. .init = pci_siig_init,
  843. .setup = pci_siig_setup,
  844. },
  845. /*
  846. * Titan cards
  847. */
  848. {
  849. .vendor = PCI_VENDOR_ID_TITAN,
  850. .device = PCI_DEVICE_ID_TITAN_400L,
  851. .subvendor = PCI_ANY_ID,
  852. .subdevice = PCI_ANY_ID,
  853. .setup = titan_400l_800l_setup,
  854. },
  855. {
  856. .vendor = PCI_VENDOR_ID_TITAN,
  857. .device = PCI_DEVICE_ID_TITAN_800L,
  858. .subvendor = PCI_ANY_ID,
  859. .subdevice = PCI_ANY_ID,
  860. .setup = titan_400l_800l_setup,
  861. },
  862. /*
  863. * Timedia cards
  864. */
  865. {
  866. .vendor = PCI_VENDOR_ID_TIMEDIA,
  867. .device = PCI_DEVICE_ID_TIMEDIA_1889,
  868. .subvendor = PCI_VENDOR_ID_TIMEDIA,
  869. .subdevice = PCI_ANY_ID,
  870. .init = pci_timedia_init,
  871. .setup = pci_timedia_setup,
  872. },
  873. {
  874. .vendor = PCI_VENDOR_ID_TIMEDIA,
  875. .device = PCI_ANY_ID,
  876. .subvendor = PCI_ANY_ID,
  877. .subdevice = PCI_ANY_ID,
  878. .setup = pci_timedia_setup,
  879. },
  880. /*
  881. * Xircom cards
  882. */
  883. {
  884. .vendor = PCI_VENDOR_ID_XIRCOM,
  885. .device = PCI_DEVICE_ID_XIRCOM_X3201_MDM,
  886. .subvendor = PCI_ANY_ID,
  887. .subdevice = PCI_ANY_ID,
  888. .init = pci_xircom_init,
  889. .setup = pci_default_setup,
  890. },
  891. /*
  892. * Netmos cards - these may be called via parport_serial
  893. */
  894. {
  895. .vendor = PCI_VENDOR_ID_NETMOS,
  896. .device = PCI_ANY_ID,
  897. .subvendor = PCI_ANY_ID,
  898. .subdevice = PCI_ANY_ID,
  899. .init = pci_netmos_init,
  900. .setup = pci_default_setup,
  901. },
  902. /*
  903. * Default "match everything" terminator entry
  904. */
  905. {
  906. .vendor = PCI_ANY_ID,
  907. .device = PCI_ANY_ID,
  908. .subvendor = PCI_ANY_ID,
  909. .subdevice = PCI_ANY_ID,
  910. .setup = pci_default_setup,
  911. }
  912. };
  913. static inline int quirk_id_matches(u32 quirk_id, u32 dev_id)
  914. {
  915. return quirk_id == PCI_ANY_ID || quirk_id == dev_id;
  916. }
  917. static struct pci_serial_quirk *find_quirk(struct pci_dev *dev)
  918. {
  919. struct pci_serial_quirk *quirk;
  920. for (quirk = pci_serial_quirks; ; quirk++)
  921. if (quirk_id_matches(quirk->vendor, dev->vendor) &&
  922. quirk_id_matches(quirk->device, dev->device) &&
  923. quirk_id_matches(quirk->subvendor, dev->subsystem_vendor) &&
  924. quirk_id_matches(quirk->subdevice, dev->subsystem_device))
  925. break;
  926. return quirk;
  927. }
  928. static inline int get_pci_irq(struct pci_dev *dev,
  929. struct pciserial_board *board)
  930. {
  931. if (board->flags & FL_NOIRQ)
  932. return 0;
  933. else
  934. return dev->irq;
  935. }
  936. /*
  937. * This is the configuration table for all of the PCI serial boards
  938. * which we support. It is directly indexed by the pci_board_num_t enum
  939. * value, which is encoded in the pci_device_id PCI probe table's
  940. * driver_data member.
  941. *
  942. * The makeup of these names are:
  943. * pbn_bn{_bt}_n_baud{_offsetinhex}
  944. *
  945. * bn = PCI BAR number
  946. * bt = Index using PCI BARs
  947. * n = number of serial ports
  948. * baud = baud rate
  949. * offsetinhex = offset for each sequential port (in hex)
  950. *
  951. * This table is sorted by (in order): bn, bt, baud, offsetindex, n.
  952. *
  953. * Please note: in theory if n = 1, _bt infix should make no difference.
  954. * ie, pbn_b0_1_115200 is the same as pbn_b0_bt_1_115200
  955. */
  956. enum pci_board_num_t {
  957. pbn_default = 0,
  958. pbn_b0_1_115200,
  959. pbn_b0_2_115200,
  960. pbn_b0_4_115200,
  961. pbn_b0_5_115200,
  962. pbn_b0_8_115200,
  963. pbn_b0_1_921600,
  964. pbn_b0_2_921600,
  965. pbn_b0_4_921600,
  966. pbn_b0_2_1130000,
  967. pbn_b0_4_1152000,
  968. pbn_b0_2_1843200,
  969. pbn_b0_4_1843200,
  970. pbn_b0_2_1843200_200,
  971. pbn_b0_4_1843200_200,
  972. pbn_b0_8_1843200_200,
  973. pbn_b0_bt_1_115200,
  974. pbn_b0_bt_2_115200,
  975. pbn_b0_bt_8_115200,
  976. pbn_b0_bt_1_460800,
  977. pbn_b0_bt_2_460800,
  978. pbn_b0_bt_4_460800,
  979. pbn_b0_bt_1_921600,
  980. pbn_b0_bt_2_921600,
  981. pbn_b0_bt_4_921600,
  982. pbn_b0_bt_8_921600,
  983. pbn_b1_1_115200,
  984. pbn_b1_2_115200,
  985. pbn_b1_4_115200,
  986. pbn_b1_8_115200,
  987. pbn_b1_1_921600,
  988. pbn_b1_2_921600,
  989. pbn_b1_4_921600,
  990. pbn_b1_8_921600,
  991. pbn_b1_2_1250000,
  992. pbn_b1_bt_1_115200,
  993. pbn_b1_bt_2_921600,
  994. pbn_b1_1_1382400,
  995. pbn_b1_2_1382400,
  996. pbn_b1_4_1382400,
  997. pbn_b1_8_1382400,
  998. pbn_b2_1_115200,
  999. pbn_b2_2_115200,
  1000. pbn_b2_4_115200,
  1001. pbn_b2_8_115200,
  1002. pbn_b2_1_460800,
  1003. pbn_b2_4_460800,
  1004. pbn_b2_8_460800,
  1005. pbn_b2_16_460800,
  1006. pbn_b2_1_921600,
  1007. pbn_b2_4_921600,
  1008. pbn_b2_8_921600,
  1009. pbn_b2_bt_1_115200,
  1010. pbn_b2_bt_2_115200,
  1011. pbn_b2_bt_4_115200,
  1012. pbn_b2_bt_2_921600,
  1013. pbn_b2_bt_4_921600,
  1014. pbn_b3_2_115200,
  1015. pbn_b3_4_115200,
  1016. pbn_b3_8_115200,
  1017. /*
  1018. * Board-specific versions.
  1019. */
  1020. pbn_panacom,
  1021. pbn_panacom2,
  1022. pbn_panacom4,
  1023. pbn_exsys_4055,
  1024. pbn_plx_romulus,
  1025. pbn_oxsemi,
  1026. pbn_intel_i960,
  1027. pbn_sgi_ioc3,
  1028. pbn_computone_4,
  1029. pbn_computone_6,
  1030. pbn_computone_8,
  1031. pbn_sbsxrsio,
  1032. pbn_exar_XR17C152,
  1033. pbn_exar_XR17C154,
  1034. pbn_exar_XR17C158,
  1035. pbn_pasemi_1682M,
  1036. };
  1037. /*
  1038. * uart_offset - the space between channels
  1039. * reg_shift - describes how the UART registers are mapped
  1040. * to PCI memory by the card.
  1041. * For example IER register on SBS, Inc. PMC-OctPro is located at
  1042. * offset 0x10 from the UART base, while UART_IER is defined as 1
  1043. * in include/linux/serial_reg.h,
  1044. * see first lines of serial_in() and serial_out() in 8250.c
  1045. */
  1046. static struct pciserial_board pci_boards[] __devinitdata = {
  1047. [pbn_default] = {
  1048. .flags = FL_BASE0,
  1049. .num_ports = 1,
  1050. .base_baud = 115200,
  1051. .uart_offset = 8,
  1052. },
  1053. [pbn_b0_1_115200] = {
  1054. .flags = FL_BASE0,
  1055. .num_ports = 1,
  1056. .base_baud = 115200,
  1057. .uart_offset = 8,
  1058. },
  1059. [pbn_b0_2_115200] = {
  1060. .flags = FL_BASE0,
  1061. .num_ports = 2,
  1062. .base_baud = 115200,
  1063. .uart_offset = 8,
  1064. },
  1065. [pbn_b0_4_115200] = {
  1066. .flags = FL_BASE0,
  1067. .num_ports = 4,
  1068. .base_baud = 115200,
  1069. .uart_offset = 8,
  1070. },
  1071. [pbn_b0_5_115200] = {
  1072. .flags = FL_BASE0,
  1073. .num_ports = 5,
  1074. .base_baud = 115200,
  1075. .uart_offset = 8,
  1076. },
  1077. [pbn_b0_8_115200] = {
  1078. .flags = FL_BASE0,
  1079. .num_ports = 8,
  1080. .base_baud = 115200,
  1081. .uart_offset = 8,
  1082. },
  1083. [pbn_b0_1_921600] = {
  1084. .flags = FL_BASE0,
  1085. .num_ports = 1,
  1086. .base_baud = 921600,
  1087. .uart_offset = 8,
  1088. },
  1089. [pbn_b0_2_921600] = {
  1090. .flags = FL_BASE0,
  1091. .num_ports = 2,
  1092. .base_baud = 921600,
  1093. .uart_offset = 8,
  1094. },
  1095. [pbn_b0_4_921600] = {
  1096. .flags = FL_BASE0,
  1097. .num_ports = 4,
  1098. .base_baud = 921600,
  1099. .uart_offset = 8,
  1100. },
  1101. [pbn_b0_2_1130000] = {
  1102. .flags = FL_BASE0,
  1103. .num_ports = 2,
  1104. .base_baud = 1130000,
  1105. .uart_offset = 8,
  1106. },
  1107. [pbn_b0_4_1152000] = {
  1108. .flags = FL_BASE0,
  1109. .num_ports = 4,
  1110. .base_baud = 1152000,
  1111. .uart_offset = 8,
  1112. },
  1113. [pbn_b0_2_1843200] = {
  1114. .flags = FL_BASE0,
  1115. .num_ports = 2,
  1116. .base_baud = 1843200,
  1117. .uart_offset = 8,
  1118. },
  1119. [pbn_b0_4_1843200] = {
  1120. .flags = FL_BASE0,
  1121. .num_ports = 4,
  1122. .base_baud = 1843200,
  1123. .uart_offset = 8,
  1124. },
  1125. [pbn_b0_2_1843200_200] = {
  1126. .flags = FL_BASE0,
  1127. .num_ports = 2,
  1128. .base_baud = 1843200,
  1129. .uart_offset = 0x200,
  1130. },
  1131. [pbn_b0_4_1843200_200] = {
  1132. .flags = FL_BASE0,
  1133. .num_ports = 4,
  1134. .base_baud = 1843200,
  1135. .uart_offset = 0x200,
  1136. },
  1137. [pbn_b0_8_1843200_200] = {
  1138. .flags = FL_BASE0,
  1139. .num_ports = 8,
  1140. .base_baud = 1843200,
  1141. .uart_offset = 0x200,
  1142. },
  1143. [pbn_b0_bt_1_115200] = {
  1144. .flags = FL_BASE0|FL_BASE_BARS,
  1145. .num_ports = 1,
  1146. .base_baud = 115200,
  1147. .uart_offset = 8,
  1148. },
  1149. [pbn_b0_bt_2_115200] = {
  1150. .flags = FL_BASE0|FL_BASE_BARS,
  1151. .num_ports = 2,
  1152. .base_baud = 115200,
  1153. .uart_offset = 8,
  1154. },
  1155. [pbn_b0_bt_8_115200] = {
  1156. .flags = FL_BASE0|FL_BASE_BARS,
  1157. .num_ports = 8,
  1158. .base_baud = 115200,
  1159. .uart_offset = 8,
  1160. },
  1161. [pbn_b0_bt_1_460800] = {
  1162. .flags = FL_BASE0|FL_BASE_BARS,
  1163. .num_ports = 1,
  1164. .base_baud = 460800,
  1165. .uart_offset = 8,
  1166. },
  1167. [pbn_b0_bt_2_460800] = {
  1168. .flags = FL_BASE0|FL_BASE_BARS,
  1169. .num_ports = 2,
  1170. .base_baud = 460800,
  1171. .uart_offset = 8,
  1172. },
  1173. [pbn_b0_bt_4_460800] = {
  1174. .flags = FL_BASE0|FL_BASE_BARS,
  1175. .num_ports = 4,
  1176. .base_baud = 460800,
  1177. .uart_offset = 8,
  1178. },
  1179. [pbn_b0_bt_1_921600] = {
  1180. .flags = FL_BASE0|FL_BASE_BARS,
  1181. .num_ports = 1,
  1182. .base_baud = 921600,
  1183. .uart_offset = 8,
  1184. },
  1185. [pbn_b0_bt_2_921600] = {
  1186. .flags = FL_BASE0|FL_BASE_BARS,
  1187. .num_ports = 2,
  1188. .base_baud = 921600,
  1189. .uart_offset = 8,
  1190. },
  1191. [pbn_b0_bt_4_921600] = {
  1192. .flags = FL_BASE0|FL_BASE_BARS,
  1193. .num_ports = 4,
  1194. .base_baud = 921600,
  1195. .uart_offset = 8,
  1196. },
  1197. [pbn_b0_bt_8_921600] = {
  1198. .flags = FL_BASE0|FL_BASE_BARS,
  1199. .num_ports = 8,
  1200. .base_baud = 921600,
  1201. .uart_offset = 8,
  1202. },
  1203. [pbn_b1_1_115200] = {
  1204. .flags = FL_BASE1,
  1205. .num_ports = 1,
  1206. .base_baud = 115200,
  1207. .uart_offset = 8,
  1208. },
  1209. [pbn_b1_2_115200] = {
  1210. .flags = FL_BASE1,
  1211. .num_ports = 2,
  1212. .base_baud = 115200,
  1213. .uart_offset = 8,
  1214. },
  1215. [pbn_b1_4_115200] = {
  1216. .flags = FL_BASE1,
  1217. .num_ports = 4,
  1218. .base_baud = 115200,
  1219. .uart_offset = 8,
  1220. },
  1221. [pbn_b1_8_115200] = {
  1222. .flags = FL_BASE1,
  1223. .num_ports = 8,
  1224. .base_baud = 115200,
  1225. .uart_offset = 8,
  1226. },
  1227. [pbn_b1_1_921600] = {
  1228. .flags = FL_BASE1,
  1229. .num_ports = 1,
  1230. .base_baud = 921600,
  1231. .uart_offset = 8,
  1232. },
  1233. [pbn_b1_2_921600] = {
  1234. .flags = FL_BASE1,
  1235. .num_ports = 2,
  1236. .base_baud = 921600,
  1237. .uart_offset = 8,
  1238. },
  1239. [pbn_b1_4_921600] = {
  1240. .flags = FL_BASE1,
  1241. .num_ports = 4,
  1242. .base_baud = 921600,
  1243. .uart_offset = 8,
  1244. },
  1245. [pbn_b1_8_921600] = {
  1246. .flags = FL_BASE1,
  1247. .num_ports = 8,
  1248. .base_baud = 921600,
  1249. .uart_offset = 8,
  1250. },
  1251. [pbn_b1_2_1250000] = {
  1252. .flags = FL_BASE1,
  1253. .num_ports = 2,
  1254. .base_baud = 1250000,
  1255. .uart_offset = 8,
  1256. },
  1257. [pbn_b1_bt_1_115200] = {
  1258. .flags = FL_BASE1|FL_BASE_BARS,
  1259. .num_ports = 1,
  1260. .base_baud = 115200,
  1261. .uart_offset = 8,
  1262. },
  1263. [pbn_b1_bt_2_921600] = {
  1264. .flags = FL_BASE1|FL_BASE_BARS,
  1265. .num_ports = 2,
  1266. .base_baud = 921600,
  1267. .uart_offset = 8,
  1268. },
  1269. [pbn_b1_1_1382400] = {
  1270. .flags = FL_BASE1,
  1271. .num_ports = 1,
  1272. .base_baud = 1382400,
  1273. .uart_offset = 8,
  1274. },
  1275. [pbn_b1_2_1382400] = {
  1276. .flags = FL_BASE1,
  1277. .num_ports = 2,
  1278. .base_baud = 1382400,
  1279. .uart_offset = 8,
  1280. },
  1281. [pbn_b1_4_1382400] = {
  1282. .flags = FL_BASE1,
  1283. .num_ports = 4,
  1284. .base_baud = 1382400,
  1285. .uart_offset = 8,
  1286. },
  1287. [pbn_b1_8_1382400] = {
  1288. .flags = FL_BASE1,
  1289. .num_ports = 8,
  1290. .base_baud = 1382400,
  1291. .uart_offset = 8,
  1292. },
  1293. [pbn_b2_1_115200] = {
  1294. .flags = FL_BASE2,
  1295. .num_ports = 1,
  1296. .base_baud = 115200,
  1297. .uart_offset = 8,
  1298. },
  1299. [pbn_b2_2_115200] = {
  1300. .flags = FL_BASE2,
  1301. .num_ports = 2,
  1302. .base_baud = 115200,
  1303. .uart_offset = 8,
  1304. },
  1305. [pbn_b2_4_115200] = {
  1306. .flags = FL_BASE2,
  1307. .num_ports = 4,
  1308. .base_baud = 115200,
  1309. .uart_offset = 8,
  1310. },
  1311. [pbn_b2_8_115200] = {
  1312. .flags = FL_BASE2,
  1313. .num_ports = 8,
  1314. .base_baud = 115200,
  1315. .uart_offset = 8,
  1316. },
  1317. [pbn_b2_1_460800] = {
  1318. .flags = FL_BASE2,
  1319. .num_ports = 1,
  1320. .base_baud = 460800,
  1321. .uart_offset = 8,
  1322. },
  1323. [pbn_b2_4_460800] = {
  1324. .flags = FL_BASE2,
  1325. .num_ports = 4,
  1326. .base_baud = 460800,
  1327. .uart_offset = 8,
  1328. },
  1329. [pbn_b2_8_460800] = {
  1330. .flags = FL_BASE2,
  1331. .num_ports = 8,
  1332. .base_baud = 460800,
  1333. .uart_offset = 8,
  1334. },
  1335. [pbn_b2_16_460800] = {
  1336. .flags = FL_BASE2,
  1337. .num_ports = 16,
  1338. .base_baud = 460800,
  1339. .uart_offset = 8,
  1340. },
  1341. [pbn_b2_1_921600] = {
  1342. .flags = FL_BASE2,
  1343. .num_ports = 1,
  1344. .base_baud = 921600,
  1345. .uart_offset = 8,
  1346. },
  1347. [pbn_b2_4_921600] = {
  1348. .flags = FL_BASE2,
  1349. .num_ports = 4,
  1350. .base_baud = 921600,
  1351. .uart_offset = 8,
  1352. },
  1353. [pbn_b2_8_921600] = {
  1354. .flags = FL_BASE2,
  1355. .num_ports = 8,
  1356. .base_baud = 921600,
  1357. .uart_offset = 8,
  1358. },
  1359. [pbn_b2_bt_1_115200] = {
  1360. .flags = FL_BASE2|FL_BASE_BARS,
  1361. .num_ports = 1,
  1362. .base_baud = 115200,
  1363. .uart_offset = 8,
  1364. },
  1365. [pbn_b2_bt_2_115200] = {
  1366. .flags = FL_BASE2|FL_BASE_BARS,
  1367. .num_ports = 2,
  1368. .base_baud = 115200,
  1369. .uart_offset = 8,
  1370. },
  1371. [pbn_b2_bt_4_115200] = {
  1372. .flags = FL_BASE2|FL_BASE_BARS,
  1373. .num_ports = 4,
  1374. .base_baud = 115200,
  1375. .uart_offset = 8,
  1376. },
  1377. [pbn_b2_bt_2_921600] = {
  1378. .flags = FL_BASE2|FL_BASE_BARS,
  1379. .num_ports = 2,
  1380. .base_baud = 921600,
  1381. .uart_offset = 8,
  1382. },
  1383. [pbn_b2_bt_4_921600] = {
  1384. .flags = FL_BASE2|FL_BASE_BARS,
  1385. .num_ports = 4,
  1386. .base_baud = 921600,
  1387. .uart_offset = 8,
  1388. },
  1389. [pbn_b3_2_115200] = {
  1390. .flags = FL_BASE3,
  1391. .num_ports = 2,
  1392. .base_baud = 115200,
  1393. .uart_offset = 8,
  1394. },
  1395. [pbn_b3_4_115200] = {
  1396. .flags = FL_BASE3,
  1397. .num_ports = 4,
  1398. .base_baud = 115200,
  1399. .uart_offset = 8,
  1400. },
  1401. [pbn_b3_8_115200] = {
  1402. .flags = FL_BASE3,
  1403. .num_ports = 8,
  1404. .base_baud = 115200,
  1405. .uart_offset = 8,
  1406. },
  1407. /*
  1408. * Entries following this are board-specific.
  1409. */
  1410. /*
  1411. * Panacom - IOMEM
  1412. */
  1413. [pbn_panacom] = {
  1414. .flags = FL_BASE2,
  1415. .num_ports = 2,
  1416. .base_baud = 921600,
  1417. .uart_offset = 0x400,
  1418. .reg_shift = 7,
  1419. },
  1420. [pbn_panacom2] = {
  1421. .flags = FL_BASE2|FL_BASE_BARS,
  1422. .num_ports = 2,
  1423. .base_baud = 921600,
  1424. .uart_offset = 0x400,
  1425. .reg_shift = 7,
  1426. },
  1427. [pbn_panacom4] = {
  1428. .flags = FL_BASE2|FL_BASE_BARS,
  1429. .num_ports = 4,
  1430. .base_baud = 921600,
  1431. .uart_offset = 0x400,
  1432. .reg_shift = 7,
  1433. },
  1434. [pbn_exsys_4055] = {
  1435. .flags = FL_BASE2,
  1436. .num_ports = 4,
  1437. .base_baud = 115200,
  1438. .uart_offset = 8,
  1439. },
  1440. /* I think this entry is broken - the first_offset looks wrong --rmk */
  1441. [pbn_plx_romulus] = {
  1442. .flags = FL_BASE2,
  1443. .num_ports = 4,
  1444. .base_baud = 921600,
  1445. .uart_offset = 8 << 2,
  1446. .reg_shift = 2,
  1447. .first_offset = 0x03,
  1448. },
  1449. /*
  1450. * This board uses the size of PCI Base region 0 to
  1451. * signal now many ports are available
  1452. */
  1453. [pbn_oxsemi] = {
  1454. .flags = FL_BASE0|FL_REGION_SZ_CAP,
  1455. .num_ports = 32,
  1456. .base_baud = 115200,
  1457. .uart_offset = 8,
  1458. },
  1459. /*
  1460. * EKF addition for i960 Boards form EKF with serial port.
  1461. * Max 256 ports.
  1462. */
  1463. [pbn_intel_i960] = {
  1464. .flags = FL_BASE0,
  1465. .num_ports = 32,
  1466. .base_baud = 921600,
  1467. .uart_offset = 8 << 2,
  1468. .reg_shift = 2,
  1469. .first_offset = 0x10000,
  1470. },
  1471. [pbn_sgi_ioc3] = {
  1472. .flags = FL_BASE0|FL_NOIRQ,
  1473. .num_ports = 1,
  1474. .base_baud = 458333,
  1475. .uart_offset = 8,
  1476. .reg_shift = 0,
  1477. .first_offset = 0x20178,
  1478. },
  1479. /*
  1480. * Computone - uses IOMEM.
  1481. */
  1482. [pbn_computone_4] = {
  1483. .flags = FL_BASE0,
  1484. .num_ports = 4,
  1485. .base_baud = 921600,
  1486. .uart_offset = 0x40,
  1487. .reg_shift = 2,
  1488. .first_offset = 0x200,
  1489. },
  1490. [pbn_computone_6] = {
  1491. .flags = FL_BASE0,
  1492. .num_ports = 6,
  1493. .base_baud = 921600,
  1494. .uart_offset = 0x40,
  1495. .reg_shift = 2,
  1496. .first_offset = 0x200,
  1497. },
  1498. [pbn_computone_8] = {
  1499. .flags = FL_BASE0,
  1500. .num_ports = 8,
  1501. .base_baud = 921600,
  1502. .uart_offset = 0x40,
  1503. .reg_shift = 2,
  1504. .first_offset = 0x200,
  1505. },
  1506. [pbn_sbsxrsio] = {
  1507. .flags = FL_BASE0,
  1508. .num_ports = 8,
  1509. .base_baud = 460800,
  1510. .uart_offset = 256,
  1511. .reg_shift = 4,
  1512. },
  1513. /*
  1514. * Exar Corp. XR17C15[248] Dual/Quad/Octal UART
  1515. * Only basic 16550A support.
  1516. * XR17C15[24] are not tested, but they should work.
  1517. */
  1518. [pbn_exar_XR17C152] = {
  1519. .flags = FL_BASE0,
  1520. .num_ports = 2,
  1521. .base_baud = 921600,
  1522. .uart_offset = 0x200,
  1523. },
  1524. [pbn_exar_XR17C154] = {
  1525. .flags = FL_BASE0,
  1526. .num_ports = 4,
  1527. .base_baud = 921600,
  1528. .uart_offset = 0x200,
  1529. },
  1530. [pbn_exar_XR17C158] = {
  1531. .flags = FL_BASE0,
  1532. .num_ports = 8,
  1533. .base_baud = 921600,
  1534. .uart_offset = 0x200,
  1535. },
  1536. /*
  1537. * PA Semi PWRficient PA6T-1682M on-chip UART
  1538. */
  1539. [pbn_pasemi_1682M] = {
  1540. .flags = FL_BASE0,
  1541. .num_ports = 1,
  1542. .base_baud = 8333333,
  1543. },
  1544. };
  1545. static const struct pci_device_id softmodem_blacklist[] = {
  1546. { PCI_VDEVICE(AL, 0x5457), }, /* ALi Corporation M5457 AC'97 Modem */
  1547. };
  1548. /*
  1549. * Given a complete unknown PCI device, try to use some heuristics to
  1550. * guess what the configuration might be, based on the pitiful PCI
  1551. * serial specs. Returns 0 on success, 1 on failure.
  1552. */
  1553. static int __devinit
  1554. serial_pci_guess_board(struct pci_dev *dev, struct pciserial_board *board)
  1555. {
  1556. const struct pci_device_id *blacklist;
  1557. int num_iomem, num_port, first_port = -1, i;
  1558. /*
  1559. * If it is not a communications device or the programming
  1560. * interface is greater than 6, give up.
  1561. *
  1562. * (Should we try to make guesses for multiport serial devices
  1563. * later?)
  1564. */
  1565. if ((((dev->class >> 8) != PCI_CLASS_COMMUNICATION_SERIAL) &&
  1566. ((dev->class >> 8) != PCI_CLASS_COMMUNICATION_MODEM)) ||
  1567. (dev->class & 0xff) > 6)
  1568. return -ENODEV;
  1569. /*
  1570. * Do not access blacklisted devices that are known not to
  1571. * feature serial ports.
  1572. */
  1573. for (blacklist = softmodem_blacklist;
  1574. blacklist < softmodem_blacklist + ARRAY_SIZE(softmodem_blacklist);
  1575. blacklist++) {
  1576. if (dev->vendor == blacklist->vendor &&
  1577. dev->device == blacklist->device)
  1578. return -ENODEV;
  1579. }
  1580. num_iomem = num_port = 0;
  1581. for (i = 0; i < PCI_NUM_BAR_RESOURCES; i++) {
  1582. if (pci_resource_flags(dev, i) & IORESOURCE_IO) {
  1583. num_port++;
  1584. if (first_port == -1)
  1585. first_port = i;
  1586. }
  1587. if (pci_resource_flags(dev, i) & IORESOURCE_MEM)
  1588. num_iomem++;
  1589. }
  1590. /*
  1591. * If there is 1 or 0 iomem regions, and exactly one port,
  1592. * use it. We guess the number of ports based on the IO
  1593. * region size.
  1594. */
  1595. if (num_iomem <= 1 && num_port == 1) {
  1596. board->flags = first_port;
  1597. board->num_ports = pci_resource_len(dev, first_port) / 8;
  1598. return 0;
  1599. }
  1600. /*
  1601. * Now guess if we've got a board which indexes by BARs.
  1602. * Each IO BAR should be 8 bytes, and they should follow
  1603. * consecutively.
  1604. */
  1605. first_port = -1;
  1606. num_port = 0;
  1607. for (i = 0; i < PCI_NUM_BAR_RESOURCES; i++) {
  1608. if (pci_resource_flags(dev, i) & IORESOURCE_IO &&
  1609. pci_resource_len(dev, i) == 8 &&
  1610. (first_port == -1 || (first_port + num_port) == i)) {
  1611. num_port++;
  1612. if (first_port == -1)
  1613. first_port = i;
  1614. }
  1615. }
  1616. if (num_port > 1) {
  1617. board->flags = first_port | FL_BASE_BARS;
  1618. board->num_ports = num_port;
  1619. return 0;
  1620. }
  1621. return -ENODEV;
  1622. }
  1623. static inline int
  1624. serial_pci_matches(struct pciserial_board *board,
  1625. struct pciserial_board *guessed)
  1626. {
  1627. return
  1628. board->num_ports == guessed->num_ports &&
  1629. board->base_baud == guessed->base_baud &&
  1630. board->uart_offset == guessed->uart_offset &&
  1631. board->reg_shift == guessed->reg_shift &&
  1632. board->first_offset == guessed->first_offset;
  1633. }
  1634. struct serial_private *
  1635. pciserial_init_ports(struct pci_dev *dev, struct pciserial_board *board)
  1636. {
  1637. struct uart_port serial_port;
  1638. struct serial_private *priv;
  1639. struct pci_serial_quirk *quirk;
  1640. int rc, nr_ports, i;
  1641. nr_ports = board->num_ports;
  1642. /*
  1643. * Find an init and setup quirks.
  1644. */
  1645. quirk = find_quirk(dev);
  1646. /*
  1647. * Run the new-style initialization function.
  1648. * The initialization function returns:
  1649. * <0 - error
  1650. * 0 - use board->num_ports
  1651. * >0 - number of ports
  1652. */
  1653. if (quirk->init) {
  1654. rc = quirk->init(dev);
  1655. if (rc < 0) {
  1656. priv = ERR_PTR(rc);
  1657. goto err_out;
  1658. }
  1659. if (rc)
  1660. nr_ports = rc;
  1661. }
  1662. priv = kzalloc(sizeof(struct serial_private) +
  1663. sizeof(unsigned int) * nr_ports,
  1664. GFP_KERNEL);
  1665. if (!priv) {
  1666. priv = ERR_PTR(-ENOMEM);
  1667. goto err_deinit;
  1668. }
  1669. priv->dev = dev;
  1670. priv->quirk = quirk;
  1671. memset(&serial_port, 0, sizeof(struct uart_port));
  1672. serial_port.flags = UPF_SKIP_TEST | UPF_BOOT_AUTOCONF | UPF_SHARE_IRQ;
  1673. serial_port.uartclk = board->base_baud * 16;
  1674. serial_port.irq = get_pci_irq(dev, board);
  1675. serial_port.dev = &dev->dev;
  1676. for (i = 0; i < nr_ports; i++) {
  1677. if (quirk->setup(priv, board, &serial_port, i))
  1678. break;
  1679. #ifdef SERIAL_DEBUG_PCI
  1680. printk(KERN_DEBUG "Setup PCI port: port %x, irq %d, type %d\n",
  1681. serial_port.iobase, serial_port.irq, serial_port.iotype);
  1682. #endif
  1683. priv->line[i] = serial8250_register_port(&serial_port);
  1684. if (priv->line[i] < 0) {
  1685. printk(KERN_WARNING "Couldn't register serial port %s: %d\n", pci_name(dev), priv->line[i]);
  1686. break;
  1687. }
  1688. }
  1689. priv->nr = i;
  1690. return priv;
  1691. err_deinit:
  1692. if (quirk->exit)
  1693. quirk->exit(dev);
  1694. err_out:
  1695. return priv;
  1696. }
  1697. EXPORT_SYMBOL_GPL(pciserial_init_ports);
  1698. void pciserial_remove_ports(struct serial_private *priv)
  1699. {
  1700. struct pci_serial_quirk *quirk;
  1701. int i;
  1702. for (i = 0; i < priv->nr; i++)
  1703. serial8250_unregister_port(priv->line[i]);
  1704. for (i = 0; i < PCI_NUM_BAR_RESOURCES; i++) {
  1705. if (priv->remapped_bar[i])
  1706. iounmap(priv->remapped_bar[i]);
  1707. priv->remapped_bar[i] = NULL;
  1708. }
  1709. /*
  1710. * Find the exit quirks.
  1711. */
  1712. quirk = find_quirk(priv->dev);
  1713. if (quirk->exit)
  1714. quirk->exit(priv->dev);
  1715. kfree(priv);
  1716. }
  1717. EXPORT_SYMBOL_GPL(pciserial_remove_ports);
  1718. void pciserial_suspend_ports(struct serial_private *priv)
  1719. {
  1720. int i;
  1721. for (i = 0; i < priv->nr; i++)
  1722. if (priv->line[i] >= 0)
  1723. serial8250_suspend_port(priv->line[i]);
  1724. }
  1725. EXPORT_SYMBOL_GPL(pciserial_suspend_ports);
  1726. void pciserial_resume_ports(struct serial_private *priv)
  1727. {
  1728. int i;
  1729. /*
  1730. * Ensure that the board is correctly configured.
  1731. */
  1732. if (priv->quirk->init)
  1733. priv->quirk->init(priv->dev);
  1734. for (i = 0; i < priv->nr; i++)
  1735. if (priv->line[i] >= 0)
  1736. serial8250_resume_port(priv->line[i]);
  1737. }
  1738. EXPORT_SYMBOL_GPL(pciserial_resume_ports);
  1739. /*
  1740. * Probe one serial board. Unfortunately, there is no rhyme nor reason
  1741. * to the arrangement of serial ports on a PCI card.
  1742. */
  1743. static int __devinit
  1744. pciserial_init_one(struct pci_dev *dev, const struct pci_device_id *ent)
  1745. {
  1746. struct serial_private *priv;
  1747. struct pciserial_board *board, tmp;
  1748. int rc;
  1749. if (ent->driver_data >= ARRAY_SIZE(pci_boards)) {
  1750. printk(KERN_ERR "pci_init_one: invalid driver_data: %ld\n",
  1751. ent->driver_data);
  1752. return -EINVAL;
  1753. }
  1754. board = &pci_boards[ent->driver_data];
  1755. rc = pci_enable_device(dev);
  1756. if (rc)
  1757. return rc;
  1758. if (ent->driver_data == pbn_default) {
  1759. /*
  1760. * Use a copy of the pci_board entry for this;
  1761. * avoid changing entries in the table.
  1762. */
  1763. memcpy(&tmp, board, sizeof(struct pciserial_board));
  1764. board = &tmp;
  1765. /*
  1766. * We matched one of our class entries. Try to
  1767. * determine the parameters of this board.
  1768. */
  1769. rc = serial_pci_guess_board(dev, board);
  1770. if (rc)
  1771. goto disable;
  1772. } else {
  1773. /*
  1774. * We matched an explicit entry. If we are able to
  1775. * detect this boards settings with our heuristic,
  1776. * then we no longer need this entry.
  1777. */
  1778. memcpy(&tmp, &pci_boards[pbn_default],
  1779. sizeof(struct pciserial_board));
  1780. rc = serial_pci_guess_board(dev, &tmp);
  1781. if (rc == 0 && serial_pci_matches(board, &tmp))
  1782. moan_device("Redundant entry in serial pci_table.",
  1783. dev);
  1784. }
  1785. priv = pciserial_init_ports(dev, board);
  1786. if (!IS_ERR(priv)) {
  1787. pci_set_drvdata(dev, priv);
  1788. return 0;
  1789. }
  1790. rc = PTR_ERR(priv);
  1791. disable:
  1792. pci_disable_device(dev);
  1793. return rc;
  1794. }
  1795. static void __devexit pciserial_remove_one(struct pci_dev *dev)
  1796. {
  1797. struct serial_private *priv = pci_get_drvdata(dev);
  1798. pci_set_drvdata(dev, NULL);
  1799. pciserial_remove_ports(priv);
  1800. pci_disable_device(dev);
  1801. }
  1802. #ifdef CONFIG_PM
  1803. static int pciserial_suspend_one(struct pci_dev *dev, pm_message_t state)
  1804. {
  1805. struct serial_private *priv = pci_get_drvdata(dev);
  1806. if (priv)
  1807. pciserial_suspend_ports(priv);
  1808. pci_save_state(dev);
  1809. pci_set_power_state(dev, pci_choose_state(dev, state));
  1810. return 0;
  1811. }
  1812. static int pciserial_resume_one(struct pci_dev *dev)
  1813. {
  1814. int err;
  1815. struct serial_private *priv = pci_get_drvdata(dev);
  1816. pci_set_power_state(dev, PCI_D0);
  1817. pci_restore_state(dev);
  1818. if (priv) {
  1819. /*
  1820. * The device may have been disabled. Re-enable it.
  1821. */
  1822. err = pci_enable_device(dev);
  1823. if (err)
  1824. return err;
  1825. pciserial_resume_ports(priv);
  1826. }
  1827. return 0;
  1828. }
  1829. #endif
  1830. static struct pci_device_id serial_pci_tbl[] = {
  1831. { PCI_VENDOR_ID_V3, PCI_DEVICE_ID_V3_V960,
  1832. PCI_SUBVENDOR_ID_CONNECT_TECH,
  1833. PCI_SUBDEVICE_ID_CONNECT_TECH_BH8_232, 0, 0,
  1834. pbn_b1_8_1382400 },
  1835. { PCI_VENDOR_ID_V3, PCI_DEVICE_ID_V3_V960,
  1836. PCI_SUBVENDOR_ID_CONNECT_TECH,
  1837. PCI_SUBDEVICE_ID_CONNECT_TECH_BH4_232, 0, 0,
  1838. pbn_b1_4_1382400 },
  1839. { PCI_VENDOR_ID_V3, PCI_DEVICE_ID_V3_V960,
  1840. PCI_SUBVENDOR_ID_CONNECT_TECH,
  1841. PCI_SUBDEVICE_ID_CONNECT_TECH_BH2_232, 0, 0,
  1842. pbn_b1_2_1382400 },
  1843. { PCI_VENDOR_ID_V3, PCI_DEVICE_ID_V3_V351,
  1844. PCI_SUBVENDOR_ID_CONNECT_TECH,
  1845. PCI_SUBDEVICE_ID_CONNECT_TECH_BH8_232, 0, 0,
  1846. pbn_b1_8_1382400 },
  1847. { PCI_VENDOR_ID_V3, PCI_DEVICE_ID_V3_V351,
  1848. PCI_SUBVENDOR_ID_CONNECT_TECH,
  1849. PCI_SUBDEVICE_ID_CONNECT_TECH_BH4_232, 0, 0,
  1850. pbn_b1_4_1382400 },
  1851. { PCI_VENDOR_ID_V3, PCI_DEVICE_ID_V3_V351,
  1852. PCI_SUBVENDOR_ID_CONNECT_TECH,
  1853. PCI_SUBDEVICE_ID_CONNECT_TECH_BH2_232, 0, 0,
  1854. pbn_b1_2_1382400 },
  1855. { PCI_VENDOR_ID_V3, PCI_DEVICE_ID_V3_V351,
  1856. PCI_SUBVENDOR_ID_CONNECT_TECH,
  1857. PCI_SUBDEVICE_ID_CONNECT_TECH_BH8_485, 0, 0,
  1858. pbn_b1_8_921600 },
  1859. { PCI_VENDOR_ID_V3, PCI_DEVICE_ID_V3_V351,
  1860. PCI_SUBVENDOR_ID_CONNECT_TECH,
  1861. PCI_SUBDEVICE_ID_CONNECT_TECH_BH8_485_4_4, 0, 0,
  1862. pbn_b1_8_921600 },
  1863. { PCI_VENDOR_ID_V3, PCI_DEVICE_ID_V3_V351,
  1864. PCI_SUBVENDOR_ID_CONNECT_TECH,
  1865. PCI_SUBDEVICE_ID_CONNECT_TECH_BH4_485, 0, 0,
  1866. pbn_b1_4_921600 },
  1867. { PCI_VENDOR_ID_V3, PCI_DEVICE_ID_V3_V351,
  1868. PCI_SUBVENDOR_ID_CONNECT_TECH,
  1869. PCI_SUBDEVICE_ID_CONNECT_TECH_BH4_485_2_2, 0, 0,
  1870. pbn_b1_4_921600 },
  1871. { PCI_VENDOR_ID_V3, PCI_DEVICE_ID_V3_V351,
  1872. PCI_SUBVENDOR_ID_CONNECT_TECH,
  1873. PCI_SUBDEVICE_ID_CONNECT_TECH_BH2_485, 0, 0,
  1874. pbn_b1_2_921600 },
  1875. { PCI_VENDOR_ID_V3, PCI_DEVICE_ID_V3_V351,
  1876. PCI_SUBVENDOR_ID_CONNECT_TECH,
  1877. PCI_SUBDEVICE_ID_CONNECT_TECH_BH8_485_2_6, 0, 0,
  1878. pbn_b1_8_921600 },
  1879. { PCI_VENDOR_ID_V3, PCI_DEVICE_ID_V3_V351,
  1880. PCI_SUBVENDOR_ID_CONNECT_TECH,
  1881. PCI_SUBDEVICE_ID_CONNECT_TECH_BH081101V1, 0, 0,
  1882. pbn_b1_8_921600 },
  1883. { PCI_VENDOR_ID_V3, PCI_DEVICE_ID_V3_V351,
  1884. PCI_SUBVENDOR_ID_CONNECT_TECH,
  1885. PCI_SUBDEVICE_ID_CONNECT_TECH_BH041101V1, 0, 0,
  1886. pbn_b1_4_921600 },
  1887. { PCI_VENDOR_ID_V3, PCI_DEVICE_ID_V3_V351,
  1888. PCI_SUBVENDOR_ID_CONNECT_TECH,
  1889. PCI_SUBDEVICE_ID_CONNECT_TECH_BH2_20MHZ, 0, 0,
  1890. pbn_b1_2_1250000 },
  1891. { PCI_VENDOR_ID_OXSEMI, PCI_DEVICE_ID_OXSEMI_16PCI954,
  1892. PCI_SUBVENDOR_ID_CONNECT_TECH,
  1893. PCI_SUBDEVICE_ID_CONNECT_TECH_TITAN_2, 0, 0,
  1894. pbn_b0_2_1843200 },
  1895. { PCI_VENDOR_ID_OXSEMI, PCI_DEVICE_ID_OXSEMI_16PCI954,
  1896. PCI_SUBVENDOR_ID_CONNECT_TECH,
  1897. PCI_SUBDEVICE_ID_CONNECT_TECH_TITAN_4, 0, 0,
  1898. pbn_b0_4_1843200 },
  1899. { PCI_VENDOR_ID_OXSEMI, PCI_DEVICE_ID_OXSEMI_16PCI954,
  1900. PCI_VENDOR_ID_AFAVLAB,
  1901. PCI_SUBDEVICE_ID_AFAVLAB_P061, 0, 0,
  1902. pbn_b0_4_1152000 },
  1903. { PCI_VENDOR_ID_EXAR, PCI_DEVICE_ID_EXAR_XR17C152,
  1904. PCI_SUBVENDOR_ID_CONNECT_TECH,
  1905. PCI_SUBDEVICE_ID_CONNECT_TECH_PCI_UART_2_232, 0, 0,
  1906. pbn_b0_2_1843200_200 },
  1907. { PCI_VENDOR_ID_EXAR, PCI_DEVICE_ID_EXAR_XR17C154,
  1908. PCI_SUBVENDOR_ID_CONNECT_TECH,
  1909. PCI_SUBDEVICE_ID_CONNECT_TECH_PCI_UART_4_232, 0, 0,
  1910. pbn_b0_4_1843200_200 },
  1911. { PCI_VENDOR_ID_EXAR, PCI_DEVICE_ID_EXAR_XR17C158,
  1912. PCI_SUBVENDOR_ID_CONNECT_TECH,
  1913. PCI_SUBDEVICE_ID_CONNECT_TECH_PCI_UART_8_232, 0, 0,
  1914. pbn_b0_8_1843200_200 },
  1915. { PCI_VENDOR_ID_EXAR, PCI_DEVICE_ID_EXAR_XR17C152,
  1916. PCI_SUBVENDOR_ID_CONNECT_TECH,
  1917. PCI_SUBDEVICE_ID_CONNECT_TECH_PCI_UART_1_1, 0, 0,
  1918. pbn_b0_2_1843200_200 },
  1919. { PCI_VENDOR_ID_EXAR, PCI_DEVICE_ID_EXAR_XR17C154,
  1920. PCI_SUBVENDOR_ID_CONNECT_TECH,
  1921. PCI_SUBDEVICE_ID_CONNECT_TECH_PCI_UART_2_2, 0, 0,
  1922. pbn_b0_4_1843200_200 },
  1923. { PCI_VENDOR_ID_EXAR, PCI_DEVICE_ID_EXAR_XR17C158,
  1924. PCI_SUBVENDOR_ID_CONNECT_TECH,
  1925. PCI_SUBDEVICE_ID_CONNECT_TECH_PCI_UART_4_4, 0, 0,
  1926. pbn_b0_8_1843200_200 },
  1927. { PCI_VENDOR_ID_EXAR, PCI_DEVICE_ID_EXAR_XR17C152,
  1928. PCI_SUBVENDOR_ID_CONNECT_TECH,
  1929. PCI_SUBDEVICE_ID_CONNECT_TECH_PCI_UART_2, 0, 0,
  1930. pbn_b0_2_1843200_200 },
  1931. { PCI_VENDOR_ID_EXAR, PCI_DEVICE_ID_EXAR_XR17C154,
  1932. PCI_SUBVENDOR_ID_CONNECT_TECH,
  1933. PCI_SUBDEVICE_ID_CONNECT_TECH_PCI_UART_4, 0, 0,
  1934. pbn_b0_4_1843200_200 },
  1935. { PCI_VENDOR_ID_EXAR, PCI_DEVICE_ID_EXAR_XR17C158,
  1936. PCI_SUBVENDOR_ID_CONNECT_TECH,
  1937. PCI_SUBDEVICE_ID_CONNECT_TECH_PCI_UART_8, 0, 0,
  1938. pbn_b0_8_1843200_200 },
  1939. { PCI_VENDOR_ID_EXAR, PCI_DEVICE_ID_EXAR_XR17C152,
  1940. PCI_SUBVENDOR_ID_CONNECT_TECH,
  1941. PCI_SUBDEVICE_ID_CONNECT_TECH_PCI_UART_2_485, 0, 0,
  1942. pbn_b0_2_1843200_200 },
  1943. { PCI_VENDOR_ID_EXAR, PCI_DEVICE_ID_EXAR_XR17C154,
  1944. PCI_SUBVENDOR_ID_CONNECT_TECH,
  1945. PCI_SUBDEVICE_ID_CONNECT_TECH_PCI_UART_4_485, 0, 0,
  1946. pbn_b0_4_1843200_200 },
  1947. { PCI_VENDOR_ID_EXAR, PCI_DEVICE_ID_EXAR_XR17C158,
  1948. PCI_SUBVENDOR_ID_CONNECT_TECH,
  1949. PCI_SUBDEVICE_ID_CONNECT_TECH_PCI_UART_8_485, 0, 0,
  1950. pbn_b0_8_1843200_200 },
  1951. { PCI_VENDOR_ID_SEALEVEL, PCI_DEVICE_ID_SEALEVEL_U530,
  1952. PCI_ANY_ID, PCI_ANY_ID, 0, 0,
  1953. pbn_b2_bt_1_115200 },
  1954. { PCI_VENDOR_ID_SEALEVEL, PCI_DEVICE_ID_SEALEVEL_UCOMM2,
  1955. PCI_ANY_ID, PCI_ANY_ID, 0, 0,
  1956. pbn_b2_bt_2_115200 },
  1957. { PCI_VENDOR_ID_SEALEVEL, PCI_DEVICE_ID_SEALEVEL_UCOMM422,
  1958. PCI_ANY_ID, PCI_ANY_ID, 0, 0,
  1959. pbn_b2_bt_4_115200 },
  1960. { PCI_VENDOR_ID_SEALEVEL, PCI_DEVICE_ID_SEALEVEL_UCOMM232,
  1961. PCI_ANY_ID, PCI_ANY_ID, 0, 0,
  1962. pbn_b2_bt_2_115200 },
  1963. { PCI_VENDOR_ID_SEALEVEL, PCI_DEVICE_ID_SEALEVEL_COMM4,
  1964. PCI_ANY_ID, PCI_ANY_ID, 0, 0,
  1965. pbn_b2_bt_4_115200 },
  1966. { PCI_VENDOR_ID_SEALEVEL, PCI_DEVICE_ID_SEALEVEL_COMM8,
  1967. PCI_ANY_ID, PCI_ANY_ID, 0, 0,
  1968. pbn_b2_8_115200 },
  1969. { PCI_VENDOR_ID_SEALEVEL, PCI_DEVICE_ID_SEALEVEL_UCOMM8,
  1970. PCI_ANY_ID, PCI_ANY_ID, 0, 0,
  1971. pbn_b2_8_115200 },
  1972. { PCI_VENDOR_ID_PLX, PCI_DEVICE_ID_PLX_GTEK_SERIAL2,
  1973. PCI_ANY_ID, PCI_ANY_ID, 0, 0,
  1974. pbn_b2_bt_2_115200 },
  1975. { PCI_VENDOR_ID_PLX, PCI_DEVICE_ID_PLX_SPCOM200,
  1976. PCI_ANY_ID, PCI_ANY_ID, 0, 0,
  1977. pbn_b2_bt_2_921600 },
  1978. /*
  1979. * VScom SPCOM800, from sl@s.pl
  1980. */
  1981. { PCI_VENDOR_ID_PLX, PCI_DEVICE_ID_PLX_SPCOM800,
  1982. PCI_ANY_ID, PCI_ANY_ID, 0, 0,
  1983. pbn_b2_8_921600 },
  1984. { PCI_VENDOR_ID_PLX, PCI_DEVICE_ID_PLX_1077,
  1985. PCI_ANY_ID, PCI_ANY_ID, 0, 0,
  1986. pbn_b2_4_921600 },
  1987. { PCI_VENDOR_ID_PLX, PCI_DEVICE_ID_PLX_9050,
  1988. PCI_SUBVENDOR_ID_KEYSPAN,
  1989. PCI_SUBDEVICE_ID_KEYSPAN_SX2, 0, 0,
  1990. pbn_panacom },
  1991. { PCI_VENDOR_ID_PANACOM, PCI_DEVICE_ID_PANACOM_QUADMODEM,
  1992. PCI_ANY_ID, PCI_ANY_ID, 0, 0,
  1993. pbn_panacom4 },
  1994. { PCI_VENDOR_ID_PANACOM, PCI_DEVICE_ID_PANACOM_DUALMODEM,
  1995. PCI_ANY_ID, PCI_ANY_ID, 0, 0,
  1996. pbn_panacom2 },
  1997. { PCI_VENDOR_ID_PLX, PCI_DEVICE_ID_PLX_9030,
  1998. PCI_VENDOR_ID_ESDGMBH,
  1999. PCI_DEVICE_ID_ESDGMBH_CPCIASIO4, 0, 0,
  2000. pbn_b2_4_115200 },
  2001. { PCI_VENDOR_ID_PLX, PCI_DEVICE_ID_PLX_9050,
  2002. PCI_SUBVENDOR_ID_CHASE_PCIFAST,
  2003. PCI_SUBDEVICE_ID_CHASE_PCIFAST4, 0, 0,
  2004. pbn_b2_4_460800 },
  2005. { PCI_VENDOR_ID_PLX, PCI_DEVICE_ID_PLX_9050,
  2006. PCI_SUBVENDOR_ID_CHASE_PCIFAST,
  2007. PCI_SUBDEVICE_ID_CHASE_PCIFAST8, 0, 0,
  2008. pbn_b2_8_460800 },
  2009. { PCI_VENDOR_ID_PLX, PCI_DEVICE_ID_PLX_9050,
  2010. PCI_SUBVENDOR_ID_CHASE_PCIFAST,
  2011. PCI_SUBDEVICE_ID_CHASE_PCIFAST16, 0, 0,
  2012. pbn_b2_16_460800 },
  2013. { PCI_VENDOR_ID_PLX, PCI_DEVICE_ID_PLX_9050,
  2014. PCI_SUBVENDOR_ID_CHASE_PCIFAST,
  2015. PCI_SUBDEVICE_ID_CHASE_PCIFAST16FMC, 0, 0,
  2016. pbn_b2_16_460800 },
  2017. { PCI_VENDOR_ID_PLX, PCI_DEVICE_ID_PLX_9050,
  2018. PCI_SUBVENDOR_ID_CHASE_PCIRAS,
  2019. PCI_SUBDEVICE_ID_CHASE_PCIRAS4, 0, 0,
  2020. pbn_b2_4_460800 },
  2021. { PCI_VENDOR_ID_PLX, PCI_DEVICE_ID_PLX_9050,
  2022. PCI_SUBVENDOR_ID_CHASE_PCIRAS,
  2023. PCI_SUBDEVICE_ID_CHASE_PCIRAS8, 0, 0,
  2024. pbn_b2_8_460800 },
  2025. { PCI_VENDOR_ID_PLX, PCI_DEVICE_ID_PLX_9050,
  2026. PCI_SUBVENDOR_ID_EXSYS,
  2027. PCI_SUBDEVICE_ID_EXSYS_4055, 0, 0,
  2028. pbn_exsys_4055 },
  2029. /*
  2030. * Megawolf Romulus PCI Serial Card, from Mike Hudson
  2031. * (Exoray@isys.ca)
  2032. */
  2033. { PCI_VENDOR_ID_PLX, PCI_DEVICE_ID_PLX_ROMULUS,
  2034. 0x10b5, 0x106a, 0, 0,
  2035. pbn_plx_romulus },
  2036. { PCI_VENDOR_ID_QUATECH, PCI_DEVICE_ID_QUATECH_QSC100,
  2037. PCI_ANY_ID, PCI_ANY_ID, 0, 0,
  2038. pbn_b1_4_115200 },
  2039. { PCI_VENDOR_ID_QUATECH, PCI_DEVICE_ID_QUATECH_DSC100,
  2040. PCI_ANY_ID, PCI_ANY_ID, 0, 0,
  2041. pbn_b1_2_115200 },
  2042. { PCI_VENDOR_ID_QUATECH, PCI_DEVICE_ID_QUATECH_ESC100D,
  2043. PCI_ANY_ID, PCI_ANY_ID, 0, 0,
  2044. pbn_b1_8_115200 },
  2045. { PCI_VENDOR_ID_QUATECH, PCI_DEVICE_ID_QUATECH_ESC100M,
  2046. PCI_ANY_ID, PCI_ANY_ID, 0, 0,
  2047. pbn_b1_8_115200 },
  2048. { PCI_VENDOR_ID_SPECIALIX, PCI_DEVICE_ID_OXSEMI_16PCI954,
  2049. PCI_VENDOR_ID_SPECIALIX, PCI_SUBDEVICE_ID_SPECIALIX_SPEED4,
  2050. 0, 0,
  2051. pbn_b0_4_921600 },
  2052. { PCI_VENDOR_ID_OXSEMI, PCI_DEVICE_ID_OXSEMI_16PCI954,
  2053. PCI_SUBVENDOR_ID_SIIG, PCI_SUBDEVICE_ID_SIIG_QUARTET_SERIAL,
  2054. 0, 0,
  2055. pbn_b0_4_1152000 },
  2056. /*
  2057. * The below card is a little controversial since it is the
  2058. * subject of a PCI vendor/device ID clash. (See
  2059. * www.ussg.iu.edu/hypermail/linux/kernel/0303.1/0516.html).
  2060. * For now just used the hex ID 0x950a.
  2061. */
  2062. { PCI_VENDOR_ID_OXSEMI, 0x950a,
  2063. PCI_ANY_ID, PCI_ANY_ID, 0, 0,
  2064. pbn_b0_2_1130000 },
  2065. { PCI_VENDOR_ID_OXSEMI, PCI_DEVICE_ID_OXSEMI_16PCI954,
  2066. PCI_ANY_ID, PCI_ANY_ID, 0, 0,
  2067. pbn_b0_4_115200 },
  2068. { PCI_VENDOR_ID_OXSEMI, PCI_DEVICE_ID_OXSEMI_16PCI952,
  2069. PCI_ANY_ID, PCI_ANY_ID, 0, 0,
  2070. pbn_b0_bt_2_921600 },
  2071. /*
  2072. * SBS Technologies, Inc. P-Octal and PMC-OCTPRO cards,
  2073. * from skokodyn@yahoo.com
  2074. */
  2075. { PCI_VENDOR_ID_SBSMODULARIO, PCI_DEVICE_ID_OCTPRO,
  2076. PCI_SUBVENDOR_ID_SBSMODULARIO, PCI_SUBDEVICE_ID_OCTPRO232, 0, 0,
  2077. pbn_sbsxrsio },
  2078. { PCI_VENDOR_ID_SBSMODULARIO, PCI_DEVICE_ID_OCTPRO,
  2079. PCI_SUBVENDOR_ID_SBSMODULARIO, PCI_SUBDEVICE_ID_OCTPRO422, 0, 0,
  2080. pbn_sbsxrsio },
  2081. { PCI_VENDOR_ID_SBSMODULARIO, PCI_DEVICE_ID_OCTPRO,
  2082. PCI_SUBVENDOR_ID_SBSMODULARIO, PCI_SUBDEVICE_ID_POCTAL232, 0, 0,
  2083. pbn_sbsxrsio },
  2084. { PCI_VENDOR_ID_SBSMODULARIO, PCI_DEVICE_ID_OCTPRO,
  2085. PCI_SUBVENDOR_ID_SBSMODULARIO, PCI_SUBDEVICE_ID_POCTAL422, 0, 0,
  2086. pbn_sbsxrsio },
  2087. /*
  2088. * Digitan DS560-558, from jimd@esoft.com
  2089. */
  2090. { PCI_VENDOR_ID_ATT, PCI_DEVICE_ID_ATT_VENUS_MODEM,
  2091. PCI_ANY_ID, PCI_ANY_ID, 0, 0,
  2092. pbn_b1_1_115200 },
  2093. /*
  2094. * Titan Electronic cards
  2095. * The 400L and 800L have a custom setup quirk.
  2096. */
  2097. { PCI_VENDOR_ID_TITAN, PCI_DEVICE_ID_TITAN_100,
  2098. PCI_ANY_ID, PCI_ANY_ID, 0, 0,
  2099. pbn_b0_1_921600 },
  2100. { PCI_VENDOR_ID_TITAN, PCI_DEVICE_ID_TITAN_200,
  2101. PCI_ANY_ID, PCI_ANY_ID, 0, 0,
  2102. pbn_b0_2_921600 },
  2103. { PCI_VENDOR_ID_TITAN, PCI_DEVICE_ID_TITAN_400,
  2104. PCI_ANY_ID, PCI_ANY_ID, 0, 0,
  2105. pbn_b0_4_921600 },
  2106. { PCI_VENDOR_ID_TITAN, PCI_DEVICE_ID_TITAN_800B,
  2107. PCI_ANY_ID, PCI_ANY_ID, 0, 0,
  2108. pbn_b0_4_921600 },
  2109. { PCI_VENDOR_ID_TITAN, PCI_DEVICE_ID_TITAN_100L,
  2110. PCI_ANY_ID, PCI_ANY_ID, 0, 0,
  2111. pbn_b1_1_921600 },
  2112. { PCI_VENDOR_ID_TITAN, PCI_DEVICE_ID_TITAN_200L,
  2113. PCI_ANY_ID, PCI_ANY_ID, 0, 0,
  2114. pbn_b1_bt_2_921600 },
  2115. { PCI_VENDOR_ID_TITAN, PCI_DEVICE_ID_TITAN_400L,
  2116. PCI_ANY_ID, PCI_ANY_ID, 0, 0,
  2117. pbn_b0_bt_4_921600 },
  2118. { PCI_VENDOR_ID_TITAN, PCI_DEVICE_ID_TITAN_800L,
  2119. PCI_ANY_ID, PCI_ANY_ID, 0, 0,
  2120. pbn_b0_bt_8_921600 },
  2121. { PCI_VENDOR_ID_SIIG, PCI_DEVICE_ID_SIIG_1S_10x_550,
  2122. PCI_ANY_ID, PCI_ANY_ID, 0, 0,
  2123. pbn_b2_1_460800 },
  2124. { PCI_VENDOR_ID_SIIG, PCI_DEVICE_ID_SIIG_1S_10x_650,
  2125. PCI_ANY_ID, PCI_ANY_ID, 0, 0,
  2126. pbn_b2_1_460800 },
  2127. { PCI_VENDOR_ID_SIIG, PCI_DEVICE_ID_SIIG_1S_10x_850,
  2128. PCI_ANY_ID, PCI_ANY_ID, 0, 0,
  2129. pbn_b2_1_460800 },
  2130. { PCI_VENDOR_ID_SIIG, PCI_DEVICE_ID_SIIG_2S_10x_550,
  2131. PCI_ANY_ID, PCI_ANY_ID, 0, 0,
  2132. pbn_b2_bt_2_921600 },
  2133. { PCI_VENDOR_ID_SIIG, PCI_DEVICE_ID_SIIG_2S_10x_650,
  2134. PCI_ANY_ID, PCI_ANY_ID, 0, 0,
  2135. pbn_b2_bt_2_921600 },
  2136. { PCI_VENDOR_ID_SIIG, PCI_DEVICE_ID_SIIG_2S_10x_850,
  2137. PCI_ANY_ID, PCI_ANY_ID, 0, 0,
  2138. pbn_b2_bt_2_921600 },
  2139. { PCI_VENDOR_ID_SIIG, PCI_DEVICE_ID_SIIG_4S_10x_550,
  2140. PCI_ANY_ID, PCI_ANY_ID, 0, 0,
  2141. pbn_b2_bt_4_921600 },
  2142. { PCI_VENDOR_ID_SIIG, PCI_DEVICE_ID_SIIG_4S_10x_650,
  2143. PCI_ANY_ID, PCI_ANY_ID, 0, 0,
  2144. pbn_b2_bt_4_921600 },
  2145. { PCI_VENDOR_ID_SIIG, PCI_DEVICE_ID_SIIG_4S_10x_850,
  2146. PCI_ANY_ID, PCI_ANY_ID, 0, 0,
  2147. pbn_b2_bt_4_921600 },
  2148. { PCI_VENDOR_ID_SIIG, PCI_DEVICE_ID_SIIG_1S_20x_550,
  2149. PCI_ANY_ID, PCI_ANY_ID, 0, 0,
  2150. pbn_b0_1_921600 },
  2151. { PCI_VENDOR_ID_SIIG, PCI_DEVICE_ID_SIIG_1S_20x_650,
  2152. PCI_ANY_ID, PCI_ANY_ID, 0, 0,
  2153. pbn_b0_1_921600 },
  2154. { PCI_VENDOR_ID_SIIG, PCI_DEVICE_ID_SIIG_1S_20x_850,
  2155. PCI_ANY_ID, PCI_ANY_ID, 0, 0,
  2156. pbn_b0_1_921600 },
  2157. { PCI_VENDOR_ID_SIIG, PCI_DEVICE_ID_SIIG_2S_20x_550,
  2158. PCI_ANY_ID, PCI_ANY_ID, 0, 0,
  2159. pbn_b0_bt_2_921600 },
  2160. { PCI_VENDOR_ID_SIIG, PCI_DEVICE_ID_SIIG_2S_20x_650,
  2161. PCI_ANY_ID, PCI_ANY_ID, 0, 0,
  2162. pbn_b0_bt_2_921600 },
  2163. { PCI_VENDOR_ID_SIIG, PCI_DEVICE_ID_SIIG_2S_20x_850,
  2164. PCI_ANY_ID, PCI_ANY_ID, 0, 0,
  2165. pbn_b0_bt_2_921600 },
  2166. { PCI_VENDOR_ID_SIIG, PCI_DEVICE_ID_SIIG_4S_20x_550,
  2167. PCI_ANY_ID, PCI_ANY_ID, 0, 0,
  2168. pbn_b0_bt_4_921600 },
  2169. { PCI_VENDOR_ID_SIIG, PCI_DEVICE_ID_SIIG_4S_20x_650,
  2170. PCI_ANY_ID, PCI_ANY_ID, 0, 0,
  2171. pbn_b0_bt_4_921600 },
  2172. { PCI_VENDOR_ID_SIIG, PCI_DEVICE_ID_SIIG_4S_20x_850,
  2173. PCI_ANY_ID, PCI_ANY_ID, 0, 0,
  2174. pbn_b0_bt_4_921600 },
  2175. { PCI_VENDOR_ID_SIIG, PCI_DEVICE_ID_SIIG_8S_20x_550,
  2176. PCI_ANY_ID, PCI_ANY_ID, 0, 0,
  2177. pbn_b0_bt_8_921600 },
  2178. { PCI_VENDOR_ID_SIIG, PCI_DEVICE_ID_SIIG_8S_20x_650,
  2179. PCI_ANY_ID, PCI_ANY_ID, 0, 0,
  2180. pbn_b0_bt_8_921600 },
  2181. { PCI_VENDOR_ID_SIIG, PCI_DEVICE_ID_SIIG_8S_20x_850,
  2182. PCI_ANY_ID, PCI_ANY_ID, 0, 0,
  2183. pbn_b0_bt_8_921600 },
  2184. /*
  2185. * Computone devices submitted by Doug McNash dmcnash@computone.com
  2186. */
  2187. { PCI_VENDOR_ID_COMPUTONE, PCI_DEVICE_ID_COMPUTONE_PG,
  2188. PCI_SUBVENDOR_ID_COMPUTONE, PCI_SUBDEVICE_ID_COMPUTONE_PG4,
  2189. 0, 0, pbn_computone_4 },
  2190. { PCI_VENDOR_ID_COMPUTONE, PCI_DEVICE_ID_COMPUTONE_PG,
  2191. PCI_SUBVENDOR_ID_COMPUTONE, PCI_SUBDEVICE_ID_COMPUTONE_PG8,
  2192. 0, 0, pbn_computone_8 },
  2193. { PCI_VENDOR_ID_COMPUTONE, PCI_DEVICE_ID_COMPUTONE_PG,
  2194. PCI_SUBVENDOR_ID_COMPUTONE, PCI_SUBDEVICE_ID_COMPUTONE_PG6,
  2195. 0, 0, pbn_computone_6 },
  2196. { PCI_VENDOR_ID_OXSEMI, PCI_DEVICE_ID_OXSEMI_16PCI95N,
  2197. PCI_ANY_ID, PCI_ANY_ID, 0, 0,
  2198. pbn_oxsemi },
  2199. { PCI_VENDOR_ID_TIMEDIA, PCI_DEVICE_ID_TIMEDIA_1889,
  2200. PCI_VENDOR_ID_TIMEDIA, PCI_ANY_ID, 0, 0,
  2201. pbn_b0_bt_1_921600 },
  2202. /*
  2203. * AFAVLAB serial card, from Harald Welte <laforge@gnumonks.org>
  2204. */
  2205. { PCI_VENDOR_ID_AFAVLAB, PCI_DEVICE_ID_AFAVLAB_P028,
  2206. PCI_ANY_ID, PCI_ANY_ID, 0, 0,
  2207. pbn_b0_bt_8_115200 },
  2208. { PCI_VENDOR_ID_AFAVLAB, PCI_DEVICE_ID_AFAVLAB_P030,
  2209. PCI_ANY_ID, PCI_ANY_ID, 0, 0,
  2210. pbn_b0_bt_8_115200 },
  2211. { PCI_VENDOR_ID_LAVA, PCI_DEVICE_ID_LAVA_DSERIAL,
  2212. PCI_ANY_ID, PCI_ANY_ID, 0, 0,
  2213. pbn_b0_bt_2_115200 },
  2214. { PCI_VENDOR_ID_LAVA, PCI_DEVICE_ID_LAVA_QUATRO_A,
  2215. PCI_ANY_ID, PCI_ANY_ID, 0, 0,
  2216. pbn_b0_bt_2_115200 },
  2217. { PCI_VENDOR_ID_LAVA, PCI_DEVICE_ID_LAVA_QUATRO_B,
  2218. PCI_ANY_ID, PCI_ANY_ID, 0, 0,
  2219. pbn_b0_bt_2_115200 },
  2220. { PCI_VENDOR_ID_LAVA, PCI_DEVICE_ID_LAVA_OCTO_A,
  2221. PCI_ANY_ID, PCI_ANY_ID, 0, 0,
  2222. pbn_b0_bt_4_460800 },
  2223. { PCI_VENDOR_ID_LAVA, PCI_DEVICE_ID_LAVA_OCTO_B,
  2224. PCI_ANY_ID, PCI_ANY_ID, 0, 0,
  2225. pbn_b0_bt_4_460800 },
  2226. { PCI_VENDOR_ID_LAVA, PCI_DEVICE_ID_LAVA_PORT_PLUS,
  2227. PCI_ANY_ID, PCI_ANY_ID, 0, 0,
  2228. pbn_b0_bt_2_460800 },
  2229. { PCI_VENDOR_ID_LAVA, PCI_DEVICE_ID_LAVA_QUAD_A,
  2230. PCI_ANY_ID, PCI_ANY_ID, 0, 0,
  2231. pbn_b0_bt_2_460800 },
  2232. { PCI_VENDOR_ID_LAVA, PCI_DEVICE_ID_LAVA_QUAD_B,
  2233. PCI_ANY_ID, PCI_ANY_ID, 0, 0,
  2234. pbn_b0_bt_2_460800 },
  2235. { PCI_VENDOR_ID_LAVA, PCI_DEVICE_ID_LAVA_SSERIAL,
  2236. PCI_ANY_ID, PCI_ANY_ID, 0, 0,
  2237. pbn_b0_bt_1_115200 },
  2238. { PCI_VENDOR_ID_LAVA, PCI_DEVICE_ID_LAVA_PORT_650,
  2239. PCI_ANY_ID, PCI_ANY_ID, 0, 0,
  2240. pbn_b0_bt_1_460800 },
  2241. /*
  2242. * Korenix Jetcard F0/F1 cards (JC1204, JC1208, JC1404, JC1408).
  2243. * Cards are identified by their subsystem vendor IDs, which
  2244. * (in hex) match the model number.
  2245. *
  2246. * Note that JC140x are RS422/485 cards which require ox950
  2247. * ACR = 0x10, and as such are not currently fully supported.
  2248. */
  2249. { PCI_VENDOR_ID_KORENIX, PCI_DEVICE_ID_KORENIX_JETCARDF0,
  2250. 0x1204, 0x0004, 0, 0,
  2251. pbn_b0_4_921600 },
  2252. { PCI_VENDOR_ID_KORENIX, PCI_DEVICE_ID_KORENIX_JETCARDF0,
  2253. 0x1208, 0x0004, 0, 0,
  2254. pbn_b0_4_921600 },
  2255. /* { PCI_VENDOR_ID_KORENIX, PCI_DEVICE_ID_KORENIX_JETCARDF0,
  2256. 0x1402, 0x0002, 0, 0,
  2257. pbn_b0_2_921600 }, */
  2258. /* { PCI_VENDOR_ID_KORENIX, PCI_DEVICE_ID_KORENIX_JETCARDF0,
  2259. 0x1404, 0x0004, 0, 0,
  2260. pbn_b0_4_921600 }, */
  2261. { PCI_VENDOR_ID_KORENIX, PCI_DEVICE_ID_KORENIX_JETCARDF1,
  2262. 0x1208, 0x0004, 0, 0,
  2263. pbn_b0_4_921600 },
  2264. /*
  2265. * Dell Remote Access Card 4 - Tim_T_Murphy@Dell.com
  2266. */
  2267. { PCI_VENDOR_ID_DELL, PCI_DEVICE_ID_DELL_RAC4,
  2268. PCI_ANY_ID, PCI_ANY_ID, 0, 0,
  2269. pbn_b1_1_1382400 },
  2270. /*
  2271. * Dell Remote Access Card III - Tim_T_Murphy@Dell.com
  2272. */
  2273. { PCI_VENDOR_ID_DELL, PCI_DEVICE_ID_DELL_RACIII,
  2274. PCI_ANY_ID, PCI_ANY_ID, 0, 0,
  2275. pbn_b1_1_1382400 },
  2276. /*
  2277. * RAStel 2 port modem, gerg@moreton.com.au
  2278. */
  2279. { PCI_VENDOR_ID_MORETON, PCI_DEVICE_ID_RASTEL_2PORT,
  2280. PCI_ANY_ID, PCI_ANY_ID, 0, 0,
  2281. pbn_b2_bt_2_115200 },
  2282. /*
  2283. * EKF addition for i960 Boards form EKF with serial port
  2284. */
  2285. { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_80960_RP,
  2286. 0xE4BF, PCI_ANY_ID, 0, 0,
  2287. pbn_intel_i960 },
  2288. /*
  2289. * Xircom Cardbus/Ethernet combos
  2290. */
  2291. { PCI_VENDOR_ID_XIRCOM, PCI_DEVICE_ID_XIRCOM_X3201_MDM,
  2292. PCI_ANY_ID, PCI_ANY_ID, 0, 0,
  2293. pbn_b0_1_115200 },
  2294. /*
  2295. * Xircom RBM56G cardbus modem - Dirk Arnold (temp entry)
  2296. */
  2297. { PCI_VENDOR_ID_XIRCOM, PCI_DEVICE_ID_XIRCOM_RBM56G,
  2298. PCI_ANY_ID, PCI_ANY_ID, 0, 0,
  2299. pbn_b0_1_115200 },
  2300. /*
  2301. * Untested PCI modems, sent in from various folks...
  2302. */
  2303. /*
  2304. * Elsa Model 56K PCI Modem, from Andreas Rath <arh@01019freenet.de>
  2305. */
  2306. { PCI_VENDOR_ID_ROCKWELL, 0x1004,
  2307. 0x1048, 0x1500, 0, 0,
  2308. pbn_b1_1_115200 },
  2309. { PCI_VENDOR_ID_SGI, PCI_DEVICE_ID_SGI_IOC3,
  2310. 0xFF00, 0, 0, 0,
  2311. pbn_sgi_ioc3 },
  2312. /*
  2313. * HP Diva card
  2314. */
  2315. { PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_DIVA,
  2316. PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_DIVA_RMP3, 0, 0,
  2317. pbn_b1_1_115200 },
  2318. { PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_DIVA,
  2319. PCI_ANY_ID, PCI_ANY_ID, 0, 0,
  2320. pbn_b0_5_115200 },
  2321. { PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_DIVA_AUX,
  2322. PCI_ANY_ID, PCI_ANY_ID, 0, 0,
  2323. pbn_b2_1_115200 },
  2324. { PCI_VENDOR_ID_DCI, PCI_DEVICE_ID_DCI_PCCOM2,
  2325. PCI_ANY_ID, PCI_ANY_ID, 0, 0,
  2326. pbn_b3_2_115200 },
  2327. { PCI_VENDOR_ID_DCI, PCI_DEVICE_ID_DCI_PCCOM4,
  2328. PCI_ANY_ID, PCI_ANY_ID, 0, 0,
  2329. pbn_b3_4_115200 },
  2330. { PCI_VENDOR_ID_DCI, PCI_DEVICE_ID_DCI_PCCOM8,
  2331. PCI_ANY_ID, PCI_ANY_ID, 0, 0,
  2332. pbn_b3_8_115200 },
  2333. /*
  2334. * Exar Corp. XR17C15[248] Dual/Quad/Octal UART
  2335. */
  2336. { PCI_VENDOR_ID_EXAR, PCI_DEVICE_ID_EXAR_XR17C152,
  2337. PCI_ANY_ID, PCI_ANY_ID,
  2338. 0,
  2339. 0, pbn_exar_XR17C152 },
  2340. { PCI_VENDOR_ID_EXAR, PCI_DEVICE_ID_EXAR_XR17C154,
  2341. PCI_ANY_ID, PCI_ANY_ID,
  2342. 0,
  2343. 0, pbn_exar_XR17C154 },
  2344. { PCI_VENDOR_ID_EXAR, PCI_DEVICE_ID_EXAR_XR17C158,
  2345. PCI_ANY_ID, PCI_ANY_ID,
  2346. 0,
  2347. 0, pbn_exar_XR17C158 },
  2348. /*
  2349. * Topic TP560 Data/Fax/Voice 56k modem (reported by Evan Clarke)
  2350. */
  2351. { PCI_VENDOR_ID_TOPIC, PCI_DEVICE_ID_TOPIC_TP560,
  2352. PCI_ANY_ID, PCI_ANY_ID, 0, 0,
  2353. pbn_b0_1_115200 },
  2354. /*
  2355. * ITE
  2356. */
  2357. { PCI_VENDOR_ID_ITE, PCI_DEVICE_ID_ITE_8872,
  2358. PCI_ANY_ID, PCI_ANY_ID,
  2359. 0, 0,
  2360. pbn_b1_bt_1_115200 },
  2361. /*
  2362. * IntaShield IS-200
  2363. */
  2364. { PCI_VENDOR_ID_INTASHIELD, PCI_DEVICE_ID_INTASHIELD_IS200,
  2365. PCI_ANY_ID, PCI_ANY_ID, 0, 0, /* 135a.0811 */
  2366. pbn_b2_2_115200 },
  2367. /*
  2368. * IntaShield IS-400
  2369. */
  2370. { PCI_VENDOR_ID_INTASHIELD, PCI_DEVICE_ID_INTASHIELD_IS400,
  2371. PCI_ANY_ID, PCI_ANY_ID, 0, 0, /* 135a.0dc0 */
  2372. pbn_b2_4_115200 },
  2373. /*
  2374. * Perle PCI-RAS cards
  2375. */
  2376. { PCI_VENDOR_ID_PLX, PCI_DEVICE_ID_PLX_9030,
  2377. PCI_SUBVENDOR_ID_PERLE, PCI_SUBDEVICE_ID_PCI_RAS4,
  2378. 0, 0, pbn_b2_4_921600 },
  2379. { PCI_VENDOR_ID_PLX, PCI_DEVICE_ID_PLX_9030,
  2380. PCI_SUBVENDOR_ID_PERLE, PCI_SUBDEVICE_ID_PCI_RAS8,
  2381. 0, 0, pbn_b2_8_921600 },
  2382. /*
  2383. * Mainpine series cards: Fairly standard layout but fools
  2384. * parts of the autodetect in some cases and uses otherwise
  2385. * unmatched communications subclasses in the PCI Express case
  2386. */
  2387. { /* RockForceDUO */
  2388. PCI_VENDOR_ID_MAINPINE, PCI_DEVICE_ID_MAINPINE_PBRIDGE,
  2389. PCI_VENDOR_ID_MAINPINE, 0x0200,
  2390. 0, 0, pbn_b0_2_115200 },
  2391. { /* RockForceQUATRO */
  2392. PCI_VENDOR_ID_MAINPINE, PCI_DEVICE_ID_MAINPINE_PBRIDGE,
  2393. PCI_VENDOR_ID_MAINPINE, 0x0300,
  2394. 0, 0, pbn_b0_4_115200 },
  2395. { /* RockForceDUO+ */
  2396. PCI_VENDOR_ID_MAINPINE, PCI_DEVICE_ID_MAINPINE_PBRIDGE,
  2397. PCI_VENDOR_ID_MAINPINE, 0x0400,
  2398. 0, 0, pbn_b0_2_115200 },
  2399. { /* RockForceQUATRO+ */
  2400. PCI_VENDOR_ID_MAINPINE, PCI_DEVICE_ID_MAINPINE_PBRIDGE,
  2401. PCI_VENDOR_ID_MAINPINE, 0x0500,
  2402. 0, 0, pbn_b0_4_115200 },
  2403. { /* RockForce+ */
  2404. PCI_VENDOR_ID_MAINPINE, PCI_DEVICE_ID_MAINPINE_PBRIDGE,
  2405. PCI_VENDOR_ID_MAINPINE, 0x0600,
  2406. 0, 0, pbn_b0_2_115200 },
  2407. { /* RockForce+ */
  2408. PCI_VENDOR_ID_MAINPINE, PCI_DEVICE_ID_MAINPINE_PBRIDGE,
  2409. PCI_VENDOR_ID_MAINPINE, 0x0700,
  2410. 0, 0, pbn_b0_4_115200 },
  2411. { /* RockForceOCTO+ */
  2412. PCI_VENDOR_ID_MAINPINE, PCI_DEVICE_ID_MAINPINE_PBRIDGE,
  2413. PCI_VENDOR_ID_MAINPINE, 0x0800,
  2414. 0, 0, pbn_b0_8_115200 },
  2415. { /* RockForceDUO+ */
  2416. PCI_VENDOR_ID_MAINPINE, PCI_DEVICE_ID_MAINPINE_PBRIDGE,
  2417. PCI_VENDOR_ID_MAINPINE, 0x0C00,
  2418. 0, 0, pbn_b0_2_115200 },
  2419. { /* RockForceQUARTRO+ */
  2420. PCI_VENDOR_ID_MAINPINE, PCI_DEVICE_ID_MAINPINE_PBRIDGE,
  2421. PCI_VENDOR_ID_MAINPINE, 0x0D00,
  2422. 0, 0, pbn_b0_4_115200 },
  2423. { /* RockForceOCTO+ */
  2424. PCI_VENDOR_ID_MAINPINE, PCI_DEVICE_ID_MAINPINE_PBRIDGE,
  2425. PCI_VENDOR_ID_MAINPINE, 0x1D00,
  2426. 0, 0, pbn_b0_8_115200 },
  2427. { /* RockForceD1 */
  2428. PCI_VENDOR_ID_MAINPINE, PCI_DEVICE_ID_MAINPINE_PBRIDGE,
  2429. PCI_VENDOR_ID_MAINPINE, 0x2000,
  2430. 0, 0, pbn_b0_1_115200 },
  2431. { /* RockForceF1 */
  2432. PCI_VENDOR_ID_MAINPINE, PCI_DEVICE_ID_MAINPINE_PBRIDGE,
  2433. PCI_VENDOR_ID_MAINPINE, 0x2100,
  2434. 0, 0, pbn_b0_1_115200 },
  2435. { /* RockForceD2 */
  2436. PCI_VENDOR_ID_MAINPINE, PCI_DEVICE_ID_MAINPINE_PBRIDGE,
  2437. PCI_VENDOR_ID_MAINPINE, 0x2200,
  2438. 0, 0, pbn_b0_2_115200 },
  2439. { /* RockForceF2 */
  2440. PCI_VENDOR_ID_MAINPINE, PCI_DEVICE_ID_MAINPINE_PBRIDGE,
  2441. PCI_VENDOR_ID_MAINPINE, 0x2300,
  2442. 0, 0, pbn_b0_2_115200 },
  2443. { /* RockForceD4 */
  2444. PCI_VENDOR_ID_MAINPINE, PCI_DEVICE_ID_MAINPINE_PBRIDGE,
  2445. PCI_VENDOR_ID_MAINPINE, 0x2400,
  2446. 0, 0, pbn_b0_4_115200 },
  2447. { /* RockForceF4 */
  2448. PCI_VENDOR_ID_MAINPINE, PCI_DEVICE_ID_MAINPINE_PBRIDGE,
  2449. PCI_VENDOR_ID_MAINPINE, 0x2500,
  2450. 0, 0, pbn_b0_4_115200 },
  2451. { /* RockForceD8 */
  2452. PCI_VENDOR_ID_MAINPINE, PCI_DEVICE_ID_MAINPINE_PBRIDGE,
  2453. PCI_VENDOR_ID_MAINPINE, 0x2600,
  2454. 0, 0, pbn_b0_8_115200 },
  2455. { /* RockForceF8 */
  2456. PCI_VENDOR_ID_MAINPINE, PCI_DEVICE_ID_MAINPINE_PBRIDGE,
  2457. PCI_VENDOR_ID_MAINPINE, 0x2700,
  2458. 0, 0, pbn_b0_8_115200 },
  2459. { /* IQ Express D1 */
  2460. PCI_VENDOR_ID_MAINPINE, PCI_DEVICE_ID_MAINPINE_PBRIDGE,
  2461. PCI_VENDOR_ID_MAINPINE, 0x3000,
  2462. 0, 0, pbn_b0_1_115200 },
  2463. { /* IQ Express F1 */
  2464. PCI_VENDOR_ID_MAINPINE, PCI_DEVICE_ID_MAINPINE_PBRIDGE,
  2465. PCI_VENDOR_ID_MAINPINE, 0x3100,
  2466. 0, 0, pbn_b0_1_115200 },
  2467. { /* IQ Express D2 */
  2468. PCI_VENDOR_ID_MAINPINE, PCI_DEVICE_ID_MAINPINE_PBRIDGE,
  2469. PCI_VENDOR_ID_MAINPINE, 0x3200,
  2470. 0, 0, pbn_b0_2_115200 },
  2471. { /* IQ Express F2 */
  2472. PCI_VENDOR_ID_MAINPINE, PCI_DEVICE_ID_MAINPINE_PBRIDGE,
  2473. PCI_VENDOR_ID_MAINPINE, 0x3300,
  2474. 0, 0, pbn_b0_2_115200 },
  2475. { /* IQ Express D4 */
  2476. PCI_VENDOR_ID_MAINPINE, PCI_DEVICE_ID_MAINPINE_PBRIDGE,
  2477. PCI_VENDOR_ID_MAINPINE, 0x3400,
  2478. 0, 0, pbn_b0_4_115200 },
  2479. { /* IQ Express F4 */
  2480. PCI_VENDOR_ID_MAINPINE, PCI_DEVICE_ID_MAINPINE_PBRIDGE,
  2481. PCI_VENDOR_ID_MAINPINE, 0x3500,
  2482. 0, 0, pbn_b0_4_115200 },
  2483. { /* IQ Express D8 */
  2484. PCI_VENDOR_ID_MAINPINE, PCI_DEVICE_ID_MAINPINE_PBRIDGE,
  2485. PCI_VENDOR_ID_MAINPINE, 0x3C00,
  2486. 0, 0, pbn_b0_8_115200 },
  2487. { /* IQ Express F8 */
  2488. PCI_VENDOR_ID_MAINPINE, PCI_DEVICE_ID_MAINPINE_PBRIDGE,
  2489. PCI_VENDOR_ID_MAINPINE, 0x3D00,
  2490. 0, 0, pbn_b0_8_115200 },
  2491. /*
  2492. * PA Semi PA6T-1682M on-chip UART
  2493. */
  2494. { PCI_VENDOR_ID_PASEMI, 0xa004,
  2495. PCI_ANY_ID, PCI_ANY_ID, 0, 0,
  2496. pbn_pasemi_1682M },
  2497. /*
  2498. * ADDI-DATA GmbH communication cards <info@addi-data.com>
  2499. */
  2500. { PCI_VENDOR_ID_ADDIDATA,
  2501. PCI_DEVICE_ID_ADDIDATA_APCI7500,
  2502. PCI_ANY_ID,
  2503. PCI_ANY_ID,
  2504. 0,
  2505. 0,
  2506. pbn_b0_4_115200 },
  2507. { PCI_VENDOR_ID_ADDIDATA,
  2508. PCI_DEVICE_ID_ADDIDATA_APCI7420,
  2509. PCI_ANY_ID,
  2510. PCI_ANY_ID,
  2511. 0,
  2512. 0,
  2513. pbn_b0_2_115200 },
  2514. { PCI_VENDOR_ID_ADDIDATA,
  2515. PCI_DEVICE_ID_ADDIDATA_APCI7300,
  2516. PCI_ANY_ID,
  2517. PCI_ANY_ID,
  2518. 0,
  2519. 0,
  2520. pbn_b0_1_115200 },
  2521. { PCI_VENDOR_ID_ADDIDATA_OLD,
  2522. PCI_DEVICE_ID_ADDIDATA_APCI7800,
  2523. PCI_ANY_ID,
  2524. PCI_ANY_ID,
  2525. 0,
  2526. 0,
  2527. pbn_b1_8_115200 },
  2528. { PCI_VENDOR_ID_ADDIDATA,
  2529. PCI_DEVICE_ID_ADDIDATA_APCI7500_2,
  2530. PCI_ANY_ID,
  2531. PCI_ANY_ID,
  2532. 0,
  2533. 0,
  2534. pbn_b0_4_115200 },
  2535. { PCI_VENDOR_ID_ADDIDATA,
  2536. PCI_DEVICE_ID_ADDIDATA_APCI7420_2,
  2537. PCI_ANY_ID,
  2538. PCI_ANY_ID,
  2539. 0,
  2540. 0,
  2541. pbn_b0_2_115200 },
  2542. { PCI_VENDOR_ID_ADDIDATA,
  2543. PCI_DEVICE_ID_ADDIDATA_APCI7300_2,
  2544. PCI_ANY_ID,
  2545. PCI_ANY_ID,
  2546. 0,
  2547. 0,
  2548. pbn_b0_1_115200 },
  2549. { PCI_VENDOR_ID_ADDIDATA,
  2550. PCI_DEVICE_ID_ADDIDATA_APCI7500_3,
  2551. PCI_ANY_ID,
  2552. PCI_ANY_ID,
  2553. 0,
  2554. 0,
  2555. pbn_b0_4_115200 },
  2556. { PCI_VENDOR_ID_ADDIDATA,
  2557. PCI_DEVICE_ID_ADDIDATA_APCI7420_3,
  2558. PCI_ANY_ID,
  2559. PCI_ANY_ID,
  2560. 0,
  2561. 0,
  2562. pbn_b0_2_115200 },
  2563. { PCI_VENDOR_ID_ADDIDATA,
  2564. PCI_DEVICE_ID_ADDIDATA_APCI7300_3,
  2565. PCI_ANY_ID,
  2566. PCI_ANY_ID,
  2567. 0,
  2568. 0,
  2569. pbn_b0_1_115200 },
  2570. { PCI_VENDOR_ID_ADDIDATA,
  2571. PCI_DEVICE_ID_ADDIDATA_APCI7800_3,
  2572. PCI_ANY_ID,
  2573. PCI_ANY_ID,
  2574. 0,
  2575. 0,
  2576. pbn_b0_8_115200 },
  2577. /*
  2578. * These entries match devices with class COMMUNICATION_SERIAL,
  2579. * COMMUNICATION_MODEM or COMMUNICATION_MULTISERIAL
  2580. */
  2581. { PCI_ANY_ID, PCI_ANY_ID,
  2582. PCI_ANY_ID, PCI_ANY_ID,
  2583. PCI_CLASS_COMMUNICATION_SERIAL << 8,
  2584. 0xffff00, pbn_default },
  2585. { PCI_ANY_ID, PCI_ANY_ID,
  2586. PCI_ANY_ID, PCI_ANY_ID,
  2587. PCI_CLASS_COMMUNICATION_MODEM << 8,
  2588. 0xffff00, pbn_default },
  2589. { PCI_ANY_ID, PCI_ANY_ID,
  2590. PCI_ANY_ID, PCI_ANY_ID,
  2591. PCI_CLASS_COMMUNICATION_MULTISERIAL << 8,
  2592. 0xffff00, pbn_default },
  2593. { 0, }
  2594. };
  2595. static struct pci_driver serial_pci_driver = {
  2596. .name = "serial",
  2597. .probe = pciserial_init_one,
  2598. .remove = __devexit_p(pciserial_remove_one),
  2599. #ifdef CONFIG_PM
  2600. .suspend = pciserial_suspend_one,
  2601. .resume = pciserial_resume_one,
  2602. #endif
  2603. .id_table = serial_pci_tbl,
  2604. };
  2605. static int __init serial8250_pci_init(void)
  2606. {
  2607. return pci_register_driver(&serial_pci_driver);
  2608. }
  2609. static void __exit serial8250_pci_exit(void)
  2610. {
  2611. pci_unregister_driver(&serial_pci_driver);
  2612. }
  2613. module_init(serial8250_pci_init);
  2614. module_exit(serial8250_pci_exit);
  2615. MODULE_LICENSE("GPL");
  2616. MODULE_DESCRIPTION("Generic 8250/16x50 PCI serial probe module");
  2617. MODULE_DEVICE_TABLE(pci, serial_pci_tbl);