8250_pci.c 68 KB

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