diff options
author | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2007-05-09 18:01:08 -0400 |
---|---|---|
committer | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2007-05-09 18:01:08 -0400 |
commit | 2d5eaa6dd744a641e75503232a01f52d0768884c (patch) | |
tree | 0736bd00ea3bd032d601d0a676c998cb043b877a /drivers/ide/pci/it821x.c | |
parent | 18137207236285989dfc0ee7f929b954199228f3 (diff) |
ide: rework the code for selecting the best DMA transfer mode (v3)
Depends on the "ide: fix UDMA/MWDMA/SWDMA masks" patch.
* add ide_hwif_t.udma_filter hook for filtering UDMA mask
(use it in alim15x3, hpt366, siimage and serverworks drivers)
* add ide_max_dma_mode() for finding best DMA mode for the device
(loosely based on some older libata-core.c code)
* convert ide_dma_speed() users to use ide_max_dma_mode()
* make ide_rate_filter() take "ide_drive_t *drive" as an argument instead
of "u8 mode" and teach it to how to use UDMA mask to do filtering
* use ide_rate_filter() in hpt366 driver
* remove no longer needed ide_dma_speed() and *_ratemask()
* unexport eighty_ninty_three()
v2:
* rename ->filter_udma_mask to ->udma_filter
[ Suggested by Sergei Shtylyov <sshtylyov@ru.mvista.com>. ]
v3:
* updated for scc_pata driver (fixes XFER_UDMA_6 filtering for user-space
originated transfer mode change requests when 100MHz clock is used)
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers/ide/pci/it821x.c')
-rw-r--r-- | drivers/ide/pci/it821x.c | 20 |
1 files changed, 2 insertions, 18 deletions
diff --git a/drivers/ide/pci/it821x.c b/drivers/ide/pci/it821x.c index 4e1254813ee0..442f658c6ae7 100644 --- a/drivers/ide/pci/it821x.c +++ b/drivers/ide/pci/it821x.c | |||
@@ -229,22 +229,6 @@ static void it821x_clock_strategy(ide_drive_t *drive) | |||
229 | } | 229 | } |
230 | 230 | ||
231 | /** | 231 | /** |
232 | * it821x_ratemask - Compute available modes | ||
233 | * @drive: IDE drive | ||
234 | * | ||
235 | * Compute the available speeds for the devices on the interface. This | ||
236 | * is all modes to ATA133 clipped by drive cable setup. | ||
237 | */ | ||
238 | |||
239 | static u8 it821x_ratemask (ide_drive_t *drive) | ||
240 | { | ||
241 | u8 mode = 4; | ||
242 | if (!eighty_ninty_three(drive)) | ||
243 | mode = min(mode, (u8)1); | ||
244 | return mode; | ||
245 | } | ||
246 | |||
247 | /** | ||
248 | * it821x_tunepio - tune a drive | 232 | * it821x_tunepio - tune a drive |
249 | * @drive: drive to tune | 233 | * @drive: drive to tune |
250 | * @pio: the desired PIO mode | 234 | * @pio: the desired PIO mode |
@@ -438,7 +422,7 @@ static int it821x_tune_chipset (ide_drive_t *drive, byte xferspeed) | |||
438 | 422 | ||
439 | ide_hwif_t *hwif = drive->hwif; | 423 | ide_hwif_t *hwif = drive->hwif; |
440 | struct it821x_dev *itdev = ide_get_hwifdata(hwif); | 424 | struct it821x_dev *itdev = ide_get_hwifdata(hwif); |
441 | u8 speed = ide_rate_filter(it821x_ratemask(drive), xferspeed); | 425 | u8 speed = ide_rate_filter(drive, xferspeed); |
442 | 426 | ||
443 | switch (speed) { | 427 | switch (speed) { |
444 | case XFER_PIO_4: | 428 | case XFER_PIO_4: |
@@ -488,7 +472,7 @@ static int it821x_tune_chipset (ide_drive_t *drive, byte xferspeed) | |||
488 | 472 | ||
489 | static int config_chipset_for_dma (ide_drive_t *drive) | 473 | static int config_chipset_for_dma (ide_drive_t *drive) |
490 | { | 474 | { |
491 | u8 speed = ide_dma_speed(drive, it821x_ratemask(drive)); | 475 | u8 speed = ide_max_dma_mode(drive); |
492 | 476 | ||
493 | if (speed == 0) | 477 | if (speed == 0) |
494 | return 0; | 478 | return 0; |