Lines Matching refs:gpio
34 #define GPIO_MASK(gpio) (0x80000000 >> (gpio)) argument
35 #define GPIO_MASK2(gpio) (0xc0000000 >> ((gpio) * 2)) argument
76 static int ppc4xx_gpio_get(struct gpio_chip *gc, unsigned int gpio) in ppc4xx_gpio_get() argument
81 return in_be32(®s->ir) & GPIO_MASK(gpio); in ppc4xx_gpio_get()
85 __ppc4xx_gpio_set(struct gpio_chip *gc, unsigned int gpio, int val) in __ppc4xx_gpio_set() argument
91 setbits32(®s->or, GPIO_MASK(gpio)); in __ppc4xx_gpio_set()
93 clrbits32(®s->or, GPIO_MASK(gpio)); in __ppc4xx_gpio_set()
97 ppc4xx_gpio_set(struct gpio_chip *gc, unsigned int gpio, int val) in ppc4xx_gpio_set() argument
105 __ppc4xx_gpio_set(gc, gpio, val); in ppc4xx_gpio_set()
109 pr_debug("%s: gpio: %d val: %d\n", __func__, gpio, val); in ppc4xx_gpio_set()
112 static int ppc4xx_gpio_dir_in(struct gpio_chip *gc, unsigned int gpio) in ppc4xx_gpio_dir_in() argument
122 clrbits32(®s->odr, GPIO_MASK(gpio)); in ppc4xx_gpio_dir_in()
125 clrbits32(®s->tcr, GPIO_MASK(gpio)); in ppc4xx_gpio_dir_in()
128 if (gpio < 16) { in ppc4xx_gpio_dir_in()
129 clrbits32(®s->osrl, GPIO_MASK2(gpio)); in ppc4xx_gpio_dir_in()
130 clrbits32(®s->tsrl, GPIO_MASK2(gpio)); in ppc4xx_gpio_dir_in()
132 clrbits32(®s->osrh, GPIO_MASK2(gpio)); in ppc4xx_gpio_dir_in()
133 clrbits32(®s->tsrh, GPIO_MASK2(gpio)); in ppc4xx_gpio_dir_in()
142 ppc4xx_gpio_dir_out(struct gpio_chip *gc, unsigned int gpio, int val) in ppc4xx_gpio_dir_out() argument
152 __ppc4xx_gpio_set(gc, gpio, val); in ppc4xx_gpio_dir_out()
155 clrbits32(®s->odr, GPIO_MASK(gpio)); in ppc4xx_gpio_dir_out()
158 setbits32(®s->tcr, GPIO_MASK(gpio)); in ppc4xx_gpio_dir_out()
161 if (gpio < 16) { in ppc4xx_gpio_dir_out()
162 clrbits32(®s->osrl, GPIO_MASK2(gpio)); in ppc4xx_gpio_dir_out()
163 clrbits32(®s->tsrl, GPIO_MASK2(gpio)); in ppc4xx_gpio_dir_out()
165 clrbits32(®s->osrh, GPIO_MASK2(gpio)); in ppc4xx_gpio_dir_out()
166 clrbits32(®s->tsrh, GPIO_MASK2(gpio)); in ppc4xx_gpio_dir_out()
171 pr_debug("%s: gpio: %d val: %d\n", __func__, gpio, val); in ppc4xx_gpio_dir_out()