6 #ifndef __ASM_SPARC_FLOPPY_H
7 #define __ASM_SPARC_FLOPPY_H
13 #include <asm/pgtable.h>
14 #include <asm/idprom.h>
15 #include <asm/oplib.h>
22 #define release_region(X, Y) do { } while(0)
23 #define request_region(X, Y, Z) (1)
32 #define dcr_82072 status_82072
33 #define status1_82077 status_82072
36 #define status2_82077 data_82072
42 #define drs_82077 status_82077
47 #define dcr_82077 dir_82077
61 #define fd_inb(port) sun_fdops.fd_inb(port)
62 #define fd_outb(value,port) sun_fdops.fd_outb(value,port)
63 #define fd_enable_dma() sun_fd_enable_dma()
64 #define fd_disable_dma() sun_fd_disable_dma()
65 #define fd_request_dma() (0)
67 #define fd_clear_dma_ff()
68 #define fd_set_dma_mode(mode) sun_fd_set_dma_mode(mode)
69 #define fd_set_dma_addr(addr) sun_fd_set_dma_addr(addr)
70 #define fd_set_dma_count(count) sun_fd_set_dma_count(count)
71 #define fd_enable_irq()
72 #define fd_disable_irq()
73 #define fd_cacheflush(addr, size)
74 #define fd_request_irq() sun_fd_request_irq()
77 #define fd_dma_mem_alloc(size) ((unsigned long) vmalloc(size))
78 #define fd_dma_mem_free(addr,size) (vfree((void *)(addr)))
82 #define get_dma_residue(x) (0)
84 #define FLOPPY0_TYPE 4
85 #define FLOPPY1_TYPE 0
88 #undef HAVE_DISABLE_HLT
94 #define FDC1 sun_floppy_init()
100 #define CROSS_64KB(a,s) (0)
103 static void sun_set_dor(
unsigned char value,
int fdc_82077)
109 static unsigned char sun_read_dir(
void)
114 static unsigned char sun_82072_fd_inb(
int port)
119 printk(
"floppy: Asked to read unknown port %d\n", port);
120 panic(
"floppy: Port bolixed.");
126 return sun_read_dir();
128 panic(
"sun_82072_fd_inb: How did I get here?");
131 static void sun_82072_fd_outb(
unsigned char value,
int port)
136 printk(
"floppy: Asked to write to unknown port %d\n", port);
137 panic(
"floppy: Port bolixed.");
139 sun_set_dor(value, 0);
145 sun_fdc->dcr_82072 =
value;
154 static unsigned char sun_82077_fd_inb(
int port)
159 printk(
"floppy: Asked to read unknown port %d\n", port);
160 panic(
"floppy: Port bolixed.");
174 return sun_read_dir();
176 panic(
"sun_82077_fd_inb: How did I get here?");
179 static void sun_82077_fd_outb(
unsigned char value,
int port)
184 printk(
"floppy: Asked to write to unknown port %d\n", port);
185 panic(
"floppy: Port bolixed.");
187 sun_set_dor(value, 1);
193 sun_fdc->dcr_82077 =
value;
229 static inline void sun_fd_disable_dma(
void)
235 static inline void sun_fd_set_dma_mode(
int mode)
245 printk(
"Unknown dma mode %d\n", mode);
246 panic(
"floppy: Giving up...");
250 static inline void sun_fd_set_dma_addr(
char *
buffer)
255 static inline void sun_fd_set_dma_count(
int length)
260 static inline void sun_fd_enable_dma(
void)
269 static int sun_fd_request_irq(
void)
283 static int sun_floppy_init(
void)
317 if(!
strcmp(state,
"disabled")) {
321 num_regs =
prom_getproperty(fd_node,
"reg", (
char *) fd_regs,
sizeof(fd_regs));
322 num_regs = (num_regs /
sizeof(fd_regs[0]));
325 r.flags = fd_regs[0].which_io;
326 r.start = fd_regs[0].phys_addr;
327 sun_fdc =
of_ioremap(&
r, 0, fd_regs[0].reg_size,
"floppy");
333 for_each_node_by_name(dp,
"SUNW,fdtwo") {
339 for_each_node_by_name(dp,
"fd") {
356 sun_fdops.fd_inb = sun_82077_fd_inb;
357 sun_fdops.fd_outb = sun_82077_fd_outb;
363 sun_fdops.fd_inb = sun_82072_fd_inb;
364 sun_fdops.fd_outb = sun_82072_fd_outb;
370 allowed_drive_mask = 0x01;
371 return (
int) sun_fdc;
377 static int sparc_eject(
void)
379 set_dor(0x00, 0xff, 0x90);
381 set_dor(0x00, 0x6f, 0x00);
386 #define fd_eject(drive) sparc_eject()
388 #define EXTRA_FLOPPY_PARAMS
392 #define claim_dma_lock() \
393 ({ unsigned long flags; \
394 spin_lock_irqsave(&dma_spin_lock, flags); \
398 #define release_dma_lock(__flags) \
399 spin_unlock_irqrestore(&dma_spin_lock, __flags);