Linux Audio

Check our new training course

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