serial/arc-uart: Add new driver
Subsystems (2)
PATCH v2 1/1 serial/arc-uart: Add new driver
From: Vineet Gupta <[email protected]>
Driver for non-standard on-chip UART, instantiated in the ARC (Synopsys) FPGA Boards such as ARCAngel4/ML50x
v2:
* ttyARC used as device name
* Dynamic assignment of major/minor numbers.
* Ref counting tty in rx routine to prevent it from disappearing in case of a hangup
* set_termios fixes:
- hardware flow control/parity are marked as unsupported
- baud written back to termios
* cosmetics such as commenting the need for @running_on_iss, empty lines etc
--- drivers/tty/serial/Kconfig | 25 ++ drivers/tty/serial/Makefile | 1 + drivers/tty/serial/arc_uart.c | 746 +++++++++++++++++++++++++++++++++++++++++ include/linux/serial_core.h | 3 + 4 files changed, 775 insertions(+), 0 deletions(-) create mode 100644 drivers/tty/serial/arc_uart.c
drivers/tty/serial/Kconfig +25 -0
@@ -1360,4 +1360,29 @@ config SERIAL_EFM32_UART_CONSOLE depends on SERIAL_EFM32_UART=y select SERIAL_CORE_CONSOLE +config SERIAL_ARC + bool "ARC UART driver support" + select SERIAL_CORE + default y + help + Driver for on-chip UART for ARC(Synopsys) for the legacy + FPGA Boards (ML50x/ARCAngel4) + +config SERIAL_ARC_CONSOLE + bool + select SERIAL_CORE_CONSOLE + depends on SERIAL_ARC=y + default y + help + Enable system Console on ARC UART + +config SERIAL_ARC_NR_PORTS + int 'Number of ports' + range 1 3 + default 1 + depends on SERIAL_ARC + help + Set this to the number of serial ports you want the driver + to support. + endmenu
drivers/tty/serial/Makefile +1 -0
@@ -79,3 +79,4 @@ obj-$(CONFIG_SERIAL_XILINX_PS_UART) += xilinx_uartps.o obj-$(CONFIG_SERIAL_SIRFSOC) += sirfsoc_uart.o obj-$(CONFIG_SERIAL_AR933X) += ar933x_uart.o obj-$(CONFIG_SERIAL_EFM32_UART) += efm32-uart.o +obj-$(CONFIG_SERIAL_ARC) += arc_uart.o
drivers/tty/serial/arc_uart.c new file +746 -0
746 lines not on this page · raw message
include/linux/serial_core.h +3 -0
@@ -214,6 +214,9 @@/* Energy Micro efm32 SoC */ #define PORT_EFMUART 100 +/* ARC (Synopsys) on-chip UART */ +#define PORT_ARC 101 +#ifdef __KERNEL__#include <linux/compiler.h>
Signature · 1 line
1.7.4.1
Quoted 2 lines
+/* Is this for UART emulation on ARC Instruction Set Simulator (ISS) */ +int __attribute__((weak))
running_on_iss;
Why not pass a quirks field in your platform data instead - much cleaner than a global.
drivers/tty/serial/arc_uart.c line 383
Quoted 3 lines
drivers/tty/serial/arc_uart.c new file +3
-0+static void arc_serial_set_ldisc (struct uart_port *port,int ld) +{ +}
If you don't need it just remove this one
drivers/tty/serial/arc_uart.c line 426
Quoted 1 line
drivers/tty/serial/arc_uart.c new file +1
-0+ new->c_cflag &= ~(CMSPAR |CRTSCTS );
also force the CSIZE bits to CS8 if you only do 8N1.
Alan
Quoted 4 lines · Alan Cox
Quoted 2 lines
+/* Is this for UART emulation on ARC Instruction Set Simulator (ISS) */ +int __attribute__((weak))
running_on_iss;Why not pass a quirks field in your platform data instead - much cleaner than a global.
I'd thought about it too. However the platform data is retrieved in arc_uart_init_one() while it's usage in arc_serial_set_termios() will be in a different call chain, meaning this info will have to be anyways saved in "some" data structure - probably within struct arc_uart_port - and that too per port - which is not clean either. However if you strongly feel that the global is a must go - I can rework it that way.
thx,
-Vineet