Aspeed UART routing driver
Hi
As discussed with Andrew, we have a use case that requires the UART routing on the AST2500 to be configured at runtime.
After talking with Linus Walleij, we concluded that the pinmux driver is not a good match for this use case.
I went ahead and implemented a "UART routing control driver" for the AST2500. It may just work on the AST2400 as is, but I don't have a system to test on.
Thanks
Oskar.
PATCH 1/2 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.
--- .../stable/sysfs-driver-aspeed-uart-routing | 14 + .../misc-devices/aspeed-uart-routing.txt | 49 +++ drivers/misc/Kconfig | 10 + drivers/misc/Makefile | 1 + drivers/misc/aspeed-uart-routing.c | 384 ++++++++++++++++++ 5 files changed, 458 insertions(+) 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/misc/aspeed-uart-routing.c
Documentation/ABI/stable/sysfs-driver-aspeed-uart-routing new file +14 -0
@@ -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 +49 -0
49 lines not on this page · raw message
drivers/misc/Kconfig +10 -0
@@ -501,6 +501,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 ast2500 UART routing control" + depends on (ARCH_ASPEED || COMPILE_TEST) + help + Provides a driver to configure UART routing on Aspeed BMC platforms + at runtime through sysfs. 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. + config PCI_ENDPOINT_TEST depends on PCI select CRC32
drivers/misc/Makefile +1 -0
@@ -55,6 +55,7 @@ obj-$(CONFIG_VEXPRESS_SYSCFG) += vexpress-syscfg.o obj-$(CONFIG_CXL_BASE) += cxl/ 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_PCI_ENDPOINT_TEST) += pci_endpoint_test.o obj-$(CONFIG_OCXL) += ocxl/ obj-$(CONFIG_MISC_RTSX) += cardreader/
drivers/misc/aspeed-uart-routing.c new file +384 -0
384 lines not on this page · raw message
Signature · 1 line
2.19.0.rc1.350.ge57e33dbd1-goog
PATCH 1/2 misc: aspeed: Add Aspeed UART routing control driver.
Quoted 9 lines · Oskar Senft
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.
Signed-off-by Oskar Senft <[email protected]>
After reading some other messages about this I realize it's not very much you can do with the standard frameworks and you definately need something like this. Not like I have any better idea.
Arnd and Greg are misc maintainers so not you will need to talk to them.
I would opt to put it in drivers/soc/aspeed though.
Yours,
Linus Walleij
PATCH 1/2 misc: aspeed: Add Aspeed UART routing control driver.
Quoted 10 lines · Linus Walleij
Quoted 8 lines · Oskar Senft
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.
Quoted 8 lines
Quoted 1 line
Signed-off-by Oskar Senft <[email protected]>After reading some other messages about this I realize it's not very much you can do with the standard frameworks and you definately need something like this. Not like I have any better idea.
Arnd and Greg are misc maintainers so not you will need to talk to them.
Yes. I'm certainly not a person that can merge them.
Oskar: Please add at least Greg and Arnd as Linus suggests, and in the future make use of ./scripts/get_maintainer.pl to identify people and lists who should receive the patches.
Quoted 2 lines
I would opt to put it in
drivers/soc/aspeedthough.
Yep, drivers/soc/aspeed seems like a better place. There are other drivers in misc likely should be moved there as well.
Thanks for your feedback Linus.
Andrew
PATCH 1/2 misc: aspeed: Add Aspeed UART routing control driver.
Thanks for the input!
I had a look at get_maintainer.pl, but thought I'd send it to you and Linus first to get initial input since we had already talked about it.
I'll move it to drivers/soc/aspeed and will resend.
For clarification: Should I send to ALL of the people and lists that get_maintainer.pl spits out?
Thanks
Oskar.
Quoted 27 lines · Andrew Jeffery
Quoted 10 lines · Linus Walleij
Quoted 8 lines · Oskar Senft
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.
Quoted 8 lines
Quoted 1 line
Signed-off-by Oskar Senft <[email protected]>After reading some other messages about this I realize it's not very much you can do with the standard frameworks and you definately need something like this. Not like I have any better idea.
Arnd and Greg are misc maintainers so not you will need to talk to them.
Yes. I'm certainly not a person that can merge them.
Oskar: Please add at least Greg and Arnd as Linus suggests, and in the future make use of
./scripts/get_maintainer.plto identify people and lists who should receive the patches.Quoted 1 line
Quoted 9 lines
Quoted 1 line
I would opt to put it in
drivers/soc/aspeedthough.Yep,
drivers/soc/aspeedseems like a better place. There are other drivers in misc likely should be moved there as well.Thanks for your feedback Linus.
Andrew
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ozlabs.org/pipermail/linux-aspeed/attachments/20180904/f4f51d53/attachment-0001.html>
PATCH 1/2 misc: aspeed: Add Aspeed UART routing control driver.
Quoted 1 line · Oskar Senft
For clarification: Should I send to ALL of the people and lists that get_maintainer.pl spits out?
It's more like a suggestion. Definately the names coming from MAINTAINERS, the rest is "good to have". If it becomes too many just strip some off randomly, or look who changed the file(s) most recently.
Yours,
Linus Walleij
PATCH 1/2 misc: aspeed: Add Aspeed UART routing control driver.
In reply to Oskar SenftI just had a look at the upstream kernel - there's no drivers/soc/aspeed. I did find drivers/soc, but no subdirectory for aspeed. Should I create that with my commit?
Oskar.
Quoted 7 lines · Oskar Senft
Thanks for the input!
I had a look at get_maintainer.pl, but thought I'd send it to you and Linus first to get initial input since we had already talked about it.
I'll move it to
drivers/soc/aspeedand will resend.
Quoted 46 lines
For clarification: Should I send to ALL of the people and lists that get_maintainer.pl spits out?
Thanks
Oskar.Quoted 37 lines · Andrew Jeffery
Quoted 8 lines · Linus Walleij
Quoted 6 lines · Oskar Senft
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
Quoted 10 lines
Quoted 3 lines
the other UARTs wired up in a testable way.
Signed-off-by Oskar Senft <[email protected]>After reading some other messages about this I realize it's not very much you can do with the standard frameworks and you definately need something like this. Not like I have any better idea.
Arnd and Greg are misc maintainers so not you will need to talk to them.
Yes. I'm certainly not a person that can merge them.
Oskar: Please add at least Greg and Arnd as Linus suggests, and in the future make use of
./scripts/get_maintainer.plto identify people and lists who should receive the patches.Quoted 2 lines
I would opt to put it in
drivers/soc/aspeedthough.Yep,
drivers/soc/aspeedseems like a better place. There are other drivers in misc likely should be moved there as well.Thanks for your feedback Linus.
Andrew
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ozlabs.org/pipermail/linux-aspeed/attachments/20180905/4c4250e1/attachment-0001.html>
PATCH 1/2 misc: aspeed: Add Aspeed UART routing control driver.
Quoted 3 lines · Oskar Senft
I just had a look at the upstream kernel - there's no
drivers/soc/aspeed. I did finddrivers/soc, but no subdirectory for aspeed. Should I create that with my commit?
Yeah just do it, someone has to be the first.
Yours,
Linus Walleij
PATCH 2/2 arch: arm: boot: dts: aspeed: Add UART routing driver to Aspeed G5 DTS.
In reply to Oskar Senft--- .../bindings/misc/aspeed,uart-routing.txt | 22 +++++++++++++++++++ arch/arm/boot/dts/aspeed-g5.dtsi | 6 +++++ 2 files changed, 28 insertions(+) create mode 100644 Documentation/devicetree/bindings/misc/aspeed,uart-routing.txt
Documentation/devicetree/bindings/misc/aspeed,uart-routing.txt new file +22 -0
@@ -0,0 +1,22 @@ +* ASPEED AST2500 UART routing + +This file describes the bindings for the UART routing selector present +in the AST2500 BMC SoC. + +The Aspeed AST2500 allows 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. + +Required properties: +- reg: address and length of the register for the device. +- compatible: "aspeed,ast2500-cvic" + +Example: + + uart_routing: uart_routing at 1e78909c { + compatible = "aspeed,ast2500-uart-routing"; + reg = <0x1e78909c 0x4>; + };
arch/arm/boot/dts/aspeed-g5.dtsi +6 -0
@@ -375,6 +375,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.19.0.rc1.350.ge57e33dbd1-goog