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) 1998, 2003 by Ralf Baechle
8 #ifndef __ASM_MACH_JAZZ_FLOPPY_H
9 #define __ASM_MACH_JAZZ_FLOPPY_H
11 #include <linux/delay.h>
12 #include <linux/init.h>
13 #include <linux/linkage.h>
14 #include <linux/types.h>
16 #include <asm/addrspace.h>
18 #include <asm/jazzdma.h>
19 #include <asm/pgtable.h>
21 static inline unsigned char fd_inb(unsigned int port
)
25 c
= *(volatile unsigned char *) port
;
31 static inline void fd_outb(unsigned char value
, unsigned int port
)
33 *(volatile unsigned char *) port
= value
;
37 * How to access the floppy DMA functions.
39 static inline void fd_enable_dma(void)
41 vdma_enable(JAZZ_FLOPPY_DMA
);
44 static inline void fd_disable_dma(void)
46 vdma_disable(JAZZ_FLOPPY_DMA
);
49 static inline int fd_request_dma(void)
54 static inline void fd_free_dma(void)
58 static inline void fd_clear_dma_ff(void)
62 static inline void fd_set_dma_mode(char mode
)
64 vdma_set_mode(JAZZ_FLOPPY_DMA
, mode
);
67 static inline void fd_set_dma_addr(char *a
)
69 vdma_set_addr(JAZZ_FLOPPY_DMA
, vdma_phys2log(CPHYSADDR((unsigned long)a
)));
72 static inline void fd_set_dma_count(unsigned int count
)
74 vdma_set_count(JAZZ_FLOPPY_DMA
, count
);
77 static inline int fd_get_dma_residue(void)
79 return vdma_get_residue(JAZZ_FLOPPY_DMA
);
82 static inline void fd_enable_irq(void)
86 static inline void fd_disable_irq(void)
90 static inline int fd_request_irq(void)
92 return request_irq(FLOPPY_IRQ
, floppy_interrupt
,
96 static inline void fd_free_irq(void)
98 free_irq(FLOPPY_IRQ
, NULL
);
101 static inline unsigned long fd_getfdaddr1(void)
103 return JAZZ_FDC_BASE
;
106 static inline unsigned long fd_dma_mem_alloc(unsigned long size
)
110 mem
= __get_dma_pages(GFP_KERNEL
, get_order(size
));
113 vdma_alloc(CPHYSADDR(mem
), size
); /* XXX error checking */
118 static inline void fd_dma_mem_free(unsigned long addr
, unsigned long size
)
120 vdma_free(vdma_phys2log(CPHYSADDR(addr
)));
121 free_pages(addr
, get_order(size
));
124 static inline unsigned long fd_drive_type(unsigned long n
)
126 /* XXX This is wrong for machines with ED 2.88mb disk drives like the
127 Olivetti M700. Anyway, we should suck this from the ARC
130 return 4; /* 3,5", 1.44mb */
135 #endif /* __ASM_MACH_JAZZ_FLOPPY_H */