From: Alim Akhtar <alim.akhtar@samsung.com>
To: gregkh@linuxfoundation.org
Cc: linux-samsung-soc@vger.kernel.org,
linux-arm-kernel@list.infradead.org,
linux-kernel@vger.kernel.org, robh@kernel.org,
thomas.ab@samsung.com
Subject: [PATCH] tty/serial: samsung: Add earlycon support
Date: Tue, 16 Sep 2014 17:02:43 +0530 [thread overview]
Message-ID: <1410867163-27962-1-git-send-email-alim.akhtar@samsung.com> (raw)
Add earlycon support for the samsung serial port. This allows enabling
the samsung serial port for console when early_params are parse and processed.
Signed-off-by: Alim Akhtar <alim.akhtar@samsung.com>
---
Documentation/kernel-parameters.txt | 6 ++++++
drivers/tty/serial/Kconfig | 1 +
drivers/tty/serial/samsung.c | 17 +++++++++++++++++
3 files changed, 24 insertions(+)
diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt
index 5ae8608..e01c0e5 100644
--- a/Documentation/kernel-parameters.txt
+++ b/Documentation/kernel-parameters.txt
@@ -936,6 +936,12 @@ bytes respectively. Such letter suffixes can also be entirely omitted.
must already be setup and configured. Options are not
yet supported.
+ samsung,<addr>
+ Start an early, polled-mode console on a samsung serial
+ port at the specified address. The samsung serial port
+ must already be setup and configured. Options are not
+ yet supported.
+
smh Use ARM semihosting calls for early console.
earlyprintk= [X86,SH,BLACKFIN,ARM,M68k]
diff --git a/drivers/tty/serial/Kconfig b/drivers/tty/serial/Kconfig
index 249e340..9d42ac8 100644
--- a/drivers/tty/serial/Kconfig
+++ b/drivers/tty/serial/Kconfig
@@ -257,6 +257,7 @@ config SERIAL_SAMSUNG_CONSOLE
bool "Support for console on Samsung SoC serial port"
depends on SERIAL_SAMSUNG=y
select SERIAL_CORE_CONSOLE
+ select SERIAL_EARLYCON
help
Allow selection of the S3C24XX on-board serial ports for use as
an virtual console.
diff --git a/drivers/tty/serial/samsung.c b/drivers/tty/serial/samsung.c
index c78f43a..f32e9c8 100644
--- a/drivers/tty/serial/samsung.c
+++ b/drivers/tty/serial/samsung.c
@@ -917,6 +917,7 @@ s3c24xx_serial_verify_port(struct uart_port *port, struct serial_struct *ser)
#ifdef CONFIG_SERIAL_SAMSUNG_CONSOLE
static struct console s3c24xx_serial_console;
+static void s3c24xx_serial_console_putchar(struct uart_port *port, int ch);
static int __init s3c24xx_serial_console_init(void)
{
@@ -926,6 +927,22 @@ static int __init s3c24xx_serial_console_init(void)
console_initcall(s3c24xx_serial_console_init);
#define S3C24XX_SERIAL_CONSOLE &s3c24xx_serial_console
+static void samsung_early_write(struct console *con, const char *s, unsigned n)
+{
+ struct earlycon_device *dev = con->data;
+
+ uart_console_write(&dev->port, s, n, s3c24xx_serial_console_putchar);
+}
+
+static int __init samsung_early_console_setup(struct earlycon_device *device,
+ const char *opt)
+{
+ if (!device->port.membase)
+ return -ENODEV;
+ device->con->write = samsung_early_write;
+ return 0;
+}
+EARLYCON_DECLARE(samsung, samsung_early_console_setup);
#else
#define S3C24XX_SERIAL_CONSOLE NULL
#endif
--
1.7.10.4
next reply other threads:[~2014-09-16 11:37 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-09-16 11:32 Alim Akhtar [this message]
2014-09-20 12:41 ` [PATCH] tty/serial: samsung: Add earlycon support Alim Akhtar
2014-09-20 13:39 ` Tomasz Figa
2014-09-20 18:00 ` Rob Herring
2014-09-21 14:36 ` Alim Akhtar
2014-09-21 17:24 ` Tomasz Figa
2014-09-21 23:10 ` Alim Akhtar
2014-09-21 23:19 ` Tomasz Figa
2014-09-22 13:41 ` Alim Akhtar
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=1410867163-27962-1-git-send-email-alim.akhtar@samsung.com \
--to=alim.akhtar@samsung.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-arm-kernel@list.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-samsung-soc@vger.kernel.org \
--cc=robh@kernel.org \
--cc=thomas.ab@samsung.com \
/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).