Linux-2.6.12-rc2
[linux-2.6/linux-acpi-2.6/ibm-acpi-2.6.git] / include / asm-ppc64 / floppy.h
blob5c497b588e542acf78cb00e1e33a509050a28fca
1 /*
2 * Architecture specific parts of the Floppy driver
4 * This file is subject to the terms and conditions of the GNU General Public
5 * License. See the file "COPYING" in the main directory of this archive
6 * for more details.
8 * Copyright (C) 1995
9 */
10 #ifndef __ASM_PPC64_FLOPPY_H
11 #define __ASM_PPC64_FLOPPY_H
13 #include <linux/config.h>
14 #include <asm/machdep.h>
16 #define fd_inb(port) inb_p(port)
17 #define fd_outb(value,port) outb_p(value,port)
19 #define fd_enable_dma() enable_dma(FLOPPY_DMA)
20 #define fd_disable_dma() disable_dma(FLOPPY_DMA)
21 #define fd_request_dma() request_dma(FLOPPY_DMA,"floppy")
22 #define fd_free_dma() free_dma(FLOPPY_DMA)
23 #define fd_clear_dma_ff() clear_dma_ff(FLOPPY_DMA)
24 #define fd_set_dma_mode(mode) set_dma_mode(FLOPPY_DMA,mode)
25 #define fd_set_dma_count(count) set_dma_count(FLOPPY_DMA,count)
26 #define fd_enable_irq() enable_irq(FLOPPY_IRQ)
27 #define fd_disable_irq() disable_irq(FLOPPY_IRQ)
28 #define fd_cacheflush(addr,size) /* nothing */
29 #define fd_request_irq() request_irq(FLOPPY_IRQ, floppy_interrupt, \
30 SA_INTERRUPT|SA_SAMPLE_RANDOM, \
31 "floppy", NULL)
32 #define fd_free_irq() free_irq(FLOPPY_IRQ, NULL);
34 #ifdef CONFIG_PCI
36 #include <linux/pci.h>
38 #define fd_dma_setup(addr,size,mode,io) ppc64_fd_dma_setup(addr,size,mode,io)
40 static __inline__ int
41 ppc64_fd_dma_setup(char *addr, unsigned long size, int mode, int io)
43 static unsigned long prev_size;
44 static dma_addr_t bus_addr = 0;
45 static char *prev_addr;
46 static int prev_dir;
47 int dir;
49 dir = (mode == DMA_MODE_READ) ? PCI_DMA_FROMDEVICE : PCI_DMA_TODEVICE;
51 if (bus_addr
52 && (addr != prev_addr || size != prev_size || dir != prev_dir)) {
53 /* different from last time -- unmap prev */
54 pci_unmap_single(NULL, bus_addr, prev_size, prev_dir);
55 bus_addr = 0;
58 if (!bus_addr) /* need to map it */ {
59 bus_addr = pci_map_single(NULL, addr, size, dir);
62 /* remember this one as prev */
63 prev_addr = addr;
64 prev_size = size;
65 prev_dir = dir;
67 fd_clear_dma_ff();
68 fd_cacheflush(addr, size);
69 fd_set_dma_mode(mode);
70 set_dma_addr(FLOPPY_DMA, bus_addr);
71 fd_set_dma_count(size);
72 virtual_dma_port = io;
73 fd_enable_dma();
75 return 0;
78 #endif /* CONFIG_PCI */
80 __inline__ void virtual_dma_init(void)
82 /* Nothing to do on PowerPC */
85 static int FDC1 = 0x3f0;
86 static int FDC2 = -1;
89 * Again, the CMOS information not available
91 #define FLOPPY0_TYPE 6
92 #define FLOPPY1_TYPE 0
94 #define N_FDC 2 /* Don't change this! */
95 #define N_DRIVE 8
97 #define FLOPPY_MOTOR_MASK 0xf0
100 * The PowerPC has no problems with floppy DMA crossing 64k borders.
102 #define CROSS_64KB(a,s) (0)
104 #define EXTRA_FLOPPY_PARAMS
106 #endif /* __ASM_PPC64_FLOPPY_H */