summaryrefslogtreecommitdiff
path: root/board/logicpd/zoom2/zoom2_serial.h
blob: 82244521ac51f1e0645d9a2e69a27b31be195480 (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
/*
 * Copyright (c) 2009 Wind River Systems, Inc.
 * Tom Rix <Tom.Rix@windriver.com>
 *
 * SPDX-License-Identifier:	GPL-2.0+
 */

#ifndef ZOOM2_SERIAL_H
#define ZOOM2_SERIAL_H

#include <linux/stringify.h>

extern int zoom2_debug_board_connected (void);

#define SERIAL_TL16CP754C_BASE	0x10000000	/* Zoom2 Serial chip address */

#define QUAD_BASE_0	SERIAL_TL16CP754C_BASE
#define QUAD_BASE_1	(SERIAL_TL16CP754C_BASE + 0x100)
#define QUAD_BASE_2	(SERIAL_TL16CP754C_BASE + 0x200)
#define QUAD_BASE_3	(SERIAL_TL16CP754C_BASE + 0x300)

#define QUAD_INIT(n)				\
int quad_init_##n(void)				\
{						\
	return quad_init_dev(QUAD_BASE_##n);	\
}						\
void quad_setbrg_##n(void)			\
{						\
	quad_setbrg_dev(QUAD_BASE_##n);		\
}						\
void quad_putc_##n(const char c)		\
{						\
	quad_putc_dev(QUAD_BASE_##n, c);	\
}						\
void quad_puts_##n(const char *s)		\
{						\
	quad_puts_dev(QUAD_BASE_##n, s);	\
}						\
int quad_getc_##n(void)				\
{						\
	return quad_getc_dev(QUAD_BASE_##n);	\
}						\
int quad_tstc_##n(void)				\
{						\
	return quad_tstc_dev(QUAD_BASE_##n);	\
}						\
struct serial_device zoom2_serial_device##n =	\
{						\
	.name	= __stringify(n),		\
	.start	= quad_init_##n,		\
	.stop	= NULL,				\
	.setbrg	= quad_setbrg_##n,		\
	.getc	= quad_getc_##n,		\
	.tstc	= quad_tstc_##n,		\
	.putc	= quad_putc_##n,		\
	.puts	= quad_puts_##n,		\
};

#endif /* ZOOM2_SERIAL_H */