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.
Unified · Split
| @@ -502,15 +502,14 @@ config SERIAL_IMX · 501 unmodified lines | ||
| 502 | 502 | can enable its onboard serial port by enabling this option. |
| 503 | 503 | |
| 504 | 504 | 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 | |
| 507 | 507 | select SERIAL_CORE_CONSOLE |
| 508 | − select SERIAL_EARLYCON if OF | |
| 509 | 508 | help |
| 510 | 509 | 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. | |
| 512 | 511 | |
| 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 | |
| 514 | 513 | (/dev/tty0) will still be used as the system console by default, but |
| 515 | 514 | you can alter that using a kernel command line option such as |
| 516 | 515 | "console=ttymxc0". (Try "man bootparam" or see the documentation of |
| @@ -373,7 +373,7 @@ static inline int imx_uart_is_imx6q(struct imx_port *sport) · 372 unmodified lines | ||
| 373 | 373 | /* |
| 374 | 374 | * Save and restore functions for UCR1, UCR2 and UCR3 registers |
| 375 | 375 | */ |
| 376 | −#if defined(CONFIG_SERIAL_IMX_CONSOLE) | |
| 376 | +#if IS_ENABLED(CONFIG_SERIAL_IMX_CONSOLE) | |
| 377 | 377 | static void imx_uart_ucrs_save(struct imx_port *sport, |
| 378 | 378 | struct imx_port_ucrs *ucr) |
| 379 | 379 | { |
| @@ -1979,7 +1979,7 @@ static const struct uart_ops imx_uart_pops = { · 1599 unmodified lines | ||
| 1979 | 1979 | |
| 1980 | 1980 | static struct imx_port *imx_uart_ports[UART_NR]; |
| 1981 | 1981 | |
| 1982 | −#ifdef CONFIG_SERIAL_IMX_CONSOLE | |
| 1982 | +#if IS_ENABLED(CONFIG_SERIAL_IMX_CONSOLE) | |
| 1983 | 1983 | static void imx_uart_console_putchar(struct uart_port *port, int ch) |
| 1984 | 1984 | { |
| 1985 | 1985 | struct imx_port *sport = (struct imx_port *)port; |
| @@ -2176,39 +2176,6 @@ static struct console imx_uart_console = { · 190 unmodified lines | ||
| 2176 | 2176 | |
| 2177 | 2177 | #define IMX_CONSOLE &imx_uart_console |
| 2178 | 2178 | |
| 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 | − | |
| 2212 | 2179 | #else |
| 2213 | 2180 | #define IMX_CONSOLE NULL |
| 2214 | 2181 | #endif |