1 /*
2  * Copyright 2023 NXP
3  *
4  * SPDX-License-Identifier: Apache-2.0
5  */
6 
7 #ifndef ZEPHYR_SOC_XTENSA_NXP_ADSP_IMX8_PINCTRL_SOC_H_
8 #define ZEPHYR_SOC_XTENSA_NXP_ADSP_IMX8_PINCTRL_SOC_H_
9 
10 #include <zephyr/devicetree.h>
11 #include <zephyr/types.h>
12 
13 #ifdef __cplusplus
14 extern "C" {
15 #endif
16 
17 struct pinctrl_soc_pinmux {
18 	uint32_t pad;
19 	uint32_t mux;
20 };
21 
22 typedef struct pinctrl_soc_pinmux pinctrl_soc_pin_t;
23 
24 #define IMX8_PINMUX(n)					\
25 {							\
26 	.pad = DT_PROP_BY_IDX(n, pinmux, 0),            \
27 	.mux = DT_PROP_BY_IDX(n, pinmux, 1),            \
28 },
29 
30 #define Z_PINCTRL_PINMUX(group_id, pin_prop, idx)\
31 	IMX8_PINMUX(DT_PHANDLE_BY_IDX(group_id, pin_prop, idx))
32 
33 #define Z_PINCTRL_STATE_PINS_INIT(node_id, prop)		\
34 	{ DT_FOREACH_CHILD_VARGS(DT_PHANDLE(node_id, prop),     \
35 				 DT_FOREACH_PROP_ELEM, pinmux, Z_PINCTRL_PINMUX) };
36 
37 #ifdef __cplusplus
38 }
39 #endif
40 
41 #endif /* ZEPHYR_SOC_XTENSA_NXP_ADSP_IMX8_PINCTRL_SOC_H_ */
42