Line data Source code
1 0 : /*
2 : * SPDX-License-Identifier: Apache-2.0
3 : *
4 : * Copyright (c) 2024 Realtek Semiconductor Corporation, SIBG-SD7
5 : * Author: Lin Yu-Cheng <lin_yu_cheng@realtek.com>
6 : */
7 :
8 : #ifndef ZEPHYR_INCLUDE_DT_BINDINGS_PINCTRL_REALTEK_RTS5912_PINCTRL_H_
9 : #define ZEPHYR_INCLUDE_DT_BINDINGS_PINCTRL_REALTEK_RTS5912_PINCTRL_H_
10 :
11 : #include <zephyr/dt-bindings/dt-util.h>
12 :
13 0 : #define REALTEK_RTS5912_GPIO_INOUT BIT(0) /* IN/OUT : 0 input 1 output */
14 0 : #define REALTEK_RTS5912_GPIO_PINON BIT(1) /* Input_detect : 1 enable 0 disable */
15 0 : #define REALTEK_RTS5912_GPIO_VOLT BIT(2) /* Pin Volt : 1 1.8V 0 3.3V */
16 0 : #define REALTEK_RTS5912_FUNC0 0 /* GPIO mode */
17 0 : #define REALTEK_RTS5912_FUNC1 BIT(8) /* Function mode use BIT0~2 */
18 0 : #define REALTEK_RTS5912_FUNC2 BIT(9)
19 0 : #define REALTEK_RTS5912_FUNC3 ((BIT(8)) | (BIT(9)))
20 0 : #define REALTEK_RTS5912_FUNC4 BIT(10)
21 :
22 0 : #define REALTEK_RTS5912_INPUT_OUTPUT_POS 0
23 0 : #define REALTEK_RTS5912_INPUT_DETECTION_POS 1
24 0 : #define REALTEK_RTS5912_VOLTAGE_POS 2
25 0 : #define REALTEK_RTS5912_DRV_STR_POS 11
26 0 : #define REALTEK_RTS5912_SLEW_RATE_POS 12
27 0 : #define REALTEK_RTS5912_PD_POS 13
28 0 : #define REALTEK_RTS5912_PU_POS 14
29 0 : #define REALTEK_RTS5912_SCHMITTER_POS 15
30 0 : #define REALTEK_RTS5912_TYPE_POS 16
31 0 : #define REALTEK_RTS5912_HIGH_LOW_POS 17
32 :
33 0 : #define REALTEK_RTS5912_GPIO_HIGH_POS 18
34 0 : #define REALTEK_RTS5912_GPIO_HIGH_MSK 0x3f
35 0 : #define REALTEK_RTS5912_GPIO_LOW_POS 3
36 0 : #define REALTEK_RTS5912_GPIO_LOW_MSK 0x1f
37 :
38 0 : #define FUNC0 REALTEK_RTS5912_FUNC0
39 0 : #define FUNC1 REALTEK_RTS5912_FUNC1
40 0 : #define FUNC2 REALTEK_RTS5912_FUNC2
41 0 : #define FUNC3 REALTEK_RTS5912_FUNC3
42 0 : #define FUNC4 REALTEK_RTS5912_FUNC4
43 :
44 0 : #define REALTEK_RTS5912_PINMUX(n, f) \
45 : (((((n) >> 5) & REALTEK_RTS5912_GPIO_HIGH_MSK) << REALTEK_RTS5912_GPIO_HIGH_POS) | \
46 : (((n) & REALTEK_RTS5912_GPIO_LOW_MSK) << REALTEK_RTS5912_GPIO_LOW_POS) | (f))
47 :
48 : #endif /* ZEPHYR_INCLUDE_DT_BINDINGS_PINCTRL_REALTEK_RTS5912_PINCTRL_H_ */
|