Re: [PATCH V2] serial: tegra: add serial driver

2012-12-18 Thread Stephen Warren
On 12/17/2012 11:59 PM, Laxman Dewangan wrote:
> Nvidia's Tegra has multiple uart controller which supports:

A few nits:

That should be NVIDIA.

>  .../devicetree/bindings/serial/serial-tegra.txt|   24 +

I strongly object to this name; I believe nvidia,tegra20-hsuart.txt is
correct.

> +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.

> diff --git a/include/linux/platform_data/serial-tegra.h 
> b/include/linux/platform_data/serial-tegra.h
> +#endif /* _SERIAL_TEGRA_H_ */
> +

There's a blank line at the end of the file.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH V2] serial: tegra: add serial driver

2012-12-18 Thread Alan Cox
On Tue, 18 Dec 2012 12:29:53 +0530
Laxman Dewangan  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 

Acked-by: Alan Cox 
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH V2] serial: tegra: add serial driver

2012-12-18 Thread Alan Cox
On Tue, 18 Dec 2012 12:29:53 +0530
Laxman Dewangan ldewan...@nvidia.com 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 ldewan...@nvidia.com

Acked-by: Alan Cox a...@linux.intel.com
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH V2] serial: tegra: add serial driver

2012-12-18 Thread Stephen Warren
On 12/17/2012 11:59 PM, Laxman Dewangan wrote:
 Nvidia's Tegra has multiple uart controller which supports:

A few nits:

That should be NVIDIA.

  .../devicetree/bindings/serial/serial-tegra.txt|   24 +

I strongly object to this name; I believe nvidia,tegra20-hsuart.txt is
correct.

 +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.

 diff --git a/include/linux/platform_data/serial-tegra.h 
 b/include/linux/platform_data/serial-tegra.h
 +#endif /* _SERIAL_TEGRA_H_ */
 +

There's a blank line at the end of the file.
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH V2] serial: tegra: add serial driver

2012-12-17 Thread Laxman Dewangan
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 
---
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

diff --git a/Documentation/devicetree/bindings/serial/serial-tegra.txt 
b/Documentation/devicetree/bindings/serial/serial-tegra.txt
new file mode 100644
index 000..8b20248
--- /dev/null
+++ b/Documentation/devicetree/bindings/serial/serial-tegra.txt
@@ -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 = < 8>;
+   nvidia,enable-modem-interrupt;
+   status = "disabled";
+};
diff --git a/drivers/tty/serial/Kconfig b/drivers/tty/serial/Kconfig
index 59c23d0..366631c 100644
--- a/drivers/tty/serial/Kconfig
+++ b/drivers/tty/serial/Kconfig
@@ -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
diff --git a/drivers/tty/serial/Makefile b/drivers/tty/serial/Makefile
index df1b998..82e4306 100644
--- a/drivers/tty/serial/Makefile
+++ b/drivers/tty/serial/Makefile
@@ -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
diff --git a/drivers/tty/serial/serial-tegra.c 
b/drivers/tty/serial/serial-tegra.c
new file mode 100644
index 000..0b7efb3
--- /dev/null
+++ b/drivers/tty/serial/serial-tegra.c
@@ -0,0 +1,1407 @@
+/*
+ * serial_tegra.c
+ *
+ * High-speed serial driver for NVIDIA Tegra SoCs
+ *
+ * Copyright (c) 2012, NVIDIA CORPORATION.  All rights reserved.
+ *
+ * Author: Laxman Dewangan 
+ *
+ * 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 

[PATCH V2] serial: tegra: add serial driver

2012-12-17 Thread Laxman Dewangan
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 ldewan...@nvidia.com
---
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

diff --git a/Documentation/devicetree/bindings/serial/serial-tegra.txt 
b/Documentation/devicetree/bindings/serial/serial-tegra.txt
new file mode 100644
index 000..8b20248
--- /dev/null
+++ b/Documentation/devicetree/bindings/serial/serial-tegra.txt
@@ -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;
+};
diff --git a/drivers/tty/serial/Kconfig b/drivers/tty/serial/Kconfig
index 59c23d0..366631c 100644
--- a/drivers/tty/serial/Kconfig
+++ b/drivers/tty/serial/Kconfig
@@ -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
diff --git a/drivers/tty/serial/Makefile b/drivers/tty/serial/Makefile
index df1b998..82e4306 100644
--- a/drivers/tty/serial/Makefile
+++ b/drivers/tty/serial/Makefile
@@ -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
diff --git a/drivers/tty/serial/serial-tegra.c 
b/drivers/tty/serial/serial-tegra.c
new file mode 100644
index 000..0b7efb3
--- /dev/null
+++ b/drivers/tty/serial/serial-tegra.c
@@ -0,0 +1,1407 @@
+/*
+ * serial_tegra.c
+ *
+ * High-speed serial driver for NVIDIA Tegra SoCs
+ *
+ * Copyright (c) 2012, NVIDIA CORPORATION.  All rights reserved.
+ *
+ * Author: Laxman Dewangan ldewan...@nvidia.com
+ *
+ * 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