Lines Matching defs:gpio

17 #include <platsupport/gpio.h>
18 #include <platsupport/plat/gpio.h>
174 enum gpio_pin gpio, enum gpio_dir mode)
178 gpio, GPIO_CNF);;
180 gpio, GPIO_OE);
215 if (val & BIT(GPIO_BIT(gpio))) {
219 if (cnf_val & BIT(GPIO_BIT(gpio) + PORT_NBITS)) {
225 gpio);
229 val |= BIT(GPIO_BIT(gpio));
233 if ((val & BIT(GPIO_BIT(gpio))) == 0) {
236 if (cnf_val & BIT(GPIO_BIT(gpio) + PORT_NBITS)) {
238 gpio);
242 val &= ~(BIT(GPIO_BIT(gpio)));
246 ZF_LOGF("gpio: %d, invalid mode %d.", gpio, mode);
255 enum gpio_pin gpio, enum gpio_dir dir)
259 gpio, GPIO_INT_LVL);
279 ZF_LOGF("GPIO: %d, invalid pin direction/interrupt %d", gpio, dir);
282 val &= ~(GPIO_INT_LVL_MASK << GPIO_BIT(gpio));
283 val |= lvl_type << GPIO_BIT(gpio);
289 enum gpio_pin gpio, bool enable)
293 gpio, GPIO_INT_ENB);
297 val |= BIT(GPIO_BIT(gpio));
299 val &= ~(BIT(GPIO_BIT(gpio)));
305 static int tegra_set_level(gpio_t *gpio, enum gpio_level level)
307 gpio_sys_t *gpio_sys = gpio->gpio_sys;
308 enum gpio_pin pin = gpio->id;
314 "GPIO_IN: 0x%x, gpio: %d, bank: %d, port: %d, gpio_bit: %d",
335 static int tegra_read_level(gpio_t *gpio)
337 gpio_sys_t *gpio_sys = gpio->gpio_sys;
338 enum gpio_pin pin = gpio->id;
344 "GPIO_IN: 0x%x, gpio: %d, bank: %d, port: %d, gpio_bit: %d",
361 static void gpio_int_clear(gpio_sys_t *gpio_sys, enum gpio_pin gpio)
365 gpio, GPIO_INT_CLR);
368 "GPIO_IN: 0x%x, gpio: %d, bank: %d, port: %d, gpio_bit: %d",
369 tegra_gpio_controller[GPIO_BANK(gpio)]
370 + tegra_gpio_port[GPIO_PORT(gpio)]
372 tegra_gpio_controller[GPIO_BANK(gpio)],
373 tegra_gpio_port[GPIO_PORT(gpio)],
374 GPIO_OUT, gpio, GPIO_BANK(gpio), GPIO_PORT(gpio), GPIO_BIT(gpio));
377 val |= BIT(GPIO_BIT(gpio));
381 static bool gpio_check_pending(gpio_sys_t *gpio_sys, enum gpio_pin gpio)
385 gpio, GPIO_INT_STA);
388 return !!(val & BIT(GPIO_BIT(gpio)));
391 static int tegra_pending_status(gpio_t *gpio, bool clear)
395 if (gpio == NULL) {
398 if (gpio->gpio_sys == NULL) {
402 pending = gpio_check_pending(gpio->gpio_sys, gpio->id);
405 gpio_int_clear(gpio->gpio_sys, gpio->id);
411 static int tegra_gpio_init(gpio_sys_t *gpio_sys, int id, enum gpio_dir dir, gpio_t *gpio)
417 gpio->id = id;
418 gpio->gpio_sys = gpio_sys;
446 static int tegra_gpio_int_enable_disable(gpio_t *gpio, bool enable)
448 gpio_interrupt_enable(gpio->gpio_sys, gpio->id, enable);
492 enum gpio_pin gpio, enum gpio_pad_mode mode, enum gpio_dir dir)
496 gpio, GPIO_CNF);
498 gpio, GPIO_OUT);
501 "GPIO_CNF: 0x%x, gpio: %d, bank: %d, port: %d, gpio_bit: %d"
503 tegra_gpio_controller[GPIO_BANK(gpio)]
504 + tegra_gpio_port[GPIO_PORT(gpio)]
506 tegra_gpio_controller[GPIO_BANK(gpio)],
507 tegra_gpio_port[GPIO_PORT(gpio)],
508 GPIO_CNF, gpio, GPIO_BANK(gpio), GPIO_PORT(gpio), GPIO_BIT(gpio),
530 out_val |= BIT(GPIO_BIT(gpio));
533 out_val &= ~(BIT(GPIO_BIT(gpio)));
540 if (val & BIT(GPIO_BIT(gpio))) {
546 if (val & BIT(GPIO_BIT(gpio) + PORT_NBITS)) {
550 ZF_LOGW("Pin %d: Failed to set to GPIO mode. Pin is locked.", gpio);
554 val |= BIT(GPIO_BIT(gpio));
558 if ((val & BIT(GPIO_BIT(gpio))) == 0) {
561 if (val & BIT(GPIO_BIT(gpio) + PORT_NBITS)) {
562 ZF_LOGW("Pin %d: Failed to set to GPIO mode. Pin is locked.", gpio);
566 val &= ~(BIT(GPIO_BIT(gpio)));
570 ZF_LOGF("GPIO: pin %d, invalid mode %d", gpio, mode);