8250_pci.c 71 KB

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