Skip to content

Commit

Permalink
inmates: choose default UART driver according to mach settings
Browse files Browse the repository at this point in the history
This also gives us the chance to rename uart.h to console.h

Signed-off-by: Ralf Ramsauer <ralf.ramsauer@oth-regensburg.de>
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
  • Loading branch information
rralf authored and jan-kiszka committed Dec 2, 2016
1 parent c840c13 commit f191195
Show file tree
Hide file tree
Showing 7 changed files with 50 additions and 16 deletions.
Expand Up @@ -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
Expand Up @@ -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
Expand Up @@ -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
33 changes: 27 additions & 6 deletions inmates/lib/arm/printk.c
Expand Up @@ -13,7 +13,27 @@
#include <inmate.h>
#include <stdarg.h>
#include <uart.h>
#include <mach/uart.h>
#include <mach/console.h>

#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;

Expand Down Expand Up @@ -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))
Expand All @@ -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);
}
Expand Down
Expand Up @@ -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
Expand Up @@ -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
Expand Up @@ -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

0 comments on commit f191195

Please sign in to comment.