serial: 8250_tegra: Create Tegra specific 8250 driver
Subsystems (2)
Jon Hunter
maintainerPATCH 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.
--- drivers/tty/serial/8250/8250_of.c | 28 ---- drivers/tty/serial/8250/8250_tegra.c | 197 +++++++++++++++++++++++++++ drivers/tty/serial/8250/Kconfig | 9 ++ drivers/tty/serial/8250/Makefile | 1 + 4 files changed, 207 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 +197 -0
197 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 + 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
Greg Kroah-Hartman
maintainerdrivers/tty/serial/8250/Kconfig config SERIAL_8250_PXA · line 507
Quoted 13 lines · Jon Hunter
drivers/tty/serial/8250/Kconfig +5
-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
No COMPILE_TEST support so we can make sure we don't break the thing somehow?
thanks,
greg k-h
Jon Hunter
maintainerQuoted 9 lines · Greg Kroah-Hartman
Quoted 8 lines · Jon Hunter
drivers/tty/serial/8250/Kconfig +0
-0@@ -500,6 +500,15 @@ config SERIAL_8250_PXA applicable to both devicetree and legacy boards, and early console is part of its support.
Quoted 8 lines
drivers/tty/serial/8250/Kconfig config SERIAL_8250_PXA · line 507
Quoted 5 lines
drivers/tty/serial/8250/Kconfig +5
-0+config SERIAL_8250_TEGRA + tristate "8250 support for Tegra serial ports" + default SERIAL_8250 + depends on SERIAL_8250 + depends on ARCH_TEGRANo
COMPILE_TESTsupport so we can make sure we don't break the thing somehow?
Good point. Will add.
Thanks
Jon
Signature · 1 line
nvpublic
Hello Jon,
20.01.2020 19:01, Jon Hunter пишет:
[snip]
drivers/tty/serial/8250/8250_tegra.c line 81
Quoted 6 lines
drivers/tty/serial/8250/8250_tegra.c new file +6
-0+ res =platform_get_resource (pdev,IORESOURCE_MEM ,0 ); +if (!res) +return -ENODEV ; + + port->membase =devm_ioremap (&pdev->dev, res->start, +resource_size (res));
devm_platform_ioremap_resource()
drivers/tty/serial/8250/8250_tegra.c line 88
Quoted 7 lines
drivers/tty/serial/8250/8250_tegra.c new file +7
-0+if (!port->membase) +return -ENOMEM ; + + port->mapbase = res->start; + port->mapsize =resource_size (res); + + uart->rst =devm_reset_control_get_optional_shared (&pdev->dev,NULL );
Why reset is shared? It shall not be shared at least on T20/30/124/210..
[snip]
21.01.2020 19:31, Dmitry Osipenko пишет:
Quoted 25 lines
Hello Jon,
20.01.2020 19:01, Jon Hunter пишет:
[snip]
drivers/tty/serial/8250/8250_tegra.c line 81
Quoted 6 lines
drivers/tty/serial/8250/8250_tegra.c new file +6
-0+ res =platform_get_resource (pdev,IORESOURCE_MEM ,0 ); +if (!res) +return -ENODEV ; + + port->membase =devm_ioremap (&pdev->dev, res->start, +resource_size (res));
devm_platform_ioremap_resource()drivers/tty/serial/8250/8250_tegra.c line 88
Quoted 7 lines
drivers/tty/serial/8250/8250_tegra.c new file +7
-0+if (!port->membase) +return -ENOMEM ; + + port->mapbase = res->start; + port->mapsize =resource_size (res); + + uart->rst =devm_reset_control_get_optional_shared (&pdev->dev,NULL );Why reset is shared? It shall not be shared at least on T20/30/124/210..
Quoted 2 lines
[snip]
Actually, looks like use of a shared reset for a not-really-shared reset should be fine.
Jon Hunter
maintainerQuoted 6 lines · Dmitry Osipenko
Hello Jon,
20.01.2020 19:01, Jon Hunter пишет:
[snip]
Quoted 8 lines
drivers/tty/serial/8250/8250_tegra.c line 81
Quoted 6 lines
drivers/tty/serial/8250/8250_tegra.c new file +6
-0+ res =platform_get_resource (pdev,IORESOURCE_MEM ,0 ); +if (!res) +return -ENODEV ; + + port->membase =devm_ioremap (&pdev->dev, res->start, +resource_size (res));
devm_platform_ioremap_resource()
That would be ideal, but we cannot. The driver needs the res structure as well later on.
Jon
Signature · 1 line
nvpublic
21.01.2020 21:34, Jon Hunter пишет:
Quoted 17 lines · Dmitry Osipenko
Quoted 6 lines
Hello Jon,
20.01.2020 19:01, Jon Hunter пишет:
[snip]
Quoted 8 lines
drivers/tty/serial/8250/8250_tegra.c line 81
Quoted 6 lines
drivers/tty/serial/8250/8250_tegra.c new file +6
-0+ res =platform_get_resource (pdev,IORESOURCE_MEM ,0 ); +if (!res) +return -ENODEV ; + + port->membase =devm_ioremap (&pdev->dev, res->start, +resource_size (res));
devm_platform_ioremap_resource()
Quoted 2 lines
That would be ideal, but we cannot. The driver needs the res structure as well later on.
Oh, indeed.