Re: [PATCH] tty: serial: Add initial MSM UART High Speed Lite driver

2013-07-17 Thread Ivan T. Ivanov

Hi Kumar,

On Tue, 2013-07-16 at 15:17 -0500, Kumar Gala wrote:
> On Jul 1, 2013, at 4:11 AM, Ivan T. Ivanov wrote:
> 
> > From: "Ivan T. Ivanov" 
> > 
> > This is a tty driver with console support for Qualcomm's UART
> > controllers found in the MSM8974 chipsets. Driver is completely
> > based on implementation found in codeaurora.org msm_serial_hs_lite
> > with Android dependences removed. Other changes include, moved to
> > device managed resources and few cleanups.
> > 
> > Driver functionality was tested in LEGACY_HSUART mode.
> > 
> > Signed-off-by: Ivan T. Ivanov 
> > ---
> > .../bindings/tty/serial/msm_serial_hsl.txt |   52 +
> > drivers/tty/serial/Kconfig |   18 +
> > drivers/tty/serial/Makefile|1 +
> > drivers/tty/serial/msm_serial_hsl.c| 1399 
> > 
> > drivers/tty/serial/msm_serial_hsl.h|  294 
> > 5 files changed, 1764 insertions(+)
> > create mode 100644 
> > Documentation/devicetree/bindings/tty/serial/msm_serial_hsl.txt
> > create mode 100644 drivers/tty/serial/msm_serial_hsl.c
> > create mode 100644 drivers/tty/serial/msm_serial_hsl.h
> > 
> > diff --git 
> > a/Documentation/devicetree/bindings/tty/serial/msm_serial_hsl.txt 
> > b/Documentation/devicetree/bindings/tty/serial/msm_serial_hsl.txt
> > new file mode 100644
> > index 000..972552f
> > --- /dev/null
> > +++ b/Documentation/devicetree/bindings/tty/serial/msm_serial_hsl.txt
> > @@ -0,0 +1,52 @@
> > +* Qualcomm MSM HSUART Lite
> > +
> > +Required properties:
> > +- compatible :
> > +   "qcom,msm-lsuart-v14" to be used for UARTDM Core v1.4
> 
> If its really v1.4 than the string should be "qcom,msm-lsuart-v1.4"

I am not sure which is the right number here. codeaurora code uses v14 
string for compatible name and 1.4 here and there in the comments. 
I am inclined to believe that 1.4 is true.

