aboutsummaryrefslogtreecommitdiffstats
path: root/include/asm-arm26/floppy.h
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:20:36 -0400
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:20:36 -0400
commit1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 (patch)
tree0bba044c4ce775e45a88a51686b5d9f90697ea9d /include/asm-arm26/floppy.h
Linux-2.6.12-rc2v2.6.12-rc2
Initial git repository build. I'm not bothering with the full history, even though we have it. We can create a separate "historical" git archive of that later if we want to, and in the meantime it's about 3.2GB when imported into git - space that would just make the early git days unnecessarily complicated, when we don't have a lot of good infrastructure for it. Let it rip!
Diffstat (limited to 'include/asm-arm26/floppy.h')
-rw-r--r--include/asm-arm26/floppy.h141
1 files changed, 141 insertions, 0 deletions
diff --git a/include/asm-arm26/floppy.h b/include/asm-arm26/floppy.h
new file mode 100644
index 000000000000..9e090ad7e477
--- /dev/null
+++ b/include/asm-arm26/floppy.h
@@ -0,0 +1,141 @@
1/*
2 * linux/include/asm-arm/floppy.h
3 *
4 * Copyright (C) 1996-2000 Russell King
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 *
10 * Note that we don't touch FLOPPY_DMA nor FLOPPY_IRQ here
11 */
12#ifndef __ASM_ARM_FLOPPY_H
13#define __ASM_ARM_FLOPPY_H
14
15#define fd_outb(val,port) \
16 do { \
17 if ((port) == FD_DOR) \
18 fd_setdor((val)); \
19 else \
20 outb((val),(port)); \
21 } while(0)
22
23#define fd_inb(port) inb((port))
24#define fd_request_irq() request_irq(IRQ_FLOPPYDISK,floppy_interrupt,\
25 SA_INTERRUPT|SA_SAMPLE_RANDOM,"floppy",NULL)
26#define fd_free_irq() free_irq(IRQ_FLOPPYDISK,NULL)
27#define fd_disable_irq() disable_irq(IRQ_FLOPPYDISK)
28#define fd_enable_irq() enable_irq(IRQ_FLOPPYDISK)
29
30#define fd_request_dma() request_dma(DMA_FLOPPY,"floppy")
31#define fd_free_dma() free_dma(DMA_FLOPPY)
32#define fd_disable_dma() disable_dma(DMA_FLOPPY)
33#define fd_enable_dma() enable_dma(DMA_FLOPPY)
34#define fd_clear_dma_ff() clear_dma_ff(DMA_FLOPPY)
35#define fd_set_dma_mode(mode) set_dma_mode(DMA_FLOPPY, (mode))
36#define fd_set_dma_addr(addr) set_dma_addr(DMA_FLOPPY, virt_to_bus((addr)))
37#define fd_set_dma_count(len) set_dma_count(DMA_FLOPPY, (len))
38#define fd_cacheflush(addr,sz)
39
40/* need to clean up dma.h */
41#define DMA_FLOPPYDISK DMA_FLOPPY
42
43/* Floppy_selects is the list of DOR's to select drive fd
44 *
45 * On initialisation, the floppy list is scanned, and the drives allocated
46 * in the order that they are found. This is done by seeking the drive
47 * to a non-zero track, and then restoring it to track 0. If an error occurs,
48 * then there is no floppy drive present. [to be put back in again]
49 */
50static unsigned char floppy_selects[2][4] =
51{
52 { 0x10, 0x21, 0x23, 0x33 },
53 { 0x10, 0x21, 0x23, 0x33 }
54};
55
56#define fd_setdor(dor) \
57do { \
58 int new_dor = (dor); \
59 if (new_dor & 0xf0) \
60 new_dor = (new_dor & 0x0c) | floppy_selects[fdc][new_dor & 3]; \
61 else \
62 new_dor &= 0x0c; \
63 outb(new_dor, FD_DOR); \
64} while (0)
65
66/*
67 * Someday, we'll automatically detect which drives are present...
68 */
69static inline void fd_scandrives (void)
70{
71#if 0
72 int floppy, drive_count;
73
74 fd_disable_irq();
75 raw_cmd = &default_raw_cmd;
76 raw_cmd->flags = FD_RAW_SPIN | FD_RAW_NEED_SEEK;
77 raw_cmd->track = 0;
78 raw_cmd->rate = ?;
79 drive_count = 0;
80 for (floppy = 0; floppy < 4; floppy ++) {
81 current_drive = drive_count;
82 /*
83 * Turn on floppy motor
84 */
85 if (start_motor(redo_fd_request))
86 continue;
87 /*
88 * Set up FDC
89 */
90 fdc_specify();
91 /*
92 * Tell FDC to recalibrate
93 */
94 output_byte(FD_RECALIBRATE);
95 LAST_OUT(UNIT(floppy));
96 /* wait for command to complete */
97 if (!successful) {
98 int i;
99 for (i = drive_count; i < 3; i--)
100 floppy_selects[fdc][i] = floppy_selects[fdc][i + 1];
101 floppy_selects[fdc][3] = 0;
102 floppy -= 1;
103 } else
104 drive_count++;
105 }
106#else
107 floppy_selects[0][0] = 0x10;
108 floppy_selects[0][1] = 0x21;
109 floppy_selects[0][2] = 0x23;
110 floppy_selects[0][3] = 0x33;
111#endif
112}
113
114#define FDC1 (0x3f0)
115
116#define FLOPPY0_TYPE 4
117#define FLOPPY1_TYPE 4
118
119#define N_FDC 1
120#define N_DRIVE 4
121
122#define FLOPPY_MOTOR_MASK 0xf0
123
124#define CROSS_64KB(a,s) (0)
125
126/*
127 * This allows people to reverse the order of
128 * fd0 and fd1, in case their hardware is
129 * strangely connected (as some RiscPCs
130 * and A5000s seem to be).
131 */
132static void driveswap(int *ints, int dummy, int dummy2)
133{
134 floppy_selects[0][0] ^= floppy_selects[0][1];
135 floppy_selects[0][1] ^= floppy_selects[0][0];
136 floppy_selects[0][0] ^= floppy_selects[0][1];
137}
138
139#define EXTRA_FLOPPY_PARAMS ,{ "driveswap", &driveswap, NULL, 0, 0 }
140
141#endif