0001
0002
0003
0004
0005
0006
0007
0008 #ifndef __ASM_MACH_JAZZ_FLOPPY_H
0009 #define __ASM_MACH_JAZZ_FLOPPY_H
0010
0011 #include <linux/delay.h>
0012 #include <linux/linkage.h>
0013 #include <linux/types.h>
0014 #include <linux/mm.h>
0015 #include <asm/addrspace.h>
0016 #include <asm/jazz.h>
0017 #include <asm/jazzdma.h>
0018
0019 static inline unsigned char fd_inb(unsigned int base, unsigned int reg)
0020 {
0021 unsigned char c;
0022
0023 c = *(volatile unsigned char *) (base + reg);
0024 udelay(1);
0025
0026 return c;
0027 }
0028
0029 static inline void fd_outb(unsigned char value, unsigned int base, unsigned int reg)
0030 {
0031 *(volatile unsigned char *) (base + reg) = value;
0032 }
0033
0034
0035
0036
0037 static inline void fd_enable_dma(void)
0038 {
0039 vdma_enable(JAZZ_FLOPPY_DMA);
0040 }
0041
0042 static inline void fd_disable_dma(void)
0043 {
0044 vdma_disable(JAZZ_FLOPPY_DMA);
0045 }
0046
0047 static inline int fd_request_dma(void)
0048 {
0049 return 0;
0050 }
0051
0052 static inline void fd_free_dma(void)
0053 {
0054 }
0055
0056 static inline void fd_clear_dma_ff(void)
0057 {
0058 }
0059
0060 static inline void fd_set_dma_mode(char mode)
0061 {
0062 vdma_set_mode(JAZZ_FLOPPY_DMA, mode);
0063 }
0064
0065 static inline void fd_set_dma_addr(char *a)
0066 {
0067 vdma_set_addr(JAZZ_FLOPPY_DMA, vdma_phys2log(CPHYSADDR((unsigned long)a)));
0068 }
0069
0070 static inline void fd_set_dma_count(unsigned int count)
0071 {
0072 vdma_set_count(JAZZ_FLOPPY_DMA, count);
0073 }
0074
0075 static inline int fd_get_dma_residue(void)
0076 {
0077 return vdma_get_residue(JAZZ_FLOPPY_DMA);
0078 }
0079
0080 static inline void fd_enable_irq(void)
0081 {
0082 }
0083
0084 static inline void fd_disable_irq(void)
0085 {
0086 }
0087
0088 static inline int fd_request_irq(void)
0089 {
0090 return request_irq(FLOPPY_IRQ, floppy_interrupt,
0091 0, "floppy", NULL);
0092 }
0093
0094 static inline void fd_free_irq(void)
0095 {
0096 free_irq(FLOPPY_IRQ, NULL);
0097 }
0098
0099 static inline unsigned long fd_getfdaddr1(void)
0100 {
0101 return JAZZ_FDC_BASE;
0102 }
0103
0104 static inline unsigned long fd_dma_mem_alloc(unsigned long size)
0105 {
0106 unsigned long mem;
0107
0108 mem = __get_dma_pages(GFP_KERNEL, get_order(size));
0109 if(!mem)
0110 return 0;
0111 vdma_alloc(CPHYSADDR(mem), size);
0112
0113 return mem;
0114 }
0115
0116 static inline void fd_dma_mem_free(unsigned long addr, unsigned long size)
0117 {
0118 vdma_free(vdma_phys2log(CPHYSADDR(addr)));
0119 free_pages(addr, get_order(size));
0120 }
0121
0122 static inline unsigned long fd_drive_type(unsigned long n)
0123 {
0124
0125
0126
0127 if (n == 0)
0128 return 4;
0129
0130 return 0;
0131 }
0132
0133 #endif