aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide/ide-lib.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2008-04-26 16:44:19 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2008-04-26 16:44:19 -0400
commita52b0d25a722e84da999005b75f972aa4824253c (patch)
tree4a3a48305f744e6bde2e3fd663a4473dd712049c /drivers/ide/ide-lib.c
parent539a5fe22620a1665cce504167953a71a43232ad (diff)
parentf37afdaca711838b50ecd89b9c15fc745270d77c (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/bart/ide-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/bart/ide-2.6: (46 commits) ide: constify struct ide_dma_ops ide: add struct ide_dma_ops (take 3) ide: add IDE_HFLAG_SERIALIZE_DMA host flag sl82c105: check bridge revision in sl82c105_init_one() au1xxx-ide: use ->init_dma method palm_bk3710: use ->init_dma method sgiioc4: use ->init_dma method icside: use ->init_dma method ide-pmac: use ->init_dma method ide: do complete DMA setup in ->init_dma method (take 2) au1xxx-ide: fix MWDMA support ide: cleanup ide_setup_dma() ide: factor out setting PCI bus-mastering from ide_hwif_setup_dma() ide: export ide_allocate_dma_engine() ide: move ide_setup_dma() call out from ->init_dma method alim15x3: skip DMA initialization completely on revs < 0x20 pdc202xx_old: remove init_dma_pdc202xx() ide: don't display "BIOS" settings in ide_setup_dma() ide: remove ->cds field from ide_hwif_t (take 2) ide: remove ide_dma_iobase() ...
Diffstat (limited to 'drivers/ide/ide-lib.c')
-rw-r--r--drivers/ide/ide-lib.c26
1 files changed, 15 insertions, 11 deletions
diff --git a/drivers/ide/ide-lib.c b/drivers/ide/ide-lib.c
index c859de77aa8f..6f04ea3e93a8 100644
--- a/drivers/ide/ide-lib.c
+++ b/drivers/ide/ide-lib.c
@@ -85,7 +85,7 @@ static u8 ide_rate_filter(ide_drive_t *drive, u8 speed)
85 mode = XFER_PIO_4; 85 mode = XFER_PIO_4;
86 } 86 }
87 87
88// printk("%s: mode 0x%02x, speed 0x%02x\n", __FUNCTION__, mode, speed); 88/* printk("%s: mode 0x%02x, speed 0x%02x\n", __func__, mode, speed); */
89 89
90 return min(speed, mode); 90 return min(speed, mode);
91} 91}
@@ -288,9 +288,10 @@ EXPORT_SYMBOL_GPL(ide_get_best_pio_mode);
288void ide_set_pio(ide_drive_t *drive, u8 req_pio) 288void ide_set_pio(ide_drive_t *drive, u8 req_pio)
289{ 289{
290 ide_hwif_t *hwif = drive->hwif; 290 ide_hwif_t *hwif = drive->hwif;
291 const struct ide_port_ops *port_ops = hwif->port_ops;
291 u8 host_pio, pio; 292 u8 host_pio, pio;
292 293
293 if (hwif->set_pio_mode == NULL || 294 if (port_ops == NULL || port_ops->set_pio_mode == NULL ||
294 (hwif->host_flags & IDE_HFLAG_NO_SET_MODE)) 295 (hwif->host_flags & IDE_HFLAG_NO_SET_MODE))
295 return; 296 return;
296 297
@@ -343,29 +344,30 @@ void ide_toggle_bounce(ide_drive_t *drive, int on)
343int ide_set_pio_mode(ide_drive_t *drive, const u8 mode) 344int ide_set_pio_mode(ide_drive_t *drive, const u8 mode)
344{ 345{
345 ide_hwif_t *hwif = drive->hwif; 346 ide_hwif_t *hwif = drive->hwif;
347 const struct ide_port_ops *port_ops = hwif->port_ops;
346 348
347 if (hwif->host_flags & IDE_HFLAG_NO_SET_MODE) 349 if (hwif->host_flags & IDE_HFLAG_NO_SET_MODE)
348 return 0; 350 return 0;
349 351
350 if (hwif->set_pio_mode == NULL) 352 if (port_ops == NULL || port_ops->set_pio_mode == NULL)
351 return -1; 353 return -1;
352 354
353 /* 355 /*
354 * TODO: temporary hack for some legacy host drivers that didn't 356 * TODO: temporary hack for some legacy host drivers that didn't
355 * set transfer mode on the device in ->set_pio_mode method... 357 * set transfer mode on the device in ->set_pio_mode method...
356 */ 358 */
357 if (hwif->set_dma_mode == NULL) { 359 if (port_ops->set_dma_mode == NULL) {
358 hwif->set_pio_mode(drive, mode - XFER_PIO_0); 360 port_ops->set_pio_mode(drive, mode - XFER_PIO_0);
359 return 0; 361 return 0;
360 } 362 }
361 363
362 if (hwif->host_flags & IDE_HFLAG_POST_SET_MODE) { 364 if (hwif->host_flags & IDE_HFLAG_POST_SET_MODE) {
363 if (ide_config_drive_speed(drive, mode)) 365 if (ide_config_drive_speed(drive, mode))
364 return -1; 366 return -1;
365 hwif->set_pio_mode(drive, mode - XFER_PIO_0); 367 port_ops->set_pio_mode(drive, mode - XFER_PIO_0);
366 return 0; 368 return 0;
367 } else { 369 } else {
368 hwif->set_pio_mode(drive, mode - XFER_PIO_0); 370 port_ops->set_pio_mode(drive, mode - XFER_PIO_0);
369 return ide_config_drive_speed(drive, mode); 371 return ide_config_drive_speed(drive, mode);
370 } 372 }
371} 373}
@@ -373,20 +375,21 @@ int ide_set_pio_mode(ide_drive_t *drive, const u8 mode)
373int ide_set_dma_mode(ide_drive_t *drive, const u8 mode) 375int ide_set_dma_mode(ide_drive_t *drive, const u8 mode)
374{ 376{
375 ide_hwif_t *hwif = drive->hwif; 377 ide_hwif_t *hwif = drive->hwif;
378 const struct ide_port_ops *port_ops = hwif->port_ops;
376 379
377 if (hwif->host_flags & IDE_HFLAG_NO_SET_MODE) 380 if (hwif->host_flags & IDE_HFLAG_NO_SET_MODE)
378 return 0; 381 return 0;
379 382
380 if (hwif->set_dma_mode == NULL) 383 if (port_ops == NULL || port_ops->set_dma_mode == NULL)
381 return -1; 384 return -1;
382 385
383 if (hwif->host_flags & IDE_HFLAG_POST_SET_MODE) { 386 if (hwif->host_flags & IDE_HFLAG_POST_SET_MODE) {
384 if (ide_config_drive_speed(drive, mode)) 387 if (ide_config_drive_speed(drive, mode))
385 return -1; 388 return -1;
386 hwif->set_dma_mode(drive, mode); 389 port_ops->set_dma_mode(drive, mode);
387 return 0; 390 return 0;
388 } else { 391 } else {
389 hwif->set_dma_mode(drive, mode); 392 port_ops->set_dma_mode(drive, mode);
390 return ide_config_drive_speed(drive, mode); 393 return ide_config_drive_speed(drive, mode);
391 } 394 }
392} 395}
@@ -406,8 +409,9 @@ EXPORT_SYMBOL_GPL(ide_set_dma_mode);
406int ide_set_xfer_rate(ide_drive_t *drive, u8 rate) 409int ide_set_xfer_rate(ide_drive_t *drive, u8 rate)
407{ 410{
408 ide_hwif_t *hwif = drive->hwif; 411 ide_hwif_t *hwif = drive->hwif;
412 const struct ide_port_ops *port_ops = hwif->port_ops;
409 413
410 if (hwif->set_dma_mode == NULL || 414 if (port_ops == NULL || port_ops->set_dma_mode == NULL ||
411 (hwif->host_flags & IDE_HFLAG_NO_SET_MODE)) 415 (hwif->host_flags & IDE_HFLAG_NO_SET_MODE))
412 return -1; 416 return -1;
413 417