Lines Matching refs:base
63 #define swim_write(base, reg, v) out_8(&(base)->write_##reg, (v))
64 #define swim_read(base, reg) in_8(&(base)->read_##reg)
87 #define iwm_write(base, reg, v) out_8(&(base)->reg, (v))
88 #define iwm_read(base, reg) in_8(&(base)->reg)
211 struct swim __iomem *base;
217 extern int swim_read_sector_header(struct swim __iomem *base,
219 extern int swim_read_sector_data(struct swim __iomem *base,
223 static inline void set_swim_mode(struct swim __iomem *base, int enable)
229 swim_write(base, mode0, 0xf8);
233 iwm_base = (struct iwm __iomem *)base;
248 static inline int get_swim_mode(struct swim __iomem *base)
254 swim_write(base, phase, 0xf5);
255 if (swim_read(base, phase) != 0xf5)
257 swim_write(base, phase, 0xf6);
258 if (swim_read(base, phase) != 0xf6)
260 swim_write(base, phase, 0xf7);
261 if (swim_read(base, phase) != 0xf7)
270 static inline void swim_select(struct swim __iomem *base, int sel)
272 swim_write(base, phase, RELAX);
276 swim_write(base, phase, sel & CA_MASK);
279 static inline void swim_action(struct swim __iomem *base, int action)
285 swim_select(base, action);
287 swim_write(base, phase, (LSTRB<<4) | LSTRB);
289 swim_write(base, phase, (LSTRB<<4) | ((~LSTRB) & 0x0F));
295 static inline int swim_readbit(struct swim __iomem *base, int bit)
299 swim_select(base, bit);
303 stat = swim_read(base, handshake);
308 static inline void swim_drive(struct swim __iomem *base,
312 swim_write(base, mode0, EXTERNAL_DRIVE); /* clear drive 1 bit */
313 swim_write(base, mode1, INTERNAL_DRIVE); /* set drive 0 bit */
315 swim_write(base, mode0, INTERNAL_DRIVE); /* clear drive 0 bit */
316 swim_write(base, mode1, EXTERNAL_DRIVE); /* set drive 1 bit */
320 static inline void swim_motor(struct swim __iomem *base,
326 swim_action(base, MOTOR_ON);
329 swim_select(base, RELAX);
330 if (swim_readbit(base, MOTOR_ON))
336 swim_action(base, MOTOR_OFF);
337 swim_select(base, RELAX);
341 static inline void swim_eject(struct swim __iomem *base)
345 swim_action(base, EJECT);
348 swim_select(base, RELAX);
349 if (!swim_readbit(base, DISK_IN))
354 swim_select(base, RELAX);
357 static inline void swim_head(struct swim __iomem *base, enum head head)
362 swim_select(base, READ_DATA_1);
364 swim_select(base, READ_DATA_0);
367 static inline int swim_step(struct swim __iomem *base)
371 swim_action(base, STEP);
378 swim_select(base, RELAX);
379 if (!swim_readbit(base, STEP))
385 static inline int swim_track00(struct swim __iomem *base)
389 swim_action(base, SEEK_NEGATIVE);
393 swim_select(base, RELAX);
394 if (swim_readbit(base, TRACK_ZERO))
397 if (swim_step(base))
401 if (swim_readbit(base, TRACK_ZERO))
407 static inline int swim_seek(struct swim __iomem *base, int step)
413 swim_action(base, SEEK_NEGATIVE);
416 swim_action(base, SEEK_POSITIVE);
419 if (swim_step(base))
428 struct swim __iomem *base = fs->swd->base;
431 ret = swim_seek(base, track - fs->track);
436 swim_track00(base);
445 struct swim __iomem *base = fs->swd->base;
447 swim_drive(base, fs->location);
448 swim_motor(base, OFF);
449 swim_eject(base);
461 struct swim __iomem *base = fs->swd->base;
469 swim_write(base, mode1, MOTON);
470 swim_head(base, side);
471 swim_write(base, mode0, side);
475 ret = swim_read_sector_header(base, &header);
479 ret = swim_read_sector_data(base, buffer);
485 swim_write(base, mode0, MOTON);
498 struct swim __iomem *base = fs->swd->base;
504 swim_drive(base, fs->location);
585 struct swim __iomem *base = fs->swd->base;
587 if (swim_readbit(base, DISK_IN)) {
590 fs->write_protected = swim_readbit(base, WRITE_PROT);
592 if (swim_track00(base))
596 swim_track00(base);
598 fs->type = swim_readbit(base, TWOMEG_MEDIA) ?
600 fs->head_number = swim_readbit(base, SINGLE_SIDED) ? 1 : 2;
614 struct swim __iomem *base = fs->swd->base;
623 swim_write(base, setup, S_IBM_DRIVE | S_FCLK_DIV2);
625 swim_drive(base, fs->location);
626 swim_motor(base, ON);
627 swim_action(base, SETMFM);
656 swim_motor(base, OFF);
674 struct swim __iomem *base = fs->swd->base;
683 swim_motor(base, OFF);
751 struct swim __iomem *base = swd->base;
755 swim_drive(base, location);
757 swim_motor(base, OFF);
792 struct swim __iomem *base = swd->base;
796 swim_drive(base, INTERNAL_DRIVE);
797 if (swim_readbit(base, DRIVE_PRESENT) &&
798 !swim_readbit(base, ONEMEG_DRIVE))
800 swim_drive(base, EXTERNAL_DRIVE);
801 if (swim_readbit(base, DRIVE_PRESENT) &&
802 !swim_readbit(base, ONEMEG_DRIVE))
903 swd->base = swim_base;