From f1911955194fef3c5c6aa6e2ebb9f606fdeb7311 Mon Sep 17 00:00:00 2001 From: Ralf Ramsauer Date: Thu, 17 Nov 2016 15:37:02 +0100 Subject: [PATCH] inmates: choose default UART driver according to mach settings This also gives us the chance to rename uart.h to console.h Signed-off-by: Ralf Ramsauer Signed-off-by: Jan Kiszka --- .../mach-sun7i/mach/{uart.h => console.h} | 8 +++-- .../mach-tegra124/mach/{uart.h => console.h} | 9 +++-- .../mach-vexpress/mach/{uart.h => console.h} | 4 ++- inmates/lib/arm/printk.c | 33 +++++++++++++++---- .../mach/console.h} | 4 ++- .../mach/console.h} | 4 ++- .../mach-hi6220/mach/{uart.h => console.h} | 4 ++- 7 files changed, 50 insertions(+), 16 deletions(-) rename inmates/lib/arm/include/mach-sun7i/mach/{uart.h => console.h} (71%) rename inmates/lib/arm/include/mach-tegra124/mach/{uart.h => console.h} (68%) rename inmates/lib/arm/include/mach-vexpress/mach/{uart.h => console.h} (84%) rename inmates/lib/arm64/include/{mach-foundation-v8/mach/uart.h => mach-amd-seattle/mach/console.h} (84%) rename inmates/lib/arm64/include/{mach-amd-seattle/mach/uart.h => mach-foundation-v8/mach/console.h} (84%) rename inmates/lib/arm64/include/mach-hi6220/mach/{uart.h => console.h} (81%) diff --git a/inmates/lib/arm/include/mach-sun7i/mach/uart.h b/inmates/lib/arm/include/mach-sun7i/mach/console.h similarity index 71% rename from inmates/lib/arm/include/mach-sun7i/mach/uart.h rename to inmates/lib/arm/include/mach-sun7i/mach/console.h index a1b2f472f..d01937b7f 100644 --- a/inmates/lib/arm/include/mach-sun7i/mach/uart.h +++ b/inmates/lib/arm/include/mach-sun7i/mach/console.h @@ -10,6 +10,8 @@ * the COPYING file in the top-level directory. */ -#define UART_BASE ((void *)0x01c29c00) -#define UART_CLOCK_REG ((void *)0x01c2006c) -#define UART_GATE_NR 23 +#define CON_TYPE "8250" + +#define CON_BASE 0x01c29c00 +#define CON_CLOCK_REG 0x01c2006c +#define CON_GATE_NR 23 diff --git a/inmates/lib/arm/include/mach-tegra124/mach/uart.h b/inmates/lib/arm/include/mach-tegra124/mach/console.h similarity index 68% rename from inmates/lib/arm/include/mach-tegra124/mach/uart.h rename to inmates/lib/arm/include/mach-tegra124/mach/console.h index 75aaa6837..ca54c34af 100644 --- a/inmates/lib/arm/include/mach-tegra124/mach/uart.h +++ b/inmates/lib/arm/include/mach-tegra124/mach/console.h @@ -10,9 +10,12 @@ * the COPYING file in the top-level directory. */ -#define UART_BASE ((void *)0x70006300) +#define CON_TYPE "8250" + +#define CON_BASE 0x70006300 /* UART D on tegra124, exposed to the DB9 + connector of the Jetson TK1 */ /* Do not enable the clock in the inmate, as enabling the clock requires access * to the tegra-car (Clock and Reset Controller) */ -#define UART_CLOCK_REG ((void *)0) -#define UART_GATE_NR 0 +#define CON_CLOCK_REG 0 +#define CON_GATE_NR 0 diff --git a/inmates/lib/arm/include/mach-vexpress/mach/uart.h b/inmates/lib/arm/include/mach-vexpress/mach/console.h similarity index 84% rename from inmates/lib/arm/include/mach-vexpress/mach/uart.h rename to inmates/lib/arm/include/mach-vexpress/mach/console.h index 8b58cab8c..4f0df7391 100644 --- a/inmates/lib/arm/include/mach-vexpress/mach/uart.h +++ b/inmates/lib/arm/include/mach-vexpress/mach/console.h @@ -10,4 +10,6 @@ * the COPYING file in the top-level directory. */ -#define UART_BASE ((void *)0x1c090000) +#define CON_TYPE "PL011" + +#define CON_BASE 0x1c090000 diff --git a/inmates/lib/arm/printk.c b/inmates/lib/arm/printk.c index 9089fa108..5259e57d4 100644 --- a/inmates/lib/arm/printk.c +++ b/inmates/lib/arm/printk.c @@ -13,7 +13,27 @@ #include #include #include -#include +#include + +#ifndef CON_TYPE +#define CON_TYPE "none" +#endif + +#ifndef CON_BASE +#define CON_BASE 0 +#endif + +#ifndef CON_DIVIDER +#define CON_DIVIDER 0 +#endif + +#ifndef CON_CLOCK_REG +#define CON_CLOCK_REG 0 +#endif + +#ifndef CON_GATE_NR +#define CON_GATE_NR 0 +#endif static struct uart_chip *chip = NULL; @@ -41,7 +61,7 @@ static void console_init(void) char buf[32]; const char *type; - type = cmdline_parse_str("con-type", buf, sizeof(buf), "none"); + type = cmdline_parse_str("con-type", buf, sizeof(buf), CON_TYPE); if (!strncmp(type, "8250", 4)) chip = &uart_8250_ops; else if (!strncmp(type, "PL011", 5)) @@ -50,11 +70,12 @@ static void console_init(void) if (!chip) return; - chip->base = (void *)(unsigned long) cmdline_parse_int("con-base", 0); - chip->divider = cmdline_parse_int("con-divider", 0); - chip->gate_nr = cmdline_parse_int("con-gate_nr", 0); + chip->base = (void *)(unsigned long) + cmdline_parse_int("con-base", CON_BASE); + chip->divider = cmdline_parse_int("con-divider", CON_DIVIDER); + chip->gate_nr = cmdline_parse_int("con-gate_nr", CON_GATE_NR); chip->clock_reg = (void *)(unsigned long) - cmdline_parse_int("con-clock_reg", 0); + cmdline_parse_int("con-clock_reg", CON_CLOCK_REG); chip->init(chip); } diff --git a/inmates/lib/arm64/include/mach-foundation-v8/mach/uart.h b/inmates/lib/arm64/include/mach-amd-seattle/mach/console.h similarity index 84% rename from inmates/lib/arm64/include/mach-foundation-v8/mach/uart.h rename to inmates/lib/arm64/include/mach-amd-seattle/mach/console.h index 5ac3f878c..b73b868b8 100644 --- a/inmates/lib/arm64/include/mach-foundation-v8/mach/uart.h +++ b/inmates/lib/arm64/include/mach-amd-seattle/mach/console.h @@ -10,4 +10,6 @@ * the COPYING file in the top-level directory. */ -#define UART_BASE ((void *)0x1c090000) +#define CON_TYPE "PL011" + +#define CON_BASE 0xe1010000 diff --git a/inmates/lib/arm64/include/mach-amd-seattle/mach/uart.h b/inmates/lib/arm64/include/mach-foundation-v8/mach/console.h similarity index 84% rename from inmates/lib/arm64/include/mach-amd-seattle/mach/uart.h rename to inmates/lib/arm64/include/mach-foundation-v8/mach/console.h index 512b6cb37..11d1016f5 100644 --- a/inmates/lib/arm64/include/mach-amd-seattle/mach/uart.h +++ b/inmates/lib/arm64/include/mach-foundation-v8/mach/console.h @@ -10,4 +10,6 @@ * the COPYING file in the top-level directory. */ -#define UART_BASE ((void *)0xe1010000) +#define CON_TYPE "PL011" + +#define CON_BASE 0x1c090000 diff --git a/inmates/lib/arm64/include/mach-hi6220/mach/uart.h b/inmates/lib/arm64/include/mach-hi6220/mach/console.h similarity index 81% rename from inmates/lib/arm64/include/mach-hi6220/mach/uart.h rename to inmates/lib/arm64/include/mach-hi6220/mach/console.h index 474816896..0acc59d27 100644 --- a/inmates/lib/arm64/include/mach-hi6220/mach/uart.h +++ b/inmates/lib/arm64/include/mach-hi6220/mach/console.h @@ -10,4 +10,6 @@ * the COPYING file in the top-level directory. */ -#define UART_BASE ((void *)0xf7113000) +#define CON_TYPE "PL011" + +#define CON_BASE 0xf7113000