tty/serial: add generic serial earlycon
[firefly-linux-kernel-4.4.55.git] / include / linux / serial_core.h
index 87d4bbc773fc7d8d7223423c9d388accc32c527c..c2b355fd921abe3c96b431dc5f9c6413ecb308eb 100644 (file)
@@ -279,6 +279,22 @@ static inline int uart_poll_timeout(struct uart_port *port)
 /*
  * Console helpers.
  */
+struct earlycon_device {
+       struct console *con;
+       struct uart_port port;
+       char options[16];               /* e.g., 115200n8 */
+       unsigned int baud;
+};
+int setup_earlycon(char *buf, const char *match,
+                  int (*setup)(struct earlycon_device *, const char *));
+
+#define EARLYCON_DECLARE(name, func) \
+static int __init name ## _setup_earlycon(char *buf) \
+{ \
+       return setup_earlycon(buf, __stringify(name), func); \
+} \
+early_param("earlycon", name ## _setup_earlycon);
+
 struct uart_port *uart_get_console(struct uart_port *ports, int nr,
                                   struct console *c);
 void uart_parse_options(char *options, int *baud, int *parity, int *bits,