aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ata/pata_pdc2027x.c
diff options
context:
space:
mode:
authorAlan Cox <alan@lxorguk.ukuu.org.uk>2007-09-20 10:07:12 -0400
committerJeff Garzik <jeff@garzik.org>2007-10-12 14:55:38 -0400
commitd2a84f47899d1efc24fa610696f7b793692279c7 (patch)
tree52334248ca785c0a43da154b42c0a484e6391df1 /drivers/ata/pata_pdc2027x.c
parentc645fd34256e8ef4986d3e8acd569890cc421e5d (diff)
pdc2027x: Switch properly to ioread/iowrite
Some iomap functions were still using readl/writel and friends which happens to work on most platforms but is not correct. Signed-off-by: Alan Cox <alan@redhat.com> Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers/ata/pata_pdc2027x.c')
-rw-r--r--drivers/ata/pata_pdc2027x.c56
1 files changed, 28 insertions, 28 deletions
diff --git a/drivers/ata/pata_pdc2027x.c b/drivers/ata/pata_pdc2027x.c
index f87c800be7f3..3d3f1558cdee 100644
--- a/drivers/ata/pata_pdc2027x.c
+++ b/drivers/ata/pata_pdc2027x.c
@@ -273,7 +273,7 @@ static int pdc2027x_cable_detect(struct ata_port *ap)
273 u32 cgcr; 273 u32 cgcr;
274 274
275 /* check cable detect results */ 275 /* check cable detect results */
276 cgcr = readl(port_mmio(ap, PDC_GLOBAL_CTL)); 276 cgcr = ioread32(port_mmio(ap, PDC_GLOBAL_CTL));
277 if (cgcr & (1 << 26)) 277 if (cgcr & (1 << 26))
278 goto cbl40; 278 goto cbl40;
279 279
@@ -291,7 +291,7 @@ cbl40:
291 */ 291 */
292static inline int pdc2027x_port_enabled(struct ata_port *ap) 292static inline int pdc2027x_port_enabled(struct ata_port *ap)
293{ 293{
294 return readb(port_mmio(ap, PDC_ATA_CTL)) & 0x02; 294 return ioread8(port_mmio(ap, PDC_ATA_CTL)) & 0x02;
295} 295}
296 296
297/** 297/**
@@ -383,16 +383,16 @@ static void pdc2027x_set_piomode(struct ata_port *ap, struct ata_device *adev)
383 /* Set the PIO timing registers using value table for 133MHz */ 383 /* Set the PIO timing registers using value table for 133MHz */
384 PDPRINTK("Set pio regs... \n"); 384 PDPRINTK("Set pio regs... \n");
385 385
386 ctcr0 = readl(dev_mmio(ap, adev, PDC_CTCR0)); 386 ctcr0 = ioread32(dev_mmio(ap, adev, PDC_CTCR0));
387 ctcr0 &= 0xffff0000; 387 ctcr0 &= 0xffff0000;
388 ctcr0 |= pdc2027x_pio_timing_tbl[pio].value0 | 388 ctcr0 |= pdc2027x_pio_timing_tbl[pio].value0 |
389 (pdc2027x_pio_timing_tbl[pio].value1 << 8); 389 (pdc2027x_pio_timing_tbl[pio].value1 << 8);
390 writel(ctcr0, dev_mmio(ap, adev, PDC_CTCR0)); 390 iowrite32(ctcr0, dev_mmio(ap, adev, PDC_CTCR0));
391 391
392 ctcr1 = readl(dev_mmio(ap, adev, PDC_CTCR1)); 392 ctcr1 = ioread32(dev_mmio(ap, adev, PDC_CTCR1));
393 ctcr1 &= 0x00ffffff; 393 ctcr1 &= 0x00ffffff;
394 ctcr1 |= (pdc2027x_pio_timing_tbl[pio].value2 << 24); 394 ctcr1 |= (pdc2027x_pio_timing_tbl[pio].value2 << 24);
395 writel(ctcr1, dev_mmio(ap, adev, PDC_CTCR1)); 395 iowrite32(ctcr1, dev_mmio(ap, adev, PDC_CTCR1));
396 396
397 PDPRINTK("Set pio regs done\n"); 397 PDPRINTK("Set pio regs done\n");
398 398
@@ -426,18 +426,18 @@ static void pdc2027x_set_dmamode(struct ata_port *ap, struct ata_device *adev)
426 * 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.
427 * 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.
428 */ 428 */
429 ctcr1 = readl(dev_mmio(ap, adev, PDC_CTCR1)); 429 ctcr1 = ioread32(dev_mmio(ap, adev, PDC_CTCR1));
430 writel(ctcr1 & ~(1 << 7), dev_mmio(ap, adev, PDC_CTCR1)); 430 iowrite32(ctcr1 & ~(1 << 7), dev_mmio(ap, adev, PDC_CTCR1));
431 } 431 }
432 432
433 PDPRINTK("Set udma regs... \n"); 433 PDPRINTK("Set udma regs... \n");
434 434
435 ctcr1 = readl(dev_mmio(ap, adev, PDC_CTCR1)); 435 ctcr1 = ioread32(dev_mmio(ap, adev, PDC_CTCR1));
436 ctcr1 &= 0xff000000; 436 ctcr1 &= 0xff000000;
437 ctcr1 |= pdc2027x_udma_timing_tbl[udma_mode].value0 | 437 ctcr1 |= pdc2027x_udma_timing_tbl[udma_mode].value0 |
438 (pdc2027x_udma_timing_tbl[udma_mode].value1 << 8) | 438 (pdc2027x_udma_timing_tbl[udma_mode].value1 << 8) |
439 (pdc2027x_udma_timing_tbl[udma_mode].value2 << 16); 439 (pdc2027x_udma_timing_tbl[udma_mode].value2 << 16);
440 writel(ctcr1, dev_mmio(ap, adev, PDC_CTCR1)); 440 iowrite32(ctcr1, dev_mmio(ap, adev, PDC_CTCR1));
441 441
442 PDPRINTK("Set udma regs done\n"); 442 PDPRINTK("Set udma regs done\n");
443 443
@@ -449,13 +449,13 @@ static void pdc2027x_set_dmamode(struct ata_port *ap, struct ata_device *adev)
449 unsigned int mdma_mode = dma_mode & 0x07; 449 unsigned int mdma_mode = dma_mode & 0x07;
450 450
451 PDPRINTK("Set mdma regs... \n"); 451 PDPRINTK("Set mdma regs... \n");
452 ctcr0 = readl(dev_mmio(ap, adev, PDC_CTCR0)); 452 ctcr0 = ioread32(dev_mmio(ap, adev, PDC_CTCR0));
453 453
454 ctcr0 &= 0x0000ffff; 454 ctcr0 &= 0x0000ffff;
455 ctcr0 |= (pdc2027x_mdma_timing_tbl[mdma_mode].value0 << 16) | 455 ctcr0 |= (pdc2027x_mdma_timing_tbl[mdma_mode].value0 << 16) |
456 (pdc2027x_mdma_timing_tbl[mdma_mode].value1 << 24); 456 (pdc2027x_mdma_timing_tbl[mdma_mode].value1 << 24);
457 457
458 writel(ctcr0, dev_mmio(ap, adev, PDC_CTCR0)); 458 iowrite32(ctcr0, dev_mmio(ap, adev, PDC_CTCR0));
459 PDPRINTK("Set mdma regs done\n"); 459 PDPRINTK("Set mdma regs done\n");
460 460
461 PDPRINTK("Set to mdma mode[%u] \n", mdma_mode); 461 PDPRINTK("Set to mdma mode[%u] \n", mdma_mode);
@@ -492,9 +492,9 @@ static int pdc2027x_set_mode(struct ata_link *link, struct ata_device **r_failed
492 * Enable prefetch if the device support PIO only. 492 * Enable prefetch if the device support PIO only.
493 */ 493 */
494 if (dev->xfer_shift == ATA_SHIFT_PIO) { 494 if (dev->xfer_shift == ATA_SHIFT_PIO) {
495 u32 ctcr1 = readl(dev_mmio(ap, dev, PDC_CTCR1)); 495 u32 ctcr1 = ioread32(dev_mmio(ap, dev, PDC_CTCR1));
496 ctcr1 |= (1 << 25); 496 ctcr1 |= (1 << 25);
497 writel(ctcr1, dev_mmio(ap, dev, PDC_CTCR1)); 497 iowrite32(ctcr1, dev_mmio(ap, dev, PDC_CTCR1));
498 498
499 PDPRINTK("Turn on prefetch\n"); 499 PDPRINTK("Turn on prefetch\n");
500 } else { 500 } else {
@@ -559,12 +559,12 @@ static long pdc_read_counter(struct ata_host *host)
559 u32 bccrl, bccrh, bccrlv, bccrhv; 559 u32 bccrl, bccrh, bccrlv, bccrhv;
560 560
561retry: 561retry:
562 bccrl = readl(mmio_base + PDC_BYTE_COUNT) & 0x7fff; 562 bccrl = ioread32(mmio_base + PDC_BYTE_COUNT) & 0x7fff;
563 bccrh = readl(mmio_base + PDC_BYTE_COUNT + 0x100) & 0x7fff; 563 bccrh = ioread32(mmio_base + PDC_BYTE_COUNT + 0x100) & 0x7fff;
564 564
565 /* Read the counter values again for verification */ 565 /* Read the counter values again for verification */
566 bccrlv = readl(mmio_base + PDC_BYTE_COUNT) & 0x7fff; 566 bccrlv = ioread32(mmio_base + PDC_BYTE_COUNT) & 0x7fff;
567 bccrhv = readl(mmio_base + PDC_BYTE_COUNT + 0x100) & 0x7fff; 567 bccrhv = ioread32(mmio_base + PDC_BYTE_COUNT + 0x100) & 0x7fff;
568 568
569 counter = (bccrh << 15) | bccrl; 569 counter = (bccrh << 15) | bccrl;
570 570
@@ -613,7 +613,7 @@ static void pdc_adjust_pll(struct ata_host *host, long pll_clock, unsigned int b
613 /* Show the current clock value of PLL control register 613 /* Show the current clock value of PLL control register
614 * (maybe already configured by the firmware) 614 * (maybe already configured by the firmware)
615 */ 615 */
616 pll_ctl = readw(mmio_base + PDC_PLL_CTL); 616 pll_ctl = ioread16(mmio_base + PDC_PLL_CTL);
617 617
618 PDPRINTK("pll_ctl[%X]\n", pll_ctl); 618 PDPRINTK("pll_ctl[%X]\n", pll_ctl);
619#endif 619#endif
@@ -653,8 +653,8 @@ static void pdc_adjust_pll(struct ata_host *host, long pll_clock, unsigned int b
653 653
654 PDPRINTK("Writing pll_ctl[%X]\n", pll_ctl); 654 PDPRINTK("Writing pll_ctl[%X]\n", pll_ctl);
655 655
656 writew(pll_ctl, mmio_base + PDC_PLL_CTL); 656 iowrite16(pll_ctl, mmio_base + PDC_PLL_CTL);
657 readw(mmio_base + PDC_PLL_CTL); /* flush */ 657 ioread16(mmio_base + PDC_PLL_CTL); /* flush */
658 658
659 /* Wait the PLL circuit to be stable */ 659 /* Wait the PLL circuit to be stable */
660 mdelay(30); 660 mdelay(30);
@@ -664,7 +664,7 @@ static void pdc_adjust_pll(struct ata_host *host, long pll_clock, unsigned int b
664 * Show the current clock value of PLL control register 664 * Show the current clock value of PLL control register
665 * (maybe configured by the firmware) 665 * (maybe configured by the firmware)
666 */ 666 */
667 pll_ctl = readw(mmio_base + PDC_PLL_CTL); 667 pll_ctl = ioread16(mmio_base + PDC_PLL_CTL);
668 668
669 PDPRINTK("pll_ctl[%X]\n", pll_ctl); 669 PDPRINTK("pll_ctl[%X]\n", pll_ctl);
670#endif 670#endif
@@ -687,10 +687,10 @@ static long pdc_detect_pll_input_clock(struct ata_host *host)
687 long pll_clock, usec_elapsed; 687 long pll_clock, usec_elapsed;
688 688
689 /* Start the test mode */ 689 /* Start the test mode */
690 scr = readl(mmio_base + PDC_SYS_CTL); 690 scr = ioread32(mmio_base + PDC_SYS_CTL);
691 PDPRINTK("scr[%X]\n", scr); 691 PDPRINTK("scr[%X]\n", scr);
692 writel(scr | (0x01 << 14), mmio_base + PDC_SYS_CTL); 692 iowrite32(scr | (0x01 << 14), mmio_base + PDC_SYS_CTL);
693 readl(mmio_base + PDC_SYS_CTL); /* flush */ 693 ioread32(mmio_base + PDC_SYS_CTL); /* flush */
694 694
695 /* Read current counter value */ 695 /* Read current counter value */
696 start_count = pdc_read_counter(host); 696 start_count = pdc_read_counter(host);
@@ -704,10 +704,10 @@ static long pdc_detect_pll_input_clock(struct ata_host *host)
704 do_gettimeofday(&end_time); 704 do_gettimeofday(&end_time);
705 705
706 /* Stop the test mode */ 706 /* Stop the test mode */
707 scr = readl(mmio_base + PDC_SYS_CTL); 707 scr = ioread32(mmio_base + PDC_SYS_CTL);
708 PDPRINTK("scr[%X]\n", scr); 708 PDPRINTK("scr[%X]\n", scr);
709 writel(scr & ~(0x01 << 14), mmio_base + PDC_SYS_CTL); 709 iowrite32(scr & ~(0x01 << 14), mmio_base + PDC_SYS_CTL);
710 readl(mmio_base + PDC_SYS_CTL); /* flush */ 710 ioread32(mmio_base + PDC_SYS_CTL); /* flush */
711 711
712 /* calculate the input clock in Hz */ 712 /* calculate the input clock in Hz */
713 usec_elapsed = (end_time.tv_sec - start_time.tv_sec) * 1000000 + 713 usec_elapsed = (end_time.tv_sec - start_time.tv_sec) * 1000000 +