Skip to contentSkip to conversation

Support Aspeed SGPIO controller

PATCH In review Billy Tsai 2 participants 5 messages Oct 16, 2024 – Oct 29, 2024

Subsystems (5)
lore
Share & tools
lore

Billy Tsai

author reviewer
#0 lore raw

cover Support Aspeed SGPIO controller

AST2600 SoC has 2 SGPIO master interfaces one with 128 pins another one with 80 pins, AST2500/AST2400 SoC has 1 SGPIO master interface that supports up to 80 pins.

Billy Tsai (3):
gpio: Add Aspeed SGPIO driver
ARM: dts: ast2500: Add SGPIO to device tree
ARM: dts: ast2600: Add SGPIO to device tree

 arch/arm/dts/ast2500-evb.dts             |   5 +
 arch/arm/dts/ast2500.dtsi                |  20 ++
 arch/arm/dts/ast2600-evb.dts             |  10 +
 arch/arm/dts/ast2600.dtsi                |  40 +++
 drivers/gpio/Kconfig                     |   7 +
 drivers/gpio/Makefile                    |   1 +
 drivers/gpio/gpio-aspeed-sgpio.c         | 310 +++++++++++++++++++++++
 drivers/pinctrl/aspeed/pinctrl_ast2500.c |   1 +
 drivers/pinctrl/aspeed/pinctrl_ast2600.c |  10 +
 9 files changed, 404 insertions(+)
 create mode 100644 drivers/gpio/gpio-aspeed-sgpio.c
Signature · 1 line
2.25.1
author reviewer
#1 lore raw

PATCH 1/3 gpio: Add Aspeed SGPIO driver

The Aspeed SGPIO driver supports the SGPIO controllers found in the AST2400, AST2500 and AST2600 BMC SoCs. The implementation is a cut-down copy of the upstream Linux kernel driver, adapted for u-boot.

---
 drivers/gpio/Kconfig             |   7 +
 drivers/gpio/Makefile            |   1 +
 drivers/gpio/gpio-aspeed-sgpio.c | 310 +++++++++++++++++++++++++++++++
 3 files changed, 318 insertions(+)
 create mode 100644 drivers/gpio/gpio-aspeed-sgpio.c
drivers/gpio/Kconfig +7 -0
index 1e5711663eb..92a8597420a 100644
@@ -157,6 +157,13 @@ config ASPEED_GPIO
 	  is found in the AST2400, AST2500 and AST2600 BMC SoCs and
 	  provides access to over 200 GPIOs on each chip.
 
+config ASPEED_SGPIO
+	bool "Aspeed SGPIO Driver"
+	help
+	  Say yes here to support the Aspeed serial GPIO driver. The controller
+	  is found in the AST2400, AST2500 and AST2600 BMC SoCs and
+	  provides access to generate serial GPIO signal.
+
 config ASPEED_G7_GPIO
 	bool "Aspeed G7 GPIO Driver"
 	help
drivers/gpio/Makefile +1 -0
index fe81b6ba88b..3f882c065d8 100644
@@ -14,6 +14,7 @@ obj-$(CONFIG_$(XPL_)DM_PCA953X)	+= pca953x_gpio.o
 
 obj-$(CONFIG_ASPEED_GPIO)	+= gpio-aspeed.o
 obj-$(CONFIG_ASPEED_G7_GPIO)	+= gpio-aspeed-g7.o
+obj-$(CONFIG_ASPEED_SGPIO)	+= gpio-aspeed-sgpio.o
 obj-$(CONFIG_AT91_GPIO)	+= at91_gpio.o
 obj-$(CONFIG_ATMEL_PIO4)	+= atmel_pio4.o
 obj-$(CONFIG_BCM6345_GPIO)	+= bcm6345_gpio.o
drivers/gpio/gpio-aspeed-sgpio.c new file +310 -0

310 lines not on this page · raw message

