2 * Architecture specific parts of the Floppy driver
4 * This file is subject to the terms and conditions of the GNU General Public
5 * License. See the file "COPYING" in the main directory of this archive
8 * Copyright (C) 1995 - 2000 Ralf Baechle
13 #include <asm/bootinfo.h>
16 unsigned char (*fd_inb
)(unsigned int port
);
17 void (*fd_outb
)(unsigned char value
, unsigned int port
);
20 * How to access the floppy DMA functions.
22 void (*fd_enable_dma
)(int channel
);
23 void (*fd_disable_dma
)(int channel
);
24 int (*fd_request_dma
)(int channel
);
25 void (*fd_free_dma
)(int channel
);
26 void (*fd_clear_dma_ff
)(int channel
);
27 void (*fd_set_dma_mode
)(int channel
, char mode
);
28 void (*fd_set_dma_addr
)(int channel
, unsigned int a
);
29 void (*fd_set_dma_count
)(int channel
, unsigned int count
);
30 int (*fd_get_dma_residue
)(int channel
);
31 void (*fd_enable_irq
)(int irq
);
32 void (*fd_disable_irq
)(int irq
);
33 unsigned long (*fd_getfdaddr1
)(void);
34 unsigned long (*fd_dma_mem_alloc
)(unsigned long size
);
35 void (*fd_dma_mem_free
)(unsigned long addr
, unsigned long size
);
36 unsigned long (*fd_drive_type
)(unsigned long);
39 extern struct fd_ops
*fd_ops
;
41 #define fd_inb(port) fd_ops->fd_inb(port)
42 #define fd_outb(value,port) fd_ops->fd_outb(value,port)
44 #define fd_enable_dma() fd_ops->fd_enable_dma(FLOPPY_DMA)
45 #define fd_disable_dma() fd_ops->fd_disable_dma(FLOPPY_DMA)
46 #define fd_request_dma() fd_ops->fd_request_dma(FLOPPY_DMA)
47 #define fd_free_dma() fd_ops->fd_free_dma(FLOPPY_DMA)
48 #define fd_clear_dma_ff() fd_ops->fd_clear_dma_ff(FLOPPY_DMA)
49 #define fd_set_dma_mode(mode) fd_ops->fd_set_dma_mode(FLOPPY_DMA, mode)
50 #define fd_set_dma_addr(addr) fd_ops->fd_set_dma_addr(FLOPPY_DMA, \
52 #define fd_set_dma_count(count) fd_ops->fd_set_dma_count(FLOPPY_DMA,count)
53 #define fd_get_dma_residue() fd_ops->fd_get_dma_residue(FLOPPY_DMA)
55 #define fd_enable_irq() fd_ops->fd_enable_irq(FLOPPY_IRQ)
56 #define fd_disable_irq() fd_ops->fd_disable_irq(FLOPPY_IRQ)
57 #define fd_request_irq() request_irq(FLOPPY_IRQ, floppy_interrupt, \
58 SA_INTERRUPT | SA_SAMPLE_RANDOM, \
60 #define fd_free_irq() free_irq(FLOPPY_IRQ, NULL);
61 #define fd_dma_mem_alloc(size) fd_ops->fd_dma_mem_alloc(size)
62 #define fd_dma_mem_free(mem,size) fd_ops->fd_dma_mem_free(mem,size)
63 #define fd_drive_type(n) fd_ops->fd_drive_type(n)
64 #define fd_cacheflush(addr,size) dma_cache_wback_inv(addr,size)
66 #define MAX_BUFFER_SECTORS 24
70 * And on Mips's the CMOS info fails also ...
72 * FIXME: This information should come from the ARC configuration tree
73 * or whereever a particular machine has stored this ...
75 #define FLOPPY0_TYPE fd_drive_type(0)
76 #define FLOPPY1_TYPE fd_drive_type(1)
78 #define FDC1 fd_ops->fd_getfdaddr1();
81 * Hack: The floppy drivrer defines this, before including fdreg.h. We use
82 * to define FDC2 only one and keep it a static variable in floppy.c.
88 #define N_FDC 1 /* do you *really* want a second controller? */
91 #define FLOPPY_MOTOR_MASK 0xf0
94 * The DMA channel used by the floppy controller cannot access data at
97 * Went back to the 1MB limit, as some people had problems with the floppy
98 * driver otherwise. It doesn't matter much for performance anyway, as most
99 * floppy accesses go through the track buffer.
101 * On MIPSes using vdma, this actually means that *all* transfers go thru
102 * the * track buffer since 0x1000000 is always smaller than KSEG0/1.
103 * Actually this needs to be a bit more complicated since the so much different
104 * hardware available with MIPS CPUs ...
106 #define CROSS_64KB(a,s) ((unsigned long)(a)/K_64 != ((unsigned long)(a) + (s) - 1) / K_64)
108 #endif /* _ASM_FLOPPY_H */