Lines Matching refs:c
151 #define for_each_gpio_chip(i, c) \ argument
152 for (i = 0, c = &pxa_gpio_chips[0]; i <= pxa_last_gpio; i += 32, c++)
154 static inline void __iomem *gpio_chip_base(struct gpio_chip *c) in gpio_chip_base() argument
156 return container_of(c, struct pxa_gpio_chip, chip)->regbase; in gpio_chip_base()
315 struct gpio_chip *c = &chips[i].chip; in pxa_init_gpio_chip() local
321 c->base = gpio; in pxa_init_gpio_chip()
322 c->label = chips[i].label; in pxa_init_gpio_chip()
324 c->direction_input = pxa_gpio_direction_input; in pxa_init_gpio_chip()
325 c->direction_output = pxa_gpio_direction_output; in pxa_init_gpio_chip()
326 c->get = pxa_gpio_get; in pxa_init_gpio_chip()
327 c->set = pxa_gpio_set; in pxa_init_gpio_chip()
328 c->to_irq = pxa_gpio_to_irq; in pxa_init_gpio_chip()
330 c->of_node = pxa_gpio_of_node; in pxa_init_gpio_chip()
331 c->of_xlate = pxa_gpio_of_xlate; in pxa_init_gpio_chip()
332 c->of_gpio_n_cells = 2; in pxa_init_gpio_chip()
336 c->ngpio = (gpio + 31 > gpio_end) ? (gpio_end - gpio + 1) : 32; in pxa_init_gpio_chip()
337 gpiochip_add(c); in pxa_init_gpio_chip()
346 static inline void update_edge_detect(struct pxa_gpio_chip *c) in update_edge_detect() argument
350 grer = readl_relaxed(c->regbase + GRER_OFFSET) & ~c->irq_mask; in update_edge_detect()
351 gfer = readl_relaxed(c->regbase + GFER_OFFSET) & ~c->irq_mask; in update_edge_detect()
352 grer |= c->irq_edge_rise & c->irq_mask; in update_edge_detect()
353 gfer |= c->irq_edge_fall & c->irq_mask; in update_edge_detect()
354 writel_relaxed(grer, c->regbase + GRER_OFFSET); in update_edge_detect()
355 writel_relaxed(gfer, c->regbase + GFER_OFFSET); in update_edge_detect()
360 struct pxa_gpio_chip *c; in pxa_gpio_irq_type() local
364 c = gpio_to_pxachip(gpio); in pxa_gpio_irq_type()
370 if ((c->irq_edge_rise | c->irq_edge_fall) & GPIO_bit(gpio)) in pxa_gpio_irq_type()
379 gpdr = readl_relaxed(c->regbase + GPDR_OFFSET); in pxa_gpio_irq_type()
382 writel_relaxed(gpdr | mask, c->regbase + GPDR_OFFSET); in pxa_gpio_irq_type()
384 writel_relaxed(gpdr & ~mask, c->regbase + GPDR_OFFSET); in pxa_gpio_irq_type()
387 c->irq_edge_rise |= mask; in pxa_gpio_irq_type()
389 c->irq_edge_rise &= ~mask; in pxa_gpio_irq_type()
392 c->irq_edge_fall |= mask; in pxa_gpio_irq_type()
394 c->irq_edge_fall &= ~mask; in pxa_gpio_irq_type()
396 update_edge_detect(c); in pxa_gpio_irq_type()
406 struct pxa_gpio_chip *c; in pxa_gpio_demux_handler() local
415 for_each_gpio_chip(gpio, c) { in pxa_gpio_demux_handler()
416 gpio_base = c->chip.base; in pxa_gpio_demux_handler()
418 gedr = readl_relaxed(c->regbase + GEDR_OFFSET); in pxa_gpio_demux_handler()
419 gedr = gedr & c->irq_mask; in pxa_gpio_demux_handler()
420 writel_relaxed(gedr, c->regbase + GEDR_OFFSET); in pxa_gpio_demux_handler()
436 struct pxa_gpio_chip *c = gpio_to_pxachip(gpio); in pxa_ack_muxed_gpio() local
438 writel_relaxed(GPIO_bit(gpio), c->regbase + GEDR_OFFSET); in pxa_ack_muxed_gpio()
444 struct pxa_gpio_chip *c = gpio_to_pxachip(gpio); in pxa_mask_muxed_gpio() local
447 c->irq_mask &= ~GPIO_bit(gpio); in pxa_mask_muxed_gpio()
449 grer = readl_relaxed(c->regbase + GRER_OFFSET) & ~GPIO_bit(gpio); in pxa_mask_muxed_gpio()
450 gfer = readl_relaxed(c->regbase + GFER_OFFSET) & ~GPIO_bit(gpio); in pxa_mask_muxed_gpio()
451 writel_relaxed(grer, c->regbase + GRER_OFFSET); in pxa_mask_muxed_gpio()
452 writel_relaxed(gfer, c->regbase + GFER_OFFSET); in pxa_mask_muxed_gpio()
458 struct pxa_gpio_chip *c = gpio_to_pxachip(gpio); in pxa_gpio_set_wake() local
460 if (c->set_wake) in pxa_gpio_set_wake()
461 return c->set_wake(gpio, on); in pxa_gpio_set_wake()
469 struct pxa_gpio_chip *c = gpio_to_pxachip(gpio); in pxa_unmask_muxed_gpio() local
471 c->irq_mask |= GPIO_bit(gpio); in pxa_unmask_muxed_gpio()
472 update_edge_detect(c); in pxa_unmask_muxed_gpio()
574 struct pxa_gpio_chip *c; in pxa_gpio_probe() local
632 for_each_gpio_chip(gpio, c) { in pxa_gpio_probe()
633 writel_relaxed(0, c->regbase + GFER_OFFSET); in pxa_gpio_probe()
634 writel_relaxed(0, c->regbase + GRER_OFFSET); in pxa_gpio_probe()
635 writel_relaxed(~0, c->regbase + GEDR_OFFSET); in pxa_gpio_probe()
638 writel_relaxed(~0, c->regbase + ED_MASK_OFFSET); in pxa_gpio_probe()
702 struct pxa_gpio_chip *c; in pxa_gpio_suspend() local
705 for_each_gpio_chip(gpio, c) { in pxa_gpio_suspend()
706 c->saved_gplr = readl_relaxed(c->regbase + GPLR_OFFSET); in pxa_gpio_suspend()
707 c->saved_gpdr = readl_relaxed(c->regbase + GPDR_OFFSET); in pxa_gpio_suspend()
708 c->saved_grer = readl_relaxed(c->regbase + GRER_OFFSET); in pxa_gpio_suspend()
709 c->saved_gfer = readl_relaxed(c->regbase + GFER_OFFSET); in pxa_gpio_suspend()
712 writel_relaxed(0xffffffff, c->regbase + GEDR_OFFSET); in pxa_gpio_suspend()
719 struct pxa_gpio_chip *c; in pxa_gpio_resume() local
722 for_each_gpio_chip(gpio, c) { in pxa_gpio_resume()
724 writel_relaxed(c->saved_gplr, c->regbase + GPSR_OFFSET); in pxa_gpio_resume()
725 writel_relaxed(~c->saved_gplr, c->regbase + GPCR_OFFSET); in pxa_gpio_resume()
727 writel_relaxed(c->saved_grer, c->regbase + GRER_OFFSET); in pxa_gpio_resume()
728 writel_relaxed(c->saved_gfer, c->regbase + GFER_OFFSET); in pxa_gpio_resume()
729 writel_relaxed(c->saved_gpdr, c->regbase + GPDR_OFFSET); in pxa_gpio_resume()