pata_scc.c 29 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148
  1. /*
  2. * Support for IDE interfaces on Celleb platform
  3. *
  4. * (C) Copyright 2006 TOSHIBA CORPORATION
  5. *
  6. * This code is based on drivers/ata/ata_piix.c:
  7. * Copyright 2003-2005 Red Hat Inc
  8. * Copyright 2003-2005 Jeff Garzik
  9. * Copyright (C) 1998-1999 Andrzej Krzysztofowicz, Author and Maintainer
  10. * Copyright (C) 1998-2000 Andre Hedrick <andre@linux-ide.org>
  11. * Copyright (C) 2003 Red Hat Inc
  12. *
  13. * and drivers/ata/ahci.c:
  14. * Copyright 2004-2005 Red Hat, Inc.
  15. *
  16. * and drivers/ata/libata-core.c:
  17. * Copyright 2003-2004 Red Hat, Inc. All rights reserved.
  18. * Copyright 2003-2004 Jeff Garzik
  19. *
  20. * This program is free software; you can redistribute it and/or modify
  21. * it under the terms of the GNU General Public License as published by
  22. * the Free Software Foundation; either version 2 of the License, or
  23. * (at your option) any later version.
  24. *
  25. * This program is distributed in the hope that it will be useful,
  26. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  27. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  28. * GNU General Public License for more details.
  29. *
  30. * You should have received a copy of the GNU General Public License along
  31. * with this program; if not, write to the Free Software Foundation, Inc.,
  32. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  33. */
  34. #include <linux/kernel.h>
  35. #include <linux/module.h>
  36. #include <linux/pci.h>
  37. #include <linux/init.h>
  38. #include <linux/blkdev.h>
  39. #include <linux/delay.h>
  40. #include <linux/device.h>
  41. #include <scsi/scsi_host.h>
  42. #include <linux/libata.h>
  43. #define DRV_NAME "pata_scc"
  44. #define DRV_VERSION "0.3"
  45. #define PCI_DEVICE_ID_TOSHIBA_SCC_ATA 0x01b4
  46. /* PCI BARs */
  47. #define SCC_CTRL_BAR 0
  48. #define SCC_BMID_BAR 1
  49. /* offset of CTRL registers */
  50. #define SCC_CTL_PIOSHT 0x000
  51. #define SCC_CTL_PIOCT 0x004
  52. #define SCC_CTL_MDMACT 0x008
  53. #define SCC_CTL_MCRCST 0x00C
  54. #define SCC_CTL_SDMACT 0x010
  55. #define SCC_CTL_SCRCST 0x014
  56. #define SCC_CTL_UDENVT 0x018
  57. #define SCC_CTL_TDVHSEL 0x020
  58. #define SCC_CTL_MODEREG 0x024
  59. #define SCC_CTL_ECMODE 0xF00
  60. #define SCC_CTL_MAEA0 0xF50
  61. #define SCC_CTL_MAEC0 0xF54
  62. #define SCC_CTL_CCKCTRL 0xFF0
  63. /* offset of BMID registers */
  64. #define SCC_DMA_CMD 0x000
  65. #define SCC_DMA_STATUS 0x004
  66. #define SCC_DMA_TABLE_OFS 0x008
  67. #define SCC_DMA_INTMASK 0x010
  68. #define SCC_DMA_INTST 0x014
  69. #define SCC_DMA_PTERADD 0x018
  70. #define SCC_REG_CMD_ADDR 0x020
  71. #define SCC_REG_DATA 0x000
  72. #define SCC_REG_ERR 0x004
  73. #define SCC_REG_FEATURE 0x004
  74. #define SCC_REG_NSECT 0x008
  75. #define SCC_REG_LBAL 0x00C
  76. #define SCC_REG_LBAM 0x010
  77. #define SCC_REG_LBAH 0x014
  78. #define SCC_REG_DEVICE 0x018
  79. #define SCC_REG_STATUS 0x01C
  80. #define SCC_REG_CMD 0x01C
  81. #define SCC_REG_ALTSTATUS 0x020
  82. /* register value */
  83. #define TDVHSEL_MASTER 0x00000001
  84. #define TDVHSEL_SLAVE 0x00000004
  85. #define MODE_JCUSFEN 0x00000080
  86. #define ECMODE_VALUE 0x01
  87. #define CCKCTRL_ATARESET 0x00040000
  88. #define CCKCTRL_BUFCNT 0x00020000
  89. #define CCKCTRL_CRST 0x00010000
  90. #define CCKCTRL_OCLKEN 0x00000100
  91. #define CCKCTRL_ATACLKOEN 0x00000002
  92. #define CCKCTRL_LCLKEN 0x00000001
  93. #define QCHCD_IOS_SS 0x00000001
  94. #define QCHSD_STPDIAG 0x00020000
  95. #define INTMASK_MSK 0xD1000012
  96. #define INTSTS_SERROR 0x80000000
  97. #define INTSTS_PRERR 0x40000000
  98. #define INTSTS_RERR 0x10000000
  99. #define INTSTS_ICERR 0x01000000
  100. #define INTSTS_BMSINT 0x00000010
  101. #define INTSTS_BMHE 0x00000008
  102. #define INTSTS_IOIRQS 0x00000004
  103. #define INTSTS_INTRQ 0x00000002
  104. #define INTSTS_ACTEINT 0x00000001
  105. /* PIO transfer mode table */
  106. /* JCHST */
  107. static const unsigned long JCHSTtbl[2][7] = {
  108. {0x0E, 0x05, 0x02, 0x03, 0x02, 0x00, 0x00}, /* 100MHz */
  109. {0x13, 0x07, 0x04, 0x04, 0x03, 0x00, 0x00} /* 133MHz */
  110. };
  111. /* JCHHT */
  112. static const unsigned long JCHHTtbl[2][7] = {
  113. {0x0E, 0x02, 0x02, 0x02, 0x02, 0x00, 0x00}, /* 100MHz */
  114. {0x13, 0x03, 0x03, 0x03, 0x03, 0x00, 0x00} /* 133MHz */
  115. };
  116. /* JCHCT */
  117. static const unsigned long JCHCTtbl[2][7] = {
  118. {0x1D, 0x1D, 0x1C, 0x0B, 0x06, 0x00, 0x00}, /* 100MHz */
  119. {0x27, 0x26, 0x26, 0x0E, 0x09, 0x00, 0x00} /* 133MHz */
  120. };
  121. /* DMA transfer mode table */
  122. /* JCHDCTM/JCHDCTS */
  123. static const unsigned long JCHDCTxtbl[2][7] = {
  124. {0x0A, 0x06, 0x04, 0x03, 0x01, 0x00, 0x00}, /* 100MHz */
  125. {0x0E, 0x09, 0x06, 0x04, 0x02, 0x01, 0x00} /* 133MHz */
  126. };
  127. /* JCSTWTM/JCSTWTS */
  128. static const unsigned long JCSTWTxtbl[2][7] = {
  129. {0x06, 0x04, 0x03, 0x02, 0x02, 0x02, 0x00}, /* 100MHz */
  130. {0x09, 0x06, 0x04, 0x02, 0x02, 0x02, 0x02} /* 133MHz */
  131. };
  132. /* JCTSS */
  133. static const unsigned long JCTSStbl[2][7] = {
  134. {0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x00}, /* 100MHz */
  135. {0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05} /* 133MHz */
  136. };
  137. /* JCENVT */
  138. static const unsigned long JCENVTtbl[2][7] = {
  139. {0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00}, /* 100MHz */
  140. {0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02} /* 133MHz */
  141. };
  142. /* JCACTSELS/JCACTSELM */
  143. static const unsigned long JCACTSELtbl[2][7] = {
  144. {0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00}, /* 100MHz */
  145. {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01} /* 133MHz */
  146. };
  147. static const struct pci_device_id scc_pci_tbl[] = {
  148. { PCI_VDEVICE(TOSHIBA_2, PCI_DEVICE_ID_TOSHIBA_SCC_ATA), 0},
  149. { } /* terminate list */
  150. };
  151. /**
  152. * scc_set_piomode - Initialize host controller PATA PIO timings
  153. * @ap: Port whose timings we are configuring
  154. * @adev: um
  155. *
  156. * Set PIO mode for device.
  157. *
  158. * LOCKING:
  159. * None (inherited from caller).
  160. */
  161. static void scc_set_piomode (struct ata_port *ap, struct ata_device *adev)
  162. {
  163. unsigned int pio = adev->pio_mode - XFER_PIO_0;
  164. void __iomem *ctrl_base = ap->host->iomap[SCC_CTRL_BAR];
  165. void __iomem *cckctrl_port = ctrl_base + SCC_CTL_CCKCTRL;
  166. void __iomem *piosht_port = ctrl_base + SCC_CTL_PIOSHT;
  167. void __iomem *pioct_port = ctrl_base + SCC_CTL_PIOCT;
  168. unsigned long reg;
  169. int offset;
  170. reg = in_be32(cckctrl_port);
  171. if (reg & CCKCTRL_ATACLKOEN)
  172. offset = 1; /* 133MHz */
  173. else
  174. offset = 0; /* 100MHz */
  175. reg = JCHSTtbl[offset][pio] << 16 | JCHHTtbl[offset][pio];
  176. out_be32(piosht_port, reg);
  177. reg = JCHCTtbl[offset][pio];
  178. out_be32(pioct_port, reg);
  179. }
  180. /**
  181. * scc_set_dmamode - Initialize host controller PATA DMA timings
  182. * @ap: Port whose timings we are configuring
  183. * @adev: um
  184. *
  185. * Set UDMA mode for device.
  186. *
  187. * LOCKING:
  188. * None (inherited from caller).
  189. */
  190. static void scc_set_dmamode (struct ata_port *ap, struct ata_device *adev)
  191. {
  192. unsigned int udma = adev->dma_mode;
  193. unsigned int is_slave = (adev->devno != 0);
  194. u8 speed = udma;
  195. void __iomem *ctrl_base = ap->host->iomap[SCC_CTRL_BAR];
  196. void __iomem *cckctrl_port = ctrl_base + SCC_CTL_CCKCTRL;
  197. void __iomem *mdmact_port = ctrl_base + SCC_CTL_MDMACT;
  198. void __iomem *mcrcst_port = ctrl_base + SCC_CTL_MCRCST;
  199. void __iomem *sdmact_port = ctrl_base + SCC_CTL_SDMACT;
  200. void __iomem *scrcst_port = ctrl_base + SCC_CTL_SCRCST;
  201. void __iomem *udenvt_port = ctrl_base + SCC_CTL_UDENVT;
  202. void __iomem *tdvhsel_port = ctrl_base + SCC_CTL_TDVHSEL;
  203. int offset, idx;
  204. if (in_be32(cckctrl_port) & CCKCTRL_ATACLKOEN)
  205. offset = 1; /* 133MHz */
  206. else
  207. offset = 0; /* 100MHz */
  208. if (speed >= XFER_UDMA_0)
  209. idx = speed - XFER_UDMA_0;
  210. else
  211. return;
  212. if (is_slave) {
  213. out_be32(sdmact_port, JCHDCTxtbl[offset][idx]);
  214. out_be32(scrcst_port, JCSTWTxtbl[offset][idx]);
  215. out_be32(tdvhsel_port,
  216. (in_be32(tdvhsel_port) & ~TDVHSEL_SLAVE) | (JCACTSELtbl[offset][idx] << 2));
  217. } else {
  218. out_be32(mdmact_port, JCHDCTxtbl[offset][idx]);
  219. out_be32(mcrcst_port, JCSTWTxtbl[offset][idx]);
  220. out_be32(tdvhsel_port,
  221. (in_be32(tdvhsel_port) & ~TDVHSEL_MASTER) | JCACTSELtbl[offset][idx]);
  222. }
  223. out_be32(udenvt_port,
  224. JCTSStbl[offset][idx] << 16 | JCENVTtbl[offset][idx]);
  225. }
  226. unsigned long scc_mode_filter(struct ata_device *adev, unsigned long mask)
  227. {
  228. /* errata A308 workaround: limit ATAPI UDMA mode to UDMA4 */
  229. if (adev->class == ATA_DEV_ATAPI &&
  230. (mask & (0xE0 << ATA_SHIFT_UDMA))) {
  231. printk(KERN_INFO "%s: limit ATAPI UDMA to UDMA4\n", DRV_NAME);
  232. mask &= ~(0xE0 << ATA_SHIFT_UDMA);
  233. }
  234. return mask;
  235. }
  236. /**
  237. * scc_tf_load - send taskfile registers to host controller
  238. * @ap: Port to which output is sent
  239. * @tf: ATA taskfile register set
  240. *
  241. * Note: Original code is ata_sff_tf_load().
  242. */
  243. static void scc_tf_load (struct ata_port *ap, const struct ata_taskfile *tf)
  244. {
  245. struct ata_ioports *ioaddr = &ap->ioaddr;
  246. unsigned int is_addr = tf->flags & ATA_TFLAG_ISADDR;
  247. if (tf->ctl != ap->last_ctl) {
  248. out_be32(ioaddr->ctl_addr, tf->ctl);
  249. ap->last_ctl = tf->ctl;
  250. ata_wait_idle(ap);
  251. }
  252. if (is_addr && (tf->flags & ATA_TFLAG_LBA48)) {
  253. out_be32(ioaddr->feature_addr, tf->hob_feature);
  254. out_be32(ioaddr->nsect_addr, tf->hob_nsect);
  255. out_be32(ioaddr->lbal_addr, tf->hob_lbal);
  256. out_be32(ioaddr->lbam_addr, tf->hob_lbam);
  257. out_be32(ioaddr->lbah_addr, tf->hob_lbah);
  258. VPRINTK("hob: feat 0x%X nsect 0x%X, lba 0x%X 0x%X 0x%X\n",
  259. tf->hob_feature,
  260. tf->hob_nsect,
  261. tf->hob_lbal,
  262. tf->hob_lbam,
  263. tf->hob_lbah);
  264. }
  265. if (is_addr) {
  266. out_be32(ioaddr->feature_addr, tf->feature);
  267. out_be32(ioaddr->nsect_addr, tf->nsect);
  268. out_be32(ioaddr->lbal_addr, tf->lbal);
  269. out_be32(ioaddr->lbam_addr, tf->lbam);
  270. out_be32(ioaddr->lbah_addr, tf->lbah);
  271. VPRINTK("feat 0x%X nsect 0x%X lba 0x%X 0x%X 0x%X\n",
  272. tf->feature,
  273. tf->nsect,
  274. tf->lbal,
  275. tf->lbam,
  276. tf->lbah);
  277. }
  278. if (tf->flags & ATA_TFLAG_DEVICE) {
  279. out_be32(ioaddr->device_addr, tf->device);
  280. VPRINTK("device 0x%X\n", tf->device);
  281. }
  282. ata_wait_idle(ap);
  283. }
  284. /**
  285. * scc_check_status - Read device status reg & clear interrupt
  286. * @ap: port where the device is
  287. *
  288. * Note: Original code is ata_check_status().
  289. */
  290. static u8 scc_check_status (struct ata_port *ap)
  291. {
  292. return in_be32(ap->ioaddr.status_addr);
  293. }
  294. /**
  295. * scc_tf_read - input device's ATA taskfile shadow registers
  296. * @ap: Port from which input is read
  297. * @tf: ATA taskfile register set for storing input
  298. *
  299. * Note: Original code is ata_sff_tf_read().
  300. */
  301. static void scc_tf_read (struct ata_port *ap, struct ata_taskfile *tf)
  302. {
  303. struct ata_ioports *ioaddr = &ap->ioaddr;
  304. tf->command = scc_check_status(ap);
  305. tf->feature = in_be32(ioaddr->error_addr);
  306. tf->nsect = in_be32(ioaddr->nsect_addr);
  307. tf->lbal = in_be32(ioaddr->lbal_addr);
  308. tf->lbam = in_be32(ioaddr->lbam_addr);
  309. tf->lbah = in_be32(ioaddr->lbah_addr);
  310. tf->device = in_be32(ioaddr->device_addr);
  311. if (tf->flags & ATA_TFLAG_LBA48) {
  312. out_be32(ioaddr->ctl_addr, tf->ctl | ATA_HOB);
  313. tf->hob_feature = in_be32(ioaddr->error_addr);
  314. tf->hob_nsect = in_be32(ioaddr->nsect_addr);
  315. tf->hob_lbal = in_be32(ioaddr->lbal_addr);
  316. tf->hob_lbam = in_be32(ioaddr->lbam_addr);
  317. tf->hob_lbah = in_be32(ioaddr->lbah_addr);
  318. out_be32(ioaddr->ctl_addr, tf->ctl);
  319. ap->last_ctl = tf->ctl;
  320. }
  321. }
  322. /**
  323. * scc_exec_command - issue ATA command to host controller
  324. * @ap: port to which command is being issued
  325. * @tf: ATA taskfile register set
  326. *
  327. * Note: Original code is ata_sff_exec_command().
  328. */
  329. static void scc_exec_command (struct ata_port *ap,
  330. const struct ata_taskfile *tf)
  331. {
  332. DPRINTK("ata%u: cmd 0x%X\n", ap->print_id, tf->command);
  333. out_be32(ap->ioaddr.command_addr, tf->command);
  334. ata_sff_pause(ap);
  335. }
  336. /**
  337. * scc_check_altstatus - Read device alternate status reg
  338. * @ap: port where the device is
  339. */
  340. static u8 scc_check_altstatus (struct ata_port *ap)
  341. {
  342. return in_be32(ap->ioaddr.altstatus_addr);
  343. }
  344. /**
  345. * scc_dev_select - Select device 0/1 on ATA bus
  346. * @ap: ATA channel to manipulate
  347. * @device: ATA device (numbered from zero) to select
  348. *
  349. * Note: Original code is ata_sff_dev_select().
  350. */
  351. static void scc_dev_select (struct ata_port *ap, unsigned int device)
  352. {
  353. u8 tmp;
  354. if (device == 0)
  355. tmp = ATA_DEVICE_OBS;
  356. else
  357. tmp = ATA_DEVICE_OBS | ATA_DEV1;
  358. out_be32(ap->ioaddr.device_addr, tmp);
  359. ata_sff_pause(ap);
  360. }
  361. /**
  362. * scc_set_devctl - Write device control reg
  363. * @ap: port where the device is
  364. * @ctl: value to write
  365. */
  366. static void scc_set_devctl(struct ata_port *ap, u8 ctl)
  367. {
  368. out_be32(ap->ioaddr.ctl_addr, ctl);
  369. }
  370. /**
  371. * scc_bmdma_setup - Set up PCI IDE BMDMA transaction
  372. * @qc: Info associated with this ATA transaction.
  373. *
  374. * Note: Original code is ata_bmdma_setup().
  375. */
  376. static void scc_bmdma_setup (struct ata_queued_cmd *qc)
  377. {
  378. struct ata_port *ap = qc->ap;
  379. unsigned int rw = (qc->tf.flags & ATA_TFLAG_WRITE);
  380. u8 dmactl;
  381. void __iomem *mmio = ap->ioaddr.bmdma_addr;
  382. /* load PRD table addr */
  383. out_be32(mmio + SCC_DMA_TABLE_OFS, ap->bmdma_prd_dma);
  384. /* specify data direction, triple-check start bit is clear */
  385. dmactl = in_be32(mmio + SCC_DMA_CMD);
  386. dmactl &= ~(ATA_DMA_WR | ATA_DMA_START);
  387. if (!rw)
  388. dmactl |= ATA_DMA_WR;
  389. out_be32(mmio + SCC_DMA_CMD, dmactl);
  390. /* issue r/w command */
  391. ap->ops->sff_exec_command(ap, &qc->tf);
  392. }
  393. /**
  394. * scc_bmdma_start - Start a PCI IDE BMDMA transaction
  395. * @qc: Info associated with this ATA transaction.
  396. *
  397. * Note: Original code is ata_bmdma_start().
  398. */
  399. static void scc_bmdma_start (struct ata_queued_cmd *qc)
  400. {
  401. struct ata_port *ap = qc->ap;
  402. u8 dmactl;
  403. void __iomem *mmio = ap->ioaddr.bmdma_addr;
  404. /* start host DMA transaction */
  405. dmactl = in_be32(mmio + SCC_DMA_CMD);
  406. out_be32(mmio + SCC_DMA_CMD, dmactl | ATA_DMA_START);
  407. }
  408. /**
  409. * scc_devchk - PATA device presence detection
  410. * @ap: ATA channel to examine
  411. * @device: Device to examine (starting at zero)
  412. *
  413. * Note: Original code is ata_devchk().
  414. */
  415. static unsigned int scc_devchk (struct ata_port *ap,
  416. unsigned int device)
  417. {
  418. struct ata_ioports *ioaddr = &ap->ioaddr;
  419. u8 nsect, lbal;
  420. ap->ops->sff_dev_select(ap, device);
  421. out_be32(ioaddr->nsect_addr, 0x55);
  422. out_be32(ioaddr->lbal_addr, 0xaa);
  423. out_be32(ioaddr->nsect_addr, 0xaa);
  424. out_be32(ioaddr->lbal_addr, 0x55);
  425. out_be32(ioaddr->nsect_addr, 0x55);
  426. out_be32(ioaddr->lbal_addr, 0xaa);
  427. nsect = in_be32(ioaddr->nsect_addr);
  428. lbal = in_be32(ioaddr->lbal_addr);
  429. if ((nsect == 0x55) && (lbal == 0xaa))
  430. return 1; /* we found a device */
  431. return 0; /* nothing found */
  432. }
  433. /**
  434. * scc_wait_after_reset - wait for devices to become ready after reset
  435. *
  436. * Note: Original code is ata_sff_wait_after_reset
  437. */
  438. static int scc_wait_after_reset(struct ata_link *link, unsigned int devmask,
  439. unsigned long deadline)
  440. {
  441. struct ata_port *ap = link->ap;
  442. struct ata_ioports *ioaddr = &ap->ioaddr;
  443. unsigned int dev0 = devmask & (1 << 0);
  444. unsigned int dev1 = devmask & (1 << 1);
  445. int rc, ret = 0;
  446. /* Spec mandates ">= 2ms" before checking status. We wait
  447. * 150ms, because that was the magic delay used for ATAPI
  448. * devices in Hale Landis's ATADRVR, for the period of time
  449. * between when the ATA command register is written, and then
  450. * status is checked. Because waiting for "a while" before
  451. * checking status is fine, post SRST, we perform this magic
  452. * delay here as well.
  453. *
  454. * Old drivers/ide uses the 2mS rule and then waits for ready.
  455. */
  456. ata_msleep(ap, 150);
  457. /* always check readiness of the master device */
  458. rc = ata_sff_wait_ready(link, deadline);
  459. /* -ENODEV means the odd clown forgot the D7 pulldown resistor
  460. * and TF status is 0xff, bail out on it too.
  461. */
  462. if (rc)
  463. return rc;
  464. /* if device 1 was found in ata_devchk, wait for register
  465. * access briefly, then wait for BSY to clear.
  466. */
  467. if (dev1) {
  468. int i;
  469. ap->ops->sff_dev_select(ap, 1);
  470. /* Wait for register access. Some ATAPI devices fail
  471. * to set nsect/lbal after reset, so don't waste too
  472. * much time on it. We're gonna wait for !BSY anyway.
  473. */
  474. for (i = 0; i < 2; i++) {
  475. u8 nsect, lbal;
  476. nsect = in_be32(ioaddr->nsect_addr);
  477. lbal = in_be32(ioaddr->lbal_addr);
  478. if ((nsect == 1) && (lbal == 1))
  479. break;
  480. ata_msleep(ap, 50); /* give drive a breather */
  481. }
  482. rc = ata_sff_wait_ready(link, deadline);
  483. if (rc) {
  484. if (rc != -ENODEV)
  485. return rc;
  486. ret = rc;
  487. }
  488. }
  489. /* is all this really necessary? */
  490. ap->ops->sff_dev_select(ap, 0);
  491. if (dev1)
  492. ap->ops->sff_dev_select(ap, 1);
  493. if (dev0)
  494. ap->ops->sff_dev_select(ap, 0);
  495. return ret;
  496. }
  497. /**
  498. * scc_bus_softreset - PATA device software reset
  499. *
  500. * Note: Original code is ata_bus_softreset().
  501. */
  502. static unsigned int scc_bus_softreset(struct ata_port *ap, unsigned int devmask,
  503. unsigned long deadline)
  504. {
  505. struct ata_ioports *ioaddr = &ap->ioaddr;
  506. DPRINTK("ata%u: bus reset via SRST\n", ap->print_id);
  507. /* software reset. causes dev0 to be selected */
  508. out_be32(ioaddr->ctl_addr, ap->ctl);
  509. udelay(20);
  510. out_be32(ioaddr->ctl_addr, ap->ctl | ATA_SRST);
  511. udelay(20);
  512. out_be32(ioaddr->ctl_addr, ap->ctl);
  513. scc_wait_after_reset(&ap->link, devmask, deadline);
  514. return 0;
  515. }
  516. /**
  517. * scc_softreset - reset host port via ATA SRST
  518. * @ap: port to reset
  519. * @classes: resulting classes of attached devices
  520. * @deadline: deadline jiffies for the operation
  521. *
  522. * Note: Original code is ata_sff_softreset().
  523. */
  524. static int scc_softreset(struct ata_link *link, unsigned int *classes,
  525. unsigned long deadline)
  526. {
  527. struct ata_port *ap = link->ap;
  528. unsigned int slave_possible = ap->flags & ATA_FLAG_SLAVE_POSS;
  529. unsigned int devmask = 0, err_mask;
  530. u8 err;
  531. DPRINTK("ENTER\n");
  532. /* determine if device 0/1 are present */
  533. if (scc_devchk(ap, 0))
  534. devmask |= (1 << 0);
  535. if (slave_possible && scc_devchk(ap, 1))
  536. devmask |= (1 << 1);
  537. /* select device 0 again */
  538. ap->ops->sff_dev_select(ap, 0);
  539. /* issue bus reset */
  540. DPRINTK("about to softreset, devmask=%x\n", devmask);
  541. err_mask = scc_bus_softreset(ap, devmask, deadline);
  542. if (err_mask) {
  543. ata_port_printk(ap, KERN_ERR, "SRST failed (err_mask=0x%x)\n",
  544. err_mask);
  545. return -EIO;
  546. }
  547. /* determine by signature whether we have ATA or ATAPI devices */
  548. classes[0] = ata_sff_dev_classify(&ap->link.device[0],
  549. devmask & (1 << 0), &err);
  550. if (slave_possible && err != 0x81)
  551. classes[1] = ata_sff_dev_classify(&ap->link.device[1],
  552. devmask & (1 << 1), &err);
  553. DPRINTK("EXIT, classes[0]=%u [1]=%u\n", classes[0], classes[1]);
  554. return 0;
  555. }
  556. /**
  557. * scc_bmdma_stop - Stop PCI IDE BMDMA transfer
  558. * @qc: Command we are ending DMA for
  559. */
  560. static void scc_bmdma_stop (struct ata_queued_cmd *qc)
  561. {
  562. struct ata_port *ap = qc->ap;
  563. void __iomem *ctrl_base = ap->host->iomap[SCC_CTRL_BAR];
  564. void __iomem *bmid_base = ap->host->iomap[SCC_BMID_BAR];
  565. u32 reg;
  566. while (1) {
  567. reg = in_be32(bmid_base + SCC_DMA_INTST);
  568. if (reg & INTSTS_SERROR) {
  569. printk(KERN_WARNING "%s: SERROR\n", DRV_NAME);
  570. out_be32(bmid_base + SCC_DMA_INTST, INTSTS_SERROR|INTSTS_BMSINT);
  571. out_be32(bmid_base + SCC_DMA_CMD,
  572. in_be32(bmid_base + SCC_DMA_CMD) & ~ATA_DMA_START);
  573. continue;
  574. }
  575. if (reg & INTSTS_PRERR) {
  576. u32 maea0, maec0;
  577. maea0 = in_be32(ctrl_base + SCC_CTL_MAEA0);
  578. maec0 = in_be32(ctrl_base + SCC_CTL_MAEC0);
  579. printk(KERN_WARNING "%s: PRERR [addr:%x cmd:%x]\n", DRV_NAME, maea0, maec0);
  580. out_be32(bmid_base + SCC_DMA_INTST, INTSTS_PRERR|INTSTS_BMSINT);
  581. out_be32(bmid_base + SCC_DMA_CMD,
  582. in_be32(bmid_base + SCC_DMA_CMD) & ~ATA_DMA_START);
  583. continue;
  584. }
  585. if (reg & INTSTS_RERR) {
  586. printk(KERN_WARNING "%s: Response Error\n", DRV_NAME);
  587. out_be32(bmid_base + SCC_DMA_INTST, INTSTS_RERR|INTSTS_BMSINT);
  588. out_be32(bmid_base + SCC_DMA_CMD,
  589. in_be32(bmid_base + SCC_DMA_CMD) & ~ATA_DMA_START);
  590. continue;
  591. }
  592. if (reg & INTSTS_ICERR) {
  593. out_be32(bmid_base + SCC_DMA_CMD,
  594. in_be32(bmid_base + SCC_DMA_CMD) & ~ATA_DMA_START);
  595. printk(KERN_WARNING "%s: Illegal Configuration\n", DRV_NAME);
  596. out_be32(bmid_base + SCC_DMA_INTST, INTSTS_ICERR|INTSTS_BMSINT);
  597. continue;
  598. }
  599. if (reg & INTSTS_BMSINT) {
  600. unsigned int classes;
  601. unsigned long deadline = ata_deadline(jiffies, ATA_TMOUT_BOOT);
  602. printk(KERN_WARNING "%s: Internal Bus Error\n", DRV_NAME);
  603. out_be32(bmid_base + SCC_DMA_INTST, INTSTS_BMSINT);
  604. /* TBD: SW reset */
  605. scc_softreset(&ap->link, &classes, deadline);
  606. continue;
  607. }
  608. if (reg & INTSTS_BMHE) {
  609. out_be32(bmid_base + SCC_DMA_INTST, INTSTS_BMHE);
  610. continue;
  611. }
  612. if (reg & INTSTS_ACTEINT) {
  613. out_be32(bmid_base + SCC_DMA_INTST, INTSTS_ACTEINT);
  614. continue;
  615. }
  616. if (reg & INTSTS_IOIRQS) {
  617. out_be32(bmid_base + SCC_DMA_INTST, INTSTS_IOIRQS);
  618. continue;
  619. }
  620. break;
  621. }
  622. /* clear start/stop bit */
  623. out_be32(bmid_base + SCC_DMA_CMD,
  624. in_be32(bmid_base + SCC_DMA_CMD) & ~ATA_DMA_START);
  625. /* one-PIO-cycle guaranteed wait, per spec, for HDMA1:0 transition */
  626. ata_sff_dma_pause(ap); /* dummy read */
  627. }
  628. /**
  629. * scc_bmdma_status - Read PCI IDE BMDMA status
  630. * @ap: Port associated with this ATA transaction.
  631. */
  632. static u8 scc_bmdma_status (struct ata_port *ap)
  633. {
  634. void __iomem *mmio = ap->ioaddr.bmdma_addr;
  635. u8 host_stat = in_be32(mmio + SCC_DMA_STATUS);
  636. u32 int_status = in_be32(mmio + SCC_DMA_INTST);
  637. struct ata_queued_cmd *qc = ata_qc_from_tag(ap, ap->link.active_tag);
  638. static int retry = 0;
  639. /* return if IOS_SS is cleared */
  640. if (!(in_be32(mmio + SCC_DMA_CMD) & ATA_DMA_START))
  641. return host_stat;
  642. /* errata A252,A308 workaround: Step4 */
  643. if ((scc_check_altstatus(ap) & ATA_ERR)
  644. && (int_status & INTSTS_INTRQ))
  645. return (host_stat | ATA_DMA_INTR);
  646. /* errata A308 workaround Step5 */
  647. if (int_status & INTSTS_IOIRQS) {
  648. host_stat |= ATA_DMA_INTR;
  649. /* We don't check ATAPI DMA because it is limited to UDMA4 */
  650. if ((qc->tf.protocol == ATA_PROT_DMA &&
  651. qc->dev->xfer_mode > XFER_UDMA_4)) {
  652. if (!(int_status & INTSTS_ACTEINT)) {
  653. printk(KERN_WARNING "ata%u: operation failed (transfer data loss)\n",
  654. ap->print_id);
  655. host_stat |= ATA_DMA_ERR;
  656. if (retry++)
  657. ap->udma_mask &= ~(1 << qc->dev->xfer_mode);
  658. } else
  659. retry = 0;
  660. }
  661. }
  662. return host_stat;
  663. }
  664. /**
  665. * scc_data_xfer - Transfer data by PIO
  666. * @dev: device for this I/O
  667. * @buf: data buffer
  668. * @buflen: buffer length
  669. * @rw: read/write
  670. *
  671. * Note: Original code is ata_sff_data_xfer().
  672. */
  673. static unsigned int scc_data_xfer (struct ata_device *dev, unsigned char *buf,
  674. unsigned int buflen, int rw)
  675. {
  676. struct ata_port *ap = dev->link->ap;
  677. unsigned int words = buflen >> 1;
  678. unsigned int i;
  679. __le16 *buf16 = (__le16 *) buf;
  680. void __iomem *mmio = ap->ioaddr.data_addr;
  681. /* Transfer multiple of 2 bytes */
  682. if (rw == READ)
  683. for (i = 0; i < words; i++)
  684. buf16[i] = cpu_to_le16(in_be32(mmio));
  685. else
  686. for (i = 0; i < words; i++)
  687. out_be32(mmio, le16_to_cpu(buf16[i]));
  688. /* Transfer trailing 1 byte, if any. */
  689. if (unlikely(buflen & 0x01)) {
  690. __le16 align_buf[1] = { 0 };
  691. unsigned char *trailing_buf = buf + buflen - 1;
  692. if (rw == READ) {
  693. align_buf[0] = cpu_to_le16(in_be32(mmio));
  694. memcpy(trailing_buf, align_buf, 1);
  695. } else {
  696. memcpy(align_buf, trailing_buf, 1);
  697. out_be32(mmio, le16_to_cpu(align_buf[0]));
  698. }
  699. words++;
  700. }
  701. return words << 1;
  702. }
  703. /**
  704. * scc_pata_prereset - prepare for reset
  705. * @ap: ATA port to be reset
  706. * @deadline: deadline jiffies for the operation
  707. */
  708. static int scc_pata_prereset(struct ata_link *link, unsigned long deadline)
  709. {
  710. link->ap->cbl = ATA_CBL_PATA80;
  711. return ata_sff_prereset(link, deadline);
  712. }
  713. /**
  714. * scc_postreset - standard postreset callback
  715. * @ap: the target ata_port
  716. * @classes: classes of attached devices
  717. *
  718. * Note: Original code is ata_sff_postreset().
  719. */
  720. static void scc_postreset(struct ata_link *link, unsigned int *classes)
  721. {
  722. struct ata_port *ap = link->ap;
  723. DPRINTK("ENTER\n");
  724. /* is double-select really necessary? */
  725. if (classes[0] != ATA_DEV_NONE)
  726. ap->ops->sff_dev_select(ap, 1);
  727. if (classes[1] != ATA_DEV_NONE)
  728. ap->ops->sff_dev_select(ap, 0);
  729. /* bail out if no device is present */
  730. if (classes[0] == ATA_DEV_NONE && classes[1] == ATA_DEV_NONE) {
  731. DPRINTK("EXIT, no device\n");
  732. return;
  733. }
  734. /* set up device control */
  735. out_be32(ap->ioaddr.ctl_addr, ap->ctl);
  736. DPRINTK("EXIT\n");
  737. }
  738. /**
  739. * scc_irq_clear - Clear PCI IDE BMDMA interrupt.
  740. * @ap: Port associated with this ATA transaction.
  741. *
  742. * Note: Original code is ata_bmdma_irq_clear().
  743. */
  744. static void scc_irq_clear (struct ata_port *ap)
  745. {
  746. void __iomem *mmio = ap->ioaddr.bmdma_addr;
  747. if (!mmio)
  748. return;
  749. out_be32(mmio + SCC_DMA_STATUS, in_be32(mmio + SCC_DMA_STATUS));
  750. }
  751. /**
  752. * scc_port_start - Set port up for dma.
  753. * @ap: Port to initialize
  754. *
  755. * Allocate space for PRD table using ata_bmdma_port_start().
  756. * Set PRD table address for PTERADD. (PRD Transfer End Read)
  757. */
  758. static int scc_port_start (struct ata_port *ap)
  759. {
  760. void __iomem *mmio = ap->ioaddr.bmdma_addr;
  761. int rc;
  762. rc = ata_bmdma_port_start(ap);
  763. if (rc)
  764. return rc;
  765. out_be32(mmio + SCC_DMA_PTERADD, ap->bmdma_prd_dma);
  766. return 0;
  767. }
  768. /**
  769. * scc_port_stop - Undo scc_port_start()
  770. * @ap: Port to shut down
  771. *
  772. * Reset PTERADD.
  773. */
  774. static void scc_port_stop (struct ata_port *ap)
  775. {
  776. void __iomem *mmio = ap->ioaddr.bmdma_addr;
  777. out_be32(mmio + SCC_DMA_PTERADD, 0);
  778. }
  779. static struct scsi_host_template scc_sht = {
  780. ATA_BMDMA_SHT(DRV_NAME),
  781. };
  782. static struct ata_port_operations scc_pata_ops = {
  783. .inherits = &ata_bmdma_port_ops,
  784. .set_piomode = scc_set_piomode,
  785. .set_dmamode = scc_set_dmamode,
  786. .mode_filter = scc_mode_filter,
  787. .sff_tf_load = scc_tf_load,
  788. .sff_tf_read = scc_tf_read,
  789. .sff_exec_command = scc_exec_command,
  790. .sff_check_status = scc_check_status,
  791. .sff_check_altstatus = scc_check_altstatus,
  792. .sff_dev_select = scc_dev_select,
  793. .sff_set_devctl = scc_set_devctl,
  794. .bmdma_setup = scc_bmdma_setup,
  795. .bmdma_start = scc_bmdma_start,
  796. .bmdma_stop = scc_bmdma_stop,
  797. .bmdma_status = scc_bmdma_status,
  798. .sff_data_xfer = scc_data_xfer,
  799. .prereset = scc_pata_prereset,
  800. .softreset = scc_softreset,
  801. .postreset = scc_postreset,
  802. .sff_irq_clear = scc_irq_clear,
  803. .port_start = scc_port_start,
  804. .port_stop = scc_port_stop,
  805. };
  806. static struct ata_port_info scc_port_info[] = {
  807. {
  808. .flags = ATA_FLAG_SLAVE_POSS,
  809. .pio_mask = ATA_PIO4,
  810. /* No MWDMA */
  811. .udma_mask = ATA_UDMA6,
  812. .port_ops = &scc_pata_ops,
  813. },
  814. };
  815. /**
  816. * scc_reset_controller - initialize SCC PATA controller.
  817. */
  818. static int scc_reset_controller(struct ata_host *host)
  819. {
  820. void __iomem *ctrl_base = host->iomap[SCC_CTRL_BAR];
  821. void __iomem *bmid_base = host->iomap[SCC_BMID_BAR];
  822. void __iomem *cckctrl_port = ctrl_base + SCC_CTL_CCKCTRL;
  823. void __iomem *mode_port = ctrl_base + SCC_CTL_MODEREG;
  824. void __iomem *ecmode_port = ctrl_base + SCC_CTL_ECMODE;
  825. void __iomem *intmask_port = bmid_base + SCC_DMA_INTMASK;
  826. void __iomem *dmastatus_port = bmid_base + SCC_DMA_STATUS;
  827. u32 reg = 0;
  828. out_be32(cckctrl_port, reg);
  829. reg |= CCKCTRL_ATACLKOEN;
  830. out_be32(cckctrl_port, reg);
  831. reg |= CCKCTRL_LCLKEN | CCKCTRL_OCLKEN;
  832. out_be32(cckctrl_port, reg);
  833. reg |= CCKCTRL_CRST;
  834. out_be32(cckctrl_port, reg);
  835. for (;;) {
  836. reg = in_be32(cckctrl_port);
  837. if (reg & CCKCTRL_CRST)
  838. break;
  839. udelay(5000);
  840. }
  841. reg |= CCKCTRL_ATARESET;
  842. out_be32(cckctrl_port, reg);
  843. out_be32(ecmode_port, ECMODE_VALUE);
  844. out_be32(mode_port, MODE_JCUSFEN);
  845. out_be32(intmask_port, INTMASK_MSK);
  846. if (in_be32(dmastatus_port) & QCHSD_STPDIAG) {
  847. printk(KERN_WARNING "%s: failed to detect 80c cable. (PDIAG# is high)\n", DRV_NAME);
  848. return -EIO;
  849. }
  850. return 0;
  851. }
  852. /**
  853. * scc_setup_ports - initialize ioaddr with SCC PATA port offsets.
  854. * @ioaddr: IO address structure to be initialized
  855. * @base: base address of BMID region
  856. */
  857. static void scc_setup_ports (struct ata_ioports *ioaddr, void __iomem *base)
  858. {
  859. ioaddr->cmd_addr = base + SCC_REG_CMD_ADDR;
  860. ioaddr->altstatus_addr = ioaddr->cmd_addr + SCC_REG_ALTSTATUS;
  861. ioaddr->ctl_addr = ioaddr->cmd_addr + SCC_REG_ALTSTATUS;
  862. ioaddr->bmdma_addr = base;
  863. ioaddr->data_addr = ioaddr->cmd_addr + SCC_REG_DATA;
  864. ioaddr->error_addr = ioaddr->cmd_addr + SCC_REG_ERR;
  865. ioaddr->feature_addr = ioaddr->cmd_addr + SCC_REG_FEATURE;
  866. ioaddr->nsect_addr = ioaddr->cmd_addr + SCC_REG_NSECT;
  867. ioaddr->lbal_addr = ioaddr->cmd_addr + SCC_REG_LBAL;
  868. ioaddr->lbam_addr = ioaddr->cmd_addr + SCC_REG_LBAM;
  869. ioaddr->lbah_addr = ioaddr->cmd_addr + SCC_REG_LBAH;
  870. ioaddr->device_addr = ioaddr->cmd_addr + SCC_REG_DEVICE;
  871. ioaddr->status_addr = ioaddr->cmd_addr + SCC_REG_STATUS;
  872. ioaddr->command_addr = ioaddr->cmd_addr + SCC_REG_CMD;
  873. }
  874. static int scc_host_init(struct ata_host *host)
  875. {
  876. struct pci_dev *pdev = to_pci_dev(host->dev);
  877. int rc;
  878. rc = scc_reset_controller(host);
  879. if (rc)
  880. return rc;
  881. rc = pci_set_dma_mask(pdev, ATA_DMA_MASK);
  882. if (rc)
  883. return rc;
  884. rc = pci_set_consistent_dma_mask(pdev, ATA_DMA_MASK);
  885. if (rc)
  886. return rc;
  887. scc_setup_ports(&host->ports[0]->ioaddr, host->iomap[SCC_BMID_BAR]);
  888. pci_set_master(pdev);
  889. return 0;
  890. }
  891. /**
  892. * scc_init_one - Register SCC PATA device with kernel services
  893. * @pdev: PCI device to register
  894. * @ent: Entry in scc_pci_tbl matching with @pdev
  895. *
  896. * LOCKING:
  897. * Inherited from PCI layer (may sleep).
  898. *
  899. * RETURNS:
  900. * Zero on success, or -ERRNO value.
  901. */
  902. static int scc_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
  903. {
  904. static int printed_version;
  905. unsigned int board_idx = (unsigned int) ent->driver_data;
  906. const struct ata_port_info *ppi[] = { &scc_port_info[board_idx], NULL };
  907. struct ata_host *host;
  908. int rc;
  909. if (!printed_version++)
  910. dev_printk(KERN_DEBUG, &pdev->dev,
  911. "version " DRV_VERSION "\n");
  912. host = ata_host_alloc_pinfo(&pdev->dev, ppi, 1);
  913. if (!host)
  914. return -ENOMEM;
  915. rc = pcim_enable_device(pdev);
  916. if (rc)
  917. return rc;
  918. rc = pcim_iomap_regions(pdev, (1 << SCC_CTRL_BAR) | (1 << SCC_BMID_BAR), DRV_NAME);
  919. if (rc == -EBUSY)
  920. pcim_pin_device(pdev);
  921. if (rc)
  922. return rc;
  923. host->iomap = pcim_iomap_table(pdev);
  924. ata_port_pbar_desc(host->ports[0], SCC_CTRL_BAR, -1, "ctrl");
  925. ata_port_pbar_desc(host->ports[0], SCC_BMID_BAR, -1, "bmid");
  926. rc = scc_host_init(host);
  927. if (rc)
  928. return rc;
  929. return ata_host_activate(host, pdev->irq, ata_bmdma_interrupt,
  930. IRQF_SHARED, &scc_sht);
  931. }
  932. static struct pci_driver scc_pci_driver = {
  933. .name = DRV_NAME,
  934. .id_table = scc_pci_tbl,
  935. .probe = scc_init_one,
  936. .remove = ata_pci_remove_one,
  937. #ifdef CONFIG_PM
  938. .suspend = ata_pci_device_suspend,
  939. .resume = ata_pci_device_resume,
  940. #endif
  941. };
  942. static int __init scc_init (void)
  943. {
  944. int rc;
  945. DPRINTK("pci_register_driver\n");
  946. rc = pci_register_driver(&scc_pci_driver);
  947. if (rc)
  948. return rc;
  949. DPRINTK("done\n");
  950. return 0;
  951. }
  952. static void __exit scc_exit (void)
  953. {
  954. pci_unregister_driver(&scc_pci_driver);
  955. }
  956. module_init(scc_init);
  957. module_exit(scc_exit);
  958. MODULE_AUTHOR("Toshiba corp");
  959. MODULE_DESCRIPTION("SCSI low-level driver for Toshiba SCC PATA controller");
  960. MODULE_LICENSE("GPL");
  961. MODULE_DEVICE_TABLE(pci, scc_pci_tbl);
  962. MODULE_VERSION(DRV_VERSION);