~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/arch/mips/jazz/floppy-jazz.c

Version: ~ [ linux-5.10-rc1 ] ~ [ linux-5.9.1 ] ~ [ linux-5.8.16 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.72 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.152 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.202 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.240 ] ~ [ linux-4.8.17 ] ~ [ linux-4.7.10 ] ~ [ linux-4.6.7 ] ~ [ linux-4.5.7 ] ~ [ linux-4.4.240 ] ~ [ linux-4.3.6 ] ~ [ linux-4.2.8 ] ~ [ linux-4.1.52 ] ~ [ linux-4.0.9 ] ~ [ linux-3.19.8 ] ~ [ linux-3.18.140 ] ~ [ linux-3.17.8 ] ~ [ linux-3.16.85 ] ~ [ linux-3.15.10 ] ~ [ linux-3.14.79 ] ~ [ linux-3.13.11 ] ~ [ linux-3.12.74 ] ~ [ linux-3.11.10 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.5 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  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  * Low-level floppy stuff for Jazz family machines.
  7  *
  8  * Copyright (C) 1998 by Ralf Baechle
  9  */
 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 #include <asm/floppy.h>
 20 
 21 static unsigned char jazz_fd_inb(unsigned int port)
 22 {
 23         unsigned char c;
 24 
 25         c = *(volatile unsigned char *) port;
 26         udelay(1);
 27 
 28         return c;
 29 }
 30 
 31 static void jazz_fd_outb(unsigned char value, unsigned int port)
 32 {
 33         *(volatile unsigned char *) port = value;
 34 }
 35 
 36 /*
 37  * How to access the floppy DMA functions.
 38  */
 39 static void jazz_fd_enable_dma(int channel)
 40 {
 41         vdma_enable(JAZZ_FLOPPY_DMA);
 42 }
 43 
 44 static void jazz_fd_disable_dma(int channel)
 45 {
 46         vdma_disable(JAZZ_FLOPPY_DMA);
 47 }
 48 
 49 static int jazz_fd_request_dma(int channel)
 50 {
 51         return 0;
 52 }
 53 
 54 static void jazz_fd_free_dma(int channel)
 55 {
 56 }
 57 
 58 static void jazz_fd_clear_dma_ff(int channel)
 59 {
 60 }
 61 
 62 static void jazz_fd_set_dma_mode(int channel, char mode)
 63 {
 64         vdma_set_mode(JAZZ_FLOPPY_DMA, mode);
 65 }
 66 
 67 static void jazz_fd_set_dma_addr(int channel, unsigned int a)
 68 {
 69         vdma_set_addr(JAZZ_FLOPPY_DMA, vdma_phys2log(PHYSADDR(a)));
 70 }
 71 
 72 static void jazz_fd_set_dma_count(int channel, unsigned int count)
 73 {
 74         vdma_set_count(JAZZ_FLOPPY_DMA, count);
 75 }
 76 
 77 static int jazz_fd_get_dma_residue(int channel)
 78 {
 79         return vdma_get_residue(JAZZ_FLOPPY_DMA);
 80 }
 81 
 82 static void jazz_fd_enable_irq(int irq)
 83 {
 84 }
 85 
 86 static void jazz_fd_disable_irq(int irq)
 87 {
 88 }
 89 
 90 static unsigned long jazz_fd_getfdaddr1(void)
 91 {
 92         return JAZZ_FDC_BASE;
 93 }
 94 
 95 static unsigned long jazz_fd_dma_mem_alloc(unsigned long size)
 96 {
 97         unsigned long mem;
 98 
 99         mem = __get_dma_pages(GFP_KERNEL, get_order(size));
100         if(!mem)
101                 return 0;
102         vdma_alloc(PHYSADDR(mem), size);        /* XXX error checking */
103 
104         return mem;
105 }
106 
107 static void jazz_fd_dma_mem_free(unsigned long addr,
108                                         unsigned long size)
109 {
110         vdma_free(vdma_phys2log(PHYSADDR(addr)));
111         free_pages(addr, get_order(size));
112 }
113 
114 static unsigned long jazz_fd_drive_type(unsigned long n)
115 {
116         /* XXX This is wrong for machines with ED 2.88mb disk drives like the
117            Olivetti M700.  Anyway, we should suck this from the ARC
118            firmware.  */
119         if (n == 0)
120                 return 4;       /* 3,5", 1.44mb */
121 
122         return 0;
123 }
124 
125 struct fd_ops jazz_fd_ops = {
126         /*
127          * How to access the floppy controller's ports
128          */
129         jazz_fd_inb,
130         jazz_fd_outb,
131         /*
132          * How to access the floppy DMA functions.
133          */
134         jazz_fd_enable_dma,
135         jazz_fd_disable_dma,
136         jazz_fd_request_dma,
137         jazz_fd_free_dma,
138         jazz_fd_clear_dma_ff,
139         jazz_fd_set_dma_mode,
140         jazz_fd_set_dma_addr,
141         jazz_fd_set_dma_count,
142         jazz_fd_get_dma_residue,
143         jazz_fd_enable_irq,
144         jazz_fd_disable_irq,
145         jazz_fd_getfdaddr1,
146         jazz_fd_dma_mem_alloc,
147         jazz_fd_dma_mem_free,
148         jazz_fd_drive_type
149 };
150 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | Wiki (Japanese) | Wiki (English) | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

osdn.jp