Skip to content

Commit 1d59b38

Browse files
agnersgregkh
authored andcommitted
serial: fsl_lpuart: add earlycon support
Add support for DT and command line based earlycon support for lpuart and lpuart32 used on Freescale Vybrid and and QorIQ LS1021A processors. Signed-off-by: Stefan Agner <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 6200cba commit 1d59b38

File tree

3 files changed

+47
-0
lines changed

3 files changed

+47
-0
lines changed

Documentation/kernel-parameters.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1023,6 +1023,13 @@ bytes respectively. Such letter suffixes can also be entirely omitted.
10231023
serial port must already be setup and configured.
10241024
Options are not yet supported.
10251025

1026+
lpuart,<addr>
1027+
lpuart32,<addr>
1028+
Use early console provided by Freescale LP UART driver
1029+
found on Freescale Vybrid and QorIQ LS1021A processors.
1030+
A valid base address must be provided, and the serial
1031+
port must already be setup and configured.
1032+
10261033
earlyprintk= [X86,SH,BLACKFIN,ARM,M68k]
10271034
earlyprintk=vga
10281035
earlyprintk=efi

drivers/tty/serial/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1539,6 +1539,7 @@ config SERIAL_FSL_LPUART
15391539
tristate "Freescale lpuart serial port support"
15401540
depends on HAS_DMA
15411541
select SERIAL_CORE
1542+
select SERIAL_EARLYCON
15421543
help
15431544
Support for the on-chip lpuart on some Freescale SOCs.
15441545

drivers/tty/serial/fsl_lpuart.c

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1746,6 +1746,45 @@ static struct console lpuart32_console = {
17461746
.data = &lpuart_reg,
17471747
};
17481748

1749+
static void lpuart_early_write(struct console *con, const char *s, unsigned n)
1750+
{
1751+
struct earlycon_device *dev = con->data;
1752+
1753+
uart_console_write(&dev->port, s, n, lpuart_console_putchar);
1754+
}
1755+
1756+
static void lpuart32_early_write(struct console *con, const char *s, unsigned n)
1757+
{
1758+
struct earlycon_device *dev = con->data;
1759+
1760+
uart_console_write(&dev->port, s, n, lpuart32_console_putchar);
1761+
}
1762+
1763+
static int __init lpuart_early_console_setup(struct earlycon_device *device,
1764+
const char *opt)
1765+
{
1766+
if (!device->port.membase)
1767+
return -ENODEV;
1768+
1769+
device->con->write = lpuart_early_write;
1770+
return 0;
1771+
}
1772+
1773+
static int __init lpuart32_early_console_setup(struct earlycon_device *device,
1774+
const char *opt)
1775+
{
1776+
if (!device->port.membase)
1777+
return -ENODEV;
1778+
1779+
device->con->write = lpuart32_early_write;
1780+
return 0;
1781+
}
1782+
1783+
OF_EARLYCON_DECLARE(lpuart, "fsl,vf610-lpuart", lpuart_early_console_setup);
1784+
OF_EARLYCON_DECLARE(lpuart32, "fsl,ls1021a-lpuart", lpuart32_early_console_setup);
1785+
EARLYCON_DECLARE(lpuart, lpuart_early_console_setup);
1786+
EARLYCON_DECLARE(lpuart32, lpuart32_early_console_setup);
1787+
17491788
#define LPUART_CONSOLE (&lpuart_console)
17501789
#define LPUART32_CONSOLE (&lpuart32_console)
17511790
#else

0 commit comments

Comments
 (0)