8250_pci.c 71 KB

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