]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/ide/ide-floppy.c
ide: make ide_transfer_pc() static
[linux-2.6-omap-h63xx.git] / drivers / ide / ide-floppy.c
index 49e702670b8e6e7a47856d35f5a49c0af97eaf47..2a34f1ad22841b27ec28594cb3fe7df5b72206b9 100644 (file)
 #define CAPACITY_CURRENT       0x02
 #define CAPACITY_NO_CARTRIDGE  0x03
 
-#define IDEFLOPPY_TICKS_DELAY  HZ/20   /* default delay for ZIP 100 (50ms) */
+/*
+ * The following delay solves a problem with ATAPI Zip 100 drive where BSY bit
+ * was apparently being deasserted before the unit was ready to receive data.
+ */
+#define IDEFLOPPY_PC_DELAY     (HZ/20) /* default delay for ZIP 100 (50ms) */
 
 /* Error code returned in rq->errors to the higher part of the driver. */
 #define        IDEFLOPPY_ERROR_GENERAL         101
@@ -193,81 +197,6 @@ static void ide_floppy_callback(ide_drive_t *drive, int dsc)
        idefloppy_end_request(drive, uptodate, 0);
 }
 
-void ide_floppy_create_request_sense_cmd(struct ide_atapi_pc *pc)
-{
-       ide_init_pc(pc);
-       pc->c[0] = GPCMD_REQUEST_SENSE;
-       pc->c[4] = 255;
-       pc->req_xfer = 18;
-}
-
-/*
- * Called when an error was detected during the last packet command. We queue a
- * request sense packet command in the head of the request list.
- */
-static void idefloppy_retry_pc(ide_drive_t *drive)
-{
-       struct ide_floppy_obj *floppy = drive->driver_data;
-       struct request *rq = &floppy->request_sense_rq;
-       struct ide_atapi_pc *pc = &floppy->request_sense_pc;
-
-       (void)ide_read_error(drive);
-       ide_floppy_create_request_sense_cmd(pc);
-       ide_queue_pc_head(drive, floppy->disk, pc, rq);
-}
-
-/* The usual interrupt handler called during a packet command. */
-static ide_startstop_t idefloppy_pc_intr(ide_drive_t *drive)
-{
-       return ide_pc_intr(drive, idefloppy_pc_intr, idefloppy_update_buffers,
-                          idefloppy_retry_pc, ide_io_buffers);
-}
-
-/*
- * What we have here is a classic case of a top half / bottom half interrupt
- * service routine. In interrupt mode, the device sends an interrupt to signal
- * that it is ready to receive a packet. However, we need to delay about 2-3
- * ticks before issuing the packet or we gets in trouble.
- */
-static int idefloppy_transfer_pc(ide_drive_t *drive)
-{
-       /* Send the actual packet */
-       drive->hwif->tp_ops->output_data(drive, NULL, drive->pc->c, 12);
-
-       /* Timeout for the packet command */
-       return WAIT_FLOPPY_CMD;
-}
-
-/*
- * Called as an interrupt (or directly). When the device says it's ready for a
- * packet, we schedule the packet transfer to occur about 2-3 ticks later in
- * transfer_pc.
- */
-static ide_startstop_t idefloppy_start_pc_transfer(ide_drive_t *drive)
-{
-       idefloppy_floppy_t *floppy = drive->driver_data;
-       ide_expiry_t *expiry;
-       unsigned int timeout;
-
-       /*
-        * The following delay solves a problem with ATAPI Zip 100 drives
-        * where the Busy flag was apparently being deasserted before the
-        * unit was ready to receive data. This was happening on a
-        * 1200 MHz Athlon system. 10/26/01 25msec is too short,
-        * 40 and 50msec work well. idefloppy_pc_intr will not be actually
-        * used until after the packet is moved in about 50 msec.
-        */
-       if (drive->atapi_flags & IDE_AFLAG_ZIP_DRIVE) {
-               timeout = floppy->ticks;
-               expiry = &idefloppy_transfer_pc;
-       } else {
-               timeout = WAIT_FLOPPY_CMD;
-               expiry = NULL;
-       }
-
-       return ide_transfer_pc(drive, idefloppy_pc_intr, timeout, expiry);
-}
-
 static void ide_floppy_report_error(idefloppy_floppy_t *floppy,
                                    struct ide_atapi_pc *pc)
 {
@@ -311,8 +240,7 @@ static ide_startstop_t idefloppy_issue_pc(ide_drive_t *drive,
 
        pc->retries++;
 
-       return ide_issue_pc(drive, idefloppy_start_pc_transfer,
-                           WAIT_FLOPPY_CMD, NULL);
+       return ide_issue_pc(drive, WAIT_FLOPPY_CMD, NULL);
 }
 
 void ide_floppy_create_read_capacity_cmd(struct ide_atapi_pc *pc)
@@ -627,21 +555,7 @@ static sector_t idefloppy_capacity(ide_drive_t *drive)
 ide_devset_rw_field(bios_cyl, bios_cyl);
 ide_devset_rw_field(bios_head, bios_head);
 ide_devset_rw_field(bios_sect, bios_sect);
-
-static int get_ticks(ide_drive_t *drive)
-{
-       idefloppy_floppy_t *floppy = drive->driver_data;
-       return floppy->ticks;
-}
-
-static int set_ticks(ide_drive_t *drive, int arg)
-{
-       idefloppy_floppy_t *floppy = drive->driver_data;
-       floppy->ticks = arg;
-       return 0;
-}
-
-IDE_DEVSET(ticks, DS_SYNC, get_ticks, set_ticks);
+ide_devset_rw_field(ticks, pc_delay);
 
 static const struct ide_proc_devset idefloppy_settings[] = {
        IDE_PROC_DEVSET(bios_cyl,  0, 1023),
@@ -659,7 +573,9 @@ static void idefloppy_setup(ide_drive_t *drive, idefloppy_floppy_t *floppy)
 
        *((u16 *)&gcw) = id[ATA_ID_CONFIG];
 
-       drive->pc_callback = ide_floppy_callback;
+       drive->pc_callback       = ide_floppy_callback;
+       drive->pc_update_buffers = idefloppy_update_buffers;
+       drive->pc_io_buffers     = ide_io_buffers;
 
        if (((gcw[0] & 0x60) >> 5) == 1)
                drive->atapi_flags |= IDE_AFLAG_DRQ_INTERRUPT;
@@ -675,7 +591,7 @@ static void idefloppy_setup(ide_drive_t *drive, idefloppy_floppy_t *floppy)
        if (!strncmp((char *)&id[ATA_ID_PROD], "IOMEGA ZIP 100 ATAPI", 20)) {
                drive->atapi_flags |= IDE_AFLAG_ZIP_DRIVE;
                /* This value will be visible in the /proc/ide/hdx/settings */
-               floppy->ticks = IDEFLOPPY_TICKS_DELAY;
+               drive->pc_delay = IDEFLOPPY_PC_DELAY;
                blk_queue_max_sectors(drive->queue, 64);
        }