Lines Matching +full:alternate +full:- +full:port +full:- +full:control

4  * SPDX-License-Identifier: Apache-2.0
38 /* Pin-control local functions for peripheral devices */
52 uint8_t alt_mask = BIT(alt->bit); in npcx_periph_pinmux_configure()
55 * is_alternate == 0 means select GPIO, otherwise Alternate Func. in npcx_periph_pinmux_configure()
57 * Set devalt bit to select Alternate Func. in npcx_periph_pinmux_configure()
59 * Clear devalt bit to select Alternate Func. in npcx_periph_pinmux_configure()
61 if (is_alternate != alt->inverted) { in npcx_periph_pinmux_configure()
62 NPCX_DEVALT(scfg_base, alt->group) |= alt_mask; in npcx_periph_pinmux_configure()
64 NPCX_DEVALT(scfg_base, alt->group) &= ~alt_mask; in npcx_periph_pinmux_configure()
67 if (is_locked && npcx_periph_pinmux_has_lock(alt->group)) { in npcx_periph_pinmux_configure()
68 NPCX_DEVALT_LK(scfg_base, alt->group) |= alt_mask; in npcx_periph_pinmux_configure()
78 NPCX_PUPD_EN(scfg_base, pupd->group) &= ~BIT(pupd->bit); in npcx_periph_pupd_configure()
80 NPCX_PUPD_EN(scfg_base, pupd->group) |= BIT(pupd->bit); in npcx_periph_pupd_configure()
89 /* Find selected pwm module which enables open-drain prop. */ in npcx_periph_pwm_drive_mode_configure()
91 if (periph->group == pwm_pinctrl_cfg[i].channel) { in npcx_periph_pwm_drive_mode_configure()
104 inst->PWMCTLEX |= BIT(NPCX_PWMCTLEX_OD_OUT); in npcx_periph_pwm_drive_mode_configure()
106 inst->PWMCTLEX &= ~BIT(NPCX_PWMCTLEX_OD_OUT); in npcx_periph_pwm_drive_mode_configure()
112 if (pin->cfg.periph.type == NPCX_PINCTRL_TYPE_PERIPH_PINMUX) { in npcx_periph_configure()
114 npcx_periph_pinmux_configure(&pin->cfg.periph, in npcx_periph_configure()
115 !pin->flags.pinmux_gpio, in npcx_periph_configure()
116 pin->flags.pinmux_lock); in npcx_periph_configure()
117 } else if (pin->cfg.periph.type == NPCX_PINCTRL_TYPE_PERIPH_PUPD) { in npcx_periph_configure()
119 npcx_periph_pupd_configure(&pin->cfg.periph, in npcx_periph_configure()
120 pin->flags.io_bias_type); in npcx_periph_configure()
121 } else if (pin->cfg.periph.type == NPCX_PINCTRL_TYPE_PERIPH_DRIVE) { in npcx_periph_configure()
123 npcx_periph_pwm_drive_mode_configure(&pin->cfg.periph, in npcx_periph_configure()
124 pin->flags.io_drive_type == NPCX_DRIVE_TYPE_OPEN_DRAIN); in npcx_periph_configure()
132 const struct npcx_psl_input *psl_in = (const struct npcx_psl_input *)&pin->cfg.psl_in; in npcx_psl_input_detection_configure()
135 if (pin->flags.psl_in_polarity == NPCX_PSL_IN_POL_HIGH) { in npcx_psl_input_detection_configure()
136 NPCX_DEVALT(scfg_base, psl_in->pol_group) |= BIT(psl_in->pol_bit); in npcx_psl_input_detection_configure()
138 NPCX_DEVALT(scfg_base, psl_in->pol_group) &= ~BIT(psl_in->pol_bit); in npcx_psl_input_detection_configure()
142 if (pin->flags.psl_in_mode == NPCX_PSL_IN_MODE_EDGE) { in npcx_psl_input_detection_configure()
143 inst_glue->PSL_CTS |= NPCX_PSL_CTS_MODE_BIT(psl_in->port); in npcx_psl_input_detection_configure()
145 inst_glue->PSL_CTS &= ~NPCX_PSL_CTS_MODE_BIT(psl_in->port); in npcx_psl_input_detection_configure()
151 const struct npcx_dev_ctl *ctrl = (const struct npcx_dev_ctl *)&pin->cfg.dev_ctl; in npcx_device_control_configure()
154 SET_FIELD(NPCX_DEV_CTL(scfg_base, ctrl->offest), in npcx_device_control_configure()
155 FIELD(ctrl->field_offset, ctrl->field_size), in npcx_device_control_configure()
156 ctrl->field_value); in npcx_device_control_configure()
177 return -ENOTSUP; in pinctrl_configure_pins()