1 /* SPDX-License-Identifier: GPL-2.0-only */ 2 /* 3 * arch/arm/include/asm/floppy.h 4 * 5 * Copyright (C) 1996-2000 Russell King 6 * 7 * Note that we don't touch FLOPPY_DMA nor FLOPPY_IRQ here 8 */ 9 #ifndef __ASM_ARM_FLOPPY_H 10 #define __ASM_ARM_FLOPPY_H 11 12 #define fd_outb(val, base, reg) \ 13 do { \ 14 int new_val = (val); \ 15 if ((reg) == FD_DOR) { \ 16 if (new_val & 0xf0) \ 17 new_val = (new_val & 0x0c) | \ 18 floppy_selects[new_val & 3]; \ 19 else \ 20 new_val &= 0x0c; \ 21 } \ 22 outb(new_val, (base) + (reg)); \ 23 } while(0) 24 25 #define fd_inb(base, reg) inb((base) + (reg)) 26 #define fd_request_irq() request_irq(IRQ_FLOPPYDISK,floppy_interrupt,\ 27 0,"floppy",NULL) 28 #define fd_free_irq() free_irq(IRQ_FLOPPYDISK,NULL) 29 #define fd_disable_irq() disable_irq(IRQ_FLOPPYDISK) 30 #define fd_enable_irq() enable_irq(IRQ_FLOPPYDISK) 31 32 static inline int fd_dma_setup(void *data, unsigned int length, 33 unsigned int mode, unsigned long addr) 34 { 35 set_dma_mode(DMA_FLOPPY, mode); 36 __set_dma_addr(DMA_FLOPPY, data); 37 set_dma_count(DMA_FLOPPY, length); 38 virtual_dma_port = addr; 39 enable_dma(DMA_FLOPPY); 40 return 0; 41 } 42 #define fd_dma_setup fd_dma_setup 43 44 #define fd_request_dma() request_dma(DMA_FLOPPY,"floppy") 45 #define fd_free_dma() free_dma(DMA_FLOPPY) 46 #define fd_disable_dma() disable_dma(DMA_FLOPPY) 47 48 /* need to clean up dma.h */ 49 #define DMA_FLOPPYDISK DMA_FLOPPY 50 51 /* Floppy_selects is the list of DOR's to select drive fd 52 * 53 * On initialisation, the floppy list is scanned, and the drives allocated 54 * in the order that they are found. This is done by seeking the drive 55 * to a non-zero track, and then restoring it to track 0. If an error occurs, 56 * then there is no floppy drive present. [to be put back in again] 57 */ 58 static unsigned char floppy_selects[4] = { 0x10, 0x21, 0x23, 0x33 }; 59 60 #define FDC1 (0x3f0) 61 62 #define FLOPPY0_TYPE 4 63 #define FLOPPY1_TYPE 4 64 65 #define N_FDC 1 66 #define N_DRIVE 4 67 68 #define CROSS_64KB(a,s) (0) 69 70 /* 71 * This allows people to reverse the order of 72 * fd0 and fd1, in case their hardware is 73 * strangely connected (as some RiscPCs 74 * and A5000s seem to be). 75 */ 76 static void driveswap(int *ints, int dummy, int dummy2) 77 { 78 swap(floppy_selects[0], floppy_selects[1]); 79 } 80 81 #define EXTRA_FLOPPY_PARAMS ,{ "driveswap", &driveswap, NULL, 0, 0 } 82 83 #endif 84