1 /*
2  * Copyright (c) 2023 Texas Instruments Incorporated
3  *
4  * SPDX-License-Identifier: Apache-2.0
5  */
6 
7 #ifndef ZEPHYR_SOC_ARM_TI_K3_PINCTRL_SOC_H_
8 #define ZEPHYR_SOC_ARM_TI_K3_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_pin {
18 	uint32_t offset;
19 	uint32_t value;
20 };
21 
22 typedef struct pinctrl_soc_pin pinctrl_soc_pin_t;
23 
24 #define TI_K3_DT_PIN(node_id)				\
25 	{							\
26 		.offset = DT_PROP_BY_IDX(node_id, pinmux, 0),	\
27 		.value = DT_PROP_BY_IDX(node_id, pinmux, 1)	\
28 	},
29 
30 #define Z_PINCTRL_STATE_PIN_INIT(node_id, prop, idx)		\
31 	TI_K3_DT_PIN(DT_PROP_BY_IDX(node_id, prop, idx))
32 
33 #define Z_PINCTRL_STATE_PINS_INIT(node_id, prop)		\
34 	{ DT_FOREACH_PROP_ELEM(node_id, prop, Z_PINCTRL_STATE_PIN_INIT) }
35 
36 #ifdef __cplusplus
37 }
38 #endif
39 
40 #endif /* ZEPHYR_SOC_ARM_TI_K3_PINCTRL_SOC_H_ */
41