Lines Matching refs:base

62 #define swim_write(base, reg, v) 	out_8(&(base)->write_##reg, (v))
63 #define swim_read(base, reg) in_8(&(base)->read_##reg)
86 #define iwm_write(base, reg, v) out_8(&(base)->reg, (v))
87 #define iwm_read(base, reg) in_8(&(base)->reg)
209 struct swim __iomem *base;
215 extern int swim_read_sector_header(struct swim __iomem *base,
217 extern int swim_read_sector_data(struct swim __iomem *base,
221 static inline void set_swim_mode(struct swim __iomem *base, int enable)
227 swim_write(base, mode0, 0xf8);
231 iwm_base = (struct iwm __iomem *)base;
246 static inline int get_swim_mode(struct swim __iomem *base)
252 swim_write(base, phase, 0xf5);
253 if (swim_read(base, phase) != 0xf5)
255 swim_write(base, phase, 0xf6);
256 if (swim_read(base, phase) != 0xf6)
258 swim_write(base, phase, 0xf7);
259 if (swim_read(base, phase) != 0xf7)
268 static inline void swim_select(struct swim __iomem *base, int sel)
270 swim_write(base, phase, RELAX);
274 swim_write(base, phase, sel & CA_MASK);
277 static inline void swim_action(struct swim __iomem *base, int action)
283 swim_select(base, action);
285 swim_write(base, phase, (LSTRB<<4) | LSTRB);
287 swim_write(base, phase, (LSTRB<<4) | ((~LSTRB) & 0x0F));
293 static inline int swim_readbit(struct swim __iomem *base, int bit)
297 swim_select(base, bit);
301 stat = swim_read(base, handshake);
306 static inline void swim_drive(struct swim __iomem *base,
310 swim_write(base, mode0, EXTERNAL_DRIVE); /* clear drive 1 bit */
311 swim_write(base, mode1, INTERNAL_DRIVE); /* set drive 0 bit */
313 swim_write(base, mode0, INTERNAL_DRIVE); /* clear drive 0 bit */
314 swim_write(base, mode1, EXTERNAL_DRIVE); /* set drive 1 bit */
318 static inline void swim_motor(struct swim __iomem *base,
324 swim_action(base, MOTOR_ON);
327 swim_select(base, RELAX);
328 if (swim_readbit(base, MOTOR_ON))
334 swim_action(base, MOTOR_OFF);
335 swim_select(base, RELAX);
339 static inline void swim_eject(struct swim __iomem *base)
343 swim_action(base, EJECT);
346 swim_select(base, RELAX);
347 if (!swim_readbit(base, DISK_IN))
352 swim_select(base, RELAX);
355 static inline void swim_head(struct swim __iomem *base, enum head head)
360 swim_select(base, READ_DATA_1);
362 swim_select(base, READ_DATA_0);
365 static inline int swim_step(struct swim __iomem *base)
369 swim_action(base, STEP);
376 swim_select(base, RELAX);
377 if (!swim_readbit(base, STEP))
383 static inline int swim_track00(struct swim __iomem *base)
387 swim_action(base, SEEK_NEGATIVE);
391 swim_select(base, RELAX);
392 if (swim_readbit(base, TRACK_ZERO))
395 if (swim_step(base))
399 if (swim_readbit(base, TRACK_ZERO))
405 static inline int swim_seek(struct swim __iomem *base, int step)
411 swim_action(base, SEEK_NEGATIVE);
414 swim_action(base, SEEK_POSITIVE);
417 if (swim_step(base))
426 struct swim __iomem *base = fs->swd->base;
429 ret = swim_seek(base, track - fs->track);
434 swim_track00(base);
443 struct swim __iomem *base = fs->swd->base;
445 swim_drive(base, fs->location);
446 swim_motor(base, OFF);
447 swim_eject(base);
459 struct swim __iomem *base = fs->swd->base;
467 swim_write(base, mode1, MOTON);
468 swim_head(base, side);
469 swim_write(base, mode0, side);
473 ret = swim_read_sector_header(base, &header);
477 ret = swim_read_sector_data(base, buffer);
483 swim_write(base, mode0, MOTON);
496 struct swim __iomem *base = fs->swd->base;
502 swim_drive(base, fs->location);
583 struct swim __iomem *base = fs->swd->base;
585 if (swim_readbit(base, DISK_IN)) {
588 fs->write_protected = swim_readbit(base, WRITE_PROT);
590 if (swim_track00(base))
594 swim_track00(base);
596 fs->type = swim_readbit(base, TWOMEG_MEDIA) ?
598 fs->head_number = swim_readbit(base, SINGLE_SIDED) ? 1 : 2;
612 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);
763 struct swim __iomem *base = swd->base;
767 swim_drive(base, location);
769 swim_motor(base, OFF);
790 struct swim __iomem *base = swd->base;
794 swim_drive(base, INTERNAL_DRIVE);
795 if (swim_readbit(base, DRIVE_PRESENT) &&
796 !swim_readbit(base, ONEMEG_DRIVE))
798 swim_drive(base, EXTERNAL_DRIVE);
799 if (swim_readbit(base, DRIVE_PRESENT) &&
800 !swim_readbit(base, ONEMEG_DRIVE))
913 swd->base = swim_base;