]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
serial_core: support native endianness
authorMax Filippov <jcmvbkbc@gmail.com>
Tue, 22 Sep 2015 12:20:32 +0000 (15:20 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 4 Oct 2015 18:11:05 +0000 (19:11 +0100)
There are three natural ways in which devices may be wired to the system:
little endian (device receives correctly ordered bits of a word written
by little-endian CPU to its register, but big-endian CPU needs to swap
bytes of a word before writing it), big endian (same, but with big-endian
CPU in more favourable position) and native endian (CPU of either
endianness may do word-sized I/O without need for byteswapping).

Adding an option for native endianness allows using single kernel command
line for boards with native-endian serial ports on bi-endian
architectures. This goes in parallel with 'native-endian' DTS attribute.

Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/tty/serial/serial_core.c

index 603d2cc3f424f691c53f2ccb7c91efd4cf8ae9a5..df4271ae7414267223f293f168646b0003833920 100644 (file)
@@ -1819,8 +1819,8 @@ uart_get_console(struct uart_port *ports, int nr, struct console *co)
  *     @options: ptr for <options> field; NULL if not present (out)
  *
  *     Decodes earlycon kernel command line parameters of the form
- *        earlycon=<name>,io|mmio|mmio32|mmio32be,<addr>,<options>
- *        console=<name>,io|mmio|mmio32|mmio32be,<addr>,<options>
+ *        earlycon=<name>,io|mmio|mmio32|mmio32be|mmio32native,<addr>,<options>
+ *        console=<name>,io|mmio|mmio32|mmio32be|mmio32native,<addr>,<options>
  *
  *     The optional form
  *        earlycon=<name>,0x<addr>,<options>
@@ -1841,6 +1841,10 @@ int uart_parse_earlycon(char *p, unsigned char *iotype, unsigned long *addr,
        } else if (strncmp(p, "mmio32be,", 9) == 0) {
                *iotype = UPIO_MEM32BE;
                p += 9;
+       } else if (strncmp(p, "mmio32native,", 13) == 0) {
+               *iotype = IS_ENABLED(CONFIG_CPU_BIG_ENDIAN) ?
+                       UPIO_MEM32BE : UPIO_MEM32;
+               p += 13;
        } else if (strncmp(p, "io,", 3) == 0) {
                *iotype = UPIO_PORT;
                p += 3;