aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2016-04-05 10:45:29 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2016-04-05 10:45:29 -0400
commit1b5caa3eaa5f98a0d29ac46c7b545091520c5b26 (patch)
treee5c979d94d72204d4ca240b73860669d91b77147
parent62d2def9a5143ba5c8cd009e7f07e5dfa79830d2 (diff)
parente1641c9d174ee21b4a75a64ab6df9063cf60ac4a (diff)
Merge tag 'pinctrl-v4.6-2' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-pinctrl
Pull pin control fixes from Linus Walleij: "Here is a set of pin control fixes for the v4.6 series. A bit bigger than what I hoped for, but all fixes are confined to drivers, a few of them also targeted to stable. Summary: - On Super-H PFC (Renesas) controllers: only use dummies on legacy systems. This fixes a serious ethernet regression on a Renesas board. - Pistachio: Fix errors in the pin table. - Allwinner SunXi: fix the external interrupts to work. - Intel: fix so the high level interrupts start working, and fix a spurious interrupt issue. - Qualcomm ipq4019: fix the number of GPIOs provided (bump to 100), correct register offsets and handle GPIO mode properly. - Revert the revert on the revert so that Xway has a .to_irq() callback again. - Minor fixes to errorpaths and debug info. - A MAINTAINERS update" * tag 'pinctrl-v4.6-2' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-pinctrl: Revert "Revert "pinctrl: lantiq: Implement gpio_chip.to_irq"" pinctrl: qcom: ipq4019: fix register offsets pinctrl: qcom: ipq4019: fix the function enum for gpio mode pinctrl: qcom: ipq4019: set ngpios to correct value pinctrl: nomadik: fix pull debug print inversion MAINTAINERS: pinctrl: samsung: Add two new maintainers pinctrl: intel: implement gpio_irq_enable pinctrl: intel: make the high level interrupt working pinctrl: freescale: imx: fix bogus check of of_iomap() return value pinctrl: sunxi: Fix A33 external interrupts not working pinctrl: pistachio: fix mfio84-89 function description and pinmux. pinctrl: sh-pfc: only use dummy states for non-DT platforms
-rw-r--r--Documentation/devicetree/bindings/pinctrl/img,pistachio-pinctrl.txt12
-rw-r--r--MAINTAINERS2
-rw-r--r--drivers/pinctrl/freescale/pinctrl-imx.c17
-rw-r--r--drivers/pinctrl/intel/pinctrl-intel.c35
-rw-r--r--drivers/pinctrl/nomadik/pinctrl-nomadik.c2
-rw-r--r--drivers/pinctrl/pinctrl-pistachio.c24
-rw-r--r--drivers/pinctrl/pinctrl-xway.c17
-rw-r--r--drivers/pinctrl/qcom/pinctrl-ipq4019.c14
-rw-r--r--drivers/pinctrl/sh-pfc/core.c4
-rw-r--r--drivers/pinctrl/sunxi/pinctrl-sun8i-a33.c1
-rw-r--r--drivers/pinctrl/sunxi/pinctrl-sunxi.c17
-rw-r--r--drivers/pinctrl/sunxi/pinctrl-sunxi.h21
12 files changed, 111 insertions, 55 deletions
diff --git a/Documentation/devicetree/bindings/pinctrl/img,pistachio-pinctrl.txt b/Documentation/devicetree/bindings/pinctrl/img,pistachio-pinctrl.txt
index 08a4a32c8eb0..0326154c7925 100644
--- a/Documentation/devicetree/bindings/pinctrl/img,pistachio-pinctrl.txt
+++ b/Documentation/devicetree/bindings/pinctrl/img,pistachio-pinctrl.txt
@@ -134,12 +134,12 @@ mfio80 ddr_debug, mips_trace_data, mips_debug
134mfio81 dreq0, mips_trace_data, eth_debug 134mfio81 dreq0, mips_trace_data, eth_debug
135mfio82 dreq1, mips_trace_data, eth_debug 135mfio82 dreq1, mips_trace_data, eth_debug
136mfio83 mips_pll_lock, mips_trace_data, usb_debug 136mfio83 mips_pll_lock, mips_trace_data, usb_debug
137mfio84 sys_pll_lock, mips_trace_data, usb_debug 137mfio84 audio_pll_lock, mips_trace_data, usb_debug
138mfio85 wifi_pll_lock, mips_trace_data, sdhost_debug 138mfio85 rpu_v_pll_lock, mips_trace_data, sdhost_debug
139mfio86 bt_pll_lock, mips_trace_data, sdhost_debug 139mfio86 rpu_l_pll_lock, mips_trace_data, sdhost_debug
140mfio87 rpu_v_pll_lock, dreq2, socif_debug 140mfio87 sys_pll_lock, dreq2, socif_debug
141mfio88 rpu_l_pll_lock, dreq3, socif_debug 141mfio88 wifi_pll_lock, dreq3, socif_debug
142mfio89 audio_pll_lock, dreq4, dreq5 142mfio89 bt_pll_lock, dreq4, dreq5
143tck 143tck
144trstn 144trstn
145tdi 145tdi
diff --git a/MAINTAINERS b/MAINTAINERS
index 2ec50793c3ba..40eb1dbe2ae5 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -8712,6 +8712,8 @@ F: drivers/pinctrl/sh-pfc/
8712 8712
8713PIN CONTROLLER - SAMSUNG 8713PIN CONTROLLER - SAMSUNG
8714M: Tomasz Figa <tomasz.figa@gmail.com> 8714M: Tomasz Figa <tomasz.figa@gmail.com>
8715M: Krzysztof Kozlowski <k.kozlowski@samsung.com>
8716M: Sylwester Nawrocki <s.nawrocki@samsung.com>
8715L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) 8717L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
8716L: linux-samsung-soc@vger.kernel.org (moderated for non-subscribers) 8718L: linux-samsung-soc@vger.kernel.org (moderated for non-subscribers)
8717S: Maintained 8719S: Maintained
diff --git a/drivers/pinctrl/freescale/pinctrl-imx.c b/drivers/pinctrl/freescale/pinctrl-imx.c
index 46210512d8ec..9cfa544072b5 100644
--- a/drivers/pinctrl/freescale/pinctrl-imx.c
+++ b/drivers/pinctrl/freescale/pinctrl-imx.c
@@ -762,19 +762,18 @@ int imx_pinctrl_probe(struct platform_device *pdev,
762 762
763 if (of_property_read_bool(dev_np, "fsl,input-sel")) { 763 if (of_property_read_bool(dev_np, "fsl,input-sel")) {
764 np = of_parse_phandle(dev_np, "fsl,input-sel", 0); 764 np = of_parse_phandle(dev_np, "fsl,input-sel", 0);
765 if (np) { 765 if (!np) {
766 ipctl->input_sel_base = of_iomap(np, 0);
767 if (IS_ERR(ipctl->input_sel_base)) {
768 of_node_put(np);
769 dev_err(&pdev->dev,
770 "iomuxc input select base address not found\n");
771 return PTR_ERR(ipctl->input_sel_base);
772 }
773 } else {
774 dev_err(&pdev->dev, "iomuxc fsl,input-sel property not found\n"); 766 dev_err(&pdev->dev, "iomuxc fsl,input-sel property not found\n");
775 return -EINVAL; 767 return -EINVAL;
776 } 768 }
769
770 ipctl->input_sel_base = of_iomap(np, 0);
777 of_node_put(np); 771 of_node_put(np);
772 if (!ipctl->input_sel_base) {
773 dev_err(&pdev->dev,
774 "iomuxc input select base address not found\n");
775 return -ENOMEM;
776 }
778 } 777 }
779 778
780 imx_pinctrl_desc.name = dev_name(&pdev->dev); 779 imx_pinctrl_desc.name = dev_name(&pdev->dev);
diff --git a/drivers/pinctrl/intel/pinctrl-intel.c b/drivers/pinctrl/intel/pinctrl-intel.c
index 85536b467c25..6c2c816f8e5f 100644
--- a/drivers/pinctrl/intel/pinctrl-intel.c
+++ b/drivers/pinctrl/intel/pinctrl-intel.c
@@ -665,6 +665,35 @@ static void intel_gpio_irq_ack(struct irq_data *d)
665 spin_unlock(&pctrl->lock); 665 spin_unlock(&pctrl->lock);
666} 666}
667 667
668static void intel_gpio_irq_enable(struct irq_data *d)
669{
670 struct gpio_chip *gc = irq_data_get_irq_chip_data(d);
671 struct intel_pinctrl *pctrl = gpiochip_get_data(gc);
672 const struct intel_community *community;
673 unsigned pin = irqd_to_hwirq(d);
674 unsigned long flags;
675
676 spin_lock_irqsave(&pctrl->lock, flags);
677
678 community = intel_get_community(pctrl, pin);
679 if (community) {
680 unsigned padno = pin_to_padno(community, pin);
681 unsigned gpp_size = community->gpp_size;
682 unsigned gpp_offset = padno % gpp_size;
683 unsigned gpp = padno / gpp_size;
684 u32 value;
685
686 /* Clear interrupt status first to avoid unexpected interrupt */
687 writel(BIT(gpp_offset), community->regs + GPI_IS + gpp * 4);
688
689 value = readl(community->regs + community->ie_offset + gpp * 4);
690 value |= BIT(gpp_offset);
691 writel(value, community->regs + community->ie_offset + gpp * 4);
692 }
693
694 spin_unlock_irqrestore(&pctrl->lock, flags);
695}
696
668static void intel_gpio_irq_mask_unmask(struct irq_data *d, bool mask) 697static void intel_gpio_irq_mask_unmask(struct irq_data *d, bool mask)
669{ 698{
670 struct gpio_chip *gc = irq_data_get_irq_chip_data(d); 699 struct gpio_chip *gc = irq_data_get_irq_chip_data(d);
@@ -741,8 +770,9 @@ static int intel_gpio_irq_type(struct irq_data *d, unsigned type)
741 value |= PADCFG0_RXINV; 770 value |= PADCFG0_RXINV;
742 } else if (type & IRQ_TYPE_EDGE_RISING) { 771 } else if (type & IRQ_TYPE_EDGE_RISING) {
743 value |= PADCFG0_RXEVCFG_EDGE << PADCFG0_RXEVCFG_SHIFT; 772 value |= PADCFG0_RXEVCFG_EDGE << PADCFG0_RXEVCFG_SHIFT;
744 } else if (type & IRQ_TYPE_LEVEL_LOW) { 773 } else if (type & IRQ_TYPE_LEVEL_MASK) {
745 value |= PADCFG0_RXINV; 774 if (type & IRQ_TYPE_LEVEL_LOW)
775 value |= PADCFG0_RXINV;
746 } else { 776 } else {
747 value |= PADCFG0_RXEVCFG_DISABLED << PADCFG0_RXEVCFG_SHIFT; 777 value |= PADCFG0_RXEVCFG_DISABLED << PADCFG0_RXEVCFG_SHIFT;
748 } 778 }
@@ -852,6 +882,7 @@ static irqreturn_t intel_gpio_irq(int irq, void *data)
852 882
853static struct irq_chip intel_gpio_irqchip = { 883static struct irq_chip intel_gpio_irqchip = {
854 .name = "intel-gpio", 884 .name = "intel-gpio",
885 .irq_enable = intel_gpio_irq_enable,
855 .irq_ack = intel_gpio_irq_ack, 886 .irq_ack = intel_gpio_irq_ack,
856 .irq_mask = intel_gpio_irq_mask, 887 .irq_mask = intel_gpio_irq_mask,
857 .irq_unmask = intel_gpio_irq_unmask, 888 .irq_unmask = intel_gpio_irq_unmask,
diff --git a/drivers/pinctrl/nomadik/pinctrl-nomadik.c b/drivers/pinctrl/nomadik/pinctrl-nomadik.c
index 352406108fa0..c8969dd49449 100644
--- a/drivers/pinctrl/nomadik/pinctrl-nomadik.c
+++ b/drivers/pinctrl/nomadik/pinctrl-nomadik.c
@@ -990,7 +990,7 @@ static void nmk_gpio_dbg_show_one(struct seq_file *s,
990 int val; 990 int val;
991 991
992 if (pull) 992 if (pull)
993 pullidx = data_out ? 1 : 2; 993 pullidx = data_out ? 2 : 1;
994 994
995 seq_printf(s, " gpio-%-3d (%-20.20s) in %s %s", 995 seq_printf(s, " gpio-%-3d (%-20.20s) in %s %s",
996 gpio, 996 gpio,
diff --git a/drivers/pinctrl/pinctrl-pistachio.c b/drivers/pinctrl/pinctrl-pistachio.c
index 856f736cb1a6..2673cd9d106e 100644
--- a/drivers/pinctrl/pinctrl-pistachio.c
+++ b/drivers/pinctrl/pinctrl-pistachio.c
@@ -469,27 +469,27 @@ static const char * const pistachio_mips_pll_lock_groups[] = {
469 "mfio83", 469 "mfio83",
470}; 470};
471 471
472static const char * const pistachio_sys_pll_lock_groups[] = { 472static const char * const pistachio_audio_pll_lock_groups[] = {
473 "mfio84", 473 "mfio84",
474}; 474};
475 475
476static const char * const pistachio_wifi_pll_lock_groups[] = { 476static const char * const pistachio_rpu_v_pll_lock_groups[] = {
477 "mfio85", 477 "mfio85",
478}; 478};
479 479
480static const char * const pistachio_bt_pll_lock_groups[] = { 480static const char * const pistachio_rpu_l_pll_lock_groups[] = {
481 "mfio86", 481 "mfio86",
482}; 482};
483 483
484static const char * const pistachio_rpu_v_pll_lock_groups[] = { 484static const char * const pistachio_sys_pll_lock_groups[] = {
485 "mfio87", 485 "mfio87",
486}; 486};
487 487
488static const char * const pistachio_rpu_l_pll_lock_groups[] = { 488static const char * const pistachio_wifi_pll_lock_groups[] = {
489 "mfio88", 489 "mfio88",
490}; 490};
491 491
492static const char * const pistachio_audio_pll_lock_groups[] = { 492static const char * const pistachio_bt_pll_lock_groups[] = {
493 "mfio89", 493 "mfio89",
494}; 494};
495 495
@@ -559,12 +559,12 @@ enum pistachio_mux_option {
559 PISTACHIO_FUNCTION_DREQ4, 559 PISTACHIO_FUNCTION_DREQ4,
560 PISTACHIO_FUNCTION_DREQ5, 560 PISTACHIO_FUNCTION_DREQ5,
561 PISTACHIO_FUNCTION_MIPS_PLL_LOCK, 561 PISTACHIO_FUNCTION_MIPS_PLL_LOCK,
562 PISTACHIO_FUNCTION_AUDIO_PLL_LOCK,
563 PISTACHIO_FUNCTION_RPU_V_PLL_LOCK,
564 PISTACHIO_FUNCTION_RPU_L_PLL_LOCK,
562 PISTACHIO_FUNCTION_SYS_PLL_LOCK, 565 PISTACHIO_FUNCTION_SYS_PLL_LOCK,
563 PISTACHIO_FUNCTION_WIFI_PLL_LOCK, 566 PISTACHIO_FUNCTION_WIFI_PLL_LOCK,
564 PISTACHIO_FUNCTION_BT_PLL_LOCK, 567 PISTACHIO_FUNCTION_BT_PLL_LOCK,
565 PISTACHIO_FUNCTION_RPU_V_PLL_LOCK,
566 PISTACHIO_FUNCTION_RPU_L_PLL_LOCK,
567 PISTACHIO_FUNCTION_AUDIO_PLL_LOCK,
568 PISTACHIO_FUNCTION_DEBUG_RAW_CCA_IND, 568 PISTACHIO_FUNCTION_DEBUG_RAW_CCA_IND,
569 PISTACHIO_FUNCTION_DEBUG_ED_SEC20_CCA_IND, 569 PISTACHIO_FUNCTION_DEBUG_ED_SEC20_CCA_IND,
570 PISTACHIO_FUNCTION_DEBUG_ED_SEC40_CCA_IND, 570 PISTACHIO_FUNCTION_DEBUG_ED_SEC40_CCA_IND,
@@ -620,12 +620,12 @@ static const struct pistachio_function pistachio_functions[] = {
620 FUNCTION(dreq4), 620 FUNCTION(dreq4),
621 FUNCTION(dreq5), 621 FUNCTION(dreq5),
622 FUNCTION(mips_pll_lock), 622 FUNCTION(mips_pll_lock),
623 FUNCTION(audio_pll_lock),
624 FUNCTION(rpu_v_pll_lock),
625 FUNCTION(rpu_l_pll_lock),
623 FUNCTION(sys_pll_lock), 626 FUNCTION(sys_pll_lock),
624 FUNCTION(wifi_pll_lock), 627 FUNCTION(wifi_pll_lock),
625 FUNCTION(bt_pll_lock), 628 FUNCTION(bt_pll_lock),
626 FUNCTION(rpu_v_pll_lock),
627 FUNCTION(rpu_l_pll_lock),
628 FUNCTION(audio_pll_lock),
629 FUNCTION(debug_raw_cca_ind), 629 FUNCTION(debug_raw_cca_ind),
630 FUNCTION(debug_ed_sec20_cca_ind), 630 FUNCTION(debug_ed_sec20_cca_ind),
631 FUNCTION(debug_ed_sec40_cca_ind), 631 FUNCTION(debug_ed_sec40_cca_ind),
diff --git a/drivers/pinctrl/pinctrl-xway.c b/drivers/pinctrl/pinctrl-xway.c
index 412c6b78140a..a13f2b6f6fc0 100644
--- a/drivers/pinctrl/pinctrl-xway.c
+++ b/drivers/pinctrl/pinctrl-xway.c
@@ -1573,6 +1573,22 @@ static int xway_gpio_dir_out(struct gpio_chip *chip, unsigned int pin, int val)
1573 return 0; 1573 return 0;
1574} 1574}
1575 1575
1576/*
1577 * gpiolib gpiod_to_irq callback function.
1578 * Returns the mapped IRQ (external interrupt) number for a given GPIO pin.
1579 */
1580static int xway_gpio_to_irq(struct gpio_chip *chip, unsigned offset)
1581{
1582 struct ltq_pinmux_info *info = dev_get_drvdata(chip->parent);
1583 int i;
1584
1585 for (i = 0; i < info->num_exin; i++)
1586 if (info->exin[i] == offset)
1587 return ltq_eiu_get_irq(i);
1588
1589 return -1;
1590}
1591
1576static struct gpio_chip xway_chip = { 1592static struct gpio_chip xway_chip = {
1577 .label = "gpio-xway", 1593 .label = "gpio-xway",
1578 .direction_input = xway_gpio_dir_in, 1594 .direction_input = xway_gpio_dir_in,
@@ -1581,6 +1597,7 @@ static struct gpio_chip xway_chip = {
1581 .set = xway_gpio_set, 1597 .set = xway_gpio_set,
1582 .request = gpiochip_generic_request, 1598 .request = gpiochip_generic_request,
1583 .free = gpiochip_generic_free, 1599 .free = gpiochip_generic_free,
1600 .to_irq = xway_gpio_to_irq,
1584 .base = -1, 1601 .base = -1,
1585}; 1602};
1586 1603
diff --git a/drivers/pinctrl/qcom/pinctrl-ipq4019.c b/drivers/pinctrl/qcom/pinctrl-ipq4019.c
index b5d81ced6ce6..b68ae424cee2 100644
--- a/drivers/pinctrl/qcom/pinctrl-ipq4019.c
+++ b/drivers/pinctrl/qcom/pinctrl-ipq4019.c
@@ -237,7 +237,7 @@ DECLARE_QCA_GPIO_PINS(99);
237 .pins = gpio##id##_pins, \ 237 .pins = gpio##id##_pins, \
238 .npins = (unsigned)ARRAY_SIZE(gpio##id##_pins), \ 238 .npins = (unsigned)ARRAY_SIZE(gpio##id##_pins), \
239 .funcs = (int[]){ \ 239 .funcs = (int[]){ \
240 qca_mux_NA, /* gpio mode */ \ 240 qca_mux_gpio, /* gpio mode */ \
241 qca_mux_##f1, \ 241 qca_mux_##f1, \
242 qca_mux_##f2, \ 242 qca_mux_##f2, \
243 qca_mux_##f3, \ 243 qca_mux_##f3, \
@@ -254,11 +254,11 @@ DECLARE_QCA_GPIO_PINS(99);
254 qca_mux_##f14 \ 254 qca_mux_##f14 \
255 }, \ 255 }, \
256 .nfuncs = 15, \ 256 .nfuncs = 15, \
257 .ctl_reg = 0x1000 + 0x10 * id, \ 257 .ctl_reg = 0x0 + 0x1000 * id, \
258 .io_reg = 0x1004 + 0x10 * id, \ 258 .io_reg = 0x4 + 0x1000 * id, \
259 .intr_cfg_reg = 0x1008 + 0x10 * id, \ 259 .intr_cfg_reg = 0x8 + 0x1000 * id, \
260 .intr_status_reg = 0x100c + 0x10 * id, \ 260 .intr_status_reg = 0xc + 0x1000 * id, \
261 .intr_target_reg = 0x400 + 0x4 * id, \ 261 .intr_target_reg = 0x8 + 0x1000 * id, \
262 .mux_bit = 2, \ 262 .mux_bit = 2, \
263 .pull_bit = 0, \ 263 .pull_bit = 0, \
264 .drv_bit = 6, \ 264 .drv_bit = 6, \
@@ -414,7 +414,7 @@ static const struct msm_pinctrl_soc_data ipq4019_pinctrl = {
414 .nfunctions = ARRAY_SIZE(ipq4019_functions), 414 .nfunctions = ARRAY_SIZE(ipq4019_functions),
415 .groups = ipq4019_groups, 415 .groups = ipq4019_groups,
416 .ngroups = ARRAY_SIZE(ipq4019_groups), 416 .ngroups = ARRAY_SIZE(ipq4019_groups),
417 .ngpios = 70, 417 .ngpios = 100,
418}; 418};
419 419
420static int ipq4019_pinctrl_probe(struct platform_device *pdev) 420static int ipq4019_pinctrl_probe(struct platform_device *pdev)
diff --git a/drivers/pinctrl/sh-pfc/core.c b/drivers/pinctrl/sh-pfc/core.c
index dc3609f0c60b..ee0c1f2567d9 100644
--- a/drivers/pinctrl/sh-pfc/core.c
+++ b/drivers/pinctrl/sh-pfc/core.c
@@ -546,7 +546,9 @@ static int sh_pfc_probe(struct platform_device *pdev)
546 return ret; 546 return ret;
547 } 547 }
548 548
549 pinctrl_provide_dummies(); 549 /* Enable dummy states for those platforms without pinctrl support */
550 if (!of_have_populated_dt())
551 pinctrl_provide_dummies();
550 552
551 ret = sh_pfc_init_ranges(pfc); 553 ret = sh_pfc_init_ranges(pfc);
552 if (ret < 0) 554 if (ret < 0)
diff --git a/drivers/pinctrl/sunxi/pinctrl-sun8i-a33.c b/drivers/pinctrl/sunxi/pinctrl-sun8i-a33.c
index 00265f0435a7..8b381d69df86 100644
--- a/drivers/pinctrl/sunxi/pinctrl-sun8i-a33.c
+++ b/drivers/pinctrl/sunxi/pinctrl-sun8i-a33.c
@@ -485,6 +485,7 @@ static const struct sunxi_pinctrl_desc sun8i_a33_pinctrl_data = {
485 .pins = sun8i_a33_pins, 485 .pins = sun8i_a33_pins,
486 .npins = ARRAY_SIZE(sun8i_a33_pins), 486 .npins = ARRAY_SIZE(sun8i_a33_pins),
487 .irq_banks = 2, 487 .irq_banks = 2,
488 .irq_bank_base = 1,
488}; 489};
489 490
490static int sun8i_a33_pinctrl_probe(struct platform_device *pdev) 491static int sun8i_a33_pinctrl_probe(struct platform_device *pdev)
diff --git a/drivers/pinctrl/sunxi/pinctrl-sunxi.c b/drivers/pinctrl/sunxi/pinctrl-sunxi.c
index 12a1dfabb1af..3b017dbd289c 100644
--- a/drivers/pinctrl/sunxi/pinctrl-sunxi.c
+++ b/drivers/pinctrl/sunxi/pinctrl-sunxi.c
@@ -579,7 +579,7 @@ static void sunxi_pinctrl_irq_release_resources(struct irq_data *d)
579static int sunxi_pinctrl_irq_set_type(struct irq_data *d, unsigned int type) 579static int sunxi_pinctrl_irq_set_type(struct irq_data *d, unsigned int type)
580{ 580{
581 struct sunxi_pinctrl *pctl = irq_data_get_irq_chip_data(d); 581 struct sunxi_pinctrl *pctl = irq_data_get_irq_chip_data(d);
582 u32 reg = sunxi_irq_cfg_reg(d->hwirq); 582 u32 reg = sunxi_irq_cfg_reg(d->hwirq, pctl->desc->irq_bank_base);
583 u8 index = sunxi_irq_cfg_offset(d->hwirq); 583 u8 index = sunxi_irq_cfg_offset(d->hwirq);
584 unsigned long flags; 584 unsigned long flags;
585 u32 regval; 585 u32 regval;
@@ -626,7 +626,8 @@ static int sunxi_pinctrl_irq_set_type(struct irq_data *d, unsigned int type)
626static void sunxi_pinctrl_irq_ack(struct irq_data *d) 626static void sunxi_pinctrl_irq_ack(struct irq_data *d)
627{ 627{
628 struct sunxi_pinctrl *pctl = irq_data_get_irq_chip_data(d); 628 struct sunxi_pinctrl *pctl = irq_data_get_irq_chip_data(d);
629 u32 status_reg = sunxi_irq_status_reg(d->hwirq); 629 u32 status_reg = sunxi_irq_status_reg(d->hwirq,
630 pctl->desc->irq_bank_base);
630 u8 status_idx = sunxi_irq_status_offset(d->hwirq); 631 u8 status_idx = sunxi_irq_status_offset(d->hwirq);
631 632
632 /* Clear the IRQ */ 633 /* Clear the IRQ */
@@ -636,7 +637,7 @@ static void sunxi_pinctrl_irq_ack(struct irq_data *d)
636static void sunxi_pinctrl_irq_mask(struct irq_data *d) 637static void sunxi_pinctrl_irq_mask(struct irq_data *d)
637{ 638{
638 struct sunxi_pinctrl *pctl = irq_data_get_irq_chip_data(d); 639 struct sunxi_pinctrl *pctl = irq_data_get_irq_chip_data(d);
639 u32 reg = sunxi_irq_ctrl_reg(d->hwirq); 640 u32 reg = sunxi_irq_ctrl_reg(d->hwirq, pctl->desc->irq_bank_base);
640 u8 idx = sunxi_irq_ctrl_offset(d->hwirq); 641 u8 idx = sunxi_irq_ctrl_offset(d->hwirq);
641 unsigned long flags; 642 unsigned long flags;
642 u32 val; 643 u32 val;
@@ -653,7 +654,7 @@ static void sunxi_pinctrl_irq_mask(struct irq_data *d)
653static void sunxi_pinctrl_irq_unmask(struct irq_data *d) 654static void sunxi_pinctrl_irq_unmask(struct irq_data *d)
654{ 655{
655 struct sunxi_pinctrl *pctl = irq_data_get_irq_chip_data(d); 656 struct sunxi_pinctrl *pctl = irq_data_get_irq_chip_data(d);
656 u32 reg = sunxi_irq_ctrl_reg(d->hwirq); 657 u32 reg = sunxi_irq_ctrl_reg(d->hwirq, pctl->desc->irq_bank_base);
657 u8 idx = sunxi_irq_ctrl_offset(d->hwirq); 658 u8 idx = sunxi_irq_ctrl_offset(d->hwirq);
658 unsigned long flags; 659 unsigned long flags;
659 u32 val; 660 u32 val;
@@ -745,7 +746,7 @@ static void sunxi_pinctrl_irq_handler(struct irq_desc *desc)
745 if (bank == pctl->desc->irq_banks) 746 if (bank == pctl->desc->irq_banks)
746 return; 747 return;
747 748
748 reg = sunxi_irq_status_reg_from_bank(bank); 749 reg = sunxi_irq_status_reg_from_bank(bank, pctl->desc->irq_bank_base);
749 val = readl(pctl->membase + reg); 750 val = readl(pctl->membase + reg);
750 751
751 if (val) { 752 if (val) {
@@ -1024,9 +1025,11 @@ int sunxi_pinctrl_init(struct platform_device *pdev,
1024 1025
1025 for (i = 0; i < pctl->desc->irq_banks; i++) { 1026 for (i = 0; i < pctl->desc->irq_banks; i++) {
1026 /* Mask and clear all IRQs before registering a handler */ 1027 /* Mask and clear all IRQs before registering a handler */
1027 writel(0, pctl->membase + sunxi_irq_ctrl_reg_from_bank(i)); 1028 writel(0, pctl->membase + sunxi_irq_ctrl_reg_from_bank(i,
1029 pctl->desc->irq_bank_base));
1028 writel(0xffffffff, 1030 writel(0xffffffff,
1029 pctl->membase + sunxi_irq_status_reg_from_bank(i)); 1031 pctl->membase + sunxi_irq_status_reg_from_bank(i,
1032 pctl->desc->irq_bank_base));
1030 1033
1031 irq_set_chained_handler_and_data(pctl->irq[i], 1034 irq_set_chained_handler_and_data(pctl->irq[i],
1032 sunxi_pinctrl_irq_handler, 1035 sunxi_pinctrl_irq_handler,
diff --git a/drivers/pinctrl/sunxi/pinctrl-sunxi.h b/drivers/pinctrl/sunxi/pinctrl-sunxi.h
index e248e81a0f9e..0afce1ab12d0 100644
--- a/drivers/pinctrl/sunxi/pinctrl-sunxi.h
+++ b/drivers/pinctrl/sunxi/pinctrl-sunxi.h
@@ -97,6 +97,7 @@ struct sunxi_pinctrl_desc {
97 int npins; 97 int npins;
98 unsigned pin_base; 98 unsigned pin_base;
99 unsigned irq_banks; 99 unsigned irq_banks;
100 unsigned irq_bank_base;
100 bool irq_read_needs_mux; 101 bool irq_read_needs_mux;
101}; 102};
102 103
@@ -233,12 +234,12 @@ static inline u32 sunxi_pull_offset(u16 pin)
233 return pin_num * PULL_PINS_BITS; 234 return pin_num * PULL_PINS_BITS;
234} 235}
235 236
236static inline u32 sunxi_irq_cfg_reg(u16 irq) 237static inline u32 sunxi_irq_cfg_reg(u16 irq, unsigned bank_base)
237{ 238{
238 u8 bank = irq / IRQ_PER_BANK; 239 u8 bank = irq / IRQ_PER_BANK;
239 u8 reg = (irq % IRQ_PER_BANK) / IRQ_CFG_IRQ_PER_REG * 0x04; 240 u8 reg = (irq % IRQ_PER_BANK) / IRQ_CFG_IRQ_PER_REG * 0x04;
240 241
241 return IRQ_CFG_REG + bank * IRQ_MEM_SIZE + reg; 242 return IRQ_CFG_REG + (bank_base + bank) * IRQ_MEM_SIZE + reg;
242} 243}
243 244
244static inline u32 sunxi_irq_cfg_offset(u16 irq) 245static inline u32 sunxi_irq_cfg_offset(u16 irq)
@@ -247,16 +248,16 @@ static inline u32 sunxi_irq_cfg_offset(u16 irq)
247 return irq_num * IRQ_CFG_IRQ_BITS; 248 return irq_num * IRQ_CFG_IRQ_BITS;
248} 249}
249 250
250static inline u32 sunxi_irq_ctrl_reg_from_bank(u8 bank) 251static inline u32 sunxi_irq_ctrl_reg_from_bank(u8 bank, unsigned bank_base)
251{ 252{
252 return IRQ_CTRL_REG + bank * IRQ_MEM_SIZE; 253 return IRQ_CTRL_REG + (bank_base + bank) * IRQ_MEM_SIZE;
253} 254}
254 255
255static inline u32 sunxi_irq_ctrl_reg(u16 irq) 256static inline u32 sunxi_irq_ctrl_reg(u16 irq, unsigned bank_base)
256{ 257{
257 u8 bank = irq / IRQ_PER_BANK; 258 u8 bank = irq / IRQ_PER_BANK;
258 259
259 return sunxi_irq_ctrl_reg_from_bank(bank); 260 return sunxi_irq_ctrl_reg_from_bank(bank, bank_base);
260} 261}
261 262
262static inline u32 sunxi_irq_ctrl_offset(u16 irq) 263static inline u32 sunxi_irq_ctrl_offset(u16 irq)
@@ -265,16 +266,16 @@ static inline u32 sunxi_irq_ctrl_offset(u16 irq)
265 return irq_num * IRQ_CTRL_IRQ_BITS; 266 return irq_num * IRQ_CTRL_IRQ_BITS;
266} 267}
267 268
268static inline u32 sunxi_irq_status_reg_from_bank(u8 bank) 269static inline u32 sunxi_irq_status_reg_from_bank(u8 bank, unsigned bank_base)
269{ 270{
270 return IRQ_STATUS_REG + bank * IRQ_MEM_SIZE; 271 return IRQ_STATUS_REG + (bank_base + bank) * IRQ_MEM_SIZE;
271} 272}
272 273
273static inline u32 sunxi_irq_status_reg(u16 irq) 274static inline u32 sunxi_irq_status_reg(u16 irq, unsigned bank_base)
274{ 275{
275 u8 bank = irq / IRQ_PER_BANK; 276 u8 bank = irq / IRQ_PER_BANK;
276 277
277 return sunxi_irq_status_reg_from_bank(bank); 278 return sunxi_irq_status_reg_from_bank(bank, bank_base);
278} 279}
279 280
280static inline u32 sunxi_irq_status_offset(u16 irq) 281static inline u32 sunxi_irq_status_offset(u16 irq)