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