floppy.h 2.3 KB

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