1 /* 2 * Copyright (c) 2023 TOKITA Hiroshi <tokita.hiroshi@fujitsu.com> 3 * 4 * SPDX-License-Identifier: Apache-2.0 5 */ 6 7 #ifndef ZEPHYR_INCLUDE_DT_BINDINGS_PINCTRL_RENESAS_PINCTRL_RA_COMMON_H_ 8 #define ZEPHYR_INCLUDE_DT_BINDINGS_PINCTRL_RENESAS_PINCTRL_RA_COMMON_H_ 9 10 #define PORT4_POS 29 11 #define PORT4_MASK 0x1 12 #define PSEL_POS 24 13 #define PSEL_MASK 0x5 14 #define PORT_POS 21 15 #define PORT_MASK 0x7 16 #define PIN_POS 17 17 #define PIN_MASK 0xF 18 #define OPT_POS 0 19 #define OPT_MASK 0x1B000 20 21 #define RA_PINCFG_GPIO 0x00000 22 #define RA_PINCFG_FUNC 0x10000 23 #define RA_PINCFG_ANALOG 0x08000 24 25 #define RA_PINCFG(port, pin, psel, opt) \ 26 ((((psel)&PSEL_MASK) << PSEL_POS) | (((pin)&PIN_MASK) << PIN_POS) | \ 27 (((port)&PORT_MASK) << PORT_POS) | ((((port) >> 3) & PORT4_MASK) << PORT4_POS) | \ 28 (((opt)&OPT_MASK) << OPT_POS)) 29 30 #if RA_SOC_PINS >= 40 31 #define RA_PINCFG__40(port, pin, psel, opt) RA_PINCFG(port, pin, psel, opt) 32 #endif 33 34 #if RA_SOC_PINS >= 48 35 #define RA_PINCFG__48(port, pin, psel, opt) RA_PINCFG(port, pin, psel, opt) 36 #endif 37 38 #if RA_SOC_PINS >= 64 39 #define RA_PINCFG__64(port, pin, psel, opt) RA_PINCFG(port, pin, psel, opt) 40 #endif 41 42 #if RA_SOC_PINS >= 100 43 #define RA_PINCFG_100(port, pin, psel, opt) RA_PINCFG(port, pin, psel, opt) 44 #endif 45 46 #endif 47