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

pinctrl: sunxi: change irq_bank_base to irq_bank_map

The Allwinner H6 SoC have its pin controllers with the first IRQ-capable
GPIO bank at IRQ bank 1 and the second bank at IRQ bank 5.

Change the current code that uses IRQ bank base to a IRQ bank map, in
order to support the case that holes exist among IRQ banks.

Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
Acked-by: Maxime Ripard <maxime.ripard@bootlin.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>

authored by

Icenowy Zheng and committed by
Linus Walleij
35817d34 29dfc6bb

+11 -4
+3 -1
drivers/pinctrl/sunxi/pinctrl-sun8i-a33.c
··· 481 481 SUNXI_FUNCTION(0x3, "uart3")), /* CTS */ 482 482 }; 483 483 484 + static const unsigned int sun8i_a33_pinctrl_irq_bank_map[] = { 1, 2 }; 485 + 484 486 static const struct sunxi_pinctrl_desc sun8i_a33_pinctrl_data = { 485 487 .pins = sun8i_a33_pins, 486 488 .npins = ARRAY_SIZE(sun8i_a33_pins), 487 489 .irq_banks = 2, 488 - .irq_bank_base = 1, 490 + .irq_bank_map = sun8i_a33_pinctrl_irq_bank_map, 489 491 .disable_strict_mode = true, 490 492 }; 491 493
+3 -1
drivers/pinctrl/sunxi/pinctrl-sun8i-v3s.c
··· 293 293 SUNXI_FUNCTION_IRQ_BANK(0x6, 1, 5)), /* PG_EINT5 */ 294 294 }; 295 295 296 + static const unsigned int sun8i_v3s_pinctrl_irq_bank_map[] = { 1, 2 }; 297 + 296 298 static const struct sunxi_pinctrl_desc sun8i_v3s_pinctrl_data = { 297 299 .pins = sun8i_v3s_pins, 298 300 .npins = ARRAY_SIZE(sun8i_v3s_pins), 299 301 .irq_banks = 2, 300 - .irq_bank_base = 1, 302 + .irq_bank_map = sun8i_v3s_pinctrl_irq_bank_map, 301 303 .irq_read_needs_mux = true 302 304 }; 303 305
+5 -2
drivers/pinctrl/sunxi/pinctrl-sunxi.h
··· 110 110 int npins; 111 111 unsigned pin_base; 112 112 unsigned irq_banks; 113 - unsigned irq_bank_base; 113 + const unsigned int *irq_bank_map; 114 114 bool irq_read_needs_mux; 115 115 bool disable_strict_mode; 116 116 }; ··· 265 265 266 266 static inline u32 sunxi_irq_hw_bank_num(const struct sunxi_pinctrl_desc *desc, u8 bank) 267 267 { 268 - return desc->irq_bank_base + bank; 268 + if (!desc->irq_bank_map) 269 + return bank; 270 + else 271 + return desc->irq_bank_map[bank]; 269 272 } 270 273 271 274 static inline u32 sunxi_irq_cfg_reg(const struct sunxi_pinctrl_desc *desc,