diff options
author | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-10-12 19:16:41 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-10-12 19:16:41 -0400 |
commit | ab9c232286c2b77be78441c2d8396500b045777e (patch) | |
tree | 17570e159e4fb1ba36f1c363a7abef9b55909275 /drivers/ata/pata_pdc2027x.c | |
parent | 8bd0983e05757e5c1f7a3342cd09badae93c167d (diff) | |
parent | 2855568b1ee4f58ef2c0a13ddfceb4b0b216b7ed (diff) |
Merge branch 'upstream' of git://git.kernel.org/pub/scm/linux/kernel/git/jgarzik/libata-dev
* 'upstream' of git://git.kernel.org/pub/scm/linux/kernel/git/jgarzik/libata-dev: (119 commits)
[libata] struct pci_dev related cleanups
libata: use ata_exec_internal() for PMP register access
libata: implement ATA_PFLAG_RESETTING
libata: add @timeout to ata_exec_internal[_sg]()
ahci: fix notification handling
ahci: clean up PORT_IRQ_BAD_PMP enabling
ahci: kill leftover from enabling NCQ over PMP
libata: wrap schedule_timeout_uninterruptible() in loop
libata: skip suppress reporting if ATA_EHI_QUIET
libata: clear ehi description after initial host report
pata_jmicron: match vendor and class code only
libata: add ST9160821AS / 3.ALD to NCQ blacklist
pata_acpi: ACPI driver support
libata-core: Expose gtm methods for driver use
libata: add HDT722516DLA380 to NCQ blacklist
libata: blacklist NCQ on Seagate Barracuda ST380817AS
[libata] Turn on ACPI by default
libata_scsi: Fix ATAPI transfer lengths
libata: correct handling of SRST reset sequences
libata: Integrate ACPI-based PATA/SATA hotplug - version 5
...
Diffstat (limited to 'drivers/ata/pata_pdc2027x.c')
-rw-r--r-- | drivers/ata/pata_pdc2027x.c | 114 |
1 files changed, 56 insertions, 58 deletions
diff --git a/drivers/ata/pata_pdc2027x.c b/drivers/ata/pata_pdc2027x.c index bb64a986e8f5..3d3f1558cdee 100644 --- a/drivers/ata/pata_pdc2027x.c +++ b/drivers/ata/pata_pdc2027x.c | |||
@@ -69,7 +69,7 @@ static void pdc2027x_set_dmamode(struct ata_port *ap, struct ata_device *adev); | |||
69 | static int pdc2027x_check_atapi_dma(struct ata_queued_cmd *qc); | 69 | static int pdc2027x_check_atapi_dma(struct ata_queued_cmd *qc); |
70 | static unsigned long pdc2027x_mode_filter(struct ata_device *adev, unsigned long mask); | 70 | static unsigned long pdc2027x_mode_filter(struct ata_device *adev, unsigned long mask); |
71 | static int pdc2027x_cable_detect(struct ata_port *ap); | 71 | static int pdc2027x_cable_detect(struct ata_port *ap); |
72 | static int pdc2027x_set_mode(struct ata_port *ap, struct ata_device **r_failed); | 72 | static int pdc2027x_set_mode(struct ata_link *link, struct ata_device **r_failed); |
73 | 73 | ||
74 | /* | 74 | /* |
75 | * ATA Timing Tables based on 133MHz controller clock. | 75 | * ATA Timing Tables based on 133MHz controller clock. |
@@ -147,7 +147,6 @@ static struct scsi_host_template pdc2027x_sht = { | |||
147 | }; | 147 | }; |
148 | 148 | ||
149 | static struct ata_port_operations pdc2027x_pata100_ops = { | 149 | static struct ata_port_operations pdc2027x_pata100_ops = { |
150 | .port_disable = ata_port_disable, | ||
151 | .mode_filter = ata_pci_default_filter, | 150 | .mode_filter = ata_pci_default_filter, |
152 | 151 | ||
153 | .tf_load = ata_tf_load, | 152 | .tf_load = ata_tf_load, |
@@ -173,13 +172,11 @@ static struct ata_port_operations pdc2027x_pata100_ops = { | |||
173 | 172 | ||
174 | .irq_clear = ata_bmdma_irq_clear, | 173 | .irq_clear = ata_bmdma_irq_clear, |
175 | .irq_on = ata_irq_on, | 174 | .irq_on = ata_irq_on, |
176 | .irq_ack = ata_irq_ack, | ||
177 | 175 | ||
178 | .port_start = ata_port_start, | 176 | .port_start = ata_sff_port_start, |
179 | }; | 177 | }; |
180 | 178 | ||
181 | static struct ata_port_operations pdc2027x_pata133_ops = { | 179 | static struct ata_port_operations pdc2027x_pata133_ops = { |
182 | .port_disable = ata_port_disable, | ||
183 | .set_piomode = pdc2027x_set_piomode, | 180 | .set_piomode = pdc2027x_set_piomode, |
184 | .set_dmamode = pdc2027x_set_dmamode, | 181 | .set_dmamode = pdc2027x_set_dmamode, |
185 | .set_mode = pdc2027x_set_mode, | 182 | .set_mode = pdc2027x_set_mode, |
@@ -208,9 +205,8 @@ static struct ata_port_operations pdc2027x_pata133_ops = { | |||
208 | 205 | ||
209 | .irq_clear = ata_bmdma_irq_clear, | 206 | .irq_clear = ata_bmdma_irq_clear, |
210 | .irq_on = ata_irq_on, | 207 | .irq_on = ata_irq_on, |
211 | .irq_ack = ata_irq_ack, | ||
212 | 208 | ||
213 | .port_start = ata_port_start, | 209 | .port_start = ata_sff_port_start, |
214 | }; | 210 | }; |
215 | 211 | ||
216 | static struct ata_port_info pdc2027x_port_info[] = { | 212 | static struct ata_port_info pdc2027x_port_info[] = { |
@@ -277,7 +273,7 @@ static int pdc2027x_cable_detect(struct ata_port *ap) | |||
277 | u32 cgcr; | 273 | u32 cgcr; |
278 | 274 | ||
279 | /* check cable detect results */ | 275 | /* check cable detect results */ |
280 | cgcr = readl(port_mmio(ap, PDC_GLOBAL_CTL)); | 276 | cgcr = ioread32(port_mmio(ap, PDC_GLOBAL_CTL)); |
281 | if (cgcr & (1 << 26)) | 277 | if (cgcr & (1 << 26)) |
282 | goto cbl40; | 278 | goto cbl40; |
283 | 279 | ||
@@ -295,12 +291,12 @@ cbl40: | |||
295 | */ | 291 | */ |
296 | static inline int pdc2027x_port_enabled(struct ata_port *ap) | 292 | static inline int pdc2027x_port_enabled(struct ata_port *ap) |
297 | { | 293 | { |
298 | return readb(port_mmio(ap, PDC_ATA_CTL)) & 0x02; | 294 | return ioread8(port_mmio(ap, PDC_ATA_CTL)) & 0x02; |
299 | } | 295 | } |
300 | 296 | ||
301 | /** | 297 | /** |
302 | * pdc2027x_prereset - prereset for PATA host controller | 298 | * pdc2027x_prereset - prereset for PATA host controller |
303 | * @ap: Target port | 299 | * @link: Target link |
304 | * @deadline: deadline jiffies for the operation | 300 | * @deadline: deadline jiffies for the operation |
305 | * | 301 | * |
306 | * Probeinit including cable detection. | 302 | * Probeinit including cable detection. |
@@ -309,12 +305,12 @@ static inline int pdc2027x_port_enabled(struct ata_port *ap) | |||
309 | * None (inherited from caller). | 305 | * None (inherited from caller). |
310 | */ | 306 | */ |
311 | 307 | ||
312 | static int pdc2027x_prereset(struct ata_port *ap, unsigned long deadline) | 308 | static int pdc2027x_prereset(struct ata_link *link, unsigned long deadline) |
313 | { | 309 | { |
314 | /* Check whether port enabled */ | 310 | /* Check whether port enabled */ |
315 | if (!pdc2027x_port_enabled(ap)) | 311 | if (!pdc2027x_port_enabled(link->ap)) |
316 | return -ENOENT; | 312 | return -ENOENT; |
317 | return ata_std_prereset(ap, deadline); | 313 | return ata_std_prereset(link, deadline); |
318 | } | 314 | } |
319 | 315 | ||
320 | /** | 316 | /** |
@@ -387,16 +383,16 @@ static void pdc2027x_set_piomode(struct ata_port *ap, struct ata_device *adev) | |||
387 | /* Set the PIO timing registers using value table for 133MHz */ | 383 | /* Set the PIO timing registers using value table for 133MHz */ |
388 | PDPRINTK("Set pio regs... \n"); | 384 | PDPRINTK("Set pio regs... \n"); |
389 | 385 | ||
390 | ctcr0 = readl(dev_mmio(ap, adev, PDC_CTCR0)); | 386 | ctcr0 = ioread32(dev_mmio(ap, adev, PDC_CTCR0)); |
391 | ctcr0 &= 0xffff0000; | 387 | ctcr0 &= 0xffff0000; |
392 | ctcr0 |= pdc2027x_pio_timing_tbl[pio].value0 | | 388 | ctcr0 |= pdc2027x_pio_timing_tbl[pio].value0 | |
393 | (pdc2027x_pio_timing_tbl[pio].value1 << 8); | 389 | (pdc2027x_pio_timing_tbl[pio].value1 << 8); |
394 | writel(ctcr0, dev_mmio(ap, adev, PDC_CTCR0)); | 390 | iowrite32(ctcr0, dev_mmio(ap, adev, PDC_CTCR0)); |
395 | 391 | ||
396 | ctcr1 = readl(dev_mmio(ap, adev, PDC_CTCR1)); | 392 | ctcr1 = ioread32(dev_mmio(ap, adev, PDC_CTCR1)); |
397 | ctcr1 &= 0x00ffffff; | 393 | ctcr1 &= 0x00ffffff; |
398 | ctcr1 |= (pdc2027x_pio_timing_tbl[pio].value2 << 24); | 394 | ctcr1 |= (pdc2027x_pio_timing_tbl[pio].value2 << 24); |
399 | writel(ctcr1, dev_mmio(ap, adev, PDC_CTCR1)); | 395 | iowrite32(ctcr1, dev_mmio(ap, adev, PDC_CTCR1)); |
400 | 396 | ||
401 | PDPRINTK("Set pio regs done\n"); | 397 | PDPRINTK("Set pio regs done\n"); |
402 | 398 | ||
@@ -430,18 +426,18 @@ static void pdc2027x_set_dmamode(struct ata_port *ap, struct ata_device *adev) | |||
430 | * If tHOLD is '1', the hardware will add half clock for data hold time. | 426 | * If tHOLD is '1', the hardware will add half clock for data hold time. |
431 | * This code segment seems to be no effect. tHOLD will be overwritten below. | 427 | * This code segment seems to be no effect. tHOLD will be overwritten below. |
432 | */ | 428 | */ |
433 | ctcr1 = readl(dev_mmio(ap, adev, PDC_CTCR1)); | 429 | ctcr1 = ioread32(dev_mmio(ap, adev, PDC_CTCR1)); |
434 | writel(ctcr1 & ~(1 << 7), dev_mmio(ap, adev, PDC_CTCR1)); | 430 | iowrite32(ctcr1 & ~(1 << 7), dev_mmio(ap, adev, PDC_CTCR1)); |
435 | } | 431 | } |
436 | 432 | ||
437 | PDPRINTK("Set udma regs... \n"); | 433 | PDPRINTK("Set udma regs... \n"); |
438 | 434 | ||
439 | ctcr1 = readl(dev_mmio(ap, adev, PDC_CTCR1)); | 435 | ctcr1 = ioread32(dev_mmio(ap, adev, PDC_CTCR1)); |
440 | ctcr1 &= 0xff000000; | 436 | ctcr1 &= 0xff000000; |
441 | ctcr1 |= pdc2027x_udma_timing_tbl[udma_mode].value0 | | 437 | ctcr1 |= pdc2027x_udma_timing_tbl[udma_mode].value0 | |
442 | (pdc2027x_udma_timing_tbl[udma_mode].value1 << 8) | | 438 | (pdc2027x_udma_timing_tbl[udma_mode].value1 << 8) | |
443 | (pdc2027x_udma_timing_tbl[udma_mode].value2 << 16); | 439 | (pdc2027x_udma_timing_tbl[udma_mode].value2 << 16); |
444 | writel(ctcr1, dev_mmio(ap, adev, PDC_CTCR1)); | 440 | iowrite32(ctcr1, dev_mmio(ap, adev, PDC_CTCR1)); |
445 | 441 | ||
446 | PDPRINTK("Set udma regs done\n"); | 442 | PDPRINTK("Set udma regs done\n"); |
447 | 443 | ||
@@ -453,13 +449,13 @@ static void pdc2027x_set_dmamode(struct ata_port *ap, struct ata_device *adev) | |||
453 | unsigned int mdma_mode = dma_mode & 0x07; | 449 | unsigned int mdma_mode = dma_mode & 0x07; |
454 | 450 | ||
455 | PDPRINTK("Set mdma regs... \n"); | 451 | PDPRINTK("Set mdma regs... \n"); |
456 | ctcr0 = readl(dev_mmio(ap, adev, PDC_CTCR0)); | 452 | ctcr0 = ioread32(dev_mmio(ap, adev, PDC_CTCR0)); |
457 | 453 | ||
458 | ctcr0 &= 0x0000ffff; | 454 | ctcr0 &= 0x0000ffff; |
459 | ctcr0 |= (pdc2027x_mdma_timing_tbl[mdma_mode].value0 << 16) | | 455 | ctcr0 |= (pdc2027x_mdma_timing_tbl[mdma_mode].value0 << 16) | |
460 | (pdc2027x_mdma_timing_tbl[mdma_mode].value1 << 24); | 456 | (pdc2027x_mdma_timing_tbl[mdma_mode].value1 << 24); |
461 | 457 | ||
462 | writel(ctcr0, dev_mmio(ap, adev, PDC_CTCR0)); | 458 | iowrite32(ctcr0, dev_mmio(ap, adev, PDC_CTCR0)); |
463 | PDPRINTK("Set mdma regs done\n"); | 459 | PDPRINTK("Set mdma regs done\n"); |
464 | 460 | ||
465 | PDPRINTK("Set to mdma mode[%u] \n", mdma_mode); | 461 | PDPRINTK("Set to mdma mode[%u] \n", mdma_mode); |
@@ -470,24 +466,24 @@ static void pdc2027x_set_dmamode(struct ata_port *ap, struct ata_device *adev) | |||
470 | 466 | ||
471 | /** | 467 | /** |
472 | * pdc2027x_set_mode - Set the timing registers back to correct values. | 468 | * pdc2027x_set_mode - Set the timing registers back to correct values. |
473 | * @ap: Port to configure | 469 | * @link: link to configure |
474 | * @r_failed: Returned device for failure | 470 | * @r_failed: Returned device for failure |
475 | * | 471 | * |
476 | * The pdc2027x hardware will look at "SET FEATURES" and change the timing registers | 472 | * The pdc2027x hardware will look at "SET FEATURES" and change the timing registers |
477 | * automatically. The values set by the hardware might be incorrect, under 133Mhz PLL. | 473 | * automatically. The values set by the hardware might be incorrect, under 133Mhz PLL. |
478 | * This function overwrites the possibly incorrect values set by the hardware to be correct. | 474 | * This function overwrites the possibly incorrect values set by the hardware to be correct. |
479 | */ | 475 | */ |
480 | static int pdc2027x_set_mode(struct ata_port *ap, struct ata_device **r_failed) | 476 | static int pdc2027x_set_mode(struct ata_link *link, struct ata_device **r_failed) |
481 | { | 477 | { |
482 | int i; | 478 | struct ata_port *ap = link->ap; |
483 | 479 | struct ata_device *dev; | |
484 | i = ata_do_set_mode(ap, r_failed); | 480 | int rc; |
485 | if (i < 0) | ||
486 | return i; | ||
487 | 481 | ||
488 | for (i = 0; i < ATA_MAX_DEVICES; i++) { | 482 | rc = ata_do_set_mode(link, r_failed); |
489 | struct ata_device *dev = &ap->device[i]; | 483 | if (rc < 0) |
484 | return rc; | ||
490 | 485 | ||
486 | ata_link_for_each_dev(dev, link) { | ||
491 | if (ata_dev_enabled(dev)) { | 487 | if (ata_dev_enabled(dev)) { |
492 | 488 | ||
493 | pdc2027x_set_piomode(ap, dev); | 489 | pdc2027x_set_piomode(ap, dev); |
@@ -496,9 +492,9 @@ static int pdc2027x_set_mode(struct ata_port *ap, struct ata_device **r_failed) | |||
496 | * Enable prefetch if the device support PIO only. | 492 | * Enable prefetch if the device support PIO only. |
497 | */ | 493 | */ |
498 | if (dev->xfer_shift == ATA_SHIFT_PIO) { | 494 | if (dev->xfer_shift == ATA_SHIFT_PIO) { |
499 | u32 ctcr1 = readl(dev_mmio(ap, dev, PDC_CTCR1)); | 495 | u32 ctcr1 = ioread32(dev_mmio(ap, dev, PDC_CTCR1)); |
500 | ctcr1 |= (1 << 25); | 496 | ctcr1 |= (1 << 25); |
501 | writel(ctcr1, dev_mmio(ap, dev, PDC_CTCR1)); | 497 | iowrite32(ctcr1, dev_mmio(ap, dev, PDC_CTCR1)); |
502 | 498 | ||
503 | PDPRINTK("Turn on prefetch\n"); | 499 | PDPRINTK("Turn on prefetch\n"); |
504 | } else { | 500 | } else { |
@@ -563,14 +559,12 @@ static long pdc_read_counter(struct ata_host *host) | |||
563 | u32 bccrl, bccrh, bccrlv, bccrhv; | 559 | u32 bccrl, bccrh, bccrlv, bccrhv; |
564 | 560 | ||
565 | retry: | 561 | retry: |
566 | bccrl = readl(mmio_base + PDC_BYTE_COUNT) & 0x7fff; | 562 | bccrl = ioread32(mmio_base + PDC_BYTE_COUNT) & 0x7fff; |
567 | bccrh = readl(mmio_base + PDC_BYTE_COUNT + 0x100) & 0x7fff; | 563 | bccrh = ioread32(mmio_base + PDC_BYTE_COUNT + 0x100) & 0x7fff; |
568 | rmb(); | ||
569 | 564 | ||
570 | /* Read the counter values again for verification */ | 565 | /* Read the counter values again for verification */ |
571 | bccrlv = readl(mmio_base + PDC_BYTE_COUNT) & 0x7fff; | 566 | bccrlv = ioread32(mmio_base + PDC_BYTE_COUNT) & 0x7fff; |
572 | bccrhv = readl(mmio_base + PDC_BYTE_COUNT + 0x100) & 0x7fff; | 567 | bccrhv = ioread32(mmio_base + PDC_BYTE_COUNT + 0x100) & 0x7fff; |
573 | rmb(); | ||
574 | 568 | ||
575 | counter = (bccrh << 15) | bccrl; | 569 | counter = (bccrh << 15) | bccrl; |
576 | 570 | ||
@@ -619,7 +613,7 @@ static void pdc_adjust_pll(struct ata_host *host, long pll_clock, unsigned int b | |||
619 | /* Show the current clock value of PLL control register | 613 | /* Show the current clock value of PLL control register |
620 | * (maybe already configured by the firmware) | 614 | * (maybe already configured by the firmware) |
621 | */ | 615 | */ |
622 | pll_ctl = readw(mmio_base + PDC_PLL_CTL); | 616 | pll_ctl = ioread16(mmio_base + PDC_PLL_CTL); |
623 | 617 | ||
624 | PDPRINTK("pll_ctl[%X]\n", pll_ctl); | 618 | PDPRINTK("pll_ctl[%X]\n", pll_ctl); |
625 | #endif | 619 | #endif |
@@ -659,8 +653,8 @@ static void pdc_adjust_pll(struct ata_host *host, long pll_clock, unsigned int b | |||
659 | 653 | ||
660 | PDPRINTK("Writing pll_ctl[%X]\n", pll_ctl); | 654 | PDPRINTK("Writing pll_ctl[%X]\n", pll_ctl); |
661 | 655 | ||
662 | writew(pll_ctl, mmio_base + PDC_PLL_CTL); | 656 | iowrite16(pll_ctl, mmio_base + PDC_PLL_CTL); |
663 | readw(mmio_base + PDC_PLL_CTL); /* flush */ | 657 | ioread16(mmio_base + PDC_PLL_CTL); /* flush */ |
664 | 658 | ||
665 | /* Wait the PLL circuit to be stable */ | 659 | /* Wait the PLL circuit to be stable */ |
666 | mdelay(30); | 660 | mdelay(30); |
@@ -670,7 +664,7 @@ static void pdc_adjust_pll(struct ata_host *host, long pll_clock, unsigned int b | |||
670 | * Show the current clock value of PLL control register | 664 | * Show the current clock value of PLL control register |
671 | * (maybe configured by the firmware) | 665 | * (maybe configured by the firmware) |
672 | */ | 666 | */ |
673 | pll_ctl = readw(mmio_base + PDC_PLL_CTL); | 667 | pll_ctl = ioread16(mmio_base + PDC_PLL_CTL); |
674 | 668 | ||
675 | PDPRINTK("pll_ctl[%X]\n", pll_ctl); | 669 | PDPRINTK("pll_ctl[%X]\n", pll_ctl); |
676 | #endif | 670 | #endif |
@@ -693,10 +687,10 @@ static long pdc_detect_pll_input_clock(struct ata_host *host) | |||
693 | long pll_clock, usec_elapsed; | 687 | long pll_clock, usec_elapsed; |
694 | 688 | ||
695 | /* Start the test mode */ | 689 | /* Start the test mode */ |
696 | scr = readl(mmio_base + PDC_SYS_CTL); | 690 | scr = ioread32(mmio_base + PDC_SYS_CTL); |
697 | PDPRINTK("scr[%X]\n", scr); | 691 | PDPRINTK("scr[%X]\n", scr); |
698 | writel(scr | (0x01 << 14), mmio_base + PDC_SYS_CTL); | 692 | iowrite32(scr | (0x01 << 14), mmio_base + PDC_SYS_CTL); |
699 | readl(mmio_base + PDC_SYS_CTL); /* flush */ | 693 | ioread32(mmio_base + PDC_SYS_CTL); /* flush */ |
700 | 694 | ||
701 | /* Read current counter value */ | 695 | /* Read current counter value */ |
702 | start_count = pdc_read_counter(host); | 696 | start_count = pdc_read_counter(host); |
@@ -710,10 +704,10 @@ static long pdc_detect_pll_input_clock(struct ata_host *host) | |||
710 | do_gettimeofday(&end_time); | 704 | do_gettimeofday(&end_time); |
711 | 705 | ||
712 | /* Stop the test mode */ | 706 | /* Stop the test mode */ |
713 | scr = readl(mmio_base + PDC_SYS_CTL); | 707 | scr = ioread32(mmio_base + PDC_SYS_CTL); |
714 | PDPRINTK("scr[%X]\n", scr); | 708 | PDPRINTK("scr[%X]\n", scr); |
715 | writel(scr & ~(0x01 << 14), mmio_base + PDC_SYS_CTL); | 709 | iowrite32(scr & ~(0x01 << 14), mmio_base + PDC_SYS_CTL); |
716 | readl(mmio_base + PDC_SYS_CTL); /* flush */ | 710 | ioread32(mmio_base + PDC_SYS_CTL); /* flush */ |
717 | 711 | ||
718 | /* calculate the input clock in Hz */ | 712 | /* calculate the input clock in Hz */ |
719 | usec_elapsed = (end_time.tv_sec - start_time.tv_sec) * 1000000 + | 713 | usec_elapsed = (end_time.tv_sec - start_time.tv_sec) * 1000000 + |
@@ -745,9 +739,6 @@ static int pdc_hardware_init(struct ata_host *host, unsigned int board_idx) | |||
745 | */ | 739 | */ |
746 | pll_clock = pdc_detect_pll_input_clock(host); | 740 | pll_clock = pdc_detect_pll_input_clock(host); |
747 | 741 | ||
748 | if (pll_clock < 0) /* counter overflow? Try again. */ | ||
749 | pll_clock = pdc_detect_pll_input_clock(host); | ||
750 | |||
751 | dev_printk(KERN_INFO, host->dev, "PLL input clock %ld kHz\n", pll_clock/1000); | 742 | dev_printk(KERN_INFO, host->dev, "PLL input clock %ld kHz\n", pll_clock/1000); |
752 | 743 | ||
753 | /* Adjust PLL control register */ | 744 | /* Adjust PLL control register */ |
@@ -791,12 +782,14 @@ static void pdc_ata_setup_port(struct ata_ioports *port, void __iomem *base) | |||
791 | static int __devinit pdc2027x_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) | 782 | static int __devinit pdc2027x_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) |
792 | { | 783 | { |
793 | static int printed_version; | 784 | static int printed_version; |
785 | static const unsigned long cmd_offset[] = { 0x17c0, 0x15c0 }; | ||
786 | static const unsigned long bmdma_offset[] = { 0x1000, 0x1008 }; | ||
794 | unsigned int board_idx = (unsigned int) ent->driver_data; | 787 | unsigned int board_idx = (unsigned int) ent->driver_data; |
795 | const struct ata_port_info *ppi[] = | 788 | const struct ata_port_info *ppi[] = |
796 | { &pdc2027x_port_info[board_idx], NULL }; | 789 | { &pdc2027x_port_info[board_idx], NULL }; |
797 | struct ata_host *host; | 790 | struct ata_host *host; |
798 | void __iomem *mmio_base; | 791 | void __iomem *mmio_base; |
799 | int rc; | 792 | int i, rc; |
800 | 793 | ||
801 | if (!printed_version++) | 794 | if (!printed_version++) |
802 | dev_printk(KERN_DEBUG, &pdev->dev, "version " DRV_VERSION "\n"); | 795 | dev_printk(KERN_DEBUG, &pdev->dev, "version " DRV_VERSION "\n"); |
@@ -826,10 +819,15 @@ static int __devinit pdc2027x_init_one(struct pci_dev *pdev, const struct pci_de | |||
826 | 819 | ||
827 | mmio_base = host->iomap[PDC_MMIO_BAR]; | 820 | mmio_base = host->iomap[PDC_MMIO_BAR]; |
828 | 821 | ||
829 | pdc_ata_setup_port(&host->ports[0]->ioaddr, mmio_base + 0x17c0); | 822 | for (i = 0; i < 2; i++) { |
830 | host->ports[0]->ioaddr.bmdma_addr = mmio_base + 0x1000; | 823 | struct ata_port *ap = host->ports[i]; |
831 | pdc_ata_setup_port(&host->ports[1]->ioaddr, mmio_base + 0x15c0); | 824 | |
832 | host->ports[1]->ioaddr.bmdma_addr = mmio_base + 0x1008; | 825 | pdc_ata_setup_port(&ap->ioaddr, mmio_base + cmd_offset[i]); |
826 | ap->ioaddr.bmdma_addr = mmio_base + bmdma_offset[i]; | ||
827 | |||
828 | ata_port_pbar_desc(ap, PDC_MMIO_BAR, -1, "mmio"); | ||
829 | ata_port_pbar_desc(ap, PDC_MMIO_BAR, cmd_offset[i], "cmd"); | ||
830 | } | ||
833 | 831 | ||
834 | //pci_enable_intx(pdev); | 832 | //pci_enable_intx(pdev); |
835 | 833 | ||