aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide/pci/atiixp.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/ide/pci/atiixp.c')
-rw-r--r--drivers/ide/pci/atiixp.c22
1 files changed, 7 insertions, 15 deletions
diff --git a/drivers/ide/pci/atiixp.c b/drivers/ide/pci/atiixp.c
index 1725aa402d98..178876a3afca 100644
--- a/drivers/ide/pci/atiixp.c
+++ b/drivers/ide/pci/atiixp.c
@@ -153,9 +153,8 @@ static void atiixp_tune_pio(ide_drive_t *drive, u8 pio)
153 spin_unlock_irqrestore(&atiixp_lock, flags); 153 spin_unlock_irqrestore(&atiixp_lock, flags);
154} 154}
155 155
156static void atiixp_tuneproc(ide_drive_t *drive, u8 pio) 156static void atiixp_set_pio_mode(ide_drive_t *drive, const u8 pio)
157{ 157{
158 pio = ide_get_best_pio_mode(drive, pio, 4);
159 atiixp_tune_pio(drive, pio); 158 atiixp_tune_pio(drive, pio);
160 (void)ide_config_drive_speed(drive, XFER_PIO_0 + pio); 159 (void)ide_config_drive_speed(drive, XFER_PIO_0 + pio);
161} 160}
@@ -163,28 +162,21 @@ static void atiixp_tuneproc(ide_drive_t *drive, u8 pio)
163/** 162/**
164 * atiixp_tune_chipset - tune a ATIIXP interface 163 * atiixp_tune_chipset - tune a ATIIXP interface
165 * @drive: IDE drive to tune 164 * @drive: IDE drive to tune
166 * @xferspeed: speed to configure 165 * @speed: speed to configure
167 * 166 *
168 * Set a ATIIXP interface channel to the desired speeds. This involves 167 * Set a ATIIXP interface channel to the desired speeds. This involves
169 * requires the right timing data into the ATIIXP configuration space 168 * requires the right timing data into the ATIIXP configuration space
170 * then setting the drive parameters appropriately 169 * then setting the drive parameters appropriately
171 */ 170 */
172 171
173static int atiixp_speedproc(ide_drive_t *drive, u8 xferspeed) 172static int atiixp_speedproc(ide_drive_t *drive, const u8 speed)
174{ 173{
175 struct pci_dev *dev = drive->hwif->pci_dev; 174 struct pci_dev *dev = drive->hwif->pci_dev;
176 unsigned long flags; 175 unsigned long flags;
177 int timing_shift = (drive->dn & 2) ? 16 : 0 + (drive->dn & 1) ? 0 : 8; 176 int timing_shift = (drive->dn & 2) ? 16 : 0 + (drive->dn & 1) ? 0 : 8;
178 u32 tmp32; 177 u32 tmp32;
179 u16 tmp16; 178 u16 tmp16;
180 u8 speed, pio; 179 u8 pio;
181
182 speed = ide_rate_filter(drive, xferspeed);
183
184 if (speed >= XFER_PIO_0 && speed <= XFER_PIO_4) {
185 atiixp_tune_pio(drive, speed - XFER_PIO_0);
186 return ide_config_drive_speed(drive, speed);
187 }
188 180
189 spin_lock_irqsave(&atiixp_lock, flags); 181 spin_lock_irqsave(&atiixp_lock, flags);
190 182
@@ -233,7 +225,7 @@ static int atiixp_dma_check(ide_drive_t *drive)
233 return 0; 225 return 0;
234 226
235 if (ide_use_fast_pio(drive)) 227 if (ide_use_fast_pio(drive))
236 atiixp_tuneproc(drive, 255); 228 ide_set_max_pio(drive);
237 229
238 return -1; 230 return -1;
239} 231}
@@ -256,7 +248,7 @@ static void __devinit init_hwif_atiixp(ide_hwif_t *hwif)
256 hwif->irq = ch ? 15 : 14; 248 hwif->irq = ch ? 15 : 14;
257 249
258 hwif->autodma = 0; 250 hwif->autodma = 0;
259 hwif->tuneproc = &atiixp_tuneproc; 251 hwif->set_pio_mode = &atiixp_set_pio_mode;
260 hwif->speedproc = &atiixp_speedproc; 252 hwif->speedproc = &atiixp_speedproc;
261 hwif->drives[0].autotune = 1; 253 hwif->drives[0].autotune = 1;
262 hwif->drives[1].autotune = 1; 254 hwif->drives[1].autotune = 1;
@@ -325,7 +317,7 @@ static struct pci_device_id atiixp_pci_tbl[] = {
325 { PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_IXP300_IDE, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, 317 { PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_IXP300_IDE, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
326 { PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_IXP400_IDE, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, 318 { PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_IXP400_IDE, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
327 { PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_IXP600_IDE, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 1}, 319 { PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_IXP600_IDE, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 1},
328 { PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_IXP700_IDE, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 1}, 320 { PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_IXP700_IDE, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
329 { 0, }, 321 { 0, },
330}; 322};
331MODULE_DEVICE_TABLE(pci, atiixp_pci_tbl); 323MODULE_DEVICE_TABLE(pci, atiixp_pci_tbl);