Skip to content

Commit 648be4c

Browse files
Andre-ARMLinus Walleij
authored andcommitted
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>
1 parent d626d24 commit 648be4c

3 files changed

Lines changed: 60 additions & 0 deletions

File tree

drivers/pinctrl/sunxi/Kconfig

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,4 +131,9 @@ config PINCTRL_SUN50I_H616_R
131131
default ARM64 && ARCH_SUNXI
132132
select PINCTRL_SUNXI
133133

134+
config PINCTRL_SUN55I_A523
135+
bool "Support for the Allwinner A523 PIO"
136+
default ARM64 && ARCH_SUNXI
137+
select PINCTRL_SUNXI
138+
134139
endif

drivers/pinctrl/sunxi/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,5 +27,6 @@ obj-$(CONFIG_PINCTRL_SUN50I_H6) += pinctrl-sun50i-h6.o
2727
obj-$(CONFIG_PINCTRL_SUN50I_H6_R) += pinctrl-sun50i-h6-r.o
2828
obj-$(CONFIG_PINCTRL_SUN50I_H616) += pinctrl-sun50i-h616.o
2929
obj-$(CONFIG_PINCTRL_SUN50I_H616_R) += pinctrl-sun50i-h616-r.o
30+
obj-$(CONFIG_PINCTRL_SUN55I_A523) += pinctrl-sun55i-a523.o
3031
obj-$(CONFIG_PINCTRL_SUN9I_A80) += pinctrl-sun9i-a80.o
3132
obj-$(CONFIG_PINCTRL_SUN9I_A80_R) += pinctrl-sun9i-a80-r.o
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
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);

0 commit comments

Comments
 (0)