* better
[mascara-docs.git] / i386 / linux-2.3.21 / include / asm-arm / floppy.h
blob9d98486440b831fd5c189362a5348e09cc4c3e4e
1 /*
2 * linux/include/asm-arm/floppy.h
4 * (C) 1996 Russell King
5 */
6 #ifndef __ASM_ARM_FLOPPY_H
7 #define __ASM_ARM_FLOPPY_H
8 #if 0
9 #include <asm/arch/floppy.h>
10 #endif
12 #define fd_outb(val,port) \
13 do { \
14 if ((port) == FD_DOR) \
15 fd_setdor((val)); \
16 else \
17 outb((val),(port)); \
18 } while(0)
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) \
54 do { \
55 int new_dor = (dor); \
56 if (new_dor & 0xf0) \
57 new_dor = (new_dor & 0x0c) | floppy_selects[fdc][new_dor & 3]; \
58 else \
59 new_dor &= 0x0c; \
60 outb(new_dor, FD_DOR); \
61 } while (0)
64 * Someday, we'll automatically detect which drives are present...
66 extern __inline__ void fd_scandrives (void)
68 #if 0
69 int floppy, drive_count;
71 fd_disable_irq();
72 raw_cmd = &default_raw_cmd;
73 raw_cmd->flags = FD_RAW_SPIN | FD_RAW_NEED_SEEK;
74 raw_cmd->track = 0;
75 raw_cmd->rate = ?;
76 drive_count = 0;
77 for (floppy = 0; floppy < 4; floppy ++) {
78 current_drive = drive_count;
80 * Turn on floppy motor
82 if (start_motor(redo_fd_request))
83 continue;
85 * Set up FDC
87 fdc_specify();
89 * Tell FDC to recalibrate
91 output_byte(FD_RECALIBRATE);
92 LAST_OUT(UNIT(floppy));
93 /* wait for command to complete */
94 if (!successful) {
95 int i;
96 for (i = drive_count; i < 3; i--)
97 floppy_selects[fdc][i] = floppy_selects[fdc][i + 1];
98 floppy_selects[fdc][3] = 0;
99 floppy -= 1;
100 } else
101 drive_count++;
103 #else
104 floppy_selects[0][0] = 0x10;
105 floppy_selects[0][1] = 0x21;
106 floppy_selects[0][2] = 0x23;
107 floppy_selects[0][3] = 0x33;
108 #endif
111 #define FDC1 (0x3f0)
112 static int FDC2 = -1;
114 #define FLOPPY0_TYPE 4
115 #define FLOPPY1_TYPE 4
117 #define N_FDC 1
118 #define N_DRIVE 8
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 }
139 #endif