serial: tegra: add serial driver
Subsystems (4)
Laxman Dewangan
maintainerPATCH v2 1/1 serial: tegra: add serial driver
Nvidia's Tegra has multiple uart controller which supports:
- APB dma based controller fifo read/write.
- End Of Data interrupt in incoming data to know whether end of frame achieve or not.
- Hw controlled RTS and CTS flow control to reduce SW overhead.
Add serial driver to use all above feature.
---
Changes from V1:
- Remove port-number parameter and use the of_alias_get().
- put the ref count for the tty.
- rename the bindng document file to serial-tegra.txt to match with driver name.
- Remove falsy introduced line from Kconfig.
- Move platform data file to linux/platfor_data. Not removing the platform datacompletely now. if it is requie to remove the will be remove later along with other tegra driver also.
- Simplify tegra_uart_set_mctrl
- Clear flag for CMSPAR as driver dose not support this.
- Modify uart_get_baud_rate() to use actual baudrate.
- reorder compatibles in documentation file.
- used of_property_read_bool for modem interrupt.
- remove check if (pdev->dev.of_node) as it si always true.
- Drop devinit and devexit compiler option.
- nit cleanups for moving struture to the usage area.
.../devicetree/bindings/serial/serial-tegra.txt | 24 + drivers/tty/serial/Kconfig | 11 + drivers/tty/serial/Makefile | 1 + drivers/tty/serial/serial-tegra.c | 1407 ++++++++++++++++++++ include/linux/platform_data/serial-tegra.h | 37 + 5 files changed, 1480 insertions(+), 0 deletions(-) create mode 100644 Documentation/devicetree/bindings/serial/serial-tegra.txt create mode 100644 drivers/tty/serial/serial-tegra.c create mode 100644 include/linux/platform_data/serial-tegra.h
Documentation/devicetree/bindings/serial/serial-tegra.txt new file +24 -0
@@ -0,0 +1,24 @@ +NVIDIA Tegra20/Tegra30 high speed (dma based) UART controller driver. + +Required properties: +- compatible : should be "nvidia,tegra30-hsuart", "nvidia,tegra20-hsuart". +- reg: Should contain UART controller registers location and length. +- interrupts: Should contain UART controller interrupts. +- nvidia,dma-request-selector : The Tegra DMA controller's phandle and + request selector for this UART controller. + +Optional properties: +- nvidia,enable-modem-interrupt: Enable modem interrupts. Should be enable + only if all 8 lines of uart controller are pinmuxed. + +Example: + +serial@70006000 { + compatible = "nvidia,tegra30-hsuart", "nvidia,tegra20-hsuart"; + reg = <0x70006000 0x40>; + reg-shift = <2>; + interrupts = <0 36 0x04>; + nvidia,dma-request-selector = <&apbdma 8>; + nvidia,enable-modem-interrupt; + status = "disabled"; +};
drivers/tty/serial/Kconfig +11 -0
@@ -269,6 +269,17 @@ config SERIAL_SIRFSOC_CONSOLE your boot loader about how to pass options to the kernel at boot time.) +config SERIAL_TEGRA + tristate "Nvidia Tegra20/30 SoC serial controller" + depends on ARCH_TEGRA && TEGRA20_APB_DMA + select SERIAL_CORE + help + Support for the on-chip UARTs on the Nvidia Tegra seria SOCs + providing /dev/ttyHS0, 1, 2, 3 and 4 (note, some machines may not + provide all of these ports, depending on how the serial port + are enabled). This driver uses the APB dma to achieve higher baudrate + and better performance. + config SERIAL_MAX3100 tristate "MAX3100 support" depends on SPI
drivers/tty/serial/Makefile +1 -0
@@ -80,6 +80,7 @@ obj-$(CONFIG_SERIAL_MXS_AUART) += mxs-auart.o obj-$(CONFIG_SERIAL_LANTIQ) += lantiq.o obj-$(CONFIG_SERIAL_XILINX_PS_UART) += xilinx_uartps.o obj-$(CONFIG_SERIAL_SIRFSOC) += sirfsoc_uart.o +obj-$(CONFIG_SERIAL_TEGRA) += serial-tegra.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/serial-tegra.c new file +1407 -0
1,407 lines not on this page · raw message
include/linux/platform_data/serial-tegra.h new file +37 -0
@@ -0,0 +1,37 @@ +/* +* serial_tegra.h +* +* Interface for High-speed serial driver for NVIDIA Tegra SoCs. +* +* Copyright (c) 2012, NVIDIA CORPORATION. All rights reserved. +* +* Author: Laxman Dewangan <[email protected]> +* +* This program is free software; you can redistribute it and/or modify it +* under the terms and conditions of the GNU General Public License, +* version 2, as published by the Free Software Foundation. +* +* This program is distributed in the hope it will be useful, but WITHOUT +* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +* more details. +* +* You should have received a copy of the GNU General Public License +* along with this program. If not, see <http://www.gnu.org/licenses/>. +*/ + +#ifndef _SERIAL_TEGRA_H_ +#define _SERIAL_TEGRA_H_ + +/** +* struct tegra_uart_platform_data: Platform data for tegra serial driver. +* @dma_req_sel: DMA requestor slave id. +* @enable_modem_interrupt: enable modem interrupt or not. +*/ +struct tegra_uart_platform_data { +bool enable_modem_interrupt; +int dma_req_sel; +}; + +#endif /* _SERIAL_TEGRA_H_ */ +
Signature · 1 line
1.7.1.1
Quoted 9 lines · On Tue, 18 Dec 2012 12:29:53 +0530 Laxman Dewangan <[email protected]> wrote:
Nvidia's Tegra has multiple uart controller which supports:
- APB dma based controller fifo read/write.
- End Of Data interrupt in incoming data to know whether end of frame achieve or not.
- Hw controlled RTS and CTS flow control to reduce SW overhead.Add serial driver to use all above feature.
Signed-off-by Laxman Dewangan <[email protected]>
Quoted 1 line · Laxman Dewangan
Nvidia's Tegra has multiple uart controller which supports:
A few nits:
That should be NVIDIA.
Quoted 1 line
.../devicetree/bindings/serial/serial-tegra.txt | 24 +
I strongly object to this name; I believe nvidia,tegra20-hsuart.txt is correct.
Quoted 1 line
+NVIDIA Tegra20/Tegra30 high speed (dma based) UART controller driver.
DMA, UART (below), ... should be all capitals.
The binding looks reasonable to me. The few parts of the code I looked at look OK.
include/linux/platform_data/serial-tegra.h line 37
Quoted 3 lines
include/linux/platform_data/serial-tegra.h +2
-0+#endif /* _SERIAL_TEGRA_H_ */ +
There's a blank line at the end of the file.