1 /*
2  * Copyright (c) 2022 Antmicro <www.antmicro.com>
3  *
4  * SPDX-License-Identifier: Apache-2.0
5  */
6 
7 #ifndef ZEPHYR_SOC_RISCV_RISCV_PRIVILEGED_SIFIVE_FREEDOM_PINCTRL_H_
8 #define ZEPHYR_SOC_RISCV_RISCV_PRIVILEGED_SIFIVE_FREEDOM_PINCTRL_H_
9 
10 #include <zephyr/types.h>
11 
12 typedef struct pinctrl_soc_pin_t {
13 	uint8_t pin;
14 	uint8_t iof;
15 } pinctrl_soc_pin_t;
16 
17 #define SIFIVE_DT_PIN(node_id)					\
18 	{							\
19 		.pin = DT_PROP_BY_IDX(node_id, pinmux, 0),	\
20 		.iof = DT_PROP_BY_IDX(node_id, pinmux, 1)	\
21 	},
22 
23 #define Z_PINCTRL_STATE_PIN_INIT(node_id, prop, idx)		\
24 	SIFIVE_DT_PIN(DT_PROP_BY_IDX(node_id, prop, idx))
25 
26 #define Z_PINCTRL_STATE_PINS_INIT(node_id, prop)		\
27 	{ DT_FOREACH_PROP_ELEM(node_id, prop, Z_PINCTRL_STATE_PIN_INIT) }
28 
29 #endif /* ZEPHYR_SOC_RISCV_RISCV_PRIVILEGED_SIFIVE_FREEDOM_PINCTRL_H_ */
30