summaryrefslogtreecommitdiffstats
path: root/drivers/sbus/char/sunserial.c
blob: da90d5adef77fa518f9f92c08bf6b7ffbe5bcdcb (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
/* $Id: sunserial.c,v 1.50 1997/09/03 11:54:59 ecd Exp $
 * serial.c: Serial port driver infrastructure for the Sparc.
 *
 * Copyright (C) 1997  Eddie C. Dost  (ecd@skynet.be)
 */

#include <linux/config.h>
#include <linux/module.h>
#include <linux/errno.h>
#include <linux/tty.h>
#include <linux/serial.h>

#include <asm/oplib.h>

#include "sunserial.h"

static void nop_rs_cons_hook(int chip, int out, int line)
{
	printk("Oops: %s called\n", __FUNCTION__);
}

static void nop_rs_kgdb_hook(int channel)
{
	printk("Oops: %s called\n", __FUNCTION__);
}

static void nop_rs_change_mouse_baud(int baud)
{
	printk("Oops: %s called\n", __FUNCTION__);
}

static int nop_rs_read_proc(char *page, char **start, off_t off, int count,
			    int *eof, void *data)
{
	printk("Oops: %s called\n", __FUNCTION__);
	return 0;
}


struct sunserial_operations rs_ops = {
	0,
	nop_rs_cons_hook,
	nop_rs_kgdb_hook,
	nop_rs_change_mouse_baud,
	nop_rs_read_proc
};

int rs_init(void)
{
	struct rs_initfunc *init;
	int err = -ENODEV;

	init = rs_ops.rs_init;
	while (init) {
		err = init->rs_init();
		init = init->next;
	}
	return err;
}

void rs_cons_hook(int chip, int out, int line)
{
	rs_ops.rs_cons_hook(chip, out, line);
}

void rs_kgdb_hook(int channel)
{
	rs_ops.rs_kgdb_hook(channel);
}

void rs_change_mouse_baud(int baud)
{
	rs_ops.rs_change_mouse_baud(baud);
}

int rs_read_proc(char *page, char **start, off_t off, int count,
		 int *eof, void *data)
{
	return rs_ops.rs_read_proc(page, start, off, count, eof, data);
}

int register_serial(struct serial_struct *req)
{
	return -1;
}

void unregister_serial(int line)
{
}

void
sunserial_setinitfunc(unsigned long *memory_start, int (*init) (void))
{
	struct rs_initfunc *rs_init;

	*memory_start = (*memory_start + 7) & ~(7);
	rs_init = (struct rs_initfunc *) *memory_start;
	*memory_start += sizeof(struct rs_initfunc);

	rs_init->rs_init = init;
	rs_init->next = rs_ops.rs_init;
	rs_ops.rs_init = rs_init;
}

extern int zs_probe(unsigned long *);
#ifdef CONFIG_SAB82532
extern int sab82532_probe(unsigned long *);
#endif
#ifdef __sparc_v9__
extern int ps2kbd_probe(unsigned long *);
extern int su_probe(unsigned long *);
#endif

unsigned long
sun_serial_setup(unsigned long memory_start)
{
	/* Probe for controllers. */
	if (zs_probe(&memory_start) == 0)
		return memory_start;

#ifdef CONFIG_SAB82532
	sab82532_probe(&memory_start);
#endif
#ifdef __sparc_v9__
	if (ps2kbd_probe(&memory_start) == 0)
		return memory_start;
	if (su_probe(&memory_start) == 0)
		return memory_start;
#endif

	prom_printf("No serial devices found, bailing out.\n");
	prom_halt();
	return memory_start;
}