8250_pci.c 71 KB

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