diff options
Diffstat (limited to 'drivers/ide/pci/atiixp.c')
-rw-r--r-- | drivers/ide/pci/atiixp.c | 37 |
1 files changed, 22 insertions, 15 deletions
diff --git a/drivers/ide/pci/atiixp.c b/drivers/ide/pci/atiixp.c index 2761510309b3..1725aa402d98 100644 --- a/drivers/ide/pci/atiixp.c +++ b/drivers/ide/pci/atiixp.c | |||
@@ -1,9 +1,8 @@ | |||
1 | /* | 1 | /* |
2 | * linux/drivers/ide/pci/atiixp.c Version 0.01-bart2 Feb. 26, 2004 | 2 | * linux/drivers/ide/pci/atiixp.c Version 0.02 Jun 16 2007 |
3 | * | 3 | * |
4 | * Copyright (C) 2003 ATI Inc. <hyu@ati.com> | 4 | * Copyright (C) 2003 ATI Inc. <hyu@ati.com> |
5 | * Copyright (C) 2004 Bartlomiej Zolnierkiewicz | 5 | * Copyright (C) 2004,2007 Bartlomiej Zolnierkiewicz |
6 | * | ||
7 | */ | 6 | */ |
8 | 7 | ||
9 | #include <linux/types.h> | 8 | #include <linux/types.h> |
@@ -123,14 +122,14 @@ static void atiixp_dma_host_off(ide_drive_t *drive) | |||
123 | } | 122 | } |
124 | 123 | ||
125 | /** | 124 | /** |
126 | * atiixp_tune_drive - tune a drive attached to a ATIIXP | 125 | * atiixp_tune_pio - tune a drive attached to a ATIIXP |
127 | * @drive: drive to tune | 126 | * @drive: drive to tune |
128 | * @pio: desired PIO mode | 127 | * @pio: desired PIO mode |
129 | * | 128 | * |
130 | * Set the interface PIO mode. | 129 | * Set the interface PIO mode. |
131 | */ | 130 | */ |
132 | 131 | ||
133 | static void atiixp_tuneproc(ide_drive_t *drive, u8 pio) | 132 | static void atiixp_tune_pio(ide_drive_t *drive, u8 pio) |
134 | { | 133 | { |
135 | struct pci_dev *dev = drive->hwif->pci_dev; | 134 | struct pci_dev *dev = drive->hwif->pci_dev; |
136 | unsigned long flags; | 135 | unsigned long flags; |
@@ -154,6 +153,13 @@ static void atiixp_tuneproc(ide_drive_t *drive, u8 pio) | |||
154 | spin_unlock_irqrestore(&atiixp_lock, flags); | 153 | spin_unlock_irqrestore(&atiixp_lock, flags); |
155 | } | 154 | } |
156 | 155 | ||
156 | static void atiixp_tuneproc(ide_drive_t *drive, u8 pio) | ||
157 | { | ||
158 | pio = ide_get_best_pio_mode(drive, pio, 4); | ||
159 | atiixp_tune_pio(drive, pio); | ||
160 | (void)ide_config_drive_speed(drive, XFER_PIO_0 + pio); | ||
161 | } | ||
162 | |||
157 | /** | 163 | /** |
158 | * atiixp_tune_chipset - tune a ATIIXP interface | 164 | * atiixp_tune_chipset - tune a ATIIXP interface |
159 | * @drive: IDE drive to tune | 165 | * @drive: IDE drive to tune |
@@ -175,6 +181,11 @@ static int atiixp_speedproc(ide_drive_t *drive, u8 xferspeed) | |||
175 | 181 | ||
176 | speed = ide_rate_filter(drive, xferspeed); | 182 | speed = ide_rate_filter(drive, xferspeed); |
177 | 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 | |||
178 | spin_lock_irqsave(&atiixp_lock, flags); | 189 | spin_lock_irqsave(&atiixp_lock, flags); |
179 | 190 | ||
180 | save_mdma_mode[drive->dn] = 0; | 191 | save_mdma_mode[drive->dn] = 0; |
@@ -201,7 +212,7 @@ static int atiixp_speedproc(ide_drive_t *drive, u8 xferspeed) | |||
201 | else | 212 | else |
202 | pio = speed - XFER_PIO_0; | 213 | pio = speed - XFER_PIO_0; |
203 | 214 | ||
204 | atiixp_tuneproc(drive, pio); | 215 | atiixp_tune_pio(drive, pio); |
205 | 216 | ||
206 | return ide_config_drive_speed(drive, speed); | 217 | return ide_config_drive_speed(drive, speed); |
207 | } | 218 | } |
@@ -216,18 +227,13 @@ static int atiixp_speedproc(ide_drive_t *drive, u8 xferspeed) | |||
216 | 227 | ||
217 | static int atiixp_dma_check(ide_drive_t *drive) | 228 | static int atiixp_dma_check(ide_drive_t *drive) |
218 | { | 229 | { |
219 | u8 tspeed, speed; | ||
220 | |||
221 | drive->init_speed = 0; | 230 | drive->init_speed = 0; |
222 | 231 | ||
223 | if (ide_tune_dma(drive)) | 232 | if (ide_tune_dma(drive)) |
224 | return 0; | 233 | return 0; |
225 | 234 | ||
226 | if (ide_use_fast_pio(drive)) { | 235 | if (ide_use_fast_pio(drive)) |
227 | tspeed = ide_get_best_pio_mode(drive, 255, 5, NULL); | 236 | atiixp_tuneproc(drive, 255); |
228 | speed = atiixp_dma_2_pio(XFER_PIO_0 + tspeed) + XFER_PIO_0; | ||
229 | atiixp_speedproc(drive, speed); | ||
230 | } | ||
231 | 237 | ||
232 | return -1; | 238 | return -1; |
233 | } | 239 | } |
@@ -285,17 +291,18 @@ static ide_pci_device_t atiixp_pci_info[] __devinitdata = { | |||
285 | { /* 0 */ | 291 | { /* 0 */ |
286 | .name = "ATIIXP", | 292 | .name = "ATIIXP", |
287 | .init_hwif = init_hwif_atiixp, | 293 | .init_hwif = init_hwif_atiixp, |
288 | .channels = 2, | ||
289 | .autodma = AUTODMA, | 294 | .autodma = AUTODMA, |
290 | .enablebits = {{0x48,0x01,0x00}, {0x48,0x08,0x00}}, | 295 | .enablebits = {{0x48,0x01,0x00}, {0x48,0x08,0x00}}, |
291 | .bootable = ON_BOARD, | 296 | .bootable = ON_BOARD, |
297 | .pio_mask = ATA_PIO4, | ||
292 | },{ /* 1 */ | 298 | },{ /* 1 */ |
293 | .name = "SB600_PATA", | 299 | .name = "SB600_PATA", |
294 | .init_hwif = init_hwif_atiixp, | 300 | .init_hwif = init_hwif_atiixp, |
295 | .channels = 1, | ||
296 | .autodma = AUTODMA, | 301 | .autodma = AUTODMA, |
297 | .enablebits = {{0x48,0x01,0x00}, {0x00,0x00,0x00}}, | 302 | .enablebits = {{0x48,0x01,0x00}, {0x00,0x00,0x00}}, |
298 | .bootable = ON_BOARD, | 303 | .bootable = ON_BOARD, |
304 | .host_flags = IDE_HFLAG_SINGLE, | ||
305 | .pio_mask = ATA_PIO4, | ||
299 | }, | 306 | }, |
300 | }; | 307 | }; |
301 | 308 | ||