8250_pci.c 71 KB

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