Signature · 1 line
2.25.1
author reviewer
#2 lore raw

PATCH 2/3 ARM: dts: ast2500: Add SGPIO to device tree

In reply to Billy Tsai

Add SGPIO DTS node and enable it for AST2500 EVB.

---
 arch/arm/dts/ast2500-evb.dts             |  5 +++++
 arch/arm/dts/ast2500.dtsi                | 20 ++++++++++++++++++++
 drivers/pinctrl/aspeed/pinctrl_ast2500.c |  1 +
 3 files changed, 26 insertions(+)
arch/arm/dts/ast2500-evb.dts +5 -0
index d481eadfeb0..9a5037deca2 100644
@@ -129,3 +129,8 @@
                 reg = <0x4d>;
         };
 };
+
+&sgpio {
+	status = "okay";
+	ngpios = <80>;
+};
arch/arm/dts/ast2500.dtsi +20 -0
index 320d2e5340a..d677705fe85 100644
@@ -255,6 +255,21 @@
 				interrupt-controller;
 			};
 
+			sgpio: sgpio@1e780200 {
+				compatible = "aspeed,ast2500-sgpio";
+				reg = <0x1e780200 0x100>;
+				interrupts = <40>;
+				clocks = <&scu ASPEED_CLK_APB>;
+				#gpio-cells = <2>;
+				gpio-controller;
+				#interrupt-cells = <2>;
+				interrupt-controller;
+				bus-frequency = <1000000>;
+				pinctrl-names = "default";
+				pinctrl-0 = <&pinctrl_sgpm_default>;
+				status = "disabled";
+			};
+
 			timer: timer@1e782000 {
 				/* This timer is a Faraday FTTMR010 derivative */
 				compatible = "aspeed,ast2400-timer";
@@ -1445,4 +1460,9 @@
 		function = "WDTRST2";
 		groups = "WDTRST2";
 	};
+
+	pinctrl_sgpm_default: sgpm_default {
+		function = "SGPM";
+		groups = "SGPM";
+	};
 };
drivers/pinctrl/aspeed/pinctrl_ast2500.c +1 -0
index 9e7c347caf8..5ecd3f262b9 100644
@@ -62,6 +62,7 @@ static const struct ast2500_group_config ast2500_groups[] = {
 	{ "SD2", 5, (1 << 1) },
 	{ "FWSPICS1", 3, (1 << 24) },
 	{ "SPI1CS1", 1, (1 << 15) },
+	{ "SGPM", 2, (1 << 11) | (1 << 10) | (1 << 9) | (1 << 8) },
 };
 
 static int ast2500_pinctrl_get_groups_count(struct udevice *dev)
Signature · 1 line
2.25.1
author reviewer
#3 lore raw

PATCH 3/3 ARM: dts: ast2600: Add SGPIO to device tree

In reply to Billy Tsai

Add SGPIO DTS node and enable them for AST2600 EVB.

---
 arch/arm/dts/ast2600-evb.dts             | 10 ++++++
 arch/arm/dts/ast2600.dtsi                | 40 ++++++++++++++++++++++++
 drivers/pinctrl/aspeed/pinctrl_ast2600.c | 10 ++++++
 3 files changed, 60 insertions(+)
arch/arm/dts/ast2600-evb.dts +10 -0
index 9aac0e26f28..570ba61965a 100644
@@ -266,3 +266,13 @@
 	bootph-all;
 	status = "okay";
 };
+
+&sgpiom0 {
+	status = "okay";
+	ngpios = <128>;
+};
+
+&sgpiom1 {
+	status = "okay";
+	ngpios = <80>;
+};
arch/arm/dts/ast2600.dtsi +40 -0
index 43db80edfe5..cb8ce8b6b6f 100644
@@ -501,6 +501,36 @@
 				ngpios = <208>;
 			};
 
