root/arch/mips/kernel/tyne-c.c

/* [previous][next][first][last][top][bottom][index][help] */

DEFINITIONS

This source file includes following definitions.
  1. deskstation_tyne_fd_inb
  2. deskstation_tyne_fd_outb
  3. deskstation_tyne_fd_enable_dma
  4. deskstation_tyne_fd_disable_dma
  5. deskstation_tyne_fd_request_dma
  6. deskstation_tyne_fd_free_dma
  7. deskstation_tyne_fd_clear_dma_ff
  8. deskstation_tyne_fd_set_dma_mode
  9. deskstation_tyne_fd_set_dma_addr
  10. deskstation_tyne_fd_set_dma_count
  11. deskstation_tyne_fd_get_dma_residue
  12. deskstation_tyne_fd_enable_irq
  13. deskstation_tyne_fd_disable_irq
  14. deskstation_tyne_fd_cacheflush
  15. deskstation_tyne_dma_alloc
  16. deskstation_tyne_dma_init

   1 /*
   2  * Deskstation Tyne specific C parts
   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) 1994, 1995 by Ralf Baechle
   9  */
  10 #include <linux/delay.h>
  11 #include <linux/kernel.h>
  12 #include <linux/types.h>
  13 #include <asm/bootinfo.h>
  14 #include <asm/cachectl.h>
  15 #include <asm/dma.h>
  16 #include <asm/io.h>
  17 
  18 /*
  19  * How to access the FDC's registers.
  20  */
  21 unsigned char deskstation_tyne_fd_inb(unsigned int port)
     /* [previous][next][first][last][top][bottom][index][help] */
  22 {
  23         return inb_p(port);
  24 }
  25 
  26 void deskstation_tyne_fd_outb(unsigned char value, unsigned int port)
     /* [previous][next][first][last][top][bottom][index][help] */
  27 {
  28         outb_p(value, port);
  29 }
  30 
  31 /*
  32  * How to access the floppy DMA functions.
  33  */
  34 void deskstation_tyne_fd_enable_dma(void)
     /* [previous][next][first][last][top][bottom][index][help] */
  35 {
  36         enable_dma(FLOPPY_DMA);
  37 }
  38 
  39 void deskstation_tyne_fd_disable_dma(void)
     /* [previous][next][first][last][top][bottom][index][help] */
  40 {
  41         disable_dma(FLOPPY_DMA);
  42 }
  43 
  44 int deskstation_tyne_fd_request_dma(void)
     /* [previous][next][first][last][top][bottom][index][help] */
  45 {
  46         return request_dma(FLOPPY_DMA, "floppy");
  47 }
  48 
  49 void deskstation_tyne_fd_free_dma(void)
     /* [previous][next][first][last][top][bottom][index][help] */
  50 {
  51         free_dma(FLOPPY_DMA);
  52 }
  53 
  54 void deskstation_tyne_fd_clear_dma_ff(void)
     /* [previous][next][first][last][top][bottom][index][help] */
  55 {
  56         clear_dma_ff(FLOPPY_DMA);
  57 }
  58 
  59 int deskstation_tyne_fd_set_dma_mode(char mode)
     /* [previous][next][first][last][top][bottom][index][help] */
  60 {
  61         return set_dma_mode(FLOPPY_DMA, mode);
  62 }
  63 
  64 void deskstation_tyne_fd_set_dma_addr(unsigned int a)
     /* [previous][next][first][last][top][bottom][index][help] */
  65 {
  66         set_dma_addr(FLOPPY_DMA, addr);
  67 }
  68 
  69 void deskstation_tyne_fd_set_dma_count(unsigned int count)
     /* [previous][next][first][last][top][bottom][index][help] */
  70 {
  71         set_dma_count(FLOPPY_DMA, count);
  72 }
  73 
  74 int deskstation_tyne_fd_get_dma_residue(void)
     /* [previous][next][first][last][top][bottom][index][help] */
  75 {
  76         return get_dma_residue(FLOPPY_DMA);
  77 }
  78 
  79 void deskstation_tyne_fd_enable_irq(void)
     /* [previous][next][first][last][top][bottom][index][help] */
  80 {
  81         enable_irq(FLOPPY_IRQ);
  82 }
  83 
  84 void deskstation_tyne_fd_disable_irq(void)
     /* [previous][next][first][last][top][bottom][index][help] */
  85 {
  86         disable_irq(FLOPPY_IRQ);
  87 }
  88 
  89 void deskstation_tyne_fd_cacheflush(unsigned char *addr, unsigned int)
     /* [previous][next][first][last][top][bottom][index][help] */
  90 {
  91         sys_cacheflush((void *)addr, size, DCACHE);
  92 }
  93 
  94 
  95 /*
  96  * Tiny Tyne DMA buffer allocator
  97  *
  98  * Untested for a long time and changed again and again ...
  99  * Sorry, but no hardware to test ...
 100  */
 101 static unsigned long allocated;
 102 
 103 /*
 104  * Not very sophisticated, but should suffice for now...
 105  */
 106 unsigned long deskstation_tyne_dma_alloc(size_t size)
     /* [previous][next][first][last][top][bottom][index][help] */
 107 {
 108         unsigned long ret = allocated;
 109         allocated += size;
 110         if (allocated > boot_info.dma_cache_size)
 111                 ret = -1;
 112         return ret;
 113 }
 114 
 115 void deskstation_tyne_dma_init(void)
     /* [previous][next][first][last][top][bottom][index][help] */
 116 {
 117         if (boot_info.machtype != MACH_DESKSTATION_TYNE)
 118                 return;
 119         allocated = 0;
 120         printk ("Deskstation Tyne DMA (%luk) buffer initialized.\n",
 121                 boot_info.dma_cache_size >> 10);
 122 }

/* [previous][next][first][last][top][bottom][index][help] */