Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0-only */
0002 /*
0003  *  arch/arm/include/asm/floppy.h
0004  *
0005  *  Copyright (C) 1996-2000 Russell King
0006  *
0007  *  Note that we don't touch FLOPPY_DMA nor FLOPPY_IRQ here
0008  */
0009 #ifndef __ASM_ARM_FLOPPY_H
0010 #define __ASM_ARM_FLOPPY_H
0011 
0012 #define fd_outb(val, base, reg)                     \
0013     do {                                \
0014         int new_val = (val);                    \
0015         if ((reg) == FD_DOR) {                  \
0016             if (new_val & 0xf0)             \
0017                 new_val = (new_val & 0x0c) |        \
0018                       floppy_selects[new_val & 3];  \
0019             else                        \
0020                 new_val &= 0x0c;            \
0021         }                           \
0022         outb(new_val, (base) + (reg));              \
0023     } while(0)
0024 
0025 #define fd_inb(base, reg)   inb((base) + (reg))
0026 #define fd_request_irq()    request_irq(IRQ_FLOPPYDISK,floppy_interrupt,\
0027                         0,"floppy",NULL)
0028 #define fd_free_irq()       free_irq(IRQ_FLOPPYDISK,NULL)
0029 #define fd_disable_irq()    disable_irq(IRQ_FLOPPYDISK)
0030 #define fd_enable_irq()     enable_irq(IRQ_FLOPPYDISK)
0031 
0032 static inline int fd_dma_setup(void *data, unsigned int length,
0033                    unsigned int mode, unsigned long addr)
0034 {
0035     set_dma_mode(DMA_FLOPPY, mode);
0036     __set_dma_addr(DMA_FLOPPY, data);
0037     set_dma_count(DMA_FLOPPY, length);
0038     virtual_dma_port = addr;
0039     enable_dma(DMA_FLOPPY);
0040     return 0;
0041 }
0042 #define fd_dma_setup        fd_dma_setup
0043 
0044 #define fd_request_dma()    request_dma(DMA_FLOPPY,"floppy")
0045 #define fd_free_dma()       free_dma(DMA_FLOPPY)
0046 #define fd_disable_dma()    disable_dma(DMA_FLOPPY)
0047 
0048 /* need to clean up dma.h */
0049 #define DMA_FLOPPYDISK      DMA_FLOPPY
0050 
0051 /* Floppy_selects is the list of DOR's to select drive fd
0052  *
0053  * On initialisation, the floppy list is scanned, and the drives allocated
0054  * in the order that they are found.  This is done by seeking the drive
0055  * to a non-zero track, and then restoring it to track 0.  If an error occurs,
0056  * then there is no floppy drive present.       [to be put back in again]
0057  */
0058 static unsigned char floppy_selects[4] = { 0x10, 0x21, 0x23, 0x33 };
0059 
0060 #define FDC1 (0x3f0)
0061 
0062 #define FLOPPY0_TYPE 4
0063 #define FLOPPY1_TYPE 4
0064 
0065 #define N_FDC 1
0066 #define N_DRIVE 4
0067 
0068 #define CROSS_64KB(a,s) (0)
0069 
0070 /*
0071  * This allows people to reverse the order of
0072  * fd0 and fd1, in case their hardware is
0073  * strangely connected (as some RiscPCs
0074  * and A5000s seem to be).
0075  */
0076 static void driveswap(int *ints, int dummy, int dummy2)
0077 {
0078     swap(floppy_selects[0], floppy_selects[1]);
0079 }
0080 
0081 #define EXTRA_FLOPPY_PARAMS ,{ "driveswap", &driveswap, NULL, 0, 0 }
0082     
0083 #endif