pata_hpt3x2n.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629
  1. // SPDX-License-Identifier: GPL-2.0-only
  2. /*
  3. * Libata driver for the HighPoint 371N, 372N, and 302N UDMA66 ATA controllers.
  4. *
  5. * This driver is heavily based upon:
  6. *
  7. * linux/drivers/ide/pci/hpt366.c Version 0.36 April 25, 2003
  8. *
  9. * Copyright (C) 1999-2003 Andre Hedrick <[email protected]>
  10. * Portions Copyright (C) 2001 Sun Microsystems, Inc.
  11. * Portions Copyright (C) 2003 Red Hat Inc
  12. * Portions Copyright (C) 2005-2010 MontaVista Software, Inc.
  13. *
  14. *
  15. * TODO
  16. * Work out best PLL policy
  17. */
  18. #include <linux/kernel.h>
  19. #include <linux/module.h>
  20. #include <linux/pci.h>
  21. #include <linux/blkdev.h>
  22. #include <linux/delay.h>
  23. #include <scsi/scsi_host.h>
  24. #include <linux/libata.h>
  25. #define DRV_NAME "pata_hpt3x2n"
  26. #define DRV_VERSION "0.3.19"
  27. enum {
  28. PCI66 = (1 << 1),
  29. USE_DPLL = (1 << 0)
  30. };
  31. struct hpt_clock {
  32. u8 xfer_speed;
  33. u32 timing;
  34. };
  35. /* key for bus clock timings
  36. * bit
  37. * 0:3 data_high_time. Inactive time of DIOW_/DIOR_ for PIO and MW DMA.
  38. * cycles = value + 1
  39. * 4:8 data_low_time. Active time of DIOW_/DIOR_ for PIO and MW DMA.
  40. * cycles = value + 1
  41. * 9:12 cmd_high_time. Inactive time of DIOW_/DIOR_ during task file
  42. * register access.
  43. * 13:17 cmd_low_time. Active time of DIOW_/DIOR_ during task file
  44. * register access.
  45. * 18:20 udma_cycle_time. Clock cycles for UDMA xfer.
  46. * 21 CLK frequency for UDMA: 0=ATA clock, 1=dual ATA clock.
  47. * 22:24 pre_high_time. Time to initialize 1st cycle for PIO and MW DMA xfer.
  48. * 25:27 cmd_pre_high_time. Time to initialize 1st PIO cycle for task file
  49. * register access.
  50. * 28 UDMA enable.
  51. * 29 DMA enable.
  52. * 30 PIO_MST enable. If set, the chip is in bus master mode during
  53. * PIO xfer.
  54. * 31 FIFO enable. Only for PIO.
  55. */
  56. /* 66MHz DPLL clocks */
  57. static struct hpt_clock hpt3x2n_clocks[] = {
  58. { XFER_UDMA_7, 0x1c869c62 },
  59. { XFER_UDMA_6, 0x1c869c62 },
  60. { XFER_UDMA_5, 0x1c8a9c62 },
  61. { XFER_UDMA_4, 0x1c8a9c62 },
  62. { XFER_UDMA_3, 0x1c8e9c62 },
  63. { XFER_UDMA_2, 0x1c929c62 },
  64. { XFER_UDMA_1, 0x1c9a9c62 },
  65. { XFER_UDMA_0, 0x1c829c62 },
  66. { XFER_MW_DMA_2, 0x2c829c62 },
  67. { XFER_MW_DMA_1, 0x2c829c66 },
  68. { XFER_MW_DMA_0, 0x2c829d2e },
  69. { XFER_PIO_4, 0x0c829c62 },
  70. { XFER_PIO_3, 0x0c829c84 },
  71. { XFER_PIO_2, 0x0c829ca6 },
  72. { XFER_PIO_1, 0x0d029d26 },
  73. { XFER_PIO_0, 0x0d029d5e },
  74. };
  75. /**
  76. * hpt3x2n_find_mode - reset the hpt3x2n bus
  77. * @ap: ATA port
  78. * @speed: transfer mode
  79. *
  80. * Return the 32bit register programming information for this channel
  81. * that matches the speed provided. For the moment the clocks table
  82. * is hard coded but easy to change. This will be needed if we use
  83. * different DPLLs
  84. */
  85. static u32 hpt3x2n_find_mode(struct ata_port *ap, int speed)
  86. {
  87. struct hpt_clock *clocks = hpt3x2n_clocks;
  88. while (clocks->xfer_speed) {
  89. if (clocks->xfer_speed == speed)
  90. return clocks->timing;
  91. clocks++;
  92. }
  93. BUG();
  94. return 0xffffffffU; /* silence compiler warning */
  95. }
  96. /**
  97. * hpt372n_filter - mode selection filter
  98. * @adev: ATA device
  99. * @mask: mode mask
  100. *
  101. * The Marvell bridge chips used on the HighPoint SATA cards do not seem
  102. * to support the UltraDMA modes 1, 2, and 3 as well as any MWDMA modes...
  103. */
  104. static unsigned int hpt372n_filter(struct ata_device *adev, unsigned int mask)
  105. {
  106. if (ata_id_is_sata(adev->id))
  107. mask &= ~((0xE << ATA_SHIFT_UDMA) | ATA_MASK_MWDMA);
  108. return mask;
  109. }
  110. /**
  111. * hpt3x2n_cable_detect - Detect the cable type
  112. * @ap: ATA port to detect on
  113. *
  114. * Return the cable type attached to this port
  115. */
  116. static int hpt3x2n_cable_detect(struct ata_port *ap)
  117. {
  118. u8 scr2, ata66;
  119. struct pci_dev *pdev = to_pci_dev(ap->host->dev);
  120. pci_read_config_byte(pdev, 0x5B, &scr2);
  121. pci_write_config_byte(pdev, 0x5B, scr2 & ~0x01);
  122. udelay(10); /* debounce */
  123. /* Cable register now active */
  124. pci_read_config_byte(pdev, 0x5A, &ata66);
  125. /* Restore state */
  126. pci_write_config_byte(pdev, 0x5B, scr2);
  127. if (ata66 & (2 >> ap->port_no))
  128. return ATA_CBL_PATA40;
  129. else
  130. return ATA_CBL_PATA80;
  131. }
  132. /**
  133. * hpt3x2n_pre_reset - reset the hpt3x2n bus
  134. * @link: ATA link to reset
  135. * @deadline: deadline jiffies for the operation
  136. *
  137. * Perform the initial reset handling for the 3x2n series controllers.
  138. * Reset the hardware and state machine,
  139. */
  140. static int hpt3x2n_pre_reset(struct ata_link *link, unsigned long deadline)
  141. {
  142. struct ata_port *ap = link->ap;
  143. struct pci_dev *pdev = to_pci_dev(ap->host->dev);
  144. static const struct pci_bits hpt3x2n_enable_bits[] = {
  145. { 0x50, 1, 0x04, 0x04 },
  146. { 0x54, 1, 0x04, 0x04 }
  147. };
  148. u8 mcr2;
  149. if (!pci_test_config_bits(pdev, &hpt3x2n_enable_bits[ap->port_no]))
  150. return -ENOENT;
  151. /* Reset the state machine */
  152. pci_write_config_byte(pdev, 0x50 + 4 * ap->port_no, 0x37);
  153. udelay(100);
  154. /* Fast interrupt prediction disable, hold off interrupt disable */
  155. pci_read_config_byte(pdev, 0x51 + 4 * ap->port_no, &mcr2);
  156. mcr2 &= ~0x07;
  157. pci_write_config_byte(pdev, 0x51 + 4 * ap->port_no, mcr2);
  158. return ata_sff_prereset(link, deadline);
  159. }
  160. static void hpt3x2n_set_mode(struct ata_port *ap, struct ata_device *adev,
  161. u8 mode)
  162. {
  163. struct pci_dev *pdev = to_pci_dev(ap->host->dev);
  164. int addr = 0x40 + 4 * (adev->devno + 2 * ap->port_no);
  165. u32 reg, timing, mask;
  166. /* Determine timing mask and find matching mode entry */
  167. if (mode < XFER_MW_DMA_0)
  168. mask = 0xcfc3ffff;
  169. else if (mode < XFER_UDMA_0)
  170. mask = 0x31c001ff;
  171. else
  172. mask = 0x303c0000;
  173. timing = hpt3x2n_find_mode(ap, mode);
  174. pci_read_config_dword(pdev, addr, &reg);
  175. reg = (reg & ~mask) | (timing & mask);
  176. pci_write_config_dword(pdev, addr, reg);
  177. }
  178. /**
  179. * hpt3x2n_set_piomode - PIO setup
  180. * @ap: ATA interface
  181. * @adev: device on the interface
  182. *
  183. * Perform PIO mode setup.
  184. */
  185. static void hpt3x2n_set_piomode(struct ata_port *ap, struct ata_device *adev)
  186. {
  187. hpt3x2n_set_mode(ap, adev, adev->pio_mode);
  188. }
  189. /**
  190. * hpt3x2n_set_dmamode - DMA timing setup
  191. * @ap: ATA interface
  192. * @adev: Device being configured
  193. *
  194. * Set up the channel for MWDMA or UDMA modes.
  195. */
  196. static void hpt3x2n_set_dmamode(struct ata_port *ap, struct ata_device *adev)
  197. {
  198. hpt3x2n_set_mode(ap, adev, adev->dma_mode);
  199. }
  200. /**
  201. * hpt3x2n_bmdma_stop - DMA engine stop
  202. * @qc: ATA command
  203. *
  204. * Clean up after the HPT3x2n and later DMA engine
  205. */
  206. static void hpt3x2n_bmdma_stop(struct ata_queued_cmd *qc)
  207. {
  208. struct ata_port *ap = qc->ap;
  209. struct pci_dev *pdev = to_pci_dev(ap->host->dev);
  210. int mscreg = 0x50 + 4 * ap->port_no;
  211. u8 bwsr_stat, msc_stat;
  212. pci_read_config_byte(pdev, 0x6A, &bwsr_stat);
  213. pci_read_config_byte(pdev, mscreg, &msc_stat);
  214. if (bwsr_stat & (1 << ap->port_no))
  215. pci_write_config_byte(pdev, mscreg, msc_stat | 0x30);
  216. ata_bmdma_stop(qc);
  217. }
  218. /**
  219. * hpt3x2n_set_clock - clock control
  220. * @ap: ATA port
  221. * @source: 0x21 or 0x23 for PLL or PCI sourced clock
  222. *
  223. * Switch the ATA bus clock between the PLL and PCI clock sources
  224. * while correctly isolating the bus and resetting internal logic
  225. *
  226. * We must use the DPLL for
  227. * - writing
  228. * - second channel UDMA7 (SATA ports) or higher
  229. * - 66MHz PCI
  230. *
  231. * or we will underclock the device and get reduced performance.
  232. */
  233. static void hpt3x2n_set_clock(struct ata_port *ap, int source)
  234. {
  235. void __iomem *bmdma = ap->ioaddr.bmdma_addr - ap->port_no * 8;
  236. /* Tristate the bus */
  237. iowrite8(0x80, bmdma+0x73);
  238. iowrite8(0x80, bmdma+0x77);
  239. /* Switch clock and reset channels */
  240. iowrite8(source, bmdma+0x7B);
  241. iowrite8(0xC0, bmdma+0x79);
  242. /* Reset state machines, avoid enabling the disabled channels */
  243. iowrite8(ioread8(bmdma+0x70) | 0x32, bmdma+0x70);
  244. iowrite8(ioread8(bmdma+0x74) | 0x32, bmdma+0x74);
  245. /* Complete reset */
  246. iowrite8(0x00, bmdma+0x79);
  247. /* Reconnect channels to bus */
  248. iowrite8(0x00, bmdma+0x73);
  249. iowrite8(0x00, bmdma+0x77);
  250. }
  251. static int hpt3x2n_use_dpll(struct ata_port *ap, int writing)
  252. {
  253. long flags = (long)ap->host->private_data;
  254. /* See if we should use the DPLL */
  255. if (writing)
  256. return USE_DPLL; /* Needed for write */
  257. if (flags & PCI66)
  258. return USE_DPLL; /* Needed at 66Mhz */
  259. return 0;
  260. }
  261. static int hpt3x2n_qc_defer(struct ata_queued_cmd *qc)
  262. {
  263. struct ata_port *ap = qc->ap;
  264. struct ata_port *alt = ap->host->ports[ap->port_no ^ 1];
  265. int rc, flags = (long)ap->host->private_data;
  266. int dpll = hpt3x2n_use_dpll(ap, qc->tf.flags & ATA_TFLAG_WRITE);
  267. /* First apply the usual rules */
  268. rc = ata_std_qc_defer(qc);
  269. if (rc != 0)
  270. return rc;
  271. if ((flags & USE_DPLL) != dpll && alt->qc_active)
  272. return ATA_DEFER_PORT;
  273. return 0;
  274. }
  275. static unsigned int hpt3x2n_qc_issue(struct ata_queued_cmd *qc)
  276. {
  277. struct ata_port *ap = qc->ap;
  278. int flags = (long)ap->host->private_data;
  279. int dpll = hpt3x2n_use_dpll(ap, qc->tf.flags & ATA_TFLAG_WRITE);
  280. if ((flags & USE_DPLL) != dpll) {
  281. flags &= ~USE_DPLL;
  282. flags |= dpll;
  283. ap->host->private_data = (void *)(long)flags;
  284. hpt3x2n_set_clock(ap, dpll ? 0x21 : 0x23);
  285. }
  286. return ata_bmdma_qc_issue(qc);
  287. }
  288. static struct scsi_host_template hpt3x2n_sht = {
  289. ATA_BMDMA_SHT(DRV_NAME),
  290. };
  291. /*
  292. * Configuration for HPT302N/371N.
  293. */
  294. static struct ata_port_operations hpt3xxn_port_ops = {
  295. .inherits = &ata_bmdma_port_ops,
  296. .bmdma_stop = hpt3x2n_bmdma_stop,
  297. .qc_defer = hpt3x2n_qc_defer,
  298. .qc_issue = hpt3x2n_qc_issue,
  299. .cable_detect = hpt3x2n_cable_detect,
  300. .set_piomode = hpt3x2n_set_piomode,
  301. .set_dmamode = hpt3x2n_set_dmamode,
  302. .prereset = hpt3x2n_pre_reset,
  303. };
  304. /*
  305. * Configuration for HPT372N. Same as 302N/371N but we have a mode filter.
  306. */
  307. static struct ata_port_operations hpt372n_port_ops = {
  308. .inherits = &hpt3xxn_port_ops,
  309. .mode_filter = &hpt372n_filter,
  310. };
  311. /**
  312. * hpt3xn_calibrate_dpll - Calibrate the DPLL loop
  313. * @dev: PCI device
  314. *
  315. * Perform a calibration cycle on the HPT3xN DPLL. Returns 1 if this
  316. * succeeds
  317. */
  318. static int hpt3xn_calibrate_dpll(struct pci_dev *dev)
  319. {
  320. u8 reg5b;
  321. u32 reg5c;
  322. int tries;
  323. for (tries = 0; tries < 0x5000; tries++) {
  324. udelay(50);
  325. pci_read_config_byte(dev, 0x5b, &reg5b);
  326. if (reg5b & 0x80) {
  327. /* See if it stays set */
  328. for (tries = 0; tries < 0x1000; tries++) {
  329. pci_read_config_byte(dev, 0x5b, &reg5b);
  330. /* Failed ? */
  331. if ((reg5b & 0x80) == 0)
  332. return 0;
  333. }
  334. /* Turn off tuning, we have the DPLL set */
  335. pci_read_config_dword(dev, 0x5c, &reg5c);
  336. pci_write_config_dword(dev, 0x5c, reg5c & ~0x100);
  337. return 1;
  338. }
  339. }
  340. /* Never went stable */
  341. return 0;
  342. }
  343. static int hpt3x2n_pci_clock(struct pci_dev *pdev, unsigned int base)
  344. {
  345. unsigned int freq;
  346. u32 fcnt;
  347. /*
  348. * Some devices do not let this value be accessed via PCI space
  349. * according to the old driver.
  350. */
  351. fcnt = inl(pci_resource_start(pdev, 4) + 0x90);
  352. if ((fcnt >> 12) != 0xABCDE) {
  353. u32 total = 0;
  354. int i;
  355. u16 sr;
  356. dev_warn(&pdev->dev, "BIOS clock data not set\n");
  357. /* This is the process the HPT371 BIOS is reported to use */
  358. for (i = 0; i < 128; i++) {
  359. pci_read_config_word(pdev, 0x78, &sr);
  360. total += sr & 0x1FF;
  361. udelay(15);
  362. }
  363. fcnt = total / 128;
  364. }
  365. fcnt &= 0x1FF;
  366. freq = (fcnt * base) / 192; /* in MHz */
  367. /* Clamp to bands */
  368. if (freq < 40)
  369. return 33;
  370. if (freq < 45)
  371. return 40;
  372. if (freq < 55)
  373. return 50;
  374. return 66;
  375. }
  376. /**
  377. * hpt3x2n_init_one - Initialise an HPT37X/302
  378. * @dev: PCI device
  379. * @id: Entry in match table
  380. *
  381. * Initialise an HPT3x2n device. There are some interesting complications
  382. * here. Firstly the chip may report 366 and be one of several variants.
  383. * Secondly all the timings depend on the clock for the chip which we must
  384. * detect and look up
  385. *
  386. * This is the known chip mappings. It may be missing a couple of later
  387. * releases.
  388. *
  389. * Chip version PCI Rev Notes
  390. * HPT372 4 (HPT366) 5 Other driver
  391. * HPT372N 4 (HPT366) 6 UDMA133
  392. * HPT372 5 (HPT372) 1 Other driver
  393. * HPT372N 5 (HPT372) 2 UDMA133
  394. * HPT302 6 (HPT302) * Other driver
  395. * HPT302N 6 (HPT302) > 1 UDMA133
  396. * HPT371 7 (HPT371) * Other driver
  397. * HPT371N 7 (HPT371) > 1 UDMA133
  398. * HPT374 8 (HPT374) * Other driver
  399. * HPT372N 9 (HPT372N) * UDMA133
  400. *
  401. * (1) UDMA133 support depends on the bus clock
  402. */
  403. static int hpt3x2n_init_one(struct pci_dev *dev, const struct pci_device_id *id)
  404. {
  405. /* HPT372N - UDMA133 */
  406. static const struct ata_port_info info_hpt372n = {
  407. .flags = ATA_FLAG_SLAVE_POSS,
  408. .pio_mask = ATA_PIO4,
  409. .mwdma_mask = ATA_MWDMA2,
  410. .udma_mask = ATA_UDMA6,
  411. .port_ops = &hpt372n_port_ops
  412. };
  413. /* HPT302N and HPT371N - UDMA133 */
  414. static const struct ata_port_info info_hpt3xxn = {
  415. .flags = ATA_FLAG_SLAVE_POSS,
  416. .pio_mask = ATA_PIO4,
  417. .mwdma_mask = ATA_MWDMA2,
  418. .udma_mask = ATA_UDMA6,
  419. .port_ops = &hpt3xxn_port_ops
  420. };
  421. const struct ata_port_info *ppi[] = { &info_hpt3xxn, NULL };
  422. u8 rev = dev->revision;
  423. u8 irqmask;
  424. unsigned int pci_mhz;
  425. unsigned int f_low, f_high;
  426. int adjust;
  427. unsigned long iobase = pci_resource_start(dev, 4);
  428. void *hpriv = (void *)USE_DPLL;
  429. int rc;
  430. rc = pcim_enable_device(dev);
  431. if (rc)
  432. return rc;
  433. switch (dev->device) {
  434. case PCI_DEVICE_ID_TTI_HPT366:
  435. /* 372N if rev >= 6 */
  436. if (rev < 6)
  437. return -ENODEV;
  438. goto hpt372n;
  439. case PCI_DEVICE_ID_TTI_HPT371:
  440. /* 371N if rev >= 2 */
  441. if (rev < 2)
  442. return -ENODEV;
  443. break;
  444. case PCI_DEVICE_ID_TTI_HPT372:
  445. /* 372N if rev >= 2 */
  446. if (rev < 2)
  447. return -ENODEV;
  448. goto hpt372n;
  449. case PCI_DEVICE_ID_TTI_HPT302:
  450. /* 302N if rev >= 2 */
  451. if (rev < 2)
  452. return -ENODEV;
  453. break;
  454. case PCI_DEVICE_ID_TTI_HPT372N:
  455. hpt372n:
  456. ppi[0] = &info_hpt372n;
  457. break;
  458. default:
  459. dev_err(&dev->dev,"PCI table is bogus, please report (%d)\n",
  460. dev->device);
  461. return -ENODEV;
  462. }
  463. /* Ok so this is a chip we support */
  464. pci_write_config_byte(dev, PCI_CACHE_LINE_SIZE, (L1_CACHE_BYTES / 4));
  465. pci_write_config_byte(dev, PCI_LATENCY_TIMER, 0x78);
  466. pci_write_config_byte(dev, PCI_MIN_GNT, 0x08);
  467. pci_write_config_byte(dev, PCI_MAX_LAT, 0x08);
  468. pci_read_config_byte(dev, 0x5A, &irqmask);
  469. irqmask &= ~0x10;
  470. pci_write_config_byte(dev, 0x5a, irqmask);
  471. /*
  472. * HPT371 chips physically have only one channel, the secondary one,
  473. * but the primary channel registers do exist! Go figure...
  474. * So, we manually disable the non-existing channel here
  475. * (if the BIOS hasn't done this already).
  476. */
  477. if (dev->device == PCI_DEVICE_ID_TTI_HPT371) {
  478. u8 mcr1;
  479. pci_read_config_byte(dev, 0x50, &mcr1);
  480. mcr1 &= ~0x04;
  481. pci_write_config_byte(dev, 0x50, mcr1);
  482. }
  483. /*
  484. * Tune the PLL. HPT recommend using 75 for SATA, 66 for UDMA133 or
  485. * 50 for UDMA100. Right now we always use 66
  486. */
  487. pci_mhz = hpt3x2n_pci_clock(dev, 77);
  488. f_low = (pci_mhz * 48) / 66; /* PCI Mhz for 66Mhz DPLL */
  489. f_high = f_low + 2; /* Tolerance */
  490. pci_write_config_dword(dev, 0x5C, (f_high << 16) | f_low | 0x100);
  491. /* PLL clock */
  492. pci_write_config_byte(dev, 0x5B, 0x21);
  493. /* Unlike the 37x we don't try jiggling the frequency */
  494. for (adjust = 0; adjust < 8; adjust++) {
  495. if (hpt3xn_calibrate_dpll(dev))
  496. break;
  497. pci_write_config_dword(dev, 0x5C, (f_high << 16) | f_low);
  498. }
  499. if (adjust == 8) {
  500. dev_err(&dev->dev, "DPLL did not stabilize!\n");
  501. return -ENODEV;
  502. }
  503. dev_info(&dev->dev, "bus clock %dMHz, using 66MHz DPLL\n", pci_mhz);
  504. /*
  505. * Set our private data up. We only need a few flags
  506. * so we use it directly.
  507. */
  508. if (pci_mhz > 60)
  509. hpriv = (void *)(PCI66 | USE_DPLL);
  510. /*
  511. * On HPT371N, if ATA clock is 66 MHz we must set bit 2 in
  512. * the MISC. register to stretch the UltraDMA Tss timing.
  513. * NOTE: This register is only writeable via I/O space.
  514. */
  515. if (dev->device == PCI_DEVICE_ID_TTI_HPT371)
  516. outb(inb(iobase + 0x9c) | 0x04, iobase + 0x9c);
  517. /* Now kick off ATA set up */
  518. return ata_pci_bmdma_init_one(dev, ppi, &hpt3x2n_sht, hpriv, 0);
  519. }
  520. static const struct pci_device_id hpt3x2n[] = {
  521. { PCI_VDEVICE(TTI, PCI_DEVICE_ID_TTI_HPT366), },
  522. { PCI_VDEVICE(TTI, PCI_DEVICE_ID_TTI_HPT371), },
  523. { PCI_VDEVICE(TTI, PCI_DEVICE_ID_TTI_HPT372), },
  524. { PCI_VDEVICE(TTI, PCI_DEVICE_ID_TTI_HPT302), },
  525. { PCI_VDEVICE(TTI, PCI_DEVICE_ID_TTI_HPT372N), },
  526. { },
  527. };
  528. static struct pci_driver hpt3x2n_pci_driver = {
  529. .name = DRV_NAME,
  530. .id_table = hpt3x2n,
  531. .probe = hpt3x2n_init_one,
  532. .remove = ata_pci_remove_one
  533. };
  534. module_pci_driver(hpt3x2n_pci_driver);
  535. MODULE_AUTHOR("Alan Cox");
  536. MODULE_DESCRIPTION("low-level driver for the Highpoint HPT3xxN");
  537. MODULE_LICENSE("GPL");
  538. MODULE_DEVICE_TABLE(pci, hpt3x2n);
  539. MODULE_VERSION(DRV_VERSION);