History

tty: serial: imx: enable imx serial console port as module

Add support for building i.MX serial driver as module. The changes of the patch: - imx console driver can be built as module. - move out earlycon code to separated driver like imx_earlycon.c, and imx earlycon driver only support build-in.

Fugang Duan committed 6 years ago

Commit 0db4f9b1 parent a5e06912 files · +6 −40Browse files

Unified · Split

2 files
  1. drivers/tty/serial/Kconfig +4 −5
  2. drivers/tty/serial/imx.c +2 −35
drivers/tty/serial/Kconfig+4−5
@@ -502,15 +502,14 @@ config SERIAL_IMX · 501 unmodified lines
502502 can enable its onboard serial port by enabling this option.
503503
504504 config SERIAL_IMX_CONSOLE
505− bool "Console on IMX serial port"
506− depends on SERIAL_IMX=y
505+ tristate "Console on IMX serial port"
506+ depends on SERIAL_IMX
507507 select SERIAL_CORE_CONSOLE
508− select SERIAL_EARLYCON if OF
509508 help
510509 If you have enabled the serial port on the Freescale IMX
511− CPU you can make it the console by answering Y to this option.
510+ CPU you can make it the console by answering Y/M to this option.
512511
513− Even if you say Y here, the currently visible virtual console
512+ Even if you say Y/M here, the currently visible virtual console
514513 (/dev/tty0) will still be used as the system console by default, but
515514 you can alter that using a kernel command line option such as
516515 "console=ttymxc0". (Try "man bootparam" or see the documentation of
drivers/tty/serial/imx.c+2−35
@@ -373,7 +373,7 @@ static inline int imx_uart_is_imx6q(struct imx_port *sport) · 372 unmodified lines
373373 /*
374374 * Save and restore functions for UCR1, UCR2 and UCR3 registers
375375 */
376−#if defined(CONFIG_SERIAL_IMX_CONSOLE)
376+#if IS_ENABLED(CONFIG_SERIAL_IMX_CONSOLE)
377377 static void imx_uart_ucrs_save(struct imx_port *sport,
378378 struct imx_port_ucrs *ucr)
379379 {
@@ -1979,7 +1979,7 @@ static const struct uart_ops imx_uart_pops = { · 1599 unmodified lines
19791979
19801980 static struct imx_port *imx_uart_ports[UART_NR];
19811981
1982−#ifdef CONFIG_SERIAL_IMX_CONSOLE
1982+#if IS_ENABLED(CONFIG_SERIAL_IMX_CONSOLE)
19831983 static void imx_uart_console_putchar(struct uart_port *port, int ch)
19841984 {
19851985 struct imx_port *sport = (struct imx_port *)port;
@@ -2176,39 +2176,6 @@ static struct console imx_uart_console = { · 190 unmodified lines
21762176
21772177 #define IMX_CONSOLE &imx_uart_console
21782178
2179−#ifdef CONFIG_OF
2180−static void imx_uart_console_early_putchar(struct uart_port *port, int ch)
2181−{
2182− struct imx_port *sport = (struct imx_port *)port;
2183−
2184− while (imx_uart_readl(sport, IMX21_UTS) & UTS_TXFULL)
2185− cpu_relax();
2186−
2187− imx_uart_writel(sport, ch, URTX0);
2188−}
2189−
2190−static void imx_uart_console_early_write(struct console *con, const char *s,
2191− unsigned count)
2192−{
2193− struct earlycon_device *dev = con->data;
2194−
2195− uart_console_write(&dev->port, s, count, imx_uart_console_early_putchar);
2196−}
2197−
2198−static int __init
2199−imx_console_early_setup(struct earlycon_device *dev, const char *opt)
2200−{
2201− if (!dev->port.membase)
2202− return -ENODEV;
2203−
2204− dev->con->write = imx_uart_console_early_write;
2205−
2206− return 0;
2207−}
2208−OF_EARLYCON_DECLARE(ec_imx6q, "fsl,imx6q-uart", imx_console_early_setup);
2209−OF_EARLYCON_DECLARE(ec_imx21, "fsl,imx21-uart", imx_console_early_setup);
2210−#endif
2211−
22122179 #else
22132180 #define IMX_CONSOLE NULL
22142181 #endif