Skip to contentSkip to conversation

pinctrl: aspeed: Add AST2700 pinctrl drivers

PATCH In review Billy Tsai 2 participants 6 messages Jul 2 – Jul 15

Subsystems (3)
lore
Share & tools
lore

Billy Tsai

author reviewer
#0 lore raw

cover pinctrl: aspeed: Add AST2700 pinctrl drivers

The AST2700 is Aspeed's 7th-generation BMC SoC with a dual-die
architecture: SoC0 (CPU die) and SoC1 (I/O die) each have their own SCU with independent multi-function pin controls. Initial AST2700 platform support is already merged in next, including the ast2700.dtsi pinctrl0 and pinctrl1 nodes, but no pinctrl driver backs them yet.

This series adds one pinctrl driver per die, each followed by a patch adding its pin configuration support. Both drivers use the generic pinctrl framework and are compatible with the Linux kernel device tree bindings, using the same group and function names as the Linux aspeed,ast2700-soc0/soc1-pinctrl drivers so pin states can be shared between the kernel and U-Boot device trees.

Patch 1 adds the SoC0 driver, which models each (function, group) pair as a flat register mask/value table covering eMMC, VB, VGA DDC, JTAG master port select, PCIe RC PERST and USB2/USB3 port routing. Patch 2 adds SoC0 pin configuration support: every GPIO18A/GPIO18B ball has its own IO control register providing a 3 mA to 41 mA drive strength selector and bias control.

Patch 3 adds the SoC1 driver, porting the per-pin 4-bit multi-function selector scheme (220 pins, 238 groups, 217 functions) together with the virtual pins for PCIe RC2 PERST, the USB2 port C/D mode and SGMII controls. Patch 4 adds SoC1 pin configuration support: a per-pin bias enable bit and sparse 2-bit drive strength fields (4 mA to 16 mA in 4 mA steps) mirroring the Linux driver layout.

The bias-disable, bias-pull-down, bias-pull-up and drive-strength properties can be applied per pin or per group. Both drivers implement gpio_request_enable so the GPIO driver can reclaim pins through the gpio-ranges already present in ast2700.dtsi, and provide get_pin_muxing so "pinmux status" reports the active signal of every pin.

---
Billy Tsai (4):
pinctrl: aspeed: Add AST2700 SoC0 pinctrl driver
pinctrl: aspeed: Add AST2700 SoC0 pinconf support
pinctrl: aspeed: Add AST2700 SoC1 pinctrl driver
pinctrl: aspeed: Add AST2700 SoC1 pinconf support

 drivers/pinctrl/Kconfig                       |   20 +
 drivers/pinctrl/aspeed/Makefile               |    2 +
 drivers/pinctrl/aspeed/pinctrl_ast2700_soc0.c |  623 ++++++++++
 drivers/pinctrl/aspeed/pinctrl_ast2700_soc1.c | 1642 +++++++++++++++++++++++++
 4 files changed, 2287 insertions(+)

---
base-commit: e800cc67f5b6cb50a20f37c993ec1cd4063bdbd3
change-id: 20260702-pinctrl-03aff21bdf43

Best regards,

Signature · 1 line
Billy Tsai <[email protected]>
author reviewer
#1 lore raw

PATCH 1/4 pinctrl: aspeed: Add AST2700 SoC0 pinctrl driver

The AST2700 is a dual-die BMC SoC: SoC0 (CPU die) and SoC1 (I/O die) each have their own SCU with independent multi-function pin controls.

Add the pinctrl driver for the SoC0 die. The driver uses the generic pinctrl framework and is compatible with the Linux kernel device tree bindings, i.e. pin states are described with the same "function" and "groups" properties and the same names as the Linux aspeed,ast2700-soc0-pinctrl driver.

Unlike the older AST2500/AST2600 SCUs where each signal is enabled by independent bits, the SoC0 mux selections mix single-bit enables (eMMC, VGA DDC, VB strap), multi-bit selector fields (JTAG master port select, USB2/USB3 port routing) and reset-control bits (PCIe RC PERST). Model each (function, group) pair as one register mask/value write so all of them fit a single flat table.

The gpio_request_enable hook releases the GPIO18A/GPIO18B pins to GPIO mode by clearing every signal enable bit that claims the pin, matching the Linux driver behaviour.

---
 drivers/pinctrl/Kconfig                       |   9 +
 drivers/pinctrl/aspeed/Makefile               |   1 +
 drivers/pinctrl/aspeed/pinctrl_ast2700_soc0.c | 486 ++++++++++++++++++++++++++
 3 files changed, 496 insertions(+)
drivers/pinctrl/Kconfig +9 -0
index 578edbf8168..35b3f3afa66 100644
@@ -378,6 +378,15 @@ config ASPEED_AST2600_PINCTRL
 	  uses Generic Pinctrl framework and is compatible with the Linux
 	  driver, i.e. it uses the same device tree configuration.
 
