1 /* 2 * Copyright 2022-2024 NXP 3 * 4 * SPDX-License-Identifier: Apache-2.0 5 */ 6 7 #ifndef ZEPHYR_SOC_NXP_S32_S32K3_PINCTRL_SOC_H_ 8 #define ZEPHYR_SOC_NXP_S32_S32K3_PINCTRL_SOC_H_ 9 10 #include <zephyr/dt-bindings/pinctrl/nxp-s32-pinctrl.h> 11 #include <zephyr/sys/util.h> 12 13 #include "../common/siul2_pinctrl.h" 14 15 /* SIUL2 Multiplexed Signal Configuration */ 16 #define SIUL2_MSCR_SSS_MASK GENMASK(3, 0) 17 #define SIUL2_MSCR_SSS(v) FIELD_PREP(SIUL2_MSCR_SSS_MASK, (v)) 18 #define SIUL2_MSCR_SMC_MASK BIT(5) 19 #define SIUL2_MSCR_SMC(v) FIELD_PREP(SIUL2_MSCR_SMC_MASK, (v)) 20 #define SIUL2_MSCR_IFE_MASK BIT(6) 21 #define SIUL2_MSCR_IFE(v) FIELD_PREP(SIUL2_MSCR_IFE_MASK, (v)) 22 #define SIUL2_MSCR_DSE_MASK BIT(8) 23 #define SIUL2_MSCR_DSE(v) FIELD_PREP(SIUL2_MSCR_DSE_MASK, (v)) 24 #define SIUL2_MSCR_PUS_MASK BIT(11) 25 #define SIUL2_MSCR_PUS(v) FIELD_PREP(SIUL2_MSCR_PUS_MASK, (v)) 26 #define SIUL2_MSCR_PUE_MASK BIT(13) 27 #define SIUL2_MSCR_PUE(v) FIELD_PREP(SIUL2_MSCR_PUE_MASK, (v)) 28 #define SIUL2_MSCR_SRC_MASK BIT(14) 29 #define SIUL2_MSCR_SRC(v) FIELD_PREP(SIUL2_MSCR_SRC_MASK, (v)) 30 #define SIUL2_MSCR_PKE_MASK BIT(16) 31 #define SIUL2_MSCR_PKE(v) FIELD_PREP(SIUL2_MSCR_PKE_MASK, (v)) 32 #define SIUL2_MSCR_INV_MASK BIT(17) 33 #define SIUL2_MSCR_INV(v) FIELD_PREP(SIUL2_MSCR_INV_MASK, (v)) 34 #define SIUL2_MSCR_IBE_MASK BIT(19) 35 #define SIUL2_MSCR_IBE(v) FIELD_PREP(SIUL2_MSCR_IBE_MASK, (v)) 36 #define SIUL2_MSCR_OBE_MASK BIT(21) 37 #define SIUL2_MSCR_OBE(v) FIELD_PREP(SIUL2_MSCR_OBE_MASK, (v)) 38 /* SIUL2 Input Multiplexed Signal Configuration */ 39 #define SIUL2_IMCR_SSS_MASK GENMASK(3, 0) 40 #define SIUL2_IMCR_SSS(v) FIELD_PREP(SIUL2_IMCR_SSS_MASK, (v)) 41 42 #define NXP_S32_PINMUX_INIT(group, value) \ 43 .mscr = { \ 44 .inst = NXP_S32_PINMUX_GET_MSCR_SIUL2_IDX(value), \ 45 .idx = NXP_S32_PINMUX_GET_MSCR_IDX(value), \ 46 .val = SIUL2_MSCR_SSS(NXP_S32_PINMUX_GET_MSCR_SSS(value)) | \ 47 SIUL2_MSCR_OBE(DT_PROP(group, output_enable)) | \ 48 SIUL2_MSCR_IBE(DT_PROP(group, input_enable)) | \ 49 SIUL2_MSCR_PUE(DT_PROP(group, bias_pull_up) || \ 50 DT_PROP(group, bias_pull_down)) | \ 51 SIUL2_MSCR_PUS(DT_PROP(group, bias_pull_up)) | \ 52 SIUL2_MSCR_SRC(DT_ENUM_IDX(group, slew_rate)) | \ 53 SIUL2_MSCR_DSE(DT_PROP(group, nxp_drive_strength)) | \ 54 SIUL2_MSCR_INV(DT_PROP(group, nxp_invert)) \ 55 }, \ 56 .imcr = { \ 57 .inst = NXP_S32_PINMUX_GET_IMCR_SIUL2_IDX(value), \ 58 .idx = NXP_S32_PINMUX_GET_IMCR_IDX(value), \ 59 .val = SIUL2_IMCR_SSS(NXP_S32_PINMUX_GET_IMCR_SSS(value)), \ 60 } 61 62 #endif /* ZEPHYR_SOC_NXP_S32_S32K3_PINCTRL_SOC_H_ */ 63