diff options
author | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2007-07-19 19:11:55 -0400 |
---|---|---|
committer | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2007-07-19 19:11:55 -0400 |
commit | 2229833c1365346b64357a9263fa724f74f5e376 (patch) | |
tree | 50f06ee86c940ef415561e548dabaaafd81a49a3 /drivers/ide/pci/sl82c105.c | |
parent | 342cdb6d4739cee430efc3eafcacd1605db66036 (diff) |
ide: add ide_dev_has_iordy() helper (take 4)
* Add ide_dev_has_iordy() helper and use it sl82c105 host driver.
* Remove no longer needed ide_pio_data_t.use_iordy field.
v2/v3:
* Fix issues noticed by Sergei:
- correct patch description
- fix comment in ide_get_best_pio_mode()
v4:
* Fix "ata_" prefix (Noticed by Jeff).
Acked-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/sl82c105.c')
-rw-r--r-- | drivers/ide/pci/sl82c105.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/drivers/ide/pci/sl82c105.c b/drivers/ide/pci/sl82c105.c index a7323d278c49..f2156ee7e2bd 100644 --- a/drivers/ide/pci/sl82c105.c +++ b/drivers/ide/pci/sl82c105.c | |||
@@ -52,9 +52,10 @@ | |||
52 | * Convert a PIO mode and cycle time to the required on/off times | 52 | * Convert a PIO mode and cycle time to the required on/off times |
53 | * for the interface. This has protection against runaway timings. | 53 | * for the interface. This has protection against runaway timings. |
54 | */ | 54 | */ |
55 | static unsigned int get_pio_timings(ide_pio_data_t *p) | 55 | static unsigned int get_pio_timings(ide_drive_t *drive, ide_pio_data_t *p) |
56 | { | 56 | { |
57 | unsigned int cmd_on, cmd_off; | 57 | unsigned int cmd_on, cmd_off; |
58 | u8 iordy = 0; | ||
58 | 59 | ||
59 | cmd_on = (ide_pio_timings[p->pio_mode].active_time + 29) / 30; | 60 | cmd_on = (ide_pio_timings[p->pio_mode].active_time + 29) / 30; |
60 | cmd_off = (p->cycle_time - 30 * cmd_on + 29) / 30; | 61 | cmd_off = (p->cycle_time - 30 * cmd_on + 29) / 30; |
@@ -65,7 +66,10 @@ static unsigned int get_pio_timings(ide_pio_data_t *p) | |||
65 | if (cmd_off == 0) | 66 | if (cmd_off == 0) |
66 | cmd_off = 1; | 67 | cmd_off = 1; |
67 | 68 | ||
68 | return (cmd_on - 1) << 8 | (cmd_off - 1) | (p->use_iordy ? 0x40 : 0x00); | 69 | if (p->pio_mode > 2 || ide_dev_has_iordy(drive->id)) |
70 | iordy = 0x40; | ||
71 | |||
72 | return (cmd_on - 1) << 8 | (cmd_off - 1) | iordy; | ||
69 | } | 73 | } |
70 | 74 | ||
71 | /* | 75 | /* |
@@ -82,7 +86,7 @@ static u8 sl82c105_tune_pio(ide_drive_t *drive, u8 pio) | |||
82 | 86 | ||
83 | pio = ide_get_best_pio_mode(drive, pio, 5, &p); | 87 | pio = ide_get_best_pio_mode(drive, pio, 5, &p); |
84 | 88 | ||
85 | drv_ctrl = get_pio_timings(&p); | 89 | drv_ctrl = get_pio_timings(drive, &p); |
86 | 90 | ||
87 | /* | 91 | /* |
88 | * Store the PIO timings so that we can restore them | 92 | * Store the PIO timings so that we can restore them |