diff options
author | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2007-10-13 11:47:51 -0400 |
---|---|---|
committer | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2007-10-13 11:47:51 -0400 |
commit | 88b2b32babd46cd54d2de4d17eb869aea3383e11 (patch) | |
tree | d446864f7c3431f8c428eecacd11caf7b794f018 /drivers/ide/pci/alim15x3.c | |
parent | 6e249395eace037ef139a1c8996b31e3797e412a (diff) |
ide: move ide_config_drive_speed() calls to upper layers (take 2)
* Convert {ide_hwif_t,ide_pci_device_t}->host_flag to be u16.
* Add IDE_HFLAG_POST_SET_MODE host flag to indicate the need to program
the host for the transfer mode after programming the device. Set it
in au1xxx-ide, amd74xx, cs5530, cs5535, pdc202xx_new, sc1200, pmac
and via82cxxx host drivers.
* Add IDE_HFLAG_NO_SET_MODE host flag to indicate the need to completely
skip programming of host/device for the transfer mode ("smart" hosts).
Set it in it821x host driver and check it in ide_tune_dma().
* Add ide_set_pio_mode()/ide_set_dma_mode() helpers and convert all
direct ->set_pio_mode/->speedproc users to use these helpers.
* Move ide_config_drive_speed() calls from ->set_pio_mode/->speedproc
methods to callers.
* Rename ->speedproc method to ->set_dma_mode, make it void and update
all implementations accordingly.
* Update ide_set_xfer_rate() comments.
* Unexport ide_config_drive_speed().
v2:
* Fix issues noticed by Sergei:
- export ide_set_dma_mode() instead of moving ->set_pio_mode abuse wrt
to setting DMA modes from sc1200_set_pio_mode() to do_special()
- check IDE_HFLAG_NO_SET_MODE in ide_tune_dma()
- check for (hwif->set_pio_mode) == NULL in ide_set_pio_mode()
- check for (hwif->set_dma_mode) == NULL in ide_set_dma_mode()
- return -1 from ide_set_{pio,dma}_mode() if ->set_{pio,dma}_mode == NULL
- don't set ->set_{pio,dma}_mode on it821x in "smart" mode
- fix build problem in pmac.c
- minor fixes in au1xxx-ide.c/cs5530.c/siimage.c
- improve patch description
Changes in behavior caused by this patch:
- HDIO_SET_PIO_MODE ioctl would now return -ENOSYS for attempts to change
PIO mode if it821x controller is in "smart" mode
- removal of two debugging printk-s (from cs5530.c and sc1200.c)
- transfer modes 0x00-0x07 passed from user space may be programmed twice on
the device (not really an issue since 0x00 is not supported correctly by
any host driver ATM, 0x01 is not supported at all and 0x02-0x07 are invalid)
Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers/ide/pci/alim15x3.c')
-rw-r--r-- | drivers/ide/pci/alim15x3.c | 33 |
1 files changed, 8 insertions, 25 deletions
diff --git a/drivers/ide/pci/alim15x3.c b/drivers/ide/pci/alim15x3.c index d04b966b4347..88f084eae193 100644 --- a/drivers/ide/pci/alim15x3.c +++ b/drivers/ide/pci/alim15x3.c | |||
@@ -283,14 +283,14 @@ static int ali_get_info (char *buffer, char **addr, off_t offset, int count) | |||
283 | #endif /* defined(DISPLAY_ALI_TIMINGS) && defined(CONFIG_IDE_PROC_FS) */ | 283 | #endif /* defined(DISPLAY_ALI_TIMINGS) && defined(CONFIG_IDE_PROC_FS) */ |
284 | 284 | ||
285 | /** | 285 | /** |
286 | * ali_tune_pio - set host controller for PIO mode | 286 | * ali_set_pio_mode - set host controller for PIO mode |
287 | * @drive: drive | 287 | * @drive: drive |
288 | * @pio: PIO mode number | 288 | * @pio: PIO mode number |
289 | * | 289 | * |
290 | * Program the controller for the given PIO mode. | 290 | * Program the controller for the given PIO mode. |
291 | */ | 291 | */ |
292 | 292 | ||
293 | static void ali_tune_pio(ide_drive_t *drive, const u8 pio) | 293 | static void ali_set_pio_mode(ide_drive_t *drive, const u8 pio) |
294 | { | 294 | { |
295 | ide_hwif_t *hwif = HWIF(drive); | 295 | ide_hwif_t *hwif = HWIF(drive); |
296 | struct pci_dev *dev = hwif->pci_dev; | 296 | struct pci_dev *dev = hwif->pci_dev; |
@@ -358,21 +358,6 @@ static void ali_tune_pio(ide_drive_t *drive, const u8 pio) | |||
358 | } | 358 | } |
359 | 359 | ||
360 | /** | 360 | /** |
361 | * ali_set_pio_mode - set up drive for PIO mode | ||
362 | * @drive: drive to tune | ||
363 | * @pio: desired mode | ||
364 | * | ||
365 | * Program the controller with the desired PIO timing for the given drive. | ||
366 | * Then set up the drive itself. | ||
367 | */ | ||
368 | |||
369 | static void ali_set_pio_mode(ide_drive_t *drive, const u8 pio) | ||
370 | { | ||
371 | ali_tune_pio(drive, pio); | ||
372 | (void) ide_config_drive_speed(drive, XFER_PIO_0 + pio); | ||
373 | } | ||
374 | |||
375 | /** | ||
376 | * ali_udma_filter - compute UDMA mask | 361 | * ali_udma_filter - compute UDMA mask |
377 | * @drive: IDE device | 362 | * @drive: IDE device |
378 | * | 363 | * |
@@ -401,15 +386,14 @@ static u8 ali_udma_filter(ide_drive_t *drive) | |||
401 | } | 386 | } |
402 | 387 | ||
403 | /** | 388 | /** |
404 | * ali15x3_tune_chipset - set up chipset/drive for new speed | 389 | * ali_set_dma_mode - set host controller for DMA mode |
405 | * @drive: drive to configure for | 390 | * @drive: drive |
406 | * @speed: desired speed | 391 | * @speed: DMA mode |
407 | * | 392 | * |
408 | * Configure the hardware for the desired IDE transfer mode. | 393 | * Configure the hardware for the desired IDE transfer mode. |
409 | * We also do the needed drive configuration through helpers | ||
410 | */ | 394 | */ |
411 | 395 | ||
412 | static int ali15x3_tune_chipset(ide_drive_t *drive, const u8 speed) | 396 | static void ali_set_dma_mode(ide_drive_t *drive, const u8 speed) |
413 | { | 397 | { |
414 | ide_hwif_t *hwif = HWIF(drive); | 398 | ide_hwif_t *hwif = HWIF(drive); |
415 | struct pci_dev *dev = hwif->pci_dev; | 399 | struct pci_dev *dev = hwif->pci_dev; |
@@ -419,7 +403,7 @@ static int ali15x3_tune_chipset(ide_drive_t *drive, const u8 speed) | |||
419 | int m5229_udma = (hwif->channel) ? 0x57 : 0x56; | 403 | int m5229_udma = (hwif->channel) ? 0x57 : 0x56; |
420 | 404 | ||
421 | if (speed < XFER_PIO_0) | 405 | if (speed < XFER_PIO_0) |
422 | return 1; | 406 | return; |
423 | 407 | ||
424 | if (speed == XFER_UDMA_6) | 408 | if (speed == XFER_UDMA_6) |
425 | speed1 = 0x47; | 409 | speed1 = 0x47; |
@@ -450,7 +434,6 @@ static int ali15x3_tune_chipset(ide_drive_t *drive, const u8 speed) | |||
450 | pci_write_config_byte(dev, 0x4b, tmpbyte); | 434 | pci_write_config_byte(dev, 0x4b, tmpbyte); |
451 | } | 435 | } |
452 | } | 436 | } |
453 | return (ide_config_drive_speed(drive, speed)); | ||
454 | } | 437 | } |
455 | 438 | ||
456 | /** | 439 | /** |
@@ -699,7 +682,7 @@ static void __devinit init_hwif_common_ali15x3 (ide_hwif_t *hwif) | |||
699 | { | 682 | { |
700 | hwif->autodma = 0; | 683 | hwif->autodma = 0; |
701 | hwif->set_pio_mode = &ali_set_pio_mode; | 684 | hwif->set_pio_mode = &ali_set_pio_mode; |
702 | hwif->speedproc = &ali15x3_tune_chipset; | 685 | hwif->set_dma_mode = &ali_set_dma_mode; |
703 | hwif->udma_filter = &ali_udma_filter; | 686 | hwif->udma_filter = &ali_udma_filter; |
704 | 687 | ||
705 | /* don't use LBA48 DMA on ALi devices before rev 0xC5 */ | 688 | /* don't use LBA48 DMA on ALi devices before rev 0xC5 */ |