1 |
1633 |
jcastillo |
/*
|
2 |
|
|
* Architecture specific parts of the Floppy driver
|
3 |
|
|
*
|
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.
|
7 |
|
|
*
|
8 |
|
|
* Copyright (C) 1995
|
9 |
|
|
*/
|
10 |
|
|
#ifndef __ASM_MIPS_FLOPPY_H
|
11 |
|
|
#define __ASM_MIPS_FLOPPY_H
|
12 |
|
|
|
13 |
|
|
#include <asm/bootinfo.h>
|
14 |
|
|
#include <asm/jazz.h>
|
15 |
|
|
#include <asm/jazzdma.h>
|
16 |
|
|
#include <asm/mipsconfig.h>
|
17 |
|
|
#include <asm/vector.h>
|
18 |
|
|
|
19 |
|
|
#define fd_inb(port) feature->fd_inb(port)
|
20 |
|
|
#define fd_outb(value,port) feature->fd_outb(value,port)
|
21 |
|
|
|
22 |
|
|
#define fd_enable_dma() feature->fd_enable_dma()
|
23 |
|
|
#define fd_disable_dma() feature->fd_disable_dma()
|
24 |
|
|
#define fd_request_dma() feature->fd_request_dma()
|
25 |
|
|
#define fd_free_dma() feature->fd_free_dma()
|
26 |
|
|
#define fd_clear_dma_ff() feature->fd_clear_dma_ff()
|
27 |
|
|
#define fd_set_dma_mode(mode) feature->fd_set_dma_mode(mode)
|
28 |
|
|
#define fd_set_dma_addr(addr) feature->fd_set_dma_addr(addr)
|
29 |
|
|
#define fd_set_dma_count(count) feature->fd_set_dma_count(count)
|
30 |
|
|
#define fd_get_dma_residue() feature->fd_get_dma_residue()
|
31 |
|
|
#define fd_enable_irq() feature->fd_enable_irq()
|
32 |
|
|
#define fd_disable_irq() feature->fd_disable_irq()
|
33 |
|
|
#define fd_cacheflush(addr, size) feature->fd_cacheflush((void *)addr, size)
|
34 |
|
|
#define fd_request_irq() request_irq(FLOPPY_IRQ, floppy_interrupt, \
|
35 |
|
|
SA_INTERRUPT|SA_SAMPLE_RANDOM, \
|
36 |
|
|
"floppy", NULL)
|
37 |
|
|
#define fd_free_irq() free_irq(FLOPPY_IRQ, NULL);
|
38 |
|
|
|
39 |
|
|
#define MAX_BUFFER_SECTORS 24
|
40 |
|
|
|
41 |
|
|
static unsigned long mips_dma_mem_alloc(unsigned long size)
|
42 |
|
|
{
|
43 |
|
|
int order = __get_order(size);
|
44 |
|
|
unsigned long mem;
|
45 |
|
|
|
46 |
|
|
mem = __get_dma_pages(GFP_KERNEL,order);
|
47 |
|
|
if(!mem)
|
48 |
|
|
return 0;
|
49 |
|
|
if (boot_info.machtype == MACH_ACER_PICA_61 ||
|
50 |
|
|
boot_info.machtype == MACH_MIPS_MAGNUM_4000 ||
|
51 |
|
|
boot_info.machtype == MACH_OLIVETTI_M700)
|
52 |
|
|
vdma_alloc(PHYSADDR(mem), size);
|
53 |
|
|
return mem;
|
54 |
|
|
}
|
55 |
|
|
|
56 |
|
|
static void mips_dma_mem_free(unsigned long addr, unsigned long size)
|
57 |
|
|
{
|
58 |
|
|
if (boot_info.machtype == MACH_ACER_PICA_61 ||
|
59 |
|
|
boot_info.machtype == MACH_MIPS_MAGNUM_4000 ||
|
60 |
|
|
boot_info.machtype == MACH_OLIVETTI_M700)
|
61 |
|
|
vdma_free(PHYSADDR(addr));
|
62 |
|
|
free_pages(addr, __get_order(size));
|
63 |
|
|
}
|
64 |
|
|
|
65 |
|
|
#define fd_dma_mem_alloc(mem,size) mips_dma_mem_alloc(mem,size)
|
66 |
|
|
#define fd_dma_mem_free(mem) mips_dma_mem_free(mem)
|
67 |
|
|
|
68 |
|
|
/*
|
69 |
|
|
* And on Mips's the CMOS info fails also ...
|
70 |
|
|
*
|
71 |
|
|
* FIXME: This information should come from the ARC configuration tree
|
72 |
|
|
* or wherever a particular machine has stored this ...
|
73 |
|
|
*/
|
74 |
|
|
#define FLOPPY0_TYPE 4 /* this is wrong for the Olli M700, but who cares... */
|
75 |
|
|
#define FLOPPY1_TYPE 0
|
76 |
|
|
|
77 |
|
|
#define FDC1 ((boot_info.machtype == MACH_ACER_PICA_61 || \
|
78 |
|
|
boot_info.machtype == MACH_MIPS_MAGNUM_4000 || \
|
79 |
|
|
boot_info.machtype == MACH_OLIVETTI_M700) ? \
|
80 |
|
|
0xe0003000 : 0x3f0)
|
81 |
|
|
static int FDC2=-1;
|
82 |
|
|
|
83 |
|
|
#define N_FDC 1 /* do you *really* want a second controller? */
|
84 |
|
|
#define N_DRIVE 8
|
85 |
|
|
|
86 |
|
|
/*
|
87 |
|
|
* The DMA channel used by the floppy controller cannot access data at
|
88 |
|
|
* addresses >= 16MB
|
89 |
|
|
*
|
90 |
|
|
* Went back to the 1MB limit, as some people had problems with the floppy
|
91 |
|
|
* driver otherwise. It doesn't matter much for performance anyway, as most
|
92 |
|
|
* floppy accesses go through the track buffer.
|
93 |
|
|
*
|
94 |
|
|
* On MIPSes using vdma, this actually means that *all* transfers go thru
|
95 |
|
|
* the * track buffer since 0x1000000 is always smaller than KSEG0/1.
|
96 |
|
|
* Actually this needs to be a bit more complicated since the so much different
|
97 |
|
|
* hardware available with MIPS CPUs ...
|
98 |
|
|
*/
|
99 |
|
|
#define CROSS_64KB(a,s) ((unsigned long)(a)/K_64 != ((unsigned long)(a) + (s) - 1) / K_64)
|
100 |
|
|
|
101 |
|
|
#endif /* __ASM_MIPS_FLOPPY_H */
|