Import 2.3.18pre1
[davej-history.git] / include / asm-mips / floppy.h
blob9ba75332e4490e63bcc899b11cc84689bb26c41b
1 /* $Id: floppy.h,v 1.4 1998/05/07 18:38:41 ralf Exp $
3 * Architecture specific parts of the Floppy driver
5 * This file is subject to the terms and conditions of the GNU General Public
6 * License. See the file "COPYING" in the main directory of this archive
7 * for more details.
9 * Copyright (C) 1995, 1996, 1997, 1998 Ralf Baechle
11 #ifndef __ASM_MIPS_FLOPPY_H
12 #define __ASM_MIPS_FLOPPY_H
14 #include <asm/bootinfo.h>
15 #include <asm/jazz.h>
16 #include <asm/jazzdma.h>
17 #include <asm/mipsconfig.h>
19 struct fd_ops {
20 unsigned char (*fd_inb)(unsigned int port);
21 void (*fd_outb)(unsigned char value, unsigned int port);
24 * How to access the floppy DMA functions.
26 void (*fd_enable_dma)(int channel);
27 void (*fd_disable_dma)(int channel);
28 int (*fd_request_dma)(int channel);
29 void (*fd_free_dma)(int channel);
30 void (*fd_clear_dma_ff)(int channel);
31 void (*fd_set_dma_mode)(int channel, char mode);
32 void (*fd_set_dma_addr)(int channel, unsigned int a);
33 void (*fd_set_dma_count)(int channel, unsigned int count);
34 int (*fd_get_dma_residue)(int channel);
35 void (*fd_enable_irq)(int irq);
36 void (*fd_disable_irq)(int irq);
37 unsigned long (*fd_getfdaddr1)(void);
38 unsigned long (*fd_dma_mem_alloc)(unsigned long size);
39 void (*fd_dma_mem_free)(unsigned long addr, unsigned long size);
40 unsigned long (*fd_drive_type)(unsigned long);
43 extern struct fd_ops *fd_ops;
45 #define fd_inb(port) fd_ops->fd_inb(port)
46 #define fd_outb(value,port) fd_ops->fd_outb(value,port)
48 #define fd_enable_dma(channel) fd_ops->fd_enable_dma(channel)
49 #define fd_disable_dma(channel) fd_ops->fd_disable_dma(channel)
50 #define fd_request_dma(channel) fd_ops->fd_request_dma(channel)
51 #define fd_free_dma(channel) fd_ops->fd_free_dma(channel)
52 #define fd_clear_dma_ff(channel) fd_ops->fd_clear_dma_ff(channel)
53 #define fd_set_dma_mode(channel, mode) fd_ops->fd_set_dma_mode(channel, mode)
54 #define fd_set_dma_addr(channel, addr) fd_ops->fd_set_dma_addr(channel, \
55 virt_to_bus(addr))
56 #define fd_set_dma_count(channel,count) fd_ops->fd_set_dma_count(channel,count)
57 #define fd_get_dma_residue(channel) fd_ops->fd_get_dma_residue(channel)
59 #define fd_enable_irq(irq) fd_ops->fd_enable_irq(irq)
60 #define fd_disable_irq(irq) fd_ops->fd_disable_irq(irq)
61 #define fd_request_irq(irq) request_irq(irq, floppy_interrupt, \
62 SA_INTERRUPT \
63 | SA_SAMPLE_RANDOM, \
64 "floppy", NULL)
65 #define fd_free_irq(irq) free_irq(irq, NULL);
66 #define fd_dma_mem_alloc(size) fd_ops->fd_dma_mem_alloc(size)
67 #define fd_dma_mem_free(mem,size) fd_ops->fd_dma_mem_free(mem,size)
68 #define fd_drive_type(n) fd_ops->fd_drive_type(n)
70 #define MAX_BUFFER_SECTORS 24
74 * And on Mips's the CMOS info fails also ...
76 * FIXME: This information should come from the ARC configuration tree
77 * or whereever a particular machine has stored this ...
79 #define FLOPPY0_TYPE fd_drive_type(0)
80 #define FLOPPY1_TYPE fd_drive_type(1)
82 #define FDC1 fd_ops->fd_getfdaddr1();
83 static int FDC2=-1;
85 #define N_FDC 1 /* do you *really* want a second controller? */
86 #define N_DRIVE 8
88 #define FLOPPY_MOTOR_MASK 0xf0
91 * The DMA channel used by the floppy controller cannot access data at
92 * addresses >= 16MB
94 * Went back to the 1MB limit, as some people had problems with the floppy
95 * driver otherwise. It doesn't matter much for performance anyway, as most
96 * floppy accesses go through the track buffer.
98 * On MIPSes using vdma, this actually means that *all* transfers go thru
99 * the * track buffer since 0x1000000 is always smaller than KSEG0/1.
100 * Actually this needs to be a bit more complicated since the so much different
101 * hardware available with MIPS CPUs ...
103 #define CROSS_64KB(a,s) ((unsigned long)(a)/K_64 != ((unsigned long)(a) + (s) - 1) / K_64)
105 #endif /* __ASM_MIPS_FLOPPY_H */