arm: aspeed: Add UART routing support
Subsystems (2)
v3 cover arm: aspeed: Add UART routing support
Add UART routing driver and the device tree nodes.
v3:
- Add individual bindings in YAML
- Add support for AST24xx (AST25xx shares the same design)
- Add more explanation for the sysfs ABI
v2:
- Add dt-bindings
- Add ABI documents for the exported sysfs interface
- Revise driver implementation suggested by Joel
Chia-Wei Wang (3):
dt-bindings: aspeed: Add UART routing controller
soc: aspeed: Add UART routing support
ARM: dts: aspeed: Add uart routing to device tree
.../testing/sysfs-driver-aspeed-uart-routing | 15 + .../bindings/soc/aspeed/uart-routing.yaml | 70 ++ arch/arm/boot/dts/aspeed-g4.dtsi | 6 + arch/arm/boot/dts/aspeed-g5.dtsi | 6 + arch/arm/boot/dts/aspeed-g6.dtsi | 6 + drivers/soc/aspeed/Kconfig | 10 + drivers/soc/aspeed/Makefile | 9 +- drivers/soc/aspeed/aspeed-uart-routing.c | 603 ++++++++++++++++++ 8 files changed, 721 insertions(+), 4 deletions(-) create mode 100644 Documentation/ABI/testing/sysfs-driver-aspeed-uart-routing create mode 100644 Documentation/devicetree/bindings/soc/aspeed/uart-routing.yaml create mode 100644 drivers/soc/aspeed/aspeed-uart-routing.c
Signature · 1 line
2.17.1
PATCH v3 1/3 dt-bindings: aspeed: Add UART routing controller
Add dt-bindings for Aspeed UART routing controller.
--- .../bindings/soc/aspeed/uart-routing.yaml | 70 +++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100644 Documentation/devicetree/bindings/soc/aspeed/uart-routing.yaml
Documentation/devicetree/bindings/soc/aspeed/uart-routing.yaml new file +70 -0
@@ -0,0 +1,70 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +# # Copyright (c) 2018 Google LLC +# # Copyright (c) 2021 Aspeed Technology Inc. +%YAML 1.2 +--- +$id: "http://devicetree.org/schemas/soc/aspeed/uart-routing.yaml#" +$schema: "http://devicetree.org/meta-schemas/core.yaml#" + +title: Aspeed UART Routing Controller + +maintainers: + - Oskar Senft <[email protected]> + - Chia-Wei Wang <[email protected]> + +description: + The Aspeed UART routing control allow to dynamically route the inputs for + the built-in UARTS and physical serial I/O ports. + + This allows, for example, to connect the output of UART to another UART. + This can be used to enable Host <-> BMC communication via UARTs, e.g. to + allow access to the Host's serial console. + + This driver is for the BMC side. The sysfs files allow the BMC userspace + which owns the system configuration policy, to configure how UARTs and + physical serial I/O ports are routed. + + Two types of files, uart* and io*, are presented in sysfs. The uart* + configures the input signal of a UART controller whereas io* configures + that of a physical serial port. + + When read, each file shows the list of available options with currently + selected option marked by brackets "[]". The list of available options + depends on the selected file. + + e.g. + cat /sys/bus/platform/drivers/aspeed-uart-routing/*.uart_routing/uart1 + [io1] io2 io3 io4 uart2 uart3 uart4 io6 + + In this case, UART1 gets its input from IO1 (physical serial port 1). + +properties: + compatible: + items: + - enum: + - aspeed,ast2400-uart-routing + - aspeed,ast2500-uart-routing + - aspeed,ast2600-uart-routing + reg: + maxItems: 1 + +required: + - compatible + +additionalProperties: false + +examples: + - | + lpc: lpc at 1e789000 { + compatible = "aspeed,ast2600-lpc-v2", "simple-mfd", "syscon"; + reg = <0x1e789000 0x1000>; + + #address-cells = <1>; + #size-cells = <1>; + ranges = <0x0 0x1e789000 0x1000>; + + uart_routing: espi-routing at 98 { + compatible = "aspeed,ast2600-uart-routing"; + reg = <0x98 0x8>; + }; + };
Signature · 1 line
2.17.1
Rob Herring
maintainerRe: [PATCH v3 1/3] dt-bindings: aspeed: Add UART routing controller
Quoted 9 lines · Chia-Wei Wang
Add dt-bindings for Aspeed UART routing controller.
Signed-off-by Oskar Senft <[email protected]>Signed-off-by Chia-Wei Wang <[email protected]>--- .../bindings/soc/aspeed/uart-routing.yaml | 70 +++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100644 Documentation/devicetree/bindings/soc/aspeed/uart-routing.yaml
My bot found errors running 'make DT_CHECKER_FLAGS=-m dt_binding_check' on your patch (DT_CHECKER_FLAGS is new in v5.13):
yamllint warnings/errors:
dtschema/dtc warnings/errors:Documentation/devicetree/bindings/soc/aspeed/uart-routing.example.dt.yaml:0:0: /example-0/lpc at 1e789000: failed to match any schema with compatible: ['aspeed,ast2600-lpc-v2', 'simple-mfd', 'syscon']
doc reference errors (make refcheckdocs):
See https://patchwork.ozlabs.org/patch/1526149
This check can fail if there are any dependencies. The base for a patch series is generally the most recent rc1.
If you already ran 'make dt_binding_check' and didn't see the above error(s), then make sure 'yamllint' is installed and dt-schema is up to date:
pip3 install dtschema --upgrade
Please check and re-submit.
RE: [PATCH v3 1/3] dt-bindings: aspeed: Add UART routing controller
Hi Rob,
Quoted 20 lines
From: Rob Herring <[email protected]>
Sent: Thursday, September 9, 2021 8:33 PMQuoted 6 lines · Chia-Wei Wang
Add dt-bindings for Aspeed UART routing controller.
Signed-off-by Oskar Senft <[email protected]>Signed-off-by Chia-Wei Wang <[email protected]>--- .../bindings/soc/aspeed/uart-routing.yaml | 70+++++++++++++++++++
Quoted 4 lines
1 file changed, 70 insertions(+) create mode 100644
Documentation/devicetree/bindings/soc/aspeed/uart-routing.yamlMy bot found errors running 'make DT_CHECKER_FLAGS=-m
dt_binding_check'
on your patch (DT_CHECKER_FLAGSis new in v5.13):
Quoted 6 lines
yamllint warnings/errors:
dtschema/dtc warnings/errors:
Documentation/devicetree/bindings/soc/aspeed/uart-routing.example.dt.yaml:
0:0: /example-0/lpc at1e789000: failed to match any schema with compatible:
['aspeed,ast2600-lpc-v2', 'simple-mfd', 'syscon']
The "aspeed,ast2600-lpc-v2" compatible string is described in the .txt file 'aspeed-lpc.txt'. Do we have to firstly convert the text file into YAML one to resolve this dependency issue?
Regards,
Chiawei
Quoted 15 lines
doc reference errors (make refcheckdocs):
See https://patchwork.ozlabs.org/patch/1526149
This check can fail if there are any dependencies. The base for a patch series is generally the most recent rc1.
If you already ran 'make
dt_binding_check' and didn't see the above error(s), then make sure 'yamllint' is installed and dt-schema is up to date:pip3 install dtschema --upgrade
Please check and re-submit.
Rob Herring
maintainerRe: [PATCH v3 1/3] dt-bindings: aspeed: Add UART routing controller
Quoted 25 lines · ChiaWei Wang
Hi Rob,
Quoted 22 lines
From: Rob Herring <[email protected]>
Sent: Thursday, September 9, 2021 8:33 PMQuoted 6 lines · Chia-Wei Wang
Add dt-bindings for Aspeed UART routing controller.
Signed-off-by Oskar Senft <[email protected]>Signed-off-by Chia-Wei Wang <[email protected]>--- .../bindings/soc/aspeed/uart-routing.yaml | 70+++++++++++++++++++
Quoted 4 lines
1 file changed, 70 insertions(+) create mode 100644
Documentation/devicetree/bindings/soc/aspeed/uart-routing.yamlMy bot found errors running 'make DT_CHECKER_FLAGS=-m
dt_binding_check'
on your patch (DT_CHECKER_FLAGSis new in v5.13):yamllint warnings/errors:
Quoted 7 lines
Quoted 4 lines
dtschema/dtc warnings/errors:
Documentation/devicetree/bindings/soc/aspeed/uart-routing.example.dt.yaml:
0:0: /example-0/lpc at1e789000: failed to match any schema with compatible:
['aspeed,ast2600-lpc-v2', 'simple-mfd', 'syscon']The "aspeed,ast2600-lpc-v2" compatible string is described in the .txt file 'aspeed-lpc.txt'. Do we have to firstly convert the text file into YAML one to resolve this dependency issue?
Yes. This is a significant change to the LPC block binding.
Rob
RE: [PATCH v3 1/3] dt-bindings: aspeed: Add UART routing controller
Quoted 35 lines
From: Rob Herring <[email protected]>
Sent: Friday, September 10, 2021 11:58 PMQuoted 27 lines · ChiaWei Wang
Hi Rob,
Quoted 24 lines
From: Rob Herring <[email protected]>
Sent: Thursday, September 9, 2021 8:33 PMQuoted 6 lines · Chia-Wei Wang
Add dt-bindings for Aspeed UART routing controller.
Signed-off-by Oskar Senft <[email protected]>Signed-off-by Chia-Wei Wang <[email protected]>--- .../bindings/soc/aspeed/uart-routing.yaml | 70+++++++++++++++++++
Quoted 4 lines
1 file changed, 70 insertions(+) create mode 100644
Documentation/devicetree/bindings/soc/aspeed/uart-routing.yamlMy bot found errors running 'make DT_CHECKER_FLAGS=-m
dt_binding_check'
on your patch (DT_CHECKER_FLAGSis new in v5.13):yamllint warnings/errors:
dtschema/dtc warnings/errors:
Documentation/devicetree/bindings/soc/aspeed/uart-routing.example.dt.yaml:Quoted 1 line
Quoted 1 line
0:0: /example-0/lpc at
1e789000: failed to match any schema withcompatible:
Quoted 8 lines
Quoted 3 lines
Quoted 1 line
['aspeed,ast2600-lpc-v2', 'simple-mfd', 'syscon']
The "aspeed,ast2600-lpc-v2" compatible string is described in the .txt file
'aspeed-lpc.txt'.
Quoted 1 line
Do we have to firstly convert the text file into YAML one to resolve this
dependency issue?
Yes. This is a significant change to the LPC block binding.
Understood. Will send a v4 patch which includes the YAML conversion. Thanks.
Chiawei
PATCH v3 2/3 soc: aspeed: Add UART routing support
In reply to Chia-Wei WangAdd driver support for the UART routing control. Users can perform runtime configuration of the RX muxes among the UART controllers and the UART IO pins.
The sysfs interface is also exported for the convenience of routing paths check and update.
--- .../testing/sysfs-driver-aspeed-uart-routing | 15 + drivers/soc/aspeed/Kconfig | 10 + drivers/soc/aspeed/Makefile | 9 +- drivers/soc/aspeed/aspeed-uart-routing.c | 603 ++++++++++++++++++ 4 files changed, 633 insertions(+), 4 deletions(-) create mode 100644 Documentation/ABI/testing/sysfs-driver-aspeed-uart-routing create mode 100644 drivers/soc/aspeed/aspeed-uart-routing.c
Documentation/ABI/testing/sysfs-driver-aspeed-uart-routing new file +15 -0
@@ -0,0 +1,15 @@ +What: /sys/bus/platform/drivers/aspeed-uart-routing/*/uart* +Date: September 2021 +Contact: Chia-Wei Wang <[email protected]> +Description: Selects the RX source of the UARTx device. The current + selection will be marked with the '[]' brackets. +Users: OpenBMC. Proposed changes should be mailed to + openbmc at lists.ozlabs.org + +What: /sys/bus/platform/drivers/aspeed-uart-routing/*/io* +Date: September 2021 +Contact: Chia-Wei Wang <[email protected]> +Description: Selects the RX source of IOx pins. The current selection + will be marked with the '[]' brackets. +Users: OpenBMC. Proposed changes should be mailed to + openbmc at lists.ozlabs.org
drivers/soc/aspeed/Kconfig +10 -0
@@ -24,6 +24,16 @@ config ASPEED_LPC_SNOOP allows the BMC to listen on and save the data written by the host to an arbitrary LPC I/O port. +config ASPEED_UART_ROUTING + tristate "ASPEED uart routing control" + select REGMAP + select MFD_SYSCON + default ARCH_ASPEED + help + Provides a driver to control the UART routing paths, allowing + users to perform runtime configuration of the RX muxes among + the UART controllers and I/O pins. + config ASPEED_P2A_CTRL tristate "ASPEED P2A (VGA MMIO to BMC) bridge control" select REGMAP
drivers/soc/aspeed/Makefile +5 -4
@@ -1,5 +1,6 @@ # 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_SOCINFO) += aspeed-socinfo.o +obj-$(CONFIG_ASPEED_LPC_CTRL) += aspeed-lpc-ctrl.o +obj-$(CONFIG_ASPEED_LPC_SNOOP) += aspeed-lpc-snoop.o +obj-$(CONFIG_ASPEED_UART_ROUTING) += aspeed-uart-routing.o +obj-$(CONFIG_ASPEED_P2A_CTRL) += aspeed-p2a-ctrl.o +obj-$(CONFIG_ASPEED_SOCINFO) += aspeed-socinfo.o
drivers/soc/aspeed/aspeed-uart-routing.c new file +603 -0
603 lines not on this page · raw message
Signature · 1 line
2.17.1
PATCH v3 3/3 ARM: dts: aspeed: Add uart routing to device tree
In reply to Chia-Wei WangAdd LPC uart routing to the device tree for Aspeed SoCs.
--- arch/arm/boot/dts/aspeed-g4.dtsi | 6 ++++++ arch/arm/boot/dts/aspeed-g5.dtsi | 6 ++++++ arch/arm/boot/dts/aspeed-g6.dtsi | 6 ++++++ 3 files changed, 18 insertions(+)
arch/arm/boot/dts/aspeed-g4.dtsi +6 -0
@@ -383,6 +383,12 @@ interrupts = <8>; 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
@@ -491,6 +491,12 @@ #reset-cells = <1>; }; + uart_routing: uart-routing at 9c { + compatible = "aspeed,ast2500-uart-routing"; + reg = <0x9c 0x4>; + status = "disabled"; + }; + lhc: lhc at a0 { compatible = "aspeed,ast2500-lhc"; reg = <0xa0 0x24 0xc8 0x8>;
arch/arm/boot/dts/aspeed-g6.dtsi +6 -0
@@ -551,6 +551,12 @@ #reset-cells = <1>; }; + uart_routing: uart-routing at 98 { + compatible = "aspeed,ast2600-uart-routing"; + reg = <0x98 0x8>; + status = "disabled"; + }; + ibt: ibt at 140 { compatible = "aspeed,ast2600-ibt-bmc"; reg = <0x140 0x18>;
Signature · 1 line
2.17.1