1 /* 2 * Copyright (c) ENE Technology Inc. 3 * 4 * SPDX-License-Identifier: Apache-2.0 5 */ 6 7 #ifndef ZEPHYR_INCLUDE_DT_BINDINGS_PINCTRL_ENE_KB1200_PINCTRL_H_ 8 #define ZEPHYR_INCLUDE_DT_BINDINGS_PINCTRL_ENE_KB1200_PINCTRL_H_ 9 10 #include <zephyr/dt-bindings/dt-util.h> 11 12 #define PINMUX_FUNC_GPIO 0x00 13 #define PINMUX_FUNC_A 0x00 14 #define PINMUX_FUNC_B 0x01 15 #define PINMUX_FUNC_C 0x02 16 #define PINMUX_FUNC_D 0x03 17 #define PINMUX_FUNC_MAX 0x04 18 19 #define ENE_KB1200_NO_PUD_POS 12 20 #define ENE_KB1200_PD_POS 13 21 #define ENE_KB1200_PU_POS 14 22 #define ENE_KB1200_PUSH_PULL_POS 15 23 #define ENE_KB1200_OPEN_DRAIN_POS 16 24 #define ENE_KB1200_OUT_DIS_POS 17 25 #define ENE_KB1200_OUT_EN_POS 18 26 #define ENE_KB1200_OUT_HI_POS 19 27 #define ENE_KB1200_OUT_LO_POS 20 28 #define ENE_KB1200_PIN_LOW_POWER_POS 21 29 30 #define ENE_KB1200_PINMUX_PORT_POS 5 31 #define ENE_KB1200_PINMUX_PORT_MSK 0x7 32 #define ENE_KB1200_PINMUX_PIN_POS 0 33 #define ENE_KB1200_PINMUX_PIN_MSK 0x1f 34 #define ENE_KB1200_PINMUX_FUNC_POS 8 35 #define ENE_KB1200_PINMUX_FUNC_MSK 0xf 36 37 /* 38 * f is function number 39 * b[7:5] = pin bank 40 * b[4:0] = pin position in bank 41 * b[11:8] = function 42 */ 43 #define ENE_KB1200_PINMUX(n, f) \ 44 (((((n) >> 5) & ENE_KB1200_PINMUX_PORT_MSK) << ENE_KB1200_PINMUX_PORT_POS) | \ 45 (((n) & ENE_KB1200_PINMUX_PIN_MSK) << ENE_KB1200_PINMUX_PIN_POS) | \ 46 (((f) & ENE_KB1200_PINMUX_FUNC_MSK) << ENE_KB1200_PINMUX_FUNC_POS)) 47 48 #endif /* ZEPHYR_INCLUDE_DT_BINDINGS_PINCTRL_ENE_KB1200_PINCTRL_H_ */ 49