aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/ide/ide-dma.c20
-rw-r--r--drivers/ide/pci/aec62xx.c13
-rw-r--r--drivers/ide/pci/atiixp.c22
-rw-r--r--drivers/ide/pci/cs5535.c15
-rw-r--r--drivers/ide/pci/hpt34x.c20
-rw-r--r--drivers/ide/pci/hpt366.c20
-rw-r--r--drivers/ide/pci/it8213.c21
-rw-r--r--drivers/ide/pci/jmicron.c21
-rw-r--r--drivers/ide/pci/piix.c26
-rw-r--r--drivers/ide/pci/sis5513.c21
-rw-r--r--drivers/ide/pci/slc90e66.c13
-rw-r--r--drivers/ide/pci/tc86c001.c13
-rw-r--r--drivers/ide/pci/triflex.c13
-rw-r--r--include/linux/ide.h2
14 files changed, 34 insertions, 206 deletions
diff --git a/drivers/ide/ide-dma.c b/drivers/ide/ide-dma.c
index f28fabb791fe..5fe85191d49c 100644
--- a/drivers/ide/ide-dma.c
+++ b/drivers/ide/ide-dma.c
@@ -779,6 +779,26 @@ u8 ide_max_dma_mode(ide_drive_t *drive)
779 779
780EXPORT_SYMBOL_GPL(ide_max_dma_mode); 780EXPORT_SYMBOL_GPL(ide_max_dma_mode);
781 781
782int ide_tune_dma(ide_drive_t *drive)
783{
784 u8 speed;
785
786 /* TODO: use only ide_max_dma_mode() */
787 if (!ide_use_dma(drive))
788 return 0;
789
790 speed = ide_max_dma_mode(drive);
791
792 if (!speed)
793 return 0;
794
795 drive->hwif->speedproc(drive, speed);
796
797 return ide_dma_enable(drive);
798}
799
800EXPORT_SYMBOL_GPL(ide_tune_dma);
801
782void ide_dma_verbose(ide_drive_t *drive) 802void ide_dma_verbose(ide_drive_t *drive)
783{ 803{
784 struct hd_driveid *id = drive->id; 804 struct hd_driveid *id = drive->id;
diff --git a/drivers/ide/pci/aec62xx.c b/drivers/ide/pci/aec62xx.c
index 099539e8c7a3..b173bc66ce1e 100644
--- a/drivers/ide/pci/aec62xx.c
+++ b/drivers/ide/pci/aec62xx.c
@@ -155,17 +155,6 @@ static int aec62xx_tune_chipset (ide_drive_t *drive, u8 speed)
155 } 155 }
156} 156}
157 157
158static int config_chipset_for_dma (ide_drive_t *drive)
159{
160 u8 speed = ide_max_dma_mode(drive);
161
162 if (!(speed))
163 return 0;
164
165 (void) aec62xx_tune_chipset(drive, speed);
166 return ide_dma_enable(drive);
167}
168
169static void aec62xx_tune_drive (ide_drive_t *drive, u8 pio) 158static void aec62xx_tune_drive (ide_drive_t *drive, u8 pio)
170{ 159{
171 pio = ide_get_best_pio_mode(drive, pio, 4, NULL); 160 pio = ide_get_best_pio_mode(drive, pio, 4, NULL);
@@ -174,7 +163,7 @@ static void aec62xx_tune_drive (ide_drive_t *drive, u8 pio)
174 163
175static int aec62xx_config_drive_xfer_rate (ide_drive_t *drive) 164static int aec62xx_config_drive_xfer_rate (ide_drive_t *drive)
176{ 165{
177 if (ide_use_dma(drive) && config_chipset_for_dma(drive)) 166 if (ide_tune_dma(drive))
178 return 0; 167 return 0;
179 168
180 if (ide_use_fast_pio(drive)) 169 if (ide_use_fast_pio(drive))
diff --git a/drivers/ide/pci/atiixp.c b/drivers/ide/pci/atiixp.c
index f7e80d6076d7..0e52ad722a72 100644
--- a/drivers/ide/pci/atiixp.c
+++ b/drivers/ide/pci/atiixp.c
@@ -207,26 +207,6 @@ static int atiixp_speedproc(ide_drive_t *drive, u8 xferspeed)
207} 207}
208 208
209/** 209/**
210 * atiixp_config_drive_for_dma - configure drive for DMA
211 * @drive: IDE drive to configure
212 *
213 * Set up a ATIIXP interface channel for the best available speed.
214 * We prefer UDMA if it is available and then MWDMA. If DMA is
215 * not available we switch to PIO and return 0.
216 */
217
218static int atiixp_config_drive_for_dma(ide_drive_t *drive)
219{
220 u8 speed = ide_max_dma_mode(drive);
221
222 if (!speed)
223 return 0;
224
225 (void) atiixp_speedproc(drive, speed);
226 return ide_dma_enable(drive);
227}
228
229/**
230 * atiixp_dma_check - set up an IDE device 210 * atiixp_dma_check - set up an IDE device
231 * @drive: IDE drive to configure 211 * @drive: IDE drive to configure
232 * 212 *
@@ -240,7 +220,7 @@ static int atiixp_dma_check(ide_drive_t *drive)
240 220
241 drive->init_speed = 0; 221 drive->init_speed = 0;
242 222
243 if (ide_use_dma(drive) && atiixp_config_drive_for_dma(drive)) 223 if (ide_tune_dma(drive))
244 return 0; 224 return 0;
245 225
246 if (ide_use_fast_pio(drive)) { 226 if (ide_use_fast_pio(drive)) {
diff --git a/drivers/ide/pci/cs5535.c b/drivers/ide/pci/cs5535.c
index 66a101e470d0..41925c47ef05 100644
--- a/drivers/ide/pci/cs5535.c
+++ b/drivers/ide/pci/cs5535.c
@@ -164,26 +164,13 @@ static void cs5535_tuneproc(ide_drive_t *drive, u8 xferspeed)
164 cs5535_set_speed(drive, xferspeed); 164 cs5535_set_speed(drive, xferspeed);
165} 165}
166 166
167static int cs5535_config_drive_for_dma(ide_drive_t *drive)
168{
169 u8 speed = ide_max_dma_mode(drive);
170
171 /* If no DMA speed was available then let dma_check hit pio */
172 if (!speed) {
173 return 0;
174 }
175
176 cs5535_set_drive(drive, speed);
177 return ide_dma_enable(drive);
178}
179
180static int cs5535_dma_check(ide_drive_t *drive) 167static int cs5535_dma_check(ide_drive_t *drive)
181{ 168{
182 u8 speed; 169 u8 speed;
183 170
184 drive->init_speed = 0; 171 drive->init_speed = 0;
185 172
186 if (ide_use_dma(drive) && cs5535_config_drive_for_dma(drive)) 173 if (ide_tune_dma(drive))
187 return 0; 174 return 0;
188 175
189 if (ide_use_fast_pio(drive)) { 176 if (ide_use_fast_pio(drive)) {
diff --git a/drivers/ide/pci/hpt34x.c b/drivers/ide/pci/hpt34x.c
index 473e1b33dbf7..2c24c3de8846 100644
--- a/drivers/ide/pci/hpt34x.c
+++ b/drivers/ide/pci/hpt34x.c
@@ -84,29 +84,11 @@ static void hpt34x_tune_drive (ide_drive_t *drive, u8 pio)
84 (void) hpt34x_tune_chipset(drive, (XFER_PIO_0 + pio)); 84 (void) hpt34x_tune_chipset(drive, (XFER_PIO_0 + pio));
85} 85}
86 86
87/*
88 * This allows the configuration of ide_pci chipset registers
89 * for cards that learn about the drive's UDMA, DMA, PIO capabilities
90 * after the drive is reported by the OS. Initially for designed for
91 * HPT343 UDMA chipset by HighPoint|Triones Technologies, Inc.
92 */
93
94static int config_chipset_for_dma (ide_drive_t *drive)
95{
96 u8 speed = ide_max_dma_mode(drive);
97
98 if (!(speed))
99 return 0;
100
101 (void) hpt34x_tune_chipset(drive, speed);
102 return ide_dma_enable(drive);
103}
104
105static int hpt34x_config_drive_xfer_rate (ide_drive_t *drive) 87static int hpt34x_config_drive_xfer_rate (ide_drive_t *drive)
106{ 88{
107 drive->init_speed = 0; 89 drive->init_speed = 0;
108 90
109 if (ide_use_dma(drive) && config_chipset_for_dma(drive)) 91 if (ide_tune_dma(drive))
110#ifndef CONFIG_HPT34X_AUTODMA 92#ifndef CONFIG_HPT34X_AUTODMA
111 return -1; 93 return -1;
112#else 94#else
diff --git a/drivers/ide/pci/hpt366.c b/drivers/ide/pci/hpt366.c
index de5ad9c35dc6..fcbc5605b38e 100644
--- a/drivers/ide/pci/hpt366.c
+++ b/drivers/ide/pci/hpt366.c
@@ -669,24 +669,6 @@ static void hpt3xx_tune_drive(ide_drive_t *drive, u8 pio)
669 (void) hpt3xx_tune_chipset (drive, XFER_PIO_0 + pio); 669 (void) hpt3xx_tune_chipset (drive, XFER_PIO_0 + pio);
670} 670}
671 671
672/*
673 * This allows the configuration of ide_pci chipset registers
674 * for cards that learn about the drive's UDMA, DMA, PIO capabilities
675 * after the drive is reported by the OS. Initially designed for
676 * HPT366 UDMA chipset by HighPoint|Triones Technologies, Inc.
677 *
678 */
679static int config_chipset_for_dma(ide_drive_t *drive)
680{
681 u8 speed = ide_max_dma_mode(drive);
682
683 if (!speed)
684 return 0;
685
686 (void) hpt3xx_tune_chipset(drive, speed);
687 return ide_dma_enable(drive);
688}
689
690static int hpt3xx_quirkproc(ide_drive_t *drive) 672static int hpt3xx_quirkproc(ide_drive_t *drive)
691{ 673{
692 struct hd_driveid *id = drive->id; 674 struct hd_driveid *id = drive->id;
@@ -741,7 +723,7 @@ static int hpt366_config_drive_xfer_rate(ide_drive_t *drive)
741{ 723{
742 drive->init_speed = 0; 724 drive->init_speed = 0;
743 725
744 if (ide_use_dma(drive) && config_chipset_for_dma(drive)) 726 if (ide_tune_dma(drive))
745 return 0; 727 return 0;
746 728
747 if (ide_use_fast_pio(drive)) 729 if (ide_use_fast_pio(drive))
diff --git a/drivers/ide/pci/it8213.c b/drivers/ide/pci/it8213.c
index 02b56cb7bb1b..c04a02687b95 100644
--- a/drivers/ide/pci/it8213.c
+++ b/drivers/ide/pci/it8213.c
@@ -197,25 +197,6 @@ static int it8213_tune_chipset (ide_drive_t *drive, u8 xferspeed)
197 return ide_config_drive_speed(drive, speed); 197 return ide_config_drive_speed(drive, speed);
198} 198}
199 199
200/*
201 * config_chipset_for_dma - configure for DMA
202 * @drive: drive to configure
203 *
204 * Called by the IDE layer when it wants the timings set up.
205 */
206
207static int config_chipset_for_dma (ide_drive_t *drive)
208{
209 u8 speed = ide_max_dma_mode(drive);
210
211 if (!speed)
212 return 0;
213
214 it8213_tune_chipset(drive, speed);
215
216 return ide_dma_enable(drive);
217}
218
219/** 200/**
220 * it8213_configure_drive_for_dma - set up for DMA transfers 201 * it8213_configure_drive_for_dma - set up for DMA transfers
221 * @drive: drive we are going to set up 202 * @drive: drive we are going to set up
@@ -230,7 +211,7 @@ static int it8213_config_drive_for_dma (ide_drive_t *drive)
230{ 211{
231 u8 pio; 212 u8 pio;
232 213
233 if (ide_use_dma(drive) && config_chipset_for_dma(drive)) 214 if (ide_tune_dma(drive))
234 return 0; 215 return 0;
235 216
236 pio = ide_get_best_pio_mode(drive, 255, 4, NULL); 217 pio = ide_get_best_pio_mode(drive, 255, 4, NULL);
diff --git a/drivers/ide/pci/jmicron.c b/drivers/ide/pci/jmicron.c
index dbb3c199cba9..76ed25147229 100644
--- a/drivers/ide/pci/jmicron.c
+++ b/drivers/ide/pci/jmicron.c
@@ -119,25 +119,6 @@ static int jmicron_tune_chipset (ide_drive_t *drive, byte xferspeed)
119} 119}
120 120
121/** 121/**
122 * config_chipset_for_dma - configure for DMA
123 * @drive: drive to configure
124 *
125 * As the JMicron snoops for timings all we actually need to do is
126 * make sure we don't set an invalid mode.
127 */
128
129static int config_chipset_for_dma (ide_drive_t *drive)
130{
131 u8 speed = ide_max_dma_mode(drive);
132
133 if (!speed)
134 return 0;
135
136 jmicron_tune_chipset(drive, speed);
137 return ide_dma_enable(drive);
138}
139
140/**
141 * jmicron_configure_drive_for_dma - set up for DMA transfers 122 * jmicron_configure_drive_for_dma - set up for DMA transfers
142 * @drive: drive we are going to set up 123 * @drive: drive we are going to set up
143 * 124 *
@@ -147,7 +128,7 @@ static int config_chipset_for_dma (ide_drive_t *drive)
147 128
148static int jmicron_config_drive_for_dma (ide_drive_t *drive) 129static int jmicron_config_drive_for_dma (ide_drive_t *drive)
149{ 130{
150 if (ide_use_dma(drive) && config_chipset_for_dma(drive)) 131 if (ide_tune_dma(drive))
151 return 0; 132 return 0;
152 133
153 config_jmicron_chipset_for_pio(drive, 1); 134 config_jmicron_chipset_for_pio(drive, 1);
diff --git a/drivers/ide/pci/piix.c b/drivers/ide/pci/piix.c
index 84d3938a430a..8b219dd63024 100644
--- a/drivers/ide/pci/piix.c
+++ b/drivers/ide/pci/piix.c
@@ -304,30 +304,6 @@ static int piix_tune_chipset (ide_drive_t *drive, u8 xferspeed)
304} 304}
305 305
306/** 306/**
307 * piix_config_drive_for_dma - configure drive for DMA
308 * @drive: IDE drive to configure
309 *
310 * Set up a PIIX interface channel for the best available speed.
311 * We prefer UDMA if it is available and then MWDMA. If DMA is
312 * not available we switch to PIO and return 0.
313 */
314
315static int piix_config_drive_for_dma (ide_drive_t *drive)
316{
317 u8 speed = ide_max_dma_mode(drive);
318
319 /*
320 * If no DMA speed was available or the chipset has DMA bugs
321 * then disable DMA and use PIO
322 */
323 if (!speed)
324 return 0;
325
326 (void) piix_tune_chipset(drive, speed);
327 return ide_dma_enable(drive);
328}
329
330/**
331 * piix_config_drive_xfer_rate - set up an IDE device 307 * piix_config_drive_xfer_rate - set up an IDE device
332 * @drive: IDE drive to configure 308 * @drive: IDE drive to configure
333 * 309 *
@@ -339,7 +315,7 @@ static int piix_config_drive_xfer_rate (ide_drive_t *drive)
339{ 315{
340 drive->init_speed = 0; 316 drive->init_speed = 0;
341 317
342 if (ide_use_dma(drive) && piix_config_drive_for_dma(drive)) 318 if (ide_tune_dma(drive))
343 return 0; 319 return 0;
344 320
345 if (ide_use_fast_pio(drive)) 321 if (ide_use_fast_pio(drive))
diff --git a/drivers/ide/pci/sis5513.c b/drivers/ide/pci/sis5513.c
index 83c80ed73e99..41953fe4fa6b 100644
--- a/drivers/ide/pci/sis5513.c
+++ b/drivers/ide/pci/sis5513.c
@@ -638,32 +638,13 @@ static void sis5513_tune_drive (ide_drive_t *drive, u8 pio)
638 (void) config_chipset_for_pio(drive, pio); 638 (void) config_chipset_for_pio(drive, pio);
639} 639}
640 640
641/*
642 * ((id->hw_config & 0x4000|0x2000) && (HWIF(drive)->udma_four))
643 */
644static int config_chipset_for_dma (ide_drive_t *drive)
645{
646 u8 speed = ide_max_dma_mode(drive);
647
648#ifdef DEBUG
649 printk("SIS5513: config_chipset_for_dma, drive %d, ultra %x\n",
650 drive->dn, drive->id->dma_ultra);
651#endif
652
653 if (!(speed))
654 return 0;
655
656 sis5513_tune_chipset(drive, speed);
657 return ide_dma_enable(drive);
658}
659
660static int sis5513_config_xfer_rate(ide_drive_t *drive) 641static int sis5513_config_xfer_rate(ide_drive_t *drive)
661{ 642{
662 config_art_rwp_pio(drive, 5); 643 config_art_rwp_pio(drive, 5);
663 644
664 drive->init_speed = 0; 645 drive->init_speed = 0;
665 646
666 if (ide_use_dma(drive) && config_chipset_for_dma(drive)) 647 if (ide_tune_dma(drive))
667 return 0; 648 return 0;
668 649
669 if (ide_use_fast_pio(drive)) 650 if (ide_use_fast_pio(drive))
diff --git a/drivers/ide/pci/slc90e66.c b/drivers/ide/pci/slc90e66.c
index 9e95a5cbf984..c40f291f91e0 100644
--- a/drivers/ide/pci/slc90e66.c
+++ b/drivers/ide/pci/slc90e66.c
@@ -160,22 +160,11 @@ static int slc90e66_tune_chipset (ide_drive_t *drive, u8 xferspeed)
160 return ide_config_drive_speed(drive, speed); 160 return ide_config_drive_speed(drive, speed);
161} 161}
162 162
163static int slc90e66_config_drive_for_dma (ide_drive_t *drive)
164{
165 u8 speed = ide_max_dma_mode(drive);
166
167 if (!speed)
168 return 0;
169
170 (void) slc90e66_tune_chipset(drive, speed);
171 return ide_dma_enable(drive);
172}
173
174static int slc90e66_config_drive_xfer_rate (ide_drive_t *drive) 163static int slc90e66_config_drive_xfer_rate (ide_drive_t *drive)
175{ 164{
176 drive->init_speed = 0; 165 drive->init_speed = 0;
177 166
178 if (ide_use_dma(drive) && slc90e66_config_drive_for_dma(drive)) 167 if (ide_tune_dma(drive))
179 return 0; 168 return 0;
180 169
181 if (ide_use_fast_pio(drive)) 170 if (ide_use_fast_pio(drive))
diff --git a/drivers/ide/pci/tc86c001.c b/drivers/ide/pci/tc86c001.c
index 168f035caa3f..cee619bb2eaf 100644
--- a/drivers/ide/pci/tc86c001.c
+++ b/drivers/ide/pci/tc86c001.c
@@ -167,20 +167,9 @@ static int tc86c001_busproc(ide_drive_t *drive, int state)
167 return 0; 167 return 0;
168} 168}
169 169
170static int config_chipset_for_dma(ide_drive_t *drive)
171{
172 u8 speed = ide_max_dma_mode(drive);
173
174 if (!speed)
175 return 0;
176
177 (void) tc86c001_tune_chipset(drive, speed);
178 return ide_dma_enable(drive);
179}
180
181static int tc86c001_config_drive_xfer_rate(ide_drive_t *drive) 170static int tc86c001_config_drive_xfer_rate(ide_drive_t *drive)
182{ 171{
183 if (ide_use_dma(drive) && config_chipset_for_dma(drive)) 172 if (ide_tune_dma(drive))
184 return 0; 173 return 0;
185 174
186 if (ide_use_fast_pio(drive)) 175 if (ide_use_fast_pio(drive))
diff --git a/drivers/ide/pci/triflex.c b/drivers/ide/pci/triflex.c
index 8a877235b949..35e8c612638f 100644
--- a/drivers/ide/pci/triflex.c
+++ b/drivers/ide/pci/triflex.c
@@ -100,20 +100,9 @@ static void triflex_tune_drive(ide_drive_t *drive, u8 pio)
100 (void) triflex_tune_chipset(drive, (XFER_PIO_0 + use_pio)); 100 (void) triflex_tune_chipset(drive, (XFER_PIO_0 + use_pio));
101} 101}
102 102
103static int triflex_config_drive_for_dma(ide_drive_t *drive)
104{
105 u8 speed = ide_max_dma_mode(drive);
106
107 if (!speed)
108 return 0;
109
110 (void) triflex_tune_chipset(drive, speed);
111 return ide_dma_enable(drive);
112}
113
114static int triflex_config_drive_xfer_rate(ide_drive_t *drive) 103static int triflex_config_drive_xfer_rate(ide_drive_t *drive)
115{ 104{
116 if (ide_use_dma(drive) && triflex_config_drive_for_dma(drive)) 105 if (ide_tune_dma(drive))
117 return 0; 106 return 0;
118 107
119 triflex_tune_drive(drive, 255); 108 triflex_tune_drive(drive, 255);
diff --git a/include/linux/ide.h b/include/linux/ide.h
index 23ab4dc05009..d03fa2d5d75a 100644
--- a/include/linux/ide.h
+++ b/include/linux/ide.h
@@ -1277,6 +1277,7 @@ int __ide_dma_bad_drive(ide_drive_t *);
1277int __ide_dma_good_drive(ide_drive_t *); 1277int __ide_dma_good_drive(ide_drive_t *);
1278int ide_use_dma(ide_drive_t *); 1278int ide_use_dma(ide_drive_t *);
1279u8 ide_max_dma_mode(ide_drive_t *); 1279u8 ide_max_dma_mode(ide_drive_t *);
1280int ide_tune_dma(ide_drive_t *);
1280void ide_dma_off(ide_drive_t *); 1281void ide_dma_off(ide_drive_t *);
1281void ide_dma_verbose(ide_drive_t *); 1282void ide_dma_verbose(ide_drive_t *);
1282int ide_set_dma(ide_drive_t *); 1283int ide_set_dma(ide_drive_t *);
@@ -1304,6 +1305,7 @@ extern int __ide_dma_timeout(ide_drive_t *);
1304#else 1305#else
1305static inline int ide_use_dma(ide_drive_t *drive) { return 0; } 1306static inline int ide_use_dma(ide_drive_t *drive) { return 0; }
1306static inline u8 ide_max_dma_mode(ide_drive_t *drive) { return 0; } 1307static inline u8 ide_max_dma_mode(ide_drive_t *drive) { return 0; }
1308static inline int ide_tune_dma(ide_drive_t *drive) { return 0; }
1307static inline void ide_dma_off(ide_drive_t *drive) { ; } 1309static inline void ide_dma_off(ide_drive_t *drive) { ; }
1308static inline void ide_dma_verbose(ide_drive_t *drive) { ; } 1310static inline void ide_dma_verbose(ide_drive_t *drive) { ; }
1309static inline int ide_set_dma(ide_drive_t *drive) { return 1; } 1311static inline int ide_set_dma(ide_drive_t *drive) { return 1; }