floppy.h 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. /*
  2. * This file is subject to the terms and conditions of the GNU General Public
  3. * License. See the file "COPYING" in the main directory of this archive
  4. * for more details.
  5. *
  6. * Copyright (C) 1998, 2003 by Ralf Baechle
  7. */
  8. #ifndef __ASM_MACH_JAZZ_FLOPPY_H
  9. #define __ASM_MACH_JAZZ_FLOPPY_H
  10. #include <linux/delay.h>
  11. #include <linux/init.h>
  12. #include <linux/linkage.h>
  13. #include <linux/types.h>
  14. #include <linux/mm.h>
  15. #include <asm/addrspace.h>
  16. #include <asm/jazz.h>
  17. #include <asm/jazzdma.h>
  18. #include <asm/pgtable.h>
  19. static inline unsigned char fd_inb(unsigned int port)
  20. {
  21. unsigned char c;
  22. c = *(volatile unsigned char *) port;
  23. udelay(1);
  24. return c;
  25. }
  26. static inline void fd_outb(unsigned char value, unsigned int port)
  27. {
  28. *(volatile unsigned char *) port = value;
  29. }
  30. /*
  31. * How to access the floppy DMA functions.
  32. */
  33. static inline void fd_enable_dma(void)
  34. {
  35. vdma_enable(JAZZ_FLOPPY_DMA);
  36. }
  37. static inline void fd_disable_dma(void)
  38. {
  39. vdma_disable(JAZZ_FLOPPY_DMA);
  40. }
  41. static inline int fd_request_dma(void)
  42. {
  43. return 0;
  44. }
  45. static inline void fd_free_dma(void)
  46. {
  47. }
  48. static inline void fd_clear_dma_ff(void)
  49. {
  50. }
  51. static inline void fd_set_dma_mode(char mode)
  52. {
  53. vdma_set_mode(JAZZ_FLOPPY_DMA, mode);
  54. }
  55. static inline void fd_set_dma_addr(char *a)
  56. {
  57. vdma_set_addr(JAZZ_FLOPPY_DMA, vdma_phys2log(CPHYSADDR((unsigned long)a)));
  58. }
  59. static inline void fd_set_dma_count(unsigned int count)
  60. {
  61. vdma_set_count(JAZZ_FLOPPY_DMA, count);
  62. }
  63. static inline int fd_get_dma_residue(void)
  64. {
  65. return vdma_get_residue(JAZZ_FLOPPY_DMA);
  66. }
  67. static inline void fd_enable_irq(void)
  68. {
  69. }
  70. static inline void fd_disable_irq(void)
  71. {
  72. }
  73. static inline int fd_request_irq(void)
  74. {
  75. return request_irq(FLOPPY_IRQ, floppy_interrupt,
  76. IRQF_DISABLED, "floppy", NULL);
  77. }
  78. static inline void fd_free_irq(void)
  79. {
  80. free_irq(FLOPPY_IRQ, NULL);
  81. }
  82. static inline unsigned long fd_getfdaddr1(void)
  83. {
  84. return JAZZ_FDC_BASE;
  85. }
  86. static inline unsigned long fd_dma_mem_alloc(unsigned long size)
  87. {
  88. unsigned long mem;
  89. mem = __get_dma_pages(GFP_KERNEL, get_order(size));
  90. if(!mem)
  91. return 0;
  92. vdma_alloc(CPHYSADDR(mem), size); /* XXX error checking */
  93. return mem;
  94. }
  95. static inline void fd_dma_mem_free(unsigned long addr, unsigned long size)
  96. {
  97. vdma_free(vdma_phys2log(CPHYSADDR(addr)));
  98. free_pages(addr, get_order(size));
  99. }
  100. static inline unsigned long fd_drive_type(unsigned long n)
  101. {
  102. /* XXX This is wrong for machines with ED 2.88mb disk drives like the
  103. Olivetti M700. Anyway, we should suck this from the ARC
  104. firmware. */
  105. if (n == 0)
  106. return 4; /* 3,5", 1.44mb */
  107. return 0;
  108. }
  109. #endif /* __ASM_MACH_JAZZ_FLOPPY_H */