Skip to content

Commit

Permalink
inmates: arm: Add support Marvell UART
Browse files Browse the repository at this point in the history
Analogously to the hypervisor, add a UART driver for Marvel UARTs as
found in the Armada 3720.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
  • Loading branch information
jan-kiszka committed Jul 23, 2017
1 parent 6be4509 commit 58c9c17
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 1 deletion.
2 changes: 1 addition & 1 deletion inmates/lib/arm-common/Makefile.lib
Expand Up @@ -14,7 +14,7 @@ GCOV_PROFILE := n

OBJS-y := ../string.o ../cmdline.o
OBJS-y += printk.o gic.o timer.o
OBJS-y += uart-jailhouse.o uart-pl011.o uart-8250.o uart-xuartps.o
OBJS-y += uart-jailhouse.o uart-pl011.o uart-8250.o uart-xuartps.o uart-mvebu.o
OBJS-$(CONFIG_ARM_GIC_V2) += gic-v2.o
OBJS-$(CONFIG_ARM_GIC_V3) += gic-v3.o

Expand Down
1 change: 1 addition & 0 deletions inmates/lib/arm-common/include/uart.h
Expand Up @@ -27,3 +27,4 @@ extern struct uart_chip uart_jailhouse_ops;
extern struct uart_chip uart_8250_ops;
extern struct uart_chip uart_pl011_ops;
extern struct uart_chip uart_xuartps_ops;
extern struct uart_chip uart_mvebu_ops;
2 changes: 2 additions & 0 deletions inmates/lib/arm-common/printk.c
Expand Up @@ -64,6 +64,8 @@ static void console_init(void)
chip = &uart_pl011_ops;
else if (!strcmp(type, "XUARTPS"))
chip = &uart_xuartps_ops;
else if (!strcmp(type, "MVEBU"))
chip = &uart_mvebu_ops;

if (!chip)
return;
Expand Down
38 changes: 38 additions & 0 deletions inmates/lib/arm-common/uart-mvebu.c
@@ -0,0 +1,38 @@
/*
* Jailhouse, a Linux-based partitioning hypervisor
*
* Copyright (c) Siemens AG, 2017
*
* Authors:
* Jan Kiszka <jan.kiszka@siemens.com>
*
* This work is licensed under the terms of the GNU GPL, version 2. See
* the COPYING file in the top-level directory.
*/

#include <inmate.h>
#include <uart.h>

#define UART_TSH 0x4
#define UART_STAT 0xc
#define UART_STAT_TX_FULL (1 << 11)

static void uart_init(struct uart_chip *chip)
{
}

static bool uart_is_busy(struct uart_chip *chip)
{
return !!(mmio_read32(chip->base + UART_STAT) & UART_STAT_TX_FULL);
}

static void uart_write(struct uart_chip *chip, char c)
{
mmio_write32(chip->base + UART_TSH, c);
}

struct uart_chip uart_mvebu_ops = {
.init = uart_init,
.is_busy = uart_is_busy,
.write = uart_write,
};

0 comments on commit 58c9c17

Please sign in to comment.