Skip to content

Commit b8a51e9

Browse files
Andre-ARMLinus Walleij
authored andcommitted
pinctrl: sunxi: Add support for the secondary A523 GPIO ports
As most other Allwinner SoCs before, the A523 chip contains a second GPIO controller, managing banks PL and PM. 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-9-andre.przywara@arm.com Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
1 parent 648be4c commit b8a51e9

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
@@ -136,4 +136,9 @@ config PINCTRL_SUN55I_A523
136136
default ARM64 && ARCH_SUNXI
137137
select PINCTRL_SUNXI
138138

139+
config PINCTRL_SUN55I_A523_R
140+
bool "Support for the Allwinner A523 R-PIO"
141+
default ARM64 && ARCH_SUNXI
142+
select PINCTRL_SUNXI
143+
139144
endif

drivers/pinctrl/sunxi/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,5 +28,6 @@ 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
3030
obj-$(CONFIG_PINCTRL_SUN55I_A523) += pinctrl-sun55i-a523.o
31+
obj-$(CONFIG_PINCTRL_SUN55I_A523_R) += pinctrl-sun55i-a523-r.o
3132
obj-$(CONFIG_PINCTRL_SUN9I_A80) += pinctrl-sun9i-a80.o
3233
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 r-pinctrl driver.
4+
*
5+
* Copyright (C) 2024 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_r_nr_bank_pins[SUNXI_PINCTRL_MAX_BANKS] =
17+
/* PL PM */
18+
{ 14, 6 };
19+
20+
static const unsigned int a523_r_irq_bank_map[] = { 0, 1 };
21+
22+
static const u8 a523_r_irq_bank_muxes[SUNXI_PINCTRL_MAX_BANKS] =
23+
/* PL PM */
24+
{ 14, 14 };
25+
26+
static struct sunxi_pinctrl_desc a523_r_pinctrl_data = {
27+
.irq_banks = ARRAY_SIZE(a523_r_irq_bank_map),
28+
.irq_bank_map = a523_r_irq_bank_map,
29+
.irq_read_needs_mux = true,
30+
.io_bias_cfg_variant = BIAS_VOLTAGE_PIO_POW_MODE_SEL,
31+
.pin_base = PL_BASE,
32+
};
33+
34+
static int a523_r_pinctrl_probe(struct platform_device *pdev)
35+
{
36+
return sunxi_pinctrl_dt_table_init(pdev, a523_r_nr_bank_pins,
37+
a523_r_irq_bank_muxes,
38+
&a523_r_pinctrl_data,
39+
SUNXI_PINCTRL_NEW_REG_LAYOUT);
40+
}
41+
42+
static const struct of_device_id a523_r_pinctrl_match[] = {
43+
{ .compatible = "allwinner,sun55i-a523-r-pinctrl", },
44+
{}
45+
};
46+
47+
static struct platform_driver a523_r_pinctrl_driver = {
48+
.probe = a523_r_pinctrl_probe,
49+
.driver = {
50+
.name = "sun55i-a523-r-pinctrl",
51+
.of_match_table = a523_r_pinctrl_match,
52+
},
53+
};
54+
builtin_platform_driver(a523_r_pinctrl_driver);

0 commit comments

Comments
 (0)