devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mark Rutland <mark.rutland-5wv7dgnIgG8@public.gmane.org>
To: Chunyan Zhang <chunyan.zhang-lxIno14LUO0EEoCn2XhGlw@public.gmane.org>
Cc: Catalin Marinas <Catalin.Marinas-5wv7dgnIgG8@public.gmane.org>,
	"gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r@public.gmane.org"
	<gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r@public.gmane.org>,
	"ijc+devicetree-KcIKpvwj1kUDXYZnReoRVg@public.gmane.org"
	<ijc+devicetree-KcIKpvwj1kUDXYZnReoRVg@public.gmane.org>,
	"jslaby-AlSwsSmVLrQ@public.gmane.org"
	<jslaby-AlSwsSmVLrQ@public.gmane.org>,
	"galak-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org"
	<galak-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>,
	"broonie-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org"
	<broonie-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>,
	"m-karicheri2-l0cyMroinI0@public.gmane.org"
	<m-karicheri2-l0cyMroinI0@public.gmane.org>,
	Pawel Moll <Pawel.Moll-5wv7dgnIgG8@public.gmane.org>,
	"artagnon-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org"
	<artagnon-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
	"rrichter-YGCgFSpz5w/QT0dZR+AlfA@public.gmane.org"
	<rrichter-YGCgFSpz5w/QT0dZR+AlfA@public.gmane.org>,
	"robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org"
	<robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
	Will Deacon <Will.Deacon-5wv7dgnIgG8@public.gmane.org>,
	"orsonzhai-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org"
	<orsonzhai-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
	"geng.ren-lxIno14LUO0EEoCn2XhGlw@public.gmane.org"
	<geng.ren-lxIno14LUO0EEoCn2XhGlw@public.gmane.org>,
	"zhizhou.zhang-lxIno14LUO0EEoCn2XhGlw@public.gmane.org"
	<zhizhou.zhang-lxIno14LUO0EEoCn2XhGlw@public.gmane.org>,
	"devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
	<devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	"linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org"
	<linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org>,
	"linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
	<linux-kern>
Subject: Re: [PATCH v2 5/5] tty/serial: Add earlycon support for Spreadtrum serial driver
Date: Fri, 17 Oct 2014 14:03:54 +0100	[thread overview]
Message-ID: <20141017130354.GC5587@leverpostej> (raw)
In-Reply-To: <1413539665-11484-6-git-send-email-chunyan.zhang-lxIno14LUO0EEoCn2XhGlw@public.gmane.org>

On Fri, Oct 17, 2014 at 10:54:25AM +0100, Chunyan Zhang wrote:
> Add serial driver for spreadtrum sharkl platform with earlycon
> support at first.
> 
> Signed-off-by: Chunyan Zhang <chunyan.zhang-lxIno14LUO0EEoCn2XhGlw@public.gmane.org>
> ---
>  drivers/tty/serial/Kconfig       |   24 ++++++++++++++
>  drivers/tty/serial/Makefile      |    1 +
>  drivers/tty/serial/sprd-serial.c |   64 ++++++++++++++++++++++++++++++++++++++
>  3 files changed, 89 insertions(+)
>  create mode 100644 drivers/tty/serial/sprd-serial.c
> 
> diff --git a/drivers/tty/serial/Kconfig b/drivers/tty/serial/Kconfig
> index 26cec64..33b8f90 100644
> --- a/drivers/tty/serial/Kconfig
> +++ b/drivers/tty/serial/Kconfig
> @@ -113,6 +113,30 @@ config SERIAL_SB1250_DUART_CONSOLE
>  
>  	  If unsure, say Y.
>  
> +config SERIAL_SPRD
> +	tristate "Support for SPRD serial"
> +	depends on ARM || ARM64
> +	select SERIAL_CORE
> +	help
> +          This enables the driver for the Spreadtrum's serial.
> +
> +config SERIAL_SPRD_NR
> +        int "Maximum number of sprd serial ports"
> +        depends on SERIAL_SPRD
> +        default "4"

This is not used below.

> +
> +config SERIAL_SPRD_CONSOLE
> +        bool "SPRD UART console support"
> +        depends on SERIAL_SPRD=y
> +        select SERIAL_CORE_CONSOLE
> +	select SERIAL_EARLYCON
> +        help
> +	  Support for early debug console using Spreadtrum's serial. This enables
> +	  the console before standard serial driver is probed. This is enabled
> +	  with "earlycon=serial_sprd" on the kernel command line. The console is
> +	  enabled when early_param is processed.

There only appears to be an earlycon driver, and not "standard serial
driver".

What happens after earlycon?

Surely there should be a real driver to take ownership of the UART?

As far as I can see it won't be possible to boot your platform to a
prompt, because earlycon will have gone before that.

Thanks,
Mark.

