xref: /openbsd/sys/dev/fdt/sxipiovar.h (revision 0fd3bb56)
1 /*	$OpenBSD: sxipiovar.h,v 1.2 2023/10/13 15:41:25 kettenis Exp $	*/
2 /*
3  * Copyright (c) 2013 Artturi Alm
4  *
5  * Permission to use, copy, modify, and distribute this software for any
6  * purpose with or without fee is hereby granted, provided that the above
7  * copyright notice and this permission notice appear in all copies.
8  *
9  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16  */
17 
18 #include <sys/gpio.h>
19 
20 struct sxipio_func {
21 	const char *name;
22 	int mux;
23 };
24 
25 struct sxipio_pin {
26 	const char *name;
27 	int port, pin;
28 	struct sxipio_func funcs[10];
29 };
30 
31 #define SXIPIO_PORT_A	0
32 #define SXIPIO_PORT_B	1
33 #define SXIPIO_PORT_C	2
34 #define SXIPIO_PORT_D	3
35 #define SXIPIO_PORT_E	4
36 #define SXIPIO_PORT_F	5
37 #define SXIPIO_PORT_G	6
38 #define SXIPIO_PORT_H	7
39 #define SXIPIO_PORT_I	8
40 #define SXIPIO_PORT_L	0
41 #define SXIPIO_PORT_M	1
42 #define SXIPIO_PORT_N	2
43 
44 #define SXIPIO_PIN(port, pin) \
45 	"P" #port #pin,  SXIPIO_PORT_ ## port, pin
46