aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide/pci/hpt366.c
diff options
context:
space:
mode:
authorBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2007-10-13 11:47:51 -0400
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2007-10-13 11:47:51 -0400
commit88b2b32babd46cd54d2de4d17eb869aea3383e11 (patch)
treed446864f7c3431f8c428eecacd11caf7b794f018 /drivers/ide/pci/hpt366.c
parent6e249395eace037ef139a1c8996b31e3797e412a (diff)
ide: move ide_config_drive_speed() calls to upper layers (take 2)
* Convert {ide_hwif_t,ide_pci_device_t}->host_flag to be u16. * Add IDE_HFLAG_POST_SET_MODE host flag to indicate the need to program the host for the transfer mode after programming the device. Set it in au1xxx-ide, amd74xx, cs5530, cs5535, pdc202xx_new, sc1200, pmac and via82cxxx host drivers. * Add IDE_HFLAG_NO_SET_MODE host flag to indicate the need to completely skip programming of host/device for the transfer mode ("smart" hosts). Set it in it821x host driver and check it in ide_tune_dma(). * Add ide_set_pio_mode()/ide_set_dma_mode() helpers and convert all direct ->set_pio_mode/->speedproc users to use these helpers. * Move ide_config_drive_speed() calls from ->set_pio_mode/->speedproc methods to callers. * Rename ->speedproc method to ->set_dma_mode, make it void and update all implementations accordingly. * Update ide_set_xfer_rate() comments. * Unexport ide_config_drive_speed(). v2: * Fix issues noticed by Sergei: - export ide_set_dma_mode() instead of moving ->set_pio_mode abuse wrt to setting DMA modes from sc1200_set_pio_mode() to do_special() - check IDE_HFLAG_NO_SET_MODE in ide_tune_dma() - check for (hwif->set_pio_mode) == NULL in ide_set_pio_mode() - check for (hwif->set_dma_mode) == NULL in ide_set_dma_mode() - return -1 from ide_set_{pio,dma}_mode() if ->set_{pio,dma}_mode == NULL - don't set ->set_{pio,dma}_mode on it821x in "smart" mode - fix build problem in pmac.c - minor fixes in au1xxx-ide.c/cs5530.c/siimage.c - improve patch description Changes in behavior caused by this patch: - HDIO_SET_PIO_MODE ioctl would now return -ENOSYS for attempts to change PIO mode if it821x controller is in "smart" mode - removal of two debugging printk-s (from cs5530.c and sc1200.c) - transfer modes 0x00-0x07 passed from user space may be programmed twice on the device (not really an issue since 0x00 is not supported correctly by any host driver ATM, 0x01 is not supported at all and 0x02-0x07 are invalid) Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com> Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers/ide/pci/hpt366.c')
-rw-r--r--drivers/ide/pci/hpt366.c18
1 files changed, 7 insertions, 11 deletions
diff --git a/drivers/ide/pci/hpt366.c b/drivers/ide/pci/hpt366.c
index 0e7d3b60d43c..8812a9bb032f 100644
--- a/drivers/ide/pci/hpt366.c
+++ b/drivers/ide/pci/hpt366.c
@@ -600,7 +600,7 @@ static u32 get_speed_setting(u8 speed, struct hpt_info *info)
600 return (*info->settings)[i]; 600 return (*info->settings)[i];
601} 601}
602 602
603static int hpt36x_tune_chipset(ide_drive_t *drive, const u8 speed) 603static void hpt36x_set_mode(ide_drive_t *drive, const u8 speed)
604{ 604{
605 ide_hwif_t *hwif = HWIF(drive); 605 ide_hwif_t *hwif = HWIF(drive);
606 struct pci_dev *dev = hwif->pci_dev; 606 struct pci_dev *dev = hwif->pci_dev;
@@ -623,11 +623,9 @@ static int hpt36x_tune_chipset(ide_drive_t *drive, const u8 speed)
623 new_itr &= ~0xc0000000; 623 new_itr &= ~0xc0000000;
624 624
625 pci_write_config_dword(dev, itr_addr, new_itr); 625 pci_write_config_dword(dev, itr_addr, new_itr);
626
627 return ide_config_drive_speed(drive, speed);
628} 626}
629 627
630static int hpt37x_tune_chipset(ide_drive_t *drive, const u8 speed) 628static void hpt37x_set_mode(ide_drive_t *drive, const u8 speed)
631{ 629{
632 ide_hwif_t *hwif = HWIF(drive); 630 ide_hwif_t *hwif = HWIF(drive);
633 struct pci_dev *dev = hwif->pci_dev; 631 struct pci_dev *dev = hwif->pci_dev;
@@ -647,24 +645,22 @@ static int hpt37x_tune_chipset(ide_drive_t *drive, const u8 speed)
647 if (speed < XFER_MW_DMA_0) 645 if (speed < XFER_MW_DMA_0)
648 new_itr &= ~0x80000000; /* Disable on-chip PIO FIFO/buffer */ 646 new_itr &= ~0x80000000; /* Disable on-chip PIO FIFO/buffer */
649 pci_write_config_dword(dev, itr_addr, new_itr); 647 pci_write_config_dword(dev, itr_addr, new_itr);
650
651 return ide_config_drive_speed(drive, speed);
652} 648}
653 649
654static int hpt3xx_tune_chipset(ide_drive_t *drive, u8 speed) 650static void hpt3xx_set_mode(ide_drive_t *drive, const u8 speed)
655{ 651{
656 ide_hwif_t *hwif = HWIF(drive); 652 ide_hwif_t *hwif = HWIF(drive);
657 struct hpt_info *info = pci_get_drvdata(hwif->pci_dev); 653 struct hpt_info *info = pci_get_drvdata(hwif->pci_dev);
658 654
659 if (info->chip_type >= HPT370) 655 if (info->chip_type >= HPT370)
660 return hpt37x_tune_chipset(drive, speed); 656 hpt37x_set_mode(drive, speed);
661 else /* hpt368: hpt_minimum_revision(dev, 2) */ 657 else /* hpt368: hpt_minimum_revision(dev, 2) */
662 return hpt36x_tune_chipset(drive, speed); 658 hpt36x_set_mode(drive, speed);
663} 659}
664 660
665static void hpt3xx_set_pio_mode(ide_drive_t *drive, const u8 pio) 661static void hpt3xx_set_pio_mode(ide_drive_t *drive, const u8 pio)
666{ 662{
667 (void) hpt3xx_tune_chipset (drive, XFER_PIO_0 + pio); 663 hpt3xx_set_mode(drive, XFER_PIO_0 + pio);
668} 664}
669 665
670static int hpt3xx_quirkproc(ide_drive_t *drive) 666static int hpt3xx_quirkproc(ide_drive_t *drive)
@@ -1257,7 +1253,7 @@ static void __devinit init_hwif_hpt366(ide_hwif_t *hwif)
1257 hwif->select_data = hwif->channel ? 0x54 : 0x50; 1253 hwif->select_data = hwif->channel ? 0x54 : 0x50;
1258 1254
1259 hwif->set_pio_mode = &hpt3xx_set_pio_mode; 1255 hwif->set_pio_mode = &hpt3xx_set_pio_mode;
1260 hwif->speedproc = &hpt3xx_tune_chipset; 1256 hwif->set_dma_mode = &hpt3xx_set_mode;
1261 hwif->quirkproc = &hpt3xx_quirkproc; 1257 hwif->quirkproc = &hpt3xx_quirkproc;
1262 hwif->intrproc = &hpt3xx_intrproc; 1258 hwif->intrproc = &hpt3xx_intrproc;
1263 hwif->maskproc = &hpt3xx_maskproc; 1259 hwif->maskproc = &hpt3xx_maskproc;