Line data Source code
1 0 : /*
2 : * Copyright (c) ENE Technology Inc.
3 : *
4 : * SPDX-License-Identifier: Apache-2.0
5 : */
6 :
7 : #ifndef ZEPHYR_INCLUDE_DT_BINDINGS_PINCTRL_ENE_KB106X_PINCTRL_H_
8 : #define ZEPHYR_INCLUDE_DT_BINDINGS_PINCTRL_ENE_KB106X_PINCTRL_H_
9 :
10 : #include <zephyr/dt-bindings/dt-util.h>
11 :
12 0 : #define PINMUX_FUNC_GPIO 0x00
13 0 : #define PINMUX_FUNC_A 0x00
14 0 : #define PINMUX_FUNC_B 0x01
15 0 : #define PINMUX_FUNC_C 0x02
16 0 : #define PINMUX_FUNC_D 0x03
17 0 : #define PINMUX_FUNC_MAX 0x04
18 :
19 0 : #define ENE_KB106X_NO_PUD_POS 12
20 0 : #define ENE_KB106X_PD_POS 13
21 0 : #define ENE_KB106X_PU_POS 14
22 0 : #define ENE_KB106X_PUSH_PULL_POS 15
23 0 : #define ENE_KB106X_OPEN_DRAIN_POS 16
24 0 : #define ENE_KB106X_OUT_DIS_POS 17
25 0 : #define ENE_KB106X_OUT_EN_POS 18
26 0 : #define ENE_KB106X_OUT_HI_POS 19
27 0 : #define ENE_KB106X_OUT_LO_POS 20
28 0 : #define ENE_KB106X_PIN_LOW_POWER_POS 21
29 0 : #define ENE_KB106X_IN_DIS_POS 22
30 0 : #define ENE_KB106X_IN_EN_POS 23
31 0 : #define ENE_KB106X_DRIVING_POS 31
32 :
33 0 : #define ENE_KB106X_PINMUX_PORT_POS 5
34 0 : #define ENE_KB106X_PINMUX_PORT_MSK 0x7
35 0 : #define ENE_KB106X_PINMUX_PIN_POS 0
36 0 : #define ENE_KB106X_PINMUX_PIN_MSK 0x1f
37 0 : #define ENE_KB106X_PINMUX_FUNC_POS 8
38 0 : #define ENE_KB106X_PINMUX_FUNC_MSK 0xf
39 :
40 0 : #define ENE_KB106X_EXTENDED_BANK 0x80
41 :
42 : /*
43 : * f is function number
44 : * b[7:5] = pin bank
45 : * b[4:0] = pin position in bank
46 : * b[11:8] = function
47 : */
48 0 : #define ENE_KB106X_PINMUX(n, f) \
49 : (((((n) >> 5) & ENE_KB106X_PINMUX_PORT_MSK) << ENE_KB106X_PINMUX_PORT_POS) | \
50 : (((n) & ENE_KB106X_PINMUX_PIN_MSK) << ENE_KB106X_PINMUX_PIN_POS) | \
51 : (((f) & ENE_KB106X_PINMUX_FUNC_MSK) << ENE_KB106X_PINMUX_FUNC_POS))
52 :
53 : #endif /* ZEPHYR_INCLUDE_DT_BINDINGS_PINCTRL_ENE_KB106X_PINCTRL_H_ */
|