1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /*
3  * First generation of pinmux driver for Amlogic Meson SoCs
4  *
5  * Copyright (C) 2014 Beniamino Galvani <b.galvani@gmail.com>
6  * Copyright (C) 2017 Jerome Brunet  <jbrunet@baylibre.com>
7  */
8 
9 struct meson8_pmx_data {
10 	bool is_gpio;
11 	unsigned int reg;
12 	unsigned int bit;
13 };
14 
15 #define PMX_DATA(r, b, g)						\
16 	{								\
17 		.reg = r,						\
18 		.bit = b,						\
19 		.is_gpio = g,						\
20 	}
21 
22 #define GROUP(grp, r, b)						\
23 	{								\
24 		.name = #grp,						\
25 		.pins = grp ## _pins,					\
26 		.num_pins = ARRAY_SIZE(grp ## _pins),			\
27 		.data = (const struct meson8_pmx_data[]){		\
28 			PMX_DATA(r, b, false),				\
29 		},							\
30 	 }
31 
32 #define GPIO_GROUP(gpio)						\
33 	{								\
34 		.name = #gpio,						\
35 		.pins = (const unsigned int[]){ gpio },			\
36 		.num_pins = 1,						\
37 		.data = (const struct meson8_pmx_data[]){		\
38 			PMX_DATA(0, 0, true),				\
39 		},							\
40 	}
41 
42 extern const struct pinmux_ops meson8_pmx_ops;
43