Lines Matching refs:gpio

3  * PPC4xx gpio driver
17 #include <linux/gpio/legacy-of-mm-gpiochip.h>
18 #include <linux/gpio/driver.h>
22 #define GPIO_MASK(gpio) (0x80000000 >> (gpio))
23 #define GPIO_MASK2(gpio) (0xc0000000 >> ((gpio) * 2))
55 * There are a maximum of 32 gpios in each gpio controller.
58 static int ppc4xx_gpio_get(struct gpio_chip *gc, unsigned int gpio)
63 return !!(in_be32(&regs->ir) & GPIO_MASK(gpio));
67 __ppc4xx_gpio_set(struct gpio_chip *gc, unsigned int gpio, int val)
73 setbits32(&regs->or, GPIO_MASK(gpio));
75 clrbits32(&regs->or, GPIO_MASK(gpio));
79 ppc4xx_gpio_set(struct gpio_chip *gc, unsigned int gpio, int val)
86 __ppc4xx_gpio_set(gc, gpio, val);
90 pr_debug("%s: gpio: %d val: %d\n", __func__, gpio, val);
93 static int ppc4xx_gpio_dir_in(struct gpio_chip *gc, unsigned int gpio)
103 clrbits32(&regs->odr, GPIO_MASK(gpio));
106 clrbits32(&regs->tcr, GPIO_MASK(gpio));
109 if (gpio < 16) {
110 clrbits32(&regs->osrl, GPIO_MASK2(gpio));
111 clrbits32(&regs->tsrl, GPIO_MASK2(gpio));
113 clrbits32(&regs->osrh, GPIO_MASK2(gpio));
114 clrbits32(&regs->tsrh, GPIO_MASK2(gpio));
123 ppc4xx_gpio_dir_out(struct gpio_chip *gc, unsigned int gpio, int val)
133 __ppc4xx_gpio_set(gc, gpio, val);
136 clrbits32(&regs->odr, GPIO_MASK(gpio));
139 setbits32(&regs->tcr, GPIO_MASK(gpio));
142 if (gpio < 16) {
143 clrbits32(&regs->osrl, GPIO_MASK2(gpio));
144 clrbits32(&regs->tsrl, GPIO_MASK2(gpio));
146 clrbits32(&regs->osrh, GPIO_MASK2(gpio));
147 clrbits32(&regs->tsrh, GPIO_MASK2(gpio));
152 pr_debug("%s: gpio: %d val: %d\n", __func__, gpio, val);
161 for_each_compatible_node(np, NULL, "ibm,ppc4xx-gpio") {