serial: 8250_tegra: Create Tegra specific 8250 driver
Subsystems (2)
Jon Hunter
maintainerPATCH v3 1/1 serial: 8250_tegra: Create Tegra specific 8250 driver
From: Jeff Brasen <[email protected]>
To support booting NVIDIA Tegra platforms with either Device-Tree or ACPI, create a Tegra specific 8250 serial driver that supports both firmware types. Another benefit from doing this, is that the Tegra specific codec in the generic Open Firmware 8250 driver can now be removed.
Signed-off-by Jeff Brasen <[email protected]>
Signed-off-by Jon Hunter <[email protected]>
---
Changes since V2:
- Added missing header for devm_ioremap (reported by kbuild test robot) Changes since V1:
- Added support for COMPILE_TEST
drivers/tty/serial/8250/8250_of.c | 28 ---- drivers/tty/serial/8250/8250_tegra.c | 198 +++++++++++++++++++++++++++ drivers/tty/serial/8250/Kconfig | 9 ++ drivers/tty/serial/8250/Makefile | 1 + 4 files changed, 208 insertions(+), 28 deletions(-) create mode 100644 drivers/tty/serial/8250/8250_tegra.c
drivers/tty/serial/8250/8250_of.c +0 -28
@@ -7,7 +7,6 @@#include <linux/console.h> #include <linux/module.h> #include <linux/slab.h> -#include <linux/delay.h> #include <linux/serial_core.h> #include <linux/serial_reg.h> #include <linux/of_address.h>
@@ -26,28 +25,6 @@ struct of_serial_info {int line; }; -#ifdef CONFIG_ARCH_TEGRA -static void tegra_serial_handle_break (struct uart_port *p) -{ -unsigned int status, tmout =10000 ; - -do { - status = p->serial_in (p,UART_LSR ); -if (status & (UART_LSR_FIFOE |UART_LSR_BRK_ERROR_BITS )) - status = p->serial_in (p,UART_RX ); -else -break ; -if (--tmout ==0 ) -break ; -udelay (1 ); - }while (1 ); -} -#else -static inline void tegra_serial_handle_break (struct uart_port *port) -{ -} -#endif -static int of_8250_rs485_config (struct uart_port *port,struct serial_rs485 *rs485) {
@@ -211,10 +188,6 @@ static int of_platform_serial_setup(struct platform_device *ofdev, port->rs485_config = of_8250_rs485_config;switch (type) { -case PORT_TEGRA : - port->handle_break = tegra_serial_handle_break; -break ; -case PORT_RT2880 : port->iotype =UPIO_AU ;break ;
@@ -359,7 +332,6 @@ static const struct of_device_id of_platform_serial_table[] = { { .compatible = "ns16550", .data = (void *)PORT_16550, }, { .compatible = "ns16750", .data = (void *)PORT_16750, }, { .compatible = "ns16850", .data = (void *)PORT_16850, }, - { .compatible = "nvidia,tegra20-uart", .data = (void *)PORT_TEGRA, }, { .compatible = "nxp,lpc3220-uart", .data = (void *)PORT_LPC3220, }, { .compatible = "ralink,rt2880-uart", .data = (void *)PORT_RT2880, }, { .compatible = "intel,xscale-uart", .data = (void *)PORT_XSCALE, },
drivers/tty/serial/8250/8250_tegra.c new file +198 -0
198 lines not on this page · raw message
drivers/tty/serial/8250/Kconfig +9 -0
@@ -500,6 +500,15 @@ config SERIAL_8250_PXA applicable to both devicetree and legacy boards, and early console is part of its support. +config SERIAL_8250_TEGRA + tristate "8250 support for Tegra serial ports" + default SERIAL_8250 + depends on SERIAL_8250 + depends on ARCH_TEGRA || COMPILE_TEST + help + Select this option if you have machine with an NVIDIA Tegra SoC and + wish to enable 8250 serial driver for the Tegra serial interfaces. + config SERIAL_OF_PLATFORM tristate "Devicetree based probing for 8250 ports" depends on SERIAL_8250 && OF
drivers/tty/serial/8250/Makefile +1 -0
@@ -37,6 +37,7 @@ obj-$(CONFIG_SERIAL_8250_INGENIC) += 8250_ingenic.o obj-$(CONFIG_SERIAL_8250_LPSS) += 8250_lpss.o obj-$(CONFIG_SERIAL_8250_MID) += 8250_mid.o obj-$(CONFIG_SERIAL_8250_PXA) += 8250_pxa.o +obj-$(CONFIG_SERIAL_8250_TEGRA) += 8250_tegra.o obj-$(CONFIG_SERIAL_OF_PLATFORM) += 8250_of.o CFLAGS_8250_ingenic.o += -I$(srctree)/scripts/dtc/libfdt
Signature · 1 line
2.17.1
29.01.2020 16:28, Jon Hunter пишет:
...
drivers/tty/serial/8250/8250_tegra.c line 140
Quoted 3 lines
drivers/tty/serial/8250/8250_tegra.c new file +3
-0+#ifdef CONFIG_PM_SLEEP +static int tegra_uart_suspend (struct device *dev) +{
Nit: the ifdef'ing in the code could be avoided by using the __maybe_unused attribute.