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/it8213.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/it8213.c')
-rw-r--r-- | drivers/ide/pci/it8213.c | 20 |
1 files changed, 2 insertions, 18 deletions
diff --git a/drivers/ide/pci/it8213.c b/drivers/ide/pci/it8213.c index 424f00bb160d..02b56cb7bb1b 100644 --- a/drivers/ide/pci/it8213.c +++ b/drivers/ide/pci/it8213.c | |||
@@ -17,22 +17,6 @@ | |||
17 | 17 | ||
18 | #include <asm/io.h> | 18 | #include <asm/io.h> |
19 | 19 | ||
20 | /* | ||
21 | * it8213_ratemask - Compute available modes | ||
22 | * @drive: IDE drive | ||
23 | * | ||
24 | * Compute the available speeds for the devices on the interface. This | ||
25 | * is all modes to ATA133 clipped by drive cable setup. | ||
26 | */ | ||
27 | |||
28 | static u8 it8213_ratemask (ide_drive_t *drive) | ||
29 | { | ||
30 | u8 mode = 4; | ||
31 | if (!eighty_ninty_three(drive)) | ||
32 | mode = min_t(u8, mode, 1); | ||
33 | return mode; | ||
34 | } | ||
35 | |||
36 | /** | 20 | /** |
37 | * it8213_dma_2_pio - return the PIO mode matching DMA | 21 | * it8213_dma_2_pio - return the PIO mode matching DMA |
38 | * @xfer_rate: transfer speed | 22 | * @xfer_rate: transfer speed |
@@ -145,7 +129,7 @@ static int it8213_tune_chipset (ide_drive_t *drive, u8 xferspeed) | |||
145 | ide_hwif_t *hwif = HWIF(drive); | 129 | ide_hwif_t *hwif = HWIF(drive); |
146 | struct pci_dev *dev = hwif->pci_dev; | 130 | struct pci_dev *dev = hwif->pci_dev; |
147 | u8 maslave = 0x40; | 131 | u8 maslave = 0x40; |
148 | u8 speed = ide_rate_filter(it8213_ratemask(drive), xferspeed); | 132 | u8 speed = ide_rate_filter(drive, xferspeed); |
149 | int a_speed = 3 << (drive->dn * 4); | 133 | int a_speed = 3 << (drive->dn * 4); |
150 | int u_flag = 1 << drive->dn; | 134 | int u_flag = 1 << drive->dn; |
151 | int v_flag = 0x01 << drive->dn; | 135 | int v_flag = 0x01 << drive->dn; |
@@ -222,7 +206,7 @@ static int it8213_tune_chipset (ide_drive_t *drive, u8 xferspeed) | |||
222 | 206 | ||
223 | static int config_chipset_for_dma (ide_drive_t *drive) | 207 | static int config_chipset_for_dma (ide_drive_t *drive) |
224 | { | 208 | { |
225 | u8 speed = ide_dma_speed(drive, it8213_ratemask(drive)); | 209 | u8 speed = ide_max_dma_mode(drive); |
226 | 210 | ||
227 | if (!speed) | 211 | if (!speed) |
228 | return 0; | 212 | return 0; |