mirror of https://gitee.com/openkylin/linux.git
tty: goldfish: Implement support for kernel 'earlycon' parameter
Add early console functionality to the Goldfish tty driver. When 'earlycon' kernel command line parameter is used with no options, the early console is determined by the 'stdout-path' property in device tree's 'chosen' node. This is illustrated in the following device tree source example: Device tree example: chosen { stdout-path = "/goldfish_tty@1f004000"; }; goldfish_tty@1f004000 { interrupts = <0xc>; reg = <0x1f004000 0x0 0x1000>; compatible = "google,goldfish-tty"; }; Signed-off-by: Miodrag Dinic <miodrag.dinic@imgtec.com> Signed-off-by: Goran Ferenc <goran.ferenc@imgtec.com> Signed-off-by: Aleksandar Markovic <aleksandar.markovic@imgtec.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
7157d2be23
commit
3840ed9548
|
@ -392,6 +392,9 @@ config PPC_EARLY_DEBUG_EHV_BC_HANDLE
|
||||||
config GOLDFISH_TTY
|
config GOLDFISH_TTY
|
||||||
tristate "Goldfish TTY Driver"
|
tristate "Goldfish TTY Driver"
|
||||||
depends on GOLDFISH
|
depends on GOLDFISH
|
||||||
|
select SERIAL_CORE
|
||||||
|
select SERIAL_CORE_CONSOLE
|
||||||
|
select SERIAL_EARLYCON
|
||||||
help
|
help
|
||||||
Console and system TTY driver for the Goldfish virtual platform.
|
Console and system TTY driver for the Goldfish virtual platform.
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (C) 2007 Google, Inc.
|
* Copyright (C) 2007 Google, Inc.
|
||||||
* Copyright (C) 2012 Intel, Inc.
|
* Copyright (C) 2012 Intel, Inc.
|
||||||
|
* Copyright (C) 2017 Imagination Technologies Ltd.
|
||||||
*
|
*
|
||||||
* This software is licensed under the terms of the GNU General Public
|
* This software is licensed under the terms of the GNU General Public
|
||||||
* License version 2, as published by the Free Software Foundation, and
|
* License version 2, as published by the Free Software Foundation, and
|
||||||
|
@ -24,6 +25,7 @@
|
||||||
#include <linux/goldfish.h>
|
#include <linux/goldfish.h>
|
||||||
#include <linux/mm.h>
|
#include <linux/mm.h>
|
||||||
#include <linux/dma-mapping.h>
|
#include <linux/dma-mapping.h>
|
||||||
|
#include <linux/serial_core.h>
|
||||||
|
|
||||||
/* Goldfish tty register's offsets */
|
/* Goldfish tty register's offsets */
|
||||||
#define GOLDFISH_TTY_REG_BYTES_READY 0x04
|
#define GOLDFISH_TTY_REG_BYTES_READY 0x04
|
||||||
|
@ -440,6 +442,30 @@ static int goldfish_tty_remove(struct platform_device *pdev)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void gf_early_console_putchar(struct uart_port *port, int ch)
|
||||||
|
{
|
||||||
|
__raw_writel(ch, port->membase);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void gf_early_write(struct console *con, const char *s, unsigned int n)
|
||||||
|
{
|
||||||
|
struct earlycon_device *dev = con->data;
|
||||||
|
|
||||||
|
uart_console_write(&dev->port, s, n, gf_early_console_putchar);
|
||||||
|
}
|
||||||
|
|
||||||
|
static int __init gf_earlycon_setup(struct earlycon_device *device,
|
||||||
|
const char *opt)
|
||||||
|
{
|
||||||
|
if (!device->port.membase)
|
||||||
|
return -ENODEV;
|
||||||
|
|
||||||
|
device->con->write = gf_early_write;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
OF_EARLYCON_DECLARE(early_gf_tty, "google,goldfish-tty", gf_earlycon_setup);
|
||||||
|
|
||||||
static const struct of_device_id goldfish_tty_of_match[] = {
|
static const struct of_device_id goldfish_tty_of_match[] = {
|
||||||
{ .compatible = "google,goldfish-tty", },
|
{ .compatible = "google,goldfish-tty", },
|
||||||
{},
|
{},
|
||||||
|
|
Loading…
Reference in New Issue