diff options
author | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2007-10-11 17:54:00 -0400 |
---|---|---|
committer | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2007-10-11 17:54:00 -0400 |
commit | 26bcb879c03254545a19c6700fe5bcef6f21e7b1 (patch) | |
tree | dc35f1a7d7860fe0de268ff92189ff0884b689d3 /drivers/ide/pci/cy82c693.c | |
parent | 842c19ad6fc0dbd9ac9d2f8527466201802934cf (diff) |
ide: add ide_set{_max}_pio() (take 4)
* Add IDE_HFLAG_ABUSE_{PREFETCH,FAST_DEVSEL,DMA_MODES} flags
and set them in ht6560, cmd640, cmd64x and sc1200 host drivers.
* Add set_pio_mode_abuse() for checking if host driver has a non-standard
->tuneproc() implementation and use it in do_special().
* Add ide_set_pio() for setting PIO mode (it uses hwif->pio_mask to find
the maximum PIO mode supported by the host), also add ide_set_max_pio()
wrapper for ide_set_pio() to use for auto-tuning. Convert users of
->tuneproc to use ide_set{_max}_pio() where possible. This leaves only
do_special(), set_using_pio(), ide_hwif_restore() and ide_set_pio() as
a direct users of ->tuneproc.
* Remove no longer needed ide_get_best_pio_mode() calls and printk-s
reporting PIO mode selected from ->tuneproc implementations.
* Rename ->tuneproc hook to ->set_pio_mode and make 'pio' argument const.
* Remove stale comment from ide_config_drive_speed().
v2:
* Fix "ata_" prefix (Noticed by Jeff).
v3:
* Minor cleanups/fixups per Sergei's suggestions.
v4:
* Fix compile problem in drivers/ide/pci/cmd640.c
(Noticed by Andrew Morton).
* Improve some ->set_pio_mode comments.
Reviewed-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Cc: Jeff Garzik <jeff@garzik.org>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers/ide/pci/cy82c693.c')
-rw-r--r-- | drivers/ide/pci/cy82c693.c | 20 |
1 files changed, 2 insertions, 18 deletions
diff --git a/drivers/ide/pci/cy82c693.c b/drivers/ide/pci/cy82c693.c index daa36fcbc8ef..dc278025d318 100644 --- a/drivers/ide/pci/cy82c693.c +++ b/drivers/ide/pci/cy82c693.c | |||
@@ -97,9 +97,6 @@ | |||
97 | #define CY82_INDEX_CHANNEL1 0x31 | 97 | #define CY82_INDEX_CHANNEL1 0x31 |
98 | #define CY82_INDEX_TIMEOUT 0x32 | 98 | #define CY82_INDEX_TIMEOUT 0x32 |
99 | 99 | ||
100 | /* the max PIO mode - from datasheet */ | ||
101 | #define CY82C693_MAX_PIO 4 | ||
102 | |||
103 | /* the min and max PCI bus speed in MHz - from datasheet */ | 100 | /* the min and max PCI bus speed in MHz - from datasheet */ |
104 | #define CY82C963_MIN_BUS_SPEED 25 | 101 | #define CY82C963_MIN_BUS_SPEED 25 |
105 | #define CY82C963_MAX_BUS_SPEED 33 | 102 | #define CY82C963_MAX_BUS_SPEED 33 |
@@ -148,9 +145,6 @@ static void compute_clocks (u8 pio, pio_clocks_t *p_pclk) | |||
148 | * so you can play with the idebus=xx parameter | 145 | * so you can play with the idebus=xx parameter |
149 | */ | 146 | */ |
150 | 147 | ||
151 | if (pio > CY82C693_MAX_PIO) | ||
152 | pio = CY82C693_MAX_PIO; | ||
153 | |||
154 | /* let's calc the address setup time clocks */ | 148 | /* let's calc the address setup time clocks */ |
155 | p_pclk->address_time = (u8)calc_clk(ide_pio_timings[pio].setup_time, bus_speed); | 149 | p_pclk->address_time = (u8)calc_clk(ide_pio_timings[pio].setup_time, bus_speed); |
156 | 150 | ||
@@ -269,10 +263,7 @@ static int cy82c693_ide_dma_on (ide_drive_t *drive) | |||
269 | return __ide_dma_on(drive); | 263 | return __ide_dma_on(drive); |
270 | } | 264 | } |
271 | 265 | ||
272 | /* | 266 | static void cy82c693_set_pio_mode(ide_drive_t *drive, const u8 pio) |
273 | * tune ide drive - set PIO mode | ||
274 | */ | ||
275 | static void cy82c693_tune_drive (ide_drive_t *drive, u8 pio) | ||
276 | { | 267 | { |
277 | ide_hwif_t *hwif = HWIF(drive); | 268 | ide_hwif_t *hwif = HWIF(drive); |
278 | struct pci_dev *dev = hwif->pci_dev; | 269 | struct pci_dev *dev = hwif->pci_dev; |
@@ -329,13 +320,6 @@ static void cy82c693_tune_drive (ide_drive_t *drive, u8 pio) | |||
329 | addrCtrl, pclk.time_16r, pclk.time_16w, pclk.time_8); | 320 | addrCtrl, pclk.time_16r, pclk.time_16w, pclk.time_8); |
330 | #endif /* CY82C693_DEBUG_LOGS */ | 321 | #endif /* CY82C693_DEBUG_LOGS */ |
331 | 322 | ||
332 | /* first let's calc the pio modes */ | ||
333 | pio = ide_get_best_pio_mode(drive, pio, CY82C693_MAX_PIO); | ||
334 | |||
335 | #if CY82C693_DEBUG_INFO | ||
336 | printk (KERN_INFO "%s: Selected PIO mode %d\n", drive->name, pio); | ||
337 | #endif /* CY82C693_DEBUG_INFO */ | ||
338 | |||
339 | /* let's calc the values for this PIO mode */ | 323 | /* let's calc the values for this PIO mode */ |
340 | compute_clocks(pio, &pclk); | 324 | compute_clocks(pio, &pclk); |
341 | 325 | ||
@@ -447,7 +431,7 @@ static void __devinit init_hwif_cy82c693(ide_hwif_t *hwif) | |||
447 | hwif->autodma = 0; | 431 | hwif->autodma = 0; |
448 | 432 | ||
449 | hwif->chipset = ide_cy82c693; | 433 | hwif->chipset = ide_cy82c693; |
450 | hwif->tuneproc = &cy82c693_tune_drive; | 434 | hwif->set_pio_mode = &cy82c693_set_pio_mode; |
451 | 435 | ||
452 | if (!hwif->dma_base) { | 436 | if (!hwif->dma_base) { |
453 | hwif->drives[0].autotune = 1; | 437 | hwif->drives[0].autotune = 1; |