static void fd_seek(void) { unsigned long flags; DPRINT(("fd_seek() to track %d (unit[SelectedDrive].track=%d)\n", ReqTrack, unit[SelectedDrive].track)); if (unit[SelectedDrive].track == ReqTrack << unit[SelectedDrive].disktype->stretch) { fd_seek_done(0); return; } FDC1772_WRITE(FDC1772REG_DATA, ReqTrack << unit[SelectedDrive].disktype->stretch); udelay(25); save_flags(flags); clf(); SET_IRQ_HANDLER(fd_seek_done); FDC1772_WRITE(FDC1772REG_CMD, FDC1772CMD_SEEK | unit[SelectedDrive].steprate | /* DAG */ (MotorOn?FDC1772CMDADD_H:0)); restore_flags(flags); MotorOn = 1; set_head_settle_flag(); START_TIMEOUT(); /* wait for IRQ */ }
static void fd_rwsec(void) { unsigned long paddr, flags; unsigned int rwflag, old_motoron; unsigned int track; DPRINT(("fd_rwsec(), Sec=%d, Access=%c\n", ReqSector, ReqCmd == WRITE ? 'w' : 'r')); if (ReqCmd == WRITE) { /*cache_push( (unsigned long)ReqData, 512 ); */ paddr = (unsigned long) ReqData; rwflag = 0x100; } else { #ifdef TRACKBUFFER if (read_track) paddr = (unsigned long)PhysTrackBuffer; else paddr =(unsigned long)PhysDMABuffer; #else paddr = (unsigned long)PhysDMABuffer; #endif rwflag = 0; } DPRINT(("fd_rwsec() before sidesel rwflag=%d sec=%d trk=%d\n", rwflag, ReqSector, FDC1772_READ(FDC1772REG_TRACK))); fd_select_side(ReqSide); /*DPRINT(("fd_rwsec() before start sector \n")); */ /* Start sector of this operation */ #ifdef TRACKBUFFER FDC1772_WRITE( FDC1772REG_SECTOR, !read_track ? ReqSector : 1 ); #else FDC1772_WRITE( FDC1772REG_SECTOR, ReqSector ); #endif /* Cheat for track if stretch != 0 */ if (unit[SelectedDrive].disktype->stretch) { track = FDC1772_READ(FDC1772REG_TRACK); FDC1772_WRITE(FDC1772REG_TRACK, track >> unit[SelectedDrive].disktype->stretch); }
static void fd_calibrate(void) { DPRINT(("fd_calibrate\n")); if (unit[SelectedDrive].track >= 0) { fd_calibrate_done(0); return; } DPRINT(("fd_calibrate (after track compare)\n")); SET_IRQ_HANDLER(fd_calibrate_done); /* we can't verify, since the speed may be incorrect */ FDC1772_WRITE(FDC1772REG_CMD, FDC1772CMD_RESTORE | unit[SelectedDrive].steprate); NeedSeek = 1; MotorOn = 1; START_TIMEOUT(); /* wait for IRQ */ }
static void fd_select_drive(int drive) { #ifdef DEBUG printk("fd_select_drive:%d\n", drive); #endif /* Hmm - nowhere do we seem to turn the motor on - I'm going to do it here! */ oldlatch_aupdate(LATCHA_MOTOR | LATCHA_INUSE, 0); if (drive == SelectedDrive) return; oldlatch_aupdate(LATCHA_FDSELALL, 0xf - (1 << drive)); /* restore track register to saved value */ FDC1772_WRITE(FDC1772REG_TRACK, unit[drive].track); udelay(25); SelectedDrive = drive; }