2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
6 * Copyright (C) 1996, 1997, 1998, 2003 by Ralf Baechle
8 #ifndef __ASM_MACH_GENERIC_FLOPPY_H
9 #define __ASM_MACH_GENERIC_FLOPPY_H
11 #include <linux/delay.h>
12 #include <linux/ioport.h>
13 #include <linux/sched.h>
14 #include <linux/linkage.h>
15 #include <linux/types.h>
18 #include <asm/bootinfo.h>
19 #include <asm/cachectl.h>
21 #include <asm/floppy.h>
26 * How to access the FDC's registers.
28 static inline unsigned char fd_inb(unsigned int base
, unsigned int reg
)
30 return inb_p(base
+ reg
);
33 static inline void fd_outb(unsigned char value
, unsigned int base
, unsigned int reg
)
35 outb_p(value
, base
+ reg
);
39 * How to access the floppy DMA functions.
41 static inline void fd_enable_dma(void)
43 enable_dma(FLOPPY_DMA
);
46 static inline void fd_disable_dma(void)
48 disable_dma(FLOPPY_DMA
);
51 static inline int fd_request_dma(void)
53 return request_dma(FLOPPY_DMA
, "floppy");
56 static inline void fd_free_dma(void)
61 static inline void fd_clear_dma_ff(void)
63 clear_dma_ff(FLOPPY_DMA
);
66 static inline void fd_set_dma_mode(char mode
)
68 set_dma_mode(FLOPPY_DMA
, mode
);
71 static inline void fd_set_dma_addr(char *addr
)
73 set_dma_addr(FLOPPY_DMA
, (unsigned long) addr
);
76 static inline void fd_set_dma_count(unsigned int count
)
78 set_dma_count(FLOPPY_DMA
, count
);
81 static inline int fd_get_dma_residue(void)
83 return get_dma_residue(FLOPPY_DMA
);
86 static inline void fd_enable_irq(void)
88 enable_irq(FLOPPY_IRQ
);
91 static inline void fd_disable_irq(void)
93 disable_irq(FLOPPY_IRQ
);
96 static inline int fd_request_irq(void)
98 return request_irq(FLOPPY_IRQ
, floppy_interrupt
,
102 static inline void fd_free_irq(void)
104 free_irq(FLOPPY_IRQ
, NULL
);
107 #define fd_free_irq() free_irq(FLOPPY_IRQ, NULL);
110 static inline unsigned long fd_getfdaddr1(void)
115 static inline unsigned long fd_dma_mem_alloc(unsigned long size
)
117 return __get_dma_pages(GFP_KERNEL
, get_order(size
));
120 static inline void fd_dma_mem_free(unsigned long addr
, unsigned long size
)
122 free_pages(addr
, get_order(size
));
125 static inline unsigned long fd_drive_type(unsigned long n
)
128 return 4; /* 3,5", 1.44mb */
133 #endif /* __ASM_MACH_GENERIC_FLOPPY_H */