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 * Low-level floppy stuff for Jazz family machines.
8 * Copyright (C) 1998 by Ralf Baechle
10 #include <linux/delay.h>
11 #include <linux/init.h>
12 #include <linux/linkage.h>
13 #include <linux/types.h>
15 #include <asm/addrspace.h>
17 #include <asm/jazzdma.h>
18 #include <asm/keyboard.h>
19 #include <asm/pgtable.h>
20 #include <asm/floppy.h>
22 static unsigned char jazz_fd_inb(unsigned int port)
26 c = *(volatile unsigned char *) port;
32 static void jazz_fd_outb(unsigned char value, unsigned int port)
34 *(volatile unsigned char *) port = value;
38 * How to access the floppy DMA functions.
40 static void jazz_fd_enable_dma(int channel)
42 vdma_enable(JAZZ_FLOPPY_DMA);
45 static void jazz_fd_disable_dma(int channel)
47 vdma_disable(JAZZ_FLOPPY_DMA);
50 static int jazz_fd_request_dma(int channel)
55 static void jazz_fd_free_dma(int channel)
59 static void jazz_fd_clear_dma_ff(int channel)
63 static void jazz_fd_set_dma_mode(int channel, char mode)
65 vdma_set_mode(JAZZ_FLOPPY_DMA, mode);
68 static void jazz_fd_set_dma_addr(int channel, unsigned int a)
70 vdma_set_addr(JAZZ_FLOPPY_DMA, vdma_phys2log(PHYSADDR(a)));
73 static void jazz_fd_set_dma_count(int channel, unsigned int count)
75 vdma_set_count(JAZZ_FLOPPY_DMA, count);
78 static int jazz_fd_get_dma_residue(int channel)
80 return vdma_get_residue(JAZZ_FLOPPY_DMA);
83 static void jazz_fd_enable_irq(int irq)
87 static void jazz_fd_disable_irq(int irq)
91 static unsigned long jazz_fd_getfdaddr1(void)
96 static unsigned long jazz_fd_dma_mem_alloc(unsigned long size)
100 mem = __get_dma_pages(GFP_KERNEL, get_order(size));
103 vdma_alloc(PHYSADDR(mem), size); /* XXX error checking */
108 static void jazz_fd_dma_mem_free(unsigned long addr,
111 vdma_free(vdma_phys2log(PHYSADDR(addr)));
112 free_pages(addr, get_order(size));
115 static unsigned long jazz_fd_drive_type(unsigned long n)
117 /* XXX This is wrong for machines with ED 2.88mb disk drives like the
118 Olivetti M700. Anyway, we should suck this from the ARC
121 return 4; /* 3,5", 1.44mb */
126 struct fd_ops jazz_fd_ops = {
128 * How to access the floppy controller's ports
133 * How to access the floppy DMA functions.
139 jazz_fd_clear_dma_ff,
140 jazz_fd_set_dma_mode,
141 jazz_fd_set_dma_addr,
142 jazz_fd_set_dma_count,
143 jazz_fd_get_dma_residue,
147 jazz_fd_dma_mem_alloc,
148 jazz_fd_dma_mem_free,