xref: /freebsd-src/sys/contrib/device-tree/src/arm/st/st-pincfg.h (revision f126890ac5386406dadf7c4cfa9566cbb56537c5)
1*f126890aSEmmanuel Vadot /* SPDX-License-Identifier: GPL-2.0 */
2*f126890aSEmmanuel Vadot #ifndef _ST_PINCFG_H_
3*f126890aSEmmanuel Vadot #define _ST_PINCFG_H_
4*f126890aSEmmanuel Vadot 
5*f126890aSEmmanuel Vadot /* Alternate functions */
6*f126890aSEmmanuel Vadot #define ALT1	1
7*f126890aSEmmanuel Vadot #define ALT2	2
8*f126890aSEmmanuel Vadot #define ALT3	3
9*f126890aSEmmanuel Vadot #define ALT4	4
10*f126890aSEmmanuel Vadot #define ALT5	5
11*f126890aSEmmanuel Vadot #define ALT6	6
12*f126890aSEmmanuel Vadot #define ALT7	7
13*f126890aSEmmanuel Vadot 
14*f126890aSEmmanuel Vadot /* Output enable */
15*f126890aSEmmanuel Vadot #define OE			(1 << 27)
16*f126890aSEmmanuel Vadot /* Pull Up */
17*f126890aSEmmanuel Vadot #define PU			(1 << 26)
18*f126890aSEmmanuel Vadot /* Open Drain */
19*f126890aSEmmanuel Vadot #define OD			(1 << 25)
20*f126890aSEmmanuel Vadot #define RT			(1 << 23)
21*f126890aSEmmanuel Vadot #define INVERTCLK		(1 << 22)
22*f126890aSEmmanuel Vadot #define CLKNOTDATA		(1 << 21)
23*f126890aSEmmanuel Vadot #define DOUBLE_EDGE		(1 << 20)
24*f126890aSEmmanuel Vadot #define CLK_A			(0 << 18)
25*f126890aSEmmanuel Vadot #define CLK_B			(1 << 18)
26*f126890aSEmmanuel Vadot #define CLK_C			(2 << 18)
27*f126890aSEmmanuel Vadot #define CLK_D			(3 << 18)
28*f126890aSEmmanuel Vadot 
29*f126890aSEmmanuel Vadot /* User-frendly defines for Pin Direction */
30*f126890aSEmmanuel Vadot 		/* oe = 0, pu = 0, od = 0 */
31*f126890aSEmmanuel Vadot #define IN			(0)
32*f126890aSEmmanuel Vadot 		/* oe = 0, pu = 1, od = 0 */
33*f126890aSEmmanuel Vadot #define IN_PU			(PU)
34*f126890aSEmmanuel Vadot 		/* oe = 1, pu = 0, od = 0 */
35*f126890aSEmmanuel Vadot #define OUT			(OE)
36*f126890aSEmmanuel Vadot 		/* oe = 1, pu = 0, od = 1 */
37*f126890aSEmmanuel Vadot #define BIDIR			(OE | OD)
38*f126890aSEmmanuel Vadot 		/* oe = 1, pu = 1, od = 1 */
39*f126890aSEmmanuel Vadot #define BIDIR_PU		(OE | PU | OD)
40*f126890aSEmmanuel Vadot 
41*f126890aSEmmanuel Vadot /* RETIME_TYPE */
42*f126890aSEmmanuel Vadot /*
43*f126890aSEmmanuel Vadot  * B Mode
44*f126890aSEmmanuel Vadot  * Bypass retime with optional delay parameter
45*f126890aSEmmanuel Vadot  */
46*f126890aSEmmanuel Vadot #define BYPASS		(0)
47*f126890aSEmmanuel Vadot /*
48*f126890aSEmmanuel Vadot  * R0, R1, R0D, R1D modes
49*f126890aSEmmanuel Vadot  * single-edge data non inverted clock, retime data with clk
50*f126890aSEmmanuel Vadot  */
51*f126890aSEmmanuel Vadot #define SE_NICLK_IO	(RT)
52*f126890aSEmmanuel Vadot /*
53*f126890aSEmmanuel Vadot  * RIV0, RIV1, RIV0D, RIV1D modes
54*f126890aSEmmanuel Vadot  * single-edge data inverted clock, retime data with clk
55*f126890aSEmmanuel Vadot  */
56*f126890aSEmmanuel Vadot #define SE_ICLK_IO	(RT | INVERTCLK)
57*f126890aSEmmanuel Vadot /*
58*f126890aSEmmanuel Vadot  * R0E, R1E, R0ED, R1ED modes
59*f126890aSEmmanuel Vadot  * double-edge data, retime data with clk
60*f126890aSEmmanuel Vadot  */
61*f126890aSEmmanuel Vadot #define DE_IO		(RT | DOUBLE_EDGE)
62*f126890aSEmmanuel Vadot /*
63*f126890aSEmmanuel Vadot  * CIV0, CIV1 modes with inverted clock
64*f126890aSEmmanuel Vadot  * Retiming the clk pins will park clock & reduce the noise within the core.
65*f126890aSEmmanuel Vadot  */
66*f126890aSEmmanuel Vadot #define ICLK		(RT | CLKNOTDATA | INVERTCLK)
67*f126890aSEmmanuel Vadot /*
68*f126890aSEmmanuel Vadot  * CLK0, CLK1 modes with non-inverted clock
69*f126890aSEmmanuel Vadot  * Retiming the clk pins will park clock & reduce the noise within the core.
70*f126890aSEmmanuel Vadot  */
71*f126890aSEmmanuel Vadot #define NICLK		(RT | CLKNOTDATA)
72*f126890aSEmmanuel Vadot #endif /* _ST_PINCFG_H_ */
73