+config ASPEED_AST2700_SOC0_PINCTRL
+	bool "Aspeed AST2700 SoC0 pin control driver"
+	depends on DM && PINCTRL_GENERIC && ASPEED_AST2700
+	default y
+	help
+	  Support pin multiplexing control on Aspeed ast2700 SoC0. The driver
+	  uses Generic Pinctrl framework and is compatible with the Linux
+	  driver, i.e. it uses the same device tree configuration.
+
 config PINCTRL_K210
 	bool "Kendryte K210 Fully-Programmable Input/Output Array driver"
 	depends on DM && PINCTRL_GENERIC
drivers/pinctrl/aspeed/Makefile +1 -0
index a3e01ed1ca9..a0da1d7403d 100644
@@ -1,2 +1,3 @@
 obj-$(CONFIG_ASPEED_AST2500_PINCTRL) += pinctrl_ast2500.o
 obj-$(CONFIG_ASPEED_AST2600_PINCTRL) += pinctrl_ast2600.o
+obj-$(CONFIG_ASPEED_AST2700_SOC0_PINCTRL) += pinctrl_ast2700_soc0.o
drivers/pinctrl/aspeed/pinctrl_ast2700_soc0.c new file +486 -0

486 lines not on this page · raw message

Signature · 1 line
2.34.1
author reviewer
#2 lore raw

PATCH 2/4 pinctrl: aspeed: Add AST2700 SoC0 pinconf support

In reply to Billy Tsai

Each GPIO18A/GPIO18B ball has its own IO control register starting at SCU 0x480, providing a 4-bit drive strength selector (3 mA to 41 mA in hardware-defined steps), a bias enable bit and a pull direction bit.

Extend the group table with the pin members of the ball-backed groups so bias-disable, bias-pull-down, bias-pull-up and drive-strength properties can be applied per group as well as per pin. The routing groups (USB, JTAG, PCIe RC) have no package balls and reject pin configuration with -ENOTSUPP.

Select PINCONF so the generic pinctrl framework parses the pin configuration properties.

---
 drivers/pinctrl/Kconfig                       |   1 +
 drivers/pinctrl/aspeed/pinctrl_ast2700_soc0.c | 205 +++++++++++++++++++++-----
 2 files changed, 172 insertions(+), 34 deletions(-)
drivers/pinctrl/Kconfig +1 -0
index 35b3f3afa66..254da75d144 100644
@@ -381,6 +381,7 @@ config ASPEED_AST2600_PINCTRL
 config ASPEED_AST2700_SOC0_PINCTRL
 	bool "Aspeed AST2700 SoC0 pin control driver"
 	depends on DM && PINCTRL_GENERIC && ASPEED_AST2700
+	select PINCONF
 	default y
 	help
 	  Support pin multiplexing control on Aspeed ast2700 SoC0. The driver
drivers/pinctrl/aspeed/pinctrl_ast2700_soc0.c +171 -34

241 lines not on this page · raw message

Signature · 1 line
2.34.1
author reviewer
#3 lore raw

PATCH 3/4 pinctrl: aspeed: Add AST2700 SoC1 pinctrl driver

In reply to Billy Tsai

Add the pinctrl driver for the AST2700 SoC1 (I/O) die.

Unlike previous Aspeed generations, the SoC1 SCU assigns every pin a 4-bit multi-function selector field in a contiguous register range starting at SCU 0x400, eight pins per register. Only bits [2:0] of each field select the function; bit 3 is reserved read-only and must not be written. The driver therefore keeps per-pin group tables and per-function mux values, mirroring the Linux aspeed,ast2700-soc1-pinctrl driver, and shares the same device tree
bindings: 220 pins, 238 groups and 217 functions with identical names, so pin states written for the Linux driver work unmodified.

A few controls live outside the pin-indexed range and are handled as virtual pins: PCIERC2_PERST (SCU 0x908), the USB2 port C/D mode fields (SCU 0x3B0) and SGMII0 (SCU 0x47C).

The gpio_request_enable hook restores a pin to GPIO by writing mux value 0, except for the ADC-capable balls W17..AB19 where function 1 selects GPIO and 0 selects the ADC input.

---
 drivers/pinctrl/Kconfig                       |    9 +
 drivers/pinctrl/aspeed/Makefile               |    1 +
 drivers/pinctrl/aspeed/pinctrl_ast2700_soc1.c | 1495 +++++++++++++++++++++++++
 3 files changed, 1505 insertions(+)
drivers/pinctrl/Kconfig +9 -0
index 254da75d144..c371d94ee6a 100644
@@ -388,6 +388,15 @@ config ASPEED_AST2700_SOC0_PINCTRL
 	  uses Generic Pinctrl framework and is compatible with the Linux
 	  driver, i.e. it uses the same device tree configuration.
 
