| .. | .. |
|---|
| 45 | 45 | * The pins of a pinmux groups are composed of one or two groups of contiguous |
|---|
| 46 | 46 | * pins. |
|---|
| 47 | 47 | * @name: Name of the pin group, used to lookup the group. |
|---|
| 48 | | - * @start_pins: Index of the first pin of the main range of pins belonging to |
|---|
| 48 | + * @start_pin: Index of the first pin of the main range of pins belonging to |
|---|
| 49 | 49 | * the group |
|---|
| 50 | 50 | * @npins: Number of pins included in the first range |
|---|
| 51 | 51 | * @reg_mask: Bit mask matching the group in the selection register |
|---|
| 52 | | - * @extra_pins: Index of the first pin of the optional second range of pins |
|---|
| 52 | + * @val: Value to write to the registers for a given function |
|---|
| 53 | + * @extra_pin: Index of the first pin of the optional second range of pins |
|---|
| 53 | 54 | * belonging to the group |
|---|
| 54 | | - * @npins: Number of pins included in the second optional range |
|---|
| 55 | + * @extra_npins:Number of pins included in the second optional range |
|---|
| 55 | 56 | * @funcs: A list of pinmux functions that can be selected for this group. |
|---|
| 56 | 57 | * @pins: List of the pins included in the group |
|---|
| 57 | 58 | */ |
|---|
| .. | .. |
|---|
| 195 | 196 | PIN_GRP_GPIO("sdio_sb", 24, 6, BIT(2), "sdio"), |
|---|
| 196 | 197 | PIN_GRP_GPIO("rgmii", 6, 12, BIT(3), "mii"), |
|---|
| 197 | 198 | PIN_GRP_GPIO("smi", 18, 2, BIT(4), "smi"), |
|---|
| 198 | | - PIN_GRP_GPIO("pcie1", 3, 1, BIT(5), "pcie"), |
|---|
| 199 | + PIN_GRP_GPIO("pcie1", 3, 1, BIT(5), "pcie"), /* this actually controls "pcie1_reset" */ |
|---|
| 199 | 200 | PIN_GRP_GPIO("pcie1_clkreq", 4, 1, BIT(9), "pcie"), |
|---|
| 200 | 201 | PIN_GRP_GPIO("pcie1_wakeup", 5, 1, BIT(10), "pcie"), |
|---|
| 201 | 202 | PIN_GRP_GPIO("ptp", 20, 3, BIT(11) | BIT(12) | BIT(13), "ptp"), |
|---|
| .. | .. |
|---|
| 402 | 403 | mask = BIT(offset); |
|---|
| 403 | 404 | regmap_read(info->regmap, reg, &val); |
|---|
| 404 | 405 | |
|---|
| 405 | | - return !(val & mask); |
|---|
| 406 | + if (val & mask) |
|---|
| 407 | + return GPIO_LINE_DIRECTION_OUT; |
|---|
| 408 | + |
|---|
| 409 | + return GPIO_LINE_DIRECTION_IN; |
|---|
| 406 | 410 | } |
|---|
| 407 | 411 | |
|---|
| 408 | 412 | static int armada_37xx_gpio_direction_output(struct gpio_chip *chip, |
|---|
| .. | .. |
|---|
| 721 | 725 | struct device_node *np = info->dev->of_node; |
|---|
| 722 | 726 | struct gpio_chip *gc = &info->gpio_chip; |
|---|
| 723 | 727 | struct irq_chip *irqchip = &info->irq_chip; |
|---|
| 728 | + struct gpio_irq_chip *girq = &gc->irq; |
|---|
| 729 | + struct device *dev = &pdev->dev; |
|---|
| 724 | 730 | struct resource res; |
|---|
| 725 | 731 | int ret = -ENODEV, i, nr_irq_parent; |
|---|
| 726 | 732 | |
|---|
| .. | .. |
|---|
| 730 | 736 | ret = 0; |
|---|
| 731 | 737 | break; |
|---|
| 732 | 738 | } |
|---|
| 733 | | - }; |
|---|
| 734 | | - if (ret) |
|---|
| 739 | + } |
|---|
| 740 | + if (ret) { |
|---|
| 741 | + dev_err(dev, "no gpio-controller child node\n"); |
|---|
| 735 | 742 | return ret; |
|---|
| 743 | + } |
|---|
| 736 | 744 | |
|---|
| 737 | 745 | nr_irq_parent = of_irq_count(np); |
|---|
| 738 | 746 | spin_lock_init(&info->irq_lock); |
|---|
| 739 | 747 | |
|---|
| 740 | 748 | if (!nr_irq_parent) { |
|---|
| 741 | | - dev_err(&pdev->dev, "Invalid or no IRQ\n"); |
|---|
| 749 | + dev_err(dev, "invalid or no IRQ\n"); |
|---|
| 742 | 750 | return 0; |
|---|
| 743 | 751 | } |
|---|
| 744 | 752 | |
|---|
| 745 | 753 | if (of_address_to_resource(info->dev->of_node, 1, &res)) { |
|---|
| 746 | | - dev_err(info->dev, "cannot find IO resource\n"); |
|---|
| 754 | + dev_err(dev, "cannot find IO resource\n"); |
|---|
| 747 | 755 | return -ENOENT; |
|---|
| 748 | 756 | } |
|---|
| 749 | 757 | |
|---|
| .. | .. |
|---|
| 758 | 766 | irqchip->irq_set_type = armada_37xx_irq_set_type; |
|---|
| 759 | 767 | irqchip->irq_startup = armada_37xx_irq_startup; |
|---|
| 760 | 768 | irqchip->name = info->data->name; |
|---|
| 761 | | - ret = gpiochip_irqchip_add(gc, irqchip, 0, |
|---|
| 762 | | - handle_edge_irq, IRQ_TYPE_NONE); |
|---|
| 763 | | - if (ret) { |
|---|
| 764 | | - dev_info(&pdev->dev, "could not add irqchip\n"); |
|---|
| 765 | | - return ret; |
|---|
| 766 | | - } |
|---|
| 767 | | - |
|---|
| 769 | + girq->chip = irqchip; |
|---|
| 770 | + girq->parent_handler = armada_37xx_irq_handler; |
|---|
| 768 | 771 | /* |
|---|
| 769 | 772 | * Many interrupts are connected to the parent interrupt |
|---|
| 770 | 773 | * controller. But we do not take advantage of this and use |
|---|
| 771 | 774 | * the chained irq with all of them. |
|---|
| 772 | 775 | */ |
|---|
| 776 | + girq->num_parents = nr_irq_parent; |
|---|
| 777 | + girq->parents = devm_kcalloc(&pdev->dev, nr_irq_parent, |
|---|
| 778 | + sizeof(*girq->parents), GFP_KERNEL); |
|---|
| 779 | + if (!girq->parents) |
|---|
| 780 | + return -ENOMEM; |
|---|
| 773 | 781 | for (i = 0; i < nr_irq_parent; i++) { |
|---|
| 774 | 782 | int irq = irq_of_parse_and_map(np, i); |
|---|
| 775 | 783 | |
|---|
| 776 | | - if (irq < 0) |
|---|
| 784 | + if (!irq) |
|---|
| 777 | 785 | continue; |
|---|
| 778 | | - |
|---|
| 779 | | - gpiochip_set_chained_irqchip(gc, irqchip, irq, |
|---|
| 780 | | - armada_37xx_irq_handler); |
|---|
| 786 | + girq->parents[i] = irq; |
|---|
| 781 | 787 | } |
|---|
| 788 | + girq->default_type = IRQ_TYPE_NONE; |
|---|
| 789 | + girq->handler = handle_edge_irq; |
|---|
| 782 | 790 | |
|---|
| 783 | 791 | return 0; |
|---|
| 784 | 792 | } |
|---|
| .. | .. |
|---|
| 795 | 803 | ret = 0; |
|---|
| 796 | 804 | break; |
|---|
| 797 | 805 | } |
|---|
| 798 | | - }; |
|---|
| 806 | + } |
|---|
| 799 | 807 | if (ret) |
|---|
| 800 | 808 | return ret; |
|---|
| 801 | 809 | |
|---|
| .. | .. |
|---|
| 808 | 816 | gc->of_node = np; |
|---|
| 809 | 817 | gc->label = info->data->name; |
|---|
| 810 | 818 | |
|---|
| 811 | | - ret = devm_gpiochip_add_data(&pdev->dev, gc, info); |
|---|
| 819 | + ret = armada_37xx_irqchip_register(pdev, info); |
|---|
| 812 | 820 | if (ret) |
|---|
| 813 | 821 | return ret; |
|---|
| 814 | | - ret = armada_37xx_irqchip_register(pdev, info); |
|---|
| 822 | + ret = devm_gpiochip_add_data(&pdev->dev, gc, info); |
|---|
| 815 | 823 | if (ret) |
|---|
| 816 | 824 | return ret; |
|---|
| 817 | 825 | |
|---|
| .. | .. |
|---|
| 1106 | 1114 | * to other IO drivers. |
|---|
| 1107 | 1115 | */ |
|---|
| 1108 | 1116 | static const struct dev_pm_ops armada_3700_pinctrl_pm_ops = { |
|---|
| 1109 | | - .suspend_late = armada_3700_pinctrl_suspend, |
|---|
| 1110 | | - .resume_early = armada_3700_pinctrl_resume, |
|---|
| 1117 | + .suspend_noirq = armada_3700_pinctrl_suspend, |
|---|
| 1118 | + .resume_noirq = armada_3700_pinctrl_resume, |
|---|
| 1111 | 1119 | }; |
|---|
| 1112 | 1120 | |
|---|
| 1113 | 1121 | #define PINCTRL_ARMADA_37XX_DEV_PM_OPS (&armada_3700_pinctrl_pm_ops) |
|---|