Skip to contentSkip to conversation

misc: aspeed: Add Aspeed UART routing control driver.

PATCH New Oskar Senft 1 participant 3 messages Jul 30, 2019

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/3 misc: aspeed: Add Aspeed UART routing control driver.

This driver adds sysfs files that allow the BMC userspace to configure how UARTs and physical serial I/O ports are routed.

Tested: Checked correct behavior (both read & write) on TYAN S7106 board by manually changing routing settings and confirming that bits flow as expected. Tested for UART1 and UART3 as this board doesn't have the other UARTs wired up in a testable way.

---
Changes since v1:
Moved from drivers/misc into drivers/soc.
Added support for AST2400.

 .../stable/sysfs-driver-aspeed-uart-routing   |  14 +
 .../misc-devices/aspeed-uart-routing.txt      |  50 +++
 drivers/soc/aspeed/Kconfig                    |   7 +
 drivers/soc/aspeed/Makefile                   |   7 +-
 drivers/soc/aspeed/aspeed-uart-routing.c      | 385 ++++++++++++++++++
 5 files changed, 460 insertions(+), 3 deletions(-)
 create mode 100644 Documentation/ABI/stable/sysfs-driver-aspeed-uart-routing
 create mode 100644 Documentation/misc-devices/aspeed-uart-routing.txt
 create mode 100644 drivers/soc/aspeed/aspeed-uart-routing.c
Documentation/ABI/stable/sysfs-driver-aspeed-uart-routing new file +14 -0
new file mode 100644
index 000000000000..5068737d9c12
@@ -0,0 +1,14 @@
+What:		/sys/bus/platform/drivers/aspeed-uart-routing/*/io*
+Date:		August 2018
+Contact:	Oskar Senft <[email protected]>
+Description:	Configures the input source for the specific physical
+		serial I/O port.
+Users:		OpenBMC.  Proposed changes should be mailed to
+		openbmc at lists.ozlabs.org
+
+What:		/sys/bus/platform/drivers/aspeed-uart-routing/*/uart*
+Date:		August 2018
+Contact:	Oskar Senft <[email protected]>
+Description:	Configures the input source for the specific UART.
+Users:		OpenBMC.  Proposed changes should be mailed to
+		openbmc at lists.ozlabs.org
Documentation/misc-devices/aspeed-uart-routing.txt new file +50 -0

50 lines not on this page · raw message

drivers/soc/aspeed/Kconfig +7 -0
index 323e177aa74d..ab11dd81c752 100644
@@ -29,4 +29,11 @@ config ASPEED_P2A_CTRL
 	  ioctl()s, the driver also provides an interface for userspace mappings to
 	  a pre-defined region.
 
+config ASPEED_UART_ROUTING
+	depends on SOC_ASPEED && REGMAP && MFD_SYSCON
+	tristate "Aspeed ast2400/2500 UART routing control"
+	help
+	  Control Aspeed ast2400/ast2500 UART routing via sysfs. This enables UART
+	  and I/O components to be dynamically connected at runtime.
+
 endmenu
drivers/soc/aspeed/Makefile +4 -3
index b64be47f2b1f..2fb979dec443 100644
@@ -1,4 +1,5 @@
 # SPDX-License-Identifier: GPL-2.0-only
-obj-$(CONFIG_ASPEED_LPC_CTRL)	+= aspeed-lpc-ctrl.o
-obj-$(CONFIG_ASPEED_LPC_SNOOP)	+= aspeed-lpc-snoop.o
-obj-$(CONFIG_ASPEED_P2A_CTRL)	+= aspeed-p2a-ctrl.o
+obj-$(CONFIG_ASPEED_LPC_CTRL)		+= aspeed-lpc-ctrl.o
+obj-$(CONFIG_ASPEED_LPC_SNOOP)		+= aspeed-lpc-snoop.o
+obj-$(CONFIG_ASPEED_P2A_CTRL)		+= aspeed-p2a-ctrl.o
+obj-$(CONFIG_ASPEED_UART_ROUTING)	+= aspeed-uart-routing.o
drivers/soc/aspeed/aspeed-uart-routing.c new file +385 -0

385 lines not on this page · raw message

Signature · 1 line
2.22.0.709.g102302147b-goog
#1 lore raw

PATCH v2 2/3 dt-bindings: misc: Bindings doc for aspeed-uart-routing

Device tree bindings documentation for the aspeed-uart-routing driver.

---
Changes since v1:
Split out bindings documentation from driver commit. Added bindings for AST2400.

 .../bindings/misc/aspeed-uart-routing.txt     | 39 +++++++++++++++++++
 1 file changed, 39 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/misc/aspeed-uart-routing.txt
Documentation/devicetree/bindings/misc/aspeed-uart-routing.txt new file +39 -0
new file mode 100644
index 000000000000..bb9ce689d56b
@@ -0,0 +1,39 @@
+======================================================================
+Device tree bindings for Aspeed AST2400/AST2500 UART Routing Control Driver
+======================================================================
+
+The Aspeed AST2500 allows to dynamically route the inputs for the built-in
+UARTS and physical serial I/O ports.
+
+Required properties:
+===================
+
+ - compatible: must be one of:
+	- "aspeed,ast2400-uart-routing"
+	- "aspeed,ast2500-uart-routing"
+
+Optional properties:
+===================
+
+The uart-routing node should be the child of a lpc node with the required
+property:
+
+- compatible : Should be one of the following:
+		"aspeed,ast2400-lpc", "simple-mfd"
+		"aspeed,ast2500-lpc", "simple-mfd"
+
+Example
+===================
+
+g5 Example
+----------
+
+lpc: lpc at 1e789000 {
+	compatible = "aspeed,ast2500-lpc", "simple-mfd";
+	reg = <0x1e789000 0x1000>;
+
+	uart_routing: uart_routing at 9c {
+		compatible = "aspeed,ast2500-uart-routing";
+		reg = <0x9c 0x4>;
+	};
+};
Signature · 1 line
2.22.0.709.g102302147b-goog
#2 lore raw

PATCH v2 3/3 ARM: dts: aspeed: Add uart-routing node

In reply to Oskar Senft

Add a node for the aspeed-uart-routing module. This node, when enabled will provide control of the Aspeed UART routing via sysfs.

---
Changes since v1:
Added AST2400.

 arch/arm/boot/dts/aspeed-g4.dtsi | 6 ++++++
 arch/arm/boot/dts/aspeed-g5.dtsi | 6 ++++++
 2 files changed, 12 insertions(+)
arch/arm/boot/dts/aspeed-g4.dtsi +6 -0
index dd4b0b15afcf..d855bc19d677 100644
@@ -326,6 +326,12 @@
 						status = "disabled";
 					};
 				};
+
+				uart_routing: uart_routing at 9c {
+					compatible = "aspeed,ast2400-uart-routing";
+					reg = <0x9c 0x4>;
+					status = "disabled";
+				};
 			};
 
 			uart2: serial at 1e78d000 {
arch/arm/boot/dts/aspeed-g5.dtsi +6 -0
index 7149ff3b6fb3..9e561504042a 100644
@@ -440,6 +440,12 @@
 						status = "disabled";
 					};
 				};
+
+				uart_routing: uart_routing at 9c {
+					compatible = "aspeed,ast2500-uart-routing";
+					reg = <0x9c 0x4>;
+					status = "disabled";
+				};
 			};
 
 			uart2: serial at 1e78d000 {
Signature · 1 line
2.22.0.709.g102302147b-goog