+config ASPEED_AST2700_SOC1_PINCTRL
+	bool "Aspeed AST2700 SoC1 pin control driver"
+	depends on DM && PINCTRL_GENERIC && ASPEED_AST2700
+	default y
+	help
+	  Support pin multiplexing control on Aspeed ast2700 SoC1. The driver
+	  uses Generic Pinctrl framework and is compatible with the Linux
+	  driver, i.e. it uses the same device tree configuration.
+
 config PINCTRL_K210
 	bool "Kendryte K210 Fully-Programmable Input/Output Array driver"
 	depends on DM && PINCTRL_GENERIC
drivers/pinctrl/aspeed/Makefile +1 -0
index a0da1d7403d..33b23fce629 100644
@@ -1,3 +1,4 @@
 obj-$(CONFIG_ASPEED_AST2500_PINCTRL) += pinctrl_ast2500.o
 obj-$(CONFIG_ASPEED_AST2600_PINCTRL) += pinctrl_ast2600.o
 obj-$(CONFIG_ASPEED_AST2700_SOC0_PINCTRL) += pinctrl_ast2700_soc0.o
+obj-$(CONFIG_ASPEED_AST2700_SOC1_PINCTRL) += pinctrl_ast2700_soc1.o
drivers/pinctrl/aspeed/pinctrl_ast2700_soc1.c new file +1495 -0

1,495 lines not on this page · raw message

Signature · 1 line
2.34.1
author reviewer
#4 lore raw

PATCH 4/4 pinctrl: aspeed: Add AST2700 SoC1 pinconf support

In reply to Billy Tsai

The SoC1 SCU provides a bias enable bit per pin in the registers at 0x480 (setting the bit disables the bias; the pull direction is fixed in silicon) and 2-bit drive strength fields at 0x4C0 selecting 4 mA to 16 mA in 4 mA steps. The pin-to-field mapping of the drive strength registers is sparse and non-linear, so it is kept in a lookup table mirroring the Linux driver; pins without an entry reject drive-strength with -ENOTSUPP.

Support the bias-disable, bias-pull-down, bias-pull-up and drive-strength properties per pin and per group, and select PINCONF so the generic pinctrl framework parses them.

---
 drivers/pinctrl/Kconfig                       |   1 +
 drivers/pinctrl/aspeed/pinctrl_ast2700_soc1.c | 147 ++++++++++++++++++++++++++
 2 files changed, 148 insertions(+)
drivers/pinctrl/Kconfig +1 -0
index c371d94ee6a..40e14d5ec49 100644
@@ -391,6 +391,7 @@ config ASPEED_AST2700_SOC0_PINCTRL
 config ASPEED_AST2700_SOC1_PINCTRL
 	bool "Aspeed AST2700 SoC1 pin control driver"
 	depends on DM && PINCTRL_GENERIC && ASPEED_AST2700
+	select PINCONF
 	default y
 	help
 	  Support pin multiplexing control on Aspeed ast2700 SoC1. The driver
drivers/pinctrl/aspeed/pinctrl_ast2700_soc1.c +147 -0

165 lines not on this page · raw message

Signature · 1 line
2.34.1
#5 lore raw
In reply to Billy Tsai
Quoted 6 lines · Billy Tsai

The AST2700 is Aspeed's 7th-generation BMC SoC with a dual-die
architecture: SoC0 (CPU die) and SoC1 (I/O die) each have their own SCU with independent multi-function pin controls. Initial AST2700 platform support is already merged in next, including the ast2700.dtsi pinctrl0 and pinctrl1 nodes, but no pinctrl driver backs them yet.

Quoted 8 lines

This series adds one pinctrl driver per die, each followed by a patch adding its pin configuration support. Both drivers use the generic pinctrl framework and are compatible with the Linux kernel device tree bindings, using the same group and function names as the Linux aspeed,ast2700-soc0/soc1-pinctrl drivers so pin states can be shared between the kernel and U-Boot device trees.

[...]

Applied to u-boot/master, thanks!

[1/4] pinctrl: aspeed: Add AST2700 SoC0 pinctrl driver

      commit: 1b87385aacf2c8a5d6d9296984509ae8376d6165
[2/4] pinctrl: aspeed: Add AST2700 SoC0 pinconf support
      commit: ada5d0e7e2ceb118a70df7d8c15b53d0d91c7d3b
[3/4] pinctrl: aspeed: Add AST2700 SoC1 pinctrl driver
      commit: c0e2aeb9dfe551a1b01a44dfffe917e8997898c3
[4/4] pinctrl: aspeed: Add AST2700 SoC1 pinconf support
      commit: 02d74afe94a5510312d01ad79a3801c589cb6a20
Signature · 1 line
Tom