• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* SPDX-License-Identifier: (GPL-2.0+ OR MIT) */
2 /*
3  * Copyright (c) 2017 Baylibre SAS.
4  * Author:  Jerome Brunet  <jbrunet@baylibre.com>
5  *
6  * Copyright (c) 2017 Amlogic, Inc. All rights reserved.
7  * Author: Xingyu Chen <xingyu.chen@amlogic.com>
8  *
9  */
10 
11 struct meson_pmx_bank {
12 	const char *name;
13 	unsigned int first;
14 	unsigned int last;
15 	unsigned int reg;
16 	unsigned int offset;
17 };
18 
19 struct meson_axg_pmx_data {
20 	struct meson_pmx_bank *pmx_banks;
21 	unsigned int num_pmx_banks;
22 };
23 
24 #define BANK_PMX(n, f, l, r, o)				\
25 	{							\
26 		.name   = n,					\
27 		.first	= f,					\
28 		.last	= l,					\
29 		.reg	= r,					\
30 		.offset = o,					\
31 	}
32 
33 struct meson_pmx_axg_data {
34         unsigned int func;
35 };
36 
37 #define PMX_DATA(f)							\
38 	{								\
39 		.func = f,						\
40 	}
41 
42 #define GROUP(grp, f)							\
43 	{								\
44 		.name = #grp,						\
45 		.pins = grp ## _pins,                                   \
46 		.num_pins = ARRAY_SIZE(grp ## _pins),			\
47 		.data = (const struct meson_pmx_axg_data[]){		\
48 			PMX_DATA(f),					\
49 		},							\
50 	}
51 
52 #define GPIO_GROUP(gpio)						\
53 	{								\
54 		.name = #gpio,						\
55 		.pins = (const unsigned int[]){ gpio },			\
56 		.num_pins = 1,						\
57 		.data = (const struct meson_pmx_axg_data[]){		\
58 			PMX_DATA(0),					\
59 		},							\
60 	}
61 
62 extern const struct pinmux_ops meson_axg_pmx_ops;
63