floppy.h 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. /*
  2. * Architecture specific parts of the Floppy driver
  3. *
  4. * This file is subject to the terms and conditions of the GNU General Public
  5. * License. See the file "COPYING" in the main directory of this archive
  6. * for more details.
  7. *
  8. * Copyright (C) 1995
  9. */
  10. #ifndef __ASM_POWERPC_FLOPPY_H
  11. #define __ASM_POWERPC_FLOPPY_H
  12. #ifdef __KERNEL__
  13. #include <linux/config.h>
  14. #include <asm/machdep.h>
  15. #define fd_inb(port) inb_p(port)
  16. #define fd_outb(value,port) outb_p(value,port)
  17. #define fd_enable_dma() enable_dma(FLOPPY_DMA)
  18. #define fd_disable_dma() disable_dma(FLOPPY_DMA)
  19. #define fd_request_dma() request_dma(FLOPPY_DMA, "floppy")
  20. #define fd_free_dma() free_dma(FLOPPY_DMA)
  21. #define fd_clear_dma_ff() clear_dma_ff(FLOPPY_DMA)
  22. #define fd_set_dma_mode(mode) set_dma_mode(FLOPPY_DMA, mode)
  23. #define fd_set_dma_count(count) set_dma_count(FLOPPY_DMA, count)
  24. #define fd_enable_irq() enable_irq(FLOPPY_IRQ)
  25. #define fd_disable_irq() disable_irq(FLOPPY_IRQ)
  26. #define fd_cacheflush(addr,size) /* nothing */
  27. #define fd_request_irq() request_irq(FLOPPY_IRQ, floppy_interrupt, \
  28. SA_INTERRUPT|SA_SAMPLE_RANDOM, \
  29. "floppy", NULL)
  30. #define fd_free_irq() free_irq(FLOPPY_IRQ, NULL);
  31. #ifdef CONFIG_PCI
  32. #include <linux/pci.h>
  33. #include <asm/ppc-pci.h> /* for ppc64_isabridge_dev */
  34. #define fd_dma_setup(addr,size,mode,io) powerpc_fd_dma_setup(addr,size,mode,io)
  35. static __inline__ int powerpc_fd_dma_setup(char *addr, unsigned long size,
  36. int mode, int io)
  37. {
  38. static unsigned long prev_size;
  39. static dma_addr_t bus_addr = 0;
  40. static char *prev_addr;
  41. static int prev_dir;
  42. int dir;
  43. dir = (mode == DMA_MODE_READ) ? PCI_DMA_FROMDEVICE : PCI_DMA_TODEVICE;
  44. if (bus_addr
  45. && (addr != prev_addr || size != prev_size || dir != prev_dir)) {
  46. /* different from last time -- unmap prev */
  47. pci_unmap_single(ppc64_isabridge_dev, bus_addr, prev_size, prev_dir);
  48. bus_addr = 0;
  49. }
  50. if (!bus_addr) /* need to map it */
  51. bus_addr = pci_map_single(ppc64_isabridge_dev, addr, size, dir);
  52. /* remember this one as prev */
  53. prev_addr = addr;
  54. prev_size = size;
  55. prev_dir = dir;
  56. fd_clear_dma_ff();
  57. fd_cacheflush(addr, size);
  58. fd_set_dma_mode(mode);
  59. set_dma_addr(FLOPPY_DMA, bus_addr);
  60. fd_set_dma_count(size);
  61. virtual_dma_port = io;
  62. fd_enable_dma();
  63. return 0;
  64. }
  65. #endif /* CONFIG_PCI */
  66. __inline__ void virtual_dma_init(void)
  67. {
  68. /* Nothing to do on PowerPC */
  69. }
  70. static int FDC1 = 0x3f0;
  71. static int FDC2 = -1;
  72. /*
  73. * Again, the CMOS information not available
  74. */
  75. #define FLOPPY0_TYPE 6
  76. #define FLOPPY1_TYPE 0
  77. #define N_FDC 2 /* Don't change this! */
  78. #define N_DRIVE 8
  79. #define FLOPPY_MOTOR_MASK 0xf0
  80. /*
  81. * The PowerPC has no problems with floppy DMA crossing 64k borders.
  82. */
  83. #define CROSS_64KB(a,s) (0)
  84. #define EXTRA_FLOPPY_PARAMS
  85. #endif /* __KERNEL__ */
  86. #endif /* __ASM_POWERPC_FLOPPY_H */