aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pinctrl
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/pinctrl')
-rw-r--r--drivers/pinctrl/nomadik/pinctrl-abx500.c3
-rw-r--r--drivers/pinctrl/pinctrl-at91.c4
-rw-r--r--drivers/pinctrl/pinctrl-baytrail.c1
-rw-r--r--drivers/pinctrl/pinctrl-rockchip.c15
-rw-r--r--drivers/pinctrl/pinctrl-tegra-xusb.c5
-rw-r--r--drivers/pinctrl/samsung/pinctrl-exynos.c69
-rw-r--r--drivers/pinctrl/samsung/pinctrl-samsung.h1
-rw-r--r--drivers/pinctrl/sh-pfc/pfc-r8a7791.c8
8 files changed, 84 insertions, 22 deletions
diff --git a/drivers/pinctrl/nomadik/pinctrl-abx500.c b/drivers/pinctrl/nomadik/pinctrl-abx500.c
index a53a689a2bfa..8c6fd8d4dd3c 100644
--- a/drivers/pinctrl/nomadik/pinctrl-abx500.c
+++ b/drivers/pinctrl/nomadik/pinctrl-abx500.c
@@ -620,8 +620,7 @@ static void abx500_gpio_dbg_show_one(struct seq_file *s,
620 } else 620 } else
621 seq_printf(s, " %-9s", chip->get(chip, offset) ? "hi" : "lo"); 621 seq_printf(s, " %-9s", chip->get(chip, offset) ? "hi" : "lo");
622 622
623 if (pctldev) 623 mode = abx500_get_mode(pctldev, chip, offset);
624 mode = abx500_get_mode(pctldev, chip, offset);
625 624
626 seq_printf(s, " %s", (mode < 0) ? "unknown" : modes[mode]); 625 seq_printf(s, " %s", (mode < 0) ? "unknown" : modes[mode]);
627 626
diff --git a/drivers/pinctrl/pinctrl-at91.c b/drivers/pinctrl/pinctrl-at91.c
index af1ba4fc150d..60464a2648aa 100644
--- a/drivers/pinctrl/pinctrl-at91.c
+++ b/drivers/pinctrl/pinctrl-at91.c
@@ -497,10 +497,10 @@ static struct at91_pinctrl_mux_ops at91sam9x5_ops = {
497static void at91_pin_dbg(const struct device *dev, const struct at91_pmx_pin *pin) 497static void at91_pin_dbg(const struct device *dev, const struct at91_pmx_pin *pin)
498{ 498{
499 if (pin->mux) { 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 pin->bank + 'A', pin->pin, pin->mux - 1 + 'A', pin->conf); 501 pin->bank + 'A', pin->pin, pin->mux - 1 + 'A', pin->conf);
502 } else { 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 pin->bank + 'A', pin->pin, pin->conf); 504 pin->bank + 'A', pin->pin, pin->conf);
505 } 505 }
506} 506}
diff --git a/drivers/pinctrl/pinctrl-baytrail.c b/drivers/pinctrl/pinctrl-baytrail.c
index 9ca59a018743..e12e5b07f6d7 100644
--- a/drivers/pinctrl/pinctrl-baytrail.c
+++ b/drivers/pinctrl/pinctrl-baytrail.c
@@ -461,6 +461,7 @@ static struct irq_chip byt_irqchip = {
461 .irq_mask = byt_irq_mask, 461 .irq_mask = byt_irq_mask,
462 .irq_unmask = byt_irq_unmask, 462 .irq_unmask = byt_irq_unmask,
463 .irq_set_type = byt_irq_type, 463 .irq_set_type = byt_irq_type,
464 .flags = IRQCHIP_SKIP_SET_WAKE,
464}; 465};
465 466
466static void byt_gpio_irq_init_hw(struct byt_gpio *vg) 467static void byt_gpio_irq_init_hw(struct byt_gpio *vg)
diff --git a/drivers/pinctrl/pinctrl-rockchip.c b/drivers/pinctrl/pinctrl-rockchip.c
index 5e8b2e04cd7a..0c372a300cb8 100644
--- a/drivers/pinctrl/pinctrl-rockchip.c
+++ b/drivers/pinctrl/pinctrl-rockchip.c
@@ -438,7 +438,7 @@ static int rockchip_set_mux(struct rockchip_pin_bank *bank, int pin, int mux)
438 int reg, ret, mask; 438 int reg, ret, mask;
439 unsigned long flags; 439 unsigned long flags;
440 u8 bit; 440 u8 bit;
441 u32 data; 441 u32 data, rmask;
442 442
443 if (iomux_num > 3) 443 if (iomux_num > 3)
444 return -EINVAL; 444 return -EINVAL;
@@ -478,8 +478,9 @@ static int rockchip_set_mux(struct rockchip_pin_bank *bank, int pin, int mux)
478 spin_lock_irqsave(&bank->slock, flags); 478 spin_lock_irqsave(&bank->slock, flags);
479 479
480 data = (mask << (bit + 16)); 480 data = (mask << (bit + 16));
481 rmask = data | (data >> 16);
481 data |= (mux & mask) << bit; 482 data |= (mux & mask) << bit;
482 ret = regmap_write(regmap, reg, data); 483 ret = regmap_update_bits(regmap, reg, rmask, data);
483 484
484 spin_unlock_irqrestore(&bank->slock, flags); 485 spin_unlock_irqrestore(&bank->slock, flags);
485 486
@@ -634,7 +635,7 @@ static int rk3288_set_drive(struct rockchip_pin_bank *bank, int pin_num,
634 struct regmap *regmap; 635 struct regmap *regmap;
635 unsigned long flags; 636 unsigned long flags;
636 int reg, ret, i; 637 int reg, ret, i;
637 u32 data; 638 u32 data, rmask;
638 u8 bit; 639 u8 bit;
639 640
640 rk3288_calc_drv_reg_and_bit(bank, pin_num, &regmap, &reg, &bit); 641 rk3288_calc_drv_reg_and_bit(bank, pin_num, &regmap, &reg, &bit);
@@ -657,9 +658,10 @@ static int rk3288_set_drive(struct rockchip_pin_bank *bank, int pin_num,
657 658
658 /* enable the write to the equivalent lower bits */ 659 /* enable the write to the equivalent lower bits */
659 data = ((1 << RK3288_DRV_BITS_PER_PIN) - 1) << (bit + 16); 660 data = ((1 << RK3288_DRV_BITS_PER_PIN) - 1) << (bit + 16);
661 rmask = data | (data >> 16);
660 data |= (ret << bit); 662 data |= (ret << bit);
661 663
662 ret = regmap_write(regmap, reg, data); 664 ret = regmap_update_bits(regmap, reg, rmask, data);
663 spin_unlock_irqrestore(&bank->slock, flags); 665 spin_unlock_irqrestore(&bank->slock, flags);
664 666
665 return ret; 667 return ret;
@@ -722,7 +724,7 @@ static int rockchip_set_pull(struct rockchip_pin_bank *bank,
722 int reg, ret; 724 int reg, ret;
723 unsigned long flags; 725 unsigned long flags;
724 u8 bit; 726 u8 bit;
725 u32 data; 727 u32 data, rmask;
726 728
727 dev_dbg(info->dev, "setting pull of GPIO%d-%d to %d\n", 729 dev_dbg(info->dev, "setting pull of GPIO%d-%d to %d\n",
728 bank->bank_num, pin_num, pull); 730 bank->bank_num, pin_num, pull);
@@ -750,6 +752,7 @@ static int rockchip_set_pull(struct rockchip_pin_bank *bank,
750 752
751 /* enable the write to the equivalent lower bits */ 753 /* enable the write to the equivalent lower bits */
752 data = ((1 << RK3188_PULL_BITS_PER_PIN) - 1) << (bit + 16); 754 data = ((1 << RK3188_PULL_BITS_PER_PIN) - 1) << (bit + 16);
755 rmask = data | (data >> 16);
753 756
754 switch (pull) { 757 switch (pull) {
755 case PIN_CONFIG_BIAS_DISABLE: 758 case PIN_CONFIG_BIAS_DISABLE:
@@ -770,7 +773,7 @@ static int rockchip_set_pull(struct rockchip_pin_bank *bank,
770 return -EINVAL; 773 return -EINVAL;
771 } 774 }
772 775
773 ret = regmap_write(regmap, reg, data); 776 ret = regmap_update_bits(regmap, reg, rmask, data);
774 777
775 spin_unlock_irqrestore(&bank->slock, flags); 778 spin_unlock_irqrestore(&bank->slock, flags);
776 break; 779 break;
diff --git a/drivers/pinctrl/pinctrl-tegra-xusb.c b/drivers/pinctrl/pinctrl-tegra-xusb.c
index a06620474845..e641b4226c42 100644
--- a/drivers/pinctrl/pinctrl-tegra-xusb.c
+++ b/drivers/pinctrl/pinctrl-tegra-xusb.c
@@ -680,7 +680,7 @@ static struct phy *tegra_xusb_padctl_xlate(struct device *dev,
680 if (args->args_count <= 0) 680 if (args->args_count <= 0)
681 return ERR_PTR(-EINVAL); 681 return ERR_PTR(-EINVAL);
682 682
683 if (index > ARRAY_SIZE(padctl->phys)) 683 if (index >= ARRAY_SIZE(padctl->phys))
684 return ERR_PTR(-EINVAL); 684 return ERR_PTR(-EINVAL);
685 685
686 return padctl->phys[index]; 686 return padctl->phys[index];
@@ -930,7 +930,8 @@ static int tegra_xusb_padctl_probe(struct platform_device *pdev)
930 930
931 padctl->provider = devm_of_phy_provider_register(&pdev->dev, 931 padctl->provider = devm_of_phy_provider_register(&pdev->dev,
932 tegra_xusb_padctl_xlate); 932 tegra_xusb_padctl_xlate);
933 if (err < 0) { 933 if (IS_ERR(padctl->provider)) {
934 err = PTR_ERR(padctl->provider);
934 dev_err(&pdev->dev, "failed to register PHYs: %d\n", err); 935 dev_err(&pdev->dev, "failed to register PHYs: %d\n", err);
935 goto unregister; 936 goto unregister;
936 } 937 }
diff --git a/drivers/pinctrl/samsung/pinctrl-exynos.c b/drivers/pinctrl/samsung/pinctrl-exynos.c
index 003bfd874a61..d7154ed0b0eb 100644
--- a/drivers/pinctrl/samsung/pinctrl-exynos.c
+++ b/drivers/pinctrl/samsung/pinctrl-exynos.c
@@ -127,14 +127,10 @@ static int exynos_irq_set_type(struct irq_data *irqd, unsigned int type)
127 struct irq_chip *chip = irq_data_get_irq_chip(irqd); 127 struct irq_chip *chip = irq_data_get_irq_chip(irqd);
128 struct exynos_irq_chip *our_chip = to_exynos_irq_chip(chip); 128 struct exynos_irq_chip *our_chip = to_exynos_irq_chip(chip);
129 struct samsung_pin_bank *bank = irq_data_get_irq_chip_data(irqd); 129 struct samsung_pin_bank *bank = irq_data_get_irq_chip_data(irqd);
130 struct samsung_pin_bank_type *bank_type = bank->type;
131 struct samsung_pinctrl_drv_data *d = bank->drvdata; 130 struct samsung_pinctrl_drv_data *d = bank->drvdata;
132 unsigned int pin = irqd->hwirq; 131 unsigned int shift = EXYNOS_EINT_CON_LEN * irqd->hwirq;
133 unsigned int shift = EXYNOS_EINT_CON_LEN * pin;
134 unsigned int con, trig_type; 132 unsigned int con, trig_type;
135 unsigned long reg_con = our_chip->eint_con + bank->eint_offset; 133 unsigned long reg_con = our_chip->eint_con + bank->eint_offset;
136 unsigned long flags;
137 unsigned int mask;
138 134
139 switch (type) { 135 switch (type) {
140 case IRQ_TYPE_EDGE_RISING: 136 case IRQ_TYPE_EDGE_RISING:
@@ -167,8 +163,32 @@ static int exynos_irq_set_type(struct irq_data *irqd, unsigned int type)
167 con |= trig_type << shift; 163 con |= trig_type << shift;
168 writel(con, d->virt_base + reg_con); 164 writel(con, d->virt_base + reg_con);
169 165
166 return 0;
167}
168
169static int exynos_irq_request_resources(struct irq_data *irqd)
170{
171 struct irq_chip *chip = irq_data_get_irq_chip(irqd);
172 struct exynos_irq_chip *our_chip = to_exynos_irq_chip(chip);
173 struct samsung_pin_bank *bank = irq_data_get_irq_chip_data(irqd);
174 struct samsung_pin_bank_type *bank_type = bank->type;
175 struct samsung_pinctrl_drv_data *d = bank->drvdata;
176 unsigned int shift = EXYNOS_EINT_CON_LEN * irqd->hwirq;
177 unsigned long reg_con = our_chip->eint_con + bank->eint_offset;
178 unsigned long flags;
179 unsigned int mask;
180 unsigned int con;
181 int ret;
182
183 ret = gpio_lock_as_irq(&bank->gpio_chip, irqd->hwirq);
184 if (ret) {
185 dev_err(bank->gpio_chip.dev, "unable to lock pin %s-%lu IRQ\n",
186 bank->name, irqd->hwirq);
187 return ret;
188 }
189
170 reg_con = bank->pctl_offset + bank_type->reg_offset[PINCFG_TYPE_FUNC]; 190 reg_con = bank->pctl_offset + bank_type->reg_offset[PINCFG_TYPE_FUNC];
171 shift = pin * bank_type->fld_width[PINCFG_TYPE_FUNC]; 191 shift = irqd->hwirq * bank_type->fld_width[PINCFG_TYPE_FUNC];
172 mask = (1 << bank_type->fld_width[PINCFG_TYPE_FUNC]) - 1; 192 mask = (1 << bank_type->fld_width[PINCFG_TYPE_FUNC]) - 1;
173 193
174 spin_lock_irqsave(&bank->slock, flags); 194 spin_lock_irqsave(&bank->slock, flags);
@@ -180,9 +200,42 @@ static int exynos_irq_set_type(struct irq_data *irqd, unsigned int type)
180 200
181 spin_unlock_irqrestore(&bank->slock, flags); 201 spin_unlock_irqrestore(&bank->slock, flags);
182 202
203 exynos_irq_unmask(irqd);
204
183 return 0; 205 return 0;
184} 206}
185 207
208static void exynos_irq_release_resources(struct irq_data *irqd)
209{
210 struct irq_chip *chip = irq_data_get_irq_chip(irqd);
211 struct exynos_irq_chip *our_chip = to_exynos_irq_chip(chip);
212 struct samsung_pin_bank *bank = irq_data_get_irq_chip_data(irqd);
213 struct samsung_pin_bank_type *bank_type = bank->type;
214 struct samsung_pinctrl_drv_data *d = bank->drvdata;
215 unsigned int shift = EXYNOS_EINT_CON_LEN * irqd->hwirq;
216 unsigned long reg_con = our_chip->eint_con + bank->eint_offset;
217 unsigned long flags;
218 unsigned int mask;
219 unsigned int con;
220
221 reg_con = bank->pctl_offset + bank_type->reg_offset[PINCFG_TYPE_FUNC];
222 shift = irqd->hwirq * bank_type->fld_width[PINCFG_TYPE_FUNC];
223 mask = (1 << bank_type->fld_width[PINCFG_TYPE_FUNC]) - 1;
224
225 exynos_irq_mask(irqd);
226
227 spin_lock_irqsave(&bank->slock, flags);
228
229 con = readl(d->virt_base + reg_con);
230 con &= ~(mask << shift);
231 con |= FUNC_INPUT << shift;
232 writel(con, d->virt_base + reg_con);
233
234 spin_unlock_irqrestore(&bank->slock, flags);
235
236 gpio_unlock_as_irq(&bank->gpio_chip, irqd->hwirq);
237}
238
186/* 239/*
187 * irq_chip for gpio interrupts. 240 * irq_chip for gpio interrupts.
188 */ 241 */
@@ -193,6 +246,8 @@ static struct exynos_irq_chip exynos_gpio_irq_chip = {
193 .irq_mask = exynos_irq_mask, 246 .irq_mask = exynos_irq_mask,
194 .irq_ack = exynos_irq_ack, 247 .irq_ack = exynos_irq_ack,
195 .irq_set_type = exynos_irq_set_type, 248 .irq_set_type = exynos_irq_set_type,
249 .irq_request_resources = exynos_irq_request_resources,
250 .irq_release_resources = exynos_irq_release_resources,
196 }, 251 },
197 .eint_con = EXYNOS_GPIO_ECON_OFFSET, 252 .eint_con = EXYNOS_GPIO_ECON_OFFSET,
198 .eint_mask = EXYNOS_GPIO_EMASK_OFFSET, 253 .eint_mask = EXYNOS_GPIO_EMASK_OFFSET,
@@ -336,6 +391,8 @@ static struct exynos_irq_chip exynos_wkup_irq_chip = {
336 .irq_ack = exynos_irq_ack, 391 .irq_ack = exynos_irq_ack,
337 .irq_set_type = exynos_irq_set_type, 392 .irq_set_type = exynos_irq_set_type,
338 .irq_set_wake = exynos_wkup_irq_set_wake, 393 .irq_set_wake = exynos_wkup_irq_set_wake,
394 .irq_request_resources = exynos_irq_request_resources,
395 .irq_release_resources = exynos_irq_release_resources,
339 }, 396 },
340 .eint_con = EXYNOS_WKUP_ECON_OFFSET, 397 .eint_con = EXYNOS_WKUP_ECON_OFFSET,
341 .eint_mask = EXYNOS_WKUP_EMASK_OFFSET, 398 .eint_mask = EXYNOS_WKUP_EMASK_OFFSET,
diff --git a/drivers/pinctrl/samsung/pinctrl-samsung.h b/drivers/pinctrl/samsung/pinctrl-samsung.h
index 2b882320e8e9..5cedc9d26390 100644
--- a/drivers/pinctrl/samsung/pinctrl-samsung.h
+++ b/drivers/pinctrl/samsung/pinctrl-samsung.h
@@ -26,6 +26,7 @@
26#include <linux/gpio.h> 26#include <linux/gpio.h>
27 27
28/* pinmux function number for pin as gpio output line */ 28/* pinmux function number for pin as gpio output line */
29#define FUNC_INPUT 0x0
29#define FUNC_OUTPUT 0x1 30#define FUNC_OUTPUT 0x1
30 31
31/** 32/**
diff --git a/drivers/pinctrl/sh-pfc/pfc-r8a7791.c b/drivers/pinctrl/sh-pfc/pfc-r8a7791.c
index 576d41b459e9..c6e5deba238e 100644
--- a/drivers/pinctrl/sh-pfc/pfc-r8a7791.c
+++ b/drivers/pinctrl/sh-pfc/pfc-r8a7791.c
@@ -4509,24 +4509,24 @@ static const char * const audio_clk_groups[] = {
4509}; 4509};
4510 4510
4511static const char * const can0_groups[] = { 4511static const char * const can0_groups[] = {
4512 "can0_data_a", 4512 "can0_data",
4513 "can0_data_b", 4513 "can0_data_b",
4514 "can0_data_c", 4514 "can0_data_c",
4515 "can0_data_d", 4515 "can0_data_d",
4516 "can0_data_e", 4516 "can0_data_e",
4517 "can0_data_f", 4517 "can0_data_f",
4518 "can_clk_a", 4518 "can_clk",
4519 "can_clk_b", 4519 "can_clk_b",
4520 "can_clk_c", 4520 "can_clk_c",
4521 "can_clk_d", 4521 "can_clk_d",
4522}; 4522};
4523 4523
4524static const char * const can1_groups[] = { 4524static const char * const can1_groups[] = {
4525 "can1_data_a", 4525 "can1_data",
4526 "can1_data_b", 4526 "can1_data_b",
4527 "can1_data_c", 4527 "can1_data_c",
4528 "can1_data_d", 4528 "can1_data_d",
4529 "can_clk_a", 4529 "can_clk",
4530 "can_clk_b", 4530 "can_clk_b",
4531 "can_clk_c", 4531 "can_clk_c",
4532 "can_clk_d", 4532 "can_clk_d",