Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge tag 'pinctrl-v3.17-2' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-pinctrl

Pull pin-control fixes from Linus Walleij:
"My first (a bit delayed) pack of pin control fixes for the v3.17
series, only driver fixes:

- SH-PFC (Renesas) r8a7791 CAN bus pin group problem
- Rockchip (GPIO0 configuration)
- Tegra-xusb (interrupt handling)
- Exynos (GPIO interrupt locking)
- Qualcomm (fix misleading example interrupts)
- minor non-critical fixes for abx500 and AT91 also sneaked in,
because I initially intended this pull for post RC-1, hope it's
still OK"

* tag 'pinctrl-v3.17-2' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-pinctrl:
pinctrl: qcom: apq8064: Correct interrupts in example
pinctrl: exynos: Lock GPIOs as interrupts when used as EINTs
pinctrl: pinctrl-at91.c: fix decimal printf format specifiers prefixed with 0x
pinctrl: abx500: remove useless check
pinctrl: tegra-xusb: testing wrong variable in probe()
pinctrl: tegra-xusb: fix an off by one test
pinctrl: rockchip: fix rk3288 gpio0 configuration
sh-pfc: r8a7791: fix CAN pin groups

+84 -23
+1 -1
Documentation/devicetree/bindings/pinctrl/qcom,apq8064-pinctrl.txt
··· 62 62 #gpio-cells = <2>; 63 63 interrupt-controller; 64 64 #interrupt-cells = <2>; 65 - interrupts = <0 32 0x4>; 65 + interrupts = <0 16 0x4>; 66 66 67 67 pinctrl-names = "default"; 68 68 pinctrl-0 = <&gsbi5_uart_default>;
+1 -2
drivers/pinctrl/nomadik/pinctrl-abx500.c
··· 620 620 } else 621 621 seq_printf(s, " %-9s", chip->get(chip, offset) ? "hi" : "lo"); 622 622 623 - if (pctldev) 624 - mode = abx500_get_mode(pctldev, chip, offset); 623 + mode = abx500_get_mode(pctldev, chip, offset); 625 624 626 625 seq_printf(s, " %s", (mode < 0) ? "unknown" : modes[mode]); 627 626
+2 -2
drivers/pinctrl/pinctrl-at91.c
··· 497 497 static void at91_pin_dbg(const struct device *dev, const struct at91_pmx_pin *pin) 498 498 { 499 499 if (pin->mux) { 500 - dev_dbg(dev, "pio%c%d configured as periph%c with conf = 0x%lu\n", 500 + dev_dbg(dev, "pio%c%d configured as periph%c with conf = 0x%lx\n", 501 501 pin->bank + 'A', pin->pin, pin->mux - 1 + 'A', pin->conf); 502 502 } else { 503 - dev_dbg(dev, "pio%c%d configured as gpio with conf = 0x%lu\n", 503 + dev_dbg(dev, "pio%c%d configured as gpio with conf = 0x%lx\n", 504 504 pin->bank + 'A', pin->pin, pin->conf); 505 505 } 506 506 }
+9 -6
drivers/pinctrl/pinctrl-rockchip.c
··· 438 438 int reg, ret, mask; 439 439 unsigned long flags; 440 440 u8 bit; 441 - u32 data; 441 + u32 data, rmask; 442 442 443 443 if (iomux_num > 3) 444 444 return -EINVAL; ··· 478 478 spin_lock_irqsave(&bank->slock, flags); 479 479 480 480 data = (mask << (bit + 16)); 481 + rmask = data | (data >> 16); 481 482 data |= (mux & mask) << bit; 482 - ret = regmap_write(regmap, reg, data); 483 + ret = regmap_update_bits(regmap, reg, rmask, data); 483 484 484 485 spin_unlock_irqrestore(&bank->slock, flags); 485 486 ··· 635 634 struct regmap *regmap; 636 635 unsigned long flags; 637 636 int reg, ret, i; 638 - u32 data; 637 + u32 data, rmask; 639 638 u8 bit; 640 639 641 640 rk3288_calc_drv_reg_and_bit(bank, pin_num, &regmap, &reg, &bit); ··· 658 657 659 658 /* enable the write to the equivalent lower bits */ 660 659 data = ((1 << RK3288_DRV_BITS_PER_PIN) - 1) << (bit + 16); 660 + rmask = data | (data >> 16); 661 661 data |= (ret << bit); 662 662 663 - ret = regmap_write(regmap, reg, data); 663 + ret = regmap_update_bits(regmap, reg, rmask, data); 664 664 spin_unlock_irqrestore(&bank->slock, flags); 665 665 666 666 return ret; ··· 724 722 int reg, ret; 725 723 unsigned long flags; 726 724 u8 bit; 727 - u32 data; 725 + u32 data, rmask; 728 726 729 727 dev_dbg(info->dev, "setting pull of GPIO%d-%d to %d\n", 730 728 bank->bank_num, pin_num, pull); ··· 752 750 753 751 /* enable the write to the equivalent lower bits */ 754 752 data = ((1 << RK3188_PULL_BITS_PER_PIN) - 1) << (bit + 16); 753 + rmask = data | (data >> 16); 755 754 756 755 switch (pull) { 757 756 case PIN_CONFIG_BIAS_DISABLE: ··· 773 770 return -EINVAL; 774 771 } 775 772 776 - ret = regmap_write(regmap, reg, data); 773 + ret = regmap_update_bits(regmap, reg, rmask, data); 777 774 778 775 spin_unlock_irqrestore(&bank->slock, flags); 779 776 break;
+3 -2
drivers/pinctrl/pinctrl-tegra-xusb.c
··· 680 680 if (args->args_count <= 0) 681 681 return ERR_PTR(-EINVAL); 682 682 683 - if (index > ARRAY_SIZE(padctl->phys)) 683 + if (index >= ARRAY_SIZE(padctl->phys)) 684 684 return ERR_PTR(-EINVAL); 685 685 686 686 return padctl->phys[index]; ··· 930 930 931 931 padctl->provider = devm_of_phy_provider_register(&pdev->dev, 932 932 tegra_xusb_padctl_xlate); 933 - if (err < 0) { 933 + if (IS_ERR(padctl->provider)) { 934 + err = PTR_ERR(padctl->provider); 934 935 dev_err(&pdev->dev, "failed to register PHYs: %d\n", err); 935 936 goto unregister; 936 937 }
+63 -6
drivers/pinctrl/samsung/pinctrl-exynos.c
··· 127 127 struct irq_chip *chip = irq_data_get_irq_chip(irqd); 128 128 struct exynos_irq_chip *our_chip = to_exynos_irq_chip(chip); 129 129 struct samsung_pin_bank *bank = irq_data_get_irq_chip_data(irqd); 130 - struct samsung_pin_bank_type *bank_type = bank->type; 131 130 struct samsung_pinctrl_drv_data *d = bank->drvdata; 132 - unsigned int pin = irqd->hwirq; 133 - unsigned int shift = EXYNOS_EINT_CON_LEN * pin; 131 + unsigned int shift = EXYNOS_EINT_CON_LEN * irqd->hwirq; 134 132 unsigned int con, trig_type; 135 133 unsigned long reg_con = our_chip->eint_con + bank->eint_offset; 136 - unsigned long flags; 137 - unsigned int mask; 138 134 139 135 switch (type) { 140 136 case IRQ_TYPE_EDGE_RISING: ··· 163 167 con |= trig_type << shift; 164 168 writel(con, d->virt_base + reg_con); 165 169 170 + return 0; 171 + } 172 + 173 + static int exynos_irq_request_resources(struct irq_data *irqd) 174 + { 175 + struct irq_chip *chip = irq_data_get_irq_chip(irqd); 176 + struct exynos_irq_chip *our_chip = to_exynos_irq_chip(chip); 177 + struct samsung_pin_bank *bank = irq_data_get_irq_chip_data(irqd); 178 + struct samsung_pin_bank_type *bank_type = bank->type; 179 + struct samsung_pinctrl_drv_data *d = bank->drvdata; 180 + unsigned int shift = EXYNOS_EINT_CON_LEN * irqd->hwirq; 181 + unsigned long reg_con = our_chip->eint_con + bank->eint_offset; 182 + unsigned long flags; 183 + unsigned int mask; 184 + unsigned int con; 185 + int ret; 186 + 187 + ret = gpio_lock_as_irq(&bank->gpio_chip, irqd->hwirq); 188 + if (ret) { 189 + dev_err(bank->gpio_chip.dev, "unable to lock pin %s-%lu IRQ\n", 190 + bank->name, irqd->hwirq); 191 + return ret; 192 + } 193 + 166 194 reg_con = bank->pctl_offset + bank_type->reg_offset[PINCFG_TYPE_FUNC]; 167 - shift = pin * bank_type->fld_width[PINCFG_TYPE_FUNC]; 195 + shift = irqd->hwirq * bank_type->fld_width[PINCFG_TYPE_FUNC]; 168 196 mask = (1 << bank_type->fld_width[PINCFG_TYPE_FUNC]) - 1; 169 197 170 198 spin_lock_irqsave(&bank->slock, flags); ··· 200 180 201 181 spin_unlock_irqrestore(&bank->slock, flags); 202 182 183 + exynos_irq_unmask(irqd); 184 + 203 185 return 0; 186 + } 187 + 188 + static void exynos_irq_release_resources(struct irq_data *irqd) 189 + { 190 + struct irq_chip *chip = irq_data_get_irq_chip(irqd); 191 + struct exynos_irq_chip *our_chip = to_exynos_irq_chip(chip); 192 + struct samsung_pin_bank *bank = irq_data_get_irq_chip_data(irqd); 193 + struct samsung_pin_bank_type *bank_type = bank->type; 194 + struct samsung_pinctrl_drv_data *d = bank->drvdata; 195 + unsigned int shift = EXYNOS_EINT_CON_LEN * irqd->hwirq; 196 + unsigned long reg_con = our_chip->eint_con + bank->eint_offset; 197 + unsigned long flags; 198 + unsigned int mask; 199 + unsigned int con; 200 + 201 + reg_con = bank->pctl_offset + bank_type->reg_offset[PINCFG_TYPE_FUNC]; 202 + shift = irqd->hwirq * bank_type->fld_width[PINCFG_TYPE_FUNC]; 203 + mask = (1 << bank_type->fld_width[PINCFG_TYPE_FUNC]) - 1; 204 + 205 + exynos_irq_mask(irqd); 206 + 207 + spin_lock_irqsave(&bank->slock, flags); 208 + 209 + con = readl(d->virt_base + reg_con); 210 + con &= ~(mask << shift); 211 + con |= FUNC_INPUT << shift; 212 + writel(con, d->virt_base + reg_con); 213 + 214 + spin_unlock_irqrestore(&bank->slock, flags); 215 + 216 + gpio_unlock_as_irq(&bank->gpio_chip, irqd->hwirq); 204 217 } 205 218 206 219 /* ··· 246 193 .irq_mask = exynos_irq_mask, 247 194 .irq_ack = exynos_irq_ack, 248 195 .irq_set_type = exynos_irq_set_type, 196 + .irq_request_resources = exynos_irq_request_resources, 197 + .irq_release_resources = exynos_irq_release_resources, 249 198 }, 250 199 .eint_con = EXYNOS_GPIO_ECON_OFFSET, 251 200 .eint_mask = EXYNOS_GPIO_EMASK_OFFSET, ··· 391 336 .irq_ack = exynos_irq_ack, 392 337 .irq_set_type = exynos_irq_set_type, 393 338 .irq_set_wake = exynos_wkup_irq_set_wake, 339 + .irq_request_resources = exynos_irq_request_resources, 340 + .irq_release_resources = exynos_irq_release_resources, 394 341 }, 395 342 .eint_con = EXYNOS_WKUP_ECON_OFFSET, 396 343 .eint_mask = EXYNOS_WKUP_EMASK_OFFSET,
+1
drivers/pinctrl/samsung/pinctrl-samsung.h
··· 26 26 #include <linux/gpio.h> 27 27 28 28 /* pinmux function number for pin as gpio output line */ 29 + #define FUNC_INPUT 0x0 29 30 #define FUNC_OUTPUT 0x1 30 31 31 32 /**
+4 -4
drivers/pinctrl/sh-pfc/pfc-r8a7791.c
··· 4509 4509 }; 4510 4510 4511 4511 static const char * const can0_groups[] = { 4512 - "can0_data_a", 4512 + "can0_data", 4513 4513 "can0_data_b", 4514 4514 "can0_data_c", 4515 4515 "can0_data_d", 4516 4516 "can0_data_e", 4517 4517 "can0_data_f", 4518 - "can_clk_a", 4518 + "can_clk", 4519 4519 "can_clk_b", 4520 4520 "can_clk_c", 4521 4521 "can_clk_d", 4522 4522 }; 4523 4523 4524 4524 static const char * const can1_groups[] = { 4525 - "can1_data_a", 4525 + "can1_data", 4526 4526 "can1_data_b", 4527 4527 "can1_data_c", 4528 4528 "can1_data_d", 4529 - "can_clk_a", 4529 + "can_clk", 4530 4530 "can_clk_b", 4531 4531 "can_clk_c", 4532 4532 "can_clk_d",