diff options
author | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2008-10-13 15:39:32 -0400 |
---|---|---|
committer | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2008-10-13 15:39:32 -0400 |
commit | baf08f0be6d986521bb2fbdc7af51fc4847da734 (patch) | |
tree | 5ac765703ad79edeafc6eec39fe42850bd6b5dc6 /drivers/ide/ide-floppy.c | |
parent | aa5d2de7b080873f6d9ac3aede423c9713bf0caa (diff) |
ide: make ide_transfer_pc() static
* Move ->ticks field from struct ide_floppy_obj to ide_drive_t.
* Move idefloppy_transfer_pc() to ide-atapi.c and make
ide_transfer_pc() use it.
* Always use ide_transfer_pc as a handler in ide_issue_pc().
* Remove no longer used idefloppy_start_pc_transfer(),
ide*_transfer_pc() and 'handler' argument from ide_issue_pc().
* Make ide_transfer_pc() static.
While at it:
* idefloppy_transfer_pc() -> ide_delayed_transfer_pc()
* IDEFLOPPY_TICKS_DELAY -> IDEFLOPPY_PC_DELAY
* ->ticks -> ->pc_delay
There should be no functional changes caused by this patch.
Cc: Borislav Petkov <petkovbb@gmail.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers/ide/ide-floppy.c')
-rw-r--r-- | drivers/ide/ide-floppy.c | 72 |
1 files changed, 8 insertions, 64 deletions
diff --git a/drivers/ide/ide-floppy.c b/drivers/ide/ide-floppy.c index 7be3cd5daa9d..2a34f1ad2284 100644 --- a/drivers/ide/ide-floppy.c +++ b/drivers/ide/ide-floppy.c | |||
@@ -73,7 +73,11 @@ | |||
73 | #define CAPACITY_CURRENT 0x02 | 73 | #define CAPACITY_CURRENT 0x02 |
74 | #define CAPACITY_NO_CARTRIDGE 0x03 | 74 | #define CAPACITY_NO_CARTRIDGE 0x03 |
75 | 75 | ||
76 | #define IDEFLOPPY_TICKS_DELAY HZ/20 /* default delay for ZIP 100 (50ms) */ | 76 | /* |
77 | * The following delay solves a problem with ATAPI Zip 100 drive where BSY bit | ||
78 | * was apparently being deasserted before the unit was ready to receive data. | ||
79 | */ | ||
80 | #define IDEFLOPPY_PC_DELAY (HZ/20) /* default delay for ZIP 100 (50ms) */ | ||
77 | 81 | ||
78 | /* Error code returned in rq->errors to the higher part of the driver. */ | 82 | /* Error code returned in rq->errors to the higher part of the driver. */ |
79 | #define IDEFLOPPY_ERROR_GENERAL 101 | 83 | #define IDEFLOPPY_ERROR_GENERAL 101 |
@@ -193,51 +197,6 @@ static void ide_floppy_callback(ide_drive_t *drive, int dsc) | |||
193 | idefloppy_end_request(drive, uptodate, 0); | 197 | idefloppy_end_request(drive, uptodate, 0); |
194 | } | 198 | } |
195 | 199 | ||
196 | /* | ||
197 | * What we have here is a classic case of a top half / bottom half interrupt | ||
198 | * service routine. In interrupt mode, the device sends an interrupt to signal | ||
199 | * that it is ready to receive a packet. However, we need to delay about 2-3 | ||
200 | * ticks before issuing the packet or we gets in trouble. | ||
201 | */ | ||
202 | static int idefloppy_transfer_pc(ide_drive_t *drive) | ||
203 | { | ||
204 | /* Send the actual packet */ | ||
205 | drive->hwif->tp_ops->output_data(drive, NULL, drive->pc->c, 12); | ||
206 | |||
207 | /* Timeout for the packet command */ | ||
208 | return WAIT_FLOPPY_CMD; | ||
209 | } | ||
210 | |||
211 | /* | ||
212 | * Called as an interrupt (or directly). When the device says it's ready for a | ||
213 | * packet, we schedule the packet transfer to occur about 2-3 ticks later in | ||
214 | * transfer_pc. | ||
215 | */ | ||
216 | static ide_startstop_t idefloppy_start_pc_transfer(ide_drive_t *drive) | ||
217 | { | ||
218 | idefloppy_floppy_t *floppy = drive->driver_data; | ||
219 | ide_expiry_t *expiry; | ||
220 | unsigned int timeout; | ||
221 | |||
222 | /* | ||
223 | * The following delay solves a problem with ATAPI Zip 100 drives | ||
224 | * where the Busy flag was apparently being deasserted before the | ||
225 | * unit was ready to receive data. This was happening on a | ||
226 | * 1200 MHz Athlon system. 10/26/01 25msec is too short, | ||
227 | * 40 and 50msec work well. ide_pc_intr will not be actually | ||
228 | * used until after the packet is moved in about 50 msec. | ||
229 | */ | ||
230 | if (drive->atapi_flags & IDE_AFLAG_ZIP_DRIVE) { | ||
231 | timeout = floppy->ticks; | ||
232 | expiry = &idefloppy_transfer_pc; | ||
233 | } else { | ||
234 | timeout = WAIT_FLOPPY_CMD; | ||
235 | expiry = NULL; | ||
236 | } | ||
237 | |||
238 | return ide_transfer_pc(drive, timeout, expiry); | ||
239 | } | ||
240 | |||
241 | static void ide_floppy_report_error(idefloppy_floppy_t *floppy, | 200 | static void ide_floppy_report_error(idefloppy_floppy_t *floppy, |
242 | struct ide_atapi_pc *pc) | 201 | struct ide_atapi_pc *pc) |
243 | { | 202 | { |
@@ -281,8 +240,7 @@ static ide_startstop_t idefloppy_issue_pc(ide_drive_t *drive, | |||
281 | 240 | ||
282 | pc->retries++; | 241 | pc->retries++; |
283 | 242 | ||
284 | return ide_issue_pc(drive, idefloppy_start_pc_transfer, | 243 | return ide_issue_pc(drive, WAIT_FLOPPY_CMD, NULL); |
285 | WAIT_FLOPPY_CMD, NULL); | ||
286 | } | 244 | } |
287 | 245 | ||
288 | void ide_floppy_create_read_capacity_cmd(struct ide_atapi_pc *pc) | 246 | void ide_floppy_create_read_capacity_cmd(struct ide_atapi_pc *pc) |
@@ -597,21 +555,7 @@ static sector_t idefloppy_capacity(ide_drive_t *drive) | |||
597 | ide_devset_rw_field(bios_cyl, bios_cyl); | 555 | ide_devset_rw_field(bios_cyl, bios_cyl); |
598 | ide_devset_rw_field(bios_head, bios_head); | 556 | ide_devset_rw_field(bios_head, bios_head); |
599 | ide_devset_rw_field(bios_sect, bios_sect); | 557 | ide_devset_rw_field(bios_sect, bios_sect); |
600 | 558 | ide_devset_rw_field(ticks, pc_delay); | |
601 | static int get_ticks(ide_drive_t *drive) | ||
602 | { | ||
603 | idefloppy_floppy_t *floppy = drive->driver_data; | ||
604 | return floppy->ticks; | ||
605 | } | ||
606 | |||
607 | static int set_ticks(ide_drive_t *drive, int arg) | ||
608 | { | ||
609 | idefloppy_floppy_t *floppy = drive->driver_data; | ||
610 | floppy->ticks = arg; | ||
611 | return 0; | ||
612 | } | ||
613 | |||
614 | IDE_DEVSET(ticks, DS_SYNC, get_ticks, set_ticks); | ||
615 | 559 | ||
616 | static const struct ide_proc_devset idefloppy_settings[] = { | 560 | static const struct ide_proc_devset idefloppy_settings[] = { |
617 | IDE_PROC_DEVSET(bios_cyl, 0, 1023), | 561 | IDE_PROC_DEVSET(bios_cyl, 0, 1023), |
@@ -647,7 +591,7 @@ static void idefloppy_setup(ide_drive_t *drive, idefloppy_floppy_t *floppy) | |||
647 | if (!strncmp((char *)&id[ATA_ID_PROD], "IOMEGA ZIP 100 ATAPI", 20)) { | 591 | if (!strncmp((char *)&id[ATA_ID_PROD], "IOMEGA ZIP 100 ATAPI", 20)) { |
648 | drive->atapi_flags |= IDE_AFLAG_ZIP_DRIVE; | 592 | drive->atapi_flags |= IDE_AFLAG_ZIP_DRIVE; |
649 | /* This value will be visible in the /proc/ide/hdx/settings */ | 593 | /* This value will be visible in the /proc/ide/hdx/settings */ |
650 | floppy->ticks = IDEFLOPPY_TICKS_DELAY; | 594 | drive->pc_delay = IDEFLOPPY_PC_DELAY; |
651 | blk_queue_max_sectors(drive->queue, 64); | 595 | blk_queue_max_sectors(drive->queue, 64); |
652 | } | 596 | } |
653 | 597 | ||