pdc202xx_new.c 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671
  1. /*
  2. * Promise TX2/TX4/TX2000/133 IDE driver
  3. *
  4. * This program is free software; you can redistribute it and/or
  5. * modify it under the terms of the GNU General Public License
  6. * as published by the Free Software Foundation; either version
  7. * 2 of the License, or (at your option) any later version.
  8. *
  9. * Split from:
  10. * linux/drivers/ide/pdc202xx.c Version 0.35 Mar. 30, 2002
  11. * Copyright (C) 1998-2002 Andre Hedrick <andre@linux-ide.org>
  12. * Copyright (C) 2005-2006 MontaVista Software, Inc.
  13. * Portions Copyright (C) 1999 Promise Technology, Inc.
  14. * Author: Frank Tiernan (frankt@promise.com)
  15. * Released under terms of General Public License
  16. */
  17. #include <linux/module.h>
  18. #include <linux/types.h>
  19. #include <linux/kernel.h>
  20. #include <linux/delay.h>
  21. #include <linux/timer.h>
  22. #include <linux/mm.h>
  23. #include <linux/ioport.h>
  24. #include <linux/blkdev.h>
  25. #include <linux/hdreg.h>
  26. #include <linux/interrupt.h>
  27. #include <linux/pci.h>
  28. #include <linux/init.h>
  29. #include <linux/ide.h>
  30. #include <asm/io.h>
  31. #include <asm/irq.h>
  32. #ifdef CONFIG_PPC_PMAC
  33. #include <asm/prom.h>
  34. #include <asm/pci-bridge.h>
  35. #endif
  36. #undef DEBUG
  37. #ifdef DEBUG
  38. #define DBG(fmt, args...) printk("%s: " fmt, __FUNCTION__, ## args)
  39. #else
  40. #define DBG(fmt, args...)
  41. #endif
  42. static const char *pdc_quirk_drives[] = {
  43. "QUANTUM FIREBALLlct08 08",
  44. "QUANTUM FIREBALLP KA6.4",
  45. "QUANTUM FIREBALLP KA9.1",
  46. "QUANTUM FIREBALLP LM20.4",
  47. "QUANTUM FIREBALLP KX13.6",
  48. "QUANTUM FIREBALLP KX20.5",
  49. "QUANTUM FIREBALLP KX27.3",
  50. "QUANTUM FIREBALLP LM20.5",
  51. NULL
  52. };
  53. static u8 max_dma_rate(struct pci_dev *pdev)
  54. {
  55. u8 mode;
  56. switch(pdev->device) {
  57. case PCI_DEVICE_ID_PROMISE_20277:
  58. case PCI_DEVICE_ID_PROMISE_20276:
  59. case PCI_DEVICE_ID_PROMISE_20275:
  60. case PCI_DEVICE_ID_PROMISE_20271:
  61. case PCI_DEVICE_ID_PROMISE_20269:
  62. mode = 4;
  63. break;
  64. case PCI_DEVICE_ID_PROMISE_20270:
  65. case PCI_DEVICE_ID_PROMISE_20268:
  66. mode = 3;
  67. break;
  68. default:
  69. return 0;
  70. }
  71. return mode;
  72. }
  73. /**
  74. * get_indexed_reg - Get indexed register
  75. * @hwif: for the port address
  76. * @index: index of the indexed register
  77. */
  78. static u8 get_indexed_reg(ide_hwif_t *hwif, u8 index)
  79. {
  80. u8 value;
  81. outb(index, hwif->dma_vendor1);
  82. value = inb(hwif->dma_vendor3);
  83. DBG("index[%02X] value[%02X]\n", index, value);
  84. return value;
  85. }
  86. /**
  87. * set_indexed_reg - Set indexed register
  88. * @hwif: for the port address
  89. * @index: index of the indexed register
  90. */
  91. static void set_indexed_reg(ide_hwif_t *hwif, u8 index, u8 value)
  92. {
  93. outb(index, hwif->dma_vendor1);
  94. outb(value, hwif->dma_vendor3);
  95. DBG("index[%02X] value[%02X]\n", index, value);
  96. }
  97. /*
  98. * ATA Timing Tables based on 133 MHz PLL output clock.
  99. *
  100. * If the PLL outputs 100 MHz clock, the ASIC hardware will set
  101. * the timing registers automatically when "set features" command is
  102. * issued to the device. However, if the PLL output clock is 133 MHz,
  103. * the following tables must be used.
  104. */
  105. static struct pio_timing {
  106. u8 reg0c, reg0d, reg13;
  107. } pio_timings [] = {
  108. { 0xfb, 0x2b, 0xac }, /* PIO mode 0, IORDY off, Prefetch off */
  109. { 0x46, 0x29, 0xa4 }, /* PIO mode 1, IORDY off, Prefetch off */
  110. { 0x23, 0x26, 0x64 }, /* PIO mode 2, IORDY off, Prefetch off */
  111. { 0x27, 0x0d, 0x35 }, /* PIO mode 3, IORDY on, Prefetch off */
  112. { 0x23, 0x09, 0x25 }, /* PIO mode 4, IORDY on, Prefetch off */
  113. };
  114. static struct mwdma_timing {
  115. u8 reg0e, reg0f;
  116. } mwdma_timings [] = {
  117. { 0xdf, 0x5f }, /* MWDMA mode 0 */
  118. { 0x6b, 0x27 }, /* MWDMA mode 1 */
  119. { 0x69, 0x25 }, /* MWDMA mode 2 */
  120. };
  121. static struct udma_timing {
  122. u8 reg10, reg11, reg12;
  123. } udma_timings [] = {
  124. { 0x4a, 0x0f, 0xd5 }, /* UDMA mode 0 */
  125. { 0x3a, 0x0a, 0xd0 }, /* UDMA mode 1 */
  126. { 0x2a, 0x07, 0xcd }, /* UDMA mode 2 */
  127. { 0x1a, 0x05, 0xcd }, /* UDMA mode 3 */
  128. { 0x1a, 0x03, 0xcd }, /* UDMA mode 4 */
  129. { 0x1a, 0x02, 0xcb }, /* UDMA mode 5 */
  130. { 0x1a, 0x01, 0xcb }, /* UDMA mode 6 */
  131. };
  132. static int pdcnew_tune_chipset(ide_drive_t *drive, u8 speed)
  133. {
  134. ide_hwif_t *hwif = HWIF(drive);
  135. u8 adj = (drive->dn & 1) ? 0x08 : 0x00;
  136. int err;
  137. speed = ide_rate_filter(drive, speed);
  138. /*
  139. * Issue SETFEATURES_XFER to the drive first. PDC202xx hardware will
  140. * automatically set the timing registers based on 100 MHz PLL output.
  141. */
  142. err = ide_config_drive_speed(drive, speed);
  143. /*
  144. * As we set up the PLL to output 133 MHz for UltraDMA/133 capable
  145. * chips, we must override the default register settings...
  146. */
  147. if (max_dma_rate(hwif->pci_dev) == 4) {
  148. u8 mode = speed & 0x07;
  149. switch (speed) {
  150. case XFER_UDMA_6:
  151. case XFER_UDMA_5:
  152. case XFER_UDMA_4:
  153. case XFER_UDMA_3:
  154. case XFER_UDMA_2:
  155. case XFER_UDMA_1:
  156. case XFER_UDMA_0:
  157. set_indexed_reg(hwif, 0x10 + adj,
  158. udma_timings[mode].reg10);
  159. set_indexed_reg(hwif, 0x11 + adj,
  160. udma_timings[mode].reg11);
  161. set_indexed_reg(hwif, 0x12 + adj,
  162. udma_timings[mode].reg12);
  163. break;
  164. case XFER_MW_DMA_2:
  165. case XFER_MW_DMA_1:
  166. case XFER_MW_DMA_0:
  167. set_indexed_reg(hwif, 0x0e + adj,
  168. mwdma_timings[mode].reg0e);
  169. set_indexed_reg(hwif, 0x0f + adj,
  170. mwdma_timings[mode].reg0f);
  171. break;
  172. case XFER_PIO_4:
  173. case XFER_PIO_3:
  174. case XFER_PIO_2:
  175. case XFER_PIO_1:
  176. case XFER_PIO_0:
  177. set_indexed_reg(hwif, 0x0c + adj,
  178. pio_timings[mode].reg0c);
  179. set_indexed_reg(hwif, 0x0d + adj,
  180. pio_timings[mode].reg0d);
  181. set_indexed_reg(hwif, 0x13 + adj,
  182. pio_timings[mode].reg13);
  183. break;
  184. default:
  185. printk(KERN_ERR "pdc202xx_new: "
  186. "Unknown speed %d ignored\n", speed);
  187. }
  188. } else if (speed == XFER_UDMA_2) {
  189. /* Set tHOLD bit to 0 if using UDMA mode 2 */
  190. u8 tmp = get_indexed_reg(hwif, 0x10 + adj);
  191. set_indexed_reg(hwif, 0x10 + adj, tmp & 0x7f);
  192. }
  193. return err;
  194. }
  195. static void pdcnew_tune_drive(ide_drive_t *drive, u8 pio)
  196. {
  197. pio = ide_get_best_pio_mode(drive, pio, 4, NULL);
  198. (void)pdcnew_tune_chipset(drive, XFER_PIO_0 + pio);
  199. }
  200. static u8 pdcnew_cable_detect(ide_hwif_t *hwif)
  201. {
  202. return get_indexed_reg(hwif, 0x0b) & 0x04;
  203. }
  204. static int pdcnew_config_drive_xfer_rate(ide_drive_t *drive)
  205. {
  206. drive->init_speed = 0;
  207. if (ide_tune_dma(drive))
  208. return 0;
  209. if (ide_use_fast_pio(drive))
  210. pdcnew_tune_drive(drive, 255);
  211. return -1;
  212. }
  213. static int pdcnew_quirkproc(ide_drive_t *drive)
  214. {
  215. const char **list, *model = drive->id->model;
  216. for (list = pdc_quirk_drives; *list != NULL; list++)
  217. if (strstr(model, *list) != NULL)
  218. return 2;
  219. return 0;
  220. }
  221. static void pdcnew_reset(ide_drive_t *drive)
  222. {
  223. /*
  224. * Deleted this because it is redundant from the caller.
  225. */
  226. printk(KERN_WARNING "pdc202xx_new: %s channel reset.\n",
  227. HWIF(drive)->channel ? "Secondary" : "Primary");
  228. }
  229. /**
  230. * read_counter - Read the byte count registers
  231. * @dma_base: for the port address
  232. */
  233. static long __devinit read_counter(u32 dma_base)
  234. {
  235. u32 pri_dma_base = dma_base, sec_dma_base = dma_base + 0x08;
  236. u8 cnt0, cnt1, cnt2, cnt3;
  237. long count = 0, last;
  238. int retry = 3;
  239. do {
  240. last = count;
  241. /* Read the current count */
  242. outb(0x20, pri_dma_base + 0x01);
  243. cnt0 = inb(pri_dma_base + 0x03);
  244. outb(0x21, pri_dma_base + 0x01);
  245. cnt1 = inb(pri_dma_base + 0x03);
  246. outb(0x20, sec_dma_base + 0x01);
  247. cnt2 = inb(sec_dma_base + 0x03);
  248. outb(0x21, sec_dma_base + 0x01);
  249. cnt3 = inb(sec_dma_base + 0x03);
  250. count = (cnt3 << 23) | (cnt2 << 15) | (cnt1 << 8) | cnt0;
  251. /*
  252. * The 30-bit decrementing counter is read in 4 pieces.
  253. * Incorrect value may be read when the most significant bytes
  254. * are changing...
  255. */
  256. } while (retry-- && (((last ^ count) & 0x3fff8000) || last < count));
  257. DBG("cnt0[%02X] cnt1[%02X] cnt2[%02X] cnt3[%02X]\n",
  258. cnt0, cnt1, cnt2, cnt3);
  259. return count;
  260. }
  261. /**
  262. * detect_pll_input_clock - Detect the PLL input clock in Hz.
  263. * @dma_base: for the port address
  264. * E.g. 16949000 on 33 MHz PCI bus, i.e. half of the PCI clock.
  265. */
  266. static long __devinit detect_pll_input_clock(unsigned long dma_base)
  267. {
  268. long start_count, end_count;
  269. long pll_input;
  270. u8 scr1;
  271. start_count = read_counter(dma_base);
  272. /* Start the test mode */
  273. outb(0x01, dma_base + 0x01);
  274. scr1 = inb(dma_base + 0x03);
  275. DBG("scr1[%02X]\n", scr1);
  276. outb(scr1 | 0x40, dma_base + 0x03);
  277. /* Let the counter run for 10 ms. */
  278. mdelay(10);
  279. end_count = read_counter(dma_base);
  280. /* Stop the test mode */
  281. outb(0x01, dma_base + 0x01);
  282. scr1 = inb(dma_base + 0x03);
  283. DBG("scr1[%02X]\n", scr1);
  284. outb(scr1 & ~0x40, dma_base + 0x03);
  285. /*
  286. * Calculate the input clock in Hz
  287. * (the clock counter is 30 bit wide and counts down)
  288. */
  289. pll_input = ((start_count - end_count) & 0x3ffffff) * 100;
  290. DBG("start[%ld] end[%ld]\n", start_count, end_count);
  291. return pll_input;
  292. }
  293. #ifdef CONFIG_PPC_PMAC
  294. static void __devinit apple_kiwi_init(struct pci_dev *pdev)
  295. {
  296. struct device_node *np = pci_device_to_OF_node(pdev);
  297. unsigned int class_rev = 0;
  298. u8 conf;
  299. if (np == NULL || !of_device_is_compatible(np, "kiwi-root"))
  300. return;
  301. pci_read_config_dword(pdev, PCI_CLASS_REVISION, &class_rev);
  302. class_rev &= 0xff;
  303. if (class_rev >= 0x03) {
  304. /* Setup chip magic config stuff (from darwin) */
  305. pci_read_config_byte (pdev, 0x40, &conf);
  306. pci_write_config_byte(pdev, 0x40, (conf | 0x01));
  307. }
  308. }
  309. #endif /* CONFIG_PPC_PMAC */
  310. static unsigned int __devinit init_chipset_pdcnew(struct pci_dev *dev, const char *name)
  311. {
  312. unsigned long dma_base = pci_resource_start(dev, 4);
  313. unsigned long sec_dma_base = dma_base + 0x08;
  314. long pll_input, pll_output, ratio;
  315. int f, r;
  316. u8 pll_ctl0, pll_ctl1;
  317. if (dev->resource[PCI_ROM_RESOURCE].start) {
  318. pci_write_config_dword(dev, PCI_ROM_ADDRESS,
  319. dev->resource[PCI_ROM_RESOURCE].start | PCI_ROM_ADDRESS_ENABLE);
  320. printk(KERN_INFO "%s: ROM enabled at 0x%08lx\n", name,
  321. (unsigned long)dev->resource[PCI_ROM_RESOURCE].start);
  322. }
  323. #ifdef CONFIG_PPC_PMAC
  324. apple_kiwi_init(dev);
  325. #endif
  326. /* Calculate the required PLL output frequency */
  327. switch(max_dma_rate(dev)) {
  328. case 4: /* it's 133 MHz for Ultra133 chips */
  329. pll_output = 133333333;
  330. break;
  331. case 3: /* and 100 MHz for Ultra100 chips */
  332. default:
  333. pll_output = 100000000;
  334. break;
  335. }
  336. /*
  337. * Detect PLL input clock.
  338. * On some systems, where PCI bus is running at non-standard clock rate
  339. * (e.g. 25 or 40 MHz), we have to adjust the cycle time.
  340. * PDC20268 and newer chips employ PLL circuit to help correct timing
  341. * registers setting.
  342. */
  343. pll_input = detect_pll_input_clock(dma_base);
  344. printk("%s: PLL input clock is %ld kHz\n", name, pll_input / 1000);
  345. /* Sanity check */
  346. if (unlikely(pll_input < 5000000L || pll_input > 70000000L)) {
  347. printk(KERN_ERR "%s: Bad PLL input clock %ld Hz, giving up!\n",
  348. name, pll_input);
  349. goto out;
  350. }
  351. #ifdef DEBUG
  352. DBG("pll_output is %ld Hz\n", pll_output);
  353. /* Show the current clock value of PLL control register
  354. * (maybe already configured by the BIOS)
  355. */
  356. outb(0x02, sec_dma_base + 0x01);
  357. pll_ctl0 = inb(sec_dma_base + 0x03);
  358. outb(0x03, sec_dma_base + 0x01);
  359. pll_ctl1 = inb(sec_dma_base + 0x03);
  360. DBG("pll_ctl[%02X][%02X]\n", pll_ctl0, pll_ctl1);
  361. #endif
  362. /*
  363. * Calculate the ratio of F, R and NO
  364. * POUT = (F + 2) / (( R + 2) * NO)
  365. */
  366. ratio = pll_output / (pll_input / 1000);
  367. if (ratio < 8600L) { /* 8.6x */
  368. /* Using NO = 0x01, R = 0x0d */
  369. r = 0x0d;
  370. } else if (ratio < 12900L) { /* 12.9x */
  371. /* Using NO = 0x01, R = 0x08 */
  372. r = 0x08;
  373. } else if (ratio < 16100L) { /* 16.1x */
  374. /* Using NO = 0x01, R = 0x06 */
  375. r = 0x06;
  376. } else if (ratio < 64000L) { /* 64x */
  377. r = 0x00;
  378. } else {
  379. /* Invalid ratio */
  380. printk(KERN_ERR "%s: Bad ratio %ld, giving up!\n", name, ratio);
  381. goto out;
  382. }
  383. f = (ratio * (r + 2)) / 1000 - 2;
  384. DBG("F[%d] R[%d] ratio*1000[%ld]\n", f, r, ratio);
  385. if (unlikely(f < 0 || f > 127)) {
  386. /* Invalid F */
  387. printk(KERN_ERR "%s: F[%d] invalid!\n", name, f);
  388. goto out;
  389. }
  390. pll_ctl0 = (u8) f;
  391. pll_ctl1 = (u8) r;
  392. DBG("Writing pll_ctl[%02X][%02X]\n", pll_ctl0, pll_ctl1);
  393. outb(0x02, sec_dma_base + 0x01);
  394. outb(pll_ctl0, sec_dma_base + 0x03);
  395. outb(0x03, sec_dma_base + 0x01);
  396. outb(pll_ctl1, sec_dma_base + 0x03);
  397. /* Wait the PLL circuit to be stable */
  398. mdelay(30);
  399. #ifdef DEBUG
  400. /*
  401. * Show the current clock value of PLL control register
  402. */
  403. outb(0x02, sec_dma_base + 0x01);
  404. pll_ctl0 = inb(sec_dma_base + 0x03);
  405. outb(0x03, sec_dma_base + 0x01);
  406. pll_ctl1 = inb(sec_dma_base + 0x03);
  407. DBG("pll_ctl[%02X][%02X]\n", pll_ctl0, pll_ctl1);
  408. #endif
  409. out:
  410. return dev->irq;
  411. }
  412. static void __devinit init_hwif_pdc202new(ide_hwif_t *hwif)
  413. {
  414. hwif->autodma = 0;
  415. hwif->tuneproc = &pdcnew_tune_drive;
  416. hwif->quirkproc = &pdcnew_quirkproc;
  417. hwif->speedproc = &pdcnew_tune_chipset;
  418. hwif->resetproc = &pdcnew_reset;
  419. hwif->drives[0].autotune = hwif->drives[1].autotune = 1;
  420. hwif->atapi_dma = 1;
  421. hwif->ultra_mask = hwif->cds->udma_mask;
  422. hwif->mwdma_mask = 0x07;
  423. hwif->err_stops_fifo = 1;
  424. hwif->ide_dma_check = &pdcnew_config_drive_xfer_rate;
  425. if (!hwif->udma_four)
  426. hwif->udma_four = pdcnew_cable_detect(hwif) ? 0 : 1;
  427. if (!noautodma)
  428. hwif->autodma = 1;
  429. hwif->drives[0].autodma = hwif->drives[1].autodma = hwif->autodma;
  430. }
  431. static int __devinit init_setup_pdcnew(struct pci_dev *dev, ide_pci_device_t *d)
  432. {
  433. return ide_setup_pci_device(dev, d);
  434. }
  435. static int __devinit init_setup_pdc20270(struct pci_dev *dev,
  436. ide_pci_device_t *d)
  437. {
  438. struct pci_dev *findev = NULL;
  439. int ret;
  440. if ((dev->bus->self &&
  441. dev->bus->self->vendor == PCI_VENDOR_ID_DEC) &&
  442. (dev->bus->self->device == PCI_DEVICE_ID_DEC_21150)) {
  443. if (PCI_SLOT(dev->devfn) & 2)
  444. return -ENODEV;
  445. d->extra = 0;
  446. while ((findev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, findev)) != NULL) {
  447. if ((findev->vendor == dev->vendor) &&
  448. (findev->device == dev->device) &&
  449. (PCI_SLOT(findev->devfn) & 2)) {
  450. if (findev->irq != dev->irq) {
  451. findev->irq = dev->irq;
  452. }
  453. ret = ide_setup_pci_devices(dev, findev, d);
  454. pci_dev_put(findev);
  455. return ret;
  456. }
  457. }
  458. }
  459. return ide_setup_pci_device(dev, d);
  460. }
  461. static int __devinit init_setup_pdc20276(struct pci_dev *dev,
  462. ide_pci_device_t *d)
  463. {
  464. if ((dev->bus->self) &&
  465. (dev->bus->self->vendor == PCI_VENDOR_ID_INTEL) &&
  466. ((dev->bus->self->device == PCI_DEVICE_ID_INTEL_I960) ||
  467. (dev->bus->self->device == PCI_DEVICE_ID_INTEL_I960RM))) {
  468. printk(KERN_INFO "ide: Skipping Promise PDC20276 "
  469. "attached to I2O RAID controller.\n");
  470. return -ENODEV;
  471. }
  472. return ide_setup_pci_device(dev, d);
  473. }
  474. static ide_pci_device_t pdcnew_chipsets[] __devinitdata = {
  475. { /* 0 */
  476. .name = "PDC20268",
  477. .init_setup = init_setup_pdcnew,
  478. .init_chipset = init_chipset_pdcnew,
  479. .init_hwif = init_hwif_pdc202new,
  480. .channels = 2,
  481. .autodma = AUTODMA,
  482. .bootable = OFF_BOARD,
  483. .udma_mask = 0x3f, /* udma0-5 */
  484. },{ /* 1 */
  485. .name = "PDC20269",
  486. .init_setup = init_setup_pdcnew,
  487. .init_chipset = init_chipset_pdcnew,
  488. .init_hwif = init_hwif_pdc202new,
  489. .channels = 2,
  490. .autodma = AUTODMA,
  491. .bootable = OFF_BOARD,
  492. .udma_mask = 0x7f, /* udma0-6*/
  493. },{ /* 2 */
  494. .name = "PDC20270",
  495. .init_setup = init_setup_pdc20270,
  496. .init_chipset = init_chipset_pdcnew,
  497. .init_hwif = init_hwif_pdc202new,
  498. .channels = 2,
  499. .autodma = AUTODMA,
  500. .bootable = OFF_BOARD,
  501. .udma_mask = 0x3f, /* udma0-5 */
  502. },{ /* 3 */
  503. .name = "PDC20271",
  504. .init_setup = init_setup_pdcnew,
  505. .init_chipset = init_chipset_pdcnew,
  506. .init_hwif = init_hwif_pdc202new,
  507. .channels = 2,
  508. .autodma = AUTODMA,
  509. .bootable = OFF_BOARD,
  510. .udma_mask = 0x7f, /* udma0-6*/
  511. },{ /* 4 */
  512. .name = "PDC20275",
  513. .init_setup = init_setup_pdcnew,
  514. .init_chipset = init_chipset_pdcnew,
  515. .init_hwif = init_hwif_pdc202new,
  516. .channels = 2,
  517. .autodma = AUTODMA,
  518. .bootable = OFF_BOARD,
  519. .udma_mask = 0x7f, /* udma0-6*/
  520. },{ /* 5 */
  521. .name = "PDC20276",
  522. .init_setup = init_setup_pdc20276,
  523. .init_chipset = init_chipset_pdcnew,
  524. .init_hwif = init_hwif_pdc202new,
  525. .channels = 2,
  526. .autodma = AUTODMA,
  527. .bootable = OFF_BOARD,
  528. .udma_mask = 0x7f, /* udma0-6*/
  529. },{ /* 6 */
  530. .name = "PDC20277",
  531. .init_setup = init_setup_pdcnew,
  532. .init_chipset = init_chipset_pdcnew,
  533. .init_hwif = init_hwif_pdc202new,
  534. .channels = 2,
  535. .autodma = AUTODMA,
  536. .bootable = OFF_BOARD,
  537. .udma_mask = 0x7f, /* udma0-6*/
  538. }
  539. };
  540. /**
  541. * pdc202new_init_one - called when a pdc202xx is found
  542. * @dev: the pdc202new device
  543. * @id: the matching pci id
  544. *
  545. * Called when the PCI registration layer (or the IDE initialization)
  546. * finds a device matching our IDE device tables.
  547. */
  548. static int __devinit pdc202new_init_one(struct pci_dev *dev, const struct pci_device_id *id)
  549. {
  550. ide_pci_device_t *d = &pdcnew_chipsets[id->driver_data];
  551. return d->init_setup(dev, d);
  552. }
  553. static struct pci_device_id pdc202new_pci_tbl[] = {
  554. { PCI_VENDOR_ID_PROMISE, PCI_DEVICE_ID_PROMISE_20268, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
  555. { PCI_VENDOR_ID_PROMISE, PCI_DEVICE_ID_PROMISE_20269, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 1},
  556. { PCI_VENDOR_ID_PROMISE, PCI_DEVICE_ID_PROMISE_20270, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 2},
  557. { PCI_VENDOR_ID_PROMISE, PCI_DEVICE_ID_PROMISE_20271, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 3},
  558. { PCI_VENDOR_ID_PROMISE, PCI_DEVICE_ID_PROMISE_20275, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 4},
  559. { PCI_VENDOR_ID_PROMISE, PCI_DEVICE_ID_PROMISE_20276, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 5},
  560. { PCI_VENDOR_ID_PROMISE, PCI_DEVICE_ID_PROMISE_20277, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 6},
  561. { 0, },
  562. };
  563. MODULE_DEVICE_TABLE(pci, pdc202new_pci_tbl);
  564. static struct pci_driver driver = {
  565. .name = "Promise_IDE",
  566. .id_table = pdc202new_pci_tbl,
  567. .probe = pdc202new_init_one,
  568. };
  569. static int __init pdc202new_ide_init(void)
  570. {
  571. return ide_pci_register_driver(&driver);
  572. }
  573. module_init(pdc202new_ide_init);
  574. MODULE_AUTHOR("Andre Hedrick, Frank Tiernan");
  575. MODULE_DESCRIPTION("PCI driver module for Promise PDC20268 and higher");
  576. MODULE_LICENSE("GPL");