1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 /*
3  *  NXP (Philips) SCC+++(SCN+++) serial driver
4  *
5  *  Copyright (C) 2012 Alexander Shiyan <shc_work@mail.ru>
6  *
7  *  Based on sc26xx.c, by Thomas Bogendörfer (tsbogend@alpha.franken.de)
8  */
9 
10 #ifndef _PLATFORM_DATA_SERIAL_SCCNXP_H_
11 #define _PLATFORM_DATA_SERIAL_SCCNXP_H_
12 
13 #define SCCNXP_MAX_UARTS	2
14 
15 /* Output lines */
16 #define LINE_OP0		1
17 #define LINE_OP1		2
18 #define LINE_OP2		3
19 #define LINE_OP3		4
20 #define LINE_OP4		5
21 #define LINE_OP5		6
22 #define LINE_OP6		7
23 #define LINE_OP7		8
24 
25 /* Input lines */
26 #define LINE_IP0		9
27 #define LINE_IP1		10
28 #define LINE_IP2		11
29 #define LINE_IP3		12
30 #define LINE_IP4		13
31 #define LINE_IP5		14
32 #define LINE_IP6		15
33 
34 /* Signals */
35 #define DTR_OP			0	/* DTR */
36 #define RTS_OP			4	/* RTS */
37 #define DSR_IP			8	/* DSR */
38 #define CTS_IP			12	/* CTS */
39 #define DCD_IP			16	/* DCD */
40 #define RNG_IP			20	/* RNG */
41 
42 #define DIR_OP			24	/* Special signal for control RS-485.
43 					 * Goes high when transmit,
44 					 * then goes low.
45 					 */
46 
47 /* Routing control signal 'sig' to line 'line' */
48 #define MCTRL_SIG(sig, line)	((line) << (sig))
49 
50 /*
51  * Example board initialization data:
52  *
53  * static struct resource sc2892_resources[] = {
54  *	DEFINE_RES_MEM(UART_PHYS_START, 0x10),
55  *	DEFINE_RES_IRQ(IRQ_EXT2),
56  * };
57  *
58  * static struct sccnxp_pdata sc2892_info = {
59  *	.mctrl_cfg[0]	= MCTRL_SIG(DIR_OP, LINE_OP0),
60  *	.mctrl_cfg[1]	= MCTRL_SIG(DIR_OP, LINE_OP1),
61  * };
62  *
63  * static struct platform_device sc2892 = {
64  *	.name		= "sc2892",
65  *	.id		= -1,
66  *	.resource	= sc2892_resources,
67  *	.num_resources	= ARRAY_SIZE(sc2892_resources),
68  *	.dev = {
69  *		.platform_data	= &sc2892_info,
70  *	},
71  * };
72  */
73 
74 /* SCCNXP platform data structure */
75 struct sccnxp_pdata {
76 	/* Shift for A0 line */
77 	const u8		reg_shift;
78 	/* Modem control lines configuration */
79 	const u32		mctrl_cfg[SCCNXP_MAX_UARTS];
80 	/* Timer value for polling mode (usecs) */
81 	const unsigned int	poll_time_us;
82 };
83 
84 #endif
85