> +
> +
>  config SERIAL_ATMEL
>  	bool "AT91 / AT32 on-chip serial port support"
>  	depends on ARCH_AT91 || AVR32
> diff --git a/drivers/tty/serial/Makefile b/drivers/tty/serial/Makefile
> index 0080cc3..b16e0d4 100644
> --- a/drivers/tty/serial/Makefile
> +++ b/drivers/tty/serial/Makefile
> @@ -92,6 +92,7 @@ obj-$(CONFIG_SERIAL_ARC)	+= arc_uart.o
>  obj-$(CONFIG_SERIAL_RP2)	+= rp2.o
>  obj-$(CONFIG_SERIAL_FSL_LPUART)	+= fsl_lpuart.o
>  obj-$(CONFIG_SERIAL_MEN_Z135)	+= men_z135_uart.o
> +obj-$(CONFIG_SERIAL_SPRD) += sprd-serial.o
>  
>  # GPIOLIB helpers for modem control lines
>  obj-$(CONFIG_SERIAL_MCTRL_GPIO)	+= serial_mctrl_gpio.o
> diff --git a/drivers/tty/serial/sprd-serial.c b/drivers/tty/serial/sprd-serial.c
> new file mode 100644
> index 0000000..9ae594f
> --- /dev/null
> +++ b/drivers/tty/serial/sprd-serial.c
> @@ -0,0 +1,64 @@
> +/*
> + * Copyright (C) 2012 Spreadtrum Communications Inc.
> + *
> + * 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.
> + */
> +
> +#include <linux/kernel.h>
> +#include <linux/console.h>
> +#include <linux/init.h>
> +#include <linux/serial_core.h>
> +#include <linux/of.h>
> +
> +/*offset*/
> +#define UART_TXD	0x0000
> +#define UART_RXD	0x0004
> +#define UART_STS0	0x0008
> +#define UART_STS1	0x000C
> +#define UART_IEN	0x0010
> +#define UART_ICLR	0x0014
> +#define UART_CTL0	0x0018
> +#define UART_CTL1	0x001C
> +#define UART_CTL2	0x0020
> +#define UART_CLKD0	0x0024
> +#define UART_CLKD1	0x0028
> +#define UART_STS2	0x002C
> +
> +/*line status */
> +#define UART_LSR_TX_OVER	(0x1<<15)
> +
> +static void serial_sprd_putc(struct uart_port *port, int c)
> +{
> +	while (!(readl(port->membase + UART_STS0) & UART_LSR_TX_OVER))
> +		;
> +	writeb(c, port->membase + UART_TXD);
> +}
> +
> +static void serial_sprd_early_write(struct console *con, const char *s,
> +				    unsigned n)
> +{
> +	struct earlycon_device *dev = con->data;
> +
> +	uart_console_write(&dev->port, s, n, serial_sprd_putc);
> +}
> +
> +static int __init serial_sprd_early_console_setup(
> +				struct earlycon_device *device,
> +				const char *opt)
> +{
> +	if (!device->port.membase)
> +		return -ENODEV;
> +
> +	device->con->write = serial_sprd_early_write;
> +	return 0;
> +}
> +EARLYCON_DECLARE(serial_sprd, serial_sprd_early_console_setup);
> +OF_EARLYCON_DECLARE(serial_sprd, "sprd,serial",
> +		    serial_sprd_early_console_setup);
> -- 
> 1.7.9.5
> 
> 
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  parent reply	other threads:[~2014-10-17 13:03 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <sprd-1017-v2>
2014-10-17  9:54 ` [PATCH v2 0/5] Add Spreadtrum Sharkl Platform support Chunyan Zhang
2014-10-17  9:54   ` [PATCH v2 1/5] Documentation: DT: Renamed of-serial.txt to 8250.txt Chunyan Zhang
2014-10-17 13:12     ` Mark Rutland
2014-10-20 13:47     ` Arnd Bergmann
2014-10-17  9:54   ` [PATCH v2 2/5] Documentation: DT: Add bindings for Spreadtrum Sharkl Platform Chunyan Zhang
2014-10-17 12:50     ` Mark Rutland
2014-10-20 13:48     ` Arnd Bergmann
2014-10-17  9:54   ` [PATCH v2 3/5] arm64: dts: Add support for Spreadtrum Sharkl3 SoC in dts and Makefile Chunyan Zhang
2014-10-17 13:00     ` Mark Rutland
2014-10-17  9:54   ` [PATCH v2 4/5] arm64: Add support for Spreadtrum's Sharkl Platform in Kconfig and defconfig Chunyan Zhang
2014-10-17  9:54   ` [PATCH v2 5/5] tty/serial: Add earlycon support for Spreadtrum serial driver Chunyan Zhang
     [not found]     ` <1413539665-11484-6-git-send-email-chunyan.zhang-lxIno14LUO0EEoCn2XhGlw@public.gmane.org>
2014-10-17 13:03       ` Mark Rutland [this message]
2014-10-20  7:27         ` Lyra Zhang
2014-10-20 10:32           ` Mark Rutland
2014-10-20 11:15             ` Lyra Zhang
2014-10-18 21:06     ` One Thousand Gnomes
2014-10-20 10:23       ` Orson Zhai
2014-10-21 12:26         ` One Thousand Gnomes
2014-10-21 13:34           ` Orson Zhai
2014-10-21 11:15   ` [PATCH v2 0/5] Add Spreadtrum Sharkl Platform support Pavel Machek

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20141017130354.GC5587@leverpostej \
    --to=mark.rutland-5wv7dgnigg8@public.gmane.org \
    --cc=Catalin.Marinas-5wv7dgnIgG8@public.gmane.org \
    --cc=Pawel.Moll-5wv7dgnIgG8@public.gmane.org \
    --cc=Will.Deacon-5wv7dgnIgG8@public.gmane.org \
    --cc=artagnon-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=broonie-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org \
    --cc=chunyan.zhang-lxIno14LUO0EEoCn2XhGlw@public.gmane.org \
    --cc=devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=galak-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org \
    --cc=geng.ren-lxIno14LUO0EEoCn2XhGlw@public.gmane.org \
    --cc=gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r@public.gmane.org \
    --cc=ijc+devicetree-KcIKpvwj1kUDXYZnReoRVg@public.gmane.org \
    --cc=jslaby-AlSwsSmVLrQ@public.gmane.org \
    --cc=linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
    --cc=m-karicheri2-l0cyMroinI0@public.gmane.org \
    --cc=orsonzhai-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
    --cc=rrichter-YGCgFSpz5w/QT0dZR+AlfA@public.gmane.org \
    --cc=zhizhou.zhang-lxIno14LUO0EEoCn2XhGlw@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).