Skip to content
Permalink
Browse files

arm: virt: add an Exynos4210 UART to match t8015

The t8015 board has a s3c-compatible UART at 0x22e600000. Add it
to virt to allow printing kernel boot messages.
  • Loading branch information
zhuowei committed Jul 4, 2018
1 parent 63dcaee commit afe05f3a1edf60c148d721faf9613bb1390a2469
Showing with 18 additions and 0 deletions.
  1. +17 −0 hw/arm/virt.c
  2. +1 −0 include/hw/arm/virt.h
@@ -60,6 +60,8 @@
#include "standard-headers/linux/input.h"
#include "hw/arm/smmuv3.h"

#include "hw/arm/exynos4210.h"

#define DEFINE_VIRT_MACHINE_LATEST(major, minor, latest) \
static void virt_##major##_##minor##_class_init(ObjectClass *oc, \
void *data) \
@@ -150,6 +152,7 @@ static const MemMapEntry a15memmap[] = {
[VIRT_PCIE_ECAM] = { 0x3f000000, 0x01000000 },
[VIRT_MEM] = { 0x40000000, RAMLIMIT_BYTES },
/* Additional 64 MB redist region (can contain up to 512 redistributors) */
[VIRT_S3C_UART] = { 0x22e600000, 0x00001000 }, // zhuowei: hack
[VIRT_GIC_REDIST2] = { 0x4000000000ULL, 0x4000000 },
[VIRT_PCIE_ECAM_HIGH] = { 0x4010000000ULL, 0x10000000 },
/* Second PCIe window, 512GB wide at the 512GB boundary */
@@ -162,6 +165,7 @@ static const int a15irqmap[] = {
[VIRT_PCIE] = 3, /* ... to 6 */
[VIRT_GPIO] = 7,
[VIRT_SECURE_UART] = 8,
[VIRT_S3C_UART] = 9,
[VIRT_MMIO] = 16, /* ...to 16 + NUM_VIRTIO_TRANSPORTS - 1 */
[VIRT_GIC_V2M] = 48, /* ...to 48 + NUM_GICV2M_SPIS - 1 */
[VIRT_SMMU] = 74, /* ...to 74 + NUM_SMMU_IRQS - 1 */
@@ -683,6 +687,18 @@ static void create_uart(const VirtMachineState *vms, qemu_irq *pic, int uart,
g_free(nodename);
}

static void create_s3c_uart(const VirtMachineState *vms, qemu_irq *pic, int uart,
MemoryRegion *mem, Chardev *chr)
{
hwaddr base = vms->memmap[uart].base;
int irq = vms->irqmap[uart];

DeviceState *dev = exynos4210_uart_create(base, 256, 0, chr, pic[irq]);
if (!dev) {
abort();
}
}

static void create_rtc(const VirtMachineState *vms, qemu_irq *pic)
{
char *nodename;
@@ -1503,6 +1519,7 @@ static void machvirt_init(MachineState *machine)
create_secure_ram(vms, secure_sysmem);
create_uart(vms, pic, VIRT_SECURE_UART, secure_sysmem, serial_hd(1));
}
create_s3c_uart(vms, pic, VIRT_S3C_UART, sysmem, serial_hd(2));

vms->highmem_ecam &= vms->highmem && (!firmware_loaded || aarch64);

@@ -78,6 +78,7 @@ enum {
VIRT_GPIO,
VIRT_SECURE_UART,
VIRT_SECURE_MEM,
VIRT_S3C_UART,
};

typedef enum VirtIOMMUType {

0 comments on commit afe05f3

Please sign in to comment.
You can’t perform that action at this time.