summaryrefslogtreecommitdiffstats
path: root/arch/mips/deskstation/hw-access.c
blob: 8b1bd0e3b6b23e0d095a2c19df9a73c9070d4b5b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
/*
 * Low-level hardware access stuff for Deskstation rPC44/Tyne
 *
 * This file is subject to the terms and conditions of the GNU General Public
 * License.  See the file "COPYING" in the main directory of this archive
 * for more details.
 *
 * Copyright (C) 1996, 1997 by Ralf Baechle
 *
 * $Id: hw-access.c,v 1.2 1997/07/23 17:40:54 ralf Exp $
 */
#include <linux/config.h>
#include <linux/delay.h>
#include <linux/kbdcntrlr.h>
#include <linux/kernel.h>
#include <linux/linkage.h>
#include <linux/types.h>
#include <asm/bootinfo.h>
#include <asm/cachectl.h>
#include <asm/dma.h>
#include <asm/io.h>
#include <asm/irq.h>
#include <asm/vector.h>

extern int FLOPPY_IRQ;
extern int FLOPPY_DMA;

asmlinkage extern void deskstation_handle_int(void);

/*
 * How to access the FDC's registers.
 */
static unsigned char
fd_inb(unsigned int port)
{
	return inb_p(port);
}

static void
fd_outb(unsigned char value, unsigned int port)
{
	outb_p(value, port);
}

/*
 * How to access the floppy DMA functions.
 */
static void
fd_enable_dma(void)
{
	enable_dma(FLOPPY_DMA);
}

static void
fd_disable_dma(void)
{
	disable_dma(FLOPPY_DMA);
}

static int
fd_request_dma(void)
{
	return request_dma(FLOPPY_DMA, "floppy");
}

static void
fd_free_dma(void)
{
	free_dma(FLOPPY_DMA);
}

static void
fd_clear_dma_ff(void)
{
	clear_dma_ff(FLOPPY_DMA);
}

static void
fd_set_dma_mode(char mode)
{
	set_dma_mode(FLOPPY_DMA, mode);
}

static void
fd_set_dma_addr(unsigned int addr)
{
	set_dma_addr(FLOPPY_DMA, addr);
}

static void
fd_set_dma_count(unsigned int count)
{
	set_dma_count(FLOPPY_DMA, count);
}

static int
fd_get_dma_residue(void)
{
	return get_dma_residue(FLOPPY_DMA);
}

static void
fd_enable_irq(void)
{
	enable_irq(FLOPPY_IRQ);
}

static void
fd_disable_irq(void)
{
	disable_irq(FLOPPY_IRQ);
}

void
deskstation_fd_cacheflush(const void *addr, size_t size)
{
	flush_cache_all();
}

/*
 * RTC stuff
 */
static unsigned char *
rtc_read_data()
{
	return 0;
}

static void
rtc_write_data(unsigned char data)
{
}

/*
 * KLUDGE
 */
static unsigned long
vdma_alloc(unsigned long paddr, unsigned long size)
{
	return 0;
}

#ifdef CONFIG_DESKSTATION_TYNE
struct feature deskstation_tyne_feature = {
	/*
	 * How to access the floppy controller's ports
	 */
	fd_inb,
	fd_outb,
	/*
	 * How to access the floppy DMA functions.
	 */
	fd_enable_dma,
	fd_disable_dma,
	fd_request_dma,
	fd_free_dma,
	fd_clear_dma_ff,
	fd_set_dma_mode,
	fd_set_dma_addr,
	fd_set_dma_count,
	fd_get_dma_residue,
	fd_enable_irq,
	fd_disable_irq,
	/*
	 * How to access the RTC functions.
	 */
	rtc_read_data,
	rtc_write_data
};
#endif

#ifdef CONFIG_DESKSTATION_RPC44
struct feature deskstation_rpc44_feature = {
	/*
	 * How to access the floppy controller's ports
	 */
	fd_inb,
	fd_outb,
	/*
	 * How to access the floppy DMA functions.
	 */
	fd_enable_dma,
	fd_disable_dma,
	fd_request_dma,
	fd_free_dma,
	fd_clear_dma_ff,
	fd_set_dma_mode,
	fd_set_dma_addr,
	fd_set_dma_count,
	fd_get_dma_residue,
	fd_enable_irq,
	fd_disable_irq,
	/*
	 * How to access the RTC functions.
	 */
	rtc_read_data,
	rtc_write_data
};
#endif

static unsigned char dtc_read_input(void)
{
	return inb(KBD_DATA_REG);
}

static void dtc_write_output(unsigned char val)
{
	outb(val, KBD_DATA_REG);
}

static void dtc_write_command(unsigned char val)
{
	outb(val, KBD_CNTL_REG);
}

static unsigned char dtc_read_status(void)
{
	return inb(KBD_STATUS_REG);
}

static void dtc_rm200_keyboard_setup(void)
{
	kbd_read_input = dtc_read_input;
	kbd_write_output = dtc_write_output;
	kbd_write_command = dtc_write_command;
	kbd_read_status = dtc_read_status;
	request_region(0x60, 16, "keyboard");
}