2 * linux/include/asm-arm/floppy.h
4 * (C) 1996 Russell King
6 #ifndef __ASM_ARM_FLOPPY_H
7 #define __ASM_ARM_FLOPPY_H
9 #include <asm/arch/floppy.h>
12 #define fd_outb(val,port) \
14 if ((port) == FD_DOR) \
20 #define fd_inb(port) inb((port))
21 #define fd_request_irq() request_irq(IRQ_FLOPPYDISK,floppy_interrupt,\
22 SA_INTERRUPT|SA_SAMPLE_RANDOM,"floppy",NULL)
23 #define fd_free_irq() free_irq(IRQ_FLOPPYDISK,NULL)
24 #define fd_disable_irq() disable_irq(IRQ_FLOPPYDISK)
25 #define fd_enable_irq() enable_irq(IRQ_FLOPPYDISK)
27 #define fd_request_dma() request_dma(FLOPPY_DMA,"floppy")
28 #define fd_free_dma() free_dma(FLOPPY_DMA)
29 #define fd_disable_dma() disable_dma(FLOPPY_DMA)
30 #define fd_enable_dma() enable_dma(FLOPPY_DMA)
31 #define fd_clear_dma_ff() clear_dma_ff(FLOPPY_DMA)
32 #define fd_set_dma_mode(mode) set_dma_mode(FLOPPY_DMA, (mode))
33 #define fd_set_dma_addr(addr) set_dma_addr(FLOPPY_DMA, virt_to_bus((addr)))
34 #define fd_set_dma_count(len) set_dma_count(FLOPPY_DMA, (len))
35 #define fd_cacheflush(addr,sz)
37 /* need to clean up dma.h */
38 #define DMA_FLOPPYDISK DMA_FLOPPY
40 /* Floppy_selects is the list of DOR's to select drive fd
42 * On initialisation, the floppy list is scanned, and the drives allocated
43 * in the order that they are found. This is done by seeking the drive
44 * to a non-zero track, and then restoring it to track 0. If an error occurs,
45 * then there is no floppy drive present. [to be put back in again]
47 static unsigned char floppy_selects
[2][4] =
49 { 0x10, 0x21, 0x23, 0x33 },
50 { 0x10, 0x21, 0x23, 0x33 }
53 #define fd_setdor(dor) \
55 int new_dor = (dor); \
57 new_dor = (new_dor & 0x0c) | floppy_selects[fdc][new_dor & 3]; \
60 outb(new_dor, FD_DOR); \
64 * Someday, we'll automatically detect which drives are present...
66 extern __inline__
void fd_scandrives (void)
69 int floppy
, drive_count
;
72 raw_cmd
= &default_raw_cmd
;
73 raw_cmd
->flags
= FD_RAW_SPIN
| FD_RAW_NEED_SEEK
;
77 for (floppy
= 0; floppy
< 4; floppy
++) {
78 current_drive
= drive_count
;
80 * Turn on floppy motor
82 if (start_motor(redo_fd_request
))
89 * Tell FDC to recalibrate
91 output_byte(FD_RECALIBRATE
);
92 LAST_OUT(UNIT(floppy
));
93 /* wait for command to complete */
96 for (i
= drive_count
; i
< 3; i
--)
97 floppy_selects
[fdc
][i
] = floppy_selects
[fdc
][i
+ 1];
98 floppy_selects
[fdc
][3] = 0;
104 floppy_selects
[0][0] = 0x10;
105 floppy_selects
[0][1] = 0x21;
106 floppy_selects
[0][2] = 0x23;
107 floppy_selects
[0][3] = 0x33;
112 static int FDC2
= -1;
114 #define FLOPPY0_TYPE 4
115 #define FLOPPY1_TYPE 4
120 #define FLOPPY_MOTOR_MASK 0xf0
122 #define CROSS_64KB(a,s) (0)
125 * This allows people to reverse the order of
126 * fd0 and fd1, in case their hardware is
127 * strangely connected (as some RiscPCs
128 * and A5000s seem to be).
130 static void driveswap(int *ints
, int dummy
, int dummy2
)
132 floppy_selects
[0][0] ^= floppy_selects
[0][1];
133 floppy_selects
[0][1] ^= floppy_selects
[0][0];
134 floppy_selects
[0][0] ^= floppy_selects
[0][1];
137 #define EXTRA_FLOPPY_PARAMS ,{ "driveswap", &driveswap, NULL, 0, 0 }