> 
> > +
> > +- reg :
> > +   offset and length of the register set for both the device,
> > +   UART core and GBSI core
> > +
> > +- reg-names :
> > +   "uart_mem" to be used as name of the UART core
> > +   "gbsi_mem" to be used as name of the GBSI core
> > +
> > +The registers for the "qcom,msm-lsuart-v14" device have specify
> > +UART core block. GSBI reg is optional if specified driver will use
> > +GSBI specific functionality.
> > +
> > +- interrupts : interrupts for UART core
> > +
> > +- clocks : Must contain an entry for each entry in clock-names.
> > +
> > +- clock-names : Must include the following entries:
> > +  "core_clk" - mandatory
> > +  "iface_clk" - optional
> > +
> > +For details see:
> > +Documentation/devicetree/bindings/clock/clock-bindings.txt
> > +
> > +Example:
> > +
> > +   serial@f991e000 {
> > +   compatible = "qcom,msm-lsuart-v14";
> > +   reg = <0xf991e000 0x1000>;
> > +   reg-names = "uart_mem";
> > +   interrupts = <0 108 0>;
> > +   clocks = <&blsp1_uart2_apps_cxc>, <&blsp1_ahb_cxc>;
> > +   clock-names = "core_clk", "iface_clk";
> > +   };
> > +
> > +Aliases :
> > +An alias may be optionally used to bind the UART device to a TTY device
> > +(ttyHSL) with a given alias number. Aliases are of the form
> > +uart where  is an integer representing the alias number to use.
> > +On systems with multiple UART devices present, an alias may optionally be
> > +defined for such devices. The alias value should be from 0 to 255.
> > +
> > +Example:
> > +
> > +   aliases {
> > +   uart4 = &uart7; // This device will be enumerated as ttyHSL4
> > +   };
> > diff --git a/drivers/tty/serial/msm_serial_hsl.c 
> > b/drivers/tty/serial/msm_serial_hsl.c
> > new file mode 100644
> > index 000..56c15a8
> > --- /dev/null
> > +++ b/drivers/tty/serial/msm_serial_hsl.c
> > @@ -0,0 +1,1399 @@
> > +/*
> > + * drivers/tty/serial/msm_serial_hsl.c - driver for serial device and 
> > console
> > + *
> > + * Copyright (C) 2007 Google, Inc.
> > + * Copyright (c) 2010-2013, The Linux Foundation. All rights reserved.
> > + *
> > + * This software is licensed under the terms of the GNU General Public
> > + * License version 2, as published by the Free Software Foundation, and
> > + * may be copied, distributed, and modified under those terms.
> > + *
> > + * This program is distributed in the hope that 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.
> > + */
> > +
> > +/* Acknowledgements:
> > + * This file is based on msm_serial.c, originally
> > + * Written by Robert Love   */
> > +
> > +#include 
> > +#include 
> > +#include 
> > +#include 
> > +#include 
> > +#include 
> > +#include 
> > +#include 
> > +#include 
> > +#include 
> > +#include 
> > +#include 
> > +#include 
> > +#include 
> > +
> > +#include "msm_serial_hsl.h"
> > +
> > +/*
> > + * There are 3 different kind of UART Core available on MSM.
> > +

Re: [PATCH] tty: serial: Add initial MSM UART High Speed Lite driver

2013-07-16 Thread Ivan T. Ivanov

Hi Greg, 

On Mon, 2013-07-01 at 12:11 +0300, Ivan T. Ivanov wrote:
> From: "Ivan T. Ivanov" 
> 
> This is a tty driver with console support for Qualcomm's UART
> controllers found in the MSM8974 chipsets. Driver is completely
> based on implementation found in codeaurora.org msm_serial_hs_lite
> with Android dependences removed. Other changes include, moved to
> device managed resources and few cleanups.
> 
> Driver functionality was tested in LEGACY_HSUART mode.
> 

Please, could you take a look at this driver. It have been 
tested on these new Snapdragon 8074 based DragonBoards. 

If there is something that I have to fix or improve in 
the code please let me know.

Regards,
Ivan


> Signed-off-by: Ivan T. Ivanov 
> ---
>  .../bindings/tty/serial/msm_serial_hsl.txt |   52 +
>  drivers/tty/serial/Kconfig |   18 +
>  drivers/tty/serial/Makefile|1 +
>  drivers/tty/serial/msm_serial_hsl.c| 1399 
> 
>  drivers/tty/serial/msm_serial_hsl.h|  294 
>  5 files changed, 1764 insertions(+)
>  create mode 100644 
> Documentation/devicetree/bindings/tty/serial/msm_serial_hsl.txt
>  create mode 100644 drivers/tty/serial/msm_serial_hsl.c
>  create mode 100644 drivers/tty/serial/msm_serial_hsl.h
> 
> diff --git a/Documentation/devicetree/bindings/tty/serial/msm_serial_hsl.txt 
> b/Documentation/devicetree/bindings/tty/serial/msm_serial_hsl.txt
> new file mode 100644
> index 000..972552f
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/tty/serial/msm_serial_hsl.txt
> @@ -0,0 +1,52 @@
> +* Qualcomm MSM HSUART Lite
> +
> +Required properties:
> +- compatible :
> + "qcom,msm-lsuart-v14" to be used for UARTDM Core v1.4
> +
> +- reg :
> + offset and length of the register set for both the device,
> + UART core and GBSI core
> +
> +- reg-names :
> + "uart_mem" to be used as name of the UART core
> + "gbsi_mem" to be used as name of the GBSI core
> +
> +The registers for the "qcom,msm-lsuart-v14" device have specify
> +UART core block. GSBI reg is optional if specified driver will use
> +GSBI specific functionality.
> +
> +- interrupts : interrupts for UART core
> +
> +- clocks : Must contain an entry for each entry in clock-names.
> +
> +- clock-names : Must include the following entries:
> +  "core_clk" - mandatory
> +  "iface_clk" - optional
> +
> +For details see:
> +Documentation/devicetree/bindings/clock/clock-bindings.txt
> +
> +Example:
> +
> + serial@f991e000 {
> + compatible = "qcom,msm-lsuart-v14";
> + reg = <0xf991e000 0x1000>;
> + reg-names = "uart_mem";
> + interrupts = <0 108 0>;
> + clocks = <&blsp1_uart2_apps_cxc>, <&blsp1_ahb_cxc>;
> + clock-names = "core_clk", "iface_clk";
> + };
> +
> +Aliases :
> +An alias may be optionally used to bind the UART device to a TTY device
> +(ttyHSL) with a given alias number. Aliases are of the form
> +uart where  is an integer representing the alias number to use.
> +On systems with multiple UART devices present, an alias may optionally be
> +defined for such devices. The alias value should be from 0 to 255.
> +
> +Example:
> +
> + aliases {
> + uart4 = &uart7; // This device will be enumerated as ttyHSL4
> + };
> diff --git a/drivers/tty/serial/Kconfig b/drivers/tty/serial/Kconfig
> index 7e7006f..4482bc7 100644
> --- a/drivers/tty/serial/Kconfig
> +++ b/drivers/tty/serial/Kconfig
> @@ -1046,6 +1046,24 @@ config SERIAL_MSM_HS
> Choose M here to compile it as a module. The module will be
> called msm_serial_hs.
>  
> +config SERIAL_MSM_HSL
> + tristate "MSM High speed serial lite mode driver"
> + depends on ARM && ARCH_MSM
> + select SERIAL_CORE
> + default n
> + help
> +   Select this module to enable MSM high speed lite mode driver
> +   for UART controllers found in MSM8974 SoC's
> +
> +   Choose M here to compile it as a module. The module will be
> +   called msm_serial_hsl.
> +
> +config SERIAL_MSM_HSL_CONSOLE
> + bool "MSM High speed serial lite mode console support"
> + depends on SERIAL_MSM_HSL=y
> + select SERIAL_CORE_CONSOLE
> + default n
> +
>  config SERIAL_VT8500
>   bool "VIA VT8500 on-chip serial port support"
>   depends on ARCH_VT8500
> diff --git a/drivers/tty/serial/Makefile b/drivers/tty/serial/Makefile
> index eedfec4..86c023b 100644
> --- a/drivers/tty/serial/Makefile
> +++ b/drivers/tty/serial/Makefile
> @@ -58,6 +58,7 @@ obj-$(CONFIG_SERIAL_ATMEL) += atmel_serial.o
>  obj-$(CONFIG_SERIAL_UARTLITE) += uartlite.o
>  obj-$(CONFIG_SERIAL_MSM) += msm_serial.o
>  obj-$(CONFIG_SERIAL_MSM_HS) += msm_serial_hs.o
> +obj-$(CONFIG_SERIAL_MSM_HSL) += msm_serial_hsl.o
>  obj-$(CONFIG_SERIAL_NETX) += netx-serial.o
>  obj-$(CONFIG_SERIAL_OF_PLATFORM) += of_serial.o
>  obj-$(CONFIG_SERIAL_OF_PLATFORM_NWPSERIAL) += nwpserial.o
> diff --git a/drivers/