1*b2441318SGreg Kroah-Hartman /* SPDX-License-Identifier: GPL-2.0 */ 2a439fe51SSam Ravnborg /* asm/floppy.h: Sparc specific parts of the Floppy driver. 3a439fe51SSam Ravnborg * 4a439fe51SSam Ravnborg * Copyright (C) 1995 David S. Miller (davem@davemloft.net) 5a439fe51SSam Ravnborg */ 6a439fe51SSam Ravnborg 7a439fe51SSam Ravnborg #ifndef __ASM_SPARC_FLOPPY_H 8a439fe51SSam Ravnborg #define __ASM_SPARC_FLOPPY_H 9a439fe51SSam Ravnborg 10454eeb2dSDavid S. Miller #include <linux/of.h> 11454eeb2dSDavid S. Miller #include <linux/of_device.h> 12454eeb2dSDavid S. Miller 13a439fe51SSam Ravnborg #include <asm/pgtable.h> 14a439fe51SSam Ravnborg #include <asm/idprom.h> 15a439fe51SSam Ravnborg #include <asm/oplib.h> 16a439fe51SSam Ravnborg #include <asm/auxio.h> 17fbb86383SSam Ravnborg #include <asm/setup.h> 18fbb86383SSam Ravnborg #include <asm/page.h> 19a439fe51SSam Ravnborg #include <asm/irq.h> 20a439fe51SSam Ravnborg 21a439fe51SSam Ravnborg /* We don't need no stinkin' I/O port allocation crap. */ 22a439fe51SSam Ravnborg #undef release_region 23a439fe51SSam Ravnborg #undef request_region 24a439fe51SSam Ravnborg #define release_region(X, Y) do { } while(0) 25a439fe51SSam Ravnborg #define request_region(X, Y, Z) (1) 26a439fe51SSam Ravnborg 27a439fe51SSam Ravnborg /* References: 28a439fe51SSam Ravnborg * 1) Netbsd Sun floppy driver. 29a439fe51SSam Ravnborg * 2) NCR 82077 controller manual 30a439fe51SSam Ravnborg * 3) Intel 82077 controller manual 31a439fe51SSam Ravnborg */ 32a439fe51SSam Ravnborg struct sun_flpy_controller { 33a439fe51SSam Ravnborg volatile unsigned char status_82072; /* Main Status reg. */ 34a439fe51SSam Ravnborg #define dcr_82072 status_82072 /* Digital Control reg. */ 35a439fe51SSam Ravnborg #define status1_82077 status_82072 /* Auxiliary Status reg. 1 */ 36a439fe51SSam Ravnborg 37a439fe51SSam Ravnborg volatile unsigned char data_82072; /* Data fifo. */ 38a439fe51SSam Ravnborg #define status2_82077 data_82072 /* Auxiliary Status reg. 2 */ 39a439fe51SSam Ravnborg 40a439fe51SSam Ravnborg volatile unsigned char dor_82077; /* Digital Output reg. */ 41a439fe51SSam Ravnborg volatile unsigned char tapectl_82077; /* What the? Tape control reg? */ 42a439fe51SSam Ravnborg 43a439fe51SSam Ravnborg volatile unsigned char status_82077; /* Main Status Register. */ 44a439fe51SSam Ravnborg #define drs_82077 status_82077 /* Digital Rate Select reg. */ 45a439fe51SSam Ravnborg 46a439fe51SSam Ravnborg volatile unsigned char data_82077; /* Data fifo. */ 47a439fe51SSam Ravnborg volatile unsigned char ___unused; 48a439fe51SSam Ravnborg volatile unsigned char dir_82077; /* Digital Input reg. */ 49a439fe51SSam Ravnborg #define dcr_82077 dir_82077 /* Config Control reg. */ 50a439fe51SSam Ravnborg }; 51a439fe51SSam Ravnborg 52a439fe51SSam Ravnborg /* You'll only ever find one controller on a SparcStation anyways. */ 53a439fe51SSam Ravnborg static struct sun_flpy_controller *sun_fdc = NULL; 54a439fe51SSam Ravnborg 55a439fe51SSam Ravnborg struct sun_floppy_ops { 56a439fe51SSam Ravnborg unsigned char (*fd_inb)(int port); 57a439fe51SSam Ravnborg void (*fd_outb)(unsigned char value, int port); 58a439fe51SSam Ravnborg }; 59a439fe51SSam Ravnborg 60a439fe51SSam Ravnborg static struct sun_floppy_ops sun_fdops; 61a439fe51SSam Ravnborg 62a439fe51SSam Ravnborg #define fd_inb(port) sun_fdops.fd_inb(port) 63a439fe51SSam Ravnborg #define fd_outb(value,port) sun_fdops.fd_outb(value,port) 64a439fe51SSam Ravnborg #define fd_enable_dma() sun_fd_enable_dma() 65a439fe51SSam Ravnborg #define fd_disable_dma() sun_fd_disable_dma() 66a439fe51SSam Ravnborg #define fd_request_dma() (0) /* nothing... */ 67a439fe51SSam Ravnborg #define fd_free_dma() /* nothing... */ 68a439fe51SSam Ravnborg #define fd_clear_dma_ff() /* nothing... */ 69a439fe51SSam Ravnborg #define fd_set_dma_mode(mode) sun_fd_set_dma_mode(mode) 70a439fe51SSam Ravnborg #define fd_set_dma_addr(addr) sun_fd_set_dma_addr(addr) 71a439fe51SSam Ravnborg #define fd_set_dma_count(count) sun_fd_set_dma_count(count) 72a439fe51SSam Ravnborg #define fd_enable_irq() /* nothing... */ 73a439fe51SSam Ravnborg #define fd_disable_irq() /* nothing... */ 74a439fe51SSam Ravnborg #define fd_cacheflush(addr, size) /* nothing... */ 75a439fe51SSam Ravnborg #define fd_request_irq() sun_fd_request_irq() 76a439fe51SSam Ravnborg #define fd_free_irq() /* nothing... */ 77a439fe51SSam Ravnborg #if 0 /* P3: added by Alain, these cause a MMU corruption. 19960524 XXX */ 78a439fe51SSam Ravnborg #define fd_dma_mem_alloc(size) ((unsigned long) vmalloc(size)) 79a439fe51SSam Ravnborg #define fd_dma_mem_free(addr,size) (vfree((void *)(addr))) 80a439fe51SSam Ravnborg #endif 81a439fe51SSam Ravnborg 82a439fe51SSam Ravnborg /* XXX This isn't really correct. XXX */ 83a439fe51SSam Ravnborg #define get_dma_residue(x) (0) 84a439fe51SSam Ravnborg 85a439fe51SSam Ravnborg #define FLOPPY0_TYPE 4 86a439fe51SSam Ravnborg #define FLOPPY1_TYPE 0 87a439fe51SSam Ravnborg 88a439fe51SSam Ravnborg /* Super paranoid... */ 89a439fe51SSam Ravnborg #undef HAVE_DISABLE_HLT 90a439fe51SSam Ravnborg 91a439fe51SSam Ravnborg /* Here is where we catch the floppy driver trying to initialize, 92a439fe51SSam Ravnborg * therefore this is where we call the PROM device tree probing 93a439fe51SSam Ravnborg * routine etc. on the Sparc. 94a439fe51SSam Ravnborg */ 95a439fe51SSam Ravnborg #define FDC1 sun_floppy_init() 96a439fe51SSam Ravnborg 97a439fe51SSam Ravnborg #define N_FDC 1 98a439fe51SSam Ravnborg #define N_DRIVE 8 99a439fe51SSam Ravnborg 100a439fe51SSam Ravnborg /* No 64k boundary crossing problems on the Sparc. */ 101a439fe51SSam Ravnborg #define CROSS_64KB(a,s) (0) 102a439fe51SSam Ravnborg 103a439fe51SSam Ravnborg /* Routines unique to each controller type on a Sun. */ 104a439fe51SSam Ravnborg static void sun_set_dor(unsigned char value, int fdc_82077) 105a439fe51SSam Ravnborg { 1060301a6cbSDavid S. Miller if (fdc_82077) 107a439fe51SSam Ravnborg sun_fdc->dor_82077 = value; 108a439fe51SSam Ravnborg } 109a439fe51SSam Ravnborg 110a439fe51SSam Ravnborg static unsigned char sun_read_dir(void) 111a439fe51SSam Ravnborg { 112a439fe51SSam Ravnborg return sun_fdc->dir_82077; 113a439fe51SSam Ravnborg } 114a439fe51SSam Ravnborg 115a439fe51SSam Ravnborg static unsigned char sun_82072_fd_inb(int port) 116a439fe51SSam Ravnborg { 117a439fe51SSam Ravnborg udelay(5); 118a439fe51SSam Ravnborg switch(port & 7) { 119a439fe51SSam Ravnborg default: 120a439fe51SSam Ravnborg printk("floppy: Asked to read unknown port %d\n", port); 121a439fe51SSam Ravnborg panic("floppy: Port bolixed."); 122a439fe51SSam Ravnborg case 4: /* FD_STATUS */ 123a439fe51SSam Ravnborg return sun_fdc->status_82072 & ~STATUS_DMA; 124a439fe51SSam Ravnborg case 5: /* FD_DATA */ 125a439fe51SSam Ravnborg return sun_fdc->data_82072; 126a439fe51SSam Ravnborg case 7: /* FD_DIR */ 127a439fe51SSam Ravnborg return sun_read_dir(); 1286cb79b3fSJoe Perches } 129a439fe51SSam Ravnborg panic("sun_82072_fd_inb: How did I get here?"); 130a439fe51SSam Ravnborg } 131a439fe51SSam Ravnborg 132a439fe51SSam Ravnborg static void sun_82072_fd_outb(unsigned char value, int port) 133a439fe51SSam Ravnborg { 134a439fe51SSam Ravnborg udelay(5); 135a439fe51SSam Ravnborg switch(port & 7) { 136a439fe51SSam Ravnborg default: 137a439fe51SSam Ravnborg printk("floppy: Asked to write to unknown port %d\n", port); 138a439fe51SSam Ravnborg panic("floppy: Port bolixed."); 139a439fe51SSam Ravnborg case 2: /* FD_DOR */ 140a439fe51SSam Ravnborg sun_set_dor(value, 0); 141a439fe51SSam Ravnborg break; 142a439fe51SSam Ravnborg case 5: /* FD_DATA */ 143a439fe51SSam Ravnborg sun_fdc->data_82072 = value; 144a439fe51SSam Ravnborg break; 145a439fe51SSam Ravnborg case 7: /* FD_DCR */ 146a439fe51SSam Ravnborg sun_fdc->dcr_82072 = value; 147a439fe51SSam Ravnborg break; 148a439fe51SSam Ravnborg case 4: /* FD_STATUS */ 149a439fe51SSam Ravnborg sun_fdc->status_82072 = value; 150a439fe51SSam Ravnborg break; 1516cb79b3fSJoe Perches } 152a439fe51SSam Ravnborg return; 153a439fe51SSam Ravnborg } 154a439fe51SSam Ravnborg 155a439fe51SSam Ravnborg static unsigned char sun_82077_fd_inb(int port) 156a439fe51SSam Ravnborg { 157a439fe51SSam Ravnborg udelay(5); 158a439fe51SSam Ravnborg switch(port & 7) { 159a439fe51SSam Ravnborg default: 160a439fe51SSam Ravnborg printk("floppy: Asked to read unknown port %d\n", port); 161a439fe51SSam Ravnborg panic("floppy: Port bolixed."); 162a439fe51SSam Ravnborg case 0: /* FD_STATUS_0 */ 163a439fe51SSam Ravnborg return sun_fdc->status1_82077; 164a439fe51SSam Ravnborg case 1: /* FD_STATUS_1 */ 165a439fe51SSam Ravnborg return sun_fdc->status2_82077; 166a439fe51SSam Ravnborg case 2: /* FD_DOR */ 167a439fe51SSam Ravnborg return sun_fdc->dor_82077; 168a439fe51SSam Ravnborg case 3: /* FD_TDR */ 169a439fe51SSam Ravnborg return sun_fdc->tapectl_82077; 170a439fe51SSam Ravnborg case 4: /* FD_STATUS */ 171a439fe51SSam Ravnborg return sun_fdc->status_82077 & ~STATUS_DMA; 172a439fe51SSam Ravnborg case 5: /* FD_DATA */ 173a439fe51SSam Ravnborg return sun_fdc->data_82077; 174a439fe51SSam Ravnborg case 7: /* FD_DIR */ 175a439fe51SSam Ravnborg return sun_read_dir(); 1766cb79b3fSJoe Perches } 177a439fe51SSam Ravnborg panic("sun_82077_fd_inb: How did I get here?"); 178a439fe51SSam Ravnborg } 179a439fe51SSam Ravnborg 180a439fe51SSam Ravnborg static void sun_82077_fd_outb(unsigned char value, int port) 181a439fe51SSam Ravnborg { 182a439fe51SSam Ravnborg udelay(5); 183a439fe51SSam Ravnborg switch(port & 7) { 184a439fe51SSam Ravnborg default: 185a439fe51SSam Ravnborg printk("floppy: Asked to write to unknown port %d\n", port); 186a439fe51SSam Ravnborg panic("floppy: Port bolixed."); 187a439fe51SSam Ravnborg case 2: /* FD_DOR */ 188a439fe51SSam Ravnborg sun_set_dor(value, 1); 189a439fe51SSam Ravnborg break; 190a439fe51SSam Ravnborg case 5: /* FD_DATA */ 191a439fe51SSam Ravnborg sun_fdc->data_82077 = value; 192a439fe51SSam Ravnborg break; 193a439fe51SSam Ravnborg case 7: /* FD_DCR */ 194a439fe51SSam Ravnborg sun_fdc->dcr_82077 = value; 195a439fe51SSam Ravnborg break; 196a439fe51SSam Ravnborg case 4: /* FD_STATUS */ 197a439fe51SSam Ravnborg sun_fdc->status_82077 = value; 198a439fe51SSam Ravnborg break; 199a439fe51SSam Ravnborg case 3: /* FD_TDR */ 200a439fe51SSam Ravnborg sun_fdc->tapectl_82077 = value; 201a439fe51SSam Ravnborg break; 2026cb79b3fSJoe Perches } 203a439fe51SSam Ravnborg return; 204a439fe51SSam Ravnborg } 205a439fe51SSam Ravnborg 206a439fe51SSam Ravnborg /* For pseudo-dma (Sun floppy drives have no real DMA available to 207a439fe51SSam Ravnborg * them so we must eat the data fifo bytes directly ourselves) we have 208a439fe51SSam Ravnborg * three state variables. doing_pdma tells our inline low-level 209a439fe51SSam Ravnborg * assembly floppy interrupt entry point whether it should sit and eat 210a439fe51SSam Ravnborg * bytes from the fifo or just transfer control up to the higher level 211a439fe51SSam Ravnborg * floppy interrupt c-code. I tried very hard but I could not get the 212a439fe51SSam Ravnborg * pseudo-dma to work in c-code without getting many overruns and 213a439fe51SSam Ravnborg * underruns. If non-zero, doing_pdma encodes the direction of 214a439fe51SSam Ravnborg * the transfer for debugging. 1=read 2=write 215a439fe51SSam Ravnborg */ 216a439fe51SSam Ravnborg 217a439fe51SSam Ravnborg /* Common routines to all controller types on the Sparc. */ 218a439fe51SSam Ravnborg static inline void virtual_dma_init(void) 219a439fe51SSam Ravnborg { 220a439fe51SSam Ravnborg /* nothing... */ 221a439fe51SSam Ravnborg } 222a439fe51SSam Ravnborg 223a439fe51SSam Ravnborg static inline void sun_fd_disable_dma(void) 224a439fe51SSam Ravnborg { 225a439fe51SSam Ravnborg doing_pdma = 0; 226a439fe51SSam Ravnborg pdma_base = NULL; 227a439fe51SSam Ravnborg } 228a439fe51SSam Ravnborg 229a439fe51SSam Ravnborg static inline void sun_fd_set_dma_mode(int mode) 230a439fe51SSam Ravnborg { 231a439fe51SSam Ravnborg switch(mode) { 232a439fe51SSam Ravnborg case DMA_MODE_READ: 233a439fe51SSam Ravnborg doing_pdma = 1; 234a439fe51SSam Ravnborg break; 235a439fe51SSam Ravnborg case DMA_MODE_WRITE: 236a439fe51SSam Ravnborg doing_pdma = 2; 237a439fe51SSam Ravnborg break; 238a439fe51SSam Ravnborg default: 239a439fe51SSam Ravnborg printk("Unknown dma mode %d\n", mode); 240a439fe51SSam Ravnborg panic("floppy: Giving up..."); 241a439fe51SSam Ravnborg } 242a439fe51SSam Ravnborg } 243a439fe51SSam Ravnborg 244a439fe51SSam Ravnborg static inline void sun_fd_set_dma_addr(char *buffer) 245a439fe51SSam Ravnborg { 246a439fe51SSam Ravnborg pdma_vaddr = buffer; 247a439fe51SSam Ravnborg } 248a439fe51SSam Ravnborg 249a439fe51SSam Ravnborg static inline void sun_fd_set_dma_count(int length) 250a439fe51SSam Ravnborg { 251a439fe51SSam Ravnborg pdma_size = length; 252a439fe51SSam Ravnborg } 253a439fe51SSam Ravnborg 254a439fe51SSam Ravnborg static inline void sun_fd_enable_dma(void) 255a439fe51SSam Ravnborg { 256a439fe51SSam Ravnborg pdma_base = pdma_vaddr; 257a439fe51SSam Ravnborg pdma_areasize = pdma_size; 258a439fe51SSam Ravnborg } 259a439fe51SSam Ravnborg 260f05a6865SSam Ravnborg int sparc_floppy_request_irq(unsigned int irq, irq_handler_t irq_handler); 261a439fe51SSam Ravnborg 262a439fe51SSam Ravnborg static int sun_fd_request_irq(void) 263a439fe51SSam Ravnborg { 264a439fe51SSam Ravnborg static int once = 0; 265a439fe51SSam Ravnborg 266a439fe51SSam Ravnborg if (!once) { 267a439fe51SSam Ravnborg once = 1; 2686baa9b20SSam Ravnborg return sparc_floppy_request_irq(FLOPPY_IRQ, floppy_interrupt); 2696baa9b20SSam Ravnborg } else { 2706baa9b20SSam Ravnborg return 0; 2716baa9b20SSam Ravnborg } 272a439fe51SSam Ravnborg } 273a439fe51SSam Ravnborg 274a439fe51SSam Ravnborg static struct linux_prom_registers fd_regs[2]; 275a439fe51SSam Ravnborg 276a439fe51SSam Ravnborg static int sun_floppy_init(void) 277a439fe51SSam Ravnborg { 2786baa9b20SSam Ravnborg struct platform_device *op; 2796baa9b20SSam Ravnborg struct device_node *dp; 280a439fe51SSam Ravnborg struct resource r; 281144e988dSSam Ravnborg char state[128]; 282144e988dSSam Ravnborg phandle fd_node; 283144e988dSSam Ravnborg phandle tnode; 284144e988dSSam Ravnborg int num_regs; 285a439fe51SSam Ravnborg 286a439fe51SSam Ravnborg use_virtual_dma = 1; 287a439fe51SSam Ravnborg 288a439fe51SSam Ravnborg /* Forget it if we aren't on a machine that could possibly 289a439fe51SSam Ravnborg * ever have a floppy drive. 290a439fe51SSam Ravnborg */ 29158fa4dcbSDavid S. Miller if (sparc_cpu_model != sun4m) { 292a439fe51SSam Ravnborg /* We certainly don't have a floppy controller. */ 293a439fe51SSam Ravnborg goto no_sun_fdc; 294a439fe51SSam Ravnborg } 295a439fe51SSam Ravnborg /* Well, try to find one. */ 296a439fe51SSam Ravnborg tnode = prom_getchild(prom_root_node); 297a439fe51SSam Ravnborg fd_node = prom_searchsiblings(tnode, "obio"); 298a439fe51SSam Ravnborg if (fd_node != 0) { 299a439fe51SSam Ravnborg tnode = prom_getchild(fd_node); 300a439fe51SSam Ravnborg fd_node = prom_searchsiblings(tnode, "SUNW,fdtwo"); 301a439fe51SSam Ravnborg } else { 302a439fe51SSam Ravnborg fd_node = prom_searchsiblings(tnode, "fd"); 303a439fe51SSam Ravnborg } 304a439fe51SSam Ravnborg if (fd_node == 0) { 305a439fe51SSam Ravnborg goto no_sun_fdc; 306a439fe51SSam Ravnborg } 307a439fe51SSam Ravnborg 308a439fe51SSam Ravnborg /* The sun4m lets us know if the controller is actually usable. */ 309144e988dSSam Ravnborg if (prom_getproperty(fd_node, "status", state, sizeof(state)) != -1) { 310a439fe51SSam Ravnborg if(!strcmp(state, "disabled")) { 311a439fe51SSam Ravnborg goto no_sun_fdc; 312a439fe51SSam Ravnborg } 313a439fe51SSam Ravnborg } 314a439fe51SSam Ravnborg num_regs = prom_getproperty(fd_node, "reg", (char *) fd_regs, sizeof(fd_regs)); 315a439fe51SSam Ravnborg num_regs = (num_regs / sizeof(fd_regs[0])); 316a439fe51SSam Ravnborg prom_apply_obio_ranges(fd_regs, num_regs); 317a439fe51SSam Ravnborg memset(&r, 0, sizeof(r)); 318a439fe51SSam Ravnborg r.flags = fd_regs[0].which_io; 319a439fe51SSam Ravnborg r.start = fd_regs[0].phys_addr; 320144e988dSSam Ravnborg sun_fdc = of_ioremap(&r, 0, fd_regs[0].reg_size, "floppy"); 321a439fe51SSam Ravnborg 3226baa9b20SSam Ravnborg /* Look up irq in platform_device. 3236baa9b20SSam Ravnborg * We try "SUNW,fdtwo" and "fd" 3246baa9b20SSam Ravnborg */ 325918f8322SSam Ravnborg op = NULL; 3266baa9b20SSam Ravnborg for_each_node_by_name(dp, "SUNW,fdtwo") { 3276baa9b20SSam Ravnborg op = of_find_device_by_node(dp); 3286baa9b20SSam Ravnborg if (op) 3296baa9b20SSam Ravnborg break; 3306baa9b20SSam Ravnborg } 3316baa9b20SSam Ravnborg if (!op) { 3326baa9b20SSam Ravnborg for_each_node_by_name(dp, "fd") { 3336baa9b20SSam Ravnborg op = of_find_device_by_node(dp); 3346baa9b20SSam Ravnborg if (op) 3356baa9b20SSam Ravnborg break; 3366baa9b20SSam Ravnborg } 3376baa9b20SSam Ravnborg } 3386baa9b20SSam Ravnborg if (!op) 3396baa9b20SSam Ravnborg goto no_sun_fdc; 3406baa9b20SSam Ravnborg 3416baa9b20SSam Ravnborg FLOPPY_IRQ = op->archdata.irqs[0]; 3426baa9b20SSam Ravnborg 343a439fe51SSam Ravnborg /* Last minute sanity check... */ 344a439fe51SSam Ravnborg if (sun_fdc->status_82072 == 0xff) { 345a439fe51SSam Ravnborg sun_fdc = NULL; 346a439fe51SSam Ravnborg goto no_sun_fdc; 347a439fe51SSam Ravnborg } 348a439fe51SSam Ravnborg 349a439fe51SSam Ravnborg sun_fdops.fd_inb = sun_82077_fd_inb; 350a439fe51SSam Ravnborg sun_fdops.fd_outb = sun_82077_fd_outb; 351a439fe51SSam Ravnborg fdc_status = &sun_fdc->status_82077; 352a439fe51SSam Ravnborg 353a439fe51SSam Ravnborg if (sun_fdc->dor_82077 == 0x80) { 354a439fe51SSam Ravnborg sun_fdc->dor_82077 = 0x02; 355a439fe51SSam Ravnborg if (sun_fdc->dor_82077 == 0x80) { 356a439fe51SSam Ravnborg sun_fdops.fd_inb = sun_82072_fd_inb; 357a439fe51SSam Ravnborg sun_fdops.fd_outb = sun_82072_fd_outb; 358a439fe51SSam Ravnborg fdc_status = &sun_fdc->status_82072; 359a439fe51SSam Ravnborg } 360a439fe51SSam Ravnborg } 361a439fe51SSam Ravnborg 362a439fe51SSam Ravnborg /* Success... */ 363a439fe51SSam Ravnborg allowed_drive_mask = 0x01; 364a439fe51SSam Ravnborg return (int) sun_fdc; 365a439fe51SSam Ravnborg 366a439fe51SSam Ravnborg no_sun_fdc: 367a439fe51SSam Ravnborg return -1; 368a439fe51SSam Ravnborg } 369a439fe51SSam Ravnborg 370a439fe51SSam Ravnborg static int sparc_eject(void) 371a439fe51SSam Ravnborg { 372a439fe51SSam Ravnborg set_dor(0x00, 0xff, 0x90); 373a439fe51SSam Ravnborg udelay(500); 374a439fe51SSam Ravnborg set_dor(0x00, 0x6f, 0x00); 375a439fe51SSam Ravnborg udelay(500); 376a439fe51SSam Ravnborg return 0; 377a439fe51SSam Ravnborg } 378a439fe51SSam Ravnborg 379a439fe51SSam Ravnborg #define fd_eject(drive) sparc_eject() 380a439fe51SSam Ravnborg 381a439fe51SSam Ravnborg #define EXTRA_FLOPPY_PARAMS 382a439fe51SSam Ravnborg 383334ae614SDavid S. Miller static DEFINE_SPINLOCK(dma_spin_lock); 384334ae614SDavid S. Miller 385334ae614SDavid S. Miller #define claim_dma_lock() \ 386334ae614SDavid S. Miller ({ unsigned long flags; \ 387334ae614SDavid S. Miller spin_lock_irqsave(&dma_spin_lock, flags); \ 388334ae614SDavid S. Miller flags; \ 389334ae614SDavid S. Miller }) 390334ae614SDavid S. Miller 391334ae614SDavid S. Miller #define release_dma_lock(__flags) \ 392334ae614SDavid S. Miller spin_unlock_irqrestore(&dma_spin_lock, __flags); 393334ae614SDavid S. Miller 394a439fe51SSam Ravnborg #endif /* !(__ASM_SPARC_FLOPPY_H) */ 395