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

pinctrl: sunxi: Add support for the Allwinner A523

The Allwinner A523 contains pins in 10 out of the 11 possible pin banks;
it just skips port A.
Use the newly introduced DT based pinctrl driver to describe just the
generic pinctrl properties, so advertise the number of pins per bank
and the interrupt capabilities. The actual function/mux assignment is
taken from the devicetree.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Jernej Skrabec <jernej.skrabec@gmail.com>
Link: https://lore.kernel.org/20250306235827.4895-8-andre.przywara@arm.com
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>

authored by

Andre Przywara and committed by
Linus Walleij
648be4cd d626d248

+60
+5
drivers/pinctrl/sunxi/Kconfig
··· 131 131 default ARM64 && ARCH_SUNXI 132 132 select PINCTRL_SUNXI 133 133 134 + config PINCTRL_SUN55I_A523 135 + bool "Support for the Allwinner A523 PIO" 136 + default ARM64 && ARCH_SUNXI 137 + select PINCTRL_SUNXI 138 + 134 139 endif
+1
drivers/pinctrl/sunxi/Makefile
··· 27 27 obj-$(CONFIG_PINCTRL_SUN50I_H6_R) += pinctrl-sun50i-h6-r.o 28 28 obj-$(CONFIG_PINCTRL_SUN50I_H616) += pinctrl-sun50i-h616.o 29 29 obj-$(CONFIG_PINCTRL_SUN50I_H616_R) += pinctrl-sun50i-h616-r.o 30 + obj-$(CONFIG_PINCTRL_SUN55I_A523) += pinctrl-sun55i-a523.o 30 31 obj-$(CONFIG_PINCTRL_SUN9I_A80) += pinctrl-sun9i-a80.o 31 32 obj-$(CONFIG_PINCTRL_SUN9I_A80_R) += pinctrl-sun9i-a80-r.o
+54
drivers/pinctrl/sunxi/pinctrl-sun55i-a523.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 2 + /* 3 + * Allwinner A523 SoC pinctrl driver. 4 + * 5 + * Copyright (C) 2023 Arm Ltd. 6 + */ 7 + 8 + #include <linux/module.h> 9 + #include <linux/platform_device.h> 10 + #include <linux/of.h> 11 + #include <linux/of_device.h> 12 + #include <linux/pinctrl/pinctrl.h> 13 + 14 + #include "pinctrl-sunxi.h" 15 + 16 + static const u8 a523_nr_bank_pins[SUNXI_PINCTRL_MAX_BANKS] = 17 + /* PA PB PC PD PE PF PG PH PI PJ PK */ 18 + { 0, 15, 17, 24, 16, 7, 15, 20, 17, 28, 24 }; 19 + 20 + static const unsigned int a523_irq_bank_map[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }; 21 + 22 + static const u8 a523_irq_bank_muxes[SUNXI_PINCTRL_MAX_BANKS] = 23 + /* PA PB PC PD PE PF PG PH PI PJ PK */ 24 + { 0, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14}; 25 + 26 + static struct sunxi_pinctrl_desc a523_pinctrl_data = { 27 + .irq_banks = ARRAY_SIZE(a523_irq_bank_map), 28 + .irq_bank_map = a523_irq_bank_map, 29 + .irq_read_needs_mux = true, 30 + .io_bias_cfg_variant = BIAS_VOLTAGE_PIO_POW_MODE_SEL, 31 + }; 32 + 33 + static int a523_pinctrl_probe(struct platform_device *pdev) 34 + { 35 + return sunxi_pinctrl_dt_table_init(pdev, a523_nr_bank_pins, 36 + a523_irq_bank_muxes, 37 + &a523_pinctrl_data, 38 + SUNXI_PINCTRL_NEW_REG_LAYOUT | 39 + SUNXI_PINCTRL_ELEVEN_BANKS); 40 + } 41 + 42 + static const struct of_device_id a523_pinctrl_match[] = { 43 + { .compatible = "allwinner,sun55i-a523-pinctrl", }, 44 + {} 45 + }; 46 + 47 + static struct platform_driver a523_pinctrl_driver = { 48 + .probe = a523_pinctrl_probe, 49 + .driver = { 50 + .name = "sun55i-a523-pinctrl", 51 + .of_match_table = a523_pinctrl_match, 52 + }, 53 + }; 54 + builtin_platform_driver(a523_pinctrl_driver);