aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/ide/ide-dma.c5
-rw-r--r--drivers/ide/ide-lib.c12
-rw-r--r--drivers/ide/pci/cmd64x.c15
-rw-r--r--drivers/ide/pci/cs5530.c8
-rw-r--r--drivers/ide/pci/sc1200.c8
-rw-r--r--drivers/ide/pci/scc_pata.c22
-rw-r--r--drivers/ide/pci/siimage.c24
-rw-r--r--drivers/ide/pci/sl82c105.c17
-rw-r--r--include/linux/ide.h1
9 files changed, 11 insertions, 101 deletions
diff --git a/drivers/ide/ide-dma.c b/drivers/ide/ide-dma.c
index 5fe85191d49c..de33e6f88f17 100644
--- a/drivers/ide/ide-dma.c
+++ b/drivers/ide/ide-dma.c
@@ -792,9 +792,10 @@ int ide_tune_dma(ide_drive_t *drive)
792 if (!speed) 792 if (!speed)
793 return 0; 793 return 0;
794 794
795 drive->hwif->speedproc(drive, speed); 795 if (drive->hwif->speedproc(drive, speed))
796 return 0;
796 797
797 return ide_dma_enable(drive); 798 return 1;
798} 799}
799 800
800EXPORT_SYMBOL_GPL(ide_tune_dma); 801EXPORT_SYMBOL_GPL(ide_tune_dma);
diff --git a/drivers/ide/ide-lib.c b/drivers/ide/ide-lib.c
index 3be3c69383f2..074bb32a4a40 100644
--- a/drivers/ide/ide-lib.c
+++ b/drivers/ide/ide-lib.c
@@ -111,18 +111,6 @@ u8 ide_rate_filter(ide_drive_t *drive, u8 speed)
111 111
112EXPORT_SYMBOL(ide_rate_filter); 112EXPORT_SYMBOL(ide_rate_filter);
113 113
114int ide_dma_enable (ide_drive_t *drive)
115{
116 ide_hwif_t *hwif = HWIF(drive);
117 struct hd_driveid *id = drive->id;
118
119 return ((int) ((((id->dma_ultra >> 8) & hwif->ultra_mask) ||
120 ((id->dma_mword >> 8) & hwif->mwdma_mask) ||
121 ((id->dma_1word >> 8) & hwif->swdma_mask)) ? 1 : 0));
122}
123
124EXPORT_SYMBOL(ide_dma_enable);
125
126int ide_use_fast_pio(ide_drive_t *drive) 114int ide_use_fast_pio(ide_drive_t *drive)
127{ 115{
128 struct hd_driveid *id = drive->id; 116 struct hd_driveid *id = drive->id;
diff --git a/drivers/ide/pci/cmd64x.c b/drivers/ide/pci/cmd64x.c
index 61ea96b5555c..7c57dc696f52 100644
--- a/drivers/ide/pci/cmd64x.c
+++ b/drivers/ide/pci/cmd64x.c
@@ -352,22 +352,9 @@ static int cmd64x_tune_chipset (ide_drive_t *drive, u8 speed)
352 return ide_config_drive_speed(drive, speed); 352 return ide_config_drive_speed(drive, speed);
353} 353}
354 354
355static int config_chipset_for_dma (ide_drive_t *drive)
356{
357 u8 speed = ide_max_dma_mode(drive);
358
359 if (!speed)
360 return 0;
361
362 if (cmd64x_tune_chipset(drive, speed))
363 return 0;
364
365 return ide_dma_enable(drive);
366}
367
368static int cmd64x_config_drive_for_dma (ide_drive_t *drive) 355static int cmd64x_config_drive_for_dma (ide_drive_t *drive)
369{ 356{
370 if (ide_use_dma(drive) && config_chipset_for_dma(drive)) 357 if (ide_tune_dma(drive))
371 return 0; 358 return 0;
372 359
373 if (ide_use_fast_pio(drive)) 360 if (ide_use_fast_pio(drive))
diff --git a/drivers/ide/pci/cs5530.c b/drivers/ide/pci/cs5530.c
index aacb79b4a9cd..1eec1f308d16 100644
--- a/drivers/ide/pci/cs5530.c
+++ b/drivers/ide/pci/cs5530.c
@@ -137,12 +137,8 @@ out:
137 137
138static int cs5530_config_dma(ide_drive_t *drive) 138static int cs5530_config_dma(ide_drive_t *drive)
139{ 139{
140 if (ide_use_dma(drive)) { 140 if (ide_tune_dma(drive))
141 u8 mode = ide_max_dma_mode(drive); 141 return 0;
142
143 if (mode && drive->hwif->speedproc(drive, mode) == 0)
144 return 0;
145 }
146 142
147 return 1; 143 return 1;
148} 144}
diff --git a/drivers/ide/pci/sc1200.c b/drivers/ide/pci/sc1200.c
index c989fd90f377..523363c93794 100644
--- a/drivers/ide/pci/sc1200.c
+++ b/drivers/ide/pci/sc1200.c
@@ -240,12 +240,8 @@ static int sc1200_tune_chipset(ide_drive_t *drive, u8 mode)
240 */ 240 */
241static int sc1200_config_dma (ide_drive_t *drive) 241static int sc1200_config_dma (ide_drive_t *drive)
242{ 242{
243 if (ide_use_dma(drive)) { 243 if (ide_tune_dma(drive))
244 u8 mode = ide_max_dma_mode(drive); 244 return 0;
245
246 if (mode && drive->hwif->speedproc(drive, mode) == 0)
247 return 0;
248 }
249 245
250 return 1; 246 return 1;
251} 247}
diff --git a/drivers/ide/pci/scc_pata.c b/drivers/ide/pci/scc_pata.c
index cbf936325355..55bc0a32e34f 100644
--- a/drivers/ide/pci/scc_pata.c
+++ b/drivers/ide/pci/scc_pata.c
@@ -322,26 +322,6 @@ static int scc_tune_chipset(ide_drive_t *drive, byte xferspeed)
322} 322}
323 323
324/** 324/**
325 * scc_config_chipset_for_dma - configure for DMA
326 * @drive: drive to configure
327 *
328 * Called by scc_config_drive_for_dma().
329 */
330
331static int scc_config_chipset_for_dma(ide_drive_t *drive)
332{
333 u8 speed = ide_max_dma_mode(drive);
334
335 if (!speed)
336 return 0;
337
338 if (scc_tune_chipset(drive, speed))
339 return 0;
340
341 return ide_dma_enable(drive);
342}
343
344/**
345 * scc_configure_drive_for_dma - set up for DMA transfers 325 * scc_configure_drive_for_dma - set up for DMA transfers
346 * @drive: drive we are going to set up 326 * @drive: drive we are going to set up
347 * 327 *
@@ -354,7 +334,7 @@ static int scc_config_chipset_for_dma(ide_drive_t *drive)
354 334
355static int scc_config_drive_for_dma(ide_drive_t *drive) 335static int scc_config_drive_for_dma(ide_drive_t *drive)
356{ 336{
357 if (ide_use_dma(drive) && scc_config_chipset_for_dma(drive)) 337 if (ide_tune_dma(drive))
358 return 0; 338 return 0;
359 339
360 if (ide_use_fast_pio(drive)) 340 if (ide_use_fast_pio(drive))
diff --git a/drivers/ide/pci/siimage.c b/drivers/ide/pci/siimage.c
index d09e74c2996e..1a4444e7226a 100644
--- a/drivers/ide/pci/siimage.c
+++ b/drivers/ide/pci/siimage.c
@@ -375,28 +375,6 @@ static int siimage_tune_chipset (ide_drive_t *drive, byte xferspeed)
375} 375}
376 376
377/** 377/**
378 * config_chipset_for_dma - configure for DMA
379 * @drive: drive to configure
380 *
381 * Called by the IDE layer when it wants the timings set up.
382 * For the CMD680 we also need to set up the PIO timings and
383 * enable DMA.
384 */
385
386static int config_chipset_for_dma (ide_drive_t *drive)
387{
388 u8 speed = ide_max_dma_mode(drive);
389
390 if (!speed)
391 return 0;
392
393 if (siimage_tune_chipset(drive, speed))
394 return 0;
395
396 return ide_dma_enable(drive);
397}
398
399/**
400 * siimage_configure_drive_for_dma - set up for DMA transfers 378 * siimage_configure_drive_for_dma - set up for DMA transfers
401 * @drive: drive we are going to set up 379 * @drive: drive we are going to set up
402 * 380 *
@@ -408,7 +386,7 @@ static int config_chipset_for_dma (ide_drive_t *drive)
408 386
409static int siimage_config_drive_for_dma (ide_drive_t *drive) 387static int siimage_config_drive_for_dma (ide_drive_t *drive)
410{ 388{
411 if (ide_use_dma(drive) && config_chipset_for_dma(drive)) 389 if (ide_tune_dma(drive))
412 return 0; 390 return 0;
413 391
414 if (ide_use_fast_pio(drive)) 392 if (ide_use_fast_pio(drive))
diff --git a/drivers/ide/pci/sl82c105.c b/drivers/ide/pci/sl82c105.c
index 3d7759c361ff..ac1ec170fd26 100644
--- a/drivers/ide/pci/sl82c105.c
+++ b/drivers/ide/pci/sl82c105.c
@@ -159,28 +159,13 @@ static int sl82c105_tune_chipset(ide_drive_t *drive, u8 speed)
159} 159}
160 160
161/* 161/*
162 * Configure the drive for DMA.
163 */
164static int config_for_dma(ide_drive_t *drive)
165{
166 u8 speed = ide_max_dma_mode(drive);
167
168 DBG(("config_for_dma(drive:%s)\n", drive->name));
169
170 if (!speed || sl82c105_tune_chipset(drive, speed))
171 return 0;
172
173 return ide_dma_enable(drive);
174}
175
176/*
177 * Check to see if the drive and chipset are capable of DMA mode. 162 * Check to see if the drive and chipset are capable of DMA mode.
178 */ 163 */
179static int sl82c105_ide_dma_check(ide_drive_t *drive) 164static int sl82c105_ide_dma_check(ide_drive_t *drive)
180{ 165{
181 DBG(("sl82c105_ide_dma_check(drive:%s)\n", drive->name)); 166 DBG(("sl82c105_ide_dma_check(drive:%s)\n", drive->name));
182 167
183 if (ide_use_dma(drive) && config_for_dma(drive)) 168 if (ide_tune_dma(drive))
184 return 0; 169 return 0;
185 170
186 return -1; 171 return -1;
diff --git a/include/linux/ide.h b/include/linux/ide.h
index df4e6a510310..be789613007d 100644
--- a/include/linux/ide.h
+++ b/include/linux/ide.h
@@ -1357,7 +1357,6 @@ static inline void ide_set_hwifdata (ide_hwif_t * hwif, void *data)
1357 1357
1358/* ide-lib.c */ 1358/* ide-lib.c */
1359u8 ide_rate_filter(ide_drive_t *, u8); 1359u8 ide_rate_filter(ide_drive_t *, u8);
1360extern int ide_dma_enable(ide_drive_t *drive);
1361extern char *ide_xfer_verbose(u8 xfer_rate); 1360extern char *ide_xfer_verbose(u8 xfer_rate);
1362extern void ide_toggle_bounce(ide_drive_t *drive, int on); 1361extern void ide_toggle_bounce(ide_drive_t *drive, int on);
1363extern int ide_set_xfer_rate(ide_drive_t *drive, u8 rate); 1362extern int ide_set_xfer_rate(ide_drive_t *drive, u8 rate);