diff options
author | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2007-07-09 17:17:57 -0400 |
---|---|---|
committer | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2007-07-09 17:17:57 -0400 |
commit | 75b1d97535327d0428c6bffd9d5407e65546fd5d (patch) | |
tree | 3271a13a27ed2a7896b7018bc2fceac62eba1b2e /drivers/ide/ide-timing.h | |
parent | 15a4f943e729d8ba215ee551df6d7988ba14ac00 (diff) |
ide: convert ide_find_best_mode() users to use ide_max_dma_mode()
ide-timing.h:
* remove handling of DMA modes from ide_find_best_mode() and rename it to
ide_find_best_pio_mode()
* drop no longer needed "map" argument from ide_find_best_pio_mode()
and delete needless ->id check
* remove no longer needed XFER_SWDMA and XFER_UDMA* defines
au1xxx-ide.c:
* use ide_max_dma_mode() instead of ide_find_best_mode()
* remove needless CONFIG_BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA #ifdef
amd74xx.c:
* store UDMA masks in amd_ide_chip[] and while at it make "base" field
to be u8 instead of unsigned long
* convert the driver to use UDMA masks from amd_ide_chip[]
* use ide_max_dma_mode() and ide_find_best_pio_mode() instead
of ide_find_best_mode()
* delete stale comment from amd74xx_ide_dma_check()
* remove no longer needed AMD_UDMA* defines
via82cxxx.c:
* remove unused DISPLAY_VIA_TIMINGS define
* store UDMA masks in via_isa_bridges[] and while at it make "flags" field
to be u8 instead of u16
* convert the driver to use UDMA masks from via_isa_bridges[]
* use ide_max_dma_mode() and ide_find_best_pio_mode() instead
of ide_find_best_mode()
* remove no longer needed VIA_UDMA* defines
pmac.c:
* use ide_max_dma_mode() instead of ide_find_best_mode()
There should be no functionality changes caused by this patch.
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Reviewed-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Diffstat (limited to 'drivers/ide/ide-timing.h')
-rw-r--r-- | drivers/ide/ide-timing.h | 56 |
1 files changed, 3 insertions, 53 deletions
diff --git a/drivers/ide/ide-timing.h b/drivers/ide/ide-timing.h index c0864b1e922..e6cb8593b5b 100644 --- a/drivers/ide/ide-timing.h +++ b/drivers/ide/ide-timing.h | |||
@@ -102,66 +102,16 @@ static struct ide_timing ide_timing[] = { | |||
102 | #define EZ(v,unit) ((v)?ENOUGH(v,unit):0) | 102 | #define EZ(v,unit) ((v)?ENOUGH(v,unit):0) |
103 | 103 | ||
104 | #define XFER_MODE 0xf0 | 104 | #define XFER_MODE 0xf0 |
105 | #define XFER_UDMA_133 0x48 | ||
106 | #define XFER_UDMA_100 0x44 | ||
107 | #define XFER_UDMA_66 0x42 | ||
108 | #define XFER_UDMA 0x40 | ||
109 | #define XFER_MWDMA 0x20 | 105 | #define XFER_MWDMA 0x20 |
110 | #define XFER_SWDMA 0x10 | ||
111 | #define XFER_EPIO 0x01 | 106 | #define XFER_EPIO 0x01 |
112 | #define XFER_PIO 0x00 | 107 | #define XFER_PIO 0x00 |
113 | 108 | ||
114 | static short ide_find_best_mode(ide_drive_t *drive, int map) | 109 | static short ide_find_best_pio_mode(ide_drive_t *drive) |
115 | { | 110 | { |
116 | struct hd_driveid *id = drive->id; | 111 | struct hd_driveid *id = drive->id; |
117 | short best = 0; | 112 | short best = 0; |
118 | 113 | ||
119 | if (!id) | 114 | if (id->field_valid & 2) { /* EIDE PIO modes */ |
120 | return XFER_PIO_SLOW; | ||
121 | |||
122 | if ((map & XFER_UDMA) && (id->field_valid & 4)) { /* Want UDMA and UDMA bitmap valid */ | ||
123 | |||
124 | if ((map & XFER_UDMA_133) == XFER_UDMA_133) | ||
125 | if ((best = (id->dma_ultra & 0x0040) ? XFER_UDMA_6 : 0)) return best; | ||
126 | |||
127 | if ((map & XFER_UDMA_100) == XFER_UDMA_100) | ||
128 | if ((best = (id->dma_ultra & 0x0020) ? XFER_UDMA_5 : 0)) return best; | ||
129 | |||
130 | if ((map & XFER_UDMA_66) == XFER_UDMA_66) | ||
131 | if ((best = (id->dma_ultra & 0x0010) ? XFER_UDMA_4 : | ||
132 | (id->dma_ultra & 0x0008) ? XFER_UDMA_3 : 0)) return best; | ||
133 | |||
134 | if ((best = (id->dma_ultra & 0x0004) ? XFER_UDMA_2 : | ||
135 | (id->dma_ultra & 0x0002) ? XFER_UDMA_1 : | ||
136 | (id->dma_ultra & 0x0001) ? XFER_UDMA_0 : 0)) return best; | ||
137 | } | ||
138 | |||
139 | if ((map & XFER_MWDMA) && (id->field_valid & 2)) { /* Want MWDMA and drive has EIDE fields */ | ||
140 | |||
141 | if ((best = (id->dma_mword & 0x0004) ? XFER_MW_DMA_2 : | ||
142 | (id->dma_mword & 0x0002) ? XFER_MW_DMA_1 : | ||
143 | (id->dma_mword & 0x0001) ? XFER_MW_DMA_0 : 0)) return best; | ||
144 | } | ||
145 | |||
146 | if (map & XFER_SWDMA) { /* Want SWDMA */ | ||
147 | |||
148 | if (id->field_valid & 2) { /* EIDE SWDMA */ | ||
149 | |||
150 | if ((best = (id->dma_1word & 0x0004) ? XFER_SW_DMA_2 : | ||
151 | (id->dma_1word & 0x0002) ? XFER_SW_DMA_1 : | ||
152 | (id->dma_1word & 0x0001) ? XFER_SW_DMA_0 : 0)) return best; | ||
153 | } | ||
154 | |||
155 | if (id->capability & 1) { /* Pre-EIDE style SWDMA */ | ||
156 | |||
157 | if ((best = (id->tDMA == 2) ? XFER_SW_DMA_2 : | ||
158 | (id->tDMA == 1) ? XFER_SW_DMA_1 : | ||
159 | (id->tDMA == 0) ? XFER_SW_DMA_0 : 0)) return best; | ||
160 | } | ||
161 | } | ||
162 | |||
163 | |||
164 | if ((map & XFER_EPIO) && (id->field_valid & 2)) { /* EIDE PIO modes */ | ||
165 | 115 | ||
166 | if ((best = (drive->id->eide_pio_modes & 4) ? XFER_PIO_5 : | 116 | if ((best = (drive->id->eide_pio_modes & 4) ? XFER_PIO_5 : |
167 | (drive->id->eide_pio_modes & 2) ? XFER_PIO_4 : | 117 | (drive->id->eide_pio_modes & 2) ? XFER_PIO_4 : |
@@ -262,7 +212,7 @@ static int ide_timing_compute(ide_drive_t *drive, short speed, struct ide_timing | |||
262 | */ | 212 | */ |
263 | 213 | ||
264 | if ((speed & XFER_MODE) != XFER_PIO) { | 214 | if ((speed & XFER_MODE) != XFER_PIO) { |
265 | ide_timing_compute(drive, ide_find_best_mode(drive, XFER_PIO | XFER_EPIO), &p, T, UT); | 215 | ide_timing_compute(drive, ide_find_best_pio_mode(drive), &p, T, UT); |
266 | ide_timing_merge(&p, t, t, IDE_TIMING_ALL); | 216 | ide_timing_merge(&p, t, t, IDE_TIMING_ALL); |
267 | } | 217 | } |
268 | 218 | ||