1 /* $Id: floppy-jazz.c,v 1.1 1998/05/07 18:38:29 ralf Exp $
3 * This file is subject to the terms and conditions of the GNU General Public
4 * License. See the file "COPYING" in the main directory of this archive
7 * Low-level floppy stuff for Jazz family machines.
9 * Copyright (C) 1998 by Ralf Baechle
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/keyboard.h>
20 #include <asm/pgtable.h>
21 #include <asm/floppy.h>
23 static unsigned char jazz_fd_inb(unsigned int port
)
27 c
= *(volatile unsigned char *) port
;
33 static void jazz_fd_outb(unsigned char value
, unsigned int port
)
35 *(volatile unsigned char *) port
= value
;
39 * How to access the floppy DMA functions.
41 static void jazz_fd_enable_dma(int channel
)
43 vdma_enable(JAZZ_FLOPPY_DMA
);
46 static void jazz_fd_disable_dma(int channel
)
48 vdma_disable(JAZZ_FLOPPY_DMA
);
51 static int jazz_fd_request_dma(int channel
)
56 static void jazz_fd_free_dma(int channel
)
60 static void jazz_fd_clear_dma_ff(int channel
)
64 static void jazz_fd_set_dma_mode(int channel
, char mode
)
66 vdma_set_mode(JAZZ_FLOPPY_DMA
, mode
);
69 static void jazz_fd_set_dma_addr(int channel
, unsigned int a
)
71 vdma_set_addr(JAZZ_FLOPPY_DMA
, vdma_phys2log(PHYSADDR(a
)));
74 static void jazz_fd_set_dma_count(int channel
, unsigned int count
)
76 vdma_set_count(JAZZ_FLOPPY_DMA
, count
);
79 static int jazz_fd_get_dma_residue(int channel
)
81 return vdma_get_residue(JAZZ_FLOPPY_DMA
);
84 static void jazz_fd_enable_irq(int irq
)
88 static void jazz_fd_disable_irq(int irq
)
92 static unsigned long jazz_fd_getfdaddr1(void)
97 /* Pure 2^n version of get_order */
98 extern inline int __get_order(unsigned long size
)
102 size
= (size
-1) >> (PAGE_SHIFT
-1);
111 static unsigned long jazz_fd_dma_mem_alloc(unsigned long size
)
113 int order
= __get_order(size
);
116 mem
= __get_dma_pages(GFP_KERNEL
, order
);
119 vdma_alloc(PHYSADDR(mem
), size
); /* XXX error checking */
124 static void jazz_fd_dma_mem_free(unsigned long addr
,
127 vdma_free(vdma_phys2log(PHYSADDR(addr
)));
128 free_pages(addr
, __get_order(size
));
131 static unsigned long jazz_fd_drive_type(unsigned long n
)
133 /* XXX This is wrong for machines with ED 2.88mb disk drives like the
134 Olivetti M700. Anyway, we should suck this from the ARC
137 return 4; /* 3,5", 1.44mb */
142 struct fd_ops jazz_fd_ops
= {
144 * How to access the floppy controller's ports
149 * How to access the floppy DMA functions.
155 jazz_fd_clear_dma_ff
,
156 jazz_fd_set_dma_mode
,
157 jazz_fd_set_dma_addr
,
158 jazz_fd_set_dma_count
,
159 jazz_fd_get_dma_residue
,
163 jazz_fd_dma_mem_alloc
,
164 jazz_fd_dma_mem_free
,