jzgc 1333 drivers/pinctrl/pinctrl-ingenic.c static u32 ingenic_gpio_read_reg(struct ingenic_gpio_chip *jzgc, u8 reg) jzgc 1337 drivers/pinctrl/pinctrl-ingenic.c regmap_read(jzgc->jzpc->map, jzgc->reg_base + reg, &val); jzgc 1342 drivers/pinctrl/pinctrl-ingenic.c static void ingenic_gpio_set_bit(struct ingenic_gpio_chip *jzgc, jzgc 1350 drivers/pinctrl/pinctrl-ingenic.c regmap_write(jzgc->jzpc->map, jzgc->reg_base + reg, BIT(offset)); jzgc 1353 drivers/pinctrl/pinctrl-ingenic.c static void ingenic_gpio_shadow_set_bit(struct ingenic_gpio_chip *jzgc, jzgc 1361 drivers/pinctrl/pinctrl-ingenic.c regmap_write(jzgc->jzpc->map, X1000_GPIO_PZ_BASE + reg, BIT(offset)); jzgc 1364 drivers/pinctrl/pinctrl-ingenic.c static void ingenic_gpio_shadow_set_bit_load(struct ingenic_gpio_chip *jzgc) jzgc 1366 drivers/pinctrl/pinctrl-ingenic.c regmap_write(jzgc->jzpc->map, X1000_GPIO_PZ_GID2LD, jzgc 1367 drivers/pinctrl/pinctrl-ingenic.c jzgc->gc.base / PINS_PER_GPIO_CHIP); jzgc 1370 drivers/pinctrl/pinctrl-ingenic.c static inline bool ingenic_gpio_get_value(struct ingenic_gpio_chip *jzgc, jzgc 1373 drivers/pinctrl/pinctrl-ingenic.c unsigned int val = ingenic_gpio_read_reg(jzgc, GPIO_PIN); jzgc 1378 drivers/pinctrl/pinctrl-ingenic.c static void ingenic_gpio_set_value(struct ingenic_gpio_chip *jzgc, jzgc 1381 drivers/pinctrl/pinctrl-ingenic.c if (jzgc->jzpc->version >= ID_JZ4760) jzgc 1382 drivers/pinctrl/pinctrl-ingenic.c ingenic_gpio_set_bit(jzgc, JZ4760_GPIO_PAT0, offset, !!value); jzgc 1384 drivers/pinctrl/pinctrl-ingenic.c ingenic_gpio_set_bit(jzgc, JZ4740_GPIO_DATA, offset, !!value); jzgc 1387 drivers/pinctrl/pinctrl-ingenic.c static void irq_set_type(struct ingenic_gpio_chip *jzgc, jzgc 1392 drivers/pinctrl/pinctrl-ingenic.c if (jzgc->jzpc->version >= ID_JZ4760) { jzgc 1402 drivers/pinctrl/pinctrl-ingenic.c if (jzgc->jzpc->version >= ID_X1000) { jzgc 1403 drivers/pinctrl/pinctrl-ingenic.c ingenic_gpio_shadow_set_bit(jzgc, reg2, offset, true); jzgc 1404 drivers/pinctrl/pinctrl-ingenic.c ingenic_gpio_shadow_set_bit(jzgc, reg1, offset, true); jzgc 1405 drivers/pinctrl/pinctrl-ingenic.c ingenic_gpio_shadow_set_bit_load(jzgc); jzgc 1407 drivers/pinctrl/pinctrl-ingenic.c ingenic_gpio_set_bit(jzgc, reg2, offset, true); jzgc 1408 drivers/pinctrl/pinctrl-ingenic.c ingenic_gpio_set_bit(jzgc, reg1, offset, true); jzgc 1412 drivers/pinctrl/pinctrl-ingenic.c if (jzgc->jzpc->version >= ID_X1000) { jzgc 1413 drivers/pinctrl/pinctrl-ingenic.c ingenic_gpio_shadow_set_bit(jzgc, reg2, offset, false); jzgc 1414 drivers/pinctrl/pinctrl-ingenic.c ingenic_gpio_shadow_set_bit(jzgc, reg1, offset, true); jzgc 1415 drivers/pinctrl/pinctrl-ingenic.c ingenic_gpio_shadow_set_bit_load(jzgc); jzgc 1417 drivers/pinctrl/pinctrl-ingenic.c ingenic_gpio_set_bit(jzgc, reg2, offset, false); jzgc 1418 drivers/pinctrl/pinctrl-ingenic.c ingenic_gpio_set_bit(jzgc, reg1, offset, true); jzgc 1422 drivers/pinctrl/pinctrl-ingenic.c if (jzgc->jzpc->version >= ID_X1000) { jzgc 1423 drivers/pinctrl/pinctrl-ingenic.c ingenic_gpio_shadow_set_bit(jzgc, reg2, offset, true); jzgc 1424 drivers/pinctrl/pinctrl-ingenic.c ingenic_gpio_shadow_set_bit(jzgc, reg1, offset, false); jzgc 1425 drivers/pinctrl/pinctrl-ingenic.c ingenic_gpio_shadow_set_bit_load(jzgc); jzgc 1427 drivers/pinctrl/pinctrl-ingenic.c ingenic_gpio_set_bit(jzgc, reg2, offset, true); jzgc 1428 drivers/pinctrl/pinctrl-ingenic.c ingenic_gpio_set_bit(jzgc, reg1, offset, false); jzgc 1433 drivers/pinctrl/pinctrl-ingenic.c if (jzgc->jzpc->version >= ID_X1000) { jzgc 1434 drivers/pinctrl/pinctrl-ingenic.c ingenic_gpio_shadow_set_bit(jzgc, reg2, offset, false); jzgc 1435 drivers/pinctrl/pinctrl-ingenic.c ingenic_gpio_shadow_set_bit(jzgc, reg1, offset, false); jzgc 1436 drivers/pinctrl/pinctrl-ingenic.c ingenic_gpio_shadow_set_bit_load(jzgc); jzgc 1438 drivers/pinctrl/pinctrl-ingenic.c ingenic_gpio_set_bit(jzgc, reg2, offset, false); jzgc 1439 drivers/pinctrl/pinctrl-ingenic.c ingenic_gpio_set_bit(jzgc, reg1, offset, false); jzgc 1448 drivers/pinctrl/pinctrl-ingenic.c struct ingenic_gpio_chip *jzgc = gpiochip_get_data(gc); jzgc 1450 drivers/pinctrl/pinctrl-ingenic.c ingenic_gpio_set_bit(jzgc, GPIO_MSK, irqd->hwirq, true); jzgc 1456 drivers/pinctrl/pinctrl-ingenic.c struct ingenic_gpio_chip *jzgc = gpiochip_get_data(gc); jzgc 1458 drivers/pinctrl/pinctrl-ingenic.c ingenic_gpio_set_bit(jzgc, GPIO_MSK, irqd->hwirq, false); jzgc 1464 drivers/pinctrl/pinctrl-ingenic.c struct ingenic_gpio_chip *jzgc = gpiochip_get_data(gc); jzgc 1467 drivers/pinctrl/pinctrl-ingenic.c if (jzgc->jzpc->version >= ID_JZ4760) jzgc 1468 drivers/pinctrl/pinctrl-ingenic.c ingenic_gpio_set_bit(jzgc, JZ4760_GPIO_INT, irq, true); jzgc 1470 drivers/pinctrl/pinctrl-ingenic.c ingenic_gpio_set_bit(jzgc, JZ4740_GPIO_SELECT, irq, true); jzgc 1478 drivers/pinctrl/pinctrl-ingenic.c struct ingenic_gpio_chip *jzgc = gpiochip_get_data(gc); jzgc 1483 drivers/pinctrl/pinctrl-ingenic.c if (jzgc->jzpc->version >= ID_JZ4760) jzgc 1484 drivers/pinctrl/pinctrl-ingenic.c ingenic_gpio_set_bit(jzgc, JZ4760_GPIO_INT, irq, false); jzgc 1486 drivers/pinctrl/pinctrl-ingenic.c ingenic_gpio_set_bit(jzgc, JZ4740_GPIO_SELECT, irq, false); jzgc 1492 drivers/pinctrl/pinctrl-ingenic.c struct ingenic_gpio_chip *jzgc = gpiochip_get_data(gc); jzgc 1501 drivers/pinctrl/pinctrl-ingenic.c high = ingenic_gpio_get_value(jzgc, irq); jzgc 1503 drivers/pinctrl/pinctrl-ingenic.c irq_set_type(jzgc, irq, IRQ_TYPE_EDGE_FALLING); jzgc 1505 drivers/pinctrl/pinctrl-ingenic.c irq_set_type(jzgc, irq, IRQ_TYPE_EDGE_RISING); jzgc 1508 drivers/pinctrl/pinctrl-ingenic.c if (jzgc->jzpc->version >= ID_JZ4760) jzgc 1509 drivers/pinctrl/pinctrl-ingenic.c ingenic_gpio_set_bit(jzgc, JZ4760_GPIO_FLAG, irq, false); jzgc 1511 drivers/pinctrl/pinctrl-ingenic.c ingenic_gpio_set_bit(jzgc, JZ4740_GPIO_DATA, irq, true); jzgc 1517 drivers/pinctrl/pinctrl-ingenic.c struct ingenic_gpio_chip *jzgc = gpiochip_get_data(gc); jzgc 1539 drivers/pinctrl/pinctrl-ingenic.c bool high = ingenic_gpio_get_value(jzgc, irqd->hwirq); jzgc 1544 drivers/pinctrl/pinctrl-ingenic.c irq_set_type(jzgc, irqd->hwirq, type); jzgc 1551 drivers/pinctrl/pinctrl-ingenic.c struct ingenic_gpio_chip *jzgc = gpiochip_get_data(gc); jzgc 1553 drivers/pinctrl/pinctrl-ingenic.c return irq_set_irq_wake(jzgc->irq, on); jzgc 1559 drivers/pinctrl/pinctrl-ingenic.c struct ingenic_gpio_chip *jzgc = gpiochip_get_data(gc); jzgc 1565 drivers/pinctrl/pinctrl-ingenic.c if (jzgc->jzpc->version >= ID_JZ4760) jzgc 1566 drivers/pinctrl/pinctrl-ingenic.c flag = ingenic_gpio_read_reg(jzgc, JZ4760_GPIO_FLAG); jzgc 1568 drivers/pinctrl/pinctrl-ingenic.c flag = ingenic_gpio_read_reg(jzgc, JZ4740_GPIO_FLAG); jzgc 1578 drivers/pinctrl/pinctrl-ingenic.c struct ingenic_gpio_chip *jzgc = gpiochip_get_data(gc); jzgc 1580 drivers/pinctrl/pinctrl-ingenic.c ingenic_gpio_set_value(jzgc, offset, value); jzgc 1585 drivers/pinctrl/pinctrl-ingenic.c struct ingenic_gpio_chip *jzgc = gpiochip_get_data(gc); jzgc 1587 drivers/pinctrl/pinctrl-ingenic.c return (int) ingenic_gpio_get_value(jzgc, offset); jzgc 1642 drivers/pinctrl/pinctrl-ingenic.c struct ingenic_gpio_chip *jzgc = gpiochip_get_data(gc); jzgc 1643 drivers/pinctrl/pinctrl-ingenic.c struct ingenic_pinctrl *jzpc = jzgc->jzpc; jzgc 1941 drivers/pinctrl/pinctrl-ingenic.c struct ingenic_gpio_chip *jzgc; jzgc 1952 drivers/pinctrl/pinctrl-ingenic.c jzgc = devm_kzalloc(dev, sizeof(*jzgc), GFP_KERNEL); jzgc 1953 drivers/pinctrl/pinctrl-ingenic.c if (!jzgc) jzgc 1956 drivers/pinctrl/pinctrl-ingenic.c jzgc->jzpc = jzpc; jzgc 1957 drivers/pinctrl/pinctrl-ingenic.c jzgc->reg_base = bank * 0x100; jzgc 1959 drivers/pinctrl/pinctrl-ingenic.c jzgc->gc.label = devm_kasprintf(dev, GFP_KERNEL, "GPIO%c", 'A' + bank); jzgc 1960 drivers/pinctrl/pinctrl-ingenic.c if (!jzgc->gc.label) jzgc 1967 drivers/pinctrl/pinctrl-ingenic.c jzgc->gc.base = bank * 32; jzgc 1969 drivers/pinctrl/pinctrl-ingenic.c jzgc->gc.ngpio = 32; jzgc 1970 drivers/pinctrl/pinctrl-ingenic.c jzgc->gc.parent = dev; jzgc 1971 drivers/pinctrl/pinctrl-ingenic.c jzgc->gc.of_node = node; jzgc 1972 drivers/pinctrl/pinctrl-ingenic.c jzgc->gc.owner = THIS_MODULE; jzgc 1974 drivers/pinctrl/pinctrl-ingenic.c jzgc->gc.set = ingenic_gpio_set; jzgc 1975 drivers/pinctrl/pinctrl-ingenic.c jzgc->gc.get = ingenic_gpio_get; jzgc 1976 drivers/pinctrl/pinctrl-ingenic.c jzgc->gc.direction_input = ingenic_gpio_direction_input; jzgc 1977 drivers/pinctrl/pinctrl-ingenic.c jzgc->gc.direction_output = ingenic_gpio_direction_output; jzgc 1978 drivers/pinctrl/pinctrl-ingenic.c jzgc->gc.get_direction = ingenic_gpio_get_direction; jzgc 1981 drivers/pinctrl/pinctrl-ingenic.c jzgc->gc.request = gpiochip_generic_request; jzgc 1982 drivers/pinctrl/pinctrl-ingenic.c jzgc->gc.free = gpiochip_generic_free; jzgc 1985 drivers/pinctrl/pinctrl-ingenic.c err = devm_gpiochip_add_data(dev, &jzgc->gc, jzgc); jzgc 1989 drivers/pinctrl/pinctrl-ingenic.c jzgc->irq = irq_of_parse_and_map(node, 0); jzgc 1990 drivers/pinctrl/pinctrl-ingenic.c if (!jzgc->irq) jzgc 1993 drivers/pinctrl/pinctrl-ingenic.c jzgc->irq_chip.name = jzgc->gc.label; jzgc 1994 drivers/pinctrl/pinctrl-ingenic.c jzgc->irq_chip.irq_enable = ingenic_gpio_irq_enable; jzgc 1995 drivers/pinctrl/pinctrl-ingenic.c jzgc->irq_chip.irq_disable = ingenic_gpio_irq_disable; jzgc 1996 drivers/pinctrl/pinctrl-ingenic.c jzgc->irq_chip.irq_unmask = ingenic_gpio_irq_unmask; jzgc 1997 drivers/pinctrl/pinctrl-ingenic.c jzgc->irq_chip.irq_mask = ingenic_gpio_irq_mask; jzgc 1998 drivers/pinctrl/pinctrl-ingenic.c jzgc->irq_chip.irq_ack = ingenic_gpio_irq_ack; jzgc 1999 drivers/pinctrl/pinctrl-ingenic.c jzgc->irq_chip.irq_set_type = ingenic_gpio_irq_set_type; jzgc 2000 drivers/pinctrl/pinctrl-ingenic.c jzgc->irq_chip.irq_set_wake = ingenic_gpio_irq_set_wake; jzgc 2001 drivers/pinctrl/pinctrl-ingenic.c jzgc->irq_chip.flags = IRQCHIP_MASK_ON_SUSPEND; jzgc 2003 drivers/pinctrl/pinctrl-ingenic.c err = gpiochip_irqchip_add(&jzgc->gc, &jzgc->irq_chip, 0, jzgc 2008 drivers/pinctrl/pinctrl-ingenic.c gpiochip_set_chained_irqchip(&jzgc->gc, &jzgc->irq_chip, jzgc 2009 drivers/pinctrl/pinctrl-ingenic.c jzgc->irq, ingenic_gpio_irq_handler);