• Home
  • Raw
  • Download

Lines Matching +full:eic +full:- +full:debounce

1 // SPDX-License-Identifier: GPL-2.0
9 * linux/arch/arm/mach-ep93xx/core.c
52 struct ep93xx_gpio_irq_chip *eic; member
66 return egc->eic; in to_ep93xx_gpio_irq_chip()
70 * Interrupt handling for EP93xx on-chip GPIOs
81 struct ep93xx_gpio_irq_chip *eic) in ep93xx_gpio_update_int_params() argument
83 writeb_relaxed(0, epg->base + eic->irq_offset + EP93XX_INT_EN_OFFSET); in ep93xx_gpio_update_int_params()
85 writeb_relaxed(eic->int_type2, in ep93xx_gpio_update_int_params()
86 epg->base + eic->irq_offset + EP93XX_INT_TYPE2_OFFSET); in ep93xx_gpio_update_int_params()
88 writeb_relaxed(eic->int_type1, in ep93xx_gpio_update_int_params()
89 epg->base + eic->irq_offset + EP93XX_INT_TYPE1_OFFSET); in ep93xx_gpio_update_int_params()
91 writeb_relaxed(eic->int_unmasked & eic->int_enabled, in ep93xx_gpio_update_int_params()
92 epg->base + eic->irq_offset + EP93XX_INT_EN_OFFSET); in ep93xx_gpio_update_int_params()
99 struct ep93xx_gpio_irq_chip *eic = to_ep93xx_gpio_irq_chip(gc); in ep93xx_gpio_int_debounce() local
103 eic->int_debounce |= port_mask; in ep93xx_gpio_int_debounce()
105 eic->int_debounce &= ~port_mask; in ep93xx_gpio_int_debounce()
107 writeb(eic->int_debounce, in ep93xx_gpio_int_debounce()
108 epg->base + eic->irq_offset + EP93XX_INT_DEBOUNCE_OFFSET); in ep93xx_gpio_int_debounce()
127 stat = readb(epg->base + EP93XX_GPIO_A_INT_STATUS); in ep93xx_gpio_ab_irq_handler()
129 generic_handle_irq(irq_find_mapping(epg->gc[0].gc.irq.domain, in ep93xx_gpio_ab_irq_handler()
132 stat = readb(epg->base + EP93XX_GPIO_B_INT_STATUS); in ep93xx_gpio_ab_irq_handler()
134 generic_handle_irq(irq_find_mapping(epg->gc[1].gc.irq.domain, in ep93xx_gpio_ab_irq_handler()
145 * IRQ_EP93XX_GPIO{0..7}MUX -> EP93XX_GPIO_LINE_F{0..7} in ep93xx_gpio_f_irq_handler()
149 int port_f_idx = ((irq + 1) & 7) ^ 4; /* {19..22,47..50} -> {0..7} */ in ep93xx_gpio_f_irq_handler()
160 struct ep93xx_gpio_irq_chip *eic = to_ep93xx_gpio_irq_chip(gc); in ep93xx_gpio_irq_ack() local
162 int port_mask = BIT(d->irq & 7); in ep93xx_gpio_irq_ack()
165 eic->int_type2 ^= port_mask; /* switch edge direction */ in ep93xx_gpio_irq_ack()
166 ep93xx_gpio_update_int_params(epg, eic); in ep93xx_gpio_irq_ack()
169 writeb(port_mask, epg->base + eic->irq_offset + EP93XX_INT_EOI_OFFSET); in ep93xx_gpio_irq_ack()
175 struct ep93xx_gpio_irq_chip *eic = to_ep93xx_gpio_irq_chip(gc); in ep93xx_gpio_irq_mask_ack() local
177 int port_mask = BIT(d->irq & 7); in ep93xx_gpio_irq_mask_ack()
180 eic->int_type2 ^= port_mask; /* switch edge direction */ in ep93xx_gpio_irq_mask_ack()
182 eic->int_unmasked &= ~port_mask; in ep93xx_gpio_irq_mask_ack()
183 ep93xx_gpio_update_int_params(epg, eic); in ep93xx_gpio_irq_mask_ack()
185 writeb(port_mask, epg->base + eic->irq_offset + EP93XX_INT_EOI_OFFSET); in ep93xx_gpio_irq_mask_ack()
191 struct ep93xx_gpio_irq_chip *eic = to_ep93xx_gpio_irq_chip(gc); in ep93xx_gpio_irq_mask() local
194 eic->int_unmasked &= ~BIT(d->irq & 7); in ep93xx_gpio_irq_mask()
195 ep93xx_gpio_update_int_params(epg, eic); in ep93xx_gpio_irq_mask()
201 struct ep93xx_gpio_irq_chip *eic = to_ep93xx_gpio_irq_chip(gc); in ep93xx_gpio_irq_unmask() local
204 eic->int_unmasked |= BIT(d->irq & 7); in ep93xx_gpio_irq_unmask()
205 ep93xx_gpio_update_int_params(epg, eic); in ep93xx_gpio_irq_unmask()
216 struct ep93xx_gpio_irq_chip *eic = to_ep93xx_gpio_irq_chip(gc); in ep93xx_gpio_irq_type() local
218 int offset = d->irq & 7; in ep93xx_gpio_irq_type()
222 gc->direction_input(gc, offset); in ep93xx_gpio_irq_type()
226 eic->int_type1 |= port_mask; in ep93xx_gpio_irq_type()
227 eic->int_type2 |= port_mask; in ep93xx_gpio_irq_type()
231 eic->int_type1 |= port_mask; in ep93xx_gpio_irq_type()
232 eic->int_type2 &= ~port_mask; in ep93xx_gpio_irq_type()
236 eic->int_type1 &= ~port_mask; in ep93xx_gpio_irq_type()
237 eic->int_type2 |= port_mask; in ep93xx_gpio_irq_type()
241 eic->int_type1 &= ~port_mask; in ep93xx_gpio_irq_type()
242 eic->int_type2 &= ~port_mask; in ep93xx_gpio_irq_type()
246 eic->int_type1 |= port_mask; in ep93xx_gpio_irq_type()
248 if (gc->get(gc, offset)) in ep93xx_gpio_irq_type()
249 eic->int_type2 &= ~port_mask; /* falling */ in ep93xx_gpio_irq_type()
251 eic->int_type2 |= port_mask; /* rising */ in ep93xx_gpio_irq_type()
255 return -EINVAL; in ep93xx_gpio_irq_type()
260 eic->int_enabled |= port_mask; in ep93xx_gpio_irq_type()
262 ep93xx_gpio_update_int_params(epg, eic); in ep93xx_gpio_irq_type()
268 * gpiolib interface for EP93xx on-chip GPIOs
310 u32 debounce; in ep93xx_gpio_set_config() local
313 return -ENOTSUPP; in ep93xx_gpio_set_config()
315 debounce = pinconf_to_config_argument(config); in ep93xx_gpio_set_config()
316 ep93xx_gpio_int_debounce(gc, offset, debounce ? true : false); in ep93xx_gpio_set_config()
328 ic->irq_ack = ep93xx_gpio_irq_ack; in ep93xx_init_irq_chip()
329 ic->irq_mask_ack = ep93xx_gpio_irq_mask_ack; in ep93xx_init_irq_chip()
330 ic->irq_mask = ep93xx_gpio_irq_mask; in ep93xx_init_irq_chip()
331 ic->irq_unmask = ep93xx_gpio_irq_unmask; in ep93xx_init_irq_chip()
332 ic->irq_set_type = ep93xx_gpio_irq_type; in ep93xx_init_irq_chip()
340 void __iomem *data = epg->base + bank->data; in ep93xx_gpio_add_bank()
341 void __iomem *dir = epg->base + bank->dir; in ep93xx_gpio_add_bank()
342 struct gpio_chip *gc = &egc->gc; in ep93xx_gpio_add_bank()
343 struct device *dev = &pdev->dev; in ep93xx_gpio_add_bank()
351 gc->label = bank->label; in ep93xx_gpio_add_bank()
352 gc->base = bank->base; in ep93xx_gpio_add_bank()
354 girq = &gc->irq; in ep93xx_gpio_add_bank()
355 if (bank->has_irq || bank->has_hierarchical_irq) { in ep93xx_gpio_add_bank()
358 gc->set_config = ep93xx_gpio_set_config; in ep93xx_gpio_add_bank()
359 egc->eic = devm_kcalloc(dev, 1, in ep93xx_gpio_add_bank()
360 sizeof(*egc->eic), in ep93xx_gpio_add_bank()
362 if (!egc->eic) in ep93xx_gpio_add_bank()
363 return -ENOMEM; in ep93xx_gpio_add_bank()
364 egc->eic->irq_offset = bank->irq; in ep93xx_gpio_add_bank()
365 ic = &egc->eic->ic; in ep93xx_gpio_add_bank()
366 ic->name = devm_kasprintf(dev, GFP_KERNEL, "gpio-irq-%s", bank->label); in ep93xx_gpio_add_bank()
367 if (!ic->name) in ep93xx_gpio_add_bank()
368 return -ENOMEM; in ep93xx_gpio_add_bank()
370 girq->chip = ic; in ep93xx_gpio_add_bank()
373 if (bank->has_irq) { in ep93xx_gpio_add_bank()
376 girq->parent_handler = ep93xx_gpio_ab_irq_handler; in ep93xx_gpio_add_bank()
377 girq->num_parents = 1; in ep93xx_gpio_add_bank()
378 girq->parents = devm_kcalloc(dev, 1, in ep93xx_gpio_add_bank()
379 sizeof(*girq->parents), in ep93xx_gpio_add_bank()
381 if (!girq->parents) in ep93xx_gpio_add_bank()
382 return -ENOMEM; in ep93xx_gpio_add_bank()
383 girq->default_type = IRQ_TYPE_NONE; in ep93xx_gpio_add_bank()
384 girq->handler = handle_level_irq; in ep93xx_gpio_add_bank()
385 girq->parents[0] = ab_parent_irq; in ep93xx_gpio_add_bank()
386 girq->first = bank->irq_base; in ep93xx_gpio_add_bank()
390 if (bank->has_hierarchical_irq) { in ep93xx_gpio_add_bank()
398 girq->parent_handler = ep93xx_gpio_f_irq_handler; in ep93xx_gpio_add_bank()
399 girq->num_parents = 8; in ep93xx_gpio_add_bank()
400 girq->parents = devm_kcalloc(dev, 8, in ep93xx_gpio_add_bank()
401 sizeof(*girq->parents), in ep93xx_gpio_add_bank()
403 if (!girq->parents) in ep93xx_gpio_add_bank()
404 return -ENOMEM; in ep93xx_gpio_add_bank()
407 girq->parents[i - 1] = platform_get_irq(pdev, i); in ep93xx_gpio_add_bank()
410 irq_set_chip_data(gpio_irq, &epg->gc[5]); in ep93xx_gpio_add_bank()
412 girq->chip, in ep93xx_gpio_add_bank()
416 girq->default_type = IRQ_TYPE_NONE; in ep93xx_gpio_add_bank()
417 girq->handler = handle_level_irq; in ep93xx_gpio_add_bank()
418 gc->to_irq = ep93xx_gpio_f_to_irq; in ep93xx_gpio_add_bank()
429 epg = devm_kzalloc(&pdev->dev, sizeof(*epg), GFP_KERNEL); in ep93xx_gpio_probe()
431 return -ENOMEM; in ep93xx_gpio_probe()
433 epg->base = devm_platform_ioremap_resource(pdev, 0); in ep93xx_gpio_probe()
434 if (IS_ERR(epg->base)) in ep93xx_gpio_probe()
435 return PTR_ERR(epg->base); in ep93xx_gpio_probe()
438 struct ep93xx_gpio_chip *gc = &epg->gc[i]; in ep93xx_gpio_probe()
442 dev_warn(&pdev->dev, "Unable to add gpio bank %s\n", in ep93xx_gpio_probe()
443 bank->label); in ep93xx_gpio_probe()
451 .name = "gpio-ep93xx",