+			sgpiom0: sgpiom@1e780500 {
+				compatible = "aspeed,ast2600-sgpiom";
+				reg = <0x1e780500 0x100>;
+				interrupts = <GIC_SPI 51 IRQ_TYPE_LEVEL_HIGH>;
+				clocks = <&scu ASPEED_CLK_APB2>;
+				#gpio-cells = <2>;
+				gpio-controller;
+				#interrupt-cells = <2>;
+				interrupt-controller;
+				bus-frequency = <1000000>;
+				pinctrl-names = "default";
+				pinctrl-0 = <&pinctrl_sgpm1_default>;
+				status = "disabled";
+			};
+
+			sgpiom1: sgpiom@1e780600 {
+				compatible = "aspeed,ast2600-sgpiom";
+				reg = <0x1e780600 0x100>;
+				interrupts = <GIC_SPI 70 IRQ_TYPE_LEVEL_HIGH>;
+				clocks = <&scu ASPEED_CLK_APB2>;
+				#gpio-cells = <2>;
+				gpio-controller;
+				#interrupt-cells = <2>;
+				interrupt-controller;
+				bus-frequency = <12000000>;
+				pinctrl-names = "default";
+				pinctrl-0 = <&pinctrl_sgpm2_default>;
+				status = "disabled";
+			};
+
 			gpio1: gpio@1e780800 {
 				compatible = "aspeed,ast2600-gpio";
 				reg = <0x1e780800 0x800>;
@@ -2167,4 +2197,14 @@
 		function = "PCIE1RC";
 		groups = "PCIE1RC";
 	};
+
+	pinctrl_sgpm1_default: sgpm1_default {
+		function = "SGPM1";
+		groups = "SGPM1";
+	};
+
+	pinctrl_sgpm2_default: sgpm2_default {
+		function = "SGPM2";
+		groups = "SGPM2";
+	};
 };
drivers/pinctrl/aspeed/pinctrl_ast2600.c +10 -0
index bc12590e583..f4bec6fe53c 100644
@@ -454,6 +454,14 @@ static struct aspeed_sig_desc pwm15g1[] = {
 	{0x41c, BIT(31), 0},
 };
 
+static struct aspeed_sig_desc sgpm1[] = {
+	{0x414, GENMASK(27, 24), 0},
+};
+
+static struct aspeed_sig_desc sgpm2[] = {
+	{0x6d0, GENMASK(7, 4), 0},
+};
+
 static const struct aspeed_group_config ast2600_groups[] = {
 	{ "MAC1LINK", ARRAY_SIZE(mac1_link), mac1_link },
 	{ "MAC2LINK", ARRAY_SIZE(mac2_link), mac2_link },
@@ -543,6 +551,8 @@ static const struct aspeed_group_config ast2600_groups[] = {
 	{ "PWM14G1", ARRAY_SIZE(pwm14g1), pwm14g1 },
 	{ "PWM15G0", ARRAY_SIZE(pwm15g0), pwm15g0 },
 	{ "PWM15G1", ARRAY_SIZE(pwm15g1), pwm15g1 },
+	{ "SGPM1", ARRAY_SIZE(sgpm1), sgpm1 },
+	{ "SGPM2", ARRAY_SIZE(sgpm2), sgpm2 },
 };
 
 static int ast2600_pinctrl_get_groups_count(struct udevice *dev)
Signature · 1 line
2.25.1
#4 lore raw
In reply to Billy Tsai
Quoted 10 lines · Billy Tsai

AST2600 SoC has 2 SGPIO master interfaces one with 128 pins another one with 80 pins, AST2500/AST2400 SoC has 1 SGPIO master interface that supports up to 80 pins.

Billy Tsai (3):
gpio: Add Aspeed SGPIO driver
ARM: dts: ast2500: Add SGPIO to device tree
ARM: dts: ast2600: Add SGPIO to device tree

[...]

Applied to u-boot/master, thanks!

Signature · 1 line
Tom