1 /* 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 #define REALTEK_RTS5912_GPIO_INOUT BIT(0) /* IN/OUT : 0 input 1 output */ 14 #define REALTEK_RTS5912_GPIO_PINON BIT(1) /* Input_detect : 1 enable 0 disable */ 15 #define REALTEK_RTS5912_GPIO_VOLT BIT(2) /* Pin Volt : 1 1.8V 0 3.3V */ 16 #define REALTEK_RTS5912_FUNC0 0 /* GPIO mode */ 17 #define REALTEK_RTS5912_FUNC1 BIT(8) /* Function mode use BIT0~2 */ 18 #define REALTEK_RTS5912_FUNC2 BIT(9) 19 #define REALTEK_RTS5912_FUNC3 ((BIT(8)) | (BIT(9))) 20 #define REALTEK_RTS5912_FUNC4 BIT(10) 21 22 #define REALTEK_RTS5912_INPUT_OUTPUT_POS 0 23 #define REALTEK_RTS5912_INPUT_DETECTION_POS 1 24 #define REALTEK_RTS5912_VOLTAGE_POS 2 25 #define REALTEK_RTS5912_DRV_STR_POS 11 26 #define REALTEK_RTS5912_SLEW_RATE_POS 12 27 #define REALTEK_RTS5912_PD_POS 13 28 #define REALTEK_RTS5912_PU_POS 14 29 #define REALTEK_RTS5912_SCHMITTER_POS 15 30 #define REALTEK_RTS5912_TYPE_POS 16 31 #define REALTEK_RTS5912_HIGH_LOW_POS 17 32 33 #define REALTEK_RTS5912_GPIO_HIGH_POS 18 34 #define REALTEK_RTS5912_GPIO_HIGH_MSK 0x3f 35 #define REALTEK_RTS5912_GPIO_LOW_POS 3 36 #define REALTEK_RTS5912_GPIO_LOW_MSK 0x1f 37 38 #define FUNC0 REALTEK_RTS5912_FUNC0 39 #define FUNC1 REALTEK_RTS5912_FUNC1 40 #define FUNC2 REALTEK_RTS5912_FUNC2 41 #define FUNC3 REALTEK_RTS5912_FUNC3 42 #define FUNC4 REALTEK_RTS5912_FUNC4 43 44 #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_ */ 49