aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide/mips/au1xxx-ide.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/mips/au1xxx-ide.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/mips/au1xxx-ide.c')
-rw-r--r--drivers/ide/mips/au1xxx-ide.c27
1 files changed, 6 insertions, 21 deletions
diff --git a/drivers/ide/mips/au1xxx-ide.c b/drivers/ide/mips/au1xxx-ide.c
index c319f6163127..aebde49365d1 100644
--- a/drivers/ide/mips/au1xxx-ide.c
+++ b/drivers/ide/mips/au1xxx-ide.c
@@ -101,14 +101,7 @@ void auide_outsw(unsigned long port, void *addr, u32 count)
101 101
102static void au1xxx_set_pio_mode(ide_drive_t *drive, const u8 pio) 102static void au1xxx_set_pio_mode(ide_drive_t *drive, const u8 pio)
103{ 103{
104 int mem_sttime; 104 int mem_sttime = 0, mem_stcfg = au_readl(MEM_STCFG2);
105 int mem_stcfg;
106
107 if (ide_config_drive_speed(drive, pio + XFER_PIO_0))
108 return;
109
110 mem_sttime = 0;
111 mem_stcfg = au_readl(MEM_STCFG2);
112 105
113 /* set pio mode! */ 106 /* set pio mode! */
114 switch(pio) { 107 switch(pio) {
@@ -168,13 +161,9 @@ static void au1xxx_set_pio_mode(ide_drive_t *drive, const u8 pio)
168 au_writel(mem_stcfg,MEM_STCFG2); 161 au_writel(mem_stcfg,MEM_STCFG2);
169} 162}
170 163
171static int auide_tune_chipset(ide_drive_t *drive, const u8 speed) 164static void auide_set_dma_mode(ide_drive_t *drive, const u8 speed)
172{ 165{
173 int mem_sttime; 166 int mem_sttime = 0, mem_stcfg = au_readl(MEM_STCFG2);
174 int mem_stcfg;
175
176 mem_sttime = 0;
177 mem_stcfg = au_readl(MEM_STCFG2);
178 167
179 switch(speed) { 168 switch(speed) {
180#ifdef CONFIG_BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA 169#ifdef CONFIG_BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA
@@ -210,16 +199,11 @@ static int auide_tune_chipset(ide_drive_t *drive, const u8 speed)
210 break; 199 break;
211#endif 200#endif
212 default: 201 default:
213 return 1; 202 return;
214 } 203 }
215 204
216 if (ide_config_drive_speed(drive, speed))
217 return 1;
218
219 au_writel(mem_sttime,MEM_STTIME2); 205 au_writel(mem_sttime,MEM_STTIME2);
220 au_writel(mem_stcfg,MEM_STCFG2); 206 au_writel(mem_stcfg,MEM_STCFG2);
221
222 return 0;
223} 207}
224 208
225/* 209/*
@@ -681,6 +665,7 @@ static int au_ide_probe(struct device *dev)
681#endif 665#endif
682 666
683 hwif->pio_mask = ATA_PIO4; 667 hwif->pio_mask = ATA_PIO4;
668 hwif->host_flags = IDE_HFLAG_POST_SET_MODE;
684 669
685 hwif->noprobe = 0; 670 hwif->noprobe = 0;
686 hwif->drives[0].unmask = 1; 671 hwif->drives[0].unmask = 1;
@@ -701,7 +686,7 @@ static int au_ide_probe(struct device *dev)
701#endif 686#endif
702 687
703 hwif->set_pio_mode = &au1xxx_set_pio_mode; 688 hwif->set_pio_mode = &au1xxx_set_pio_mode;
704 hwif->speedproc = &auide_tune_chipset; 689 hwif->set_dma_mode = &auide_set_dma_mode;
705 690
706#ifdef CONFIG_BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA 691#ifdef CONFIG_BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA
707 hwif->dma_off_quietly = &auide_dma_off_quietly; 692 hwif->dma_off_quietly = &auide_dma_off_quietly;