Lines Matching +full:wkup +full:- +full:pins +full:- +full:pol

4  * SPDX-License-Identifier: Apache-2.0
25 /* GPIO P0 and P1 share single GPIO and WKUP peripheral instance with separate
27 * data access, bit access, mode, latch and wake-up controller are defined in
48 uint32_t pol; member
60 /* Pins that are configured for both edges (handled by software) */
95 WAKEUP->WKUP_CTRL_REG = 0; in gpio_smartbond_wkup_init()
96 WAKEUP->WKUP_CLEAR_P0_REG = 0xffffffff; in gpio_smartbond_wkup_init()
97 WAKEUP->WKUP_CLEAR_P1_REG = 0xffffffff; in gpio_smartbond_wkup_init()
98 WAKEUP->WKUP_SELECT_P0_REG = 0; in gpio_smartbond_wkup_init()
99 WAKEUP->WKUP_SELECT_P1_REG = 0; in gpio_smartbond_wkup_init()
100 WAKEUP->WKUP_SEL_GPIO_P0_REG = 0; in gpio_smartbond_wkup_init()
101 WAKEUP->WKUP_SEL_GPIO_P1_REG = 0; in gpio_smartbond_wkup_init()
102 WAKEUP->WKUP_RESET_IRQ_REG = 0; in gpio_smartbond_wkup_init()
104 CRG_TOP->CLK_TMR_REG |= CRG_TOP_CLK_TMR_REG_WAKEUPCT_ENABLE_Msk; in gpio_smartbond_wkup_init()
106 WAKEUP->WKUP_CTRL_REG = WAKEUP_WKUP_CTRL_REG_WKUP_ENABLE_IRQ_Msk; in gpio_smartbond_wkup_init()
115 const struct gpio_smartbond_config *config = dev->config; in gpio_smartbond_pin_configure()
119 config->mode_regs[pin] = GPIO_PUPD_INPUT << GPIO_P0_00_MODE_REG_PUPD_Pos; in gpio_smartbond_pin_configure()
125 return -ENOTSUP; in gpio_smartbond_pin_configure()
129 config->mode_regs[pin] = GPIO_PUPD_OUTPUT << GPIO_P0_00_MODE_REG_PUPD_Pos; in gpio_smartbond_pin_configure()
132 config->data_regs->reset = BIT(pin); in gpio_smartbond_pin_configure()
134 config->data_regs->set = BIT(pin); in gpio_smartbond_pin_configure()
141 config->mode_regs[pin] = GPIO_PUPD_INPUT_PD << GPIO_P0_00_MODE_REG_PUPD_Pos; in gpio_smartbond_pin_configure()
143 config->mode_regs[pin] = GPIO_PUPD_INPUT_PU << GPIO_P0_00_MODE_REG_PUPD_Pos; in gpio_smartbond_pin_configure()
145 config->mode_regs[pin] = GPIO_PUPD_INPUT << GPIO_P0_00_MODE_REG_PUPD_Pos; in gpio_smartbond_pin_configure()
154 const struct gpio_smartbond_config *config = dev->config; in gpio_smartbond_port_get_raw()
156 *value = config->data_regs->data; in gpio_smartbond_port_get_raw()
165 const struct gpio_smartbond_config *config = dev->config; in gpio_smartbond_port_set_masked_raw()
167 config->data_regs->set = value & mask; in gpio_smartbond_port_set_masked_raw()
168 config->data_regs->reset = ~value & mask; in gpio_smartbond_port_set_masked_raw()
174 gpio_port_pins_t pins) in gpio_smartbond_port_set_bits_raw() argument
176 const struct gpio_smartbond_config *config = dev->config; in gpio_smartbond_port_set_bits_raw()
178 config->data_regs->set = pins; in gpio_smartbond_port_set_bits_raw()
184 gpio_port_pins_t pins) in gpio_smartbond_port_clear_bits_raw() argument
186 const struct gpio_smartbond_config *config = dev->config; in gpio_smartbond_port_clear_bits_raw()
188 config->data_regs->reset = pins; in gpio_smartbond_port_clear_bits_raw()
196 const struct gpio_smartbond_config *config = dev->config; in gpio_smartbond_port_toggle_bits()
197 volatile uint32_t *reg = &config->data_regs->data; in gpio_smartbond_port_toggle_bits()
207 const struct gpio_smartbond_config *config = dev->config; in gpio_smartbond_arm_next_edge_interrupt()
211 pin_value = config->data_regs->data & pin_mask; in gpio_smartbond_arm_next_edge_interrupt()
213 config->wkup_regs->pol |= pin_mask; in gpio_smartbond_arm_next_edge_interrupt()
215 config->wkup_regs->pol &= ~pin_mask; in gpio_smartbond_arm_next_edge_interrupt()
217 } while (pin_value != (config->data_regs->data & pin_mask)); in gpio_smartbond_arm_next_edge_interrupt()
225 const struct gpio_smartbond_config *config = dev->config; in gpio_smartbond_pin_interrupt_configure()
226 struct gpio_smartbond_data *data = dev->data; in gpio_smartbond_pin_interrupt_configure()
229 int trig_select_id = (config->wkup_trig_select << 5) | pin; in gpio_smartbond_pin_interrupt_configure()
235 return -ENOTSUP; in gpio_smartbond_pin_interrupt_configure()
242 config->wkup_regs->sel &= ~pin_mask; in gpio_smartbond_pin_interrupt_configure()
243 config->wkup_regs->clear = pin_mask; in gpio_smartbond_pin_interrupt_configure()
244 data->both_edges_pins &= ~pin_mask; in gpio_smartbond_pin_interrupt_configure()
253 data->both_edges_pins |= pin_mask; in gpio_smartbond_pin_interrupt_configure()
256 config->wkup_regs->pol &= ~pin_mask; in gpio_smartbond_pin_interrupt_configure()
258 config->wkup_regs->pol |= pin_mask; in gpio_smartbond_pin_interrupt_configure()
261 config->wkup_regs->sel |= pin_mask; in gpio_smartbond_pin_interrupt_configure()
268 return -ENOMEM; in gpio_smartbond_pin_interrupt_configure()
279 struct gpio_smartbond_data *data = dev->data; in gpio_smartbond_manage_callback()
281 return gpio_manage_callback(&data->callbacks, callback, set); in gpio_smartbond_manage_callback()
286 const struct gpio_smartbond_config *config = dev->config; in gpio_smartbond_isr()
287 struct gpio_smartbond_data *data = dev->data; in gpio_smartbond_isr()
291 WAKEUP->WKUP_RESET_IRQ_REG = WAKEUP_WKUP_RESET_IRQ_REG_WKUP_IRQ_RST_Msk; in gpio_smartbond_isr()
293 stat = config->wkup_regs->status; in gpio_smartbond_isr()
295 two_edge_triggered = stat & data->both_edges_pins; in gpio_smartbond_isr()
297 int pos = find_lsb_set(two_edge_triggered) - 1; in gpio_smartbond_isr()
300 /* Re-arm for other edge */ in gpio_smartbond_isr()
304 config->wkup_regs->clear = stat; in gpio_smartbond_isr()
306 gpio_fire_callbacks(&data->callbacks, dev, stat); in gpio_smartbond_isr()
338 const struct gpio_smartbond_config *config = dev->config; in gpio_latch()
339 const struct gpio_smartbond_data *data = dev->data; in gpio_latch()
341 gpio_latch_inst((mem_addr_t)&config->data_regs->data, in gpio_latch()
342 (mem_addr_t)config->mode_regs, in gpio_latch()
343 (mem_addr_t)&config->latch_regs->reset, in gpio_latch()
344 config->ngpios, data->gpio_saved_state, data->gpio_saved_state + 1); in gpio_latch()
349 const struct gpio_smartbond_config *config = dev->config; in gpio_unlatch()
350 const struct gpio_smartbond_data *data = dev->data; in gpio_unlatch()
352 gpio_unlatch_inst((mem_addr_t)&config->data_regs->data, in gpio_unlatch()
353 (mem_addr_t)config->mode_regs, in gpio_unlatch()
354 (mem_addr_t)&config->latch_regs->set, in gpio_unlatch()
355 config->ngpios, data->gpio_saved_state[0], data->gpio_saved_state + 1); in gpio_unlatch()
373 ret = -ENOTSUP; in gpio_smartbond_pm_action()
412 DT_INST_REG_ADDR_BY_NAME(id, wkup), \